From fc6500e81991d4fc2651642388d1132f3d67b755 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed, 25 Jan 2023 07:13:01 +1300 Subject: [PATCH] Fix Inpaint Replace Slider --- .../{index-legacy-a65cbb12.js => index-legacy-fd07f069.js} | 2 +- .../dist/assets/{index.6d38ba64.js => index.b451449e.js} | 2 +- frontend/dist/index.html | 4 ++-- .../components/AdvancedOptions/Canvas/InpaintReplace.tsx | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) rename frontend/dist/assets/{index-legacy-a65cbb12.js => index-legacy-fd07f069.js} (94%) rename frontend/dist/assets/{index.6d38ba64.js => index.b451449e.js} (99%) diff --git a/frontend/dist/assets/index-legacy-a65cbb12.js b/frontend/dist/assets/index-legacy-fd07f069.js similarity index 94% rename from frontend/dist/assets/index-legacy-a65cbb12.js rename to frontend/dist/assets/index-legacy-fd07f069.js index 6f547704b0..e17b29e7b8 100644 --- a/frontend/dist/assets/index-legacy-a65cbb12.js +++ b/frontend/dist/assets/index-legacy-fd07f069.js @@ -26,7 +26,7 @@ var Y=a.exports,Z=G.exports;function X(e){for(var t="https://reactjs.org/docs/er * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */!function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",s=16,l=32,c=64,u=128,d=256,h=1/0,f=9007199254740991,p=NaN,g=4294967295,m=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",s],["flip",512],["partial",l],["partialRight",c],["rearg",d]],v="[object Arguments]",y="[object Array]",b="[object Boolean]",x="[object Date]",w="[object Error]",k="[object Function]",S="[object GeneratorFunction]",C="[object Map]",_="[object Number]",E="[object Object]",L="[object Promise]",P="[object RegExp]",O="[object Set]",M="[object String]",T="[object Symbol]",A="[object WeakMap]",I="[object ArrayBuffer]",R="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",z="[object Int8Array]",B="[object Int16Array]",j="[object Int32Array]",F="[object Uint8Array]",H="[object Uint8ClampedArray]",W="[object Uint16Array]",V="[object Uint32Array]",U=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,Z=RegExp(q.source),X=RegExp(Y.source),K=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,re=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(re.source),ie=/^\s+/,ae=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,le=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,de=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,ge=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,ve=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,be=/^(?:0|[1-9]\d*)$/,xe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,we=/($^)/,ke=/['\n\r\u2028\u2029\\]/g,Se="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",Le="A-Z\\xc0-\\xd6\\xd8-\\xde",Pe="\\ufe0e\\ufe0f",Oe="\\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",Me="['’]",Te="["+Se+"]",Ae="["+Oe+"]",Ie="["+Ce+"]",Re="\\d+",Ne="["+_e+"]",De="["+Ee+"]",ze="[^"+Se+Oe+Re+_e+Ee+Le+"]",Be="\\ud83c[\\udffb-\\udfff]",je="[^"+Se+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",He="[\\ud800-\\udbff][\\udc00-\\udfff]",We="["+Le+"]",Ve="\\u200d",Ue="(?:"+De+"|"+ze+")",$e="(?:"+We+"|"+ze+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ye="(?:"+Ie+"|"+Be+")"+"?",Ze="["+Pe+"]?",Xe=Ze+Ye+("(?:"+Ve+"(?:"+[je,Fe,He].join("|")+")"+Ze+Ye+")*"),Ke="(?:"+[Ne,Fe,He].join("|")+")"+Xe,Qe="(?:"+[je+Ie+"?",Ie,Fe,He,Te].join("|")+")",Je=RegExp(Me,"g"),et=RegExp(Ie,"g"),tt=RegExp(Be+"(?="+Be+")|"+Qe+Xe,"g"),nt=RegExp([We+"?"+De+"+"+Ge+"(?="+[Ae,We,"$"].join("|")+")",$e+"+"+qe+"(?="+[Ae,We+Ue,"$"].join("|")+")",We+"?"+Ue+"+"+Ge,We+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Re,Ke].join("|"),"g"),rt=RegExp("["+Ve+Se+Ce+Pe+"]"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["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"],at=-1,st={};st[N]=st[D]=st[z]=st[B]=st[j]=st[F]=st[H]=st[W]=st[V]=!0,st[v]=st[y]=st[I]=st[b]=st[R]=st[x]=st[w]=st[k]=st[C]=st[_]=st[E]=st[P]=st[O]=st[M]=st[A]=!1;var lt={};lt[v]=lt[y]=lt[I]=lt[R]=lt[b]=lt[x]=lt[N]=lt[D]=lt[z]=lt[B]=lt[j]=lt[C]=lt[_]=lt[E]=lt[P]=lt[O]=lt[M]=lt[T]=lt[F]=lt[H]=lt[W]=lt[V]=!0,lt[w]=lt[k]=lt[A]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,dt=parseInt,ht="object"==typeof o&&o&&o.Object===Object&&o,ft="object"==typeof self&&self&&self.Object===Object&&self,pt=ht||ft||Function("return this")(),gt=t&&!t.nodeType&&t,mt=gt&&e&&!e.nodeType&&e,vt=mt&&mt.exports===gt,yt=vt&&ht.process,bt=function(){try{var e=mt&&mt.require&&mt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(j2){}}(),xt=bt&&bt.isArrayBuffer,wt=bt&&bt.isDate,kt=bt&&bt.isMap,St=bt&&bt.isRegExp,Ct=bt&&bt.isSet,_t=bt&&bt.isTypedArray;function Et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Lt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o-1}function It(e,t,n){for(var r=-1,o=null==e?0:e.length;++r-1;);return n}function nn(e,t){for(var n=e.length;n--&&Wt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var on=qt({"À":"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"}),an=qt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+ct[e]}function ln(e){return rt.test(e)}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n",""":'"',"'":"'"});var yn=function e(t){var o,ae=(t=null==t?pt:yn.defaults(pt.Object(),t,yn.pick(pt,it))).Array,Se=t.Date,Ce=t.Error,_e=t.Function,Ee=t.Math,Le=t.Object,Pe=t.RegExp,Oe=t.String,Me=t.TypeError,Te=ae.prototype,Ae=_e.prototype,Ie=Le.prototype,Re=t["__core-js_shared__"],Ne=Ae.toString,De=Ie.hasOwnProperty,ze=0,Be=(o=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"",je=Ie.toString,Fe=Ne.call(Le),He=pt._,We=Pe("^"+Ne.call(De).replace(re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=vt?t.Buffer:n,Ue=t.Symbol,$e=t.Uint8Array,Ge=Ve?Ve.allocUnsafe:n,qe=un(Le.getPrototypeOf,Le),Ye=Le.create,Ze=Ie.propertyIsEnumerable,Xe=Te.splice,Ke=Ue?Ue.isConcatSpreadable:n,Qe=Ue?Ue.iterator:n,tt=Ue?Ue.toStringTag:n,rt=function(){try{var e=pi(Le,"defineProperty");return e({},"",{}),e}catch(j2){}}(),ct=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ht=Se&&Se.now!==pt.Date.now&&Se.now,ft=t.setTimeout!==pt.setTimeout&&t.setTimeout,gt=Ee.ceil,mt=Ee.floor,yt=Le.getOwnPropertySymbols,bt=Ve?Ve.isBuffer:n,jt=t.isFinite,qt=Te.join,bn=un(Le.keys,Le),xn=Ee.max,wn=Ee.min,kn=Se.now,Sn=t.parseInt,Cn=Ee.random,_n=Te.reverse,En=pi(t,"DataView"),Ln=pi(t,"Map"),Pn=pi(t,"Promise"),On=pi(t,"Set"),Mn=pi(t,"WeakMap"),Tn=pi(Le,"create"),An=Mn&&new Mn,In={},Rn=Hi(En),Nn=Hi(Ln),Dn=Hi(Pn),zn=Hi(On),Bn=Hi(Mn),jn=Ue?Ue.prototype:n,Fn=jn?jn.valueOf:n,Hn=jn?jn.toString:n;function Wn(e){if(os(e)&&!qa(e)&&!(e instanceof Gn)){if(e instanceof $n)return e;if(De.call(e,"__wrapped__"))return Wi(e)}return new $n(e)}var Vn=function(){function e(){}return function(t){if(!rs(t))return{};if(Ye)return Ye(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Un(){}function $n(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Gn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ur(e,t,r,o,i,a){var s,l=1&t,c=2&t,u=4&t;if(r&&(s=i?r(e,o,i,a):r(e)),s!==n)return s;if(!rs(e))return e;var d=qa(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&De.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!l)return Ao(e,s)}else{var h=vi(e),f=h==k||h==S;if(Ka(e))return Eo(e,l);if(h==E||h==v||f&&!i){if(s=c||f?{}:bi(e),!l)return c?function(e,t){return Io(e,mi(e),t)}(e,function(e,t){return e&&Io(t,Ns(t),e)}(s,e)):function(e,t){return Io(e,gi(e),t)}(e,ar(s,e))}else{if(!lt[h])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case I:return Lo(e);case b:case x:return new r(+e);case R:return function(e,t){var n=t?Lo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case D:case z:case B:case j:case F:case H:case W:case V:return Po(e,n);case C:return new r;case _:case M:return new r(e);case P:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case O:return new r;case T:return o=e,Fn?Le(Fn.call(o)):{}}var o}(e,h,l)}}a||(a=new Kn);var p=a.get(e);if(p)return p;a.set(e,s),cs(e)?e.forEach((function(n){s.add(ur(n,t,r,n,e,a))})):is(e)&&e.forEach((function(n,o){s.set(o,ur(n,t,r,o,e,a))}));var g=d?n:(u?c?si:ai:c?Ns:Rs)(e);return Pt(g||e,(function(n,o){g&&(n=e[o=n]),rr(s,o,ur(n,t,r,o,e,a))})),s}function dr(e,t,r){var o=r.length;if(null==e)return!o;for(e=Le(e);o--;){var i=r[o],a=t[i],s=e[i];if(s===n&&!(i in e)||!a(s))return!1}return!0}function hr(e,t,o){if("function"!=typeof e)throw new Me(r);return Ri((function(){e.apply(n,o)}),t)}function fr(e,t,n,r){var o=-1,i=At,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;n&&(t=Rt(t,Qt(n))),r?(i=It,a=!1):t.length>=200&&(i=en,a=!1,t=new Xn(t));e:for(;++o-1},Yn.prototype.set=function(e,t){var n=this.__data__,r=or(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Zn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(Ln||Yn),string:new qn}},Zn.prototype.delete=function(e){var t=hi(this,e).delete(e);return this.size-=t?1:0,t},Zn.prototype.get=function(e){return hi(this,e).get(e)},Zn.prototype.has=function(e){return hi(this,e).has(e)},Zn.prototype.set=function(e,t){var n=hi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(e){return this.__data__.set(e,i),this},Xn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new Yn,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Yn){var r=n.__data__;if(!Ln||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Zn(r)}return n.set(e,t),this.size=n.size,this};var pr=Do(kr),gr=Do(Sr,!0);function mr(e,t){var n=!0;return pr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function vr(e,t,r){for(var o=-1,i=e.length;++o0&&n(s)?t>1?br(s,t-1,n,r,o):Nt(o,s):r||(o[o.length]=s)}return o}var xr=zo(),wr=zo(!0);function kr(e,t){return e&&xr(e,t,Rs)}function Sr(e,t){return e&&wr(e,t,Rs)}function Cr(e,t){return Tt(t,(function(t){return es(e[t])}))}function _r(e,t){for(var r=0,o=(t=ko(t,e)).length;null!=e&&rt}function Or(e,t){return null!=e&&De.call(e,t)}function Mr(e,t){return null!=e&&t in Le(e)}function Tr(e,t,r){for(var o=r?It:At,i=e[0].length,a=e.length,s=a,l=ae(a),c=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Rt(d,Qt(t))),c=wn(d.length,c),l[s]=!r&&(t||i>=120&&d.length>=120)?new Xn(s&&d):n}d=e[0];var h=-1,f=l[0];e:for(;++h=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function qr(e,t,n){for(var r=-1,o=t.length,i={};++r-1;)s!==e&&Xe.call(s,l,1),Xe.call(e,l,1);return e}function Zr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;wi(o)?Xe.call(e,o,1):po(e,o)}}return e}function Xr(e,t){return e+mt(Cn()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Qr(e,t){return Ni(Oi(e,t,al),e+"")}function Jr(e){return Jn(Vs(e))}function eo(e,t){var n=Vs(e);return Bi(n,cr(t,0,n.length))}function to(e,t,r,o){if(!rs(e))return e;for(var i=-1,a=(t=ko(t,e)).length,s=a-1,l=e;null!=l&&++io?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=ae(o);++r>>1,a=e[i];null!==a&&!ds(a)&&(n?a<=t:a=200){var c=t?null:Qo(e);if(c)return hn(c);a=!1,o=en,l=new Xn}else l=t?[]:s;e:for(;++r=o?e:io(e,t,r)}var _o=ct||function(e){return pt.clearTimeout(e)};function Eo(e,t){if(t)return e.slice();var n=e.length,r=Ge?Ge(n):new e.constructor(n);return e.copy(r),r}function Lo(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Po(e,t){var n=t?Lo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Oo(e,t){if(e!==t){var r=e!==n,o=null===e,i=e==e,a=ds(e),s=t!==n,l=null===t,c=t==t,u=ds(t);if(!l&&!u&&!a&&e>t||a&&s&&c&&!l&&!u||o&&s&&c||!r&&c||!i)return 1;if(!o&&!a&&!u&&e1?r[i-1]:n,s=i>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(i--,a):n,s&&ki(r[0],r[1],s)&&(a=i<3?n:a,i=1),t=Le(t);++o-1?i[a?t[s]:s]:n}}function Wo(e){return ii((function(t){var o=t.length,i=o,a=$n.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new Me(r);if(a&&!l&&"wrapper"==ci(s))var l=new $n([],!0)}for(i=l?i:o;++i1&&y.reverse(),h&&cl))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&r?new Xn:n;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Pt(m,(function(n){var r="_."+n[0];t&n[1]&&!At(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(le);return t?t[1].split(ce):[]}(r),n)))}function zi(e){var t=0,r=0;return function(){var o=kn(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Bi(e,t){var r=-1,o=e.length,i=o-1;for(t=t===n?o:t;++r1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,la(e,r)}));function ga(e){var t=Wn(e);return t.__chain__=!0,t}function ma(e,t){return t(e)}var va=ii((function(e){var t=e.length,r=t?e[0]:0,o=this.__wrapped__,i=function(t){return lr(t,e)};return!(t>1||this.__actions__.length)&&o instanceof Gn&&wi(r)?((o=o.slice(r,+r+(t?1:0))).__actions__.push({func:ma,args:[i],thisArg:n}),new $n(o,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(i)}));var ya=Ro((function(e,t,n){De.call(e,n)?++e[n]:sr(e,n,1)}));var ba=Ho(Gi),xa=Ho(qi);function wa(e,t){return(qa(e)?Pt:pr)(e,di(t,3))}function ka(e,t){return(qa(e)?Ot:gr)(e,di(t,3))}var Sa=Ro((function(e,t,n){De.call(e,n)?e[n].push(t):sr(e,n,[t])}));var Ca=Qr((function(e,t,n){var r=-1,o="function"==typeof t,i=Za(e)?ae(e.length):[];return pr(e,(function(e){i[++r]=o?Et(t,e,n):Ar(e,t,n)})),i})),_a=Ro((function(e,t,n){sr(e,n,t)}));function Ea(e,t){return(qa(e)?Rt:Hr)(e,di(t,3))}var La=Ro((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Pa=Qr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ki(e,t[0],t[1])?t=[]:n>2&&ki(t[0],t[1],t[2])&&(t=[t[0]]),Gr(e,br(t,1),[])})),Oa=ht||function(){return pt.Date.now()};function Ma(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,ei(e,u,n,n,n,n,t)}function Ta(e,t){var o;if("function"!=typeof t)throw new Me(r);return e=vs(e),function(){return--e>0&&(o=t.apply(this,arguments)),e<=1&&(t=n),o}}var Aa=Qr((function(e,t,n){var r=1;if(n.length){var o=dn(n,ui(Aa));r|=l}return ei(e,r,t,n,o)})),Ia=Qr((function(e,t,n){var r=3;if(n.length){var o=dn(n,ui(Ia));r|=l}return ei(t,r,e,n,o)}));function Ra(e,t,o){var i,a,s,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Me(r);function g(t){var r=i,o=a;return i=a=n,d=t,l=e.apply(o,r)}function m(e){return d=e,c=Ri(y,t),h?g(e):l}function v(e){var r=e-u;return u===n||r>=t||r<0||f&&e-d>=s}function y(){var e=Oa();if(v(e))return b(e);c=Ri(y,function(e){var n=t-(e-u);return f?wn(n,s-(e-d)):n}(e))}function b(e){return c=n,p&&i?g(e):(i=a=n,l)}function x(){var e=Oa(),r=v(e);if(i=arguments,a=this,u=e,r){if(c===n)return m(u);if(f)return _o(c),c=Ri(y,t),g(u)}return c===n&&(c=Ri(y,t)),l}return t=bs(t)||0,rs(o)&&(h=!!o.leading,s=(f="maxWait"in o)?xn(bs(o.maxWait)||0,t):s,p="trailing"in o?!!o.trailing:p),x.cancel=function(){c!==n&&_o(c),d=0,i=u=a=c=n},x.flush=function(){return c===n?l:b(Oa())},x}var Na=Qr((function(e,t){return hr(e,1,t)})),Da=Qr((function(e,t,n){return hr(e,bs(t)||0,n)}));function za(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Me(r);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(za.Cache||Zn),n}function Ba(e){if("function"!=typeof e)throw new Me(r);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)}}za.Cache=Zn;var ja=So((function(e,t){var n=(t=1==t.length&&qa(t[0])?Rt(t[0],Qt(di())):Rt(br(t,1),Qt(di()))).length;return Qr((function(r){for(var o=-1,i=wn(r.length,n);++o=t})),Ga=Ir(function(){return arguments}())?Ir:function(e){return os(e)&&De.call(e,"callee")&&!Ze.call(e,"callee")},qa=ae.isArray,Ya=xt?Qt(xt):function(e){return os(e)&&Lr(e)==I};function Za(e){return null!=e&&ns(e.length)&&!es(e)}function Xa(e){return os(e)&&Za(e)}var Ka=bt||bl,Qa=wt?Qt(wt):function(e){return os(e)&&Lr(e)==x};function Ja(e){if(!os(e))return!1;var t=Lr(e);return t==w||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ss(e)}function es(e){if(!rs(e))return!1;var t=Lr(e);return t==k||t==S||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ts(e){return"number"==typeof e&&e==vs(e)}function ns(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function rs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function os(e){return null!=e&&"object"==typeof e}var is=kt?Qt(kt):function(e){return os(e)&&vi(e)==C};function as(e){return"number"==typeof e||os(e)&&Lr(e)==_}function ss(e){if(!os(e)||Lr(e)!=E)return!1;var t=qe(e);if(null===t)return!0;var n=De.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==Fe}var ls=St?Qt(St):function(e){return os(e)&&Lr(e)==P};var cs=Ct?Qt(Ct):function(e){return os(e)&&vi(e)==O};function us(e){return"string"==typeof e||!qa(e)&&os(e)&&Lr(e)==M}function ds(e){return"symbol"==typeof e||os(e)&&Lr(e)==T}var hs=_t?Qt(_t):function(e){return os(e)&&ns(e.length)&&!!st[Lr(e)]};var fs=Zo(Fr),ps=Zo((function(e,t){return e<=t}));function gs(e){if(!e)return[];if(Za(e))return us(e)?gn(e):Ao(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=vi(e);return(t==C?cn:t==O?hn:Vs)(e)}function ms(e){return e?(e=bs(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function vs(e){var t=ms(e),n=t%1;return t==t?n?t-n:t:0}function ys(e){return e?cr(vs(e),0,g):0}function bs(e){if("number"==typeof e)return e;if(ds(e))return p;if(rs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=rs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=me.test(e);return n||ye.test(e)?dt(e.slice(2),n?2:8):ge.test(e)?p:+e}function xs(e){return Io(e,Ns(e))}function ws(e){return null==e?"":ho(e)}var ks=No((function(e,t){if(Ei(t)||Za(t))Io(t,Rs(t),e);else for(var n in t)De.call(t,n)&&rr(e,n,t[n])})),Ss=No((function(e,t){Io(t,Ns(t),e)})),Cs=No((function(e,t,n,r){Io(t,Ns(t),e,r)})),_s=No((function(e,t,n,r){Io(t,Rs(t),e,r)})),Es=ii(lr);var Ls=Qr((function(e,t){e=Le(e);var r=-1,o=t.length,i=o>2?t[2]:n;for(i&&ki(t[0],t[1],i)&&(o=1);++r1),t})),Io(e,si(e),n),r&&(n=ur(n,7,ri));for(var o=t.length;o--;)po(n,t[o]);return n}));var js=ii((function(e,t){return null==e?{}:function(e,t){return qr(e,t,(function(t,n){return Ms(e,n)}))}(e,t)}));function Fs(e,t){if(null==e)return{};var n=Rt(si(e),(function(e){return[e]}));return t=di(t),qr(e,n,(function(e,n){return t(e,n[0])}))}var Hs=Jo(Rs),Ws=Jo(Ns);function Vs(e){return null==e?[]:Jt(e,Rs(e))}var Us=jo((function(e,t,n){return t=t.toLowerCase(),e+(n?$s(t):t)}));function $s(e){return Js(ws(e).toLowerCase())}function Gs(e){return(e=ws(e))&&e.replace(xe,on).replace(et,"")}var qs=jo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ys=jo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Zs=Bo("toLowerCase");var Xs=jo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Ks=jo((function(e,t,n){return e+(n?" ":"")+Js(t)}));var Qs=jo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Js=Bo("toUpperCase");function el(e,t,r){return e=ws(e),(t=r?n:t)===n?function(e){return ot.test(e)}(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var tl=Qr((function(e,t){try{return Et(e,n,t)}catch(j2){return Ja(j2)?j2:new Ce(j2)}})),nl=ii((function(e,t){return Pt(t,(function(t){t=Fi(t),sr(e,t,Aa(e[t],e))})),e}));function rl(e){return function(){return e}}var ol=Wo(),il=Wo(!0);function al(e){return e}function sl(e){return zr("function"==typeof e?e:ur(e,1))}var ll=Qr((function(e,t){return function(n){return Ar(n,e,t)}})),cl=Qr((function(e,t){return function(n){return Ar(e,n,t)}}));function ul(e,t,n){var r=Rs(t),o=Cr(t,r);null!=n||rs(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Cr(t,Rs(t)));var i=!(rs(n)&&"chain"in n&&!n.chain),a=es(e);return Pt(o,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),o=n.__actions__=Ao(this.__actions__);return o.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Nt([this.value()],arguments))})})),e}function dl(){}var hl=Go(Rt),fl=Go(Mt),pl=Go(Bt);function gl(e){return Si(e)?Gt(Fi(e)):function(e){return function(t){return _r(t,e)}}(e)}var ml=Yo(),vl=Yo(!0);function yl(){return[]}function bl(){return!1}var xl=$o((function(e,t){return e+t}),0),wl=Ko("ceil"),kl=$o((function(e,t){return e/t}),1),Sl=Ko("floor");var Cl,_l=$o((function(e,t){return e*t}),1),El=Ko("round"),Ll=$o((function(e,t){return e-t}),0);return Wn.after=function(e,t){if("function"!=typeof t)throw new Me(r);return e=vs(e),function(){if(--e<1)return t.apply(this,arguments)}},Wn.ary=Ma,Wn.assign=ks,Wn.assignIn=Ss,Wn.assignInWith=Cs,Wn.assignWith=_s,Wn.at=Es,Wn.before=Ta,Wn.bind=Aa,Wn.bindAll=nl,Wn.bindKey=Ia,Wn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qa(e)?e:[e]},Wn.chain=ga,Wn.chunk=function(e,t,r){t=(r?ki(e,t,r):t===n)?1:xn(vs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var i=0,a=0,s=ae(gt(o/t));ii?0:i+r),(o=o===n||o>i?i:vs(o))<0&&(o+=i),o=r>o?0:ys(o);r>>0)?(e=ws(e))&&("string"==typeof t||null!=t&&!ls(t))&&!(t=ho(t))&&ln(e)?Co(gn(e),0,r):e.split(t,r):[]},Wn.spread=function(e,t){if("function"!=typeof e)throw new Me(r);return t=null==t?0:xn(vs(t),0),Qr((function(n){var r=n[t],o=Co(n,0,t);return r&&Nt(o,r),Et(e,this,o)}))},Wn.tail=function(e){var t=null==e?0:e.length;return t?io(e,1,t):[]},Wn.take=function(e,t,r){return e&&e.length?io(e,0,(t=r||t===n?1:vs(t))<0?0:t):[]},Wn.takeRight=function(e,t,r){var o=null==e?0:e.length;return o?io(e,(t=o-(t=r||t===n?1:vs(t)))<0?0:t,o):[]},Wn.takeRightWhile=function(e,t){return e&&e.length?mo(e,di(t,3),!1,!0):[]},Wn.takeWhile=function(e,t){return e&&e.length?mo(e,di(t,3)):[]},Wn.tap=function(e,t){return t(e),e},Wn.throttle=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new Me(r);return rs(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),Ra(e,t,{leading:o,maxWait:t,trailing:i})},Wn.thru=ma,Wn.toArray=gs,Wn.toPairs=Hs,Wn.toPairsIn=Ws,Wn.toPath=function(e){return qa(e)?Rt(e,Fi):ds(e)?[e]:Ao(ji(ws(e)))},Wn.toPlainObject=xs,Wn.transform=function(e,t,n){var r=qa(e),o=r||Ka(e)||hs(e);if(t=di(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:rs(e)&&es(i)?Vn(qe(e)):{}}return(o?Pt:kr)(e,(function(e,r,o){return t(n,e,r,o)})),n},Wn.unary=function(e){return Ma(e,1)},Wn.union=oa,Wn.unionBy=ia,Wn.unionWith=aa,Wn.uniq=function(e){return e&&e.length?fo(e):[]},Wn.uniqBy=function(e,t){return e&&e.length?fo(e,di(t,2)):[]},Wn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?fo(e,n,t):[]},Wn.unset=function(e,t){return null==e||po(e,t)},Wn.unzip=sa,Wn.unzipWith=la,Wn.update=function(e,t,n){return null==e?e:go(e,t,wo(n))},Wn.updateWith=function(e,t,r,o){return o="function"==typeof o?o:n,null==e?e:go(e,t,wo(r),o)},Wn.values=Vs,Wn.valuesIn=function(e){return null==e?[]:Jt(e,Ns(e))},Wn.without=ca,Wn.words=el,Wn.wrap=function(e,t){return Fa(wo(t),e)},Wn.xor=ua,Wn.xorBy=da,Wn.xorWith=ha,Wn.zip=fa,Wn.zipObject=function(e,t){return bo(e||[],t||[],rr)},Wn.zipObjectDeep=function(e,t){return bo(e||[],t||[],to)},Wn.zipWith=pa,Wn.entries=Hs,Wn.entriesIn=Ws,Wn.extend=Ss,Wn.extendWith=Cs,ul(Wn,Wn),Wn.add=xl,Wn.attempt=tl,Wn.camelCase=Us,Wn.capitalize=$s,Wn.ceil=wl,Wn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=bs(r))==r?r:0),t!==n&&(t=(t=bs(t))==t?t:0),cr(bs(e),t,r)},Wn.clone=function(e){return ur(e,4)},Wn.cloneDeep=function(e){return ur(e,5)},Wn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:n)},Wn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:n)},Wn.conformsTo=function(e,t){return null==t||dr(e,t,Rs(t))},Wn.deburr=Gs,Wn.defaultTo=function(e,t){return null==e||e!=e?t:e},Wn.divide=kl,Wn.endsWith=function(e,t,r){e=ws(e),t=ho(t);var o=e.length,i=r=r===n?o:cr(vs(r),0,o);return(r-=t.length)>=0&&e.slice(r,i)==t},Wn.eq=Va,Wn.escape=function(e){return(e=ws(e))&&X.test(e)?e.replace(Y,an):e},Wn.escapeRegExp=function(e){return(e=ws(e))&&oe.test(e)?e.replace(re,"\\$&"):e},Wn.every=function(e,t,r){var o=qa(e)?Mt:mr;return r&&ki(e,t,r)&&(t=n),o(e,di(t,3))},Wn.find=ba,Wn.findIndex=Gi,Wn.findKey=function(e,t){return Ft(e,di(t,3),kr)},Wn.findLast=xa,Wn.findLastIndex=qi,Wn.findLastKey=function(e,t){return Ft(e,di(t,3),Sr)},Wn.floor=Sl,Wn.forEach=wa,Wn.forEachRight=ka,Wn.forIn=function(e,t){return null==e?e:xr(e,di(t,3),Ns)},Wn.forInRight=function(e,t){return null==e?e:wr(e,di(t,3),Ns)},Wn.forOwn=function(e,t){return e&&kr(e,di(t,3))},Wn.forOwnRight=function(e,t){return e&&Sr(e,di(t,3))},Wn.get=Os,Wn.gt=Ua,Wn.gte=$a,Wn.has=function(e,t){return null!=e&&yi(e,t,Or)},Wn.hasIn=Ms,Wn.head=Zi,Wn.identity=al,Wn.includes=function(e,t,n,r){e=Za(e)?e:Vs(e),n=n&&!r?vs(n):0;var o=e.length;return n<0&&(n=xn(o+n,0)),us(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Wt(e,t,n)>-1},Wn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:vs(n);return o<0&&(o=xn(r+o,0)),Wt(e,t,o)},Wn.inRange=function(e,t,r){return t=ms(t),r===n?(r=t,t=0):r=ms(r),function(e,t,n){return e>=wn(t,n)&&e=-9007199254740991&&e<=f},Wn.isSet=cs,Wn.isString=us,Wn.isSymbol=ds,Wn.isTypedArray=hs,Wn.isUndefined=function(e){return e===n},Wn.isWeakMap=function(e){return os(e)&&vi(e)==A},Wn.isWeakSet=function(e){return os(e)&&"[object WeakSet]"==Lr(e)},Wn.join=function(e,t){return null==e?"":qt.call(e,t)},Wn.kebabCase=qs,Wn.last=Ji,Wn.lastIndexOf=function(e,t,r){var o=null==e?0:e.length;if(!o)return-1;var i=o;return r!==n&&(i=(i=vs(r))<0?xn(o+i,0):wn(i,o-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):Ht(e,Ut,i,!0)},Wn.lowerCase=Ys,Wn.lowerFirst=Zs,Wn.lt=fs,Wn.lte=ps,Wn.max=function(e){return e&&e.length?vr(e,al,Pr):n},Wn.maxBy=function(e,t){return e&&e.length?vr(e,di(t,2),Pr):n},Wn.mean=function(e){return $t(e,al)},Wn.meanBy=function(e,t){return $t(e,di(t,2))},Wn.min=function(e){return e&&e.length?vr(e,al,Fr):n},Wn.minBy=function(e,t){return e&&e.length?vr(e,di(t,2),Fr):n},Wn.stubArray=yl,Wn.stubFalse=bl,Wn.stubObject=function(){return{}},Wn.stubString=function(){return""},Wn.stubTrue=function(){return!0},Wn.multiply=_l,Wn.nth=function(e,t){return e&&e.length?$r(e,vs(t)):n},Wn.noConflict=function(){return pt._===this&&(pt._=He),this},Wn.noop=dl,Wn.now=Oa,Wn.pad=function(e,t,n){e=ws(e);var r=(t=vs(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return qo(mt(o),n)+e+qo(gt(o),n)},Wn.padEnd=function(e,t,n){e=ws(e);var r=(t=vs(t))?pn(e):0;return t&&rt){var o=e;e=t,t=o}if(r||e%1||t%1){var i=Cn();return wn(e+i*(t-e+ut("1e-"+((i+"").length-1))),t)}return Xr(e,t)},Wn.reduce=function(e,t,n){var r=qa(e)?Dt:Yt,o=arguments.length<3;return r(e,di(t,4),n,o,pr)},Wn.reduceRight=function(e,t,n){var r=qa(e)?zt:Yt,o=arguments.length<3;return r(e,di(t,4),n,o,gr)},Wn.repeat=function(e,t,r){return t=(r?ki(e,t,r):t===n)?1:vs(t),Kr(ws(e),t)},Wn.replace=function(){var e=arguments,t=ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Wn.result=function(e,t,r){var o=-1,i=(t=ko(t,e)).length;for(i||(i=1,e=n);++of)return[];var n=g,r=wn(e,g);t=di(t),e-=g;for(var o=Xt(r,t);++n=a)return e;var l=r-pn(o);if(l<1)return o;var c=s?Co(s,0,l).join(""):e.slice(0,l);if(i===n)return c+o;if(s&&(l+=c.length-l),ls(i)){if(e.slice(l).search(i)){var u,d=c;for(i.global||(i=Pe(i.source,ws(pe.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var h=u.index;c=c.slice(0,h===n?l:h)}}else if(e.indexOf(ho(i),l)!=l){var f=c.lastIndexOf(i);f>-1&&(c=c.slice(0,f))}return c+o},Wn.unescape=function(e){return(e=ws(e))&&Z.test(e)?e.replace(q,vn):e},Wn.uniqueId=function(e){var t=++ze;return ws(e)+t},Wn.upperCase=Qs,Wn.upperFirst=Js,Wn.each=wa,Wn.eachRight=ka,Wn.first=Zi,ul(Wn,(Cl={},kr(Wn,(function(e,t){De.call(Wn.prototype,t)||(Cl[t]=e)})),Cl),{chain:!1}),Wn.VERSION="4.17.21",Pt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Wn[e].placeholder=Wn})),Pt(["drop","take"],(function(e,t){Gn.prototype[e]=function(r){r=r===n?1:xn(vs(r),0);var o=this.__filtered__&&!t?new Gn(this):this.clone();return o.__filtered__?o.__takeCount__=wn(r,o.__takeCount__):o.__views__.push({size:wn(r,g),type:e+(o.__dir__<0?"Right":"")}),o},Gn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Pt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Gn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:di(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Pt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Gn.prototype[e]=function(){return this[n](1).value()[0]}})),Pt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Gn.prototype[e]=function(){return this.__filtered__?new Gn(this):this[n](1)}})),Gn.prototype.compact=function(){return this.filter(al)},Gn.prototype.find=function(e){return this.filter(e).head()},Gn.prototype.findLast=function(e){return this.reverse().find(e)},Gn.prototype.invokeMap=Qr((function(e,t){return"function"==typeof e?new Gn(this):this.map((function(n){return Ar(n,e,t)}))})),Gn.prototype.reject=function(e){return this.filter(Ba(di(e)))},Gn.prototype.slice=function(e,t){e=vs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Gn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=vs(t))<0?r.dropRight(-t):r.take(t-e)),r)},Gn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Gn.prototype.toArray=function(){return this.take(g)},kr(Gn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),i=Wn[o?"take"+("last"==t?"Right":""):t],a=o||/^find/.test(t);i&&(Wn.prototype[t]=function(){var t=this.__wrapped__,s=o?[1]:arguments,l=t instanceof Gn,c=s[0],u=l||qa(t),d=function(e){var t=i.apply(Wn,Nt([e],s));return o&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=a&&!h,g=l&&!f;if(!a&&u){t=g?t:new Gn(this);var m=e.apply(t,s);return m.__actions__.push({func:ma,args:[d],thisArg:n}),new $n(m,h)}return p&&g?e.apply(this,s):(m=this.thru(d),p?o?m.value()[0]:m.value():m)})})),Pt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Wn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(qa(o)?o:[],e)}return this[n]((function(n){return t.apply(qa(n)?n:[],e)}))}})),kr(Gn.prototype,(function(e,t){var n=Wn[t];if(n){var r=n.name+"";De.call(In,r)||(In[r]=[]),In[r].push({name:t,func:n})}})),In[Vo(n,2).name]=[{name:"wrapper",func:n}],Gn.prototype.clone=function(){var e=new Gn(this.__wrapped__);return e.__actions__=Ao(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ao(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ao(this.__views__),e},Gn.prototype.reverse=function(){if(this.__filtered__){var e=new Gn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Gn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qa(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Wn.prototype.plant=function(e){for(var t,r=this;r instanceof Un;){var o=Wi(r);o.__index__=0,o.__values__=n,t?i.__wrapped__=o:t=o;var i=o;r=r.__wrapped__}return i.__wrapped__=e,t},Wn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Gn){var t=e;return this.__actions__.length&&(t=new Gn(this)),(t=t.reverse()).__actions__.push({func:ma,args:[ra],thisArg:n}),new $n(t,this.__chain__)}return this.thru(ra)},Wn.prototype.toJSON=Wn.prototype.valueOf=Wn.prototype.value=function(){return vo(this.__wrapped__,this.__actions__)},Wn.prototype.first=Wn.prototype.head,Qe&&(Wn.prototype[Qe]=function(){return this}),Wn}();mt?((mt.exports=yn)._=yn,gt._=yn):pt._=yn}).call(o)}(T$,T$.exports);const A$=T$.exports,I$=AV({name:"gallery",initialState:{currentImageUuid:"",shouldPinGallery:!0,shouldShowGallery:!0,galleryScrollPosition:0,galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldHoldGalleryOpen:!1,shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},reducers:{setCurrentImage:(e,t)=>{e.currentImage=t.payload,e.currentImageUuid=t.payload.uuid},removeImage:(e,t)=>{const{uuid:n,category:r}=t.payload,o=e.categories[r].images,i=o.filter((e=>e.uuid!==n));if(n===e.currentImageUuid){const t=o.findIndex((e=>e.uuid===n)),r=T$.exports.clamp(t,0,i.length-1);e.currentImage=i.length?i[r]:void 0,e.currentImageUuid=i.length?i[r].uuid:""}e.categories[r].images=i},addImage:(e,t)=>{const{image:n,category:r}=t.payload,{uuid:o,url:i,mtime:a}=n,s=e.categories[r];s.images.find((e=>e.url===i&&e.mtime===a))||(s.images.unshift(n),e.shouldAutoSwitchToNewImages&&(e.currentImageUuid=o,e.currentImage=n,e.currentCategory=r),e.intermediateImage=void 0,s.latest_mtime=a)},setIntermediateImage:(e,t)=>{e.intermediateImage=t.payload},clearIntermediateImage:e=>{e.intermediateImage=void 0},selectNextImage:e=>{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex((e=>e.uuid===t.uuid));if(r{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex((e=>e.uuid===t.uuid));if(r>0){const t=n[r-1];e.currentImage=t,e.currentImageUuid=t.uuid}}},addGalleryImages:(e,t)=>{const{images:n,areMoreImagesAvailable:r,category:o}=t.payload,i=e.categories[o].images;if(n.length>0){const t=n.filter((e=>!i.find((t=>t.url===e.url&&t.mtime===e.mtime))));if(e.categories[o].images=i.concat(t).sort(((e,t)=>t.mtime-e.mtime)),!e.currentImage){const t=n[0];e.currentImage=t,e.currentImageUuid=t.uuid}e.categories[o].latest_mtime=n[0].mtime,e.categories[o].earliest_mtime=n[n.length-1].mtime}void 0!==r&&(e.categories[o].areMoreImagesAvailable=r)},setShouldPinGallery:(e,t)=>{e.shouldPinGallery=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},setGalleryScrollPosition:(e,t)=>{e.galleryScrollPosition=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},setGalleryImageObjectFit:(e,t)=>{e.galleryImageObjectFit=t.payload},setShouldHoldGalleryOpen:(e,t)=>{e.shouldHoldGalleryOpen=t.payload},setShouldAutoSwitchToNewImages:(e,t)=>{e.shouldAutoSwitchToNewImages=t.payload},setCurrentCategory:(e,t)=>{e.currentCategory=t.payload},setGalleryWidth:(e,t)=>{e.galleryWidth=t.payload},setShouldUseSingleGalleryColumn:(e,t)=>{e.shouldUseSingleGalleryColumn=t.payload}}}),{addImage:R$,clearIntermediateImage:N$,removeImage:D$,setCurrentImage:z$,addGalleryImages:B$,setIntermediateImage:j$,selectNextImage:F$,selectPrevImage:H$,setShouldPinGallery:W$,setShouldShowGallery:V$,setGalleryScrollPosition:U$,setGalleryImageMinimumWidth:$$,setGalleryImageObjectFit:G$,setShouldHoldGalleryOpen:q$,setShouldAutoSwitchToNewImages:Y$,setCurrentCategory:Z$,setGalleryWidth:X$,setShouldUseSingleGalleryColumn:K$}=I$.actions,Q$=I$.reducer;function J$(e){return J$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J$(e)}function eG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tG(e){var t=function(e,t){if("object"!==J$(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==J$(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===J$(t)?t:String(t)}function nG(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{};eG(this,e),this.init(t,n)}return rG(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||pG,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(o())return{};var a=r(i.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return o()?{}:{obj:e,k:r(i.shift())}}function kG(e,t,n){var r=wG(e,t,Object);r.obj[r.k]=n}function SG(e,t){var n=wG(e,t),r=n.obj,o=n.k;if(r)return r[o]}function CG(e,t,n){var r=SG(e,n);return void 0!==r?r:SG(t,n)}function _G(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):_G(e[r],t[r],n):e[r]=t[r]);return e}function EG(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var LG={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function PG(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return LG[e]})):e}var OG="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,MG=[" ",",","?","!",";"];function TG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function AG(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;ii+a;)a++,l=o[s=r.slice(i,i+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var c=r.slice(i+a).join(n);return c?RG(l,c,n):void 0}o=o[r[i]]}return o}}var NG=function(e){aG(n,e);var t=IG(n);function n(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return eG(this,n),r=t.call(this),OG&&vG.call(oG(r)),r.data=e||{},r.options=o,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return rG(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=SG(this.data,a);return s||!i||"string"!=typeof n?s:RG(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),kG(this.data,a,r),o.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=SG(this.data,a)||{};r?_G(s,n,o):s=AG(AG({},s),n),kG(this.data,a,s),i.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?AG(AG({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(vG),DG={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,o){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r,o))})),t}};function zG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function BG(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};return eG(this,n),r=t.call(this),OG&&vG.call(oG(r)),xG(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,oG(r)),r.options=o,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=mG.create("translator"),r}return rG(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],i=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=MG.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var o=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),i=!o.test(e);if(!i){var a=e.indexOf(n);a>0&&!o.test(e.substring(0,a))&&(i=!0)}return i}(e,n,r));if(i&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:o};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(r)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,t,r){var o=this;if("object"!==J$(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var i=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var f=t.nsSeparator||this.options.nsSeparator;return i?(p.res="".concat(u).concat(f).concat(l),p):"".concat(u).concat(f).concat(l)}return i?(p.res=l,p):l}var p=this.resolve(e,t),g=p&&p.res,m=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,y=Object.prototype.toString.apply(g),b=["[object Number]","[object Function]","[object RegExp]"],x=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,k="string"!=typeof g&&"boolean"!=typeof g&&"number"!=typeof g;if(w&&g&&k&&b.indexOf(y)<0&&("string"!=typeof x||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,g,BG(BG({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return i?(p.res=S,p):S}if(a){var C="[object Array]"===y,_=C?[]:{},E=C?v:m;for(var L in g)if(Object.prototype.hasOwnProperty.call(g,L)){var P="".concat(E).concat(a).concat(L);_[L]=this.translate(P,BG(BG({},t),{joinArrays:!1,ns:c})),_[L]===P&&(_[L]=g[L])}g=_}}else if(w&&"string"==typeof x&&"[object Array]"===y)(g=g.join(x))&&(g=this.extendTranslation(g,e,t,r));else{var O=!1,M=!1,T=void 0!==t.count&&"string"!=typeof t.count,A=n.hasDefaultValue(t),I=T?this.pluralResolver.getSuffix(d,t.count,t):"",R=t["defaultValue".concat(I)]||t.defaultValue;!this.isValidLookup(g)&&A&&(O=!0,g=R),this.isValidLookup(g)||(M=!0,g=l);var N=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,D=N&&M?void 0:g,z=A&&R!==g&&this.options.updateMissing;if(M||O||z){if(this.logger.log(z?"updateKey":"missingKey",d,u,l,z?R:g),a){var B=this.resolve(l,BG(BG({},t),{},{keySeparator:!1}));B&&B.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var j=[],F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&F&&F[0])for(var H=0;H1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,h=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),f=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(i=e,!FG["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(FG["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){o=n;var i,l=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,c,n,e,s);else{var u;d&&(u=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+p)),f){var g="".concat(c).concat(a.options.contextSeparator).concat(s.context);l.push(g),d&&(l.push(g+u),h&&l.push(g+p))}}for(;i=l.pop();)a.isValidLookup(t)||(r=i,t=a.getResource(n,e,i,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(vG);function WG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var VG=function(){function e(t){eG(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mG.create("languageUtils")}return rG(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=WG(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=WG(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=WG(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],i=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),r.forEach((function(e){o.indexOf(e)<0&&i(n.formatLanguageCode(e))})),o}}]),e}(),UG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],$G={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},GG=["v1","v2","v3"],qG={zero:0,one:1,two:2,few:3,many:4,other:5};function YG(){var e={};return UG.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:$G[t.fc]}}))})),e}var ZG=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eG(this,e),this.languageUtils=t,this.options=n,this.logger=mG.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=YG()}return rG(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(n){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return qG[e]-qG[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var i=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):i():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!GG.includes(this.options.compatibilityJSON)}}]),e}();function XG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function KG(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};eG(this,e),this.logger=mG.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return rG(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:PG,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?EG(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?EG(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?EG(t.nestingPrefix):t.nestingPrefixEscaped||EG("$t("),this.nestingSuffix=t.nestingSuffix?EG(t.nestingSuffix):t.nestingSuffixEscaped||EG(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var o,i,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(s.formatSeparator)<0){var o=CG(t,l,e);return s.alwaysFormat?s.format(o,void 0,n,KG(KG(KG({},r),t),{},{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),c=i.join(s.formatSeparator).trim();return s.format(CG(t,l,a),c,n,KG(KG(KG({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){var n=o[1].trim();if(void 0===(i=u(n)))if("function"==typeof d){var l=d(e,o,r);i="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))i="";else{if(h){i=o[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),i=""}else"string"==typeof i||s.useRawValueToEscape||(i=bG(i));var c=t.safeValue(i);if(e=e.replace(o[0],c),h?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,o,i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var a=(i=this.interpolate(i,o)).match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o=KG(KG({},t),o))}catch(j2){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),j2),"".concat(e).concat(n).concat(i)}return delete o.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var l=[];(o=KG({},a)).applyPostProcessor=!1,delete o.defaultValue;var c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(s.call(this,n[1].trim(),o),o))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=bG(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,a.lng,KG(KG({},a),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function JG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function eq(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};eG(this,e),this.logger=mG.create("formatter"),this.options=t,this.formats={number:tq((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:tq((function(e,t){var n=new Intl.NumberFormat(e,eq(eq({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:tq((function(e,t){var n=new Intl.DateTimeFormat(e,eq({},t));return function(e){return n.format(e)}})),relativetime:tq((function(e,t){var n=new Intl.RelativeTimeFormat(e,eq({},t));return function(e){return n.format(e,t.range||"day")}})),list:tq((function(e,t){var n=new Intl.ListFormat(e,eq({},t));return function(e){return n.format(e)}}))},this.init(t)}return rG(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=tq(t)}},{key:"format",value:function(e,t,n,r){var o=this,i=t.split(this.formatSeparator).reduce((function(e,t){var i=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach((function(e){if(e){var t=dG(e.split(":")),r=t[0],o=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=o),"false"===o&&(n[r.trim()]=!1),"true"===o&&(n[r.trim()]=!0),isNaN(o)||(n[r.trim()]=parseInt(o,10))}}))}return{formatName:t,formatOptions:n}}(t),a=i.formatName,s=i.formatOptions;if(o.formats[a]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=o.formats[a](e,u,eq(eq(eq({},s),r),c))}catch(d){o.logger.warn(d)}return l}return o.logger.warn("there was no format function for ".concat(a)),e}),e);return i}}]),e}();function rq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function oq(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:{};return eG(this,n),i=t.call(this),OG&&vG.call(oG(i)),i.backend=e,i.store=r,i.services=o,i.languageUtils=o.languageUtils,i.options=a,i.logger=mG.create("backendConnector"),i.waitingReads=[],i.maxParallelReads=a.maxParallelReads||10,i.readingCalls=0,i.maxRetries=a.maxRetries>=0?a.maxRetries:5,i.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(o,a.backend,a),i}return rG(n,[{key:"queueLoad",value:function(e,t,n,r){var o=this,i={},a={},s={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?void 0===a[s]&&(a[s]=!0):(o.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===i[s]&&(i[s]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),n&&this.store.addResourceBundle(o,i,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var o=wG(e,t,Object),i=o.obj,a=o.k;i[a]=i[a]||[],r&&(i[a]=i[a].concat(n)),r||i[a].push(n)}(n.loaded,[o],i),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:o,wait:i,callback:a});else{this.readingCalls++;var s=function(s,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}s&&l&&o2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(i," for language ").concat(o," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(i," for language ").concat(o),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s=oq(oq({},i),{},{isUpdate:o}),l=this.backend.create.bind(this.backend);if(l.length<6)try{var c;(c=5===l.length?l(e,t,n,r,s):l(e,t,n,r))&&"function"==typeof c.then?c.then((function(e){return a(null,e)})).catch(a):a(null,c)}catch(Jhe){a(Jhe)}else l(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}]),n}(vG);function sq(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===J$(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===J$(e[2])||"object"===J$(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function lq(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function cq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function uq(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(eG(this,n),e=t.call(this),OG&&vG.call(oG(e)),e.options=lq(r),e.services={},e.logger=mG,e.modules={external:[]},fq(oG(e)),o&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,o),sG(e,oG(e));setTimeout((function(){e.init(r,o)}),0)}return e}return rG(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=sq();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=uq(uq(uq({},r),this.options),lq(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=uq(uq({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var i;this.modules.logger?mG.init(o(this.modules.logger),this.options):mG.init(null,this.options),this.modules.formatter?i=this.modules.formatter:"undefined"!=typeof Intl&&(i=nq);var a=new VG(this.options);this.store=new NG(this.options.resources,this.options);var s=this.services;s.logger=mG,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new ZG(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!i||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=o(i),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new QG(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new aq(o(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=yG(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hq,r=n,o="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return r();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(o)a(o);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=yG();return e||(e=this.languages),t||(t=this.options.ns),n||(n=hq),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&DG.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=yG();this.emit("languageChanging",e);var o=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},i=function(i){e||i||!n.services.languageDetector||(i=[]);var a="string"==typeof i?i:n.services.languageUtils.getBestMatchFromCodes(i);a&&(n.language||o(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,i){i?(o(i),n.translator.changeLanguage(i),n.isLanguageChangingTo=void 0,n.emit("languageChanged",i),n.logger.log("languageChanged",i)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,o=function e(t,o){var i;if("object"!==J$(o)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||o&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=yG();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=yG();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],o=e.filter((function(e){return r.indexOf(e)<0}));return o.length?(this.options.preload=r.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new VG(sq());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hq,o=uq(uq(uq({},this.options),t),{isClone:!0}),i=new n(o);void 0===t.debug&&void 0===t.prefix||(i.logger=i.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){i[t]=e[t]})),i.services=uq({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new HG(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new pq(e,t)}));var gq=pq.createInstance();function mq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vq(e){return vq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vq(e)}function yq(e){var t=function(e,t){if("object"!==vq(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==vq(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===vq(t)?t:String(t)}function bq(e,t){for(var n=0;n0){var a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+="; Max-Age=".concat(Math.floor(a))}if(r.domain){if(!Cq.test(r.domain))throw new TypeError("option domain is invalid");i+="; Domain=".concat(r.domain)}if(r.path){if(!Cq.test(r.path))throw new TypeError("option path is invalid");i+="; Path=".concat(r.path)}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");i+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},Eq=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+60*n*1e3)),r&&(o.domain=r),document.cookie=_q(e,encodeURIComponent(t),o)},Lq=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),r=0;r-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=n.substring(1).split("&"),o=0;o0)r[o].substring(0,i)===e.lookupQuerystring&&(t=r[o].substring(i+1))}}return t}},Mq=null,Tq=function(){if(null!==Mq)return Mq;try{Mq="undefined"!==window&&null!==window.localStorage;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(j2){Mq=!1}return Mq},Aq={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Tq()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Tq()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Iq=null,Rq=function(){if(null!==Iq)return Iq;try{Iq="undefined"!==window&&null!==window.sessionStorage;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(j2){Iq=!1}return Iq},Nq={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Rq()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Rq()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Dq={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n0?t:void 0}},zq={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},Bq={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},jq={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var Fq=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mq(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}var t,n,r;return t=e,n=[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=Sq(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Pq),this.addDetector(Oq),this.addDetector(Aq),this.addDetector(Nq),this.addDetector(Dq),this.addDetector(zq),this.addDetector(Bq),this.addDetector(jq)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var r=t.detectors[e].lookup(t.options);r&&"string"==typeof r&&(r=[r]),r&&(n=n.concat(r))}})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}],n&&bq(t.prototype,n),r&&bq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Hq(e){return Hq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hq(e)}Fq.type="languageDetector";var Wq=[],Vq=Wq.forEach,Uq=Wq.slice;function $q(e){return Vq.call(Uq.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}function Gq(){return"function"==typeof XMLHttpRequest||"object"===("undefined"==typeof XMLHttpRequest?"undefined":Hq(XMLHttpRequest))}function qq(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Yq,Zq={exports:{}},Xq={exports:{}};function Kq(){return Yq||(Yq=1,function(e,t){var n="undefined"!=typeof self?self:o,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(j2){return!1}}(),i="FormData"in e,a="ArrayBuffer"in e;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&o&&function(e){return e&&DataView.prototype.isPrototypeOf(e)}(e)?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var k=[301,302,303,307,308];w.redirect=function(e,t){if(-1===k.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(Jhe){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,n){return new Promise((function(r,i){var a=new b(e,n);if(a.signal&&a.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new w(o,n))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&o&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=h,e.Request=b,e.Response=w),t.Headers=h,t.Request=b,t.Response=w,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(Xq,Xq.exports)),Xq.exports}!function(e,t){var n;if("function"==typeof fetch&&(n=void 0!==o&&o.fetch?o.fetch:"undefined"!=typeof window&&window.fetch?window.fetch:fetch),void 0!==qq&&("undefined"==typeof window||void 0===window.document)){var r=n||Kq();r.default&&(r=r.default),t.default=r,e.exports=t.default}}(Zq,Zq.exports);const Qq=Zq.exports,Jq=r({__proto__:null,default:Qq},[Zq.exports]);function eY(e){return eY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eY(e)}var tY,nY,rY;"function"==typeof fetch&&(tY="undefined"!=typeof global&&global.fetch?global.fetch:"undefined"!=typeof window&&window.fetch?window.fetch:fetch),Gq()&&("undefined"!=typeof global&&global.XMLHttpRequest?nY=global.XMLHttpRequest:"undefined"!=typeof window&&window.XMLHttpRequest&&(nY=window.XMLHttpRequest)),"function"==typeof ActiveXObject&&("undefined"!=typeof global&&global.ActiveXObject?rY=global.ActiveXObject:"undefined"!=typeof window&&window.ActiveXObject&&(rY=window.ActiveXObject)),tY||!Jq||nY||rY||(tY=Qq||Jq),"function"!=typeof tY&&(tY=void 0);var oY=function(e,t){if(t&&"object"===eY(t)){var n="";for(var r in t)n+="&"+encodeURIComponent(r)+"="+encodeURIComponent(t[r]);if(!n)return e;e=e+(-1!==e.indexOf("?")?"&":"?")+n.slice(1)}return e},iY=function(e,t,n){tY(e,t).then((function(e){if(!e.ok)return n(e.statusText||"Error",{status:e.status});e.text().then((function(t){n(null,{status:e.status,data:t})})).catch(n)})).catch(n)},aY=!1,sY=function(e,t,n,r){return"function"==typeof n&&(r=n,n=void 0),r=r||function(){},tY&&0!==t.indexOf("file:")?function(e,t,n,r){e.queryStringParams&&(t=oY(t,e.queryStringParams));var o=$q({},"function"==typeof e.customHeaders?e.customHeaders():e.customHeaders);n&&(o["Content-Type"]="application/json");var i="function"==typeof e.requestOptions?e.requestOptions(n):e.requestOptions,a=$q({method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:o},aY?{}:i);try{iY(t,a,r)}catch(j2){if(!i||0===Object.keys(i).length||!j2.message||j2.message.indexOf("not implemented")<0)return r(j2);try{Object.keys(i).forEach((function(e){delete a[e]})),iY(t,a,r),aY=!0}catch(Jhe){r(Jhe)}}}(e,t,n,r):Gq()||"function"==typeof ActiveXObject?function(e,t,n,r){n&&"object"===eY(n)&&(n=oY("",n).slice(1)),e.queryStringParams&&(t=oY(t,e.queryStringParams));try{var o;(o=nY?new nY:new rY("MSXML2.XMLHTTP.3.0")).open(n?"POST":"GET",t,1),e.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!e.withCredentials,n&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var i=e.customHeaders;if(i="function"==typeof i?i():i)for(var a in i)o.setRequestHeader(a,i[a]);o.onreadystatechange=function(){o.readyState>3&&r(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(n)}catch(j2){console&&console.log(j2)}}(e,t,n,r):void r(new Error("No fetch and no xhr implementation found!"))};function lY(e){return lY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lY(e)}function cY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uY(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};cY(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}var t,n,r;return t=e,n=[{key:"init",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=$q(n,this.options||{},hY()),this.allOptions=r,this.services&&this.options.reloadInterval&&setInterval((function(){return t.reload()}),this.options.reloadInterval)}},{key:"readMulti",value:function(e,t,n){this._readAny(e,e,t,t,n)}},{key:"read",value:function(e,t,n){this._readAny([e],e,[t],t,n)}},{key:"_readAny",value:function(e,t,n,r,o){var i,a=this,s=this.options.loadPath;"function"==typeof this.options.loadPath&&(s=this.options.loadPath(e,n)),(s=function(e){return!!e&&"function"==typeof e.then}(i=s)?i:Promise.resolve(i)).then((function(i){if(!i)return o(null,{});var s=a.services.interpolator.interpolate(i,{lng:e.join("+"),ns:n.join("+")});a.loadUrl(s,o,t,r)}))}},{key:"loadUrl",value:function(e,t,n,r){var o=this;this.options.request(this.options,e,void 0,(function(i,a){if(a&&(a.status>=500&&a.status<600||!a.status))return t("failed loading "+e+"; status code: "+a.status,!0);if(a&&a.status>=400&&a.status<500)return t("failed loading "+e+"; status code: "+a.status,!1);if(!a&&i&&i.message&&i.message.indexOf("Failed to fetch")>-1)return t("failed loading "+e+": "+i.message,!0);if(i)return t(i,!1);var s,l;try{s="string"==typeof a.data?o.options.parse(a.data,n,r):a.data}catch(j2){l="failed parsing "+e+" to json"}if(l)return t(l,!1);t(null,s)}))}},{key:"create",value:function(e,t,n,r,o){var i=this;if(this.options.addPath){"string"==typeof e&&(e=[e]);var a=this.options.parsePayload(t,n,r),s=0,l=[],c=[];e.forEach((function(n){var r=i.options.addPath;"function"==typeof i.options.addPath&&(r=i.options.addPath(n,t));var u=i.services.interpolator.interpolate(r,{lng:n,ns:t});i.options.request(i.options,u,a,(function(t,n){s+=1,l.push(t),c.push(n),s===e.length&&o&&o(l,c)}))}))}}},{key:"reload",value:function(){var e=this,t=this.services,n=t.backendConnector,r=t.languageUtils,o=t.logger,i=n.language;if(!i||"cimode"!==i.toLowerCase()){var a=[],s=function(e){r.toResolveHierarchy(e).forEach((function(e){a.indexOf(e)<0&&a.push(e)}))};s(i),this.allOptions.preload&&this.allOptions.preload.forEach((function(e){return s(e)})),a.forEach((function(t){e.allOptions.ns.forEach((function(e){n.read(t,e,"read",null,null,(function(r,i){r&&o.warn("loading namespace ".concat(e," for language ").concat(t," failed"),r),!r&&i&&o.log("loaded namespace ".concat(e," for language ").concat(t),i),n.loaded("".concat(t,"|").concat(e),r,i)}))}))}))}}}],n&&uY(t.prototype,n),r&&uY(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function pY(e){return pY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pY(e)}function gY(e){var t=function(e,t){if("object"!==pY(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==pY(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===pY(t)?t:String(t)}function mY(e,t,n){return(t=gY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vY(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r2&&void 0!==arguments[2]?arguments[2]:{},r=t.languages[0],o=!!t.options&&t.options.fallbackLng,i=t.languages[t.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))&&(!!t.hasResourceBundle(r,e)||(!(t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages))||!(!a(r,e)||o&&!a(i,e))))}function kY(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.languages||!t.languages.length)return bY("i18n.languages were undefined or empty",t.languages),!0;var r=void 0!==t.options.ignoreJSONStructure;return r?t.hasLoadedNamespace(e,{precheck:function(t,r){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):wY(e,t,n)}var SY=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,CY={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},_Y=function(e){return CY[e]};function EY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function LY(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};OY=LY(LY({},OY),e)}(e.options.react),function(e){PY=e}(e)}},RY=a.exports.createContext(),NY=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var t,n,r;return t=e,(n=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach((function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&AY(t.prototype,n),r&&AY(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function DY(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=t.i18n,r=a.exports.useContext(RY)||{},o=r.i18n,i=r.defaultNS,s=n||o||TY();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new NY),!s){bY("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},c=[l,{},!1];return c.t=l,c.i18n={},c.ready=!1,c}s.options.react&&void 0!==s.options.react.wait&&bY("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var u=jY(jY(jY({},MY()),s.options.react),t),d=u.useSuspense,h=u.keyPrefix,f=e||i||s.options&&s.options.defaultNS;f="string"==typeof f?[f]:f||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(f);var p=(s.isInitialized||s.initializedStoreOnce)&&f.every((function(e){return kY(e,s,u)}));function g(){return s.getFixedT(null,"fallback"===u.nsMode?f:f[0],h)}var m=a.exports.useState(g),v=zY(m,2),y=v[0],b=v[1],x=f.join(),w=FY(x),k=a.exports.useRef(!0);a.exports.useEffect((function(){var e=u.bindI18n,t=u.bindI18nStore;function n(){k.current&&b(g)}return k.current=!0,p||d||xY(s,f,(function(){k.current&&b(g)})),p&&w&&w!==x&&k.current&&b(g),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){k.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,n)})),t&&s&&t.split(" ").forEach((function(e){return s.store.off(e,n)}))}}),[s,x]);var S=a.exports.useRef(!0);a.exports.useEffect((function(){k.current&&!S.current&&b(g),S.current=!1}),[s,h]);var C=[y,s,p];if(C.t=y,C.i18n=s,C.ready=p,p)return C;if(!p&&!d)return C;throw new Promise((function(e){xY(s,f,(function(){e()}))}))}gq.use(fY).use(Fq).use(IY).init({fallbackLng:"en",debug:!1,ns:["common","gallery","hotkeys","options","settings","modelmanager","toast","tooltip","unifiedcanvas"],backend:{loadPath:"/locales/{{ns}}/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const WY=AV({name:"system",initialState:{isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:gq.isInitialized?gq.t("common:statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null},reducers:{setShouldDisplayInProgressType:(e,t)=>{e.shouldDisplayInProgressType=t.payload},setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.currentStatus=t.payload},setSystemStatus:(e,t)=>({...e,...t.payload}),errorOccurred:e=>{e.hasError=!0,e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=gq.t("common:statusError"),e.wasErrorSeen=!1},errorSeen:e=>{e.hasError=!1,e.wasErrorSeen=!0,e.currentStatus=e.isConnected?gq.t("common:statusConnected"):gq.t("common:statusDisconnected")},addLogEntry:(e,t)=>{const{timestamp:n,message:r,level:o}=t.payload,i={timestamp:n,message:r,level:o||"info"};e.log.push(i)},setShouldShowLogViewer:(e,t)=>{e.shouldShowLogViewer=t.payload},setIsConnected:(e,t)=>{e.isConnected=t.payload,e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.hasError=!1},setSocketId:(e,t)=>{e.socketId=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setOpenAccordions:(e,t)=>{e.openAccordions=t.payload},setSystemConfig:(e,t)=>({...e,...t.payload}),setShouldDisplayGuides:(e,t)=>{e.shouldDisplayGuides=t.payload},processingCanceled:e=>{e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=gq.t("common:statusProcessingCanceled")},generationRequested:e=>{e.isProcessing=!0,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=gq.t("common:statusPreparing")},setModelList:(e,t)=>{e.model_list=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},modelChangeRequested:e=>{e.currentStatus=gq.t("common:statusLoadingModel"),e.isCancelable=!1,e.isProcessing=!0,e.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(e,t)=>{e.saveIntermediatesInterval=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},setProcessingIndeterminateTask:(e,t)=>{e.isProcessing=!0,e.currentStatus=t.payload,e.currentStatusHasSteps=!1},setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setFoundModels:(e,t)=>{e.foundModels=t.payload},setOpenModel:(e,t)=>{e.openModel=t.payload}}}),{setShouldDisplayInProgressType:VY,setIsProcessing:UY,addLogEntry:$Y,setShouldShowLogViewer:GY,setIsConnected:qY,setSocketId:YY,setShouldConfirmOnDelete:ZY,setOpenAccordions:XY,setSystemStatus:KY,setCurrentStatus:QY,setSystemConfig:JY,setShouldDisplayGuides:eZ,processingCanceled:tZ,errorOccurred:nZ,errorSeen:rZ,setModelList:oZ,setIsCancelable:iZ,modelChangeRequested:aZ,setSaveIntermediatesInterval:sZ,setEnableImageDebugging:lZ,generationRequested:cZ,addToast:uZ,clearToastQueue:dZ,setProcessingIndeterminateTask:hZ,setSearchFolder:fZ,setFoundModels:pZ,setOpenModel:gZ}=WY.actions,mZ=WY.reducer,vZ=(e,t)=>Math.floor(e/t)*t,yZ=(e,t)=>Math.round(e/t)*t,bZ=(e,t,n,r,o,i,a)=>({x:e/2-(n+o/2)*a,y:t/2-(r+i/2)*a}),xZ=(e,t,n,r,o=.95)=>{const i=e*o/n,a=t*o/r;return Math.min(1,Math.min(i,a))},wZ=.95,kZ=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),SZ=e=>{const{width:t,height:n}=e,r={width:t,height:n},o=t/n;let i=t*n,a=448;for(;i<262144;){if(a+=64,t===n){r.width=512,r.height=512;break}o>1?(r.width=a,r.height=yZ(a/o,64)):o<1&&(r.height=a,r.width=yZ(a*o,64)),i=r.width*r.height}return r},CZ=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],_Z=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],EZ=e=>"line"===e.kind&&"mask"===e.layer,LZ=e=>"image"===e.kind&&"base"===e.layer,PZ=e=>"line"===e.kind,OZ={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},MZ=AV({name:"canvas",initialState:{boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],inpaintReplace:.1,isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:OZ,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,shouldUseInpaintReplace:!1,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,"move"!==n&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;"move"!==t&&(e.tool="brush"===t?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.layerState.objects=e.layerState.objects.filter((e=>!EZ(e))),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{stageDimensions:r}=e,o={width:vZ(A$.clamp(n.width,64,512),64),height:vZ(A$.clamp(n.height,64,512),64)},i={x:yZ(n.width/2-o.width/2,64),y:yZ(n.height/2-o.height/2,64)};if("auto"===e.boundingBoxScaleMethod){const t=SZ(o);e.scaledBoundingBoxDimensions=t}e.boundingBoxDimensions=o,e.boundingBoxCoordinates=i,e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.layerState={...OZ,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const a=xZ(r.width,r.height,n.width,n.height,wZ),s=bZ(r.width,r.height,0,0,n.width,n.height,a);e.stageScale=a,e.stageCoordinates=s,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=(r=t.payload,{width:yZ(r.width,64),height:yZ(r.height,64)});var r;if(e.boundingBoxDimensions=n,"auto"===e.boundingBoxScaleMethod){const t=SZ(n);e.scaledBoundingBoxDimensions=t}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=kZ(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldUseInpaintReplace:(e,t)=>{e.shouldUseInpaintReplace=t.payload},setInpaintReplace:(e,t)=>{e.inpaintReplace=t.payload},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},addImageToStagingArea:(e,t)=>{const{boundingBox:n,image:r}=t.payload;n&&r&&(e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...OZ.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:o,brushSize:i,shouldRestrictStrokesToBox:a}=e;if("move"===n||"colorPicker"===n)return;const s=i/2,l="base"===r&&"brush"===n?{color:o}:{};e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const c={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(c.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(c),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(PZ);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(A$.cloneDeep(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.layerState=OZ,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(LZ),o={width:Math.floor(t),height:Math.floor(n)};if(!r){const t=xZ(o.width,o.height,512,512,wZ),n=bZ(o.width,o.height,0,0,512,512,t),r={width:512,height:512};if(e.stageScale=t,e.stageCoordinates=n,e.stageDimensions=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=r,"auto"===e.boundingBoxScaleMethod){const t=SZ(r);e.scaledBoundingBoxDimensions=t}return}const{width:i,height:a}=r,s=xZ(t,n,i,a,.95),l=bZ(o.width,o.height,0,0,i,a,s);e.minimumStageScale=s,e.stageScale=s,e.stageCoordinates=kZ(l),e.stageDimensions=o,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(LZ)){const t=xZ(r.width,r.height,512,512,wZ),n=bZ(r.width,r.height,0,0,512,512,t),o={width:512,height:512};if(e.stageScale=t,e.stageCoordinates=n,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=o,"auto"===e.boundingBoxScaleMethod){const t=SZ(o);e.scaledBoundingBoxDimensions=t}}},resetCanvasView:(e,t)=>{const{contentRect:n}=t.payload,{stageDimensions:{width:r,height:o}}=e,{x:i,y:a,width:s,height:l}=n;if(0!==s&&0!==l){const t=xZ(r,o,s,l,wZ),n=bZ(r,o,i,a,s,l,t);e.stageScale=t,e.stageCoordinates=n}else{const t=xZ(r,o,512,512,wZ),n=bZ(r,o,0,0,512,512,t),i={width:512,height:512};if(e.stageScale=t,e.stageCoordinates=n,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=i,"auto"===e.boundingBoxScaleMethod){const t=SZ(i);e.scaledBoundingBoxDimensions=t}}},nextStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:e=>{const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({...t[n]}),e.layerState.stagingArea={...OZ.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:o}=e,i=r.width/o,a=r.height/o;if(n.x<0||n.x+t.width>i||n.y<0||n.y+t.height>a){const t={width:vZ(A$.clamp(i,64,512),64),height:vZ(A$.clamp(a,64,512),64)},n={x:yZ(i/2-t.width/2,64),y:yZ(a/2-t.height/2,64)};if(e.boundingBoxDimensions=t,e.boundingBoxCoordinates=n,"auto"===e.boundingBoxScaleMethod){const n=SZ(t);e.scaledBoundingBoxDimensions=n}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,"auto"===t.payload){const t=SZ(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=t}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}}}),{addEraseRect:TZ,addFillRect:AZ,addImageToStagingArea:IZ,addLine:RZ,addPointToCurrentLine:NZ,clearCanvasHistory:DZ,clearMask:zZ,commitColorPickerColor:BZ,commitStagingAreaImage:jZ,discardStagedImages:FZ,fitBoundingBoxToStage:HZ,mouseLeftCanvas:WZ,nextStagingAreaImage:VZ,prevStagingAreaImage:UZ,redo:$Z,resetCanvas:GZ,resetCanvasInteractionState:qZ,resetCanvasView:YZ,resizeAndScaleCanvas:ZZ,resizeCanvas:XZ,setBoundingBoxCoordinates:KZ,setBoundingBoxDimensions:QZ,setBoundingBoxPreviewFill:JZ,setBoundingBoxScaleMethod:eX,setBrushColor:tX,setBrushSize:nX,setCanvasContainerDimensions:rX,setColorPickerColor:oX,setCursorPosition:iX,setDoesCanvasNeedScaling:aX,setInitialCanvasImage:sX,setInpaintReplace:lX,setIsDrawing:cX,setIsMaskEnabled:uX,setIsMouseOverBoundingBox:dX,setIsMoveBoundingBoxKeyHeld:hX,setIsMoveStageKeyHeld:fX,setIsMovingBoundingBox:pX,setIsMovingStage:gX,setIsTransformingBoundingBox:mX,setLayer:vX,setMaskColor:yX,setMergedCanvas:bX,setShouldAutoSave:xX,setShouldCropToBoundingBoxOnSave:wX,setShouldDarkenOutsideBoundingBox:kX,setShouldLockBoundingBox:SX,setShouldPreserveMaskedArea:CX,setShouldShowBoundingBox:_X,setShouldShowBrush:EX,setShouldShowBrushPreview:LX,setShouldShowCanvasDebugInfo:PX,setShouldShowCheckboardTransparency:OX,setShouldShowGrid:MX,setShouldShowIntermediates:TX,setShouldShowStagingImage:AX,setShouldShowStagingOutline:IX,setShouldSnapToGrid:RX,setShouldUseInpaintReplace:NX,setStageCoordinates:DX,setStageScale:zX,setTool:BX,toggleShouldLockBoundingBox:jX,toggleTool:FX,undo:HX,setScaledBoundingBoxDimensions:WX,setShouldRestrictStrokesToBox:VX}=MZ.actions,UX=MZ.reducer,$X=Object.create(null);$X.open="0",$X.close="1",$X.ping="2",$X.pong="3",$X.message="4",$X.upgrade="5",$X.noop="6";const GX=Object.create(null);Object.keys($X).forEach((e=>{GX[$X[e]]=e}));const qX={type:"error",data:"parser error"},YX="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),ZX="function"==typeof ArrayBuffer,XX=({type:e,data:t},n,r)=>YX&&t instanceof Blob?n?r(t):KX(t,r):ZX&&(t instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer)(t))?n?r(t):KX(new Blob([t]),r):r($X[e]+(t||"")),KX=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+e)},n.readAsDataURL(e)},QX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",JX="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e{if("string"!=typeof e)return{type:"message",data:rK(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:nK(e.substring(1),t)};return GX[n]?e.length>1?{type:GX[n],data:e.substring(1)}:{type:GX[n]}:qX},nK=(e,t)=>{if(eK){const n=(e=>{let t,n,r,o,i,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const c=new ArrayBuffer(a),u=new Uint8Array(c);for(t=0;t>4,u[l++]=(15&r)<<4|o>>2,u[l++]=(3&o)<<6|63&i;return c})(e);return rK(n,t)}return{base64:!0,data:e}},rK=(e,t)=>"blob"===t&&e instanceof ArrayBuffer?new Blob([e]):e,oK=String.fromCharCode(30);function iK(e){if(e)return function(e){for(var t in iK.prototype)e[t]=iK.prototype[t];return e}(e)}iK.prototype.on=iK.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},iK.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},iK.prototype.off=iK.prototype.removeListener=iK.prototype.removeAllListeners=iK.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const lK=setTimeout,cK=clearTimeout;function uK(e,t){t.useNativeTimers?(e.setTimeoutFn=lK.bind(aK),e.clearTimeoutFn=cK.bind(aK)):(e.setTimeoutFn=setTimeout.bind(aK),e.clearTimeoutFn=clearTimeout.bind(aK))}function dK(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}class hK extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class fK extends iK{constructor(e){super(),this.writable=!1,uK(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new hK(e,t,n)),this}open(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=tK(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const pK="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),gK={};let mK,vK=0,yK=0;function bK(e){let t="";do{t=pK[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function xK(){const e=bK(+new Date);return e!==mK?(vK=0,mK=e):e+"."+bK(vK++)}for(;yK<64;yK++)gK[pK[yK]]=yK;function wK(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}let kK=!1;try{kK="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Jhe){}const SK=kK;function CK(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||SK))return new XMLHttpRequest}catch(j2){}if(!t)try{return new(aK[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(j2){}}function _K(){}const EK=null!=new CK({xdomain:!1}).responseType;class LK extends iK{constructor(e,t){super(),uK(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.create()}create(){const e=sK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new CK(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&t.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(j2){}if("POST"===this.method)try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(j2){}try{t.setRequestHeader("Accept","*/*")}catch(j2){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{4===t.readyState&&(200===t.status||1223===t.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof t.status?t.status:0)}),0))},t.send(this.data)}catch(j2){return void this.setTimeoutFn((()=>{this.onError(j2)}),0)}"undefined"!=typeof document&&(this.index=LK.requestsCount++,LK.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=_K,e)try{this.xhr.abort()}catch(j2){}"undefined"!=typeof document&&delete LK.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(LK.requestsCount=0,LK.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",PK);else if("function"==typeof addEventListener){addEventListener("onpagehide"in aK?"pagehide":"unload",PK,!1)}function PK(){for(let e in LK.requests)LK.requests.hasOwnProperty(e)&&LK.requests[e].abort()}const OK="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),MK=aK.WebSocket||aK.MozWebSocket,TK="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const AK={websocket:class extends fK{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=TK?{}:sK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=TK?new MK(e,t,n):t?new MK(e,t):new MK(e)}catch(Jhe){return this.emitReserved("error",Jhe)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(j2){}r&&OK((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let n="";this.opts.port&&("wss"===t&&443!==Number(this.opts.port)||"ws"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=xK()),this.supportsBinary||(e.b64=1);const r=wK(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}check(){return!!MK}},polling:class extends fK{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}const t=e&&e.forceBase64;this.supportsBinary=EK&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(oK),r=[];for(let o=0;o{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach(((e,i)=>{XX(e,!1,(e=>{r[i]=e,++o===n&&t(r.join(oK))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let n="";!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=xK()),this.supportsBinary||e.sid||(e.b64=1),this.opts.port&&("https"===t&&443!==Number(this.opts.port)||"http"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port);const r=wK(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new LK(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},IK=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,RK=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function NK(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=IK.exec(e||""),i={},a=14;for(;a--;)i[RK[a]]=o[a]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,i.query),i}class DK extends iK{constructor(e,t={}){super(),e&&"object"==typeof e&&(t=e,e=null),e?(e=NK(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=NK(t.host).host),uK(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,o=n.length;r{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new AK[e](n)}open(){let e;if(this.opts.rememberUpgrade&&DK.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(j2){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),n=!1;DK.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;DK.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,c(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function a(){i("transport closed")}function s(){i("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",a),this.off("close",s),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",a),this.once("close",s),this.once("upgrading",l),t.open()}onOpen(){if(this.readyState="open",DK.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(e){DK.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||jK&&e instanceof Blob||FK&&e instanceof File}function WK(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t=0&&e.num0;case qK.ACK:case qK.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class ZK{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=$K(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const XK=Object.freeze(Object.defineProperty({__proto__:null,protocol:5,get PacketType(){return qK},Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==qK.EVENT&&e.type!==qK.ACK||!WK(e)?[this.encodeAsString(e)]:(e.type=e.type===qK.EVENT?qK.BINARY_EVENT:qK.BINARY_ACK,this.encodeAsBinary(e))}encodeAsString(e){let t=""+e.type;return e.type!==qK.BINARY_EVENT&&e.type!==qK.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=VK(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Decoder:YK},Symbol.toStringTag,{value:"Module"}));function KK(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const QK=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class JK extends iK{constructor(e,t,n){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[KK(e,"open",this.onopen.bind(this)),KK(e,"packet",this.onpacket.bind(this)),KK(e,"error",this.onerror.bind(this)),KK(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(QK.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');t.unshift(e);const n={type:qK.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){const n=this.flags.timeout;if(void 0===n)return void(this.acks[e]=t);const r=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(r),t.apply(this,[null,...e])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this.packet({type:qK.CONNECT,data:e})})):this.packet({type:qK.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case qK.CONNECT:if(e.data&&e.data.sid){const t=e.data.sid;this.onconnect(t)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qK.EVENT:case qK.BINARY_EVENT:this.onevent(e);break;case qK.ACK:case qK.BINARY_ACK:this.onack(e);break;case qK.DISCONNECT:this.ondisconnect();break;case qK.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:qK.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qK.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}eQ.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},eQ.prototype.reset=function(){this.attempts=0},eQ.prototype.setMin=function(e){this.ms=e},eQ.prototype.setMax=function(e){this.max=e},eQ.prototype.setJitter=function(e){this.jitter=e};class tQ extends iK{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,uK(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new eQ({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||XK;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new DK(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=KK(t,"open",(function(){n.onopen(),e&&e()})),o=KK(t,"error",(t=>{n.cleanup(),n._readyState="closed",this.emitReserved("error",t),e?e(t):n.maybeReconnectOnOpen()}));if(!1!==this._timeout){const e=this._timeout;0===e&&r();const n=this.setTimeoutFn((()=>{r(),t.close(),t.emit("error",new Error("timeout"))}),e);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(KK(e,"ping",this.onping.bind(this)),KK(e,"data",this.ondata.bind(this)),KK(e,"error",this.onerror.bind(this)),KK(e,"close",this.onclose.bind(this)),KK(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(j2){this.onclose("parse error",j2)}}ondecoded(e){OK((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n||(n=new JK(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const nQ={};function rQ(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=NK(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,a=nQ[o]&&i in nQ[o].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new tQ(r,t):(nQ[o]||(nQ[o]=new tQ(r,t)),s=nQ[o]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}let oQ;Object.assign(rQ,{Manager:tQ,Socket:JK,io:rQ,connect:rQ});const iQ=new Uint8Array(16);function aQ(){if(!oQ&&(oQ="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!oQ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oQ(iQ)}const sQ=[];for(let e=0;e<256;++e)sQ.push((e+256).toString(16).slice(1));const lQ={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function cQ(e,t,n){if(lQ.randomUUID&&!t&&!e)return lQ.randomUUID();const r=(e=e||{}).random||(e.rng||aQ)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(sQ[e[t+0]]+sQ[e[t+1]]+sQ[e[t+2]]+sQ[e[t+3]]+"-"+sQ[e[t+4]]+sQ[e[t+5]]+"-"+sQ[e[t+6]]+sQ[e[t+7]]+"-"+sQ[e[t+8]]+sQ[e[t+9]]+"-"+sQ[e[t+10]]+sQ[e[t+11]]+sQ[e[t+12]]+sQ[e[t+13]]+sQ[e[t+14]]+sQ[e[t+15]]).toLowerCase()}(r)}var uQ=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,dQ=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,hQ=/[^-+\dA-Z]/g;function fQ(e,t,n,r){if(1!==arguments.length||"string"!=typeof e||/\d/.test(e)||(t=e,e=void 0),(e=e||0===e?e:new Date)instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");var o=(t=String(pQ[t]||t||pQ.default)).slice(0,4);"UTC:"!==o&&"GMT:"!==o||(t=t.slice(4),n=!0,"GMT:"===o&&(r=!0));var i=function(){return n?"getUTC":"get"},a=function(){return e[i()+"Date"]()},s=function(){return e[i()+"Day"]()},l=function(){return e[i()+"Month"]()},c=function(){return e[i()+"FullYear"]()},u=function(){return e[i()+"Hours"]()},d=function(){return e[i()+"Minutes"]()},h=function(){return e[i()+"Seconds"]()},f=function(){return e[i()+"Milliseconds"]()},p=function(){return n?0:e.getTimezoneOffset()},g=function(){return yQ(e)},m=function(){return bQ(e)},v={d:function(){return a()},dd:function(){return mQ(a())},ddd:function(){return gQ.dayNames[s()]},DDD:function(){return vQ({y:c(),m:l(),d:a(),_:i(),dayName:gQ.dayNames[s()],short:!0})},dddd:function(){return gQ.dayNames[s()+7]},DDDD:function(){return vQ({y:c(),m:l(),d:a(),_:i(),dayName:gQ.dayNames[s()+7]})},m:function(){return l()+1},mm:function(){return mQ(l()+1)},mmm:function(){return gQ.monthNames[l()]},mmmm:function(){return gQ.monthNames[l()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return mQ(c(),4)},h:function(){return u()%12||12},hh:function(){return mQ(u()%12||12)},H:function(){return u()},HH:function(){return mQ(u())},M:function(){return d()},MM:function(){return mQ(d())},s:function(){return h()},ss:function(){return mQ(h())},l:function(){return mQ(f(),3)},L:function(){return mQ(Math.floor(f()/10))},t:function(){return u()<12?gQ.timeNames[0]:gQ.timeNames[1]},tt:function(){return u()<12?gQ.timeNames[2]:gQ.timeNames[3]},T:function(){return u()<12?gQ.timeNames[4]:gQ.timeNames[5]},TT:function(){return u()<12?gQ.timeNames[6]:gQ.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":xQ(e)},o:function(){return(p()>0?"-":"+")+mQ(100*Math.floor(Math.abs(p())/60)+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+mQ(Math.floor(Math.abs(p())/60),2)+":"+mQ(Math.floor(Math.abs(p())%60),2)},S:function(){return["th","st","nd","rd"][a()%10>3?0:(a()%100-a()%10!=10)*a()%10]},W:function(){return g()},WW:function(){return mQ(g())},N:function(){return m()}};return t.replace(uQ,(function(e){return e in v?v[e]():e.slice(1,e.length-1)}))}var pQ={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},gQ={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},mQ=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return String(e).padStart(t,"0")},vQ=function(e){var t=e.y,n=e.m,r=e.d,o=e._,i=e.dayName,a=e.short,s=void 0!==a&&a,l=new Date,c=new Date;c.setDate(c[o+"Date"]()-1);var u=new Date;u.setDate(u[o+"Date"]()+1);return l[o+"FullYear"]()===t&&l[o+"Month"]()===n&&l[o+"Date"]()===r?s?"Tdy":"Today":c[o+"FullYear"]()===t&&c[o+"Month"]()===n&&c[o+"Date"]()===r?s?"Ysd":"Yesterday":u[o+"FullYear"]()===t&&u[o+"Month"]()===n&&u[o+"Date"]()===r?s?"Tmw":"Tomorrow":i},yQ=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var o=(t-n)/6048e5;return 1+Math.floor(o)},bQ=function(e){var t=e.getDay();return 0===t&&(t=7),t},xQ=function(e){return(String(e).match(dQ)||[""]).pop().replace(hQ,"").replace(/GMT\+0000/g,"UTC")};const wQ=MV("socketio/generateImage"),kQ=MV("socketio/runESRGAN"),SQ=MV("socketio/runFacetool"),CQ=MV("socketio/deleteImage"),_Q=MV("socketio/requestImages"),EQ=MV("socketio/requestNewImages"),LQ=MV("socketio/cancelProcessing"),PQ=MV("socketio/requestSystemConfig"),OQ=MV("socketio/searchForModels"),MQ=MV("socketio/addNewModel"),TQ=MV("socketio/deleteModel"),AQ=MV("socketio/requestModelChange"),IQ=MV("socketio/saveStagingAreaImageToGallery"),RQ=MV("socketio/requestEmptyTempFolder"),NQ=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],DQ=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],zQ=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],BQ=[{key:"2x",value:2},{key:"4x",value:4}],jQ=4294967295,FQ=["gfpgan","codeformer"],HQ=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}],WQ=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);var VQ=Math.PI/180;const UQ="undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},$Q={_global:UQ,version:"8.3.14",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>$Q.angleDeg?e*VQ:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>$Q.DD.isDragging,isDragReady:()=>!!$Q.DD.node,releaseCanvasOnDestroy:!0,document:UQ.document,_injectGlobal(e){UQ.Konva=e}},GQ=e=>{$Q[e.prototype.getClassName()]=e};$Q._injectGlobal($Q);class qQ{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new qQ(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,o=this.m[1]*t+this.m[3]*n,i=this.m[0]*-n+this.m[2]*t,a=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,o=this.m[2]+this.m[0]*e,i=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],o=this.m[1]*e.m[2]+this.m[3]*e.m[3],i=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],a=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=o,this.m[4]=i,this.m[5]=a,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,o=this.m[0]*e,i=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=o,this.m[4]=i,this.m[5]=a,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],o=e*r-t*n;let i={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var a=Math.sqrt(e*e+t*t);i.rotation=t>0?Math.acos(e/a):-Math.acos(e/a),i.scaleX=a,i.scaleY=o/a,i.skewX=(e*n+t*r)/o,i.skewY=0}else if(0!=n||0!=r){var s=Math.sqrt(n*n+r*r);i.rotation=Math.PI/2-(r>0?Math.acos(-n/s):-Math.acos(n/s)),i.scaleX=o/s,i.scaleY=s,i.skewX=0,i.skewY=(e*n+t*r)/o}return i.rotation=tJ._getRotation(i.rotation),i}}var YQ=Math.PI/180,ZQ=180/Math.PI,XQ="Konva error: ",KQ={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},QQ=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,JQ=[];const eJ="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},tJ={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){JQ.push(e),1===JQ.length&&eJ((function(){const e=JQ;JQ=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(j2){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=tJ.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in KQ?{r:(t=KQ[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=QQ.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",tJ._namedColorToRBA(e)||tJ._hex3ColorToRGBA(e)||tJ._hex6ColorToRGBA(e)||tJ._rgbColorToRGBA(e)||tJ._rgbaColorToRGBA(e)||tJ._hslColorToRGBA(e)),_namedColorToRBA(e){var t=KQ[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let a,s,l;if(0===o)return l=255*i,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};a=i<.5?i*(1+o):i+o-i*o;const c=2*i-a,u=[0,0,0];for(let e=0;e<3;e++)s=r+1/3*-(e-1),s<0&&s++,s>1&&s--,l=6*s<1?c+6*(a-c)*s:2*s<1?a:3*s<2?c+(a-c)*(2/3-s)*6:c,u[e]=255*l;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.heighte.slice(0),degToRad:e=>e*YQ,radToDeg:e=>e*ZQ,_degToRad:e=>(tJ.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),tJ.degToRad(e)),_radToDeg:e=>(tJ.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),tJ.radToDeg(e)),_getRotation:e=>$Q.angleDeg?tJ.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(XQ+e)},error(e){console.error(XQ+e)},warn(e){$Q.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e1?(a=n,s=r,l=(n-o)*(n-o)+(r-i)*(r-i)):l=((a=e+u*(n-e))-o)*(a-o)+((s=t+u*(r-t))-i)*(s-i)}return[a,s,l]},_getProjectionToLine(e,t,n){var r=tJ.cloneObject(e),o=Number.MAX_VALUE;return t.forEach((function(i,a){if(n||a!==t.length-1){var s=t[(a+1)%t.length],l=tJ._getProjectionToSegment(i.x,i.y,s.x,s.y,e.x,e.y),c=l[0],u=l[1],d=l[2];dt.length){var a=t;t=e,e=a}for(r=0;re.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){$Q.releaseCanvasOnDestroy&&e.forEach((e=>{e.width=0,e.height=0}))}};function nJ(e){return tJ._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||tJ._isBoolean(e)?e:Object.prototype.toString.call(e)}function rJ(e){return e>255?255:e<0?0:Math.round(e)}function oJ(){if($Q.isUnminified)return function(e,t){return tJ._isNumber(e)||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function iJ(e){if($Q.isUnminified)return function(t,n){let r=tJ._isNumber(t),o=tJ._isArray(t)&&t.length==e;return r||o||tJ.warn(nJ(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}function aJ(){if($Q.isUnminified)return function(e,t){return tJ._isNumber(e)||"auto"===e||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function sJ(){if($Q.isUnminified)return function(e,t){return tJ._isString(e)||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function lJ(){if($Q.isUnminified)return function(e,t){const n=tJ._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function cJ(){if($Q.isUnminified)return function(e,t){return!0===e||!1===e||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}var uJ="get",dJ="set";const hJ={addGetterSetter(e,t,n,r,o){hJ.addGetter(e,t,n),hJ.addSetter(e,t,r,o),hJ.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=uJ+tJ._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,r){var o=dJ+tJ._capitalize(t);e.prototype[o]||hJ.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var o=dJ+tJ._capitalize(t);e.prototype[o]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,o){var i,a,s=n.length,l=tJ._capitalize,c=uJ+l(t),u=dJ+l(t);e.prototype[c]=function(){var e={};for(i=0;i{this._setAttr(t+l(e),void 0)})),this._fireChangeEvent(t,a,e),o&&o.call(this),this},hJ.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=tJ._capitalize(t),r=dJ+n,o=uJ+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){tJ.error("Adding deprecated "+t);var o=uJ+tJ._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){tJ.error(i);var e=this.attrs[t];return void 0===e?n:e},hJ.addSetter(e,t,r,(function(){tJ.error(i)})),hJ.addOverloadedGetterSetter(e,t)},backCompat(e,t){tJ.each(t,(function(t,n){var r=e.prototype[n],o=uJ+tJ._capitalize(t),i=dJ+tJ._capitalize(t);function a(){r.apply(this,arguments),tJ.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=a,e.prototype[o]=a,e.prototype[i]=a}))},afterSetFilter(){this._filterUpToDate=!1}};function fJ(e){var t,n,r=[],o=e.length,i=tJ;for(t=0;t"number"==typeof e?Math.floor(e):e))),l+="("+i.join(",")+")")):(l+=r.property,e||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){var t=e.getLineCap();t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){var t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,a,s,l){var c=arguments,u=this._context;3===c.length?u.drawImage(e,t,n):5===c.length?u.drawImage(e,t,n,r,o):9===c.length&&u.drawImage(e,t,n,r,o,i,a,s,l)}ellipse(e,t,n,r,o,i,a,s){this._context.ellipse(e,t,n,r,o,i,a,s)}isPointInPath(e,t){return this._context.isPointInPath(e,t)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,r=pJ.length,o=this.setAttr,i=function(e){var r,o=n[e];n[e]=function(){return t=fJ(Array.prototype.slice.call(arguments,0)),r=o.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return kJ._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const t=[];kJ._dragElements.forEach(((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=tJ._getFirstPointerId(e));const a=i._changedPointerPositions.find((e=>e.id===n.pointerId));if(a){if("dragging"!==n.dragStatus){var s=o.dragDistance();if(Math.max(Math.abs(a.x-n.startPointerPos.x),Math.abs(a.y-n.startPointerPos.y)){t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const t=[];kJ._dragElements.forEach((n=>{const{node:r}=n,o=r.getStage();e&&o.setPointersPositions(e);if(!o._changedPointerPositions.find((e=>e.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(kJ.justDragged=!0,$Q._mouseListenClick=!1,$Q._touchListenClick=!1,$Q._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof $Q.Stage&&n.node;i&&-1===t.indexOf(i)&&t.push(i)})),t.forEach((e=>{e.draw()}))},_endDragAfter(e){kJ._dragElements.forEach(((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&kJ._dragElements.delete(n)}))}};$Q.isBrowser&&(window.addEventListener("mouseup",kJ._endDragBefore,!0),window.addEventListener("touchend",kJ._endDragBefore,!0),window.addEventListener("mousemove",kJ._drag),window.addEventListener("touchmove",kJ._drag),window.addEventListener("mouseup",kJ._endDragAfter,!1),window.addEventListener("touchend",kJ._endDragAfter,!1));var SJ="absoluteOpacity",CJ="allEventListeners",_J="absoluteTransform",EJ="absoluteScale",LJ="canvas",PJ="listening",OJ="mouseenter",MJ="mouseleave",TJ="Shape",AJ=" ",IJ="stage",RJ="transform",NJ="visible",DJ=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(AJ);let zJ=1;class BJ{constructor(e){this._id=zJ++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==RJ&&e!==_J||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===RJ||e===_J)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(AJ);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(LJ)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===_J&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(LJ)){const{scene:e,filter:t,hit:n}=this._cache.get(LJ);tJ.releaseCanvas(e,t,n),this._cache.delete(LJ)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(t.width||n.width),o=Math.ceil(t.height||n.height),i=t.pixelRatio,a=void 0===t.x?Math.floor(n.x):t.x,s=void 0===t.y?Math.floor(n.y):t.y,l=t.offset||0,c=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(r&&o){a-=l,s-=l;var d=new xJ({pixelRatio:i,width:r+=2*l+1,height:o+=2*l+1}),h=new xJ({pixelRatio:i,width:0,height:0}),f=new wJ({pixelRatio:u,width:r,height:o}),p=d.getContext(),g=f.getContext();return f.isCache=!0,d.isCache=!0,this._cache.delete(LJ),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(d.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),p.save(),g.save(),p.translate(-a,-s),g.translate(-a,-s),this._isUnderCache=!0,this._clearSelfAndDescendantCache(SJ),this._clearSelfAndDescendantCache(EJ),this.drawScene(d,this),this.drawHit(f,this),this._isUnderCache=!1,p.restore(),g.restore(),c&&(p.save(),p.beginPath(),p.rect(0,0,r,o),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(LJ,{scene:d,filter:h,hit:f,x:a,y:s}),this._requestDraw(),this}tJ.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(LJ)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,r,o,i,a=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],s=this.getAbsoluteTransform(t);return a.forEach((function(e){var t=s.point(e);void 0===n&&(n=o=t.x,r=i=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.x),i=Math.max(i,t.y)})),{x:n,y:r,width:o-n,height:i-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,r,o=this.filters(),i=this._getCanvasCache(),a=i.scene,s=i.filter,l=s.getContext();if(o){if(!this._filterUpToDate){var c=a.pixelRatio;s.setSize(a.width/a.pixelRatio,a.height/a.pixelRatio);try{for(e=o.length,l.clear(),l.drawImage(a._canvas,0,0,a.getWidth()/c,a.getHeight()/c),t=l.getImageData(0,0,s.getWidth(),s.getHeight()),n=0;n{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+tJ._capitalize(t),tJ._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(PJ,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(NJ,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;kJ._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var o=!t&&!$Q.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,o=this.getDepth(),i=this,a=0;return"Stage"!==i.nodeType&&function s(l){for(e=[],t=l.length,n=0;n0&&e[0].getDepth()<=o&&s(e)}(i.getStage().getChildren()),a}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(RJ),this._clearSelfAndDescendantCache(_J)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),o=new qQ,i=this.offset();return o.m=r.slice(),o.translate(i.x,i.y),o.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(RJ);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(RJ),this._clearSelfAndDescendantCache(_J),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var t=e.x,n=e.y,r=this.x(),o=this.y();return void 0!==t&&(r+=t),void 0!==n&&(o+=n),this.setPosition({x:r,y:o}),this}_eachAncestorReverse(e,t){var n,r,o=[],i=this.getParent();if(!t||t._id!==this._id){for(o.unshift(this);i&&(!t||i._id!==t._id);)o.unshift(i),i=i.parent;for(n=o.length,r=0;r0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return tJ.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return tJ.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&tJ.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(SJ,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,r,o={},i=this.getAttrs();for(e in o.attrs={},i)t=i[e],tJ.isObject(t)&&!tJ._isPlainObject(t)&&!tJ._isArray(t)||(n="function"==typeof this[e]&&this[e],delete i[e],r=n?n.call(this):null,i[e]=t,r!==t&&(o.attrs[e]=t));return o.className=this.getClassName(),tJ._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var o=this.parent;o;){if(o===n)return r;o._isMatch(e)&&r.push(o),o=o.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),o=r.length;for(t=0;t{try{const n=null==e?void 0:e.callback;n&&delete e.callback,tJ._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(Jhe){n(Jhe)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}))}catch(Jhe){n(Jhe)}}))}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():$Q.dragDistance}_off(e,t,n){var r,o,i,a=this.eventListeners[e];for(r=0;r=0)&&!this.isDragging()){var t=!1;kJ._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=kJ._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&kJ._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return tJ.haveIntersection(n,this.getClientRect())}static create(e,t){return tJ._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,r,o,i=BJ.prototype.getClassName.call(e),a=e.children;t&&(e.attrs.container=t),$Q[i]||(tJ.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape");if(n=new(0,$Q[i])(e.attrs),a)for(r=a.length,o=0;o0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(arguments.length>1){for(var t=0;t0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const o=r._isMatch(e);return o&&n.push(r),!(!o||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=BJ.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=BJ.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),o=r&&r.getContext(),i=this._getCanvasCache(),a=i&&i.scene,s=r&&r.isCache;if(!this.isVisible()&&!s)return this;if(a){o.save();var l=this.getAbsoluteTransform(t).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",r,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();var a=this.getAbsoluteTransform(t).getMatrix();o.transform(a[0],a[1],a[2],a[3],a[4],a[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n){var r,o=t&&t.getContext(),i=this.clipWidth(),a=this.clipHeight(),s=this.clipFunc(),l=i&&a||s;const c=n===this;if(l){o.save();var u=this.getAbsoluteTransform(n),d=u.getMatrix();if(o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o.beginPath(),s)s.call(this,o,this);else{var h=this.clipX(),f=this.clipY();o.rect(h,f,i,a)}o.clip(),d=u.copy().invert().getMatrix(),o.transform(d[0],d[1],d[2],d[3],d[4],d[5])}var p=!c&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(o.save(),o._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&o.restore(),l&&o.restore()}getClientRect(e){var t,n,r,o,i,a=(e=e||{}).skipTransform,s=e.relativeTo,l={x:1/0,y:1/0,width:0,height:0},c=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var a=t.getClientRect({relativeTo:c,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===a.width&&0===a.height||(void 0===n?(n=a.x,r=a.y,o=a.x+a.width,i=a.y+a.height):(n=Math.min(n,a.x),r=Math.min(r,a.y),o=Math.max(o,a.x+a.width),i=Math.max(i,a.y+a.height)))}}));for(var u=this.find("Shape"),d=!1,h=0;he.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",v0=e=>{const t=m0(e);return"pointer"===t?$Q.pointerEventsEnabled&&g0.pointer:"touch"===t?g0.touch:"mouse"===t?g0.mouse:void 0};function y0(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&tJ.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const b0=[];class x0 extends FJ{constructor(e){super(y0(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),b0.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{y0(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||tJ.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e-1&&b0.splice(t,1),tJ.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(tJ.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new xJ({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n5&&tJ.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),$Q.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return $J(e,this)}setPointerCapture(e){GJ(e,this)}releaseCapture(e){qJ(e)}getLayers(){return this.children}_bindContentEvents(){$Q.isBrowser&&p0.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=v0(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=v0(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=v0(e.type),n=m0(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),o=!kJ.isDragging||$Q.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=v0(e.type),n=m0(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((o=>{var i=this.getIntersection(o);kJ.justDragged=!1,$Q["_"+n+"ListenClick"]=!0;if(!(i&&i.isListening()))return;$Q.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const a=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&a&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=v0(e.type),n=m0(e.type);if(!t)return;if(kJ.isDragging&&kJ.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),!(!kJ.isDragging||$Q.hitOnDragEnabled))return;var r={};let o=!1;var i=this._getTargetShape(n);this._changedPointerPositions.forEach((a=>{const s=VJ(a.id)||this.getIntersection(a),l=a.id,c={evt:e,pointerId:l};var u=i!==s;if(u&&i&&(i._fireAndBubble(t.pointerout,Object.assign({},c),s),i._fireAndBubble(t.pointerleave,Object.assign({},c),s)),s){if(r[s._id])return;r[s._id]=!0}s&&s.isListening()?(o=!0,u&&(s._fireAndBubble(t.pointerover,Object.assign({},c),i),s._fireAndBubble(t.pointerenter,Object.assign({},c),i),this[n+"targetShape"]=s),s._fireAndBubble(t.pointermove,Object.assign({},c))):i&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:l}),this[n+"targetShape"]=null)})),o||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=v0(e.type),n=m0(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"];var i={};let a=!1;this._changedPointerPositions.forEach((s=>{const l=VJ(s.id)||this.getIntersection(s);if(l){if(l.releaseCapture(s.id),i[l._id])return;i[l._id]=!0}const c=s.id,u={evt:e,pointerId:c};let d=!1;$Q["_"+n+"InDblClickWindow"]?(d=!0,clearTimeout(this[n+"DblTimeout"])):kJ.justDragged||($Q["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){$Q["_"+n+"InDblClickWindow"]=!1}),$Q.dblClickWindow),l&&l.isListening()?(a=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,Object.assign({},u)),$Q["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,Object.assign({},u)),d&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,Object.assign({},u)))):(this[n+"ClickEndShape"]=null,$Q["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:c}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:c}))})),a||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),$Q["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(l0,{evt:e}):this._fire(l0,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(f0,{evt:e}):this._fire(f0,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=VJ(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(n0,UJ(e)),qJ(e.pointerId)}_lostpointercapture(e){qJ(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:tJ._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:tJ._getFirstPointerId(e)}])}_setPointerPosition(e){tJ.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new xJ({width:this.width(),height:this.height()}),this.bufferHitCanvas=new wJ({pixelRatio:1,width:this.width(),height:this.height()}),$Q.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return tJ.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}x0.prototype.nodeType="Stage",GQ(x0),hJ.addGetterSetter(x0,"container");var w0="hasShadow",k0="shadowRGBA",S0="patternImage",C0="linearGradient",_0="radialGradient";let E0;function L0(){return E0||(E0=tJ.createCanvasElement().getContext("2d"),E0)}const P0={};class O0 extends BJ{constructor(e){let t;for(super(e);t=tJ.getRandomColor(),!t||t in P0;);this.colorKey=t,P0[t]=this}getContext(){return tJ.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return tJ.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(w0,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(S0,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=L0().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new qQ;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate($Q.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(C0,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=L0(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y),i=0;ithis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return BJ.prototype.destroy.call(this),delete P0[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(!(null===(t=this.attrs.perfectDrawEnabled)||void 0===t||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=1!==this.getAbsoluteOpacity();if(n&&r&&o)return!0;const i=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&r&&i&&a)}setStrokeHitEnabled(e){tJ.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,i=r.width+o,a=r.height+o,s=!e.skipShadow&&this.hasShadow(),l=s?this.shadowOffsetX():0,c=s?this.shadowOffsetY():0,u=i+Math.abs(l),d=a+Math.abs(c),h=s&&this.shadowBlur()||0,f={width:u+2*h,height:d+2*h,x:-(o/2+h)+Math.min(l,0)+r.x,y:-(o/2+h)+Math.min(c,0)+r.y};return t?f:this._transformedRect(f,n)}drawScene(e,t){var n,r,o=this.getLayer(),i=e||o.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),l=this.getSceneFunc(),c=this.hasShadow(),u=i.isCache,d=t===this;if(!this.isVisible()&&!d)return this;if(s){a.save();var h=this.getAbsoluteTransform(t).getMatrix();return a.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!l)return this;if(a.save(),this._useBufferCanvas()&&!u){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var f=this.getAbsoluteTransform(t).getMatrix();r.transform(f[0],f[1],f[2],f[3],f[4],f[5]),l.call(this,r,this),r.restore();var p=n.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else{if(a._applyLineJoin(this),!d){f=this.getAbsoluteTransform(t).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),l.call(this,a,this)}return a.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),a=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),l=s&&s.hit;if(this.colorKey||tJ.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();var c=this.getAbsoluteTransform(t).getMatrix();return i.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!a)return this;i.save(),i._applyLineJoin(this);if(!(this===t)){var u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return a.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){var t,n,r,o,i,a=this._getCanvasCache(),s=this._getCachedSceneCanvas(),l=a.hit,c=l.getContext(),u=l.getWidth(),d=l.getHeight();c.clear(),c.drawImage(s._canvas,0,0,u,d);try{for(r=(n=(t=c.getImageData(0,0,u,d)).data).length,o=tJ._hexToRgb(this.colorKey),i=0;ie?(n[i]=o.r,n[i+1]=o.g,n[i+2]=o.b,n[i+3]=255):n[i+3]=0;c.putImageData(t,0,0)}catch(j2){tJ.error("Unable to draw hit graph from cached scene canvas. "+j2.message)}return this}hasPointerCapture(e){return $J(e,this)}setPointerCapture(e){GJ(e,this)}releaseCapture(e){qJ(e)}}O0.prototype._fillFunc=function(e){e.fill()},O0.prototype._strokeFunc=function(e){e.stroke()},O0.prototype._fillFuncHit=function(e){e.fill()},O0.prototype._strokeFuncHit=function(e){e.stroke()},O0.prototype._centroid=!1,O0.prototype.nodeType="Shape",GQ(O0),O0.prototype.eventListeners={},O0.prototype.on.call(O0.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(w0)})),O0.prototype.on.call(O0.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(k0)})),O0.prototype.on.call(O0.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(S0)})),O0.prototype.on.call(O0.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(C0)})),O0.prototype.on.call(O0.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(_0)})),hJ.addGetterSetter(O0,"stroke",void 0,lJ()),hJ.addGetterSetter(O0,"strokeWidth",2,oJ()),hJ.addGetterSetter(O0,"fillAfterStrokeEnabled",!1),hJ.addGetterSetter(O0,"hitStrokeWidth","auto",aJ()),hJ.addGetterSetter(O0,"strokeHitEnabled",!0,cJ()),hJ.addGetterSetter(O0,"perfectDrawEnabled",!0,cJ()),hJ.addGetterSetter(O0,"shadowForStrokeEnabled",!0,cJ()),hJ.addGetterSetter(O0,"lineJoin"),hJ.addGetterSetter(O0,"lineCap"),hJ.addGetterSetter(O0,"sceneFunc"),hJ.addGetterSetter(O0,"hitFunc"),hJ.addGetterSetter(O0,"dash"),hJ.addGetterSetter(O0,"dashOffset",0,oJ()),hJ.addGetterSetter(O0,"shadowColor",void 0,sJ()),hJ.addGetterSetter(O0,"shadowBlur",0,oJ()),hJ.addGetterSetter(O0,"shadowOpacity",1,oJ()),hJ.addComponentsGetterSetter(O0,"shadowOffset",["x","y"]),hJ.addGetterSetter(O0,"shadowOffsetX",0,oJ()),hJ.addGetterSetter(O0,"shadowOffsetY",0,oJ()),hJ.addGetterSetter(O0,"fillPatternImage"),hJ.addGetterSetter(O0,"fill",void 0,lJ()),hJ.addGetterSetter(O0,"fillPatternX",0,oJ()),hJ.addGetterSetter(O0,"fillPatternY",0,oJ()),hJ.addGetterSetter(O0,"fillLinearGradientColorStops"),hJ.addGetterSetter(O0,"strokeLinearGradientColorStops"),hJ.addGetterSetter(O0,"fillRadialGradientStartRadius",0),hJ.addGetterSetter(O0,"fillRadialGradientEndRadius",0),hJ.addGetterSetter(O0,"fillRadialGradientColorStops"),hJ.addGetterSetter(O0,"fillPatternRepeat","repeat"),hJ.addGetterSetter(O0,"fillEnabled",!0),hJ.addGetterSetter(O0,"strokeEnabled",!0),hJ.addGetterSetter(O0,"shadowEnabled",!0),hJ.addGetterSetter(O0,"dashEnabled",!0),hJ.addGetterSetter(O0,"strokeScaleEnabled",!0),hJ.addGetterSetter(O0,"fillPriority","color"),hJ.addComponentsGetterSetter(O0,"fillPatternOffset",["x","y"]),hJ.addGetterSetter(O0,"fillPatternOffsetX",0,oJ()),hJ.addGetterSetter(O0,"fillPatternOffsetY",0,oJ()),hJ.addComponentsGetterSetter(O0,"fillPatternScale",["x","y"]),hJ.addGetterSetter(O0,"fillPatternScaleX",1,oJ()),hJ.addGetterSetter(O0,"fillPatternScaleY",1,oJ()),hJ.addComponentsGetterSetter(O0,"fillLinearGradientStartPoint",["x","y"]),hJ.addComponentsGetterSetter(O0,"strokeLinearGradientStartPoint",["x","y"]),hJ.addGetterSetter(O0,"fillLinearGradientStartPointX",0),hJ.addGetterSetter(O0,"strokeLinearGradientStartPointX",0),hJ.addGetterSetter(O0,"fillLinearGradientStartPointY",0),hJ.addGetterSetter(O0,"strokeLinearGradientStartPointY",0),hJ.addComponentsGetterSetter(O0,"fillLinearGradientEndPoint",["x","y"]),hJ.addComponentsGetterSetter(O0,"strokeLinearGradientEndPoint",["x","y"]),hJ.addGetterSetter(O0,"fillLinearGradientEndPointX",0),hJ.addGetterSetter(O0,"strokeLinearGradientEndPointX",0),hJ.addGetterSetter(O0,"fillLinearGradientEndPointY",0),hJ.addGetterSetter(O0,"strokeLinearGradientEndPointY",0),hJ.addComponentsGetterSetter(O0,"fillRadialGradientStartPoint",["x","y"]),hJ.addGetterSetter(O0,"fillRadialGradientStartPointX",0),hJ.addGetterSetter(O0,"fillRadialGradientStartPointY",0),hJ.addComponentsGetterSetter(O0,"fillRadialGradientEndPoint",["x","y"]),hJ.addGetterSetter(O0,"fillRadialGradientEndPointX",0),hJ.addGetterSetter(O0,"fillRadialGradientEndPointY",0),hJ.addGetterSetter(O0,"fillPatternRotation",0),hJ.backCompat(O0,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var M0=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],T0=M0.length;class A0 extends FJ{constructor(e){super(e),this.canvas=new xJ,this.hitCanvas=new wJ({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),FJ.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),FJ.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){tJ.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return tJ.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return tJ.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}A0.prototype.nodeType="Layer",GQ(A0),hJ.addGetterSetter(A0,"imageSmoothingEnabled",!0),hJ.addGetterSetter(A0,"clearBeforeDraw",!0),hJ.addGetterSetter(A0,"hitGraphEnabled",!0,cJ());class I0 extends A0{constructor(e){super(e),this.listening(!1),tJ.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}I0.prototype.nodeType="FastLayer",GQ(I0);class R0 extends FJ{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&tJ.throw("You may only add groups and shapes to groups.")}}R0.prototype.nodeType="Group",GQ(R0);var N0=UQ.performance&&UQ.performance.now?function(){return UQ.performance.now()}:function(){return(new Date).getTime()};class D0{constructor(e,t){this.id=D0.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:N0(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t=[];return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,r=n.length;for(t=0;tthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class H0{constructor(e){var t,n,r=this,o=e.node,i=o._id,a=e.easing||W0.Linear,s=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=o,this._id=B0++;var l=o.getLayer()||(o instanceof $Q.Stage?o.getLayers():null);for(n in l||tJ.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new D0((function(){r.tween.onEnterFrame()}),l),this.tween=new F0(n,(function(e){r._tweenFunc(e)}),a,0,1,1e3*t,s),this._addListeners(),H0.attrs[i]||(H0.attrs[i]={}),H0.attrs[i][this._id]||(H0.attrs[i][this._id]={}),H0.tweens[i]||(H0.tweens[i]={}),e)void 0===z0[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,r,o,i,a,s,l,c,u=this.node,d=u._id;if((o=H0.tweens[d][e])&&delete H0.attrs[d][o][e],n=u.getAttr(e),tJ._isArray(t))if(r=[],a=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(l=n,n=tJ._prepareArrayForTween(n,t,u.closed())):(s=t,t=tJ._prepareArrayForTween(t,n,u.closed()))),0===e.indexOf("fill"))for(i=0;i{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=H0.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=H0.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=H0.tweens[t];for(e in this.pause(),r)delete H0.tweens[t][e];delete H0.attrs[t][n]}}H0.attrs={},H0.tweens={},BJ.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new H0(e).play()};const W0={BackEaseIn(e,t,n,r){var o=1.70158;return n*(e/=r)*e*((o+1)*e-o)+t},BackEaseOut(e,t,n,r){var o=1.70158;return n*((e=e/r-1)*e*((o+1)*e+o)+1)+t},BackEaseInOut(e,t,n,r){var o=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){var a=0;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),!o||o(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,t,n,r)=>n-W0.BounceEaseOut(r-e,0,n,r)+t,BounceEaseInOut:(e,t,n,r)=>en*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t},V0=tJ._assign($Q,{Util:tJ,Transform:qQ,Node:BJ,Container:FJ,Stage:x0,stages:b0,Layer:A0,FastLayer:I0,Group:R0,DD:kJ,Shape:O0,shapes:P0,Animation:D0,Tween:H0,Easings:W0,Context:gJ,Canvas:bJ});class U0 extends O0{_sceneFunc(e){var t=$Q.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=$Q.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),s=o*(o>0?e:t),l=i*(i>0?e:t),c=a*(a>0?t:e);return{x:s,y:n?-1*c:l,width:1*t-s,height:c-l}}}function $0(e,t,n,r,o,i,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),c=a*s/(s+l),u=a*l/(s+l);return[n-c*(o-e),r-c*(i-t),n+u*(o-e),r+u*(i-t)]}function G0(e,t){var n,r,o=e.length,i=[];for(n=2;n4){for(n=(t=this.getTensionPoints()).length,r=s?0:4,s||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);rc?l:c,g=l>c?1:l/c,m=l>c?c/l:1;e.translate(a,s),e.rotate(h),e.scale(g,m),e.arc(0,0,p,u,u+d,1-f),e.scale(1/g,1/m),e.rotate(-h),e.translate(-a,-s);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],o=t.points[4]+r,i=Math.PI/180;if(Math.abs(n-o)o;r-=i){const n=Y0.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+i;rthis.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===r)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var o=this.dataArray[n],i=o.points;switch(o.command){case"L":return Y0.getPointOnLine(e,o.start.x,o.start.y,i[0],i[1]);case"C":return Y0.getPointOnCubicBezier(e/o.pathLength,o.start.x,o.start.y,i[0],i[1],i[2],i[3],i[4],i[5]);case"Q":return Y0.getPointOnQuadraticBezier(e/o.pathLength,o.start.x,o.start.y,i[0],i[1],i[2],i[3]);case"A":var a=i[0],s=i[1],l=i[2],c=i[3],u=i[4],d=i[5],h=i[6];return u+=d*e/o.pathLength,Y0.getPointOnEllipticalArc(a,s,l,c,u,h)}return null}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPointOnLine(e,t,n,r,o,i,a){void 0===i&&(i=t),void 0===a&&(a=n);var s=(o-n)/(r-t+1e-8),l=Math.sqrt(e*e/(1+s*s));r0&&!isNaN(f[0]);){var v,y,b,x,w,k,S,C,_,E,L=null,P=[],O=l,M=c;switch(h){case"l":l+=f.shift(),c+=f.shift(),L="L",P.push(l,c);break;case"L":l=f.shift(),c=f.shift(),P.push(l,c);break;case"m":var T=f.shift(),A=f.shift();if(l+=T,c+=A,L="M",a.length>2&&"z"===a[a.length-1].command)for(var I=a.length-2;I>=0;I--)if("M"===a[I].command){l=a[I].points[0]+T,c=a[I].points[1]+A;break}P.push(l,c),h="l";break;case"M":l=f.shift(),c=f.shift(),L="M",P.push(l,c),h="L";break;case"h":l+=f.shift(),L="L",P.push(l,c);break;case"H":l=f.shift(),L="L",P.push(l,c);break;case"v":c+=f.shift(),L="L",P.push(l,c);break;case"V":c=f.shift(),L="L",P.push(l,c);break;case"C":P.push(f.shift(),f.shift(),f.shift(),f.shift()),l=f.shift(),c=f.shift(),P.push(l,c);break;case"c":P.push(l+f.shift(),c+f.shift(),l+f.shift(),c+f.shift()),l+=f.shift(),c+=f.shift(),L="C",P.push(l,c);break;case"S":y=l,b=c,"C"===(v=a[a.length-1]).command&&(y=l+(l-v.points[2]),b=c+(c-v.points[3])),P.push(y,b,f.shift(),f.shift()),l=f.shift(),c=f.shift(),L="C",P.push(l,c);break;case"s":y=l,b=c,"C"===(v=a[a.length-1]).command&&(y=l+(l-v.points[2]),b=c+(c-v.points[3])),P.push(y,b,l+f.shift(),c+f.shift()),l+=f.shift(),c+=f.shift(),L="C",P.push(l,c);break;case"Q":P.push(f.shift(),f.shift()),l=f.shift(),c=f.shift(),P.push(l,c);break;case"q":P.push(l+f.shift(),c+f.shift()),l+=f.shift(),c+=f.shift(),L="Q",P.push(l,c);break;case"T":y=l,b=c,"Q"===(v=a[a.length-1]).command&&(y=l+(l-v.points[0]),b=c+(c-v.points[1])),l=f.shift(),c=f.shift(),L="Q",P.push(y,b,l,c);break;case"t":y=l,b=c,"Q"===(v=a[a.length-1]).command&&(y=l+(l-v.points[0]),b=c+(c-v.points[1])),l+=f.shift(),c+=f.shift(),L="Q",P.push(y,b,l,c);break;case"A":x=f.shift(),w=f.shift(),k=f.shift(),S=f.shift(),C=f.shift(),_=l,E=c,l=f.shift(),c=f.shift(),L="A",P=this.convertEndpointToCenterParameterization(_,E,l,c,S,C,x,w,k);break;case"a":x=f.shift(),w=f.shift(),k=f.shift(),S=f.shift(),C=f.shift(),_=l,E=c,l+=f.shift(),c+=f.shift(),L="A",P=this.convertEndpointToCenterParameterization(_,E,l,c,S,C,x,w,k)}a.push({command:L||h,points:P,start:{x:O,y:M},pathLength:this.calcLength(O,M,L||h,P)})}"z"!==h&&"Z"!==h||a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,t,n,r){var o,i,a,s,l=Y0;switch(n){case"L":return l.getLineLength(e,t,r[0],r[1]);case"C":for(o=0,i=l.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),s=.01;s<=1;s+=.01)a=l.getPointOnCubicBezier(s,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),o+=l.getLineLength(i.x,i.y,a.x,a.y),i=a;return o;case"Q":for(o=0,i=l.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),s=.01;s<=1;s+=.01)a=l.getPointOnQuadraticBezier(s,e,t,r[0],r[1],r[2],r[3]),o+=l.getLineLength(i.x,i.y,a.x,a.y),i=a;return o;case"A":o=0;var c=r[4],u=r[5],d=r[4]+u,h=Math.PI/180;if(Math.abs(c-d)d;s-=h)a=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),o+=l.getLineLength(i.x,i.y,a.x,a.y),i=a;else for(s=c+h;s1&&(a*=Math.sqrt(h),s*=Math.sqrt(h));var f=Math.sqrt((a*a*(s*s)-a*a*(d*d)-s*s*(u*u))/(a*a*(d*d)+s*s*(u*u)));o===i&&(f*=-1),isNaN(f)&&(f=0);var p=f*a*d/s,g=f*-s*u/a,m=(e+n)/2+Math.cos(c)*p-Math.sin(c)*g,v=(t+r)/2+Math.sin(c)*p+Math.cos(c)*g,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},x=function(e,t){return(e[0]*t[1]=1&&(C=0),0===i&&C>0&&(C-=2*Math.PI),1===i&&C<0&&(C+=2*Math.PI),[m,v,a,s,w,C,c,i]}}Y0.prototype.className="Path",Y0.prototype._attrsAffectingSize=["data"],GQ(Y0),hJ.addGetterSetter(Y0,"data");class Z0 extends q0{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,o=0!==this.tension()&&n.length>4;o&&(r=this.getTensionPoints());var i,a,s=this.pointerLength(),l=n.length;if(o){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[l-2],n[l-1]],t=Y0.calcLength(r[r.length-4],r[r.length-3],"C",e),o=Y0.getPointOnQuadraticBezier(Math.min(1,1-s/t),e[0],e[1],e[2],e[3],e[4],e[5]);i=n[l-2]-o.x,a=n[l-1]-o.y}else i=n[l-2]-n[l-4],a=n[l-1]-n[l-3];var c=(Math.atan2(a,i)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[l-2],n[l-1]),e.rotate(c),e.moveTo(0,0),e.lineTo(-s,u/2),e.lineTo(-s,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(i=(r[0]+r[2])/2-n[0],a=(r[1]+r[3])/2-n[1]):(i=n[2]-n[0],a=n[3]-n[1]),e.rotate((Math.atan2(-a,-i)+t)%t),e.moveTo(0,0),e.lineTo(-s,u/2),e.lineTo(-s,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}Z0.prototype.className="Arrow",GQ(Z0),hJ.addGetterSetter(Z0,"pointerLength",10,oJ()),hJ.addGetterSetter(Z0,"pointerWidth",10,oJ()),hJ.addGetterSetter(Z0,"pointerAtBeginning",!1),hJ.addGetterSetter(Z0,"pointerAtEnding",!0);class X0 extends O0{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}X0.prototype._centroid=!0,X0.prototype.className="Circle",X0.prototype._attrsAffectingSize=["radius"],GQ(X0),hJ.addGetterSetter(X0,"radius",0,oJ());class K0 extends O0{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}K0.prototype.className="Ellipse",K0.prototype._centroid=!0,K0.prototype._attrsAffectingSize=["radiusX","radiusY"],GQ(K0),hJ.addComponentsGetterSetter(K0,"radius",["x","y"]),hJ.addGetterSetter(K0,"radiusX",0,oJ()),hJ.addGetterSetter(K0,"radiusY",0,oJ());class Q0 extends O0{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),r=this.attrs.image;let o;if(r){const e=this.attrs.cropWidth,i=this.attrs.cropHeight;o=e&&i?[r,this.cropX(),this.cropY(),e,i,0,0,t,n]:[r,0,0,t,n]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),r&&e.drawImage.apply(e,o)}_hitFunc(e){var t=this.width(),n=this.height();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var r=tJ.createImageElement();r.onload=function(){var e=new Q0({image:r});t(e)},r.onerror=n,r.crossOrigin="Anonymous",r.src=e}}Q0.prototype.className="Image",GQ(Q0),hJ.addGetterSetter(Q0,"image"),hJ.addComponentsGetterSetter(Q0,"crop",["x","y","width","height"]),hJ.addGetterSetter(Q0,"cropX",0,oJ()),hJ.addGetterSetter(Q0,"cropY",0,oJ()),hJ.addGetterSetter(Q0,"cropWidth",0,oJ()),hJ.addGetterSetter(Q0,"cropHeight",0,oJ());var J0=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],e1="up",t1="right",n1="down",r1="left",o1=J0.length;class i1 extends R0{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.y)})),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}l1.prototype.className="RegularPolygon",l1.prototype._centroid=!0,l1.prototype._attrsAffectingSize=["radius"],GQ(l1),hJ.addGetterSetter(l1,"radius",0,oJ()),hJ.addGetterSetter(l1,"sides",0,oJ());var c1=2*Math.PI;class u1 extends O0{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,c1,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),c1,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}u1.prototype.className="Ring",u1.prototype._centroid=!0,u1.prototype._attrsAffectingSize=["innerRadius","outerRadius"],GQ(u1),hJ.addGetterSetter(u1,"innerRadius",0,oJ()),hJ.addGetterSetter(u1,"outerRadius",0,oJ());class d1 extends O0{constructor(e){super(e),this._updated=!0,this.anim=new D0((()=>{var e=this._updated;return this._updated=!1,e})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,o=this.animations()[t],i=this.frameOffsets(),a=o[r+0],s=o[r+1],l=o[r+2],c=o[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,c),e.closePath(),e.fillStrokeShape(this)),u)if(i){var d=i[t],h=2*n;e.drawImage(u,a,s,l,c,d[h+0],d[h+1],l,c)}else e.drawImage(u,a,s,l,c,0,0,l,c)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,o=this.animations()[t],i=this.frameOffsets(),a=o[r+2],s=o[r+3];if(e.beginPath(),i){var l=i[t],c=2*n;e.rect(l[c+0],l[c+1],a,s)}else e.rect(0,0,a,s);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e1&&(m+=a)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=tJ._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===g1||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===g1||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return tJ.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=C1(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}_getContextFont(){return this.fontStyle()+x1+this.fontVariant()+x1+(this.fontSize()+"px ")+this.fontFamily().split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}_addTextLine(e){this.align()===m1&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return C1().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,a=o!==g1&&void 0!==o,s=i!==g1&&void 0!==i,l=this.padding(),c=o-2*l,u=i-2*l,d=0,h=this.wrap(),f="char"!==h&&h!==w1,p=this.ellipsis();this.textArr=[],C1().font=this._getContextFont();for(var g=p?this._getTextWidth("…"):0,m=0,v=e.length;mc)for(;y.length>0;){for(var x=0,w=y.length,k="",S=0;x>>1,_=y.slice(0,C+1),E=this._getTextWidth(_)+g;E<=c?(x=C+1,k=_,S=E):w=C}if(!k)break;if(f){var L,P=y[k.length];(L=(P===x1||"-"===P)&&S<=c?k.length:Math.max(k.lastIndexOf(x1),k.lastIndexOf("-"))+1)>0&&(x=L,k=k.slice(0,x),S=this._getTextWidth(k))}if(k=k.trimRight(),this._addTextLine(k),n=Math.max(n,S),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if((y=(y=y.slice(x)).trimLeft()).length>0&&(b=this._getTextWidth(y))<=c){this._addTextLine(y),d+=r,n=Math.max(n,b);break}}else this._addTextLine(y),d+=r,n=Math.max(n,b),this._shouldHandleEllipsis(d)&&mu)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==g1&&void 0!==r,i=r-2*this.padding();return!(this.wrap()!==w1)||o&&e+n>i}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==g1&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),o=this.textArr[this.textArr.length-1];if(o&&r){if(t)this._getTextWidth(o.text+"…")=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r0&&(a+=e.dataArray[s].pathLength);var l=0;"center"===r&&(l=Math.max(0,a/2-i/2)),"right"===r&&(l=Math.max(0,a-i));for(var c,u,d,h=f1(this.text()),f=this.text().split(" ").length-1,p=-1,g=0,m=function(){g=0;for(var t=e.dataArray,n=p+1;n0)return p=n,t[n];"M"===t[n].command&&(c={x:t[n].points[0],y:t[n].points[1]})}return{}},v=function(t){var o=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(o+=(a-i)/f);var s=0,l=0;for(u=void 0;Math.abs(o-s)/o>.01&&l<20;){l++;for(var h=s;void 0===d;)(d=m())&&h+d.pathLengtho?u=Y0.getPointOnLine(o,c.x,c.y,d.points[0],d.points[1],c.x,c.y):d=void 0;break;case"A":var v=d.points[4],y=d.points[5],b=d.points[4]+y;0===g?g=v+1e-8:o>s?g+=Math.PI/180*y/Math.abs(y):g-=Math.PI/360*y/Math.abs(y),(y<0&&g=0&&g>b)&&(g=b,p=!0),u=Y0.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],g,d.points[6]);break;case"C":0===g?g=o>d.pathLength?1e-8:o/d.pathLength:o>s?g+=(o-s)/d.pathLength/2:g=Math.max(g-(s-o)/d.pathLength/2,0),g>1&&(g=1,p=!0),u=Y0.getPointOnCubicBezier(g,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);break;case"Q":0===g?g=o/d.pathLength:o>s?g+=(o-s)/d.pathLength:g-=(s-o)/d.pathLength,g>1&&(g=1,p=!0),u=Y0.getPointOnQuadraticBezier(g,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3])}void 0!==u&&(s=Y0.getLineLength(c.x,c.y,u.x,u.y)),p&&(p=!1,d=void 0)}},y=l/(e._getTextSize("C").width+n)-1,b=0;be+`.${M1}`)).join(" "),A1="nodesRect",I1=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],R1={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const N1="ontouchstart"in $Q._global;var D1=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function z1(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:o})}function B1(e,t){const n=function(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}(e);return z1(e,t,n)}class j1 extends R0{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(T1,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return tJ.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return M1+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(I1.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+o,y:r.y+i}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(A1),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(A1,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),a=r.x*o.x-e.offsetX()*o.x,s=r.y*o.y-e.offsetY()*o.y;const l=($Q.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return z1({x:i.x+a*Math.cos(l)+s*Math.sin(-l),y:i.y+s*Math.cos(l)+a*Math.sin(l),width:r.width*o.x,height:r.height*o.y,rotation:l},-$Q.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],o=t.getAbsoluteTransform();r.forEach((function(t){var n=o.point(t);e.push(n)}))}));const t=new qQ;var n,r,o,i;t.rotate(-$Q.getAngle(this.rotation())),e.forEach((function(e){var a=t.point(e);void 0===n&&(n=o=a.x,r=i=a.y),n=Math.min(n,a.x),r=Math.min(r,a.y),o=Math.max(o,a.x),i=Math.max(i,a.y)})),t.invert();const a=t.point({x:n,y:r});return{x:a.x,y:a.y,width:o-n,height:i-r,rotation:$Q.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),D1.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new s1({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:N1?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=$Q.getAngle(this.rotation()),r=function(e,t){if("rotater"===e)return"crosshair";t+=tJ.degToRad(R1[e]||0);var n=(tJ.radToDeg(t)%360+360)%360;return tJ._inRange(n,337.5,360)||tJ._inRange(n,0,22.5)?"ns-resize":tJ._inRange(n,22.5,67.5)?"nesw-resize":tJ._inRange(n,67.5,112.5)?"ew-resize":tJ._inRange(n,112.5,157.5)?"nwse-resize":tJ._inRange(n,157.5,202.5)?"ns-resize":tJ._inRange(n,202.5,247.5)?"nesw-resize":tJ._inRange(n,247.5,292.5)?"ew-resize":tJ._inRange(n,292.5,337.5)?"nwse-resize":(tJ.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new O0({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*tJ._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var i=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-i.x,y:a.y-i.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}_handleMouseMove(e){var t,n,r,o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const a=i.getPointerPosition();let s={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(s=this.anchorDragBoundFunc()(l,s,e)),o.setAbsolutePosition(s);const c=o.getAbsolutePosition();if(l.x!==c.x||l.y!==c.y)if("rotater"!==this._movingAnchorName){var u=this.keepRatio()||e.shiftKey,d=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(u){var h=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(h.x-o.x(),2)+Math.pow(h.y-o.y(),2));var f=this.findOne(".top-left").x()>h.x?-1:1,p=this.findOne(".top-left").y()>h.y?-1:1;t=r*this.cos*f,n=r*this.sin*p,this.findOne(".top-left").x(h.x-t),this.findOne(".top-left").y(h.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(o.y());else if("top-right"===this._movingAnchorName){if(u){h=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-h.x,2)+Math.pow(h.y-o.y(),2));f=this.findOne(".top-right").x()h.y?-1:1;t=r*this.cos*f,n=r*this.sin*p,this.findOne(".top-right").x(h.x+t),this.findOne(".top-right").y(h.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(o.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(o.x());else if("bottom-left"===this._movingAnchorName){if(u){h=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(h.x-o.x(),2)+Math.pow(o.y()-h.y,2));f=h.x{t._fire("transformend",{evt:e,target:t})})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(tJ._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(tJ._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=this.flipEnabled();var o=new qQ;if(o.rotate($Q.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=o.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!r)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=o.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!r)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=o.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=o.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:tJ.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,a=new qQ;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/i,n.height/i);const s=new qQ;s.translate(e.x,e.y),s.rotate(e.rotation),s.scale(e.width/i,e.height/i);const l=s.multiply(a.invert());this._nodes.forEach((e=>{var n;const r=e.getParent().getAbsoluteTransform(),o=e.getTransform().copy();o.translate(e.offsetX(),e.offsetY());const i=new qQ;i.multiply(r.copy().invert()).multiply(l).multiply(r).multiply(o);const a=i.decompose();e.setAttrs(a),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(tJ._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(tJ._getRotation(t.rotation));var n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),a=this.padding(),s=this.anchorSize();this.find("._anchor").forEach((e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:s/2+a,offsetY:s/2+a,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:s/2+a,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:s/2-a,offsetY:s/2+a,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:s/2+a,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:s/2-a,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:s/2+a,offsetY:s/2-a,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:s/2-a,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:s/2-a,offsetY:s/2-a,visible:i&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*tJ._sign(r)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),R0.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return BJ.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}j1.prototype.className="Transformer",GQ(j1),hJ.addGetterSetter(j1,"enabledAnchors",D1,(function(e){return e instanceof Array||tJ.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===D1.indexOf(e)&&tJ.warn("Unknown anchor name: "+e+". Available names are: "+D1.join(", "))})),e||[]})),hJ.addGetterSetter(j1,"flipEnabled",!0,cJ()),hJ.addGetterSetter(j1,"resizeEnabled",!0),hJ.addGetterSetter(j1,"anchorSize",10,oJ()),hJ.addGetterSetter(j1,"rotateEnabled",!0),hJ.addGetterSetter(j1,"rotationSnaps",[]),hJ.addGetterSetter(j1,"rotateAnchorOffset",50,oJ()),hJ.addGetterSetter(j1,"rotationSnapTolerance",5,oJ()),hJ.addGetterSetter(j1,"borderEnabled",!0),hJ.addGetterSetter(j1,"anchorStroke","rgb(0, 161, 255)"),hJ.addGetterSetter(j1,"anchorStrokeWidth",1,oJ()),hJ.addGetterSetter(j1,"anchorFill","white"),hJ.addGetterSetter(j1,"anchorCornerRadius",0,oJ()),hJ.addGetterSetter(j1,"borderStroke","rgb(0, 161, 255)"),hJ.addGetterSetter(j1,"borderStrokeWidth",1,oJ()),hJ.addGetterSetter(j1,"borderDash"),hJ.addGetterSetter(j1,"keepRatio",!0),hJ.addGetterSetter(j1,"centeredScaling",!1),hJ.addGetterSetter(j1,"ignoreStroke",!1),hJ.addGetterSetter(j1,"padding",0,oJ()),hJ.addGetterSetter(j1,"node"),hJ.addGetterSetter(j1,"nodes"),hJ.addGetterSetter(j1,"boundBoxFunc"),hJ.addGetterSetter(j1,"anchorDragBoundFunc"),hJ.addGetterSetter(j1,"shouldOverdrawWholeArea",!1),hJ.addGetterSetter(j1,"useSingleNodeRotation",!0),hJ.backCompat(j1,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class F1 extends O0{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,$Q.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function H1(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}F1.prototype.className="Wedge",F1.prototype._centroid=!0,F1.prototype._attrsAffectingSize=["radius"],GQ(F1),hJ.addGetterSetter(F1,"radius",0,oJ()),hJ.addGetterSetter(F1,"angle",0,oJ()),hJ.addGetterSetter(F1,"clockwise",!1),hJ.backCompat(F1,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var W1=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],V1=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];hJ.addGetterSetter(BJ,"blurRadius",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"brightness",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"contrast",0,oJ(),hJ.afterSetFilter);function U1(e,t,n,r,o){var i=n-t,a=o-r;return 0===i?r+a/2:0===a?r:a*((e-t)/i)+r}hJ.addGetterSetter(BJ,"embossStrength",.5,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"embossWhiteLevel",.5,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"embossDirection","top-left",null,hJ.afterSetFilter),hJ.addGetterSetter(BJ,"embossBlend",!1,null,hJ.afterSetFilter);hJ.addGetterSetter(BJ,"enhance",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"hue",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"saturation",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"luminance",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"hue",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"saturation",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"value",0,oJ(),hJ.afterSetFilter);function $1(e,t,n){var r=4*(n*e.width+t),o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function G1(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}hJ.addGetterSetter(BJ,"kaleidoscopePower",2,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"kaleidoscopeAngle",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"threshold",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"noise",.2,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"pixelSize",8,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"levels",.5,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"blue",0,rJ,hJ.afterSetFilter);hJ.addGetterSetter(BJ,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"blue",0,rJ,hJ.afterSetFilter),hJ.addGetterSetter(BJ,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}));hJ.addGetterSetter(BJ,"threshold",.5,oJ(),hJ.afterSetFilter);const q1=V0.Util._assign(V0,{Arc:U0,Arrow:Z0,Circle:X0,Ellipse:K0,Image:Q0,Label:i1,Tag:a1,Line:q0,Path:Y0,Rect:s1,RegularPolygon:l1,Ring:u1,Sprite:d1,Star:h1,Text:_1,TextPath:O1,Transformer:j1,Wedge:F1,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,o,i,a,s,l,c,u,d,h,f,p,g,m,v,y,b,x,w,k,S,C,_,E=e.data,L=e.width,P=e.height,O=t+t+1,M=L-1,T=P-1,A=t+1,I=A*(A+1)/2,R=new H1,N=null,D=R,z=null,B=null,j=W1[t],F=V1[t];for(o=1;o>F,0!==C?(C=255/C,E[s]=(c*j>>F)*C,E[s+1]=(u*j>>F)*C,E[s+2]=(d*j>>F)*C):E[s]=E[s+1]=E[s+2]=0,c-=f,u-=p,d-=g,h-=m,f-=z.r,p-=z.g,g-=z.b,m-=z.a,i=l+((i=n+t+1)>F,C>0?(C=255/C,E[i]=(c*j>>F)*C,E[i+1]=(u*j>>F)*C,E[i+2]=(d*j>>F)*C):E[i]=E[i+1]=E[i+2]=0,c-=f,u-=p,d-=g,h-=m,f-=z.r,p-=z.g,g-=z.b,m-=z.a,i=n+((i=r+A)255?255:i,a=(a*=255)<0?0:a>255?255:a,s=(s*=255)<0?0:s>255?255:s,r[t]=i,r[t+1]=a,r[t+2]=s},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),o=this.embossBlend(),i=0,a=0,s=e.data,l=e.width,c=e.height,u=4*l,d=c;switch(r){case"top-left":i=-1,a=-1;break;case"top":i=-1,a=0;break;case"top-right":i=-1,a=1;break;case"right":i=0,a=1;break;case"bottom-right":i=1,a=1;break;case"bottom":i=1,a=0;break;case"bottom-left":i=1,a=-1;break;case"left":i=0,a=-1;break;default:tJ.error("Unknown emboss direction: "+r)}do{var h=(d-1)*u,f=i;d+f<1&&(f=0),d+f>c&&(f=0);var p=(d-1+f)*l*4,g=l;do{var m=h+4*(g-1),v=a;g+v<1&&(v=0),g+v>l&&(v=0);var y=p+4*(g-1+v),b=s[m]-s[y],x=s[m+1]-s[y+1],w=s[m+2]-s[y+2],k=b,S=k>0?k:-k;if((x>0?x:-x)>S&&(k=x),(w>0?w:-w)>S&&(k=w),k*=t,o){var C=s[m]+k,_=s[m+1]+k,E=s[m+2]+k;s[m]=C>255?255:C<0?0:C,s[m+1]=_>255?255:_<0?0:_,s[m+2]=E>255?255:E<0?0:E}else{var L=n-k;L<0?L=0:L>255&&(L=255),s[m]=s[m+1]=s[m+2]=L}}while(--g)}while(--d)},Enhance:function(e){var t,n,r,o,i=e.data,a=i.length,s=i[0],l=s,c=i[1],u=c,d=i[2],h=d,f=this.enhance();if(0!==f){for(o=0;ol&&(l=t),(n=i[o+1])u&&(u=n),(r=i[o+2])h&&(h=r);var p,g,m,v,y,b,x,w,k;for(l===s&&(l=255,s=0),u===c&&(u=255,c=0),h===d&&(h=255,d=0),f>0?(g=l+f*(255-l),m=s-f*(s-0),y=u+f*(255-u),b=c-f*(c-0),w=h+f*(255-h),k=d-f*(d-0)):(g=l+f*(l-(p=.5*(l+s))),m=s+f*(s-p),y=u+f*(u-(v=.5*(u+c))),b=c+f*(c-v),w=h+f*(h-(x=.5*(h+d))),k=d+f*(d-x)),o=0;ov?a:v;var y,b,x,w,k=u,S=c,C=360/S*Math.PI/180;for(b=0;bu&&(b=y,x=0,w=-1),n=0;nb?l:b;var x,w,k,S=h,C=d,_=n.polarRotation||0;for(o=0;o=0&&f=0&&p=0&&f=0&&p=1020?255:0}return a}(t,e.width,e.height),t=function(e,t,n){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),a=[],s=0;s=0&&f=0&&p=m))for(n=u;n=v||(o+=x[(r=4*(m*n+t))+0],i+=x[r+1],a+=x[r+2],s+=x[r+3],p+=1);for(o/=p,i/=p,a/=p,s/=p,t=l;t=m))for(n=u;n=v||(x[(r=4*(m*n+t))+0]=o,x[r+1]=i,x[r+2]=a,x[r+3]=s)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,o=r.length,i=255/n;for(t=0;t127&&(l=255-l),c>127&&(c=255-c),u>127&&(u=255-u),t[s]=l,t[s+1]=c,t[s+2]=u}while(--a)}while(--o)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,o=r.length;for(t=0;tY1,K1=()=>Z1,Q1=e=>{const t=X1(),{generationMode:n,optionsState:r,canvasState:o,systemState:i}=e,{cfgScale:a,codeformerFidelity:s,facetoolStrength:l,facetoolType:c,height:u,hiresFix:d,img2imgStrength:h,infillMethod:f,initialImage:p,iterations:g,perlin:m,prompt:v,sampler:y,seamBlur:b,seamless:x,seamSize:w,seamSteps:k,seamStrength:S,seed:C,seedWeights:_,shouldFitToWidthHeight:E,shouldGenerateVariations:L,shouldRandomizeSeed:P,shouldRunESRGAN:O,shouldRunFacetool:M,steps:T,threshold:A,tileSize:I,upscalingLevel:R,upscalingStrength:N,variationAmount:D,width:z}=r,{shouldDisplayInProgressType:B,saveIntermediatesInterval:j,enableImageDebugging:F}=i,H={prompt:v,iterations:g,steps:T,cfg_scale:a,threshold:A,perlin:m,height:u,width:z,sampler_name:y,seed:C,progress_images:"full-res"===B,progress_latents:"latents"===B,save_intermediates:j,generation_mode:n,init_mask:""};let W=!1,V=!1;if(H.seed=P?WQ(0,jQ):C,["txt2img","img2img"].includes(n)&&(H.seamless=x,H.hires_fix=d,O&&(W={level:R,strength:N}),M&&(V={type:c,strength:l},"codeformer"===c&&(V.codeformer_fidelity=s))),"img2img"===n&&p&&(H.init_img="string"==typeof p?p:p.url,H.strength=h,H.fit=E),"unifiedCanvas"===n&&t){const{layerState:{objects:e},boundingBoxCoordinates:n,boundingBoxDimensions:r,inpaintReplace:i,shouldUseInpaintReplace:a,stageScale:s,isMaskEnabled:l,shouldPreserveMaskedArea:c,boundingBoxScaleMethod:u,scaledBoundingBoxDimensions:d}=o,p={...n,...r},g=((e,t)=>{const{width:n,height:r}=t,o=document.createElement("div"),i=new q1.Stage({container:o,width:n,height:r}),a=new q1.Layer,s=new q1.Layer;a.add(new q1.Rect({...t,fill:"white"})),e.forEach((e=>s.add(new q1.Line({points:e.points,stroke:"black",strokeWidth:2*e.strokeWidth,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:"brush"===e.tool?"source-over":"destination-out"})))),i.add(a),i.add(s);const l=i.toDataURL({...t});return o.remove(),l})(l?e.filter(EZ):[],p);H.init_mask=g,H.fit=!1,H.strength=h,H.invert_mask=c,a&&(H.inpaint_replace=i),H.bounding_box=p;const m=t.scale();t.scale({x:1/s,y:1/s});const v=t.getAbsolutePosition(),y=t.toDataURL({x:p.x+v.x,y:p.y+v.y,width:p.width,height:p.height});F&&(e=>{const t=window.open("");t&&e.forEach((e=>{const n=new Image;n.src=e.base64,t.document.write(e.caption),t.document.write("
"),t.document.write(n.outerHTML),t.document.write("

")}))})([{base64:g,caption:"mask sent as init_mask"},{base64:y,caption:"image sent as init_img"}]),t.scale(m),H.init_img=y,H.progress_images=!1,"none"!==u&&(H.inpaint_width=d.width,H.inpaint_height=d.height),H.seam_size=w,H.seam_blur=b,H.seam_strength=S,H.seam_steps=k,H.tile_size=I,H.infill_method=f,H.force_outpaint=!1}return L?(H.variation_amount=D,_&&(H.with_variations=(e=>{const t=e.split(",").map((e=>e.split(":")));return t.map((e=>[parseInt(e[0]),parseFloat(e[1])]))})(_))):H.variation_amount=0,F&&(H.enable_image_debugging=F),{generationParameters:H,esrganParameters:W,facetoolParameters:V}},J1=()=>{const{origin:e}=new URL(window.location.href),t=rQ(e,{timeout:6e4,path:window.location.pathname+"socket.io"});let n=!1;return e=>r=>o=>{const{onConnect:i,onDisconnect:a,onError:s,onPostprocessingResult:l,onGenerationResult:c,onIntermediateResult:u,onProgressUpdate:d,onGalleryImages:h,onProcessingCanceled:f,onImageDeleted:p,onSystemConfig:g,onModelChanged:m,onFoundModels:v,onNewModelAdded:y,onModelDeleted:b,onModelChangeFailed:x,onTempFolderEmptied:w}=(e=>{const{dispatch:t,getState:n}=e;return{onConnect:()=>{try{t(qY(!0)),t(QY(gq.t("common:statusConnected"))),t(PQ());const e=n().gallery;e.categories.result.latest_mtime?t(EQ("result")):t(_Q("result")),e.categories.user.latest_mtime?t(EQ("user")):t(_Q("user"))}catch(j2){console.error(j2)}},onDisconnect:()=>{try{t(qY(!1)),t(QY(gq.t("common:statusDisconnected"))),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(j2){console.error(j2)}},onGenerationResult:e=>{try{const r=n(),{shouldLoopback:o,activeTab:i}=r.options,{boundingBox:a,generationMode:s,...l}=e,c={uuid:cQ(),...l};if(["txt2img","img2img"].includes(s)&&t(R$({category:"result",image:{...c,category:"result"}})),"unifiedCanvas"===s&&e.boundingBox){const{boundingBox:n}=e;t(IZ({image:{...c,category:"temp"},boundingBox:n})),r.canvas.shouldAutoSave&&t(R$({image:{...c,category:"result"},category:"result"}))}o&&"img2img"===LU[i]&&t(GU(c)),t(N$()),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Image generated: ${e.url}`}))}catch(j2){console.error(j2)}},onIntermediateResult:e=>{try{t(j$({uuid:cQ(),...e,category:"result"})),e.isBase64||t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Intermediate image generated: ${e.url}`}))}catch(j2){console.error(j2)}},onPostprocessingResult:e=>{try{t(R$({category:"result",image:{uuid:cQ(),...e,category:"result"}})),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Postprocessed: ${e.url}`}))}catch(j2){console.error(j2)}},onProgressUpdate:e=>{try{t(UY(!0)),t(KY(e))}catch(j2){console.error(j2)}},onError:e=>{const{message:n,additionalData:r}=e;try{t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Server error: ${n}`,level:"error"})),t(nZ()),t(N$())}catch(j2){console.error(j2)}},onGalleryImages:e=>{const{images:n,areMoreImagesAvailable:r,category:o}=e,i=n.map((e=>({uuid:cQ(),...e})));t(B$({images:i,areMoreImagesAvailable:r,category:o})),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Loaded ${n.length} images`}))},onProcessingCanceled:()=>{t(tZ());const{intermediateImage:e}=n().gallery;e&&(e.isBase64||(t(R$({category:"result",image:e})),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Intermediate image saved: ${e.url}`}))),t(N$())),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:e=>{const{url:r}=e;t(D$(e));const{initialImage:o,maskPath:i}=n().options;o!==r&&o?.url!==r||t(MU()),i===r&&t(ZU("")),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Image deleted: ${r}`}))},onSystemConfig:e=>{t(JY(e)),e.infill_methods.includes("patchmatch")||t($U(e.infill_methods[0]))},onFoundModels:e=>{const{search_folder:n,found_models:r}=e;t(fZ(n)),t(pZ(r))},onNewModelAdded:e=>{const{new_model_name:n,model_list:r,update:o}=e;t(oZ(r)),t(UY(!1)),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Model Added: ${n}`,level:"info"})),t(uZ({title:o?`${gq.t("modelmanager:modelUpdated")}: ${n}`:`${gq.t("modelmanager:modelAdded")}: ${n}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:e=>{const{deleted_model_name:n,model_list:r}=e;t(oZ(r)),t(UY(!1)),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`${gq.t("modelmanager:modelAdded")}: ${n}`,level:"info"})),t(uZ({title:`${gq.t("modelmanager:modelEntryDeleted")}: ${n}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:e=>{const{model_name:n,model_list:r}=e;t(oZ(r)),t(QY(gq.t("common:statusModelChanged"))),t(UY(!1)),t(iZ(!0)),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Model changed: ${n}`,level:"info"}))},onModelChangeFailed:e=>{const{model_name:n,model_list:r}=e;t(oZ(r)),t(UY(!1)),t(iZ(!0)),t(nZ()),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Model change failed: ${n}`,level:"error"}))},onTempFolderEmptied:()=>{t(uZ({title:gq.t("toast:tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}})(e),{emitGenerateImage:k,emitRunESRGAN:S,emitRunFacetool:C,emitDeleteImage:_,emitRequestImages:E,emitRequestNewImages:L,emitCancelProcessing:P,emitRequestSystemConfig:O,emitSearchForModels:M,emitAddNewModel:T,emitDeleteModel:A,emitRequestModelChange:I,emitSaveStagingAreaImageToGallery:R,emitRequestEmptyTempFolder:N}=((e,t)=>{const{dispatch:n,getState:r}=e;return{emitGenerateImage:e=>{n(UY(!0));const o=r(),{options:i,system:a,canvas:s}=o,l={generationMode:e,optionsState:i,canvasState:s,systemState:a};n(cZ());const{generationParameters:c,esrganParameters:u,facetoolParameters:d}=Q1(l);t.emit("generateImage",c,u,d),c.init_mask&&(c.init_mask=c.init_mask.substr(0,64).concat("...")),c.init_img&&(c.init_img=c.init_img.substr(0,64).concat("...")),n($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...c,...u,...d})}`}))},emitRunESRGAN:e=>{n(UY(!0));const o=r().options,{upscalingLevel:i,upscalingStrength:a}=o,s={upscale:[i,a]};t.emit("runPostprocessing",e,{type:"esrgan",...s}),n($Y({timestamp:fQ(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:e.url,...s})}`}))},emitRunFacetool:e=>{n(UY(!0));const o=r().options,{facetoolType:i,facetoolStrength:a,codeformerFidelity:s}=o,l={facetool_strength:a};"codeformer"===i&&(l.codeformer_fidelity=s),t.emit("runPostprocessing",e,{type:i,...l}),n($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Face restoration (${i}) requested: ${JSON.stringify({file:e.url,...l})}`}))},emitDeleteImage:e=>{const{url:r,uuid:o,category:i,thumbnail:a}=e;n(D$(e)),t.emit("deleteImage",r,a,o,i)},emitRequestImages:e=>{const n=r().gallery,{earliest_mtime:o}=n.categories[e];t.emit("requestImages",e,o)},emitRequestNewImages:e=>{const n=r().gallery,{latest_mtime:o}=n.categories[e];t.emit("requestLatestImages",e,o)},emitCancelProcessing:()=>{t.emit("cancel")},emitRequestSystemConfig:()=>{t.emit("requestSystemConfig")},emitSearchForModels:e=>{t.emit("searchForModels",e)},emitAddNewModel:e=>{t.emit("addNewModel",e)},emitDeleteModel:e=>{t.emit("deleteModel",e)},emitRequestModelChange:e=>{n(aZ()),t.emit("requestModelChange",e)},emitSaveStagingAreaImageToGallery:e=>{t.emit("requestSaveStagingAreaImageToGallery",e)},emitRequestEmptyTempFolder:()=>{t.emit("requestEmptyTempFolder")}}})(e,t);switch(n||(t.on("connect",(()=>i())),t.on("disconnect",(()=>a())),t.on("error",(e=>s(e))),t.on("generationResult",(e=>c(e))),t.on("postprocessingResult",(e=>l(e))),t.on("intermediateResult",(e=>u(e))),t.on("progressUpdate",(e=>d(e))),t.on("galleryImages",(e=>h(e))),t.on("processingCanceled",(()=>{f()})),t.on("imageDeleted",(e=>{p(e)})),t.on("systemConfig",(e=>{g(e)})),t.on("foundModels",(e=>{v(e)})),t.on("newModelAdded",(e=>{y(e)})),t.on("modelDeleted",(e=>{b(e)})),t.on("modelChanged",(e=>{m(e)})),t.on("modelChangeFailed",(e=>{x(e)})),t.on("tempFolderEmptied",(()=>{w()})),n=!0),o.type){case"socketio/generateImage":k(o.payload);break;case"socketio/runESRGAN":S(o.payload);break;case"socketio/runFacetool":C(o.payload);break;case"socketio/deleteImage":_(o.payload);break;case"socketio/requestImages":E(o.payload);break;case"socketio/requestNewImages":L(o.payload);break;case"socketio/cancelProcessing":P();break;case"socketio/requestSystemConfig":O();break;case"socketio/searchForModels":M(o.payload);break;case"socketio/addNewModel":T(o.payload);break;case"socketio/deleteModel":A(o.payload);break;case"socketio/requestModelChange":I(o.payload);break;case"socketio/saveStagingAreaImageToGallery":R(o.payload);break;case"socketio/requestEmptyTempFolder":N()}r(o)}},e2=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map((e=>`canvas.${e}`)),t2=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel"].map((e=>`system.${e}`)),n2=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","shouldHoldGalleryOpen","intermediateImage"].map((e=>`gallery.${e}`)),r2=nV({options:M$,gallery:Q$,system:mZ,canvas:UX}),o2=function(e,t){var n=void 0!==e.version?e.version:-1;e.debug;var r=void 0===e.stateReconciler?ZV:e.stateReconciler,o=e.getStoredState||QV,i=void 0!==e.timeout?e.timeout:5e3,a=null,s=!1,l=!0,c=function(e){return e._persist.rehydrated&&a&&!l&&a.update(e),e};return function(u,d){var h=u||{},f=h._persist,p=oU(h,["_persist"]);if(d.type===VV){var g=!1,m=function(t,n){g||(d.rehydrate(e.key,t,n),g=!0)};if(i&&setTimeout((function(){!g&&m(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))}),i),l=!1,a||(a=XV(e)),f)return nU({},t(p,d),{_persist:f});if("function"!=typeof d.rehydrate||"function"!=typeof d.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return d.register(e.key),o(e).then((function(t){var r=e.migrate||function(e,t){return Promise.resolve(e)};r(t,n).then((function(e){m(e)}),(function(e){m(void 0,e)}))}),(function(e){m(void 0,e)})),nU({},t(p,d),{_persist:{version:n,rehydrated:!1}})}if(d.type===UV)return s=!0,d.result(function(e){var t=e.storage,n="".concat(void 0!==e.keyPrefix?e.keyPrefix:jV).concat(e.key);return t.removeItem(n,eU)}(e)),nU({},t(p,d),{_persist:f});if(d.type===FV)return d.result(a&&a.flush()),nU({},t(p,d),{_persist:f});if(d.type===WV)l=!0;else if(d.type===HV){if(s)return nU({},p,{_persist:nU({},f,{rehydrated:!0})});if(d.key===e.key){var v=t(p,d),y=d.payload,b=nU({},!1!==r&&void 0!==y?r(y,u,v,e):v,{_persist:nU({},f,{rehydrated:!0})});return c(b)}}if(!f)return t(u,d);var x=t(p,d);return x===p?u:c(nU({},x,{_persist:f}))}}(xU.getPersistConfig({key:"root",storage:yU,rootReducer:r2,blacklist:[...e2,...t2,...n2],debounce:300}),r2),i2=function(e){var t,n=OV(),r=e||{},o=r.reducer,i=void 0===o?void 0:o,a=r.middleware,s=void 0===a?n():a,l=r.devTools,c=void 0===l||l,u=r.preloadedState,d=void 0===u?void 0:u,h=r.enhancers,f=void 0===h?void 0:h;if("function"==typeof i)t=i;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=nV(i)}var p=s;"function"==typeof p&&(p=p(n));var g=oV.apply(void 0,p),m=rV;c&&(m=EV(CV({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=mV([g],f):"function"==typeof f&&(v=f(v)),tV(t,d,m.apply(void 0,v))}({reducer:o2,middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(J1()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}});var a2={exports:{}},s2={},l2=a.exports;var c2="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},u2=l2.useState,d2=l2.useEffect,h2=l2.useLayoutEffect,f2=l2.useDebugValue;function p2(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!c2(e,n)}catch(pue){return!0}}var g2="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=u2({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return h2((function(){o.value=n,o.getSnapshot=t,p2(o)&&i({inst:o})}),[e,n,t]),d2((function(){return p2(o)&&i({inst:o}),e((function(){p2(o)&&i({inst:o})}))}),[e]),f2(n),n};s2.useSyncExternalStore=void 0!==l2.useSyncExternalStore?l2.useSyncExternalStore:g2,function(e){e.exports=s2}(a2);var m2={exports:{}},v2={},y2=a.exports,b2=a2.exports;var x2="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},w2=b2.useSyncExternalStore,k2=y2.useRef,S2=y2.useEffect,C2=y2.useMemo,_2=y2.useDebugValue;v2.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=k2(null);if(null===i.current){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=C2((function(){function e(e){if(!l){if(l=!0,i=e,e=r(e),void 0!==o&&a.hasValue){var t=a.value;if(o(t,e))return s=t}return s=e}if(t=s,x2(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(i=e,s=n)}var i,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,o]);var s=w2(e,i[0],i[1]);return S2((function(){a.hasValue=!0,a.value=s}),[s]),_2(s),s},function(e){e.exports=v2}(m2);let E2=function(e){e()};const L2=()=>E2,P2=a.exports.createContext(null);function O2(){return a.exports.useContext(P2)}let M2=()=>{throw new Error("uSES not initialized!")};const T2=(e,t)=>e===t;function A2(e=P2){const t=e===P2?O2:()=>a.exports.useContext(e);return function(e,n=T2){const{store:r,subscription:o,getServerState:i}=t(),s=M2(o.addNestedSub,r.getState,i||r.getState,e,n);return a.exports.useDebugValue(s),s}}const I2=A2();var R2,N2={},D2=Symbol.for("react.element"),z2=Symbol.for("react.portal"),B2=Symbol.for("react.fragment"),j2=Symbol.for("react.strict_mode"),F2=Symbol.for("react.profiler"),H2=Symbol.for("react.provider"),W2=Symbol.for("react.context"),V2=Symbol.for("react.server_context"),U2=Symbol.for("react.forward_ref"),$2=Symbol.for("react.suspense"),G2=Symbol.for("react.suspense_list"),q2=Symbol.for("react.memo"),Y2=Symbol.for("react.lazy"),Z2=Symbol.for("react.offscreen");function X2(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case D2:switch(e=e.type){case B2:case F2:case j2:case $2:case G2:return e;default:switch(e=e&&e.$$typeof){case V2:case W2:case U2:case Y2:case q2:case H2:return e;default:return t}}case z2:return t}}}R2=Symbol.for("react.module.reference"),N2.ContextConsumer=W2,N2.ContextProvider=H2,N2.Element=D2,N2.ForwardRef=U2,N2.Fragment=B2,N2.Lazy=Y2,N2.Memo=q2,N2.Portal=z2,N2.Profiler=F2,N2.StrictMode=j2,N2.Suspense=$2,N2.SuspenseList=G2,N2.isAsyncMode=function(){return!1},N2.isConcurrentMode=function(){return!1},N2.isContextConsumer=function(e){return X2(e)===W2},N2.isContextProvider=function(e){return X2(e)===H2},N2.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D2},N2.isForwardRef=function(e){return X2(e)===U2},N2.isFragment=function(e){return X2(e)===B2},N2.isLazy=function(e){return X2(e)===Y2},N2.isMemo=function(e){return X2(e)===q2},N2.isPortal=function(e){return X2(e)===z2},N2.isProfiler=function(e){return X2(e)===F2},N2.isStrictMode=function(e){return X2(e)===j2},N2.isSuspense=function(e){return X2(e)===$2},N2.isSuspenseList=function(e){return X2(e)===G2},N2.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===B2||e===F2||e===j2||e===$2||e===G2||e===Z2||"object"==typeof e&&null!==e&&(e.$$typeof===Y2||e.$$typeof===q2||e.$$typeof===H2||e.$$typeof===W2||e.$$typeof===U2||e.$$typeof===R2||void 0!==e.getModuleId)},N2.typeOf=X2,function(e){e.exports=N2}({exports:{}});const K2={notify(){},get:()=>[]};function Q2(e,t){let n,r=K2;function o(){a.onStateChange&&a.onStateChange()}function i(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){const e=L2();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const a={addNestedSub:function(e){return i(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=K2)},getListeners:()=>r};return a}const J2=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?a.exports.useLayoutEffect:a.exports.useEffect;function e5({store:e,context:t,children:n,serverState:r}){const o=a.exports.useMemo((()=>{const t=Q2(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0}}),[e,r]),i=a.exports.useMemo((()=>e.getState()),[e]);J2((()=>{const{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),i!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[o,i]);return ld((t||P2).Provider,{value:o,children:n})}function t5(e=P2){const t=e===P2?O2:()=>a.exports.useContext(e);return function(){const{store:e}=t();return e}}const n5=t5();function r5(e=P2){const t=e===P2?n5:t5(e);return function(){return t().dispatch}}const o5=r5();var i5;function a5(e){return a5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a5(e)}function s5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l5(e,t){for(var n=0;n{M2=e})(m2.exports.useSyncExternalStoreWithSelector),i5=U.exports.unstable_batchedUpdates,E2=i5;var p5=function(e){function t(){var e,n;s5(this,t);for(var r=arguments.length,o=new Array(r),i=0;ild(CI,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",children:ld(hT,{thickness:"2px",speed:"1s",emptyColor:"gray.200",color:"gray.400",size:"xl"})}),v5=o5,y5=I2,b5=uV((e=>e.system),(e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),x5=()=>{const{isProcessing:e,currentStep:t,totalSteps:n,currentStatusHasSteps:r}=y5(b5),o=t?Math.round(100*t/n):0;return ld(eF,{value:o,isIndeterminate:e&&!r,className:"progress-bar"})};var w5={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},k5=H.createContext&&H.createContext(w5),S5=globalThis&&globalThis.__assign||function(){return S5=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{tooltip:n="",styleClass:r,tooltipProps:o,asCheckbox:i,isChecked:a,...s}=e;return ld(YH,{label:n,hasArrow:!0,...o,...o?.placement?{placement:o.placement}:{placement:"top"},children:ld(zT,{ref:t,className:r?`invokeai__icon-button ${r}`:"invokeai__icon-button","data-as-checkbox":i,"data-selected":void 0!==a?a:void 0,...s})})}));function C3(e){const{title:t,hotkey:n,description:r}=e;return cd("div",{className:"hotkey-modal-item",children:[cd("div",{className:"hotkey-info",children:[ld("p",{className:"hotkey-title",children:t}),r&&ld("p",{className:"hotkey-description",children:r})]}),ld("div",{className:"hotkey-key",children:n})]})}function _3({children:e}){const{isOpen:t,onOpen:n,onClose:r}=QA(),{t:o}=HY(),i=[{title:o("hotkeys:invoke.title"),desc:o("hotkeys:invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys:cancel.title"),desc:o("hotkeys:cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys:focusPrompt.title"),desc:o("hotkeys:focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys:toggleOptions.title"),desc:o("hotkeys:toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys:pinOptions.title"),desc:o("hotkeys:pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys:toggleViewer.title"),desc:o("hotkeys:toggleViewer.desc"),hotkey:"Z"},{title:o("hotkeys:toggleGallery.title"),desc:o("hotkeys:toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys:maximizeWorkSpace.title"),desc:o("hotkeys:maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys:changeTabs.title"),desc:o("hotkeys:changeTabs.desc"),hotkey:"1-5"},{title:o("hotkeys:consoleToggle.title"),desc:o("hotkeys:consoleToggle.desc"),hotkey:"`"}],s=[{title:o("hotkeys:setPrompt.title"),desc:o("hotkeys:setPrompt.desc"),hotkey:"P"},{title:o("hotkeys:setSeed.title"),desc:o("hotkeys:setSeed.desc"),hotkey:"S"},{title:o("hotkeys:setParameters.title"),desc:o("hotkeys:setParameters.desc"),hotkey:"A"},{title:o("hotkeys:restoreFaces.title"),desc:o("hotkeys:restoreFaces.desc"),hotkey:"Shift+R"},{title:o("hotkeys:upscale.title"),desc:o("hotkeys:upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys:showInfo.title"),desc:o("hotkeys:showInfo.desc"),hotkey:"I"},{title:o("hotkeys:sendToImageToImage.title"),desc:o("hotkeys:sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys:deleteImage.title"),desc:o("hotkeys:deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys:closePanels.title"),desc:o("hotkeys:closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys:previousImage.title"),desc:o("hotkeys:previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys:nextImage.title"),desc:o("hotkeys:nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys:toggleGalleryPin.title"),desc:o("hotkeys:toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:o("hotkeys:increaseGalleryThumbSize.title"),desc:o("hotkeys:increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys:decreaseGalleryThumbSize.title"),desc:o("hotkeys:decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],c=[{title:o("hotkeys:selectBrush.title"),desc:o("hotkeys:selectBrush.desc"),hotkey:"B"},{title:o("hotkeys:selectEraser.title"),desc:o("hotkeys:selectEraser.desc"),hotkey:"E"},{title:o("hotkeys:decreaseBrushSize.title"),desc:o("hotkeys:decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys:increaseBrushSize.title"),desc:o("hotkeys:increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys:decreaseBrushOpacity.title"),desc:o("hotkeys:decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys:increaseBrushOpacity.title"),desc:o("hotkeys:increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys:moveTool.title"),desc:o("hotkeys:moveTool.desc"),hotkey:"V"},{title:o("hotkeys:fillBoundingBox.title"),desc:o("hotkeys:fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys:eraseBoundingBox.title"),desc:o("hotkeys:eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys:colorPicker.title"),desc:o("hotkeys:colorPicker.desc"),hotkey:"C"},{title:o("hotkeys:toggleSnap.title"),desc:o("hotkeys:toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys:quickToggleMove.title"),desc:o("hotkeys:quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys:toggleLayer.title"),desc:o("hotkeys:toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys:clearMask.title"),desc:o("hotkeys:clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys:hideMask.title"),desc:o("hotkeys:hideMask.desc"),hotkey:"H"},{title:o("hotkeys:showHideBoundingBox.title"),desc:o("hotkeys:showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys:mergeVisible.title"),desc:o("hotkeys:mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys:saveToGallery.title"),desc:o("hotkeys:saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys:copyToClipboard.title"),desc:o("hotkeys:copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys:downloadImage.title"),desc:o("hotkeys:downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys:undoStroke.title"),desc:o("hotkeys:undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys:redoStroke.title"),desc:o("hotkeys:redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys:resetView.title"),desc:o("hotkeys:resetView.desc"),hotkey:"R"},{title:o("hotkeys:previousStagingImage.title"),desc:o("hotkeys:previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys:nextStagingImage.title"),desc:o("hotkeys:nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys:acceptStagingImage.title"),desc:o("hotkeys:acceptStagingImage.desc"),hotkey:"Enter"}],u=e=>{const t=[];return e.forEach(((e,n)=>{t.push(ld(C3,{title:e.title,description:e.desc,hotkey:e.hotkey},n))})),ld("div",{className:"hotkey-modal-category",children:t})};return cd(sd,{children:[a.exports.cloneElement(e,{onClick:n}),cd(RB,{isOpen:t,onClose:r,children:[ld(GB,{}),cd(WB,{className:" modal hotkeys-modal",children:[ld(DB,{className:"modal-close-btn"}),ld("h1",{children:"Keyboard Shorcuts"}),ld("div",{className:"hotkeys-modal-items",children:cd(uT,{allowMultiple:!0,children:[cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:appHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(i)})]}),cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:generalHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(s)})]}),cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:galleryHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(l)})]}),cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:unifiedCanvasHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(c)})]})]})})]})]})]})}const E3=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:i,styleClass:a,...s}=e;return cd(GT,{isDisabled:n,width:r,className:`invokeai__switch-form-control ${a}`,display:"flex",columnGap:"1rem",alignItems:"center",justifyContent:"space-between",...o,children:[ld(eA,{className:"invokeai__switch-form-label",whiteSpace:"nowrap",marginRight:0,marginTop:.5,marginBottom:.5,fontSize:"sm",fontWeight:"bold",width:"auto",...i,children:t}),ld(nH,{className:"invokeai__switch-root",...s})]})},L3=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:o,tooltipProps:i,size:a="sm",fontSize:s="sm",styleClass:l,...c}=e;return cd(GT,{isDisabled:n,className:`invokeai__select ${l}`,onClick:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.nativeEvent.stopPropagation(),e.nativeEvent.cancelBubble=!0},children:[t&&ld(eA,{className:"invokeai__select-label",fontSize:s,fontWeight:"bold",marginRight:0,marginBottom:0,whiteSpace:"nowrap",children:t}),ld(YH,{label:o,...i,children:ld(rF,{className:"invokeai__select-picker",fontSize:s,size:a,...c,children:r.map((e=>"string"==typeof e||"number"==typeof e?ld("option",{value:e,className:"invokeai__select-option",children:e},e):ld("option",{value:e.value,className:"invokeai__select-option",children:e.key},e.value)))})})]})},P3=/^-?(0\.)?\.?$/,O3=e=>{const{label:t,labelFontSize:n="sm",styleClass:r,isDisabled:o=!1,showStepper:i=!0,width:s,textAlign:l,isInvalid:c,value:u,onChange:d,min:h,max:f,isInteger:p=!0,formControlProps:g,formLabelProps:m,numberInputFieldProps:v,numberInputStepperProps:y,tooltipProps:b,...x}=e,[w,k]=a.exports.useState(String(u));a.exports.useEffect((()=>{w.match(P3)||u===Number(w)||k(String(u))}),[u,w]);return ld(YH,{...b,children:cd(GT,{isDisabled:o,isInvalid:c,className:r?`invokeai__number-input-form-control ${r}`:"invokeai__number-input-form-control",...g,children:[t&&ld(eA,{className:"invokeai__number-input-form-label",style:{display:t?"block":"none"},fontSize:n,fontWeight:"bold",marginRight:0,marginBottom:0,whiteSpace:"nowrap",...m,children:t}),cd(fj,{className:"invokeai__number-input-root",value:w,min:h,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:e=>{k(e),e.match(P3)||d(p?Math.floor(Number(e)):Number(e))},onBlur:e=>{const t=A$.clamp(p?Math.floor(Number(e.target.value)):Number(e.target.value),h,f);k(String(t)),d(t)},width:s,...x,children:[ld(gj,{className:"invokeai__number-input-field",textAlign:l,...v}),i&&cd("div",{className:"invokeai__number-input-stepper",children:[ld(yj,{...y,className:"invokeai__number-input-stepper-button"}),ld(vj,{...y,className:"invokeai__number-input-stepper-button"})]})]})]})})},M3=e=>e.system,T3=e=>e.system.toastQueue,A3=uV((e=>e.options),(e=>LU[e.activeTab]),{memoizeOptions:{equalityCheck:A$.isEqual}});uV((e=>e.options),(e=>{const{shouldRandomizeSeed:t,shouldGenerateVariations:n}=e;return t||n}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});const I3=e=>e.options,R3=uV([M3,I3],((e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,model_list:i,saveIntermediatesInterval:a,enableImageDebugging:s}=e,{shouldUseCanvasBetaLayout:l}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,models:A$.map(i,((e,t)=>t)),saveIntermediatesInterval:a,enableImageDebugging:s,shouldUseCanvasBetaLayout:l}}),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),N3=({children:e})=>{const t=v5(),{t:n}=HY(),r=y5((e=>e.options.steps)),{isOpen:o,onOpen:i,onClose:s}=QA(),{isOpen:l,onOpen:c,onClose:u}=QA(),{shouldDisplayInProgressType:d,shouldConfirmOnDelete:h,shouldDisplayGuides:f,saveIntermediatesInterval:p,enableImageDebugging:g,shouldUseCanvasBetaLayout:m}=y5(R3);return cd(sd,{children:[a.exports.cloneElement(e,{onClick:i}),cd(RB,{isOpen:o,onClose:s,size:"lg",children:[ld(GB,{}),cd(WB,{className:"modal settings-modal",children:[ld(UB,{className:"settings-modal-header",children:n("common:settingsLabel")}),ld(DB,{className:"modal-close-btn"}),cd(NB,{className:"settings-modal-content",children:[cd("div",{className:"settings-modal-items",children:[cd("div",{className:"settings-modal-item",style:{gridAutoFlow:"row",rowGap:"0.5rem"},children:[ld(L3,{label:n("settings:displayInProgress"),validValues:HQ,value:d,onChange:e=>t(VY(e.target.value))}),"full-res"===d&&ld(O3,{label:n("settings:saveSteps"),min:1,max:r,step:1,onChange:e=>{e>r&&(e=r),e<1&&(e=1),t(sZ(e))},value:p,width:"auto",textAlign:"center"})]}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:confirmOnDelete"),isChecked:h,onChange:e=>t(ZY(e.target.checked))}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:displayHelpIcons"),isChecked:f,onChange:e=>t(eZ(e.target.checked))}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:useCanvasBeta"),isChecked:m,onChange:e=>t(L$(e.target.checked))})]}),cd("div",{className:"settings-modal-items",children:[ld("h2",{style:{fontWeight:"bold"},children:"Developer"}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:enableImageDebugging"),isChecked:g,onChange:e=>t(lZ(e.target.checked))})]}),cd("div",{className:"settings-modal-reset",children:[ld(PI,{size:"md",children:n("settings:resetWebUI")}),ld(RT,{colorScheme:"red",onClick:()=>{g5.purge().then((()=>{s(),c()}))},children:n("settings:resetWebUI")}),ld(VI,{children:n("settings:resetWebUIDesc1")}),ld(VI,{children:n("settings:resetWebUIDesc2")})]})]}),ld(VB,{children:ld(RT,{onClick:s,className:"modal-close-btn",children:n("common:close")})})]})]}),cd(RB,{closeOnOverlayClick:!1,isOpen:l,onClose:u,isCentered:!0,children:[ld(GB,{bg:"blackAlpha.300",backdropFilter:"blur(40px)"}),ld(WB,{children:ld(NB,{pb:6,pt:6,children:ld(CI,{justifyContent:"center",children:ld(VI,{fontSize:"lg",children:ld(VI,{children:n("settings:resetComplete")})})})})})]})]})},D3=uV((e=>e.system),(e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),z3=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:o,hasError:i,wasErrorSeen:a}=y5(D3),s=v5(),{t:l}=HY();let c;c=e&&!i?"status-good":"status-bad";let u=o;[l("common:statusGenerating"),l("common:statusPreparing"),l("common:statusSavingImage"),l("common:statusRestoringFaces"),l("common:statusUpscaling")].includes(u)&&(c="status-working"),u&&t&&r>1&&(u=l(u)+` (${n}/${r})`);return ld(YH,{label:i&&!a?"Click to clear, check logs for details":void 0,children:ld(VI,{cursor:i&&!a?"pointer":"initial",onClick:()=>{!i&&a||s(rZ())},className:`status ${c}`,children:l(u)})})},B3=e=>{const{triggerComponent:t,children:n,styleClass:r,hasArrow:o=!0,...i}=e;return cd(Aj,{...i,children:[ld(Wj,{children:t}),cd(Fj,{className:`invokeai__popover-content ${r}`,children:[o&&ld(Ij,{className:"invokeai__popover-arrow"}),n]})]})},j3=ok(((e,t)=>{const{children:n,tooltip:r="",tooltipProps:o,styleClass:i,...a}=e;return ld(YH,{label:r,...o,children:ld(RT,{ref:t,className:["invokeai__button",i].join(" "),...a,children:n})})}));function F3(){const{t:e}=HY(),{setColorMode:t,colorMode:n}=dd(),r=v5(),o=y5((e=>e.options.currentTheme)),i={dark:e("common:darkTheme"),light:e("common:lightTheme"),green:e("common:greenTheme")};a.exports.useEffect((()=>{n!==o&&t(o)}),[t,n,o]);return ld(B3,{trigger:"hover",triggerComponent:ld(S3,{"aria-label":e("common:themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:ld(i3,{})}),children:ld(WI,{align:"stretch",children:(()=>{const e=[];return Object.keys(i).forEach((t=>{e.push(ld(j3,{style:{width:"6rem"},leftIcon:o===t?ld(B5,{}):void 0,size:"sm",onClick:()=>(e=>{r(jU(e))})(t),children:i[t]},t))})),e})()})})}const H3=uV([M3],(e=>{const{isProcessing:t,model_list:n}=e,r=A$.map(n,((e,t)=>t)),o=A$.reduce(n,((e,t,n)=>("active"===t.status&&(e=n),e)),"");return{models:r,activeModel:o,isProcessing:t,activeDesc:n[o].description}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),W3=()=>{const e=v5(),{models:t,activeModel:n,isProcessing:r,activeDesc:o}=y5(H3);return ld(CI,{style:{paddingLeft:"0.3rem"},children:ld(L3,{style:{fontSize:"0.8rem"},tooltip:o,isDisabled:r,value:n,validValues:t,onChange:t=>{e(AQ(t.target.value))}})})};function V3(e){const{label:t="",styleClass:n,isDisabled:r=!1,fontSize:o="sm",width:i,size:a="sm",isInvalid:s,...l}=e;return cd(GT,{className:`input ${n}`,isInvalid:s,isDisabled:r,children:[""!==t&&ld(eA,{fontSize:o,fontWeight:"bold",alignItems:"center",whiteSpace:"nowrap",marginBottom:0,marginRight:0,className:"input-label",children:t}),ld(eI,{...l,className:"input-entry",size:a,width:i})]})}const U3=e=>{const{label:t,styleClass:n,...r}=e;return ld(TA,{className:`invokeai__checkbox ${n}`,...r,children:t})};function $3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"}}]})(e)}function G3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function q3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function Y3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function Z3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function X3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function K3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}var Q3=Array.isArray,J3=Object.keys,e4=Object.prototype.hasOwnProperty,t4="undefined"!=typeof Element;function n4(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,o,i=Q3(e),a=Q3(t);if(i&&a){if((r=e.length)!=t.length)return!1;for(n=r;0!=n--;)if(!n4(e[n],t[n]))return!1;return!0}if(i!=a)return!1;var s=e instanceof Date,l=t instanceof Date;if(s!=l)return!1;if(s&&l)return e.getTime()==t.getTime();var c=e instanceof RegExp,u=t instanceof RegExp;if(c!=u)return!1;if(c&&u)return e.toString()==t.toString();var d=J3(e);if((r=d.length)!==J3(t).length)return!1;for(n=r;0!=n--;)if(!e4.call(t,d[n]))return!1;if(t4&&e instanceof Element&&t instanceof Element)return e===t;for(n=r;0!=n--;)if(!("_owner"===(o=d[n])&&e.$$typeof||n4(e[o],t[o])))return!1;return!0}return e!=e&&t!=t}var r4=function(e,t){try{return n4(e,t)}catch(n){if(n.message&&n.message.match(/stack|recursion/i)||-2146828260===n.number)return console.warn("Warning: react-fast-compare does not handle circular references.",n.name,n.message),!1;throw n}},o4=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i4}(e)}(e)};var i4="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a4(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l4((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function s4(e,t,n){return e.concat(t).map((function(e){return a4(e,n)}))}function l4(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||s4,n.isMergeableObject=n.isMergeableObject||o4;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):function(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach((function(t){r[t]=a4(e[t],n)})),Object.keys(t).forEach((function(o){n.isMergeableObject(t[o])&&e[o]?r[o]=l4(e[o],t[o],n):r[o]=a4(t[o],n)})),r}(e,t,n):a4(t,n)}l4.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l4(e,n,t)}),{})};var c4=l4;const u4="object"==typeof global&&global&&global.Object===Object&&global;var d4="object"==typeof self&&self&&self.Object===Object&&self;const h4=u4||d4||Function("return this")();const f4=h4.Symbol;var p4=Object.prototype,g4=p4.hasOwnProperty,m4=p4.toString,v4=f4?f4.toStringTag:void 0;var y4=Object.prototype.toString;var b4=f4?f4.toStringTag:void 0;function x4(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":b4&&b4 in Object(e)?function(e){var t=g4.call(e,v4),n=e[v4];try{e[v4]=void 0;var r=!0}catch(j2){}var o=m4.call(e);return r&&(t?e[v4]=n:delete e[v4]),o}(e):function(e){return y4.call(e)}(e)}function w4(e,t){return function(n){return e(t(n))}}const k4=w4(Object.getPrototypeOf,Object);function S4(e){return null!=e&&"object"==typeof e}var C4=Function.prototype,_4=Object.prototype,E4=C4.toString,L4=_4.hasOwnProperty,P4=E4.call(Object);function O4(e){if(!S4(e)||"[object Object]"!=x4(e))return!1;var t=k4(e);if(null===t)return!0;var n=L4.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&E4.call(n)==P4}function M4(e,t){return e===t||e!=e&&t!=t}function T4(e,t){for(var n=e.length;n--;)if(M4(e[n][0],t))return n;return-1}var A4=Array.prototype.splice;function I4(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},I4.prototype.set=function(e,t){var n=this.__data__,r=T4(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function N4(e){if(!R4(e))return!1;var t=x4(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}const D4=h4["__core-js_shared__"];var z4,B4=(z4=/[^.]+$/.exec(D4&&D4.keys&&D4.keys.IE_PROTO||""))?"Symbol(src)_1."+z4:"";var j4=Function.prototype.toString;function F4(e){if(null!=e){try{return j4.call(e)}catch(j2){}try{return e+""}catch(j2){}}return""}var H4=/^\[object .+?Constructor\]$/,W4=Function.prototype,V4=Object.prototype,U4=W4.toString,$4=V4.hasOwnProperty,G4=RegExp("^"+U4.call($4).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q4(e){return!(!R4(e)||(t=e,B4&&B4 in t))&&(N4(e)?G4:H4).test(F4(e));var t}function Y4(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return q4(n)?n:void 0}const Z4=Y4(h4,"Map");const X4=Y4(Object,"create");var K4=Object.prototype.hasOwnProperty;var Q4=Object.prototype.hasOwnProperty;function J4(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}var k6={};function S6(e){return function(t){return e(t)}}k6["[object Float32Array]"]=k6["[object Float64Array]"]=k6["[object Int8Array]"]=k6["[object Int16Array]"]=k6["[object Int32Array]"]=k6["[object Uint8Array]"]=k6["[object Uint8ClampedArray]"]=k6["[object Uint16Array]"]=k6["[object Uint32Array]"]=!0,k6["[object Arguments]"]=k6["[object Array]"]=k6["[object ArrayBuffer]"]=k6["[object Boolean]"]=k6["[object DataView]"]=k6["[object Date]"]=k6["[object Error]"]=k6["[object Function]"]=k6["[object Map]"]=k6["[object Number]"]=k6["[object Object]"]=k6["[object RegExp]"]=k6["[object Set]"]=k6["[object String]"]=k6["[object WeakMap]"]=!1;var C6="object"==typeof t&&t&&!t.nodeType&&t,_6=C6&&"object"==typeof n&&n&&!n.nodeType&&n,E6=_6&&_6.exports===C6&&u4.process,L6=function(){try{var e=_6&&_6.require&&_6.require("util").types;return e||E6&&E6.binding&&E6.binding("util")}catch(j2){}}();const P6=L6;var O6=P6&&P6.isTypedArray,M6=O6?S6(O6):function(e){return S4(e)&&w6(e.length)&&!!k6[x4(e)]};const T6=M6;var A6=Object.prototype.hasOwnProperty;function I6(e,t){var n=p6(e),r=!n&&f6(e),o=!n&&!r&&y6(e),i=!n&&!r&&!o&&T6(e),a=n||r||o||i,s=a?function(e,t){for(var n=-1,r=Array(e);++n=0||(o[n]=e[n]);return o}function n9(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var r9=function(e){return Array.isArray(e)&&0===e.length},o9=function(e){return"function"==typeof e},i9=function(e){return null!==e&&"object"==typeof e},a9=function(e){return String(Math.floor(Number(e)))===e},s9=function(e){return"[object String]"===Object.prototype.toString.call(e)},l9=function(e){return 0===a.exports.Children.count(e)},c9=function(e){return i9(e)&&o9(e.then)};function u9(e,t,n,r){void 0===r&&(r=0);for(var o=Q7(t);e&&r=0?[]:{}}}return(0===i?e:o)[a[i]]===n?e:(void 0===n?delete o[a[i]]:o[a[i]]=n,0===i&&void 0===n&&delete r[a[i]],r)}function h9(e,t,n,r){void 0===n&&(n=new WeakMap),void 0===r&&(r={});for(var o=0,i=Object.keys(e);o=n.length)break;i=n[o++]}else{if((o=n.next()).done)break;i=o.value}var a=i;u9(t,a.path)||(t=d9(t,a.path,a.message))}}return t}(n)):t(n)}))}))}),[f.validationSchema]),_=a.exports.useCallback((function(e,t){return new Promise((function(n){return n(b.current[e].validate(t))}))}),[]),E=a.exports.useCallback((function(e){var t=Object.keys(b.current).filter((function(e){return o9(b.current[e].validate)})),n=t.length>0?t.map((function(t){return _(t,u9(e,t))})):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(n).then((function(e){return e.reduce((function(e,n,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===n||n&&(e=d9(e,t[r],n)),e}),{})}))}),[_]),L=a.exports.useCallback((function(e){return Promise.all([E(e),f.validationSchema?C(e):{},f.validate?S(e):{}]).then((function(e){var t=e[0],n=e[1],r=e[2];return c4.all([t,n,r],{arrayMerge:k9})}))}),[f.validate,f.validationSchema,E,S,C]),P=C9((function(e){return void 0===e&&(e=w.values),k({type:"SET_ISVALIDATING",payload:!0}),L(e).then((function(e){return y.current&&(k({type:"SET_ISVALIDATING",payload:!1}),k({type:"SET_ERRORS",payload:e})),e}))}));a.exports.useEffect((function(){s&&!0===y.current&&r4(p.current,f.initialValues)&&P(p.current)}),[s,P]);var O=a.exports.useCallback((function(e){var t=e&&e.values?e.values:p.current,n=e&&e.errors?e.errors:g.current?g.current:f.initialErrors||{},r=e&&e.touched?e.touched:m.current?m.current:f.initialTouched||{},o=e&&e.status?e.status:v.current?v.current:f.initialStatus;p.current=t,g.current=n,m.current=r,v.current=o;var i=function(){k({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:o,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})};if(f.onReset){var a=f.onReset(w.values,Y);c9(a)?a.then(i):i()}else i()}),[f.initialErrors,f.initialStatus,f.initialTouched]);a.exports.useEffect((function(){!0!==y.current||r4(p.current,f.initialValues)||(u&&(p.current=f.initialValues,O()),s&&P(p.current))}),[u,f.initialValues,O,s,P]),a.exports.useEffect((function(){u&&!0===y.current&&!r4(g.current,f.initialErrors)&&(g.current=f.initialErrors||v9,k({type:"SET_ERRORS",payload:f.initialErrors||v9}))}),[u,f.initialErrors]),a.exports.useEffect((function(){u&&!0===y.current&&!r4(m.current,f.initialTouched)&&(m.current=f.initialTouched||y9,k({type:"SET_TOUCHED",payload:f.initialTouched||y9}))}),[u,f.initialTouched]),a.exports.useEffect((function(){u&&!0===y.current&&!r4(v.current,f.initialStatus)&&(v.current=f.initialStatus,k({type:"SET_STATUS",payload:f.initialStatus}))}),[u,f.initialStatus,f.initialTouched]);var M=C9((function(e){if(b.current[e]&&o9(b.current[e].validate)){var t=u9(w.values,e),n=b.current[e].validate(t);return c9(n)?(k({type:"SET_ISVALIDATING",payload:!0}),n.then((function(e){return e})).then((function(t){k({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),k({type:"SET_ISVALIDATING",payload:!1})}))):(k({type:"SET_FIELD_ERROR",payload:{field:e,value:n}}),Promise.resolve(n))}return f.validationSchema?(k({type:"SET_ISVALIDATING",payload:!0}),C(w.values,e).then((function(e){return e})).then((function(t){k({type:"SET_FIELD_ERROR",payload:{field:e,value:t[e]}}),k({type:"SET_ISVALIDATING",payload:!1})}))):Promise.resolve()})),T=a.exports.useCallback((function(e,t){var n=t.validate;b.current[e]={validate:n}}),[]),A=a.exports.useCallback((function(e){delete b.current[e]}),[]),I=C9((function(e,t){return k({type:"SET_TOUCHED",payload:e}),(void 0===t?o:t)?P(w.values):Promise.resolve()})),R=a.exports.useCallback((function(e){k({type:"SET_ERRORS",payload:e})}),[]),N=C9((function(e,t){var r=o9(e)?e(w.values):e;return k({type:"SET_VALUES",payload:r}),(void 0===t?n:t)?P(r):Promise.resolve()})),D=a.exports.useCallback((function(e,t){k({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})}),[]),z=C9((function(e,t,r){return k({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),(void 0===r?n:r)?P(d9(w.values,e,t)):Promise.resolve()})),B=a.exports.useCallback((function(e,t){var n,r=t,o=e;if(!s9(e)){e.persist&&e.persist();var i=e.target?e.target:e.currentTarget,a=i.type,s=i.name,l=i.id,c=i.value,u=i.checked,d=(i.outerHTML,i.options),h=i.multiple;r=t||(s||l),o=/number|range/.test(a)?(n=parseFloat(c),isNaN(n)?"":n):/checkbox/.test(a)?function(e,t,n){if("boolean"==typeof e)return Boolean(t);var r=[],o=!1,i=-1;if(Array.isArray(e))r=e,o=(i=e.indexOf(n))>=0;else if(!n||"true"==n||"false"==n)return Boolean(t);if(t&&n&&!o)return r.concat(n);if(!o)return r;return r.slice(0,i).concat(r.slice(i+1))}(u9(w.values,r),u,c):d&&h?function(e){return Array.from(e).filter((function(e){return e.selected})).map((function(e){return e.value}))}(d):c}r&&z(r,o)}),[z,w.values]),j=C9((function(e){if(s9(e))return function(t){return B(t,e)};B(e)})),F=C9((function(e,t,n){return void 0===t&&(t=!0),k({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),(void 0===n?o:n)?P(w.values):Promise.resolve()})),H=a.exports.useCallback((function(e,t){e.persist&&e.persist();var n=e.target,r=n.name,o=n.id,i=(n.outerHTML,t||(r||o));F(i,!0)}),[F]),W=C9((function(e){if(s9(e))return function(t){return H(t,e)};H(e)})),V=a.exports.useCallback((function(e){o9(e)?k({type:"SET_FORMIK_STATE",payload:e}):k({type:"SET_FORMIK_STATE",payload:function(){return e}})}),[]),U=a.exports.useCallback((function(e){k({type:"SET_STATUS",payload:e})}),[]),$=a.exports.useCallback((function(e){k({type:"SET_ISSUBMITTING",payload:e})}),[]),G=C9((function(){return k({type:"SUBMIT_ATTEMPT"}),P().then((function(e){var t=e instanceof Error;if(!t&&0===Object.keys(e).length){var n;try{if(void 0===(n=Z()))return}catch(r){throw r}return Promise.resolve(n).then((function(e){return y.current&&k({type:"SUBMIT_SUCCESS"}),e})).catch((function(e){if(y.current)throw k({type:"SUBMIT_FAILURE"}),e}))}if(y.current&&(k({type:"SUBMIT_FAILURE"}),t))throw e}))})),q=C9((function(e){e&&e.preventDefault&&o9(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&o9(e.stopPropagation)&&e.stopPropagation(),G().catch((function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)}))})),Y={resetForm:O,validateForm:P,validateField:M,setErrors:R,setFieldError:D,setFieldTouched:F,setFieldValue:z,setStatus:U,setSubmitting:$,setTouched:I,setValues:N,setFormikState:V,submitForm:G},Z=C9((function(){return d(w.values,Y)})),X=C9((function(e){e&&e.preventDefault&&o9(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&o9(e.stopPropagation)&&e.stopPropagation(),O()})),K=a.exports.useCallback((function(e){return{value:u9(w.values,e),error:u9(w.errors,e),touched:!!u9(w.touched,e),initialValue:u9(p.current,e),initialTouched:!!u9(m.current,e),initialError:u9(g.current,e)}}),[w.errors,w.touched,w.values]),Q=a.exports.useCallback((function(e){return{setValue:function(t,n){return z(e,t,n)},setTouched:function(t,n){return F(e,t,n)},setError:function(t){return D(e,t)}}}),[z,F,D]),J=a.exports.useCallback((function(e){var t=i9(e),n=t?e.name:e,r=u9(w.values,n),o={name:n,value:r,onChange:j,onBlur:W};if(t){var i=e.type,a=e.value,s=e.as,l=e.multiple;"checkbox"===i?void 0===a?o.checked=!!r:(o.checked=!(!Array.isArray(r)||!~r.indexOf(a)),o.value=a):"radio"===i?(o.checked=r===a,o.value=a):"select"===s&&l&&(o.value=o.value||[],o.multiple=!0)}return o}),[W,j,w.values]),ee=a.exports.useMemo((function(){return!r4(p.current,w.values)}),[p.current,w.values]),te=a.exports.useMemo((function(){return void 0!==l?ee?w.errors&&0===Object.keys(w.errors).length:!1!==l&&o9(l)?l(f):l:w.errors&&0===Object.keys(w.errors).length}),[l,ee,w.errors,f]);return e9({},w,{initialValues:p.current,initialErrors:g.current,initialTouched:m.current,initialStatus:v.current,handleBlur:W,handleChange:j,handleReset:X,handleSubmit:q,resetForm:O,setErrors:R,setFormikState:V,setFieldTouched:F,setFieldValue:z,setFieldError:D,setStatus:U,setSubmitting:$,setTouched:I,setValues:N,submitForm:G,validateForm:P,validateField:M,isValid:te,dirty:ee,unregisterField:A,registerField:T,getFieldProps:J,getFieldMeta:K,getFieldHelpers:Q,validateOnBlur:o,validateOnChange:n,validateOnMount:s})}function x9(e){var t=b9(e),n=e.component,r=e.children,o=e.render,i=e.innerRef;return a.exports.useImperativeHandle(i,(function(){return t})),a.exports.createElement(p9,{value:t},n?a.exports.createElement(n,t):o?o(t):r?o9(r)?r(t):l9(r)?null:a.exports.Children.only(r):null)}function w9(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);!0===Array.isArray(e[r])?t[r]=e[r].map((function(e){return!0===Array.isArray(e)||O4(e)?w9(e):""!==e?e:void 0})):O4(e[r])?t[r]=w9(e[r]):t[r]=""!==e[r]?e[r]:void 0}return t}function k9(e,t,n){var r=e.slice();return t.forEach((function(t,o){if(void 0===r[o]){var i=!1!==n.clone&&n.isMergeableObject(t);r[o]=i?c4(Array.isArray(t)?[]:{},t,n):t}else n.isMergeableObject(t)?r[o]=c4(e[o],t,n):-1===e.indexOf(t)&&r.push(t)})),r}var S9="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?a.exports.useLayoutEffect:a.exports.useEffect;function C9(e){var t=a.exports.useRef(e);return S9((function(){t.current=e})),a.exports.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;re?t:e}),0);return Array.from(e9({},e,{length:t+1}))}return[]},P9=function(e){var t,n;function r(t){var n;return(n=e.call(this,t)||this).updateArrayField=function(e,t,r){var o=n.props,i=o.name;(0,o.formik.setFormikState)((function(n){var o="function"==typeof r?r:e,a="function"==typeof t?t:e,s=d9(n.values,i,e(u9(n.values,i))),l=r?o(u9(n.errors,i)):void 0,c=t?a(u9(n.touched,i)):void 0;return r9(l)&&(l=void 0),r9(c)&&(c=void 0),e9({},n,{values:s,errors:r?d9(n.errors,i,l):n.errors,touched:t?d9(n.touched,i,c):n.touched})}))},n.push=function(e){return n.updateArrayField((function(t){return[].concat(L9(t),[J7(e)])}),!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=L9(e),o=r[t];return r[t]=r[n],r[n]=o,r}(n,e,t)}),!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=L9(e),o=r[t];return r.splice(t,1),r.splice(n,0,o),r}(n,e,t)}),!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField((function(n){return E9(n,e,t)}),(function(t){return E9(t,e,null)}),(function(t){return E9(t,e,null)}))},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=L9(e);return r[t]=n,r}(n,e,t)}),!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField((function(n){var r=n?[e].concat(n):[e];return t<0&&(t=r.length),r}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n})),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(n9(n)),n.pop=n.pop.bind(n9(n)),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=r.prototype;return o.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!r4(u9(e.formik.values,e.name),u9(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},o.remove=function(e){var t;return this.updateArrayField((function(n){var r=n?L9(n):[];return t||(t=r[e]),o9(r.splice)&&r.splice(e,1),r}),!0,!0),t},o.pop=function(){var e;return this.updateArrayField((function(t){var n=t;return e||(e=n&&n.pop&&n.pop()),n}),!0,!0),e},o.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},t=this.props,n=t.component,r=t.render,o=t.children,i=t.name,s=e9({},e,{form:t9(t.formik,["validate","validationSchema"]),name:i});return n?a.exports.createElement(n,s):r?r(s):o?"function"==typeof o?o(s):l9(o)?null:a.exports.Children.only(o):null},r}(a.exports.Component);function O9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21 11H6.414l5.293-5.293-1.414-1.414L2.586 12l7.707 7.707 1.414-1.414L6.414 13H21z"}}]})(e)}function M9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19.002 3h-14c-1.103 0-2 .897-2 2v4h2V5h14v14h-14v-4h-2v4c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.898-2-2-2z"}},{tag:"path",attr:{d:"m11 16 5-4-5-4v3.001H3v2h8z"}}]})(e)}function T9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}function A9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6.758 8.758 5.344 7.344a8.048 8.048 0 0 0-1.841 2.859l1.873.701a6.048 6.048 0 0 1 1.382-2.146zM19 12.999a7.935 7.935 0 0 0-2.344-5.655A7.917 7.917 0 0 0 12 5.069V2L7 6l5 4V7.089a5.944 5.944 0 0 1 3.242 1.669A5.956 5.956 0 0 1 17 13v.002c0 .33-.033.655-.086.977-.007.043-.011.088-.019.131a6.053 6.053 0 0 1-1.138 2.536c-.16.209-.331.412-.516.597a5.954 5.954 0 0 1-.728.613 5.906 5.906 0 0 1-2.277 1.015c-.142.03-.285.05-.43.069-.062.009-.122.021-.184.027a6.104 6.104 0 0 1-1.898-.103L9.3 20.819a8.087 8.087 0 0 0 2.534.136c.069-.007.138-.021.207-.03.205-.026.409-.056.61-.098l.053-.009-.001-.005a7.877 7.877 0 0 0 2.136-.795l.001.001.028-.019a7.906 7.906 0 0 0 1.01-.67c.27-.209.532-.43.777-.675.248-.247.47-.513.681-.785.021-.028.049-.053.07-.081l-.006-.004a7.899 7.899 0 0 0 1.093-1.997l.008.003c.029-.078.05-.158.076-.237.037-.11.075-.221.107-.333.04-.14.073-.281.105-.423.022-.099.048-.195.066-.295.032-.171.056-.344.076-.516.01-.076.023-.15.03-.227.023-.249.037-.5.037-.753.002-.002.002-.004.002-.008zM6.197 16.597l-1.6 1.201a8.045 8.045 0 0 0 2.569 2.225l.961-1.754a6.018 6.018 0 0 1-1.93-1.672zM5 13c0-.145.005-.287.015-.429l-1.994-.143a7.977 7.977 0 0 0 .483 3.372l1.873-.701A5.975 5.975 0 0 1 5 13z"}}]})(e)}function I9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.242 17.242a6.04 6.04 0 0 1-1.37 1.027l.961 1.754a8.068 8.068 0 0 0 2.569-2.225l-1.6-1.201a5.938 5.938 0 0 1-.56.645zm1.743-4.671a5.975 5.975 0 0 1-.362 2.528l1.873.701a7.977 7.977 0 0 0 .483-3.371l-1.994.142zm1.512-2.368a8.048 8.048 0 0 0-1.841-2.859l-1.414 1.414a6.071 6.071 0 0 1 1.382 2.146l1.873-.701zm-8.128 8.763c-.047-.005-.094-.015-.141-.021a6.701 6.701 0 0 1-.468-.075 5.923 5.923 0 0 1-2.421-1.122 5.954 5.954 0 0 1-.583-.506 6.138 6.138 0 0 1-.516-.597 5.91 5.91 0 0 1-.891-1.634 6.086 6.086 0 0 1-.247-.902c-.008-.043-.012-.088-.019-.131A6.332 6.332 0 0 1 6 13.002V13c0-1.603.624-3.109 1.758-4.242A5.944 5.944 0 0 1 11 7.089V10l5-4-5-4v3.069a7.917 7.917 0 0 0-4.656 2.275A7.936 7.936 0 0 0 4 12.999v.009c0 .253.014.504.037.753.007.076.021.15.03.227.021.172.044.345.076.516.019.1.044.196.066.295.032.142.065.283.105.423.032.112.07.223.107.333.026.079.047.159.076.237l.008-.003A7.948 7.948 0 0 0 5.6 17.785l-.007.005c.021.028.049.053.07.081.211.272.433.538.681.785a8.236 8.236 0 0 0 .966.816c.265.192.537.372.821.529l.028.019.001-.001a7.877 7.877 0 0 0 2.136.795l-.001.005.053.009c.201.042.405.071.61.098.069.009.138.023.207.03a8.038 8.038 0 0 0 2.532-.137l-.424-1.955a6.11 6.11 0 0 1-1.904.102z"}}]})(e)}function R9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M11 6H9v3H6v2h3v3h2v-3h3V9h-3z"}},{tag:"path",attr:{d:"M10 2c-4.411 0-8 3.589-8 8s3.589 8 8 8a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8zm0 14c-3.309 0-6-2.691-6-6s2.691-6 6-6 6 2.691 6 6-2.691 6-6 6z"}}]})(e)}function N9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6 9h8v2H6z"}},{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"}}]})(e)}P9.defaultProps={validateOnChange:!0};const D9=uV([M3],(e=>{const{model_list:t}=e,n=[];return A$.forEach(t,(e=>{n.push(e.weights)})),n}));function z9(){const{t:e}=HY();return ld(mI,{position:"absolute",zIndex:2,right:4,top:4,fontSize:"0.7rem",fontWeight:"bold",backgroundColor:"var(--accent-color)",padding:"0.2rem 0.5rem",borderRadius:"0.2rem",alignItems:"center",children:e("modelmanager:modelExists")})}function B9({model:e,modelsToAdd:t,setModelsToAdd:n}){const r=y5(D9);return cd(mI,{position:"relative",children:[r.includes(e.location)?ld(z9,{}):null,ld(U3,{value:e.name,label:ld(sd,{children:cd(WI,{alignItems:"start",children:[ld("p",{style:{fontWeight:"bold"},children:e.name}),ld("p",{style:{fontStyle:"italic"},children:e.location})]})}),isChecked:t.includes(e.name),isDisabled:r.includes(e.location),onChange:e=>{t.includes(e.target.value)?n(A$.remove(t,(t=>t!==e.target.value))):n([...t,e.target.value])},padding:"1rem",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",_checked:{backgroundColor:"var(--accent-color)",color:"var(--text-color)"},_disabled:{backgroundColor:"var(--background-color-secondary)"}})]})}function j9(){const e=v5(),{t:t}=HY(),n=y5((e=>e.system.searchFolder)),r=y5((e=>e.system.foundModels)),o=y5(D9),i=y5((e=>e.options.shouldShowExistingModelsInSearch)),a=y5((e=>e.system.isProcessing)),[s,l]=H.useState([]);return cd(sd,{children:[n?cd(CI,{flexDirection:"column",padding:"1rem",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",rowGap:"0.5rem",position:"relative",children:[ld("p",{style:{fontWeight:"bold",fontSize:"0.8rem",backgroundColor:"var(--background-color-secondary)",padding:"0.2rem 1rem",width:"max-content",borderRadius:"0.2rem"},children:t("modelmanager:checkpointFolder")}),ld("p",{style:{fontWeight:"bold",fontSize:"0.8rem",maxWidth:"80%"},children:n}),ld(S3,{"aria-label":t("modelmanager:scanAgain"),tooltip:t("modelmanager:scanAgain"),icon:ld(T9,{}),position:"absolute",right:16,fontSize:18,disabled:a,onClick:()=>e(OQ(n))}),ld(S3,{"aria-label":t("modelmanager:clearCheckpointFolder"),icon:ld(s3,{style:{transform:"rotate(45deg)"}}),position:"absolute",right:5,onClick:()=>{e(fZ(null)),e(pZ(null)),l([])}})]}):ld(x9,{initialValues:{checkpointFolder:""},onSubmit:t=>{(t=>{e(OQ(t.checkpointFolder))})(t)},children:({handleSubmit:e})=>ld("form",{onSubmit:e,children:cd(HI,{columnGap:"0.5rem",children:[ld(GT,{isRequired:!0,width:"max-content",children:ld(_9,{as:V3,id:"checkpointFolder",name:"checkpointFolder",type:"text",width:"lg",size:"md",label:t("modelmanager:checkpointFolder")})}),ld(S3,{icon:ld($3,{}),"aria-label":t("modelmanager:findModels"),tooltip:t("modelmanager:findModels"),type:"submit",disabled:a})]})})}),r&&cd(CI,{flexDirection:"column",rowGap:"1rem",children:[cd(CI,{justifyContent:"space-between",alignItems:"center",children:[cd("p",{children:[t("modelmanager:modelsFound"),": ",r.length]}),cd("p",{children:[t("modelmanager:selected"),": ",s.length]})]}),cd(CI,{columnGap:"0.5rem",justifyContent:"space-between",children:[cd(CI,{columnGap:"0.5rem",children:[ld(j3,{isDisabled:s.length===r.length,onClick:()=>{l([]),r&&r.forEach((e=>{o.includes(e.location)||l((t=>[...t,e.name]))}))},children:t("modelmanager:selectAll")}),ld(j3,{isDisabled:0===s.length,onClick:()=>{l([])},children:t("modelmanager:deselectAll")}),ld(U3,{label:t("modelmanager:showExisting"),isChecked:i,onChange:()=>e(P$(!i))})]}),ld(j3,{isDisabled:0===s.length,onClick:()=>{const t=r?.filter((e=>s.includes(e.name)));t?.forEach((t=>{const n={name:t.name,description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:t.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(MQ(n))})),l([])},backgroundColor:s.length>0?"var(--accent-color) !important":"",children:t("modelmanager:addSelected")})]}),cd(CI,{rowGap:"1rem",flexDirection:"column",maxHeight:"18rem",overflowY:"scroll",paddingRight:"1rem",paddingLeft:"0.2rem",borderRadius:"0.2rem",children:[r.length>0?0===s.length&&ld(VI,{fontWeight:"bold",fontSize:14,padding:"0.5rem",borderRadius:"0.2rem",margin:"0 0.5rem 0 1rem",textAlign:"center",backgroundColor:"var(--notice-color)",boxShadow:"0 0 200px 6px var(--notice-color)",marginTop:"1rem",width:"max-content",children:t("modelmanager:selectAndAdd")}):ld(VI,{fontWeight:"bold",fontSize:14,padding:"0.5rem",borderRadius:"0.2rem",textAlign:"center",backgroundColor:"var(--status-bad-color)",children:t("modelmanager:noModelsFound")}),(()=>{const e=[],t=[];return r&&r.forEach(((n,r)=>{o.includes(n.location)?t.push(ld(B9,{model:n,modelsToAdd:s,setModelsToAdd:l},r)):e.push(ld(B9,{model:n,modelsToAdd:s,setModelsToAdd:l},r))})),cd(sd,{children:[e,i&&t]})})()]})]})]})}function F9(){const e=v5(),{t:t}=HY(),n=y5((e=>e.system.isProcessing));function r(e){let n;return function(e){return/\s/.test(e)}(e)&&(n=t("modelmanager:cannotUseSpaces")),n}const[o,i]=H.useState(!1);return cd(sd,{children:[ld(S3,{"aria-label":t("common:back"),tooltip:t("common:back"),onClick:()=>e(O$(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",right:12,top:3,icon:ld(O9,{})}),ld(j9,{}),ld(U3,{label:t("modelmanager:addManually"),isChecked:o,onChange:()=>i(!o)}),o&&ld(x9,{initialValues:{name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},onSubmit:t=>{e(MQ(t)),e(O$(null))},children:({handleSubmit:e,errors:o,touched:i})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",children:[ld(VI,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelmanager:manual")}),cd(GT,{isInvalid:!!o.name&&i.name,isRequired:!0,children:[ld(eA,{htmlFor:"name",fontSize:"sm",children:t("modelmanager:name")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"name",name:"name",type:"text",validate:r,width:"2xl"}),o.name&&i.name?ld(QT,{children:o.name}):ld(qT,{margin:0,children:t("modelmanager:nameValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.description&&i.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:t("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"2xl"}),o.description&&i.description?ld(QT,{children:o.description}):ld(qT,{margin:0,children:t("modelmanager:descriptionValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.config&&i.config,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:t("modelmanager:config")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"config",name:"config",type:"text",width:"2xl"}),o.config&&i.config?ld(QT,{children:o.config}):ld(qT,{margin:0,children:t("modelmanager:configValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.weights&&i.weights,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:t("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"weights",name:"weights",type:"text",width:"2xl"}),o.weights&&i.weights?ld(QT,{children:o.weights}):ld(qT,{margin:0,children:t("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.vae&&i.vae,children:[ld(eA,{htmlFor:"vae",fontSize:"sm",children:t("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae",name:"vae",type:"text",width:"2xl"}),o.vae&&i.vae?ld(QT,{children:o.vae}):ld(qT,{margin:0,children:t("modelmanager:vaeLocationValidationMsg")})]})]}),cd(HI,{width:"100%",children:[cd(GT,{isInvalid:!!o.width&&i.width,children:[ld(eA,{htmlFor:"width",fontSize:"sm",children:t("modelmanager:width")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"width",name:"width",children:({field:e,form:t})=>ld(O3,{id:"width",name:"width",min:64,max:2048,step:64,width:"90%",value:t.values.width,onChange:n=>t.setFieldValue(e.name,Number(n))})}),o.width&&i.width?ld(QT,{children:o.width}):ld(qT,{margin:0,children:t("modelmanager:widthValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.height&&i.height,children:[ld(eA,{htmlFor:"height",fontSize:"sm",children:t("modelmanager:height")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"height",name:"height",children:({field:e,form:t})=>ld(O3,{id:"height",name:"height",min:64,max:2048,width:"90%",step:64,value:t.values.height,onChange:n=>t.setFieldValue(e.name,Number(n))})}),o.height&&i.height?ld(QT,{children:o.height}):ld(qT,{margin:0,children:t("modelmanager:heightValidationMsg")})]})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelmanager:addModel")})]})})})]})}function H9({children:e}){return ld(CI,{flexDirection:"column",backgroundColor:"var(--background-color)",padding:"1rem 1rem",borderRadius:"0.5rem",rowGap:"1rem",width:"100%",children:e})}function W9(){const e=v5(),{t:t}=HY(),n=y5((e=>e.system.isProcessing));function r(e){let n;return function(e){return/\s/.test(e)}(e)&&(n=t("modelmanager:cannotUseSpaces")),n}return cd(CI,{children:[ld(S3,{"aria-label":t("common:back"),tooltip:t("common:back"),onClick:()=>e(O$(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",right:12,top:3,icon:ld(O9,{})}),ld(x9,{initialValues:{name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},onSubmit:t=>{const n=t;""===t.path&&(n.path=void 0),""===t.repo_id&&(n.repo_id=void 0),""===t.vae.path&&(void 0===t.path?n.vae.path=void 0:n.vae.path=t.path+"/vae"),""===t.vae.repo_id&&(n.vae.repo_id=void 0),e(MQ(n)),e(O$(null))},children:({handleSubmit:e,errors:o,touched:i})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",children:[ld(H9,{children:cd(GT,{isInvalid:!!o.name&&i.name,isRequired:!0,children:[ld(eA,{htmlFor:"name",fontSize:"sm",children:t("modelmanager:name")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"name",name:"name",type:"text",validate:r,width:"2xl",isRequired:!0}),o.name&&i.name?ld(QT,{children:o.name}):ld(qT,{margin:0,children:t("modelmanager:nameValidationMsg")})]})]})}),ld(H9,{children:cd(GT,{isInvalid:!!o.description&&i.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:t("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),o.description&&i.description?ld(QT,{children:o.description}):ld(qT,{margin:0,children:t("modelmanager:descriptionValidationMsg")})]})]})}),cd(H9,{children:[ld(VI,{fontWeight:"bold",fontSize:"sm",children:t("modelmanager:formMessageDiffusersModelLocation")}),ld(VI,{fontSize:"sm",fontStyle:"italic",color:"var(--text-color-secondary)",children:t("modelmanager:formMessageDiffusersModelLocationDesc")}),cd(GT,{isInvalid:!!o.path&&i.path,children:[ld(eA,{htmlFor:"path",fontSize:"sm",children:t("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"path",name:"path",type:"text",width:"2xl"}),o.path&&i.path?ld(QT,{children:o.path}):ld(qT,{margin:0,children:t("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.repo_id&&i.repo_id,children:[ld(eA,{htmlFor:"repo_id",fontSize:"sm",children:t("modelmanager:repo_id")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),o.repo_id&&i.repo_id?ld(QT,{children:o.repo_id}):ld(qT,{margin:0,children:t("modelmanager:repoIDValidationMsg")})]})]})]}),cd(H9,{children:[ld(VI,{fontWeight:"bold",children:t("modelmanager:formMessageDiffusersVAELocation")}),ld(VI,{fontSize:"sm",fontStyle:"italic",color:"var(--text-color-secondary)",children:t("modelmanager:formMessageDiffusersVAELocationDesc")}),cd(GT,{isInvalid:!!o.vae?.path&&i.vae?.path,children:[ld(eA,{htmlFor:"vae.path",fontSize:"sm",children:t("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),o.vae?.path&&i.vae?.path?ld(QT,{children:o.vae?.path}):ld(qT,{margin:0,children:t("modelmanager:vaeLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.vae?.repo_id&&i.vae?.repo_id,children:[ld(eA,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelmanager:vaeRepoID")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),o.vae?.repo_id&&i.vae?.repo_id?ld(QT,{children:o.vae?.repo_id}):ld(qT,{margin:0,children:t("modelmanager:vaeRepoIDValidationMsg")})]})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelmanager:addModel")})]})})})]})}function V9({text:e,onClick:t}){return ld(CI,{position:"relative",width:"50%",height:"200px",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",justifyContent:"center",alignItems:"center",_hover:{cursor:"pointer",backgroundColor:"var(--accent-color)"},onClick:t,children:ld(VI,{fontWeight:"bold",children:e})})}function U9(){const{isOpen:e,onOpen:t,onClose:n}=QA(),r=y5((e=>e.options.addNewModelUIOption)),o=v5(),{t:i}=HY();return cd(sd,{children:[ld(j3,{"aria-label":i("modelmanager:addNewModel"),tooltip:i("modelmanager:addNewModel"),onClick:t,className:"modal-close-btn",size:"sm",children:cd(CI,{columnGap:"0.5rem",alignItems:"center",children:[ld(s3,{}),i("modelmanager:addNew")]})}),cd(RB,{isOpen:e,onClose:()=>{n(),o(O$(null))},size:"3xl",closeOnOverlayClick:!1,children:[ld(GB,{}),cd(WB,{className:"modal add-model-modal",fontFamily:"Inter",children:[ld(UB,{children:i("modelmanager:addNewModel")}),ld(DB,{marginTop:"0.3rem"}),cd(NB,{className:"add-model-modal-body",children:[null==r&&cd(CI,{columnGap:"1rem",children:[ld(V9,{text:i("modelmanager:addCheckpointModel"),onClick:()=>o(O$("ckpt"))}),ld(V9,{text:i("modelmanager:addDiffuserModel"),onClick:()=>o(O$("diffusers"))})]}),"ckpt"==r&&ld(F9,{}),"diffusers"==r&&ld(W9,{})]})]})]})]})}Sk({d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",displayName:"CopyIcon"}),Sk({d:"M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z",displayName:"SearchIcon"}),Sk({d:"M23.414,20.591l-4.645-4.645a10.256,10.256,0,1,0-2.828,2.829l4.645,4.644a2.025,2.025,0,0,0,2.828,0A2,2,0,0,0,23.414,20.591ZM10.25,3.005A7.25,7.25,0,1,1,3,10.255,7.258,7.258,0,0,1,10.25,3.005Z",displayName:"Search2Icon"}),Sk({d:"M21.4,13.7C20.6,13.9,19.8,14,19,14c-5,0-9-4-9-9c0-0.8,0.1-1.6,0.3-2.4c0.1-0.3,0-0.7-0.3-1 c-0.3-0.3-0.6-0.4-1-0.3C4.3,2.7,1,7.1,1,12c0,6.1,4.9,11,11,11c4.9,0,9.3-3.3,10.6-8.1c0.1-0.3,0-0.7-0.3-1 C22.1,13.7,21.7,13.6,21.4,13.7z",displayName:"MoonIcon"}),Sk({displayName:"SunIcon",path:cd("g",{strokeLinejoin:"round",strokeLinecap:"round",strokeWidth:"2",fill:"none",stroke:"currentColor",children:[ld("circle",{cx:"12",cy:"12",r:"5"}),ld("path",{d:"M12 1v2"}),ld("path",{d:"M12 21v2"}),ld("path",{d:"M4.22 4.22l1.42 1.42"}),ld("path",{d:"M18.36 18.36l1.42 1.42"}),ld("path",{d:"M1 12h2"}),ld("path",{d:"M21 12h2"}),ld("path",{d:"M4.22 19.78l1.42-1.42"}),ld("path",{d:"M18.36 5.64l1.42-1.42"})]})}),Sk({d:"M0,12a1.5,1.5,0,0,0,1.5,1.5h8.75a.25.25,0,0,1,.25.25V22.5a1.5,1.5,0,0,0,3,0V13.75a.25.25,0,0,1,.25-.25H22.5a1.5,1.5,0,0,0,0-3H13.75a.25.25,0,0,1-.25-.25V1.5a1.5,1.5,0,0,0-3,0v8.75a.25.25,0,0,1-.25.25H1.5A1.5,1.5,0,0,0,0,12Z",displayName:"AddIcon"}),Sk({displayName:"SmallAddIcon",viewBox:"0 0 20 20",path:ld("path",{fill:"currentColor",d:"M14 9h-3V6c0-.55-.45-1-1-1s-1 .45-1 1v3H6c-.55 0-1 .45-1 1s.45 1 1 1h3v3c0 .55.45 1 1 1s1-.45 1-1v-3h3c.55 0 1-.45 1-1s-.45-1-1-1z",fillRule:"evenodd"})}),Sk({viewBox:"0 0 14 14",d:"M14,7.77 L14,6.17 L12.06,5.53 L11.61,4.44 L12.49,2.6 L11.36,1.47 L9.55,2.38 L8.46,1.93 L7.77,0.01 L6.17,0.01 L5.54,1.95 L4.43,2.4 L2.59,1.52 L1.46,2.65 L2.37,4.46 L1.92,5.55 L0,6.23 L0,7.82 L1.94,8.46 L2.39,9.55 L1.51,11.39 L2.64,12.52 L4.45,11.61 L5.54,12.06 L6.23,13.98 L7.82,13.98 L8.45,12.04 L9.56,11.59 L11.4,12.47 L12.53,11.34 L11.61,9.53 L12.08,8.44 L14,7.75 L14,7.77 Z M7,10 C5.34,10 4,8.66 4,7 C4,5.34 5.34,4 7,4 C8.66,4 10,5.34 10,7 C10,8.66 8.66,10 7,10 Z",displayName:"SettingsIcon"}),Sk({displayName:"CheckCircleIcon",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"}),Sk({d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-9.5,6a2,2,0,1,1,3,1.723V19.5a1,1,0,0,1-2,0V17.223A1.994,1.994,0,0,1,10,15.5ZM7.75,6.75a4.25,4.25,0,0,1,8.5,0V9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5Z",displayName:"LockIcon"}),Sk({d:"M19.5,9.5h-.75V6.75A6.751,6.751,0,0,0,5.533,4.811a1.25,1.25,0,1,0,2.395.717A4.251,4.251,0,0,1,16.25,6.75V9a.5.5,0,0,1-.5.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-9.5,6a2,2,0,1,1,3,1.723V19.5a1,1,0,0,1-2,0V17.223A1.994,1.994,0,0,1,10,15.5Z",displayName:"UnlockIcon"}),Sk({displayName:"ViewIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M23.432,10.524C20.787,7.614,16.4,4.538,12,4.6,7.6,4.537,3.213,7.615.568,10.524a2.211,2.211,0,0,0,0,2.948C3.182,16.351,7.507,19.4,11.839,19.4h.308c4.347,0,8.671-3.049,11.288-5.929A2.21,2.21,0,0,0,23.432,10.524ZM7.4,12A4.6,4.6,0,1,1,12,16.6,4.6,4.6,0,0,1,7.4,12Z"}),ld("circle",{cx:"12",cy:"12",r:"2"})]})}),Sk({displayName:"ViewOffIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M23.2,10.549a20.954,20.954,0,0,0-4.3-3.6l4-3.995a1,1,0,1,0-1.414-1.414l-.018.018a.737.737,0,0,1-.173.291l-19.5,19.5c-.008.007-.018.009-.026.017a1,1,0,0,0,1.631,1.088l4.146-4.146a11.26,11.26,0,0,0,4.31.939h.3c4.256,0,8.489-2.984,11.051-5.8A2.171,2.171,0,0,0,23.2,10.549ZM16.313,13.27a4.581,4.581,0,0,1-3,3.028,4.3,4.3,0,0,1-3.1-.19.253.253,0,0,1-.068-.407l5.56-5.559a.252.252,0,0,1,.407.067A4.3,4.3,0,0,1,16.313,13.27Z"}),ld("path",{d:"M7.615,13.4a.244.244,0,0,0,.061-.24A4.315,4.315,0,0,1,7.5,12,4.5,4.5,0,0,1,12,7.5a4.276,4.276,0,0,1,1.16.173.244.244,0,0,0,.24-.062l1.941-1.942a.254.254,0,0,0-.1-.421A10.413,10.413,0,0,0,12,4.75C7.7,4.692,3.4,7.7.813,10.549a2.15,2.15,0,0,0-.007,2.9,21.209,21.209,0,0,0,3.438,3.03.256.256,0,0,0,.326-.029Z"})]})}),Sk({d:"M11.2857,6.05714 L10.08571,4.85714 L7.85714,7.14786 L7.85714,1 L6.14286,1 L6.14286,7.14786 L3.91429,4.85714 L2.71429,6.05714 L7,10.42857 L11.2857,6.05714 Z M1,11.2857 L1,13 L13,13 L13,11.2857 L1,11.2857 Z",displayName:"DownloadIcon",viewBox:"0 0 14 14"});var $9=Sk({displayName:"DeleteIcon",path:ld("g",{fill:"currentColor",children:ld("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});Sk({displayName:"RepeatIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M10.319,4.936a7.239,7.239,0,0,1,7.1,2.252,1.25,1.25,0,1,0,1.872-1.657A9.737,9.737,0,0,0,9.743,2.5,10.269,10.269,0,0,0,2.378,9.61a.249.249,0,0,1-.271.178l-1.033-.13A.491.491,0,0,0,.6,9.877a.5.5,0,0,0-.019.526l2.476,4.342a.5.5,0,0,0,.373.248.43.43,0,0,0,.062,0,.5.5,0,0,0,.359-.152l3.477-3.593a.5.5,0,0,0-.3-.844L5.15,10.172a.25.25,0,0,1-.2-.333A7.7,7.7,0,0,1,10.319,4.936Z"}),ld("path",{d:"M23.406,14.1a.5.5,0,0,0,.015-.526l-2.5-4.329A.5.5,0,0,0,20.546,9a.489.489,0,0,0-.421.151l-3.456,3.614a.5.5,0,0,0,.3.842l1.848.221a.249.249,0,0,1,.183.117.253.253,0,0,1,.023.216,7.688,7.688,0,0,1-5.369,4.9,7.243,7.243,0,0,1-7.1-2.253,1.25,1.25,0,1,0-1.872,1.656,9.74,9.74,0,0,0,9.549,3.03,10.261,10.261,0,0,0,7.369-7.12.251.251,0,0,1,.27-.179l1.058.127a.422.422,0,0,0,.06,0A.5.5,0,0,0,23.406,14.1Z"})]})}),Sk({displayName:"RepeatClockIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M12.965,6a1,1,0,0,0-1,1v5.5a1,1,0,0,0,1,1h5a1,1,0,0,0,0-2h-3.75a.25.25,0,0,1-.25-.25V7A1,1,0,0,0,12.965,6Z"}),ld("path",{d:"M12.567,1.258A10.822,10.822,0,0,0,2.818,8.4a.25.25,0,0,1-.271.163L.858,8.309a.514.514,0,0,0-.485.213.5.5,0,0,0-.021.53l2.679,4.7a.5.5,0,0,0,.786.107l3.77-3.746a.5.5,0,0,0-.279-.85L5.593,9.007a.25.25,0,0,1-.192-.35,8.259,8.259,0,1,1,7.866,11.59,1.25,1.25,0,0,0,.045,2.5h.047a10.751,10.751,0,1,0-.792-21.487Z"})]})});var G9=Sk({displayName:"EditIcon",path:cd("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[ld("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),ld("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})});Sk({d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z",displayName:"ChevronLeftIcon"}),Sk({d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",displayName:"ChevronRightIcon"}),Sk({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}),Sk({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),Sk({d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",displayName:"ArrowBackIcon"}),Sk({d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",displayName:"ArrowForwardIcon"}),Sk({d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z",displayName:"ArrowUpIcon"}),Sk({viewBox:"0 0 16 16",d:"M11.891 9.992a1 1 0 1 1 1.416 1.415l-4.3 4.3a1 1 0 0 1-1.414 0l-4.3-4.3A1 1 0 0 1 4.71 9.992l3.59 3.591 3.591-3.591zm0-3.984L8.3 2.417 4.709 6.008a1 1 0 0 1-1.416-1.415l4.3-4.3a1 1 0 0 1 1.414 0l4.3 4.3a1 1 0 1 1-1.416 1.415z",displayName:"ArrowUpDownIcon"}),Sk({d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z",displayName:"ArrowDownIcon"});var q9=Sk({displayName:"ExternalLinkIcon",path:cd("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[ld("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),ld("path",{d:"M15 3h6v6"}),ld("path",{d:"M10 14L21 3"})]})});Sk({displayName:"LinkIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z"}),ld("path",{d:"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z"})]})}),Sk({displayName:"PlusSquareIcon",path:cd("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[ld("rect",{height:"18",width:"18",rx:"2",ry:"2",x:"3",y:"3"}),ld("path",{d:"M12 8v8"}),ld("path",{d:"M8 12h8"})]})}),Sk({displayName:"CalendarIcon",viewBox:"0 0 14 14",d:"M10.8889,5.5 L3.11111,5.5 L3.11111,7.05556 L10.8889,7.05556 L10.8889,5.5 Z M12.4444,1.05556 L11.6667,1.05556 L11.6667,0 L10.1111,0 L10.1111,1.05556 L3.88889,1.05556 L3.88889,0 L2.33333,0 L2.33333,1.05556 L1.55556,1.05556 C0.692222,1.05556 0.00777777,1.75556 0.00777777,2.61111 L0,12.5 C0,13.3556 0.692222,14 1.55556,14 L12.4444,14 C13.3,14 14,13.3556 14,12.5 L14,2.61111 C14,1.75556 13.3,1.05556 12.4444,1.05556 Z M12.4444,12.5 L1.55556,12.5 L1.55556,3.94444 L12.4444,3.94444 L12.4444,12.5 Z M8.55556,8.61111 L3.11111,8.61111 L3.11111,10.1667 L8.55556,10.1667 L8.55556,8.61111 Z"}),Sk({d:"M0.913134,0.920639 C1.49851,0.331726 2.29348,0 3.12342,0 L10.8766,0 C11.7065,0 12.5015,0.331725 13.0869,0.920639 C13.6721,1.50939 14,2.30689 14,3.13746 L14,8.12943 C13.9962,8.51443 13.9059,8.97125 13.7629,9.32852 C13.6128,9.683 13.3552,10.0709 13.0869,10.3462 C12.813,10.6163 12.4265,10.8761 12.0734,11.0274 C11.7172,11.1716 11.2607,11.263 10.8766,11.2669 L10.1234,11.2669 L10.1234,12.5676 L10.1209,12.5676 C10.1204,12.793 10.0633,13.0791 9.97807,13.262 C9.8627,13.466 9.61158,13.7198 9.40818,13.8382 L9.40824,13.8383 C9.4077,13.8386 9.40716,13.8388 9.40661,13.8391 C9.40621,13.8393 9.4058,13.8396 9.40539,13.8398 L9.40535,13.8397 C9.22958,13.9254 8.94505,13.9951 8.75059,14 L8.74789,14 C8.35724,13.9963 7.98473,13.8383 7.71035,13.5617 L5.39553,11.2669 L3.12342,11.2669 C2.29348,11.2669 1.49851,10.9352 0.913134,10.3462 C0.644826,10.0709 0.387187,9.683 0.23711,9.32852 C0.0941235,8.97125 0.00379528,8.51443 0,8.12943 L0,3.13746 C0,2.30689 0.327915,1.50939 0.913134,0.920639 Z M3.12342,1.59494 C2.71959,1.59494 2.33133,1.75628 2.04431,2.04503 C1.75713,2.33395 1.59494,2.72681 1.59494,3.13746 L1.59494,8.12943 C1.59114,8.35901 1.62114,8.51076 1.71193,8.72129 C1.79563,8.9346 1.88065,9.06264 2.04431,9.22185 C2.33133,9.5106 2.71959,9.67195 3.12342,9.67195 L5.72383,9.67195 C5.93413,9.67195 6.13592,9.75502 6.28527,9.90308 L8.52848,12.1269 L8.52848,10.4694 C8.52848,10.029 8.88552,9.67195 9.32595,9.67195 L10.8766,9.67195 C11.1034,9.67583 11.2517,9.64614 11.4599,9.55518 C11.6712,9.47132 11.7976,9.38635 11.9557,9.22185 C12.1193,9.06264 12.2044,8.9346 12.2881,8.72129 C12.3789,8.51076 12.4089,8.35901 12.4051,8.12943 L12.4051,3.13746 C12.4051,2.72681 12.2429,2.33394 11.9557,2.04503 C11.6687,1.75628 11.2804,1.59494 10.8766,1.59494 L3.12342,1.59494 Z",displayName:"ChatIcon",viewBox:"0 0 14 14"}),Sk({displayName:"TimeIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm0,22A10,10,0,1,1,22,12,10.011,10.011,0,0,1,12,22Z"}),ld("path",{d:"M17.134,15.81,12.5,11.561V6.5a1,1,0,0,0-2,0V12a1,1,0,0,0,.324.738l4.959,4.545a1.01,1.01,0,0,0,1.413-.061A1,1,0,0,0,17.134,15.81Z"})]})}),Sk({displayName:"ArrowRightIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M13.584,12a2.643,2.643,0,0,1-.775,1.875L3.268,23.416a1.768,1.768,0,0,1-2.5-2.5l8.739-8.739a.25.25,0,0,0,0-.354L.768,3.084a1.768,1.768,0,0,1,2.5-2.5l9.541,9.541A2.643,2.643,0,0,1,13.584,12Z"}),ld("path",{d:"M23.75,12a2.643,2.643,0,0,1-.775,1.875l-9.541,9.541a1.768,1.768,0,0,1-2.5-2.5l8.739-8.739a.25.25,0,0,0,0-.354L10.934,3.084a1.768,1.768,0,0,1,2.5-2.5l9.541,9.541A2.643,2.643,0,0,1,23.75,12Z"})]})}),Sk({displayName:"ArrowLeftIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M10.416,12a2.643,2.643,0,0,1,.775-1.875L20.732.584a1.768,1.768,0,0,1,2.5,2.5l-8.739,8.739a.25.25,0,0,0,0,.354l8.739,8.739a1.768,1.768,0,0,1-2.5,2.5l-9.541-9.541A2.643,2.643,0,0,1,10.416,12Z"}),ld("path",{d:"M.25,12a2.643,2.643,0,0,1,.775-1.875L10.566.584a1.768,1.768,0,0,1,2.5,2.5L4.327,11.823a.25.25,0,0,0,0,.354l8.739,8.739a1.768,1.768,0,0,1-2.5,2.5L1.025,13.875A2.643,2.643,0,0,1,.25,12Z"})]})}),Sk({displayName:"AtSignIcon",d:"M12,.5A11.634,11.634,0,0,0,.262,12,11.634,11.634,0,0,0,12,23.5a11.836,11.836,0,0,0,6.624-2,1.25,1.25,0,1,0-1.393-2.076A9.34,9.34,0,0,1,12,21a9.132,9.132,0,0,1-9.238-9A9.132,9.132,0,0,1,12,3a9.132,9.132,0,0,1,9.238,9v.891a1.943,1.943,0,0,1-3.884,0V12A5.355,5.355,0,1,0,12,17.261a5.376,5.376,0,0,0,3.861-1.634,4.438,4.438,0,0,0,7.877-2.736V12A11.634,11.634,0,0,0,12,.5Zm0,14.261A2.763,2.763,0,1,1,14.854,12,2.812,2.812,0,0,1,12,14.761Z"}),Sk({displayName:"AttachmentIcon",d:"M21.843,3.455a6.961,6.961,0,0,0-9.846,0L1.619,13.832a5.128,5.128,0,0,0,7.252,7.252L17.3,12.653A3.293,3.293,0,1,0,12.646,8L7.457,13.184A1,1,0,1,0,8.871,14.6L14.06,9.409a1.294,1.294,0,0,1,1.829,1.83L7.457,19.67a3.128,3.128,0,0,1-4.424-4.424L13.411,4.869a4.962,4.962,0,1,1,7.018,7.018L12.646,19.67a1,1,0,1,0,1.414,1.414L21.843,13.3a6.96,6.96,0,0,0,0-9.846Z"}),Sk({displayName:"UpDownIcon",viewBox:"-1 -1 9 11",d:"M 3.5 0L 3.98809 -0.569442L 3.5 -0.987808L 3.01191 -0.569442L 3.5 0ZM 3.5 9L 3.01191 9.56944L 3.5 9.98781L 3.98809 9.56944L 3.5 9ZM 0.488094 3.56944L 3.98809 0.569442L 3.01191 -0.569442L -0.488094 2.43056L 0.488094 3.56944ZM 3.01191 0.569442L 6.51191 3.56944L 7.48809 2.43056L 3.98809 -0.569442L 3.01191 0.569442ZM -0.488094 6.56944L 3.01191 9.56944L 3.98809 8.43056L 0.488094 5.43056L -0.488094 6.56944ZM 3.98809 9.56944L 7.48809 6.56944L 6.51191 5.43056L 3.01191 8.43056L 3.98809 9.56944Z"}),Sk({d:"M23.555,8.729a1.505,1.505,0,0,0-1.406-.98H16.062a.5.5,0,0,1-.472-.334L13.405,1.222a1.5,1.5,0,0,0-2.81,0l-.005.016L8.41,7.415a.5.5,0,0,1-.471.334H1.85A1.5,1.5,0,0,0,.887,10.4l5.184,4.3a.5.5,0,0,1,.155.543L4.048,21.774a1.5,1.5,0,0,0,2.31,1.684l5.346-3.92a.5.5,0,0,1,.591,0l5.344,3.919a1.5,1.5,0,0,0,2.312-1.683l-2.178-6.535a.5.5,0,0,1,.155-.543l5.194-4.306A1.5,1.5,0,0,0,23.555,8.729Z",displayName:"StarIcon"}),Sk({displayName:"EmailIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M11.114,14.556a1.252,1.252,0,0,0,1.768,0L22.568,4.87a.5.5,0,0,0-.281-.849A1.966,1.966,0,0,0,22,4H2a1.966,1.966,0,0,0-.289.021.5.5,0,0,0-.281.849Z"}),ld("path",{d:"M23.888,5.832a.182.182,0,0,0-.2.039l-6.2,6.2a.251.251,0,0,0,0,.354l5.043,5.043a.75.75,0,1,1-1.06,1.061l-5.043-5.043a.25.25,0,0,0-.354,0l-2.129,2.129a2.75,2.75,0,0,1-3.888,0L7.926,13.488a.251.251,0,0,0-.354,0L2.529,18.531a.75.75,0,0,1-1.06-1.061l5.043-5.043a.251.251,0,0,0,0-.354l-6.2-6.2a.18.18,0,0,0-.2-.039A.182.182,0,0,0,0,6V18a2,2,0,0,0,2,2H22a2,2,0,0,0,2-2V6A.181.181,0,0,0,23.888,5.832Z"})]})}),Sk({d:"M2.20731,0.0127209 C2.1105,-0.0066419 1.99432,-0.00664663 1.91687,0.032079 C0.871279,0.438698 0.212942,1.92964 0.0580392,2.95587 C-0.426031,6.28627 2.20731,9.17133 4.62766,11.0689 C6.77694,12.7534 10.9012,15.5223 13.3409,12.8503 C13.6507,12.5211 14.0186,12.037 13.9993,11.553 C13.9412,10.7397 13.186,10.1588 12.6051,9.71349 C12.1598,9.38432 11.2304,8.47427 10.6495,8.49363 C10.1267,8.51299 9.79754,9.05515 9.46837,9.38432 L8.88748,9.96521 C8.79067,10.062 7.55145,9.24878 7.41591,9.15197 C6.91248,8.8228 6.4284,8.45491 6.00242,8.04829 C5.57644,7.64167 5.18919,7.19632 4.86002,6.73161 C4.7632,6.59607 3.96933,5.41495 4.04678,5.31813 C4.04678,5.31813 4.72448,4.58234 4.91811,4.2919 C5.32473,3.67229 5.63453,3.18822 5.16982,2.45243 C4.99556,2.18135 4.78257,1.96836 4.55021,1.73601 C4.14359,1.34875 3.73698,0.942131 3.27227,0.612963 C3.02055,0.419335 2.59457,0.0708094 2.20731,0.0127209 Z",displayName:"PhoneIcon",viewBox:"0 0 14 14"}),Sk({viewBox:"0 0 10 10",d:"M3,2 C2.44771525,2 2,1.55228475 2,1 C2,0.44771525 2.44771525,0 3,0 C3.55228475,0 4,0.44771525 4,1 C4,1.55228475 3.55228475,2 3,2 Z M3,6 C2.44771525,6 2,5.55228475 2,5 C2,4.44771525 2.44771525,4 3,4 C3.55228475,4 4,4.44771525 4,5 C4,5.55228475 3.55228475,6 3,6 Z M3,10 C2.44771525,10 2,9.55228475 2,9 C2,8.44771525 2.44771525,8 3,8 C3.55228475,8 4,8.44771525 4,9 C4,9.55228475 3.55228475,10 3,10 Z M7,2 C6.44771525,2 6,1.55228475 6,1 C6,0.44771525 6.44771525,0 7,0 C7.55228475,0 8,0.44771525 8,1 C8,1.55228475 7.55228475,2 7,2 Z M7,6 C6.44771525,6 6,5.55228475 6,5 C6,4.44771525 6.44771525,4 7,4 C7.55228475,4 8,4.44771525 8,5 C8,5.55228475 7.55228475,6 7,6 Z M7,10 C6.44771525,10 6,9.55228475 6,9 C6,8.44771525 6.44771525,8 7,8 C7.55228475,8 8,8.44771525 8,9 C8,9.55228475 7.55228475,10 7,10 Z",displayName:"DragHandleIcon"}),Sk({displayName:"SpinnerIcon",path:cd(sd,{children:[ld("defs",{children:cd("linearGradient",{x1:"28.154%",y1:"63.74%",x2:"74.629%",y2:"17.783%",id:"a",children:[ld("stop",{stopColor:"currentColor",offset:"0%"}),ld("stop",{stopColor:"#fff",stopOpacity:"0",offset:"100%"})]})}),cd("g",{transform:"translate(2)",fill:"none",children:[ld("circle",{stroke:"url(#a)",strokeWidth:"4",cx:"10",cy:"12",r:"10"}),ld("path",{d:"M10 2C4.477 2 0 6.477 0 12",stroke:"currentColor",strokeWidth:"4"}),ld("rect",{fill:"currentColor",x:"8",width:"4",height:"4",rx:"8"})]})]})}),Sk({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),Sk({displayName:"SmallCloseIcon",viewBox:"0 0 16 16",path:ld("path",{d:"M9.41 8l2.29-2.29c.19-.18.3-.43.3-.71a1.003 1.003 0 0 0-1.71-.71L8 6.59l-2.29-2.3a1.003 1.003 0 0 0-1.42 1.42L6.59 8 4.3 10.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71L8 9.41l2.29 2.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71L9.41 8z",fillRule:"evenodd",fill:"currentColor"})}),Sk({d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z",displayName:"NotAllowedIcon"}),Sk({d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z",displayName:"TriangleDownIcon"}),Sk({d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z",displayName:"TriangleUpIcon"}),Sk({displayName:"InfoOutlineIcon",path:cd("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"2",children:[ld("circle",{cx:"12",cy:"12",fill:"none",r:"11",stroke:"currentColor"}),ld("line",{fill:"none",x1:"11.959",x2:"11.959",y1:"11",y2:"17"}),ld("circle",{cx:"11.959",cy:"7",r:"1",stroke:"none"})]})}),Sk({displayName:"BellIcon",d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"}),Sk({d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"}),Sk({d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm0,19a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,12,19Zm1.6-6.08a1,1,0,0,0-.6.917,1,1,0,1,1-2,0,3,3,0,0,1,1.8-2.75A2,2,0,1,0,10,9.255a1,1,0,1,1-2,0,4,4,0,1,1,5.6,3.666Z",displayName:"QuestionIcon"}),Sk({displayName:"QuestionOutlineIcon",path:cd("g",{stroke:"currentColor",strokeWidth:"1.5",children:[ld("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),ld("path",{fill:"none",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),ld("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]})}),Sk({d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z",displayName:"WarningIcon"}),Sk({displayName:"WarningTwoIcon",d:"M23.119,20,13.772,2.15h0a2,2,0,0,0-3.543,0L.881,20a2,2,0,0,0,1.772,2.928H21.347A2,2,0,0,0,23.119,20ZM11,8.423a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Zm1.05,11.51h-.028a1.528,1.528,0,0,1-1.522-1.47,1.476,1.476,0,0,1,1.448-1.53h.028A1.527,1.527,0,0,1,13.5,18.4,1.475,1.475,0,0,1,12.05,19.933Z"}),Sk({viewBox:"0 0 14 14",path:ld("g",{fill:"currentColor",children:ld("polygon",{points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})})}),Sk({displayName:"MinusIcon",path:ld("g",{fill:"currentColor",children:ld("rect",{height:"4",width:"20",x:"2",y:"10"})})}),Sk({displayName:"HamburgerIcon",viewBox:"0 0 24 24",d:"M 3 5 A 1.0001 1.0001 0 1 0 3 7 L 21 7 A 1.0001 1.0001 0 1 0 21 5 L 3 5 z M 3 11 A 1.0001 1.0001 0 1 0 3 13 L 21 13 A 1.0001 1.0001 0 1 0 21 11 L 3 11 z M 3 17 A 1.0001 1.0001 0 1 0 3 19 L 21 19 A 1.0001 1.0001 0 1 0 21 17 L 3 17 z"});const Y9=ok(((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:o="Cancel",cancelCallback:i,children:s,title:l,triggerComponent:c}=e,{isOpen:u,onOpen:d,onClose:h}=QA(),f=a.exports.useRef(null);return cd(sd,{children:[a.exports.cloneElement(c,{onClick:d,ref:t}),ld(qB,{isOpen:u,leastDestructiveRef:f,onClose:h,children:ld(GB,{children:cd(YB,{className:"modal",children:[ld(UB,{fontSize:"lg",fontWeight:"bold",children:l}),ld(NB,{children:s}),cd(VB,{children:[ld(RT,{ref:f,onClick:()=>{i&&i(),h()},className:"modal-close-btn",children:o}),ld(RT,{colorScheme:"red",onClick:()=>{r(),h()},ml:3,children:n})]})]})})})]})}));function Z9(e){const{isProcessing:t,isConnected:n}=y5((e=>e.system)),r=y5((e=>e.system.openModel)),{t:o}=HY(),i=v5(),{name:a,status:s,description:l}=e,c=()=>{i(gZ(a))};return cd(CI,{alignItems:"center",padding:"0.5rem 0.5rem",borderRadius:"0.2rem",backgroundColor:a===r?"var(--accent-color)":"",_hover:{backgroundColor:a===r?"var(--accent-color)":"var(--background-color)"},children:[ld(mI,{onClick:c,cursor:"pointer",children:ld(YH,{label:l,hasArrow:!0,placement:"bottom",children:ld(VI,{fontWeight:"bold",children:a})})}),ld(zI,{onClick:c,cursor:"pointer"}),cd(CI,{gap:2,alignItems:"center",children:[ld(VI,{color:(()=>{switch(s){case"active":return"var(--status-good-color)";case"cached":return"var(--status-working-color)";case"not loaded":return"var(--text-color-secondary)"}})(),children:s}),ld(RT,{size:"sm",onClick:()=>{i(AQ(a))},isDisabled:"active"===s||t||!n,className:"modal-close-btn",children:o("modelmanager:load")}),ld(S3,{icon:ld(G9,{}),size:"sm",onClick:c,"aria-label":"Modify Config",isDisabled:"active"===s||t||!n,className:" modal-close-btn"}),ld(Y9,{title:o("modelmanager:deleteModel"),acceptCallback:()=>{i(TQ(a)),i(gZ(null))},acceptButtonText:o("modelmanager:delete"),triggerComponent:ld(S3,{icon:ld($9,{}),size:"sm","aria-label":o("modelmanager:deleteConfig"),isDisabled:"active"===s||t||!n,className:" modal-close-btn",style:{backgroundColor:"var(--btn-delete-image)"}}),children:cd(CI,{rowGap:"1rem",flexDirection:"column",children:[ld("p",{style:{fontWeight:"bold"},children:o("modelmanager:deleteMsg1")}),ld("p",{style:{color:"var(--text-color-secondary"},children:o("modelmanager:deleteMsg2")})]})})]})]})}const X9=uV((e=>e.system),(e=>{const t=A$.map(e.model_list,((e,t)=>({name:t,...e})));return t}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function K9({label:e,isActive:t,onClick:n}){return ld(j3,{onClick:n,isActive:t,_active:{backgroundColor:"var(--accent-color)",_hover:{backgroundColor:"var(--accent-color)"}},size:"sm",children:e})}const Q9=()=>{const e=y5(X9),[t,n]=a.exports.useState(""),[r,o]=a.exports.useState("all"),[i,s]=a.exports.useTransition(),{t:l}=HY(),c=a.exports.useMemo((()=>{const n=[],o=[],i=[],a=[];return e.forEach(((e,s)=>{e.name.toLowerCase().includes(t.toLowerCase())&&(i.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s)),e.format===r&&a.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s))),"diffusers"!==e.format?n.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s)):o.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s))})),""!==t?ld(mI,"all"===r?{marginTop:"1rem",children:i}:{marginTop:"1rem",children:a}):cd(CI,{flexDirection:"column",rowGap:"1.5rem",children:["all"===r&&cd(sd,{children:[cd(mI,{children:[ld(VI,{fontWeight:"bold",backgroundColor:"var(--background-color)",padding:"0.5rem 1rem",borderRadius:"0.5rem",margin:"1rem 0",width:"max-content",fontSize:"14",children:l("modelmanager:checkpointModels")}),n]}),cd(mI,{children:[ld(VI,{fontWeight:"bold",backgroundColor:"var(--background-color)",padding:"0.5rem 1rem",borderRadius:"0.5rem",marginBottom:"0.5rem",width:"max-content",fontSize:"14",children:l("modelmanager:diffusersModels")}),o]})]}),"ckpt"===r&&ld(CI,{flexDirection:"column",marginTop:"1rem",children:n}),"diffusers"===r&&ld(CI,{flexDirection:"column",marginTop:"1rem",children:o})]})}),[e,t,l,r]);return cd(CI,{flexDirection:"column",rowGap:"2rem",width:"50%",minWidth:"50%",children:[cd(CI,{justifyContent:"space-between",children:[ld(VI,{fontSize:"1.4rem",fontWeight:"bold",children:l("modelmanager:availableModels")}),ld(U9,{})]}),ld(V3,{onChange:e=>{s((()=>{n(e.target.value)}))},label:l("modelmanager:search")}),cd(CI,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-360,overflow:"scroll",paddingRight:"1rem",children:[cd(CI,{columnGap:"0.5rem",children:[ld(K9,{label:l("modelmanager:allModels"),onClick:()=>o("all"),isActive:"all"===r}),ld(K9,{label:l("modelmanager:checkpointModels"),onClick:()=>o("ckpt"),isActive:"ckpt"===r}),ld(K9,{label:l("modelmanager:diffusersModels"),onClick:()=>o("diffusers"),isActive:"diffusers"===r})]}),c]})]})},J9=uV([M3],(e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function e8(){const{openModel:e,model_list:t}=y5(J9),n=y5((e=>e.system.isProcessing)),r=v5(),{t:o}=HY(),[i,s]=a.exports.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});a.exports.useEffect((()=>{if(e){const n=A$.pickBy(t,((t,n)=>A$.isEqual(n,e)));s({name:e,description:n[e]?.description,path:n[e]?.path,repo_id:n[e]?.repo_id,vae:{repo_id:n[e]?.vae?.repo_id?n[e]?.vae?.repo_id:"",path:n[e]?.vae?.path?n[e]?.vae?.path:""},default:n[e]?.default,format:"diffusers"})}}),[t,e]);return e?cd(CI,{flexDirection:"column",rowGap:"1rem",width:"100%",children:[ld(CI,{alignItems:"center",children:ld(VI,{fontSize:"lg",fontWeight:"bold",children:e})}),ld(CI,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingRight:"2rem",children:ld(x9,{enableReinitialize:!0,initialValues:i,onSubmit:e=>{r(MQ(e))},children:({handleSubmit:e,errors:t,touched:r})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",alignItems:"start",children:[cd(GT,{isInvalid:!!t.description&&r.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:o("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"lg"}),t.description&&r.description?ld(QT,{children:t.description}):ld(qT,{margin:0,children:o("modelmanager:descriptionValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.path&&r.path,isRequired:!0,children:[ld(eA,{htmlFor:"path",fontSize:"sm",children:o("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"path",name:"path",type:"text",width:"lg"}),t.path&&r.path?ld(QT,{children:t.path}):ld(qT,{margin:0,children:o("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.repo_id&&r.repo_id,children:[ld(eA,{htmlFor:"repo_id",fontSize:"sm",children:o("modelmanager:repo_id")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"repo_id",name:"repo_id",type:"text",width:"lg"}),t.repo_id&&r.repo_id?ld(QT,{children:t.repo_id}):ld(qT,{margin:0,children:o("modelmanager:repoIDValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.vae?.path&&r.vae?.path,children:[ld(eA,{htmlFor:"vae.path",fontSize:"sm",children:o("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.path",name:"vae.path",type:"text",width:"lg"}),t.vae?.path&&r.vae?.path?ld(QT,{children:t.vae?.path}):ld(qT,{margin:0,children:o("modelmanager:vaeLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.vae?.repo_id&&r.vae?.repo_id,children:[ld(eA,{htmlFor:"vae.repo_id",fontSize:"sm",children:o("modelmanager:vaeRepoID")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"lg"}),t.vae?.repo_id&&r.vae?.repo_id?ld(QT,{children:t.vae?.repo_id}):ld(qT,{margin:0,children:o("modelmanager:vaeRepoIDValidationMsg")})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelmanager:updateModel")})]})})})})]}):ld(CI,{width:"100%",height:"250px",justifyContent:"center",alignItems:"center",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",children:ld(VI,{fontWeight:"bold",color:"var(--subtext-color-bright)",children:"Pick A Model To Edit"})})}const t8=uV([M3],(e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function n8(){const{openModel:e,model_list:t}=y5(t8),n=y5((e=>e.system.isProcessing)),r=v5(),{t:o}=HY(),[i,s]=a.exports.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});a.exports.useEffect((()=>{if(e){const n=A$.pickBy(t,((t,n)=>A$.isEqual(n,e)));s({name:e,description:n[e]?.description,config:n[e]?.config,weights:n[e]?.weights,vae:n[e]?.vae,width:n[e]?.width,height:n[e]?.height,default:n[e]?.default,format:"ckpt"})}}),[t,e]);return e?cd(CI,{flexDirection:"column",rowGap:"1rem",width:"100%",children:[ld(CI,{alignItems:"center",children:ld(VI,{fontSize:"lg",fontWeight:"bold",children:e})}),ld(CI,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingRight:"2rem",children:ld(x9,{enableReinitialize:!0,initialValues:i,onSubmit:e=>{r(MQ({...e,width:Number(e.width),height:Number(e.height)}))},children:({handleSubmit:e,errors:t,touched:r})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",alignItems:"start",children:[cd(GT,{isInvalid:!!t.description&&r.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:o("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"lg"}),t.description&&r.description?ld(QT,{children:t.description}):ld(qT,{margin:0,children:o("modelmanager:descriptionValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.config&&r.config,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:o("modelmanager:config")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"config",name:"config",type:"text",width:"lg"}),t.config&&r.config?ld(QT,{children:t.config}):ld(qT,{margin:0,children:o("modelmanager:configValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.weights&&r.weights,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:o("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"weights",name:"weights",type:"text",width:"lg"}),t.weights&&r.weights?ld(QT,{children:t.weights}):ld(qT,{margin:0,children:o("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.vae&&r.vae,children:[ld(eA,{htmlFor:"vae",fontSize:"sm",children:o("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae",name:"vae",type:"text",width:"lg"}),t.vae&&r.vae?ld(QT,{children:t.vae}):ld(qT,{margin:0,children:o("modelmanager:vaeLocationValidationMsg")})]})]}),cd(HI,{width:"100%",children:[cd(GT,{isInvalid:!!t.width&&r.width,children:[ld(eA,{htmlFor:"width",fontSize:"sm",children:o("modelmanager:width")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"width",name:"width",children:({field:e,form:t})=>ld(O3,{id:"width",name:"width",min:64,max:2048,step:64,value:t.values.width,onChange:n=>t.setFieldValue(e.name,Number(n))})}),t.width&&r.width?ld(QT,{children:t.width}):ld(qT,{margin:0,children:o("modelmanager:widthValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.height&&r.height,children:[ld(eA,{htmlFor:"height",fontSize:"sm",children:o("modelmanager:height")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"height",name:"height",children:({field:e,form:t})=>ld(O3,{id:"height",name:"height",min:64,max:2048,step:64,value:t.values.height,onChange:n=>t.setFieldValue(e.name,Number(n))})}),t.height&&r.height?ld(QT,{children:t.height}):ld(qT,{margin:0,children:o("modelmanager:heightValidationMsg")})]})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelmanager:updateModel")})]})})})})]}):ld(CI,{width:"100%",height:"250px",justifyContent:"center",alignItems:"center",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",children:ld(VI,{fontWeight:"bold",color:"var(--subtext-color-bright)",children:"Pick A Model To Edit"})})}function r8({children:e}){const{isOpen:t,onOpen:n,onClose:r}=QA(),o=y5((e=>e.system.model_list)),i=y5((e=>e.system.openModel)),{t:s}=HY();return cd(sd,{children:[a.exports.cloneElement(e,{onClick:n}),cd(RB,{isOpen:t,onClose:r,size:"6xl",children:[ld(GB,{}),cd(WB,{className:"modal",fontFamily:"Inter",children:[ld(DB,{className:"modal-close-btn"}),ld(UB,{fontWeight:"bold",children:s("modelmanager:modelManager")}),cd(CI,{padding:"0 1.5rem 1.5rem 1.5rem",width:"100%",columnGap:"2rem",children:[ld(Q9,{}),i&&"diffusers"===o[i].format?ld(e8,{}):ld(n8,{})]})]})]})]})}function o8(){const{t:e,i18n:t}=HY(),n={en:e("common:langEnglish"),ru:e("common:langRussian"),it:e("common:langItalian"),pt_br:e("common:langBrPortuguese"),de:e("common:langGerman"),pl:e("common:langPolish"),zh_cn:e("common:langSimplifiedChinese"),es:e("common:langSpanish"),ja:e("common:langJapanese")};return ld(B3,{trigger:"hover",triggerComponent:ld(S3,{"aria-label":e("common:languagePickerLabel"),tooltip:e("common:languagePickerLabel"),icon:ld(e3,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:ld(WI,{children:(()=>{const e=[];return Object.keys(n).forEach((r=>{e.push(ld(j3,{"data-selected":localStorage.getItem("i18nextLng")===r,onClick:()=>t.changeLanguage(r),className:"modal-close-btn lang-select-btn","aria-label":n[r],tooltip:n[r],size:"sm",minWidth:"200px",children:n[r]},r))})),e})()})})}const i8=()=>{const{t:e}=HY(),t=y5((e=>e.system.app_version));return cd("div",{className:"site-header",children:[cd("div",{className:"site-header-left-side",children:[ld("img",{src:k3,alt:"invoke-ai-logo"}),cd(CI,{alignItems:"center",columnGap:"0.6rem",children:[cd(VI,{fontSize:"1.4rem",children:["invoke ",ld("strong",{children:"ai"})]}),ld(VI,{fontWeight:"bold",color:"var(--text-color-secondary)",marginTop:"0.2rem",children:t})]})]}),cd("div",{className:"site-header-right-side",children:[ld(z3,{}),ld(W3,{}),ld(r8,{children:ld(S3,{"aria-label":e("modelmanager:modelManager"),tooltip:e("modelmanager:modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:ld(W5,{})})}),ld(_3,{children:ld(S3,{"aria-label":e("common:hotkeysLabel"),tooltip:e("common:hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:ld(J5,{})})}),ld(F3,{}),ld(o8,{}),ld(S3,{"aria-label":e("common:reportBugLabel"),tooltip:e("common:reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:ld(MI,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:ld(z5,{})})}),ld(S3,{"aria-label":e("common:githubLabel"),tooltip:e("common:githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:ld(MI,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:ld(O5,{})})}),ld(S3,{"aria-label":e("common:discordLabel"),tooltip:e("common:discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:ld(MI,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:ld(P5,{})})}),ld(N3,{children:ld(S3,{"aria-label":e("common:settingsLabel"),tooltip:e("common:settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:ld(q3,{})})})]})]})};var a8=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),s8=globalThis&&globalThis.__assign||function(){return s8=Object.assign||function(e){for(var t,n=1,r=arguments.length;n()=>(t||e((t={exports:{}}).exports,t),t.exports),I8=(e,t,n)=>(n=null!=e?E8(M8(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of O8(t))!T8.call(e,o)&&o!==n&&L8(e,o,{get:()=>t[o],enumerable:!(r=P8(t,o))||r.enumerable});return e})(!t&&e&&e.__esModule?n:L8(n,"default",{value:e,enumerable:!0}),e)),R8=A8(((e,t)=>{t.exports=function(){this.__data__=[],this.size=0}})),N8=A8(((e,t)=>{t.exports=function(e,t){return e===t||e!=e&&t!=t}})),D8=A8(((e,t)=>{var n=N8();t.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}})),z8=A8(((e,t)=>{var n=D8(),r=Array.prototype.splice;t.exports=function(e){var t=this.__data__,o=n(t,e);return!(o<0)&&(o==t.length-1?t.pop():r.call(t,o,1),--this.size,!0)}})),B8=A8(((e,t)=>{var n=D8();t.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}})),j8=A8(((e,t)=>{var n=D8();t.exports=function(e){return n(this.__data__,e)>-1}})),F8=A8(((e,t)=>{var n=D8();t.exports=function(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}})),H8=A8(((e,t)=>{var n=R8(),r=z8(),o=B8(),i=j8(),a=F8();function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var n=H8();t.exports=function(){this.__data__=new n,this.size=0}})),V8=A8(((e,t)=>{t.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}})),U8=A8(((e,t)=>{t.exports=function(e){return this.__data__.get(e)}})),$8=A8(((e,t)=>{t.exports=function(e){return this.__data__.has(e)}})),G8=A8(((e,t)=>{var n="object"==typeof global&&global&&global.Object===Object&&global;t.exports=n})),q8=A8(((e,t)=>{var n=G8(),r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")();t.exports=o})),Y8=A8(((e,t)=>{var n=q8().Symbol;t.exports=n})),Z8=A8(((e,t)=>{var n=Y8(),r=Object.prototype,o=r.hasOwnProperty,i=r.toString,a=n?n.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch{}var s=i.call(e);return r&&(t?e[a]=n:delete e[a]),s}})),X8=A8(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){return n.call(e)}})),K8=A8(((e,t)=>{var n=Y8(),r=Z8(),o=X8(),i=n?n.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?r(e):o(e)}})),Q8=A8(((e,t)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}})),J8=A8(((e,t)=>{var n=K8(),r=Q8();t.exports=function(e){if(!r(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}})),eee=A8(((e,t)=>{var n=q8()["__core-js_shared__"];t.exports=n})),tee=A8(((e,t)=>{var n=eee(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();t.exports=function(e){return!!r&&r in e}})),nee=A8(((e,t)=>{var n=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return n.call(e)}catch{}try{return e+""}catch{}}return""}})),ree=A8(((e,t)=>{var n=J8(),r=tee(),o=Q8(),i=nee(),a=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!o(e)||r(e))&&(n(e)?d:a).test(i(e))}})),oee=A8(((e,t)=>{t.exports=function(e,t){return e?.[t]}})),iee=A8(((e,t)=>{var n=ree(),r=oee();t.exports=function(e,t){var o=r(e,t);return n(o)?o:void 0}})),aee=A8(((e,t)=>{var n=iee()(q8(),"Map");t.exports=n})),see=A8(((e,t)=>{var n=iee()(Object,"create");t.exports=n})),lee=A8(((e,t)=>{var n=see();t.exports=function(){this.__data__=n?n(null):{},this.size=0}})),cee=A8(((e,t)=>{t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}})),uee=A8(((e,t)=>{var n=see(),r=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(n){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return r.call(t,e)?t[e]:void 0}})),dee=A8(((e,t)=>{var n=see(),r=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:r.call(t,e)}})),hee=A8(((e,t)=>{var n=see();t.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}})),fee=A8(((e,t)=>{var n=lee(),r=cee(),o=uee(),i=dee(),a=hee();function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var n=fee(),r=H8(),o=aee();t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||r),string:new n}}})),gee=A8(((e,t)=>{t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}})),mee=A8(((e,t)=>{var n=gee();t.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}})),vee=A8(((e,t)=>{var n=mee();t.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}})),yee=A8(((e,t)=>{var n=mee();t.exports=function(e){return n(this,e).get(e)}})),bee=A8(((e,t)=>{var n=mee();t.exports=function(e){return n(this,e).has(e)}})),xee=A8(((e,t)=>{var n=mee();t.exports=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}})),wee=A8(((e,t)=>{var n=pee(),r=vee(),o=yee(),i=bee(),a=xee();function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var n=H8(),r=aee(),o=wee();t.exports=function(e,t){var i=this.__data__;if(i instanceof n){var a=i.__data__;if(!r||a.length<199)return a.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(a)}return i.set(e,t),this.size=i.size,this}})),See=A8(((e,t)=>{var n=H8(),r=W8(),o=V8(),i=U8(),a=$8(),s=kee();function l(e){var t=this.__data__=new n(e);this.size=t.size}l.prototype.clear=r,l.prototype.delete=o,l.prototype.get=i,l.prototype.has=a,l.prototype.set=s,t.exports=l})),Cee=A8(((e,t)=>{t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}})),_ee=A8(((e,t)=>{t.exports=function(e){return this.__data__.has(e)}})),Eee=A8(((e,t)=>{var n=wee(),r=Cee(),o=_ee();function i(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new n;++t{t.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{t.exports=function(e,t){return e.has(t)}})),Oee=A8(((e,t)=>{var n=Eee(),r=Lee(),o=Pee();t.exports=function(e,t,i,a,s,l){var c=1&i,u=e.length,d=t.length;if(u!=d&&!(c&&d>u))return!1;var h=l.get(e),f=l.get(t);if(h&&f)return h==t&&f==e;var p=-1,g=!0,m=2&i?new n:void 0;for(l.set(e,t),l.set(t,e);++p{var n=q8().Uint8Array;t.exports=n})),Tee=A8(((e,t)=>{t.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}})),Aee=A8(((e,t)=>{t.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}})),Iee=A8(((e,t)=>{var n=Y8(),r=Mee(),o=N8(),i=Oee(),a=Tee(),s=Aee(),l=n?n.prototype:void 0,c=l?l.valueOf:void 0;t.exports=function(e,t,n,l,u,d,h){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new r(e),new r(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var p=1&l;if(f||(f=s),e.size!=t.size&&!p)return!1;var g=h.get(e);if(g)return g==t;l|=2,h.set(e,t);var m=i(f(e),f(t),l,u,d,h);return h.delete(e),m;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}})),Ree=A8(((e,t)=>{t.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n{var n=Array.isArray;t.exports=n})),Dee=A8(((e,t)=>{var n=Ree(),r=Nee();t.exports=function(e,t,o){var i=t(e);return r(e)?i:n(i,o(e))}})),zee=A8(((e,t)=>{t.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n{t.exports=function(){return[]}})),jee=A8(((e,t)=>{var n=zee(),r=Bee(),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(e){return null==e?[]:(e=Object(e),n(i(e),(function(t){return o.call(e,t)})))}:r;t.exports=a})),Fee=A8(((e,t)=>{t.exports=function(e,t){for(var n=-1,r=Array(e);++n{t.exports=function(e){return null!=e&&"object"==typeof e}})),Wee=A8(((e,t)=>{var n=K8(),r=Hee();t.exports=function(e){return r(e)&&"[object Arguments]"==n(e)}})),Vee=A8(((e,t)=>{var n=Wee(),r=Hee(),o=Object.prototype,i=o.hasOwnProperty,a=o.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(e){return r(e)&&i.call(e,"callee")&&!a.call(e,"callee")};t.exports=s})),Uee=A8(((e,t)=>{t.exports=function(){return!1}})),$ee=A8(((e,t)=>{var n=q8(),r=Uee(),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;t.exports=s})),Gee=A8(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var r=typeof e;return!!(t=t??9007199254740991)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e{t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}})),Yee=A8(((e,t)=>{var n=K8(),r=qee(),o=Hee(),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(e){return o(e)&&r(e.length)&&!!i[n(e)]}})),Zee=A8(((e,t)=>{t.exports=function(e){return function(t){return e(t)}}})),Xee=A8(((e,t)=>{var n=G8(),r="object"==typeof e&&e&&!e.nodeType&&e,o=r&&"object"==typeof t&&t&&!t.nodeType&&t,i=o&&o.exports===r&&n.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch{}}();t.exports=a})),Kee=A8(((e,t)=>{var n=Yee(),r=Zee(),o=Xee(),i=o&&o.isTypedArray,a=i?r(i):n;t.exports=a})),Qee=A8(((e,t)=>{var n=Fee(),r=Vee(),o=Nee(),i=$ee(),a=Gee(),s=Kee(),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=o(e),u=!c&&r(e),d=!c&&!u&&i(e),h=!c&&!u&&!d&&s(e),f=c||u||d||h,p=f?n(e.length,String):[],g=p.length;for(var m in e)(t||l.call(e,m))&&(!f||!("length"==m||d&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,g)))&&p.push(m);return p}})),Jee=A8(((e,t)=>{var n=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}})),ete=A8(((e,t)=>{t.exports=function(e,t){return function(n){return e(t(n))}}})),tte=A8(((e,t)=>{var n=ete()(Object.keys,Object);t.exports=n})),nte=A8(((e,t)=>{var n=Jee(),r=tte(),o=Object.prototype.hasOwnProperty;t.exports=function(e){if(!n(e))return r(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}})),rte=A8(((e,t)=>{var n=J8(),r=qee();t.exports=function(e){return null!=e&&r(e.length)&&!n(e)}})),ote=A8(((e,t)=>{var n=Qee(),r=nte(),o=rte();t.exports=function(e){return o(e)?n(e):r(e)}})),ite=A8(((e,t)=>{var n=Dee(),r=jee(),o=ote();t.exports=function(e){return n(e,o,r)}})),ate=A8(((e,t)=>{var n=ite(),r=Object.prototype.hasOwnProperty;t.exports=function(e,t,o,i,a,s){var l=1&o,c=n(e),u=c.length;if(u!=n(t).length&&!l)return!1;for(var d=u;d--;){var h=c[d];if(!(l?h in t:r.call(t,h)))return!1}var f=s.get(e),p=s.get(t);if(f&&p)return f==t&&p==e;var g=!0;s.set(e,t),s.set(t,e);for(var m=l;++d{var n=iee()(q8(),"DataView");t.exports=n})),lte=A8(((e,t)=>{var n=iee()(q8(),"Promise");t.exports=n})),cte=A8(((e,t)=>{var n=iee()(q8(),"Set");t.exports=n})),ute=A8(((e,t)=>{var n=iee()(q8(),"WeakMap");t.exports=n})),dte=A8(((e,t)=>{var n=ste(),r=aee(),o=lte(),i=cte(),a=ute(),s=K8(),l=nee(),c="[object Map]",u="[object Promise]",d="[object Set]",h="[object WeakMap]",f="[object DataView]",p=l(n),g=l(r),m=l(o),v=l(i),y=l(a),b=s;(n&&b(new n(new ArrayBuffer(1)))!=f||r&&b(new r)!=c||o&&b(o.resolve())!=u||i&&b(new i)!=d||a&&b(new a)!=h)&&(b=function(e){var t=s(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):"";if(r)switch(r){case p:return f;case g:return c;case m:return u;case v:return d;case y:return h}return t}),t.exports=b})),hte=A8(((e,t)=>{var n=See(),r=Oee(),o=Iee(),i=ate(),a=dte(),s=Nee(),l=$ee(),c=Kee(),u="[object Arguments]",d="[object Array]",h="[object Object]",f=Object.prototype.hasOwnProperty;t.exports=function(e,t,p,g,m,v){var y=s(e),b=s(t),x=y?d:a(e),w=b?d:a(t),k=(x=x==u?h:x)==h,S=(w=w==u?h:w)==h,C=x==w;if(C&&l(e)){if(!l(t))return!1;y=!0,k=!1}if(C&&!k)return v||(v=new n),y||c(e)?r(e,t,p,g,m,v):o(e,t,x,p,g,m,v);if(!(1&p)){var _=k&&f.call(e,"__wrapped__"),E=S&&f.call(t,"__wrapped__");if(_||E){var L=_?e.value():e,P=E?t.value():t;return v||(v=new n),m(L,P,p,g,v)}}return!!C&&(v||(v=new n),i(e,t,p,g,m,v))}})),fte=A8(((e,t)=>{var n=hte(),r=Hee();t.exports=function e(t,o,i,a,s){return t===o||(null==t||null==o||!r(t)&&!r(o)?t!=t&&o!=o:n(t,o,i,a,e,s))}})),pte=A8(((e,t)=>{var n=fte();t.exports=function(e,t){return n(e,t)}})),gte=["ctrl","shift","alt","meta","mod"],mte={esc:"escape",return:"enter",left:"arrowleft",up:"arrowup",right:"arrowright",down:"arrowdown"};function vte(e,t=","){return"string"==typeof e?e.split(t):e}function yte(e,t="+"){let n=e.toLocaleLowerCase().split(t).map((e=>e.trim())).map((e=>mte[e]||e)),r={alt:n.includes("alt"),ctrl:n.includes("ctrl"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod")},o=n.filter((e=>!gte.includes(e)));return{...r,keys:o}}function bte({target:e},t=!1){let n=e&&e.tagName;return t instanceof Array?Boolean(n&&t&&t.some((e=>e.toLowerCase()===n.toLowerCase()))):Boolean(n&&t&&!0===t)}var xte=a.exports.createContext(void 0),wte=a.exports.createContext({hotkeys:[],enabledScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),kte=I8(pte());var Ste=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()};function Cte(e,t,n,r){let o=a.exports.useRef(null),{current:i}=a.exports.useRef(new Set),s=n instanceof Array?r instanceof Array?void 0:r:n,l=n instanceof Array?n:r instanceof Array?r:[],c=a.exports.useCallback(t,[...l]),u=function(e){let t=a.exports.useRef(void 0);return(0,kte.default)(t.current,e)||(t.current=e),t.current}(s),{enabledScopes:d}=a.exports.useContext(wte),h=a.exports.useContext(xte);return a.exports.useLayoutEffect((()=>{if(!1===u?.enabled||!function(e,t){return 0===e.length&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a '),!0):!t||e.some((e=>t.includes(e)))||e.includes("*")}(d,u?.scopes))return;let t=t=>{if(!function(e){return bte(e,["input","textarea","select"])}(t)||bte(t,u?.enableOnFormTags)){if(null!==o.current&&document.activeElement!==o.current&&!o.current.contains(document.activeElement))return void Ste(t);t.target?.isContentEditable&&!u?.enableOnContentEditable||vte(e,u?.splitKey).forEach((e=>{let n=yte(e,u?.combinationKey);if(((e,t,n)=>{let{alt:r,ctrl:o,meta:i,mod:a,shift:s,keys:l}=t,{altKey:c,ctrlKey:u,metaKey:d,shiftKey:h,key:f,code:p}=e,g=p.toLowerCase().replace("key",""),m=f.toLowerCase();if(c!==r&&"alt"!==m||h!==s&&"shift"!==m)return!1;if(a){if(!d&&!u)return!1}else if(d!==i&&"meta"!==g||u!==o&&"ctrl"!==g)return!1;return!(!l||1!==l.length||!l.includes(m)&&!l.includes(g))||(l?l.every((e=>n.has(e))):!l)})(t,n,i)||n.keys?.includes("*")){if(function(e,t,n){("function"==typeof n&&n(e,t)||!0===n)&&e.preventDefault()}(t,n,u?.preventDefault),!function(e,t,n){return"function"==typeof n?n(e,t):!0===n||void 0===n}(t,n,u?.enabled))return void Ste(t);c(t,n)}}))}},n=e=>{i.add(e.key.toLowerCase()),(void 0===u?.keydown&&!0!==u?.keyup||u?.keydown)&&t(e)},r=e=>{"meta"!==e.key.toLowerCase()?i.delete(e.key.toLowerCase()):i.clear(),u?.keyup&&t(e)};return(o.current||document).addEventListener("keyup",r),(o.current||document).addEventListener("keydown",n),h&&vte(e,u?.splitKey).forEach((e=>h.addHotkey(yte(e,u?.combinationKey)))),()=>{(o.current||document).removeEventListener("keyup",r),(o.current||document).removeEventListener("keydown",n),h&&vte(e,u?.splitKey).forEach((e=>h.removeHotkey(yte(e,u?.combinationKey))))}}),[e,c,u,d]),o}I8(pte());var _te=new Set;window.addEventListener("DOMContentLoaded",(()=>{document.addEventListener("keydown",(e=>{!function(e){(Array.isArray(e)?e:[e]).forEach((e=>_te.add(yte(e))))}(e.key)})),document.addEventListener("keyup",(e=>{!function(e){(Array.isArray(e)?e:[e]).forEach((e=>{let t=yte(e);for(let n of _te)n.keys?.every((e=>t.keys?.includes(e)))&&_te.delete(n)}))}(e.key)}))}));const Ete=uV((e=>e.system),(e=>e.log),{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),Lte=uV((e=>e.system),(e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),Pte=()=>{const e=v5(),t=y5(Ete),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:o}=y5(Lte),[i,s]=a.exports.useState(!0),l=a.exports.useRef(null);a.exports.useLayoutEffect((()=>{null!==l.current&&i&&(l.current.scrollTop=l.current.scrollHeight)}),[i,t,n]);Cte("`",(()=>{e(GY(!n))}),[n]),Cte("esc",(()=>{e(GY(!1))}));return cd(sd,{children:[n&&ld(_8,{defaultSize:{width:"100%",height:200},style:{display:"flex",position:"fixed",left:0,bottom:0,zIndex:9999},maxHeight:"90vh",children:ld("div",{className:"console",ref:l,onScroll:()=>{l.current&&i&&l.current.scrollTop{const{timestamp:n,message:r,level:o}=e;return cd("div",{className:`console-entry console-${o}-color`,children:[cd("p",{className:"console-timestamp",children:[n,":"]}),ld("p",{className:"console-message",children:r})]},t)}))})}),n&&ld(YH,{hasArrow:!0,label:i?"Autoscroll On":"Autoscroll Off",children:ld(zT,{className:"console-autoscroll-icon-button","data-autoscroll-enabled":i,size:"sm","aria-label":"Toggle autoscroll",variant:"solid",icon:ld(M5,{}),onClick:()=>s(!i)})}),ld(YH,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:ld(zT,{className:"console-toggle-icon-button","data-error-seen":r||!o,size:"sm",position:"fixed",variant:"solid","aria-label":"Toggle Log Viewer",icon:ld(n?r3:j5,{}),onClick:()=>{e(rZ()),e(GY(!n))}})})]})};function Ote(){const{t:e}=HY();return cd("div",{className:"work-in-progress nodes-work-in-progress",children:[ld("h1",{children:e("common:nodes")}),ld("p",{children:e("common:nodesDesc")})]})}const Mte=()=>{const{t:e}=HY();return cd("div",{className:"work-in-progress post-processing-work-in-progress",children:[ld("h1",{children:e("common:postProcessing")}),ld("p",{children:e("common:postProcessDesc1")}),ld("p",{children:e("common:postProcessDesc2")}),ld("p",{children:e("common:postProcessDesc3")})]})},Tte=Sk({displayName:"ImageToImageIcon",viewBox:"0 0 3543 3543",path:ld("g",{transform:"matrix(1.10943,0,0,1.10943,-206.981,-213.533)",children:ld("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M688.533,2405.95L542.987,2405.95C349.532,2405.95 192.47,2248.89 192.47,2055.44L192.47,542.987C192.47,349.532 349.532,192.47 542.987,192.47L2527.88,192.47C2721.33,192.47 2878.4,349.532 2878.4,542.987L2878.4,1172.79L3023.94,1172.79C3217.4,1172.79 3374.46,1329.85 3374.46,1523.3C3374.46,1523.3 3374.46,3035.75 3374.46,3035.75C3374.46,3229.21 3217.4,3386.27 3023.94,3386.27L1039.05,3386.27C845.595,3386.27 688.533,3229.21 688.533,3035.75L688.533,2405.95ZM3286.96,2634.37L3286.96,1523.3C3286.96,1378.14 3169.11,1260.29 3023.94,1260.29C3023.94,1260.29 1039.05,1260.29 1039.05,1260.29C893.887,1260.29 776.033,1378.14 776.033,1523.3L776.033,2489.79L1440.94,1736.22L2385.83,2775.59L2880.71,2200.41L3286.96,2634.37ZM2622.05,1405.51C2778.5,1405.51 2905.51,1532.53 2905.51,1688.98C2905.51,1845.42 2778.5,1972.44 2622.05,1972.44C2465.6,1972.44 2338.58,1845.42 2338.58,1688.98C2338.58,1532.53 2465.6,1405.51 2622.05,1405.51ZM2790.9,1172.79L1323.86,1172.79L944.882,755.906L279.97,1509.47L279.97,542.987C279.97,397.824 397.824,279.97 542.987,279.97C542.987,279.97 2527.88,279.97 2527.88,279.97C2673.04,279.97 2790.9,397.824 2790.9,542.987L2790.9,1172.79ZM2125.98,425.197C2282.43,425.197 2409.45,552.213 2409.45,708.661C2409.45,865.11 2282.43,992.126 2125.98,992.126C1969.54,992.126 1842.52,865.11 1842.52,708.661C1842.52,552.213 1969.54,425.197 2125.98,425.197Z"})})}),Ate=Sk({displayName:"NodesIcon",viewBox:"0 0 3543 3543",path:ld("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3543.31,770.787C3543.31,515.578 3336.11,308.38 3080.9,308.38L462.407,308.38C207.197,308.38 0,515.578 0,770.787L0,2766.03C0,3021.24 207.197,3228.44 462.407,3228.44L3080.9,3228.44C3336.11,3228.44 3543.31,3021.24 3543.31,2766.03C3543.31,2766.03 3543.31,770.787 3543.31,770.787ZM3427.88,770.787L3427.88,2766.03C3427.88,2957.53 3272.4,3113.01 3080.9,3113.01C3080.9,3113.01 462.407,3113.01 462.407,3113.01C270.906,3113.01 115.431,2957.53 115.431,2766.03L115.431,770.787C115.431,579.286 270.906,423.812 462.407,423.812L3080.9,423.812C3272.4,423.812 3427.88,579.286 3427.88,770.787ZM1214.23,1130.69L1321.47,1130.69C1324.01,1130.69 1326.54,1130.53 1329.05,1130.2C1329.05,1130.2 1367.3,1125.33 1397.94,1149.8C1421.63,1168.72 1437.33,1204.3 1437.33,1265.48L1437.33,2078.74L1220.99,2078.74C1146.83,2078.74 1086.61,2138.95 1086.61,2213.12L1086.61,2762.46C1086.61,2836.63 1146.83,2896.84 1220.99,2896.84L1770.34,2896.84C1844.5,2896.84 1904.71,2836.63 1904.71,2762.46L1904.71,2213.12C1904.71,2138.95 1844.5,2078.74 1770.34,2078.74L1554,2078.74L1554,1604.84C1625.84,1658.19 1703.39,1658.1 1703.39,1658.1C1703.54,1658.1 1703.69,1658.11 1703.84,1658.11L2362.2,1658.11L2362.2,1874.44C2362.2,1948.61 2422.42,2008.82 2496.58,2008.82L3045.93,2008.82C3120.09,2008.82 3180.3,1948.61 3180.3,1874.44L3180.3,1325.1C3180.3,1250.93 3120.09,1190.72 3045.93,1190.72L2496.58,1190.72C2422.42,1190.72 2362.2,1250.93 2362.2,1325.1L2362.2,1558.97L2362.2,1541.44L1704.23,1541.44C1702.2,1541.37 1650.96,1539.37 1609.51,1499.26C1577.72,1468.49 1554,1416.47 1554,1331.69L1554,1265.48C1554,1153.86 1513.98,1093.17 1470.76,1058.64C1411.24,1011.1 1338.98,1012.58 1319.15,1014.03L1214.23,1014.03L1214.23,796.992C1214.23,722.828 1154.02,662.617 1079.85,662.617L530.507,662.617C456.343,662.617 396.131,722.828 396.131,796.992L396.131,1346.34C396.131,1420.5 456.343,1480.71 530.507,1480.71L1079.85,1480.71C1154.02,1480.71 1214.23,1420.5 1214.23,1346.34L1214.23,1130.69Z"})}),Ite=Sk({displayName:"PostprocessingIcon",viewBox:"0 0 3543 3543",path:ld("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M709.477,1596.53L992.591,1275.66L2239.09,2646.81L2891.95,1888.03L3427.88,2460.51L3427.88,994.78C3427.88,954.66 3421.05,916.122 3408.5,880.254L3521.9,855.419C3535.8,899.386 3543.31,946.214 3543.31,994.78L3543.31,2990.02C3543.31,3245.23 3336.11,3452.43 3080.9,3452.43C3080.9,3452.43 462.407,3452.43 462.407,3452.43C207.197,3452.43 -0,3245.23 -0,2990.02L-0,994.78C-0,739.571 207.197,532.373 462.407,532.373L505.419,532.373L504.644,532.546L807.104,600.085C820.223,601.729 832.422,607.722 841.77,617.116C850.131,625.517 855.784,636.21 858.055,647.804L462.407,647.804C270.906,647.804 115.431,803.279 115.431,994.78L115.431,2075.73L-0,2101.5L115.431,2127.28L115.431,2269.78L220.47,2150.73L482.345,2209.21C503.267,2211.83 522.722,2221.39 537.63,2236.37C552.538,2251.35 562.049,2270.9 564.657,2291.93L671.84,2776.17L779.022,2291.93C781.631,2270.9 791.141,2251.35 806.05,2236.37C820.958,2221.39 840.413,2211.83 861.334,2209.21L1353.15,2101.5L861.334,1993.8C840.413,1991.18 820.958,1981.62 806.05,1966.64C791.141,1951.66 781.631,1932.11 779.022,1911.08L709.477,1596.53ZM671.84,1573.09L725.556,2006.07C726.863,2016.61 731.63,2026.4 739.101,2033.91C746.573,2041.42 756.323,2046.21 766.808,2047.53L1197.68,2101.5L766.808,2155.48C756.323,2156.8 746.573,2161.59 739.101,2169.09C731.63,2176.6 726.863,2186.4 725.556,2196.94L671.84,2629.92L618.124,2196.94C616.817,2186.4 612.05,2176.6 604.579,2169.09C597.107,2161.59 587.357,2156.8 576.872,2155.48L146.001,2101.5L576.872,2047.53C587.357,2046.21 597.107,2041.42 604.579,2033.91C612.05,2026.4 616.817,2016.61 618.124,2006.07L671.84,1573.09ZM609.035,1710.36L564.657,1911.08C562.049,1932.11 552.538,1951.66 537.63,1966.64C522.722,1981.62 503.267,1991.18 482.345,1993.8L328.665,2028.11L609.035,1710.36ZM2297.12,938.615L2451.12,973.003C2480.59,976.695 2507.99,990.158 2528.99,1011.26C2549.99,1032.37 2563.39,1059.9 2567.07,1089.52L2672.73,1566.9C2634.5,1580.11 2593.44,1587.29 2550.72,1587.29C2344.33,1587.29 2176.77,1419.73 2176.77,1213.34C2176.77,1104.78 2223.13,1006.96 2297.12,938.615ZM2718.05,76.925L2793.72,686.847C2795.56,701.69 2802.27,715.491 2812.8,726.068C2823.32,736.644 2837.06,743.391 2851.83,745.242L3458.78,821.28L2851.83,897.318C2837.06,899.168 2823.32,905.916 2812.8,916.492C2802.27,927.068 2795.56,940.87 2793.72,955.712L2718.05,1565.63L2642.38,955.712C2640.54,940.87 2633.83,927.068 2623.3,916.492C2612.78,905.916 2599.04,899.168 2584.27,897.318L1977.32,821.28L2584.27,745.242C2599.04,743.391 2612.78,736.644 2623.3,726.068C2633.83,715.491 2640.54,701.69 2642.38,686.847L2718.05,76.925ZM2883.68,1043.06C2909.88,1094.13 2924.67,1152.02 2924.67,1213.34C2924.67,1335.4 2866.06,1443.88 2775.49,1512.14L2869.03,1089.52C2871.07,1073.15 2876.07,1057.42 2883.68,1043.06ZM925.928,201.2L959.611,472.704C960.431,479.311 963.42,485.455 968.105,490.163C972.79,494.871 978.904,497.875 985.479,498.698L1255.66,532.546L985.479,566.395C978.904,567.218 972.79,570.222 968.105,574.93C963.42,579.638 960.431,585.781 959.611,592.388L925.928,863.893L892.245,592.388C891.425,585.781 888.436,579.638 883.751,574.93C879.066,570.222 872.952,567.218 866.378,566.395L596.195,532.546L866.378,498.698C872.952,497.875 879.066,494.871 883.751,490.163C888.436,485.455 891.425,479.311 892.245,472.704L925.928,201.2ZM2864.47,532.373L3080.9,532.373C3258.7,532.373 3413.2,632.945 3490.58,780.281L3319.31,742.773C3257.14,683.925 3173.2,647.804 3080.9,647.804L2927.07,647.804C2919.95,642.994 2913.25,637.473 2907.11,631.298C2886.11,610.194 2872.71,582.655 2869.03,553.04L2864.47,532.373ZM1352.36,532.373L2571.64,532.373L2567.07,553.04C2563.39,582.655 2549.99,610.194 2528.99,631.298C2522.85,637.473 2516.16,642.994 2509.03,647.804L993.801,647.804C996.072,636.21 1001.73,625.517 1010.09,617.116C1019.43,607.722 1031.63,601.729 1044.75,600.085L1353.15,532.546L1352.36,532.373Z"})}),Rte=Sk({displayName:"TextToImageIcon",viewBox:"0 0 3543 3543",path:ld("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",transform:"matrix(1.11667,0,0,1.1066,-231.131,-213.062)",children:ld("path",{d:"M2209.59,1137.35L2209.59,1098.17C2177.13,1108.99 2125.74,1121.91 2055.41,1136.94C2054.77,1137.08 2054.14,1137.21 2053.49,1137.35L1662.79,1137.35C1687.75,1101.98 1720.8,1074.35 1761.93,1054.44C1808.52,1031.9 1875.69,1012.22 1963.45,995.386C2081.86,973.146 2163.91,952.409 2209.59,933.174L2209.59,907.929C2209.59,859.241 2197.57,824.529 2173.53,803.792C2149.48,783.054 2104.1,772.686 2037.38,772.686C1992.3,772.686 1957.14,781.552 1931.89,799.284C1906.64,817.015 1886.21,848.121 1870.58,892.601L1640.67,851.127C1666.51,758.56 1710.99,690.037 1774.11,645.557C1837.22,601.077 1930.99,578.837 2055.41,578.837C2168.42,578.837 2252.57,592.211 2307.87,618.959C2363.17,645.707 2402.09,679.668 2424.63,720.842C2447.17,762.016 2458.44,837.602 2458.44,947.6L2456.7,1137.35L3021.34,1137.35C3214.79,1137.35 3371.86,1294.41 3371.86,1487.87C3371.86,1487.87 3371.86,3000.32 3371.86,3000.32C3371.86,3193.78 3214.79,3350.84 3021.34,3350.84C3021.34,3350.84 1036.45,3350.84 1036.45,3350.84C842.991,3350.84 685.93,3193.78 685.93,3000.32L685.93,1487.87C685.93,1400.21 718.174,1320.03 771.448,1258.54L772.123,1257.76L607.408,1257.76L498.311,1558L215.202,1558L730.028,236.22L1012.24,236.22L1373.06,1137.35L2209.59,1137.35ZM3284.36,2598.93L3284.36,1487.87C3284.36,1342.71 3166.5,1224.85 3021.34,1224.85C3021.34,1224.85 1036.45,1224.85 1036.45,1224.85C891.284,1224.85 773.43,1342.71 773.43,1487.87L773.43,2454.35L1438.34,1700.79L2383.22,2740.16L2878.11,2164.98L3284.36,2598.93ZM2619.44,1370.08C2775.89,1370.08 2902.91,1497.1 2902.91,1653.54C2902.91,1809.99 2775.89,1937.01 2619.44,1937.01C2462.99,1937.01 2335.98,1809.99 2335.98,1653.54C2335.98,1497.1 2462.99,1370.08 2619.44,1370.08ZM772.877,1256.89L772.849,1256.93L773.167,1256.57L772.877,1256.89ZM773.634,1256.04L773.563,1256.12L773.985,1255.64L773.634,1256.04ZM774.394,1255.18L774.276,1255.31L774.746,1254.78L774.394,1255.18ZM775.157,1254.32L774.988,1254.51L775.493,1253.95L775.157,1254.32ZM775.923,1253.47L775.698,1253.72L776.237,1253.12L775.923,1253.47ZM776.691,1252.62L776.403,1252.94L776.979,1252.3L776.691,1252.62ZM777.462,1251.77L777.098,1252.17L777.723,1251.49L777.462,1251.77ZM925.081,1155.44C868.026,1174.57 817.508,1207.99 777.775,1251.43C817.511,1207.99 868.031,1174.57 925.081,1155.44ZM925.646,1155.25L925.108,1155.43L926.103,1155.1L925.646,1155.25ZM935.286,1152.2C932.214,1153.12 929.159,1154.09 926.13,1155.09C929.165,1154.09 932.219,1153.12 935.286,1152.2ZM935.716,1152.07L935.384,1152.17L936.292,1151.89L935.716,1152.07ZM936.843,1151.73L936.451,1151.85L937.327,1151.59L936.843,1151.73ZM937.972,1151.4L937.514,1151.53L938.377,1151.28L937.972,1151.4ZM939.102,1151.07L938.57,1151.22L939.438,1150.97L939.102,1151.07ZM940.233,1150.74L939.613,1150.92L940.505,1150.67L940.233,1150.74ZM946.659,1148.98C944.639,1149.51 942.626,1150.07 940.626,1150.63C942.631,1150.06 944.642,1149.51 946.659,1148.98ZM947.056,1148.87L946.829,1148.93L947.659,1148.71L947.056,1148.87ZM948.198,1148.57L947.919,1148.65L948.705,1148.44L948.198,1148.57ZM949.342,1148.28L949.008,1148.37L949.771,1148.17L949.342,1148.28ZM950.488,1147.99L950.096,1148.09L950.848,1147.9L950.488,1147.99ZM951.635,1147.7L951.182,1147.81L951.932,1147.63L951.635,1147.7ZM952.783,1147.42L952.262,1147.55L953.022,1147.36L952.783,1147.42ZM953.933,1147.14L953.327,1147.28L954.115,1147.09L953.933,1147.14ZM958.213,1146.13C956.927,1146.42 955.644,1146.73 954.354,1147.04C955.637,1146.73 956.923,1146.43 958.213,1146.13ZM958.547,1146.06L958.409,1146.09L959.174,1145.91L958.547,1146.06ZM959.704,1145.79L959.517,1145.84L960.229,1145.68L959.704,1145.79ZM960.863,1145.54L960.626,1145.59L961.311,1145.44L960.863,1145.54ZM962.023,1145.28L961.736,1145.35L962.406,1145.2L962.023,1145.28ZM963.184,1145.03L962.846,1145.11L963.508,1144.97L963.184,1145.03ZM964.347,1144.79L963.956,1144.87L964.615,1144.73L964.347,1144.79ZM965.511,1144.55L965.066,1144.64L965.725,1144.5L965.511,1144.55ZM966.677,1144.31L966.172,1144.41L966.838,1144.28L966.677,1144.31ZM967.844,1144.08L967.269,1144.19L967.953,1144.05L967.844,1144.08ZM970.183,1143.62C969.793,1143.69 969.403,1143.77 969.013,1143.85L969.055,1143.84C969.413,1143.77 969.771,1143.7 970.129,1143.63L970.183,1143.62ZM971.354,1143.4L971.245,1143.42L971.882,1143.3L971.354,1143.4ZM972.526,1143.18L972.37,1143.21L972.987,1143.09L972.526,1143.18ZM973.7,1142.96L973.496,1143L974.103,1142.89L973.7,1142.96ZM974.876,1142.75L974.624,1142.8L975.225,1142.69L974.876,1142.75ZM976.052,1142.55L975.754,1142.6L976.349,1142.49L976.052,1142.55ZM977.23,1142.34L976.885,1142.4L977.476,1142.3L977.23,1142.34ZM978.41,1142.14L978.019,1142.21L978.605,1142.11L978.41,1142.14ZM979.59,1141.95L979.156,1142.02L979.736,1141.92L979.59,1141.95ZM980.772,1141.76L980.299,1141.83L980.868,1141.74L980.772,1141.76ZM981.955,1141.57L981.464,1141.65L982.002,1141.56L981.955,1141.57ZM983.14,1141.39L983.1,1141.39L983.605,1141.32L983.14,1141.39ZM984.326,1141.21L984.239,1141.22L984.778,1141.14L984.326,1141.21ZM985.513,1141.03L985.379,1141.05L985.928,1140.97L985.513,1141.03ZM986.702,1140.86L986.521,1140.89L987.073,1140.81L986.702,1140.86ZM987.891,1140.69L987.665,1140.73L988.218,1140.65L987.891,1140.69ZM989.082,1140.53L988.811,1140.57L989.363,1140.49L989.082,1140.53ZM990.275,1140.37L989.96,1140.41L990.508,1140.34L990.275,1140.37ZM991.468,1140.22L991.113,1140.26L991.654,1140.19L991.468,1140.22ZM992.663,1140.07L992.273,1140.12L992.8,1140.05L992.663,1140.07ZM993.859,1139.92L993.447,1139.97L993.948,1139.91L993.859,1139.92ZM995.056,1139.78L994.671,1139.82L995.097,1139.77L995.056,1139.78ZM996.255,1139.64L996.23,1139.64L996.578,1139.6L996.255,1139.64ZM997.454,1139.5L997.383,1139.51L997.852,1139.46L997.454,1139.5ZM998.655,1139.37L998.537,1139.38L999.041,1139.33L998.655,1139.37ZM999.857,1139.24L999.693,1139.26L1000.21,1139.21L999.857,1139.24ZM1001.06,1139.12L1000.85,1139.14L1001.38,1139.09L1001.06,1139.12ZM1002.26,1139L1002.01,1139.03L1002.54,1138.98L1002.26,1139ZM1003.47,1138.89L1003.18,1138.91L1003.7,1138.87L1003.47,1138.89ZM1004.68,1138.78L1004.34,1138.81L1004.86,1138.76L1004.68,1138.78ZM1005.89,1138.67L1005.52,1138.7L1006.02,1138.66L1005.89,1138.67ZM1007.1,1138.57L1006.71,1138.6L1007.18,1138.56L1007.1,1138.57ZM1008.31,1138.47L1007.96,1138.5L1008.35,1138.46L1008.31,1138.47ZM1009.52,1138.37L1009.5,1138.38L1009.72,1138.36L1009.52,1138.37ZM1010.73,1138.28L1010.67,1138.29L1011.1,1138.26L1010.73,1138.28ZM1011.94,1138.2L1011.84,1138.2L1012.32,1138.17L1011.94,1138.2ZM1013.16,1138.12L1013,1138.13L1013.51,1138.09L1013.16,1138.12ZM1014.37,1138.04L1014.17,1138.05L1014.69,1138.02L1014.37,1138.04ZM1015.59,1137.96L1015.35,1137.98L1015.86,1137.95L1015.59,1137.96ZM1016.81,1137.89L1016.52,1137.91L1017.04,1137.88L1016.81,1137.89ZM1018.03,1137.83L1017.7,1137.85L1018.21,1137.82L1018.03,1137.83ZM1019.25,1137.77L1018.89,1137.79L1019.39,1137.76L1019.25,1137.77ZM1020.47,1137.71L1020.1,1137.73L1020.56,1137.71L1020.47,1137.71ZM1021.69,1137.66L1021.36,1137.67L1021.74,1137.66L1021.69,1137.66ZM1022.92,1137.61L1022.91,1137.61L1023.02,1137.61L1022.92,1137.61ZM1024.14,1137.57L1024.09,1137.57L1024.49,1137.55L1024.14,1137.57ZM1025.37,1137.52L1025.27,1137.53L1025.74,1137.51L1025.37,1137.52ZM1026.6,1137.49L1026.45,1137.49L1026.94,1137.48L1026.6,1137.49ZM1027.82,1137.46L1027.63,1137.46L1028.14,1137.45L1027.82,1137.46ZM1029.05,1137.43L1028.81,1137.43L1029.33,1137.42L1029.05,1137.43ZM1030.28,1137.41L1030,1137.41L1030.52,1137.4L1030.28,1137.41ZM1031.51,1137.39L1031.19,1137.39L1031.7,1137.38L1031.51,1137.39ZM1032.75,1137.37L1032.39,1137.38L1032.89,1137.37L1032.75,1137.37ZM1033.98,1137.36L1033.61,1137.36L1034.07,1137.36L1033.98,1137.36ZM1035.21,1137.35L1034.87,1137.36L1035.26,1137.35L1035.21,1137.35ZM1050.1,1035.06L867.977,544.575L689.455,1035.06L1050.1,1035.06Z"})})});var Nte=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(Nte||{});const Dte=e=>{const t=(()=>{const{t:e}=HY();return a.exports.useMemo((()=>({0:{text:e("tooltip:feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},1:{text:e("tooltip:feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},2:{text:e("tooltip:feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},3:{text:e("tooltip:feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},4:{text:e("tooltip:feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},5:{text:e("tooltip:feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},6:{text:e("tooltip:feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},7:{text:e("tooltip:feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},8:{text:e("tooltip:feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},9:{text:e("tooltip:feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},10:{text:e("tooltip:feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}})),[e])})();return t[e]},zte=uV((e=>e.options),(e=>({facetoolStrength:e.facetoolStrength,facetoolType:e.facetoolType,codeformerFidelity:e.codeformerFidelity})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),Bte=uV((e=>e.system),(e=>({isGFPGANAvailable:e.isGFPGANAvailable})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),jte=()=>{const e=v5(),{facetoolStrength:t,facetoolType:n,codeformerFidelity:r}=y5(zte),{isGFPGANAvailable:o}=y5(Bte),{t:i}=HY();return cd(CI,{direction:"column",gap:2,children:[ld(L3,{label:i("options:type"),validValues:FQ.concat(),value:n,onChange:t=>e(HU(t.target.value))}),ld(O3,{isDisabled:!o,label:i("options:strength"),step:.05,min:0,max:1,onChange:t=>e(FU(t)),value:t,width:"90px",isInteger:!1}),"codeformer"===n&&ld(O3,{isDisabled:!o,label:i("options:codeformerFidelity"),step:.05,min:0,max:1,onChange:t=>e(BU(t)),value:r,width:"90px",isInteger:!1})]})};function Fte(){const e=y5((e=>e.system.isGFPGANAvailable)),t=y5((e=>e.options.shouldRunFacetool)),n=v5();return ld(E3,{isDisabled:!e,isChecked:t,onChange:e=>n(g$(e.target.checked))})}function Hte(){const e=v5(),t=y5((e=>e.options.shouldFitToWidthHeight)),{t:n}=HY();return ld(E3,{label:n("options:imageFit"),isChecked:t,onChange:t=>e(l$(t.target.checked))})}function Wte(e){const[t,n]=a.exports.useState(!1),{label:r,value:o,min:i=1,max:s=100,step:l=1,onChange:c,width:u="100%",tooltipSuffix:d="",withSliderMarks:h=!1,sliderMarkLeftOffset:f=0,sliderMarkRightOffset:p=-7,withInput:g=!1,isInteger:m=!1,inputWidth:v="5.5rem",inputReadOnly:y=!1,withReset:b=!1,hideTooltip:x=!1,isCompact:w=!1,handleReset:k,isResetDisabled:S,isSliderDisabled:C,isInputDisabled:_,styleClass:E,sliderFormControlProps:L,sliderFormLabelProps:P,sliderMarkProps:O,sliderTrackProps:M,sliderThumbProps:T,sliderNumberInputProps:A,sliderNumberInputFieldProps:I,sliderNumberInputStepperProps:R,sliderTooltipProps:N,sliderIAIIconButtonProps:D,...z}=e,[B,j]=a.exports.useState(String(o));a.exports.useEffect((()=>{j(o)}),[o]);const F=a.exports.useMemo((()=>A?.max?A.max:s),[s,A?.max]);return cd(GT,{className:E?`invokeai__slider-component ${E}`:"invokeai__slider-component","data-markers":h,style:w?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:"1rem",margin:0,padding:0}:{},...L,children:[ld(eA,{className:"invokeai__slider-component-label",...P,children:r}),cd(HI,{w:"100%",gap:2,alignItems:"center",children:[cd(ZF,{"aria-label":r,value:o,min:i,max:s,step:l,onChange:e=>{c(e)},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:C,width:u,...z,children:[h&&cd(sd,{children:[ld(JF,{value:i,className:"invokeai__slider-mark invokeai__slider-mark-start",ml:f,...O,children:i}),ld(JF,{value:s,className:"invokeai__slider-mark invokeai__slider-mark-end",ml:p,...O,children:s})]}),ld(KF,{className:"invokeai__slider_track",...M,children:ld(QF,{className:"invokeai__slider_track-filled"})}),ld(YH,{hasArrow:!0,className:"invokeai__slider-component-tooltip",placement:"top",isOpen:t,label:`${o}${d}`,hidden:x,...N,children:ld(XF,{className:"invokeai__slider-thumb",...T})})]}),g&&cd(fj,{min:i,max:F,step:l,value:B,onChange:e=>{j(e)},onBlur:e=>{""===e.target.value&&(e.target.value=String(i));const t=A$.clamp(m?Math.floor(Number(e.target.value)):Number(B),i,F);c(t)},className:"invokeai__slider-number-field",isDisabled:_,...A,children:[ld(gj,{className:"invokeai__slider-number-input",width:v,readOnly:y,minWidth:v,...I}),cd(pj,{...R,children:[ld(yj,{onClick:()=>c(Number(B)),className:"invokeai__slider-number-stepper"}),ld(vj,{onClick:()=>c(Number(B)),className:"invokeai__slider-number-stepper"})]})]}),b&&ld(S3,{size:"sm","aria-label":"Reset",tooltip:"Reset",icon:ld(T9,{}),onClick:()=>{k&&k()},isDisabled:S,...D})]})]})}function Vte(e){const{t:t}=HY(),{label:n=`${t("options:strength")}`,styleClass:r}=e,o=y5((e=>e.options.img2imgStrength)),i=v5();return ld(Wte,{label:n,step:.01,min:.01,max:.99,onChange:e=>i(UU(e)),value:o,isInteger:!1,styleClass:r,withInput:!0,withSliderMarks:!0,inputWidth:"5.5rem",withReset:!0,handleReset:()=>{i(UU(.75))}})}const Ute=()=>{const e=v5(),t=y5((e=>e.options.seamless)),{t:n}=HY();return ld(CI,{gap:2,direction:"column",children:ld(E3,{label:n("options:seamlessTiling"),fontSize:"md",isChecked:t,onChange:t=>e(n$(t.target.checked))})})},$te=()=>ld(CI,{gap:2,direction:"column",children:ld(Ute,{})});function Gte(){const e=v5(),{t:t}=HY(),n=y5((e=>e.options.shouldRandomizeSeed));return ld(E3,{label:t("options:randomizeSeed"),isChecked:n,onChange:t=>e(f$(t.target.checked))})}function qte(){const e=y5((e=>e.options.seed)),t=y5((e=>e.options.shouldRandomizeSeed)),n=y5((e=>e.options.shouldGenerateVariations)),{t:r}=HY(),o=v5();return ld(O3,{label:r("options:seed"),step:1,precision:0,flexGrow:1,min:0,max:jQ,isDisabled:t,isInvalid:e<0&&n,onChange:e=>o(a$(e)),value:e,width:"auto"})}function Yte(){const e=v5(),t=y5((e=>e.options.shouldRandomizeSeed)),{t:n}=HY();return ld(RT,{size:"sm",isDisabled:t,onClick:()=>e(a$(WQ(0,jQ))),padding:"0 1.5rem",children:ld("p",{children:n("options:shuffle")})})}function Zte(){const e=v5(),t=y5((e=>e.options.threshold)),{t:n}=HY();return ld(O3,{label:n("options:noiseThreshold"),min:0,max:1e3,step:.1,onChange:t=>e(w$(t)),value:t,isInteger:!1})}function Xte(){const e=v5(),t=y5((e=>e.options.perlin)),{t:n}=HY();return ld(O3,{label:n("options:perlinNoise"),min:0,max:1,step:.05,onChange:t=>e(QU(t)),value:t,isInteger:!1})}const Kte=()=>cd(CI,{gap:2,direction:"column",children:[ld(Gte,{}),cd(CI,{gap:2,children:[ld(qte,{}),ld(Yte,{})]}),ld(CI,{gap:2,children:ld(Zte,{})}),ld(CI,{gap:2,children:ld(Xte,{})})]}),Qte=uV((e=>e.options),(e=>({upscalingLevel:e.upscalingLevel,upscalingStrength:e.upscalingStrength})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),Jte=uV((e=>e.system),(e=>({isESRGANAvailable:e.isESRGANAvailable})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),ene=()=>{const e=v5(),{upscalingLevel:t,upscalingStrength:n}=y5(Qte),{isESRGANAvailable:r}=y5(Jte),{t:o}=HY();return cd("div",{className:"upscale-options",children:[ld(L3,{isDisabled:!r,label:o("options:scale"),value:t,onChange:t=>e(S$(Number(t.target.value))),validValues:BQ}),ld(O3,{isDisabled:!r,label:o("options:strength"),step:.05,min:0,max:1,onChange:t=>e(C$(t)),value:n,isInteger:!1})]})};function tne(){const e=y5((e=>e.system.isESRGANAvailable)),t=y5((e=>e.options.shouldRunESRGAN)),n=v5();return ld(E3,{isDisabled:!e,isChecked:t,onChange:e=>n(p$(e.target.checked))})}function nne(){const e=y5((e=>e.options.shouldGenerateVariations)),t=v5();return ld(E3,{isChecked:e,width:"auto",onChange:e=>t(c$(e.target.checked))})}function rne(){const e=y5((e=>e.options.seedWeights)),t=y5((e=>e.options.shouldGenerateVariations)),{t:n}=HY(),r=v5();return ld(V3,{label:n("options:seedWeights"),value:e,isInvalid:t&&!(_U(e)||""===e),isDisabled:!t,onChange:e=>r(s$(e.target.value))})}function one(){const e=y5((e=>e.options.variationAmount)),t=y5((e=>e.options.shouldGenerateVariations)),{t:n}=HY(),r=v5();return ld(O3,{label:n("options:variationAmount"),value:e,step:.01,min:0,max:1,isDisabled:!t,onChange:e=>r(_$(e)),isInteger:!1})}const ine=()=>cd(CI,{gap:2,direction:"column",children:[ld(one,{}),ld(rne,{})]});function ane(){const e=v5(),t=y5((e=>e.options.cfgScale)),{t:n}=HY();return ld(O3,{label:n("options:cfgScale"),step:.5,min:1.01,max:200,onChange:t=>e(zU(t)),value:t,width:"auto",styleClass:"main-option-block",textAlign:"center",isInteger:!1})}function sne(){const e=y5((e=>e.options.height)),t=y5(A3),n=v5(),{t:r}=HY();return ld(L3,{isDisabled:"unifiedCanvas"===t,label:r("options:height"),value:e,flexGrow:1,onChange:e=>n(WU(Number(e.target.value))),validValues:zQ,styleClass:"main-option-block"})}const lne=uV([e=>e.options],(e=>{const{iterations:t}=e;return{iterations:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function cne(){const e=v5(),{iterations:t}=y5(lne),{t:n}=HY();return ld(O3,{label:n("options:images"),step:1,min:1,max:9999,onChange:t=>e(YU(t)),value:t,width:"auto",labelFontSize:.5,styleClass:"main-option-block",textAlign:"center"})}function une(){const e=y5((e=>e.options.sampler)),t=v5(),{t:n}=HY();return ld(L3,{label:n("options:sampler"),value:e,onChange:e=>t(e$(e.target.value)),validValues:NQ,styleClass:"main-option-block"})}function dne(){const e=v5(),t=y5((e=>e.options.steps)),{t:n}=HY();return ld(O3,{label:n("options:steps"),min:1,max:9999,step:1,onChange:t=>e(x$(t)),value:t,width:"auto",styleClass:"main-option-block",textAlign:"center"})}function hne(){const e=y5((e=>e.options.width)),t=y5(A3),{t:n}=HY(),r=v5();return ld(L3,{isDisabled:"unifiedCanvas"===t,label:n("options:width"),value:e,flexGrow:1,onChange:e=>r(E$(Number(e.target.value))),validValues:DQ,styleClass:"main-option-block"})}function fne(){return ld("div",{className:"main-options",children:cd("div",{className:"main-options-list",children:[cd("div",{className:"main-options-row",children:[ld(cne,{}),ld(dne,{}),ld(ane,{})]}),cd("div",{className:"main-options-row",children:[ld(hne,{}),ld(sne,{}),ld(une,{})]})]})})}const pne=uV((e=>e.system),(e=>e.shouldDisplayGuides)),gne=({children:e,feature:t})=>{const n=y5(pne),{text:r}=Dte(t);return n?cd(Aj,{trigger:"hover",children:[ld(Wj,{children:ld(mI,{children:e})}),cd(Fj,{className:"guide-popover-content",maxWidth:"400px",onClick:e=>e.preventDefault(),cursor:"initial",children:[ld(Ij,{className:"guide-popover-arrow"}),ld("div",{className:"guide-popover-guide-content",children:r})]})]}):null},mne=ok((({feature:e,icon:t=G3},n)=>ld(gne,{feature:e,children:ld(mI,{ref:n,children:ld(kk,{marginBottom:"-.15rem",as:t})})})));function vne(e){const{header:t,feature:n,content:r,additionalHeaderComponents:o}=e;return cd(lT,{className:"advanced-settings-item",children:[ld(nT,{className:"advanced-settings-header",children:cd(CI,{width:"100%",gap:"0.5rem",align:"center",children:[ld(mI,{flexGrow:1,textAlign:"left",children:t}),o,n&&ld(mne,{feature:n}),ld(sT,{})]})}),ld(cT,{className:"advanced-settings-panel",children:r})]})}const yne=e=>{const{accordionInfo:t}=e,n=y5((e=>e.system.openAccordions)),r=v5();return ld(uT,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:e=>r(XY(e)),className:"advanced-settings",children:(()=>{const e=[];return t&&Object.keys(t).forEach((n=>{const{header:r,feature:o,content:i,additionalHeaderComponents:a}=t[n];e.push(ld(vne,{header:r,feature:o,content:i,additionalHeaderComponents:a},n))})),e})()})},bne=e=>e.canvas,xne=uV([bne,A3,M3],((e,t,n)=>e.layerState.stagingArea.images.length>0||"unifiedCanvas"===t&&n.isProcessing)),wne=e=>e.canvas.layerState.objects.find(LZ),kne=uV([e=>e.options,e=>e.system,wne,A3],((e,t,n,r)=>{const{prompt:o,shouldGenerateVariations:i,seedWeights:a,initialImage:s,seed:l}=e,{isProcessing:c,isConnected:u}=t;let d=!0;const h=[];return o&&!Boolean(o.match(/^[\s\r\n]+$/))||(d=!1,h.push("Missing prompt")),"img2img"!==r||s||(d=!1,h.push("No initial image selected")),c&&(d=!1,h.push("System Busy")),u||(d=!1,h.push("System Disconnected")),i&&(!_U(a)&&""!==a||-1===l)&&(d=!1,h.push("Seed-Weights badly formatted.")),{isReady:d,reasonsWhyNotReady:h}}),{memoizeOptions:{equalityCheck:A$.isEqual,resultEqualityCheck:A$.isEqual}});function Sne(e){const{iconButton:t=!1,...n}=e,r=v5(),{isReady:o}=y5(kne),i=y5(A3),a=()=>{r(wQ(i))},{t:s}=HY();return Cte(["ctrl+enter","meta+enter"],(()=>{r(wQ(i))}),{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,i]),ld("div",{style:{flexGrow:4},children:t?ld(S3,{"aria-label":s("options:invoke"),type:"submit",icon:ld(a3,{}),isDisabled:!o,onClick:a,className:"invoke-btn",tooltip:s("options:invoke"),tooltipProps:{placement:"bottom"},...n}):ld(j3,{"aria-label":s("options:invoke"),type:"submit",isDisabled:!o,onClick:a,className:"invoke-btn",...n,children:"Invoke"})})}const Cne=uV((e=>e.system),(e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable})),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function _ne(e){const{...t}=e,n=v5(),{isProcessing:r,isConnected:o,isCancelable:i}=y5(Cne),a=()=>n(LQ()),{t:s}=HY();return Cte("shift+x",(()=>{(o||r)&&i&&a()}),[o,r,i]),ld(S3,{icon:ld(K3,{}),tooltip:s("options:cancel"),"aria-label":s("options:cancel"),isDisabled:!o||!r||!i,onClick:a,styleClass:"cancel-btn",...t})}const Ene=uV((e=>e.options),(e=>e.shouldLoopback)),Lne=()=>{const e=v5(),t=y5(Ene),{t:n}=HY();return ld(S3,{"aria-label":n("options:toggleLoopback"),tooltip:n("options:toggleLoopback"),styleClass:"loopback-btn",asCheckbox:!0,isChecked:t,icon:ld(c3,{}),onClick:()=>{e(d$(!t))}})},Pne=()=>{const e=y5(A3);return cd("div",{className:"process-buttons",children:[ld(Sne,{}),"img2img"===e&&ld(Lne,{}),ld(_ne,{})]})},One=uV([e=>e.options,A3],((e,t)=>({prompt:e.prompt,activeTabName:t})),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Mne=()=>{const e=v5(),{prompt:t,activeTabName:n}=y5(One),{isReady:r}=y5(kne),o=a.exports.useRef(null),{t:i}=HY();Cte("alt+a",(()=>{o.current?.focus()}),[]);return ld("div",{className:"prompt-bar",children:ld(GT,{isInvalid:0===t.length||Boolean(t.match(/^[\s\r\n]+$/)),children:ld(_H,{id:"prompt",name:"prompt",placeholder:i("options:promptPlaceholder"),size:"lg",value:t,onChange:t=>{e(JU(t.target.value))},onKeyDown:t=>{"Enter"===t.key&&!1===t.shiftKey&&r&&(t.preventDefault(),e(wQ(n)))},resize:"vertical",height:30,ref:o,_placeholder:{color:"var(--text-color-secondary)"}})})})};function Tne(e){return E5({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function Ane(e){return E5({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function Ine(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const Rne=!1,Nne=H.createContext(null);var Dne=function(e){return e.scrollTop},zne="unmounted",Bne="exited",jne="entering",Fne="entered",Hne="exiting",Wne=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,i=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?i?(o=Bne,r.appearStatus=jne):o=Fne:o=t.unmountOnExit||t.mountOnEnter?zne:Bne,r.state={status:o},r.nextCallback=null,r}DD(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===zne?{status:Bne}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==jne&&n!==Fne&&(t=jne):n!==jne&&n!==Fne||(t=Hne)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===jne){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:Zu.findDOMNode(this);n&&Dne(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Bne&&this.setState({status:zne})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[Zu.findDOMNode(this),r],i=o[0],a=o[1],s=this.getTimeouts(),l=r?s.appear:s.enter;!e&&!n||Rne?this.safeSetState({status:Fne},(function(){t.props.onEntered(i)})):(this.props.onEnter(i,a),this.safeSetState({status:jne},(function(){t.props.onEntering(i,a),t.onTransitionEnd(l,(function(){t.safeSetState({status:Fne},(function(){t.props.onEntered(i,a)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:Zu.findDOMNode(this);t&&!Rne?(this.props.onExit(r),this.safeSetState({status:Hne},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:Bne},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:Bne},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Zu.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],i=o[0],a=o[1];this.props.addEndListener(i,a)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===zne)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=gD(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return ld(Nne.Provider,{value:null,children:"function"==typeof n?n(e,r):H.cloneElement(H.Children.only(n),r)})},t}(H.Component);function Vne(){}Wne.contextType=Nne,Wne.propTypes={},Wne.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Vne,onEntering:Vne,onEntered:Vne,onExit:Vne,onExiting:Vne,onExited:Vne},Wne.UNMOUNTED=zne,Wne.EXITED=Bne,Wne.ENTERING=jne,Wne.ENTERED=Fne,Wne.EXITING=Hne;const Une=Wne;var $ne=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r}))},Gne=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=Ine(n.className,r):n.setAttribute("class",Ine(n.className&&n.className.baseVal||"",r)));var n,r}))},qne=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;oe.options),(e=>{const{shouldShowOptionsPanel:t,shouldHoldOptionsPanelOpen:n,shouldPinOptionsPanel:r,optionsPanelScrollPosition:o}=e;return{shouldShowOptionsPanel:t,shouldHoldOptionsPanelOpen:n,shouldPinOptionsPanel:r,optionsPanelScrollPosition:o}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Xne=e=>{const t=v5(),{shouldShowOptionsPanel:n,shouldHoldOptionsPanelOpen:r,shouldPinOptionsPanel:o}=y5(Zne),i=a.exports.useRef(null),s=a.exports.useRef(null),l=a.exports.useRef(null),{children:c}=e;Cte("o",(()=>{t(v$(!n)),o&&setTimeout((()=>t(aX(!0))),400)}),[n,o]),Cte("esc",(()=>{t(v$(!1))}),{enabled:()=>!o,preventDefault:!0},[o]),Cte("shift+o",(()=>{h(),t(aX(!0))}),[o]);const u=a.exports.useCallback((()=>{o||(t(XU(s.current?s.current.scrollTop:0)),t(v$(!1)),t(u$(!1)))}),[t,o]),d=()=>{l.current&&window.clearTimeout(l.current)},h=()=>{t(h$(!o)),t(aX(!0))};return a.exports.useEffect((()=>{function e(e){i.current&&!i.current.contains(e.target)&&u()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[u]),ld(Yne,{nodeRef:i,in:n||r&&!o,unmountOnExit:!0,timeout:200,classNames:"options-panel-wrapper",children:ld("div",{className:"options-panel-wrapper","data-pinned":o,tabIndex:1,ref:i,onMouseEnter:o?void 0:d,onMouseOver:o?void 0:d,style:{borderRight:o?"":"0.3rem solid var(--tab-list-text-inactive)"},children:ld("div",{className:"options-panel-margin",children:cd("div",{className:"options-panel",ref:s,onMouseLeave:e=>{e.target!==s.current?d():!o&&(l.current=window.setTimeout((()=>u()),500))},children:[ld(YH,{label:"Pin Options Panel",children:ld("div",{className:"options-panel-pin-button","data-selected":o,onClick:h,children:ld(o?Tne:Ane,{})})}),!o&&cd("div",{className:"invoke-ai-logo-wrapper",children:[ld("img",{src:k3,alt:"invoke-ai-logo"}),cd("h1",{children:["invoke ",ld("strong",{children:"ai"})]})]}),c]})})})})};function Kne(){const{t:e}=HY(),t={seed:{header:`${e("options:seed")}`,feature:Nte.SEED,content:ld(Kte,{})},variations:{header:`${e("options:variations")}`,feature:Nte.VARIATIONS,content:ld(ine,{}),additionalHeaderComponents:ld(nne,{})},face_restore:{header:`${e("options:faceRestoration")}`,feature:Nte.FACE_CORRECTION,content:ld(jte,{}),additionalHeaderComponents:ld(Fte,{})},upscale:{header:`${e("options:upscaling")}`,feature:Nte.UPSCALE,content:ld(ene,{}),additionalHeaderComponents:ld(tne,{})},other:{header:`${e("options:otherOptions")}`,feature:Nte.OTHER,content:ld($te,{})}},n=v5(),r=y5(A3);return a.exports.useEffect((()=>{if("img2img"===r){(()=>n(VU(!1)))()}}),[r,n]),cd(Xne,{children:[ld(Mne,{}),ld(Pne,{}),ld(fne,{}),ld(Vte,{label:e("options:img2imgStrength"),styleClass:"main-option-block image-to-image-strength-main-option"}),ld(Hte,{}),ld(yne,{accordionInfo:t})]})}const Qne=a.exports.createContext(null),Jne=e=>{const{styleClass:t}=e,n=a.exports.useContext(Qne);return ld("div",{className:`image-uploader-button-outer ${t}`,onClick:()=>{n&&n()},children:cd("div",{className:"image-upload-button",children:[ld(b3,{}),ld(PI,{size:"lg",children:"Click or Drag and Drop"})]})})},ere=uV((e=>e.system),(e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),tre=a.exports.forwardRef((({image:e,children:t},n)=>{const{isOpen:r,onOpen:o,onClose:i}=QA(),s=v5(),{shouldConfirmOnDelete:l,isConnected:c,isProcessing:u}=y5(ere),d=a.exports.useRef(null),h=()=>{c&&!u&&e&&s(CQ(e)),i()};Cte("delete",(()=>{l?o():h()}),[e,l]);return cd(sd,{children:[a.exports.cloneElement(t,{onClick:e?e=>{e.stopPropagation(),l?o():h()}:void 0,ref:n}),ld(qB,{isOpen:r,leastDestructiveRef:d,onClose:i,children:ld(GB,{children:cd(YB,{className:"modal",children:[ld(UB,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),ld(NB,{children:cd(CI,{direction:"column",gap:5,children:[ld(VI,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),ld(GT,{children:cd(CI,{alignItems:"center",children:[ld(eA,{mb:0,children:"Don't ask me again"}),ld(nH,{checked:!l,onChange:e=>s(ZY(!e.target.checked))})]})})]})}),cd(VB,{children:[ld(RT,{ref:d,onClick:i,className:"modal-close-btn",children:"Cancel"}),ld(RT,{colorScheme:"red",onClick:h,ml:3,children:"Delete"})]})]})})})]})})),nre=uV([e=>e.system,e=>e.options,e=>e.gallery,A3],((e,t,n,r)=>{const{isProcessing:o,isConnected:i,isGFPGANAvailable:a,isESRGANAvailable:s}=e,{upscalingLevel:l,facetoolStrength:c,shouldShowImageDetails:u,isLightBoxOpen:d}=t,{intermediateImage:h,currentImage:f}=n;return{isProcessing:o,isConnected:i,isGFPGANAvailable:a,isESRGANAvailable:s,upscalingLevel:l,facetoolStrength:c,shouldDisableToolbarButtons:Boolean(h)||!f,currentImage:f,shouldShowImageDetails:u,activeTabName:r,isLightBoxOpen:d}}),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),rre=()=>{const e=v5(),{isProcessing:t,isConnected:n,isGFPGANAvailable:r,isESRGANAvailable:o,upscalingLevel:i,facetoolStrength:a,shouldDisableToolbarButtons:s,shouldShowImageDetails:l,currentImage:c,isLightBoxOpen:u,activeTabName:d}=y5(nre),h=zH(),{t:f}=HY(),p=()=>{c&&(u&&e(qU(!1)),e(GU(c)),e(IU("img2img")))};Cte("shift+i",(()=>{c?(p(),h({title:f("toast:sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:imageNotLoaded"),description:f("toast:imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const g=()=>{c&&(c.metadata&&e(NU(c.metadata)),"img2img"===c.metadata?.image.type?e(IU("img2img")):"txt2img"===c.metadata?.image.type&&e(IU("txt2img")))};Cte("a",(()=>{["txt2img","img2img"].includes(c?.metadata?.image?.type)?(g(),h({title:f("toast:parametersSet"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:parametersNotSet"),description:f("toast:parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const m=()=>{c?.metadata&&e(a$(c.metadata.image.seed))};Cte("s",(()=>{c?.metadata?.image?.seed?(m(),h({title:f("toast:seedSet"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:seedNotSet"),description:f("toast:seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const v=()=>c?.metadata?.image?.prompt&&e(JU(c.metadata.image.prompt));Cte("p",(()=>{c?.metadata?.image?.prompt?(v(),h({title:f("toast:promptSet"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:promptNotSet"),description:f("toast:promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const y=()=>{c&&e(kQ(c))};Cte("Shift+U",(()=>{o&&!s&&n&&!t&&i?y():h({title:f("toast:upscalingFailed"),status:"error",duration:2500,isClosable:!0})}),[c,o,s,n,t,i]);const b=()=>{c&&e(SQ(c))};Cte("Shift+R",(()=>{r&&!s&&n&&!t&&a?b():h({title:f("toast:faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})}),[c,r,s,n,t,a]);const x=()=>e(m$(!l));Cte("i",(()=>{c?x():h({title:f("toast:metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})}),[c,l]);return cd("div",{className:"current-image-options",children:[cd(DT,{isAttached:!0,children:[ld(B3,{trigger:"hover",triggerComponent:ld(S3,{"aria-label":`${f("options:sendTo")}...`,icon:ld(f3,{})}),children:cd("div",{className:"current-image-send-to-popover",children:[ld(j3,{size:"sm",onClick:p,leftIcon:ld(p3,{}),children:f("options:sendToImg2Img")}),ld(j3,{size:"sm",onClick:()=>{c&&(u&&e(qU(!1)),e(sX(c)),e(aX(!0)),"unifiedCanvas"!==d&&e(IU("unifiedCanvas")),h({title:f("toast:sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))},leftIcon:ld(p3,{}),children:f("options:sendToUnifiedCanvas")}),ld(j3,{size:"sm",onClick:()=>{navigator.clipboard.writeText(c?window.location.toString()+c.url:"").then((()=>{h({title:f("toast:imageLinkCopied"),status:"success",duration:2500,isClosable:!0})}))},leftIcon:ld(F5,{}),children:f("options:copyImageToLink")}),ld(j3,{leftIcon:ld(V5,{}),size:"sm",children:ld(MI,{download:!0,href:c?.url,children:f("options:downloadImage")})})]})}),ld(S3,{icon:ld(G5,{}),tooltip:u?`${f("options:closeViewer")} (Z)`:`${f("options:openInViewer")} (Z)`,"aria-label":u?`${f("options:closeViewer")} (Z)`:`${f("options:openInViewer")} (Z)`,"data-selected":u,onClick:()=>{e(qU(!u))}})]}),cd(DT,{isAttached:!0,children:[ld(S3,{icon:ld(l3,{}),tooltip:`${f("options:usePrompt")} (P)`,"aria-label":`${f("options:usePrompt")} (P)`,isDisabled:!c?.metadata?.image?.prompt,onClick:v}),ld(S3,{icon:ld(h3,{}),tooltip:`${f("options:useSeed")} (S)`,"aria-label":`${f("options:useSeed")} (S)`,isDisabled:!c?.metadata?.image?.seed,onClick:m}),ld(S3,{icon:ld(D5,{}),tooltip:`${f("options:useAll")} (A)`,"aria-label":`${f("options:useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes(c?.metadata?.image?.type),onClick:g})]}),cd(DT,{isAttached:!0,children:[ld(B3,{trigger:"hover",triggerComponent:ld(S3,{icon:ld(K5,{}),"aria-label":f("options:restoreFaces")}),children:cd("div",{className:"current-image-postprocessing-popover",children:[ld(jte,{}),ld(j3,{isDisabled:!(r&&c&&n&&!t&&a),onClick:b,children:f("options:restoreFaces")})]})}),ld(B3,{trigger:"hover",triggerComponent:ld(S3,{icon:ld($5,{}),"aria-label":f("options:upscale")}),children:cd("div",{className:"current-image-postprocessing-popover",children:[ld(ene,{}),ld(j3,{isDisabled:!(o&&c&&n&&!t&&i),onClick:y,children:f("options:upscaleImage")})]})})]}),ld(DT,{isAttached:!0,children:ld(S3,{icon:ld(j5,{}),tooltip:`${f("options:info")} (I)`,"aria-label":`${f("options:info")} (I)`,"data-selected":l,onClick:x})}),ld(tre,{image:c,children:ld(S3,{icon:ld(v3,{}),tooltip:`${f("options:deleteImage")} (Del)`,"aria-label":`${f("options:deleteImage")} (Del)`,isDisabled:!c||!n||t,style:{backgroundColor:"var(--btn-delete-image)"}})})]})};function ore(e){return E5({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const ire=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:i=!1})=>cd(CI,{gap:2,children:[n&&ld(YH,{label:`Recall ${e}`,children:ld(zT,{"aria-label":"Use this parameter",icon:ld(ore,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),i&&ld(YH,{label:`Copy ${e}`,children:ld(zT,{"aria-label":`Copy ${e}`,icon:ld(F5,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),cd(CI,{direction:o?"column":"row",children:[cd(VI,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?cd(MI,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",ld(q9,{mx:"2px"})]}):ld(VI,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}),are=a.exports.memo((({image:e,styleClass:t})=>{const n=v5();Cte("esc",(()=>{n(m$(!1))}));const r=e?.metadata?.image||{},o=e?.dreamPrompt,{cfg_scale:i,fit:a,height:s,hires_fix:l,init_image_path:c,mask_image_path:u,orig_path:d,perlin:h,postprocessing:f,prompt:p,sampler:g,scale:m,seamless:v,seed:y,steps:b,strength:x,threshold:w,type:k,variations:S,width:C}=r,_=JSON.stringify(e.metadata,null,2);return ld("div",{className:`image-metadata-viewer ${t}`,children:cd(CI,{gap:1,direction:"column",width:"100%",children:[cd(CI,{gap:2,children:[ld(VI,{fontWeight:"semibold",children:"File:"}),cd(MI,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,ld(q9,{mx:"2px"})]})]}),Object.keys(r).length>0?cd(sd,{children:[k&&ld(ire,{label:"Generation type",value:k}),e.metadata?.model_weights&&ld(ire,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(k)&&ld(ire,{label:"Original image",value:d}),"gfpgan"===k&&void 0!==x&&ld(ire,{label:"Fix faces strength",value:x,onClick:()=>n(FU(x))}),"esrgan"===k&&void 0!==m&&ld(ire,{label:"Upscaling scale",value:m,onClick:()=>n(S$(m))}),"esrgan"===k&&void 0!==x&&ld(ire,{label:"Upscaling strength",value:x,onClick:()=>n(C$(x))}),p&&ld(ire,{label:"Prompt",labelPosition:"top",value:CU(p),onClick:()=>n(JU(p))}),void 0!==y&&ld(ire,{label:"Seed",value:y,onClick:()=>n(a$(y))}),void 0!==w&&ld(ire,{label:"Noise Threshold",value:w,onClick:()=>n(w$(w))}),void 0!==h&&ld(ire,{label:"Perlin Noise",value:h,onClick:()=>n(QU(h))}),g&&ld(ire,{label:"Sampler",value:g,onClick:()=>n(e$(g))}),b&&ld(ire,{label:"Steps",value:b,onClick:()=>n(x$(b))}),void 0!==i&&ld(ire,{label:"CFG scale",value:i,onClick:()=>n(zU(i))}),S&&S.length>0&&ld(ire,{label:"Seed-weight pairs",value:EU(S),onClick:()=>n(s$(EU(S)))}),v&&ld(ire,{label:"Seamless",value:v,onClick:()=>n(n$(v))}),l&&ld(ire,{label:"High Resolution Optimization",value:l,onClick:()=>n(VU(l))}),C&&ld(ire,{label:"Width",value:C,onClick:()=>n(E$(C))}),s&&ld(ire,{label:"Height",value:s,onClick:()=>n(WU(s))}),c&&ld(ire,{label:"Initial image",value:c,isLink:!0,onClick:()=>n(GU(c))}),u&&ld(ire,{label:"Mask image",value:u,isLink:!0,onClick:()=>n(ZU(u))}),"img2img"===k&&x&&ld(ire,{label:"Image to image strength",value:x,onClick:()=>n(UU(x))}),a&&ld(ire,{label:"Image to image fit",value:a,onClick:()=>n(l$(a))}),f&&f.length>0&&cd(sd,{children:[ld(PI,{size:"sm",children:"Postprocessing"}),f.map(((e,t)=>{if("esrgan"===e.type){const{scale:r,strength:o}=e;return cd(CI,{pl:"2rem",gap:1,direction:"column",children:[ld(VI,{size:"md",children:`${t+1}: Upscale (ESRGAN)`}),ld(ire,{label:"Scale",value:r,onClick:()=>n(S$(r))}),ld(ire,{label:"Strength",value:o,onClick:()=>n(C$(o))})]},t)}if("gfpgan"===e.type){const{strength:r}=e;return cd(CI,{pl:"2rem",gap:1,direction:"column",children:[ld(VI,{size:"md",children:`${t+1}: Face restoration (GFPGAN)`}),ld(ire,{label:"Strength",value:r,onClick:()=>{n(FU(r)),n(HU("gfpgan"))}})]},t)}if("codeformer"===e.type){const{strength:r,fidelity:o}=e;return cd(CI,{pl:"2rem",gap:1,direction:"column",children:[ld(VI,{size:"md",children:`${t+1}: Face restoration (Codeformer)`}),ld(ire,{label:"Strength",value:r,onClick:()=>{n(FU(r)),n(HU("codeformer"))}}),o&&ld(ire,{label:"Fidelity",value:o,onClick:()=>{n(BU(o)),n(HU("codeformer"))}})]},t)}}))]}),o&&ld(ire,{withCopy:!0,label:"Dream Prompt",value:o}),cd(CI,{gap:2,direction:"column",children:[cd(CI,{gap:2,children:[ld(YH,{label:"Copy metadata JSON",children:ld(zT,{"aria-label":"Copy metadata JSON",icon:ld(F5,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(_)})}),ld(VI,{fontWeight:"semibold",children:"Metadata JSON:"})]}),ld("div",{className:"image-json-viewer",children:ld("pre",{children:_})})]})]}):ld(bI,{width:"100%",pt:10,children:ld(VI,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})}),((e,t)=>e.image.uuid===t.image.uuid)),sre=uV([e=>e.gallery,e=>e.options],((e,t)=>{const{currentCategory:n,currentImage:r,intermediateImage:o}=e,{shouldShowImageDetails:i}=t,a=e.categories[r?r.category:"result"].images,s=a.findIndex((t=>t.uuid===e?.currentImage?.uuid)),l=a.length;return{imageToDisplay:o||r,isIntermediate:Boolean(o),viewerImageToDisplay:r,currentCategory:n,isOnFirstImage:0===s,isOnLastImage:!isNaN(s)&&s===l-1,shouldShowImageDetails:i,shouldShowPrevImageButton:0===s,shouldShowNextImageButton:!isNaN(s)&&s===l-1}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function lre(){const e=v5(),{isOnFirstImage:t,isOnLastImage:n,shouldShowImageDetails:r,imageToDisplay:o,isIntermediate:i}=y5(sre),[s,l]=a.exports.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)};return cd("div",{className:"current-image-preview",children:[o&&ld(ET,{src:o.url,width:o.width,height:o.height,style:{imageRendering:i?"pixelated":"initial"}}),!r&&cd("div",{className:"current-image-next-prev-buttons",children:[ld("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!t&&ld(zT,{"aria-label":"Previous image",icon:ld(T5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(H$())}})}),ld("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!n&&ld(zT,{"aria-label":"Next image",icon:ld(A5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(F$())}})})]}),r&&o&&ld(are,{image:o,styleClass:"current-image-metadata"})]})}const cre=uV([e=>e.gallery,e=>e.options,A3],((e,t,n)=>{const{currentImage:r,intermediateImage:o}=e,{shouldShowImageDetails:i}=t;return{activeTabName:n,shouldShowImageDetails:i,hasAnImageToDisplay:r||o}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),ure=()=>{const{hasAnImageToDisplay:e,activeTabName:t}=y5(cre);return ld("div",{className:"current-image-area","data-tab-name":t,children:e?cd(sd,{children:[ld(rre,{}),ld(lre,{})]}):ld("div",{className:"current-image-display-placeholder",children:ld(X3,{})})})},dre=()=>{const e=a.exports.useContext(Qne);return ld(S3,{"aria-label":"Upload Image",tooltip:"Upload Image",icon:ld(b3,{}),onClick:e||void 0})};function hre(){const e=y5((e=>e.options.initialImage)),{t:t}=HY(),n=v5(),r=zH();return cd(sd,{children:[cd("div",{className:"init-image-preview-header",children:[ld("h2",{children:t("options:initialImage")}),ld(dre,{})]}),e&&ld("div",{className:"init-image-preview",children:ld(ET,{fit:"contain",maxWidth:"100%",maxHeight:"100%",src:"string"==typeof e?e:e.url,onError:()=>{r({title:t("toast:parametersFailed"),description:t("toast:parametersFailedDesc"),status:"error",isClosable:!0}),n(MU())}})})]})}const fre=()=>{const e=y5((e=>e.options.initialImage)),{currentImage:t}=y5((e=>e.gallery));return cd("div",{className:"workarea-split-view",children:[ld("div",{className:"workarea-split-view-left",children:e?ld("div",{className:"image-to-image-area",children:ld(hre,{})}):ld(Jne,{})}),t&&ld("div",{className:"workarea-split-view-right",children:ld(ure,{})})]})};function pre(e){return E5({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14 1H3L2 2v11l1 1h11l1-1V2l-1-1zM8 13H3V2h5v11zm6 0H9V2h5v11z"}}]})(e)}function gre(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function mre(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>a.exports.createContext(e)));return function(n){const r=(null==n?void 0:n[e])||t;return a.exports.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=a.exports.createContext(r),i=n.length;function s(t){const{scope:n,children:r,...s}=t,l=(null==n?void 0:n[e][i])||o,c=a.exports.useMemo((()=>s),Object.values(s));return a.exports.createElement(l.Provider,{value:c},r)}return n=[...n,r],s.displayName=t+"Provider",[s,function(n,s){const l=(null==s?void 0:s[e][i])||o,c=a.exports.useContext(l);if(c)return c;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},vre(r,...t)]}function vre(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return a.exports.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function yre(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function bre(...e){return a.exports.useCallback(yre(...e),e)}const xre=a.exports.forwardRef(((e,t)=>{const{children:n,...r}=e,o=a.exports.Children.toArray(n),i=o.find(Sre);if(i){const e=i.props.children,n=o.map((t=>t===i?a.exports.Children.count(e)>1?a.exports.Children.only(null):a.exports.isValidElement(e)?e.props.children:null:t));return a.exports.createElement(wre,vp({},r,{ref:t}),a.exports.isValidElement(e)?a.exports.cloneElement(e,void 0,n):null)}return a.exports.createElement(wre,vp({},r,{ref:t}),n)}));xre.displayName="Slot";const wre=a.exports.forwardRef(((e,t)=>{const{children:n,...r}=e;return a.exports.isValidElement(n)?a.exports.cloneElement(n,{...Cre(r,n.props),ref:yre(t,n.ref)}):a.exports.Children.count(n)>1?a.exports.Children.only(null):null}));wre.displayName="SlotClone";const kre=({children:e})=>a.exports.createElement(a.exports.Fragment,null,e);function Sre(e){return a.exports.isValidElement(e)&&e.type===kre}function Cre(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const _re=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=a.exports.forwardRef(((e,n)=>{const{asChild:r,...o}=e,i=r?xre:t;return a.exports.useEffect((()=>{window[Symbol.for("radix-ui")]=!0}),[]),a.exports.createElement(i,vp({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});function Ere(e,t){e&&U.exports.flushSync((()=>e.dispatchEvent(t)))}function Lre(e){const t=e+"CollectionProvider",[n,r]=mre(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=e+"CollectionSlot",s=e+"CollectionItemSlot",l="data-radix-collection-item";return[{Provider:e=>{const{scope:t,children:n}=e,r=H.useRef(null),i=H.useRef(new Map).current;return H.createElement(o,{scope:t,itemMap:i,collectionRef:r},n)},Slot:H.forwardRef(((e,t)=>{const{scope:n,children:r}=e,o=bre(t,i(a,n).collectionRef);return H.createElement(xre,{ref:o},r)})),ItemSlot:H.forwardRef(((e,t)=>{const{scope:n,children:r,...o}=e,a=H.useRef(null),c=bre(t,a),u=i(s,n);return H.useEffect((()=>(u.itemMap.set(a,{ref:a,...o}),()=>{u.itemMap.delete(a)}))),H.createElement(xre,{[l]:"",ref:c},r)}))},function(t){const n=i(e+"CollectionConsumer",t),r=H.useCallback((()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${l}]`)),r=Array.from(n.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)));return r}),[n.collectionRef,n.itemMap]);return r},r]}const Pre=a.exports.createContext(void 0);function Ore(e){const t=a.exports.useContext(Pre);return e||t||"ltr"}function Mre(e){const t=a.exports.useRef(e);return a.exports.useEffect((()=>{t.current=e})),a.exports.useMemo((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}const Tre="dismissableLayer.update",Are="dismissableLayer.pointerDownOutside",Ire="dismissableLayer.focusOutside";let Rre;const Nre=a.exports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dre=a.exports.forwardRef(((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=a.exports.useContext(Nre),[h,f]=a.exports.useState(null),p=null!==(n=null==h?void 0:h.ownerDocument)&&void 0!==n?n:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,g]=a.exports.useState({}),m=bre(t,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=h?v.indexOf(h):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,k=x>=b,S=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=Mre(e),r=a.exports.useRef(!1),o=a.exports.useRef((()=>{}));return a.exports.useEffect((()=>{const e=e=>{if(e.target&&!r.current){const i={originalEvent:e};function a(){Bre(Are,n,i,{discrete:!0})}"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=a,t.addEventListener("click",o.current,{once:!0})):a()}r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));k&&!n&&(null==i||i(e),null==l||l(e),e.defaultPrevented||null==c||c())}),p),C=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=Mre(e),r=a.exports.useRef(!1);return a.exports.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Bre(Ire,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(null==s||s(e),null==l||l(e),e.defaultPrevented||null==c||c())}),p);return function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=Mre(e);a.exports.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)}),[n,t])}((e=>{x===d.layers.size-1&&(null==o||o(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),p),a.exports.useEffect((()=>{if(h)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Rre=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),zre(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Rre)}}),[h,p,r,d]),a.exports.useEffect((()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),zre())}),[h,d]),a.exports.useEffect((()=>{const e=()=>g({});return document.addEventListener(Tre,e),()=>document.removeEventListener(Tre,e)}),[]),a.exports.createElement(_re.div,vp({},u,{ref:m,style:{pointerEvents:w?k?"auto":"none":void 0,...e.style},onFocusCapture:gre(e.onFocusCapture,C.onFocusCapture),onBlurCapture:gre(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:gre(e.onPointerDownCapture,S.onPointerDownCapture)}))}));function zre(){const e=new CustomEvent(Tre);document.dispatchEvent(e)}function Bre(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ere(o,i):o.dispatchEvent(i)}let jre=0;function Fre(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}const Hre="focusScope.autoFocusOnMount",Wre="focusScope.autoFocusOnUnmount",Vre={bubbles:!1,cancelable:!0},Ure=a.exports.forwardRef(((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[l,c]=a.exports.useState(null),u=Mre(o),d=Mre(i),h=a.exports.useRef(null),f=bre(t,(e=>c(e))),p=a.exports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.exports.useEffect((()=>{if(r){function e(e){if(p.paused||!l)return;const t=e.target;l.contains(t)?h.current=t:Yre(h.current,{select:!0})}function t(e){!p.paused&&l&&(l.contains(e.relatedTarget)||Yre(h.current,{select:!0}))}return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t)}}}),[r,l,p.paused]),a.exports.useEffect((()=>{if(l){Zre.add(p);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(Hre,Vre);l.addEventListener(Hre,u),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Yre(r,{select:t}),document.activeElement!==n)return}((e=$re(l),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Yre(l))}return()=>{l.removeEventListener(Hre,u),setTimeout((()=>{const e=new CustomEvent(Wre,Vre);l.addEventListener(Wre,d),l.dispatchEvent(e),e.defaultPrevented||Yre(null!=t?t:document.body,{select:!0}),l.removeEventListener(Wre,d),Zre.remove(p)}),0)}}var e}),[l,u,d,p]);const g=a.exports.useCallback((e=>{if(!n&&!r)return;if(p.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,i]=function(e){const t=$re(e),n=Gre(t,e),r=Gre(t.reverse(),e);return[n,r]}(t);r&&i?e.shiftKey||o!==i?e.shiftKey&&o===r&&(e.preventDefault(),n&&Yre(i,{select:!0})):(e.preventDefault(),n&&Yre(r,{select:!0})):o===t&&e.preventDefault()}}),[n,r,p.paused]);return a.exports.createElement(_re.div,vp({tabIndex:-1},s,{ref:f,onKeyDown:g}))}));function $re(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gre(e,t){for(const n of e)if(!qre(n,{upTo:t}))return n}function qre(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Yre(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const Zre=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=Xre(e,t),e.unshift(t)},remove(t){var n;e=Xre(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function Xre(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const Kre=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?a.exports.useLayoutEffect:()=>{},Qre=W["useId".toString()]||(()=>{});let Jre=0;function eoe(e){return e.split("-")[0]}function toe(e){return e.split("-")[1]}function noe(e){return["top","bottom"].includes(eoe(e))?"x":"y"}function roe(e){return"y"===e?"height":"width"}function ooe(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,s=noe(t),l=roe(s),c=r[l]/2-o[l]/2,u="x"===s;let d;switch(eoe(t)){case"top":d={x:i,y:r.y-o.height};break;case"bottom":d={x:i,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:a};break;case"left":d={x:r.x-o.width,y:a};break;default:d={x:r.x,y:r.y}}switch(toe(t)){case"start":d[s]-=c*(n&&u?-1:1);break;case"end":d[s]+=c*(n&&u?-1:1)}return d}function ioe(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function aoe(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function soe(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=t,p=ioe(f),g=s[h?"floating"===d?"reference":"floating":d],m=aoe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v=aoe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===d?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),strategy:l}):a[d]);return{top:m.top-v.top+p.top,bottom:v.bottom-m.bottom+p.bottom,left:m.left-v.left+p.left,right:v.right-m.right+p.right}}const loe=Math.min,coe=Math.max;function uoe(e,t,n){return coe(e,loe(t,n))}const doe=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:s,platform:l}=t;if(null==n)return{};const c=ioe(r),u={x:o,y:i},d=noe(a),h=toe(a),f=roe(d),p=await l.getDimensions(n),g="y"===d?"top":"left",m="y"===d?"bottom":"right",v=s.reference[f]+s.reference[d]-u[d]-s.floating[f],y=u[d]-s.reference[d],b=await(null==l.getOffsetParent?void 0:l.getOffsetParent(n));let x=b?"y"===d?b.clientHeight||0:b.clientWidth||0:0;0===x&&(x=s.floating[f]);const w=v/2-y/2,k=c[g],S=x-p[f]-c[m],C=x/2-p[f]/2+w,_=uoe(k,C,S),E=("start"===h?c[g]:c[m])>0&&C!==_&&s.reference[f]<=s.floating[f];return{[d]:u[d]-(E?Choe[e]))}const poe={start:"end",end:"start"};function goe(e){return e.replace(/start|end/g,(e=>poe[e]))}const moe=["top","right","bottom","left"];const voe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",flipAlignment:f=!0,...p}=e,g=eoe(r),m=d||(g===a||!f?[foe(a)]:function(e){const t=foe(e);return[goe(e),t,goe(t)]}(a)),v=[a,...m],y=await soe(t,p),b=[];let x=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&b.push(y[g]),u){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=toe(e),o=noe(e),i=roe(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=foe(a)),{main:a,cross:foe(a)}}(r,i,await(null==s.isRTL?void 0:s.isRTL(l.floating)));b.push(y[e],y[t])}if(x=[...x,{placement:r,overflows:b}],!b.every((e=>e<=0))){var w,k;const e=(null!=(w=null==(k=o.flip)?void 0:k.index)?w:0)+1,t=v[e];if(t)return{data:{index:e,overflows:x},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var S;const e=null==(S=x.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:S[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};function yoe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function boe(e){return moe.some((t=>e[t]>=0))}const xoe=function(e){let{strategy:t="referenceHidden",...n}=void 0===e?{}:e;return{name:"hide",async fn(e){const{rects:r}=e;switch(t){case"referenceHidden":{const t=yoe(await soe(e,{...n,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:boe(t)}}}case"escaped":{const t=yoe(await soe(e,{...n,altBoundary:!0}),r.floating);return{data:{escapedOffsets:t,escaped:boe(t)}}}default:return{}}}}};const woe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=eoe(n),s=toe(n),l="x"===noe(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d="function"==typeof t?t(e):t;let{mainAxis:h,crossAxis:f,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(f="end"===s?-1*p:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function koe(e){return"x"===e?"y":"x"}const Soe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=e,c={x:n,y:r},u=await soe(t,l),d=noe(eoe(o)),h=koe(d);let f=c[d],p=c[h];if(i){const e="y"===d?"bottom":"right";f=uoe(f+u["y"===d?"top":"left"],f,f-u[e])}if(a){const e="y"===h?"bottom":"right";p=uoe(p+u["y"===h?"top":"left"],p,p-u[e])}const g=s.fn({...t,[d]:f,[h]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Coe=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=e,u={x:n,y:r},d=noe(o),h=koe(d);let f=u[d],p=u[h];const g="function"==typeof s?s({...i,placement:o}):s,m="number"==typeof g?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+m.mainAxis,n=i.reference[d]+i.reference[e]-m.mainAxis;fn&&(f=n)}if(c){var v,y,b,x;const e="y"===d?"width":"height",t=["top","left"].includes(eoe(o)),n=i.reference[h]-i.floating[e]+(t&&null!=(v=null==(y=a.offset)?void 0:y[h])?v:0)+(t?0:m.crossAxis),r=i.reference[h]+i.reference[e]+(t?0:null!=(b=null==(x=a.offset)?void 0:x[h])?b:0)-(t?m.crossAxis:0);pr&&(p=r)}return{[d]:f,[h]:p}}}};function _oe(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function Eoe(e){if(null==e)return window;if(!_oe(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function Loe(e){return Eoe(e).getComputedStyle(e)}function Poe(e){return _oe(e)?"":e?(e.nodeName||"").toLowerCase():""}function Ooe(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function Moe(e){return e instanceof Eoe(e).HTMLElement}function Toe(e){return e instanceof Eoe(e).Element}function Aoe(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof Eoe(e).ShadowRoot||e instanceof ShadowRoot}function Ioe(e){const{overflow:t,overflowX:n,overflowY:r}=Loe(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function Roe(e){return["table","td","th"].includes(Poe(e))}function Noe(e){const t=/firefox/i.test(Ooe()),n=Loe(e);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter}function Doe(){return!/^((?!chrome|android).)*safari/i.test(Ooe())}const zoe=Math.min,Boe=Math.max,joe=Math.round;function Foe(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const s=e.getBoundingClientRect();let l=1,c=1;t&&Moe(e)&&(l=e.offsetWidth>0&&joe(s.width)/e.offsetWidth||1,c=e.offsetHeight>0&&joe(s.height)/e.offsetHeight||1);const u=Toe(e)?Eoe(e):window,d=!Doe()&&n,h=(s.left+(d&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/l,f=(s.top+(d&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,p=s.width/l,g=s.height/c;return{width:p,height:g,top:f,right:h+p,bottom:f+g,left:h,x:h,y:f}}function Hoe(e){return((function(e){return e instanceof Eoe(e).Node}(e)?e.ownerDocument:e.document)||window.document).documentElement}function Woe(e){return Toe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Voe(e){return Foe(Hoe(e)).left+Woe(e).scrollLeft}function Uoe(e,t,n){const r=Moe(t),o=Hoe(t),i=Foe(e,r&&function(e){const t=Foe(e);return joe(t.width)!==e.offsetWidth||joe(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==Poe(t)||Ioe(o))&&(a=Woe(t)),Moe(t)){const e=Foe(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=Voe(o));return{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function $oe(e){return"html"===Poe(e)?e:e.assignedSlot||e.parentNode||(Aoe(e)?e.host:null)||Hoe(e)}function Goe(e){return Moe(e)&&"fixed"!==getComputedStyle(e).position?e.offsetParent:null}function qoe(e){const t=Eoe(e);let n=Goe(e);for(;n&&Roe(n)&&"static"===getComputedStyle(n).position;)n=Goe(n);return n&&("html"===Poe(n)||"body"===Poe(n)&&"static"===getComputedStyle(n).position&&!Noe(n))?t:n||function(e){let t=$oe(e);for(Aoe(t)&&(t=t.host);Moe(t)&&!["html","body"].includes(Poe(t));){if(Noe(t))return t;t=t.parentNode}return null}(e)||t}function Yoe(e){if(Moe(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=Foe(e);return{width:t.width,height:t.height}}function Zoe(e){const t=$oe(e);return["html","body","#document"].includes(Poe(t))?e.ownerDocument.body:Moe(t)&&Ioe(t)?t:Zoe(t)}function Xoe(e,t){var n;void 0===t&&(t=[]);const r=Zoe(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=Eoe(r),a=o?[i].concat(i.visualViewport||[],Ioe(r)?r:[]):r,s=t.concat(a);return o?s:s.concat(Xoe(a))}function Koe(e,t,n){return"viewport"===t?aoe(function(e,t){const n=Eoe(e),r=Hoe(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Doe();(e||!e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n)):Toe(t)?function(e,t){const n=Foe(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):aoe(function(e){var t;const n=Hoe(e),r=Woe(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=Boe(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Boe(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let s=-r.scrollLeft+Voe(e);const l=-r.scrollTop;return"rtl"===Loe(o||n).direction&&(s+=Boe(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}(Hoe(e)))}function Qoe(e){const t=Xoe(e),n=["absolute","fixed"].includes(Loe(e).position)&&Moe(e)?qoe(e):e;return Toe(n)?t.filter((e=>Toe(e)&&function(e,t){const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Aoe(n)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(e,n)&&"body"!==Poe(e))):[]}const Joe={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?Qoe(t):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=Koe(t,n,o);return e.top=Boe(r.top,e.top),e.right=zoe(r.right,e.right),e.bottom=zoe(r.bottom,e.bottom),e.left=Boe(r.left,e.left),e}),Koe(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Moe(n),i=Hoe(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==Poe(n)||Ioe(i))&&(a=Woe(n)),Moe(n))){const e=Foe(n,!0);s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+s.x,y:t.y-a.scrollTop+s.y}},isElement:Toe,getDimensions:Yoe,getOffsetParent:qoe,getDocumentElement:Hoe,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:Uoe(t,qoe(n),r),floating:{...Yoe(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===Loe(e).direction};function eie(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=!0,animationFrame:s=!1}=r,l=o&&!s,c=i&&!s,u=l||c?[...Toe(e)?Xoe(e):[],...Xoe(t)]:[];u.forEach((e=>{l&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)}));let d,h=null;if(a){let r=!0;h=new ResizeObserver((()=>{r||n(),r=!1})),Toe(e)&&!s&&h.observe(e),h.observe(t)}let f=s?Foe(e):null;return s&&function t(){const r=Foe(e);!f||r.x===f.x&&r.y===f.y&&r.width===f.width&&r.height===f.height||n();f=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{l&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)})),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(d)}}const tie=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=await(null==a.isRTL?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:u}=ooe(l,r,s),d=r,h={},f=0;for(let p=0;p{t.current=e})),t}(o),c=a.exports.useRef(null),[u,d]=a.exports.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[h,f]=a.exports.useState(t);rie(null==h?void 0:h.map((e=>{let{options:t}=e;return t})),null==t?void 0:t.map((e=>{let{options:t}=e;return t})))||f(t);const p=a.exports.useCallback((()=>{i.current&&s.current&&tie(i.current,s.current,{middleware:h,placement:n,strategy:r}).then((e=>{g.current&&U.exports.flushSync((()=>{d(e)}))}))}),[h,n,r]);nie((()=>{g.current&&p()}),[p]);const g=a.exports.useRef(!1);nie((()=>(g.current=!0,()=>{g.current=!1})),[]);const m=a.exports.useCallback((()=>{if("function"==typeof c.current&&(c.current(),c.current=null),i.current&&s.current)if(l.current){const e=l.current(i.current,s.current,p);c.current=e}else p()}),[p,l]),v=a.exports.useCallback((e=>{i.current=e,m()}),[m]),y=a.exports.useCallback((e=>{s.current=e,m()}),[m]),b=a.exports.useMemo((()=>({reference:i,floating:s})),[]);return a.exports.useMemo((()=>({...u,update:p,refs:b,reference:v,floating:y})),[u,p,b,v,y])}const iie=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn:e=>function(e){return Object.prototype.hasOwnProperty.call(e,"current")}(t)?null!=t.current?doe({element:t.current,padding:n}).fn(e):{}:t?doe({element:t,padding:n}).fn(e):{}}};const aie="Popper",[sie,lie]=mre(aie),[cie,uie]=sie(aie),die=a.exports.forwardRef(((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=uie("PopperAnchor",n),s=a.exports.useRef(null),l=bre(t,s);return a.exports.useEffect((()=>{i.onAnchorChange((null==r?void 0:r.current)||s.current)})),r?null:a.exports.createElement(_re.div,vp({},o,{ref:l}))})),hie="PopperContent",[fie,pie]=sie(hie),[gie,mie]=sie(hie,{hasParent:!1,positionUpdateFns:new Set}),vie=a.exports.forwardRef(((e,t)=>{var n,r,o,i,s,l,c,u;const{__scopePopper:d,side:h="bottom",sideOffset:f=0,align:p="center",alignOffset:g=0,arrowPadding:m=0,collisionBoundary:v=[],collisionPadding:y=0,sticky:b="partial",hideWhenDetached:x=!1,avoidCollisions:w=!0,...k}=e,S=uie(hie,d),[C,_]=a.exports.useState(null),E=bre(t,(e=>_(e))),[L,P]=a.exports.useState(null),O=function(e){const[t,n]=a.exports.useState(void 0);return Kre((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(L),M=null!==(n=null==O?void 0:O.width)&&void 0!==n?n:0,T=null!==(r=null==O?void 0:O.height)&&void 0!==r?r:0,A=h+("center"!==p?"-"+p:""),I="number"==typeof y?y:{top:0,right:0,bottom:0,left:0,...y},R=Array.isArray(v)?v:[v],N=R.length>0,D={padding:I,boundary:R.filter(bie),altBoundary:N},{reference:z,floating:B,strategy:j,x:F,y:H,placement:W,middlewareData:V,update:U}=oie({strategy:"fixed",placement:A,whileElementsMounted:eie,middleware:[woe({mainAxis:f+T,alignmentAxis:g}),w?Soe({mainAxis:!0,crossAxis:!1,limiter:"partial"===b?Coe():void 0,...D}):void 0,L?iie({element:L,padding:m}):void 0,w?voe({...D}):void 0,xie({arrowWidth:M,arrowHeight:T}),x?xoe({strategy:"referenceHidden"}):void 0].filter(yie)});Kre((()=>{z(S.anchor)}),[z,S.anchor]);const $=null!==F&&null!==H,[G,q]=wie(W),Y=null===(o=V.arrow)||void 0===o?void 0:o.x,Z=null===(i=V.arrow)||void 0===i?void 0:i.y,X=0!==(null===(s=V.arrow)||void 0===s?void 0:s.centerOffset),[K,Q]=a.exports.useState();Kre((()=>{C&&Q(window.getComputedStyle(C).zIndex)}),[C]);const{hasParent:J,positionUpdateFns:ee}=mie(hie,d),te=!J;a.exports.useLayoutEffect((()=>{if(!te)return ee.add(U),()=>{ee.delete(U)}}),[te,ee,U]),a.exports.useLayoutEffect((()=>{te&&$&&Array.from(ee).reverse().forEach((e=>requestAnimationFrame(e)))}),[te,$,ee]);const ne={"data-side":G,"data-align":q,...k,ref:E,style:{...k.style,animation:$?void 0:"none",opacity:null!==(l=V.hide)&&void 0!==l&&l.referenceHidden?0:void 0}};return a.exports.createElement("div",{ref:B,"data-radix-popper-content-wrapper":"",style:{position:j,left:0,top:0,transform:$?`translate3d(${Math.round(F)}px, ${Math.round(H)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[null===(c=V.transformOrigin)||void 0===c?void 0:c.x,null===(u=V.transformOrigin)||void 0===u?void 0:u.y].join(" ")}},a.exports.createElement(fie,{scope:d,placedSide:G,onArrowChange:P,arrowX:Y,arrowY:Z,shouldHideArrow:X},te?a.exports.createElement(gie,{scope:d,hasParent:!0,positionUpdateFns:ee},a.exports.createElement(_re.div,ne)):a.exports.createElement(_re.div,ne)))}));function yie(e){return void 0!==e}function bie(e){return null!==e}const xie=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,a;const{placement:s,rects:l,middlewareData:c}=t,u=0!==(null===(n=c.arrow)||void 0===n?void 0:n.centerOffset),d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[f,p]=wie(s),g={start:"0%",center:"50%",end:"100%"}[p],m=(null!==(r=null===(o=c.arrow)||void 0===o?void 0:o.x)&&void 0!==r?r:0)+d/2,v=(null!==(i=null===(a=c.arrow)||void 0===a?void 0:a.y)&&void 0!==i?i:0)+h/2;let y="",b="";return"bottom"===f?(y=u?g:`${m}px`,b=-h+"px"):"top"===f?(y=u?g:`${m}px`,b=`${l.floating.height+h}px`):"right"===f?(y=-h+"px",b=u?g:`${v}px`):"left"===f&&(y=`${l.floating.width+h}px`,b=u?g:`${v}px`),{data:{x:y,y:b}}}});function wie(e){const[t,n="center"]=e.split("-");return[t,n]}const kie=e=>{const{__scopePopper:t,children:n}=e,[r,o]=a.exports.useState(null);return a.exports.createElement(cie,{scope:t,anchor:r,onAnchorChange:o},n)},Sie=die,Cie=vie;const _ie=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=a.exports.useState(),r=a.exports.useRef({}),o=a.exports.useRef(e),i=a.exports.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return a.exports.useReducer(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.exports.useEffect((()=>{const e=Eie(r.current);i.current="mounted"===l?e:"none"}),[l]),Kre((()=>{const t=r.current,n=o.current;if(n!==e){const r=i.current,a=Eie(t);if(e)c("MOUNT");else if("none"===a||"none"===(null==t?void 0:t.display))c("UNMOUNT");else{c(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),Kre((()=>{if(t){const e=e=>{const n=Eie(r.current).includes(e.animationName);e.target===t&&n&&U.exports.flushSync((()=>c("ANIMATION_END")))},n=e=>{e.target===t&&(i.current=Eie(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.exports.useCallback((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):a.exports.Children.only(n),i=bre(r.ref,o.ref);return"function"==typeof n||r.isPresent?a.exports.cloneElement(o,{ref:i}):null};function Eie(e){return(null==e?void 0:e.animationName)||"none"}function Lie({prop:e,defaultProp:t,onChange:n=(()=>{})}){const[r,o]=function({defaultProp:e,onChange:t}){const n=a.exports.useState(e),[r]=n,o=a.exports.useRef(r),i=Mre(t);return a.exports.useEffect((()=>{o.current!==r&&(i(r),o.current=r)}),[r,o,i]),n}({defaultProp:t,onChange:n}),i=void 0!==e,s=i?e:r,l=Mre(n),c=a.exports.useCallback((t=>{if(i){const n="function"==typeof t?t(e):t;n!==e&&l(n)}else o(t)}),[i,e,o,l]);return[s,c]}_ie.displayName="Presence";const Pie="rovingFocusGroup.onEntryFocus",Oie={bubbles:!1,cancelable:!0},Mie="RovingFocusGroup",[Tie,Aie,Iie]=Lre(Mie),[Rie,Nie]=mre(Mie,[Iie]),[Die,zie]=Rie(Mie),Bie=a.exports.forwardRef(((e,t)=>a.exports.createElement(Tie.Provider,{scope:e.__scopeRovingFocusGroup},a.exports.createElement(Tie.Slot,{scope:e.__scopeRovingFocusGroup},a.exports.createElement(jie,vp({},e,{ref:t})))))),jie=a.exports.forwardRef(((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,...d}=e,h=a.exports.useRef(null),f=bre(t,h),p=Ore(i),[g=null,m]=Lie({prop:s,defaultProp:l,onChange:c}),[v,y]=a.exports.useState(!1),b=Mre(u),x=Aie(n),w=a.exports.useRef(!1),[k,S]=a.exports.useState(0);return a.exports.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(Pie,b),()=>e.removeEventListener(Pie,b)}),[b]),a.exports.createElement(Die,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:g,onItemFocus:a.exports.useCallback((e=>m(e)),[m]),onItemShiftTab:a.exports.useCallback((()=>y(!0)),[]),onFocusableItemAdd:a.exports.useCallback((()=>S((e=>e+1))),[]),onFocusableItemRemove:a.exports.useCallback((()=>S((e=>e-1))),[])},a.exports.createElement(_re.div,vp({tabIndex:v||0===k?-1:0,"data-orientation":r},d,{ref:f,style:{outline:"none",...e.style},onMouseDown:gre(e.onMouseDown,(()=>{w.current=!0})),onFocus:gre(e.onFocus,(e=>{const t=!w.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(Pie,Oie);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=x().filter((e=>e.focusable));Wie([e.find((e=>e.active)),e.find((e=>e.id===g)),...e].filter(Boolean).map((e=>e.ref.current)))}}w.current=!1})),onBlur:gre(e.onBlur,(()=>y(!1)))})))})),Fie=a.exports.forwardRef(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,...i}=e,s=function(e){const[t,n]=a.exports.useState(Qre());return Kre((()=>{e||n((e=>null!=e?e:String(Jre++)))}),[e]),e||(t?`radix-${t}`:"")}(),l=zie("RovingFocusGroupItem",n),c=l.currentTabStopId===s,u=Aie(n),{onFocusableItemAdd:d,onFocusableItemRemove:h}=l;return a.exports.useEffect((()=>{if(r)return d(),()=>h()}),[r,d,h]),a.exports.createElement(Tie.ItemSlot,{scope:n,id:s,focusable:r,active:o},a.exports.createElement(_re.span,vp({tabIndex:c?0:-1,"data-orientation":l.orientation},i,{ref:t,onMouseDown:gre(e.onMouseDown,(e=>{r?l.onItemFocus(s):e.preventDefault()})),onFocus:gre(e.onFocus,(()=>l.onItemFocus(s))),onKeyDown:gre(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void l.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:Hie[r]}(e,l.orientation,l.dir);if(void 0!==t){e.preventDefault();let o=u().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=l.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>Wie(o)))}var n,r}))})))})),Hie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wie(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}const Vie=Bie,Uie=Fie,$ie=["Enter"," "],Gie=["ArrowUp","PageDown","End"],qie=["ArrowDown","PageUp","Home",...Gie],Yie="Menu",[Zie,Xie,Kie]=Lre(Yie),[Qie,Jie]=mre(Yie,[Kie,lie,Nie]),eae=lie(),tae=Nie(),[nae,rae]=Qie(Yie),[oae,iae]=Qie(Yie),aae=a.exports.forwardRef(((e,t)=>{const{__scopeMenu:n,...r}=e,o=eae(n);return a.exports.createElement(Sie,vp({},o,r,{ref:t}))})),[sae,lae]=Qie("MenuPortal",{forceMount:void 0}),cae="MenuContent",[uae,dae]=Qie(cae),hae=a.exports.forwardRef(((e,t)=>{const n=lae(cae,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=rae(cae,e.__scopeMenu),s=iae(cae,e.__scopeMenu);return a.exports.createElement(Zie.Provider,{scope:e.__scopeMenu},a.exports.createElement(_ie,{present:r||i.open},a.exports.createElement(Zie.Slot,{scope:e.__scopeMenu},s.modal?a.exports.createElement(fae,vp({},o,{ref:t})):a.exports.createElement(pae,vp({},o,{ref:t})))))})),fae=a.exports.forwardRef(((e,t)=>{const n=rae(cae,e.__scopeMenu),r=a.exports.useRef(null),o=bre(t,r);return a.exports.useEffect((()=>{const e=r.current;if(e)return pD(e)}),[]),a.exports.createElement(gae,vp({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gre(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))})),pae=a.exports.forwardRef(((e,t)=>{const n=rae(cae,e.__scopeMenu);return a.exports.createElement(gae,vp({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))})),gae=a.exports.forwardRef(((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,m=rae(cae,n),v=iae(cae,n),y=eae(n),b=tae(n),x=Xie(n),[w,k]=a.exports.useState(null),S=a.exports.useRef(null),C=bre(t,S,m.onContentChange),_=a.exports.useRef(0),E=a.exports.useRef(""),L=a.exports.useRef(0),P=a.exports.useRef(null),O=a.exports.useRef("right"),M=a.exports.useRef(0),T=p?_B:a.exports.Fragment,A=p?{as:xre,allowPinchZoom:!0}:void 0,I=e=>{var t,n;const r=E.current+e,o=x().filter((e=>!e.disabled)),i=document.activeElement,a=null===(t=o.find((e=>e.ref.current===i)))||void 0===t?void 0:t.textValue,s=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0])),o=r?t[0]:t,i=n?e.indexOf(n):-1;let a=(s=e,l=Math.max(i,0),s.map(((e,t)=>s[(l+t)%s.length])));var s,l;1===o.length&&(a=a.filter((e=>e!==n)));const c=a.find((e=>e.toLowerCase().startsWith(o.toLowerCase())));return c!==n?c:void 0}(o.map((e=>e.textValue)),r,a),l=null===(n=o.find((e=>e.textValue===s)))||void 0===n?void 0:n.ref.current;!function e(t){E.current=t,window.clearTimeout(_.current),""!==t&&(_.current=window.setTimeout((()=>e("")),1e3))}(r),l&&setTimeout((()=>l.focus()))};a.exports.useEffect((()=>()=>window.clearTimeout(_.current)),[]),a.exports.useEffect((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:Fre()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:Fre()),jre++,()=>{1===jre&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),jre--}}),[]);const R=a.exports.useCallback((e=>{var t,n;return O.current===(null===(t=P.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;ir!=c>r&&n<(l-e)*(r-s)/(c-s)+e&&(o=!o)}return o}(n,t)}(e,null===(n=P.current)||void 0===n?void 0:n.area)}),[]);return a.exports.createElement(uae,{scope:n,searchRef:E,onItemEnter:a.exports.useCallback((e=>{R(e)&&e.preventDefault()}),[R]),onItemLeave:a.exports.useCallback((e=>{var t;R(e)||(null===(t=S.current)||void 0===t||t.focus(),k(null))}),[R]),onTriggerLeave:a.exports.useCallback((e=>{R(e)&&e.preventDefault()}),[R]),pointerGraceTimerRef:L,onPointerGraceIntentChange:a.exports.useCallback((e=>{P.current=e}),[])},a.exports.createElement(T,A,a.exports.createElement(Ure,{asChild:!0,trapped:o,onMountAutoFocus:gre(i,(e=>{var t;e.preventDefault(),null===(t=S.current)||void 0===t||t.focus()})),onUnmountAutoFocus:s},a.exports.createElement(Dre,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f},a.exports.createElement(Vie,vp({asChild:!0},b,{dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:w,onCurrentTabStopIdChange:k,onEntryFocus:e=>{v.isUsingKeyboardRef.current||e.preventDefault()}}),a.exports.createElement(Cie,vp({role:"menu","aria-orientation":"vertical","data-state":(N=m.open,N?"open":"closed"),"data-radix-menu-content":"",dir:v.dir},y,g,{ref:C,style:{outline:"none",...g.style},onKeyDown:gre(g.onKeyDown,(e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&r&&I(e.key));const o=S.current;if(e.target!==o)return;if(!qie.includes(e.key))return;e.preventDefault();const i=x().filter((e=>!e.disabled)).map((e=>e.ref.current));Gie.includes(e.key)&&i.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(i)})),onBlur:gre(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(_.current),E.current="")})),onPointerMove:gre(e.onPointerMove,xae((e=>{const t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>M.current?"right":"left";O.current=t,M.current=e.clientX}})))})))))));var N})),mae="MenuItem",vae="menu.itemSelect",yae=a.exports.forwardRef(((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=a.exports.useRef(null),s=iae(mae,e.__scopeMenu),l=dae(mae,e.__scopeMenu),c=bre(t,i),u=a.exports.useRef(!1);return a.exports.createElement(bae,vp({},o,{ref:c,disabled:n,onClick:gre(e.onClick,(()=>{const e=i.current;if(!n&&e){const t=new CustomEvent(vae,{bubbles:!0,cancelable:!0});e.addEventListener(vae,(e=>null==r?void 0:r(e)),{once:!0}),Ere(e,t),t.defaultPrevented?u.current=!1:s.onClose()}})),onPointerDown:t=>{var n;null===(n=e.onPointerDown)||void 0===n||n.call(e,t),u.current=!0},onPointerUp:gre(e.onPointerUp,(e=>{var t;u.current||null===(t=e.currentTarget)||void 0===t||t.click()})),onKeyDown:gre(e.onKeyDown,(e=>{const t=""!==l.searchRef.current;n||t&&" "===e.key||$ie.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))}))})),bae=a.exports.forwardRef(((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=dae(mae,n),l=tae(n),c=a.exports.useRef(null),u=bre(t,c),[d,h]=a.exports.useState(!1),[f,p]=a.exports.useState("");return a.exports.useEffect((()=>{const e=c.current;var t;e&&p((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[i.children]),a.exports.createElement(Zie.ItemSlot,{scope:n,disabled:r,textValue:null!=o?o:f},a.exports.createElement(Uie,vp({asChild:!0},l,{focusable:!r}),a.exports.createElement(_re.div,vp({role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:u,onPointerMove:gre(e.onPointerMove,xae((e=>{if(r)s.onItemLeave(e);else if(s.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:gre(e.onPointerLeave,xae((e=>s.onItemLeave(e)))),onFocus:gre(e.onFocus,(()=>h(!0))),onBlur:gre(e.onBlur,(()=>h(!1)))}))))}));Qie("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});Qie("MenuItemIndicator",{checked:!1});function xae(e){return t=>"mouse"===t.pointerType?e(t):void 0}Qie("MenuSub");const wae=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,l=eae(t),[c,u]=a.exports.useState(null),d=a.exports.useRef(!1),h=Mre(i),f=Ore(o);return a.exports.useEffect((()=>{const e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),a.exports.createElement(kie,l,a.exports.createElement(nae,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:u},a.exports.createElement(oae,{scope:t,onClose:a.exports.useCallback((()=>h(!1)),[h]),isUsingKeyboardRef:d,dir:f,modal:s},r)))},kae=aae,Sae=hae,Cae=yae,_ae="ContextMenu",[Eae,Lae]=mre(_ae,[Jie]),Pae=Jie(),[Oae,Mae]=Eae(_ae);function Tae(e){return t=>"mouse"!==t.pointerType?e(t):void 0}const Aae=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:o,modal:i=!0}=e,[s,l]=a.exports.useState(!1),c=Pae(t),u=Mre(r),d=a.exports.useCallback((e=>{l(e),u(e)}),[u]);return a.exports.createElement(Oae,{scope:t,open:s,onOpenChange:d,modal:i},a.exports.createElement(wae,vp({},c,{dir:o,open:s,onOpenChange:d,modal:i}),n))},Iae=a.exports.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Mae("ContextMenuTrigger",n),i=Pae(n),s=a.exports.useRef({x:0,y:0}),l=a.exports.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),c=a.exports.useRef(0),u=a.exports.useCallback((()=>window.clearTimeout(c.current)),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},o.onOpenChange(!0)};return a.exports.useEffect((()=>u),[u]),a.exports.createElement(a.exports.Fragment,null,a.exports.createElement(kae,vp({},i,{virtualRef:l})),a.exports.createElement(_re.span,vp({"data-state":o.open?"open":"closed"},r,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:gre(e.onContextMenu,(e=>{u(),d(e),e.preventDefault()})),onPointerDown:gre(e.onPointerDown,Tae((e=>{u(),c.current=window.setTimeout((()=>d(e)),700)}))),onPointerMove:gre(e.onPointerMove,Tae(u)),onPointerCancel:gre(e.onPointerCancel,Tae(u)),onPointerUp:gre(e.onPointerUp,Tae(u))})))})),Rae=a.exports.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Mae("ContextMenuContent",n),i=Pae(n),s=a.exports.useRef(!1);return a.exports.createElement(Sae,vp({},i,r,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var n;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),!t.defaultPrevented&&s.current&&t.preventDefault(),s.current=!1},onInteractOutside:t=>{var n;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||o.modal||(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}}))})),Nae=a.exports.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Pae(n);return a.exports.createElement(Cae,vp({},o,r,{ref:t}))})),Dae=uV([e=>e.gallery,e=>e.options,xne,A3],((e,t,n,r)=>{const{categories:o,currentCategory:i,currentImageUuid:a,shouldPinGallery:s,shouldShowGallery:l,galleryScrollPosition:c,galleryImageMinimumWidth:u,galleryImageObjectFit:d,shouldHoldGalleryOpen:h,shouldAutoSwitchToNewImages:f,galleryWidth:p,shouldUseSingleGalleryColumn:g}=e,{isLightBoxOpen:m}=t;return{currentImageUuid:a,shouldPinGallery:s,shouldShowGallery:l,galleryScrollPosition:c,galleryImageMinimumWidth:u,galleryImageObjectFit:d,galleryGridTemplateColumns:g?"auto":`repeat(auto-fill, minmax(${u}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:h,shouldAutoSwitchToNewImages:f,images:o[i].images,areMoreImagesAvailable:o[i].areMoreImagesAvailable,currentCategory:i,galleryWidth:p,isLightBoxOpen:m,isStaging:n,shouldEnableResize:!(m||"unifiedCanvas"===r&&s),shouldUseSingleGalleryColumn:g}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),zae=uV([e=>e.options,e=>e.gallery,e=>e.system,A3],((e,t,n,r)=>({mayDeleteImage:n.isConnected&&!n.isProcessing,galleryImageObjectFit:t.galleryImageObjectFit,galleryImageMinimumWidth:t.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:t.shouldUseSingleGalleryColumn,activeTabName:r,isLightBoxOpen:e.isLightBoxOpen})),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Bae=a.exports.memo((e=>{const t=v5(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:o,mayDeleteImage:i,isLightBoxOpen:s,shouldUseSingleGalleryColumn:l}=y5(zae),{image:c,isSelected:u}=e,{url:d,thumbnail:h,uuid:f,metadata:p}=c,[g,m]=a.exports.useState(!1),v=zH(),{t:y}=HY();return cd(Aae,{onOpenChange:e=>{t(q$(e))},children:[ld(Iae,{children:cd(mI,{position:"relative",className:"hoverable-image",onMouseOver:()=>m(!0),onMouseOut:()=>m(!1),userSelect:"none",draggable:!0,onDragStart:e=>{e.dataTransfer.setData("invokeai/imageUuid",f),e.dataTransfer.effectAllowed="move"},children:[ld(ET,{className:"hoverable-image-image",objectFit:l?"contain":r,rounded:"md",src:h||d,loading:"lazy"}),ld("div",{className:"hoverable-image-content",onClick:()=>t(z$(c)),children:u&&ld(kk,{width:"50%",height:"50%",as:B5,className:"hoverable-image-check"})}),g&&o>=64&&ld("div",{className:"hoverable-image-delete-button",children:ld(tre,{image:c,children:ld(zT,{"aria-label":y("options:deleteImage"),icon:ld(m3,{}),size:"xs",variant:"imageHoverIconButton",fontSize:14,isDisabled:!i})})})]},f)}),cd(Rae,{className:"hoverable-image-context-menu",sticky:"always",onInteractOutside:e=>{e.detail.originalEvent.preventDefault()},children:[ld(Nae,{onClickCapture:()=>{t(qU(!0)),t(z$(c))},children:y("options:openInViewer")}),ld(Nae,{onClickCapture:()=>{c.metadata&&t(JU(c.metadata.image.prompt)),v({title:y("toast:promptSet"),status:"success",duration:2500,isClosable:!0})},disabled:void 0===c?.metadata?.image?.prompt,children:y("options:usePrompt")}),ld(Nae,{onClickCapture:()=>{c.metadata&&t(a$(c.metadata.image.seed)),v({title:y("toast:seedSet"),status:"success",duration:2500,isClosable:!0})},disabled:void 0===c?.metadata?.image?.seed,children:y("options:useSeed")}),ld(Nae,{onClickCapture:()=>{p&&t(DU(p)),v({title:y("toast:parametersSet"),status:"success",duration:2500,isClosable:!0})},disabled:!["txt2img","img2img"].includes(c?.metadata?.image?.type),children:y("options:useAll")}),ld(Nae,{onClickCapture:async()=>{if(p?.image?.init_image_path){if((await fetch(p.image.init_image_path)).ok)return t(IU("img2img")),t(RU(p)),void v({title:y("toast:initialImageSet"),status:"success",duration:2500,isClosable:!0})}v({title:y("toast:initialImageNotSet"),description:y("toast:initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},disabled:"img2img"!==c?.metadata?.image?.type,children:y("options:useInitImg")}),ld(Nae,{onClickCapture:()=>{s&&t(qU(!1)),t(GU(c)),"img2img"!==n&&t(IU("img2img")),v({title:y("toast:sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},children:y("options:sendToImg2Img")}),ld(Nae,{onClickCapture:()=>{s&&t(qU(!1)),t(sX(c)),t(ZZ()),"unifiedCanvas"!==n&&t(IU("unifiedCanvas")),v({title:y("toast:sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},children:y("options:sendToUnifiedCanvas")}),ld(Nae,{"data-warning":!0,children:ld(tre,{image:c,children:ld("p",{children:y("options:deleteImage")})})})]})]})}),((e,t)=>e.image.uuid===t.image.uuid&&e.isSelected===t.isSelected)),jae=320,Fae={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}};function Hae(){const e=v5(),{t:t}=HY(),{images:n,currentCategory:r,currentImageUuid:o,shouldPinGallery:i,shouldShowGallery:s,galleryScrollPosition:l,galleryImageMinimumWidth:c,galleryGridTemplateColumns:u,activeTabName:d,galleryImageObjectFit:h,shouldHoldGalleryOpen:f,shouldAutoSwitchToNewImages:p,areMoreImagesAvailable:g,galleryWidth:m,isLightBoxOpen:v,isStaging:y,shouldEnableResize:b,shouldUseSingleGalleryColumn:x}=y5(Dae),{galleryMinWidth:w,galleryMaxWidth:k}=v?{galleryMinWidth:400,galleryMaxWidth:400}:Fae[d],[S,C]=a.exports.useState(m>=jae),[_,E]=a.exports.useState(!1),[L,P]=a.exports.useState(0),O=a.exports.useRef(null),M=a.exports.useRef(null),T=a.exports.useRef(null);a.exports.useEffect((()=>{m>=jae&&C(!1)}),[m]);const A=()=>{e(W$(!i)),e(aX(!0))},I=()=>{e(V$(!0)),i&&e(aX(!0))},R=a.exports.useCallback((()=>{e(V$(!1)),e(q$(!1)),e(U$(M.current?M.current.scrollTop:0)),setTimeout((()=>i&&e(aX(!0))),400)}),[e,i]),N=()=>{T.current&&window.clearTimeout(T.current)};Cte("g",(()=>{s?R():I()}),[s,i]),Cte("left",(()=>{e(H$())}),{enabled:!y||"unifiedCanvas"!==d},[y]),Cte("right",(()=>{e(F$())}),{enabled:!y||"unifiedCanvas"!==d},[y]),Cte("shift+g",(()=>{A()}),[i]),Cte("esc",(()=>{e(V$(!1))}),{enabled:()=>!i,preventDefault:!0},[i]);return Cte("shift+up",(()=>{if(c<256){const t=A$.clamp(c+32,32,256);e($$(t))}}),[c]),Cte("shift+down",(()=>{if(c>32){const t=A$.clamp(c-32,32,256);e($$(t))}}),[c]),a.exports.useEffect((()=>{M.current&&(M.current.scrollTop=l)}),[l,s]),a.exports.useEffect((()=>{function e(e){i||!O.current||O.current.contains(e.target)||R()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[R,i]),ld(Yne,{nodeRef:O,in:s||f,unmountOnExit:!0,timeout:200,classNames:"image-gallery-wrapper",children:cd("div",{className:"image-gallery-wrapper",style:{zIndex:i?1:100},"data-pinned":i,ref:O,onMouseLeave:i?void 0:()=>{f||(T.current=window.setTimeout((()=>R()),500))},onMouseEnter:i?void 0:N,onMouseOver:i?void 0:N,children:[cd(_8,{minWidth:w,maxWidth:i?k:window.innerWidth,className:"image-gallery-popup",handleStyles:{left:{width:"15px"}},enable:{left:b},size:{width:m,height:i?"100%":"100vh"},onResizeStart:(e,t,n)=>{P(n.clientHeight),n.style.height=`${n.clientHeight}px`,i&&(n.style.position="fixed",n.style.right="1rem",E(!0))},onResizeStop:(t,n,r,o)=>{const a=i?A$.clamp(Number(m)+o.width,w,Number(k)):Number(m)+o.width;e(X$(a)),r.removeAttribute("data-resize-alert"),i&&(r.style.position="relative",r.style.removeProperty("right"),r.style.setProperty("height",i?"100%":"100vh"),E(!1),e(aX(!0)))},onResize:(t,n,r,o)=>{const a=A$.clamp(Number(m)+o.width,w,Number(i?k:.95*window.innerWidth));a>=jae&&!S?C(!0):aa-40&&e($$(a-40)),i&&(a>=k?r.setAttribute("data-resize-alert","true"):r.removeAttribute("data-resize-alert")),r.style.height=`${L}px`},children:[cd("div",{className:"image-gallery-header",children:[ld(DT,{size:"sm",isAttached:!0,variant:"solid",className:"image-gallery-category-btn-group",children:cd(sd,S?{children:[ld(j3,{size:"sm","data-selected":"result"===r,onClick:()=>e(Z$("result")),children:t("gallery:generations")}),ld(j3,{size:"sm","data-selected":"user"===r,onClick:()=>e(Z$("user")),children:t("gallery:uploads")})]}:{children:[ld(S3,{"aria-label":t("gallery:showGenerations"),tooltip:t("gallery:showGenerations"),"data-selected":"result"===r,icon:ld(Q5,{}),onClick:()=>e(Z$("result"))}),ld(S3,{"aria-label":t("gallery:showUploads"),tooltip:t("gallery:showUploads"),"data-selected":"user"===r,icon:ld(x3,{}),onClick:()=>e(Z$("user"))})]})}),cd("div",{className:"image-gallery-header-right-icons",children:[ld(B3,{isLazy:!0,trigger:"hover",placement:"left",triggerComponent:ld(S3,{size:"sm","aria-label":t("gallery:gallerySettings"),icon:ld(w3,{}),className:"image-gallery-icon-btn",cursor:"pointer"}),children:cd("div",{className:"image-gallery-settings-popover",children:[cd("div",{children:[ld(Wte,{value:c,onChange:t=>{e($$(t))},min:32,max:256,hideTooltip:!0,label:t("gallery:galleryImageSize")}),ld(S3,{size:"sm","aria-label":t("gallery:galleryImageResetSize"),tooltip:t("gallery:galleryImageResetSize"),onClick:()=>e($$(64)),icon:ld(T9,{}),"data-selected":i,styleClass:"image-gallery-icon-btn"})]}),ld("div",{children:ld(U3,{label:t("gallery:maintainAspectRatio"),isChecked:"contain"===h,onChange:()=>e(G$("contain"===h?"cover":"contain"))})}),ld("div",{children:ld(U3,{label:t("gallery:autoSwitchNewImages"),isChecked:p,onChange:t=>e(Y$(t.target.checked))})}),ld("div",{children:ld(U3,{label:t("gallery:singleColumnLayout"),isChecked:x,onChange:t=>e(K$(t.target.checked))})})]})}),ld(S3,{size:"sm",className:"image-gallery-icon-btn","aria-label":t("gallery:pinGallery"),tooltip:`${t("gallery:pinGallery")} (Shift+G)`,onClick:A,icon:ld(i?Tne:Ane,{})})]})]}),ld("div",{className:"image-gallery-container",ref:M,children:n.length||g?cd(sd,{children:[ld("div",{className:"image-gallery",style:{gridTemplateColumns:u},children:n.map((e=>{const{uuid:t}=e;return ld(Bae,{image:e,isSelected:o===t},t)}))}),ld(RT,{onClick:()=>{e(_Q(r))},isDisabled:!g,className:"image-gallery-load-more-btn",children:t(g?"gallery:loadMore":"gallery:allImagesLoaded")})]}):cd("div",{className:"image-gallery-container-placeholder",children:[ld(Z3,{}),ld("p",{children:t("gallery:noImagesInGallery")})]})})]}),_&&ld("div",{style:{width:m+"px",height:"100%"}})]})})}const Wae=uV((e=>e.gallery),(e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images}))),Vae=uV([e=>e.options,A3],((e,t)=>{const{showDualDisplay:n,shouldPinOptionsPanel:r,isLightBoxOpen:o}=e;return{showDualDisplay:n,shouldPinOptionsPanel:r,isLightBoxOpen:o,shouldShowDualDisplayButton:["inpainting"].includes(t),activeTabName:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Uae=e=>{const t=v5(),{optionsPanel:n,children:r,styleClass:o}=e,{activeTabName:i,showDualDisplay:a,isLightBoxOpen:s,shouldShowDualDisplayButton:l}=y5(Vae),c=(()=>{const{resultImages:e,userImages:t}=y5(Wae);return n=>{const r=e.find((e=>e.uuid===n));if(r)return r;return t.find((e=>e.uuid===n))||void 0}})();return ld("div",{className:o?`workarea-wrapper ${o}`:"workarea-wrapper",children:cd("div",{className:"workarea-main",children:[n,cd("div",{className:"workarea-children-wrapper",onDrop:e=>{const n=e.dataTransfer.getData("invokeai/imageUuid"),r=c(n);r&&("img2img"===i?t(GU(r)):"unifiedCanvas"===i&&t(sX(r)))},children:[r,l&&ld(YH,{label:"Toggle Split View",children:ld("div",{className:"workarea-split-button","data-selected":a,onClick:()=>{t(b$(!a)),t(aX(!0))},children:ld(pre,{})})})]}),!s&&ld(Hae,{})]})})};function $ae(){return ld(Uae,{optionsPanel:ld(Kne,{}),children:ld(fre,{})})}const Gae=()=>{const e=v5(),t=y5((e=>e.options.hiresFix)),{t:n}=HY();return ld(CI,{gap:2,direction:"column",children:ld(E3,{label:n("options:hiresOptim"),fontSize:"md",isChecked:t,onChange:t=>e(VU(t.target.checked))})})},qae=()=>cd(CI,{gap:2,direction:"column",children:[ld(Ute,{}),ld(Gae,{})]});function Yae(){const{t:e}=HY(),t={seed:{header:`${e("options:seed")}`,feature:Nte.SEED,content:ld(Kte,{})},variations:{header:`${e("options:variations")}`,feature:Nte.VARIATIONS,content:ld(ine,{}),additionalHeaderComponents:ld(nne,{})},face_restore:{header:`${e("options:faceRestoration")}`,feature:Nte.FACE_CORRECTION,content:ld(jte,{}),additionalHeaderComponents:ld(Fte,{})},upscale:{header:`${e("options:upscaling")}`,feature:Nte.UPSCALE,content:ld(ene,{}),additionalHeaderComponents:ld(tne,{})},other:{header:`${e("options:otherOptions")}`,feature:Nte.OTHER,content:ld(qae,{})}};return cd(Xne,{children:[ld(Mne,{}),ld(Pne,{}),ld(fne,{}),ld(yne,{accordionInfo:t})]})}const Zae=()=>ld("div",{className:"workarea-single-view",children:ld("div",{className:"text-to-image-area",children:ld(ure,{})})});function Xae(){return ld(Uae,{optionsPanel:ld(Yae,{}),children:ld(Zae,{})})}var Kae=function(e,t){return Kae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Kae(e,t)};var Qae=function(){return Qae=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=n?(r(1),e.animation=null):e.animation&&(r(a),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function ase(e,t,n,r){var o=function(e){var t=e.scale,n=e.positionX,r=e.positionY;if(isNaN(t)||isNaN(n)||isNaN(r))return!1;return!0}(t);if(e.mounted&&o){var i=e.setTransformState,a=e.transformState,s=a.scale,l=a.positionX,c=a.positionY,u=t.scale-s,d=t.positionX-l,h=t.positionY-c;0===n?i(t.scale,t.positionX,t.positionY):ise(e,r,n,(function(e){i(s+u*e,l+d*e,c+h*e)}))}}var sse=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,o=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var i=function(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,i=t.offsetWidth*n,a=t.offsetHeight*n;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:i,newDiffWidth:r-i,newContentHeight:a,newDiffHeight:o-a}}(n,r,t),a=i.wrapperWidth,s=i.wrapperHeight,l=function(e,t,n,r,o,i,a){var s=e>t?n*(a?1:.5):0,l=r>o?i*(a?1:.5):0;return{minPositionX:e-t-s,maxPositionX:s,minPositionY:r-o-l,maxPositionY:l}}(a,i.newContentWidth,i.newDiffWidth,s,i.newContentHeight,i.newDiffHeight,Boolean(o));return l},lse=function(e,t){var n=sse(e,t);return e.bounds=n,n};function cse(e,t,n,r,o,i,a){var s=n.minPositionX,l=n.minPositionY,c=n.maxPositionX,u=n.maxPositionY,d=0,h=0;return a&&(d=o,h=i),{x:use(e,s-d,c+d,r),y:use(t,l-h,u+h,r)}}var use=function(e,t,n,r){return ese(r?en?n:e:e,2)};function dse(e,t,n,r,o,i){var a=e.transformState,s=a.scale,l=a.positionX,c=a.positionY,u=r-s;return"number"!=typeof t||"number"!=typeof n?(console.error("Mouse X and Y position were not provided!"),{x:l,y:c}):cse(l-t*u,c-n*u,o,i,0,0,null)}function hse(e,t,n,r,o){var i=t-(o?r:0);return!isNaN(n)&&e>=n?n:!isNaN(t)&&e<=i?i:e}var fse=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,o=e.wrapperComponent,i=t.target,a=null==o?void 0:o.contains(i);return!!(r&&i&&a)&&!Fse(i,n)},pse=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup.panning.disabled;return!(!t||!n||r)};var gse=function(e,t){var n=e.setup,r=e.transformState.scale,o=n.minScale;return t>0&&r>=o?t:0};function mse(e,t,n,r,o,i,a,s,l,c){if(o){var u;if(t>a&&n>a)return(u=a+(e-a)*c)>l?l:ui?i:u}return r?t:use(e,i,a,o)}function vse(e,t){var n=function(e){var t=e.mounted,n=e.setup,r=n.disabled,o=n.velocityAnimation,i=e.transformState.scale;return!(o.disabled&&!(i>1)&&r&&!t)}(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,i=e.setup,a=e.wrapperComponent,s=i.velocityAnimation.equalToMove,l=Date.now();if(r&&o&&a){var c=function(e,t){return t?Math.min(1,e.offsetWidth/window.innerWidth):1}(a,s),u=t.x-r.x,d=t.y-r.y,h=u/c,f=d/c,p=l-o,g=u*u+d*d,m=Math.sqrt(g)/p;e.velocity={velocityX:h,velocityY:f,total:m}}e.lastMousePosition=t,e.velocityTime=l}}function yse(e,t){var n=e.transformState.scale;ose(e),lse(e,n),t.touches?function(e,t){var n=t.touches,r=e.transformState,o=r.positionX,i=r.positionY;if(e.isPanning=!0,1===n.length){var a=n[0].clientX,s=n[0].clientY;e.startCoords={x:a-o,y:s-i}}}(e,t):function(e,t){var n=e.transformState,r=n.positionX,o=n.positionY;e.isPanning=!0;var i=t.clientX,a=t.clientY;e.startCoords={x:i-r,y:a-o}}(e,t)}function bse(e,t,n){var r=e.startCoords,o=e.setup.alignmentAnimation,i=o.sizeX,a=o.sizeY;if(r){var s=function(e,t,n){var r=e.startCoords,o=e.transformState,i=e.setup.panning,a=i.lockAxisX,s=i.lockAxisY,l=o.positionX,c=o.positionY;if(!r)return{x:l,y:c};var u=t-r.x,d=n-r.y;return{x:a?l:u,y:s?c:d}}(e,t,n),l=s.x,c=s.y,u=gse(e,i),d=gse(e,a);vse(e,{x:l,y:c}),function(e,t,n,r,o){var i=e.setup.limitToBounds,a=e.wrapperComponent,s=e.bounds,l=e.transformState,c=l.scale,u=l.positionX,d=l.positionY;if(a&&t!==u&&n!==d&&s){var h=cse(t,n,s,i,r,o,a),f=h.x,p=h.y;e.setTransformState(c,f,p)}}(e,l,c,u,d)}}function xse(e){if(e.isPanning){var t=e.setup.panning.velocityDisabled,n=e.velocity,r=e.wrapperComponent,o=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var i=null==r?void 0:r.getBoundingClientRect(),a=null==o?void 0:o.getBoundingClientRect(),s=(null==i?void 0:i.width)||0,l=(null==i?void 0:i.height)||0,c=(null==a?void 0:a.width)||0,u=(null==a?void 0:a.height)||0,d=s.1&&d?function(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,i=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,i=o.disabled,a=o.velocityAnimation,s=e.transformState.scale;return!(a.disabled&&!(s>1)&&i&&!t||!n||!r)}(e);if(i&&t&&n&&o){var a=t.velocityX,s=t.velocityY,l=t.total,c=n.maxPositionX,u=n.minPositionX,d=n.maxPositionY,h=n.minPositionY,f=r.limitToBounds,p=r.alignmentAnimation,g=r.zoomAnimation,m=r.panning,v=m.lockAxisY,y=m.lockAxisX,b=g.animationType,x=p.sizeX,w=p.sizeY,k=p.velocityAlignmentTime,S=function(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,i=n.sensitivity;return r?o*t*i:o}(e,l),C=Math.max(S,k),_=gse(e,x),E=gse(e,w),L=_*o.offsetWidth/100,P=E*o.offsetHeight/100,O=c+L,M=u-L,T=d+P,A=h-P,I=e.transformState,R=(new Date).getTime();ise(e,b,C,(function(t){var n=e.transformState,r=n.scale,o=n.positionX,i=n.positionY,l=((new Date).getTime()-R)/k,g=1-(0,nse[p.animationType])(Math.min(1,l)),m=1-t,b=o+a*m,x=i+s*m,w=mse(b,I.positionX,o,y,f,u,c,M,O,g),S=mse(x,I.positionY,i,v,f,h,d,A,T,g);o===b&&i===x||e.setTransformState(r,w,S)}))}}(e):wse(e)}}function wse(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,i=o.disabled,a=o.sizeX,s=o.sizeY,l=o.animationTime,c=o.animationType;if(!(i||td||nf||rd?c.offsetWidth:e.setup.minPositionX||0,r>f?c.offsetHeight:e.setup.minPositionY||0,o,e.bounds,s||l),y=v.x,b=v.y;return{scale:o,positionX:g?y:n,positionY:m?b:r}}}(e);u&&ase(e,u,l,c)}}function kse(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,i=e.setup,a=i.minScale,s=i.limitToBounds,l=i.zoomAnimation,c=l.disabled,u=l.animationTime,d=l.animationType,h=c||r>=a;if((r>=1||s)&&wse(e),!h&&o&&e.mounted){var f=Sse(e,a,t||o.offsetWidth/2,n||o.offsetHeight/2);f&&ase(e,f,u,d)}}function Sse(e,t,n,r){var o=e.setup,i=o.minScale,a=o.maxScale,s=o.limitToBounds,l=hse(ese(t,2),i,a,0,!1),c=dse(e,n,r,l,lse(e,l),s);return{scale:l,positionX:c.x,positionY:c.y}}var Cse={previousScale:1,scale:1,positionX:0,positionY:0},_se=Qae(Qae({},Cse),{setComponents:function(){},contextInstance:null}),Ese={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,wheel:{step:.2,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},Lse=function(e){var t,n,r,o;return{previousScale:null!==(t=e.initialScale)&&void 0!==t?t:Cse.scale,scale:null!==(n=e.initialScale)&&void 0!==n?n:Cse.scale,positionX:null!==(r=e.initialPositionX)&&void 0!==r?r:Cse.positionX,positionY:null!==(o=e.initialPositionY)&&void 0!==o?o:Cse.positionY}},Pse=function(e){var t=Qae({},Ese);return Object.keys(e).forEach((function(n){var r=void 0!==e[n];if(void 0!==Ese[n]&&r){var o=Object.prototype.toString.call(Ese[n]),i="[object Object]"===o,a="[object Array]"===o;t[n]=i?Qae(Qae({},Ese[n]),e[n]):a?Jae(Jae([],Ese[n]),e[n]):e[n]}})),t},Ose=function(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,i=e.setup,a=i.maxScale,s=i.minScale,l=i.zoomAnimation.size;if(!o)throw new Error("Wrapper is not mounted");var c=r*Math.exp(t*n);return hse(ese(c,3),s,a,l,!1)};function Mse(e,t,n,r,o){var i=e.wrapperComponent,a=e.transformState,s=a.scale,l=a.positionX,c=a.positionY;if(!i)return console.error("No WrapperComponent found");var u=(i.offsetWidth/2-l)/s,d=(i.offsetHeight/2-c)/s,h=Sse(e,Ose(e,t,n),u,d);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");ase(e,h,r,o)}function Tse(e,t,n){var r=e.setup,o=e.wrapperComponent,i=r.limitToBounds,a=Lse(e.props),s=e.transformState,l=s.scale,c=s.positionX,u=s.positionY;if(o){var d=sse(e,a.scale),h=cse(a.positionX,a.positionY,d,i,0,0,o),f={scale:a.scale,positionX:h.x,positionY:h.y};l===a.scale&&c===a.positionX&&u===a.positionY||ase(e,f,t,n)}}var Ase=function(e){return function(t,n,r){void 0===t&&(t=.5),void 0===n&&(n=300),void 0===r&&(r="easeOut"),Mse(e,1,t,n,r)}},Ise=function(e){return function(t,n,r){void 0===t&&(t=.5),void 0===n&&(n=300),void 0===r&&(r="easeOut"),Mse(e,-1,t,n,r)}},Rse=function(e){return function(t,n,r,o,i){void 0===o&&(o=300),void 0===i&&(i="easeOut");var a=e.transformState,s=a.positionX,l=a.positionY,c=a.scale,u=e.wrapperComponent,d=e.contentComponent;if(!e.setup.disabled&&u&&d){var h={positionX:isNaN(t)?s:t,positionY:isNaN(n)?l:n,scale:isNaN(r)?c:r};ase(e,h,o,i)}}},Nse=function(e){return function(t,n){void 0===t&&(t=200),void 0===n&&(n="easeOut"),Tse(e,t,n)}},Dse=function(e){return function(t,n,r){void 0===n&&(n=200),void 0===r&&(r="easeOut");var o=e.transformState,i=e.wrapperComponent,a=e.contentComponent;if(i&&a){var s=Vse(t||o.scale,i,a);ase(e,s,n,r)}}},zse=function(e){return function(t,n,r,o){void 0===r&&(r=600),void 0===o&&(o="easeOut"),ose(e);var i=e.wrapperComponent,a="string"==typeof t?document.getElementById(t):t;if(i&&function(e){return e?void 0!==(null==e?void 0:e.offsetWidth)&&void 0!==(null==e?void 0:e.offsetHeight)||(console.error("Zoom node is not valid - it must contain offsetWidth and offsetHeight"),!1):(console.error("Zoom node not found"),!1)}(a)&&a&&i.contains(a)){var s=function(e,t,n){var r=e.wrapperComponent,o=e.setup,i=o.limitToBounds,a=o.minScale,s=o.maxScale;if(!r)return Cse;var l=r.getBoundingClientRect(),c=function(e){for(var t=e,n=0,r=0;t;)n+=t.offsetLeft,r+=t.offsetTop,t=t.offsetParent;return{x:n,y:r}}(t),u=c.x,d=c.y,h=t.offsetWidth,f=t.offsetHeight,p=r.offsetWidth/h,g=r.offsetHeight/f,m=hse(n||Math.min(p,g),a,s,0,!1),v=(l.width-h*m)/2,y=(l.height-f*m)/2,b=cse((l.left-u)*m+v,(l.top-d)*m+y,sse(e,m),i,0,0,r);return{positionX:b.x,positionY:b.y,scale:m}}(e,a,n);ase(e,s,r,o)}}},Bse=function(e){return{instance:e,state:e.transformState,zoomIn:Ase(e),zoomOut:Ise(e),setTransform:Rse(e),resetTransform:Nse(e),centerView:Dse(e),zoomToElement:zse(e)}};function jse(){try{return{get passive(){return!0,!1}}}catch(Jhe){return!1}}var Fse=function(e,t){var n=e.tagName.toUpperCase();return!!t.find((function(e){return e.toUpperCase()===n}))||!!t.find((function(t){return e.classList.contains(t)}))},Hse=function(e){e&&clearTimeout(e)},Wse=function(e,t,n){return"translate3d("+e+"px, "+t+"px, 0) scale("+n+")"},Vse=function(e,t,n){var r=n.offsetWidth*e,o=n.offsetHeight*e;return{scale:e,positionX:(t.offsetWidth-r)/2,positionY:(t.offsetHeight-o)/2}},Use=function(e,t){var n=e.setup.wheel,r=n.disabled,o=n.wheelDisabled,i=n.touchPadDisabled,a=n.excluded,s=e.isInitialized,l=e.isPanning,c=t.target;return!(!s||l||r||!c)&&(!(o&&!t.ctrlKey)&&((!i||!t.ctrlKey)&&!Fse(c,a)))};function $se(e,t,n){var r=t.getBoundingClientRect(),o=0,i=0;if("clientX"in e)o=(e.clientX-r.left)/n,i=(e.clientY-r.top)/n;else{var a=e.touches[0];o=(a.clientX-r.left)/n,i=(a.clientY-r.top)/n}return(isNaN(o)||isNaN(i))&&console.error("No mouse or touch offset found"),{x:o,y:i}}var Gse=function(e,t){var n=e.setup.pinch,r=n.disabled,o=n.excluded,i=e.isInitialized,a=t.target;return!(!i||r||!a)&&!Fse(a,o)},qse=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance;return!(!n||t||!r)},Yse=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},Zse=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(ose(e),tse(Bse(e),t,r),tse(Bse(e),t,o))},Xse=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,i=e.contentComponent,a=e.setup,s=e.transformState.scale,l=a.limitToBounds,c=a.centerZoomedOut,u=a.zoomAnimation,d=a.wheel,h=u.size,f=u.disabled,p=d.step;if(!i)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var g=function(e,t){var n,r,o=e?e.deltaY<0?1:-1:0;return r=o,"number"==typeof(n=t)?n:r}(t,null),m=function(e,t,n,r,o){var i=e.transformState.scale,a=e.wrapperComponent,s=e.setup,l=s.maxScale,c=s.minScale,u=s.zoomAnimation,d=u.size,h=u.disabled;if(!a)throw new Error("Wrapper is not mounted");var f=i+t*(i-i*n)*n;if(o)return f;var p=!r&&!h;return hse(ese(f,3),c,l,d,p)}(e,g,p,!t.ctrlKey);if(s!==m){var v=lse(e,m),y=$se(t,i,s),b=l&&(f||0===h||c),x=dse(e,y.x,y.y,m,v,b),w=x.x,k=x.y;e.previousWheelEvent=t,e.setTransformState(m,w,k),tse(Bse(e),t,r),tse(Bse(e),t,o)}},Kse=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;Hse(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout((function(){e.mounted&&(kse(e,t.x,t.y),e.wheelAnimationTimer=null)}),100);var i=function(e,t){var n=e.previousWheelEvent,r=e.transformState.scale,o=e.setup,i=o.maxScale,a=o.minScale;return!!n&&(ra||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY))}(e,t);i&&(Hse(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout((function(){e.mounted&&(e.wheelStopEventTimer=null,tse(Bse(e),t,r),tse(Bse(e),t,o))}),160))},Qse=function(e,t){var n=Yse(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,ose(e)},Jse=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,i=e.setup,a=i.limitToBounds,s=i.centerZoomedOut,l=i.zoomAnimation,c=l.disabled,u=l.size;if(null!==r&&n){var d=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,i=ese(o[0].clientX-r.left,5),a=ese(o[0].clientY-r.top,5);return{x:(i+ese(o[1].clientX-r.left,5))/2/t,y:(a+ese(o[1].clientY-r.top,5))/2/t}}(t,o,n);if(isFinite(d.x)&&isFinite(d.y)){var h=Yse(t),f=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,i=o.maxScale,a=o.minScale,s=o.zoomAnimation,l=s.size,c=s.disabled;if(!n||null===r||!t)throw new Error("Pinch touches distance was not provided");return t<0?e.transformState.scale:hse(ese(t/r*n,2),a,i,l,!c)}(e,h);if(f!==o){var p=lse(e,f),g=a&&(c||0===u||s),m=dse(e,d.x,d.y,f,p,g),v=m.x,y=m.y;e.pinchMidpoint=d,e.lastDistance=h,e.setTransformState(f,v,y)}}}},ele=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,kse(e,null==t?void 0:t.x,null==t?void 0:t.y)};function tle(e,t){var n=e.setup.doubleClick,r=n.disabled,o=n.mode,i=n.step,a=n.animationTime,s=n.animationType;if(!r){if("reset"===o)return Tse(e,a,s);var l=e.transformState.scale,c=e.contentComponent;if(!c)return console.error("No ContentComponent found");var u=Ose(e,"zoomOut"===o?-1:1,i),d=$se(t,c,l),h=Sse(e,u,d.x,d.y);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");ase(e,h,a,s)}}var nle=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,i=r.doubleClick,a=i.disabled,s=i.excluded,l=t.target,c=null==o?void 0:o.contains(l),u=n&&l&&c&&!a;return!!u&&(!Fse(l,s)&&!!u)},rle=H.createContext(_se),ole=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mounted=!0,t.transformState=Lse(t.props),t.setup=Pse(t.props),t.wrapperComponent=null,t.contentComponent=null,t.isInitialized=!1,t.bounds=null,t.previousWheelEvent=null,t.wheelStopEventTimer=null,t.wheelAnimationTimer=null,t.isPanning=!1,t.startCoords=null,t.lastTouch=null,t.distance=null,t.lastDistance=null,t.pinchStartDistance=null,t.pinchStartScale=null,t.pinchMidpoint=null,t.velocity=null,t.velocityTime=null,t.lastMousePosition=null,t.animate=!1,t.animation=null,t.maxBounds=null,t.pressedKeys={},t.handleInitializeWrapperEvents=function(e){var n=jse();e.addEventListener("wheel",t.onWheelZoom,n),e.addEventListener("dblclick",t.onDoubleClick,n),e.addEventListener("touchstart",t.onTouchPanningStart,n),e.addEventListener("touchmove",t.onTouchPanning,n),e.addEventListener("touchend",t.onTouchPanningStop,n)},t.handleInitialize=function(){var e=t.setup.centerOnInit;t.applyTransformation(),t.forceUpdate(),e&&(setTimeout((function(){t.mounted&&t.setCenter()}),50),setTimeout((function(){t.mounted&&t.setCenter()}),100),setTimeout((function(){t.mounted&&t.setCenter()}),200))},t.onWheelZoom=function(e){t.setup.disabled||Use(t,e)&&t.isPressingKeys(t.setup.wheel.activationKeys)&&(Zse(t,e),Xse(t,e),Kse(t,e))},t.onPanningStart=function(e){var n=t.setup.disabled,r=t.props.onPanningStart;n||fse(t,e)&&t.isPressingKeys(t.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),ose(t),yse(t,e),tse(Bse(t),e,r))},t.onPanning=function(e){var n=t.setup.disabled,r=t.props.onPanning;n||pse(t)&&t.isPressingKeys(t.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),bse(t,e.clientX,e.clientY),tse(Bse(t),e,r))},t.onPanningStop=function(e){var n=t.props.onPanningStop;t.isPanning&&(xse(t),tse(Bse(t),e,n))},t.onPinchStart=function(e){var n=t.setup.disabled,r=t.props,o=r.onPinchingStart,i=r.onZoomStart;n||Gse(t,e)&&(Qse(t,e),ose(t),tse(Bse(t),e,o),tse(Bse(t),e,i))},t.onPinch=function(e){var n=t.setup.disabled,r=t.props,o=r.onPinching,i=r.onZoom;n||qse(t)&&(e.preventDefault(),e.stopPropagation(),Jse(t,e),tse(Bse(t),e,o),tse(Bse(t),e,i))},t.onPinchStop=function(e){var n=t.props,r=n.onPinchingStop,o=n.onZoomStop;t.pinchStartScale&&(ele(t),tse(Bse(t),e,r),tse(Bse(t),e,o))},t.onTouchPanningStart=function(e){var n=t.setup.disabled,r=t.props.onPanningStart;if(!n&&fse(t,e))if(t.lastTouch&&+new Date-t.lastTouch<200&&1===e.touches.length)t.onDoubleClick(e);else{t.lastTouch=+new Date,ose(t);var o=e.touches,i=1===o.length,a=2===o.length;i&&(ose(t),yse(t,e),tse(Bse(t),e,r)),a&&t.onPinchStart(e)}},t.onTouchPanning=function(e){var n=t.setup.disabled,r=t.props.onPanning;if(t.isPanning&&1===e.touches.length){if(n)return;if(!pse(t))return;e.preventDefault(),e.stopPropagation();var o=e.touches[0];bse(t,o.clientX,o.clientY),tse(Bse(t),e,r)}else e.touches.length>1&&t.onPinch(e)},t.onTouchPanningStop=function(e){t.onPanningStop(e),t.onPinchStop(e)},t.onDoubleClick=function(e){t.setup.disabled||nle(t,e)&&tle(t,e)},t.clearPanning=function(e){t.isPanning&&t.onPanningStop(e)},t.setKeyPressed=function(e){t.pressedKeys[e.key]=!0},t.setKeyUnPressed=function(e){t.pressedKeys[e.key]=!1},t.isPressingKeys=function(e){return!e.length||Boolean(e.find((function(e){return t.pressedKeys[e]})))},t.setComponents=function(e,n){t.wrapperComponent=e,t.contentComponent=n,lse(t,t.transformState.scale),t.handleInitializeWrapperEvents(e),t.handleInitialize(),t.handleRef(),t.isInitialized=!0,tse(Bse(t),void 0,t.props.onInit)},t.setTransformState=function(e,n,r){isNaN(e)||isNaN(n)||isNaN(r)?console.error("Detected NaN set state values"):(e!==t.transformState.scale&&(t.transformState.previousScale=t.transformState.scale,t.transformState.scale=e),t.transformState.positionX=n,t.transformState.positionY=r,t.applyTransformation())},t.setCenter=function(){if(t.wrapperComponent&&t.contentComponent){var e=Vse(t.transformState.scale,t.wrapperComponent,t.contentComponent);t.setTransformState(e.scale,e.positionX,e.positionY)}},t.applyTransformation=function(){if(t.mounted&&t.contentComponent){var e=t.transformState,n=e.scale,r=e.positionX,o=e.positionY,i=Wse(r,o,n);t.contentComponent.style.transform=i,t.handleRef()}},t.handleRef=function(){t.props.setRef(Bse(t))},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Kae(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){var e=jse();window.addEventListener("mousedown",this.onPanningStart,e),window.addEventListener("mousemove",this.onPanning,e),window.addEventListener("mouseup",this.onPanningStop,e),document.addEventListener("mouseleave",this.clearPanning,e),window.addEventListener("keyup",this.setKeyUnPressed,e),window.addEventListener("keydown",this.setKeyPressed,e),this.handleRef()},t.prototype.componentWillUnmount=function(){var e=jse();window.removeEventListener("mousedown",this.onPanningStart,e),window.removeEventListener("mousemove",this.onPanning,e),window.removeEventListener("mouseup",this.onPanningStop,e),window.removeEventListener("keyup",this.setKeyUnPressed,e),window.removeEventListener("keydown",this.setKeyPressed,e),ose(this)},t.prototype.componentDidUpdate=function(e){e!==this.props&&(lse(this,this.transformState.scale),this.setup=Pse(this.props))},t.prototype.render=function(){var e=Bse(this),t=this.props.children,n="function"==typeof t?t(e):t;return ld(rle.Provider,{value:Qae(Qae({},this.transformState),{setComponents:this.setComponents,contextInstance:this}),children:n})},t}(a.exports.Component),ile=H.forwardRef((function(e,t){var n=a.exports.useState(null),r=n[0],o=n[1];return a.exports.useImperativeHandle(t,(function(){return r}),[r]),ld(ole,{...Qae({},e,{setRef:o})})}));var ale="transform-component-module_wrapper__1_Fgj",sle="transform-component-module_content__2jYgh";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".transform-component-module_wrapper__1_Fgj {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n}\n.transform-component-module_content__2jYgh {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__2jYgh img {\n pointer-events: none;\n}\n");var lle=function(e){var t=e.children,n=e.wrapperClass,r=void 0===n?"":n,o=e.contentClass,i=void 0===o?"":o,s=e.wrapperStyle,l=e.contentStyle,c=a.exports.useContext(rle).setComponents,u=a.exports.useRef(null),d=a.exports.useRef(null);return a.exports.useEffect((function(){var e=u.current,t=d.current;null!==e&&null!==t&&c&&c(e,t)}),[]),ld("div",{ref:u,className:"react-transform-wrapper "+ale+" "+r,style:s,children:ld("div",{ref:d,className:"react-transform-component "+sle+" "+i,style:l,children:t})})};function cle({image:e,alt:t,ref:n,styleClass:r}){const[o,i]=a.exports.useState(0),[s,l]=a.exports.useState(!1),c=()=>{i(-3===o?0:o-1)},u=()=>{i(3===o?0:o+1)},d=()=>{l(!s)};return ld(ile,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:({zoomIn:a,zoomOut:h,resetTransform:f,centerView:p})=>cd(sd,{children:[cd("div",{className:"lightbox-image-options",children:[ld(S3,{icon:ld(R9,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>a(),fontSize:20}),ld(S3,{icon:ld(N9,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>h(),fontSize:20}),ld(S3,{icon:ld(A9,{}),"aria-label":"Rotate Left",tooltip:"Rotate Left",onClick:c,fontSize:20}),ld(S3,{icon:ld(I9,{}),"aria-label":"Rotate Right",tooltip:"Rotate Right",onClick:u,fontSize:20}),ld(S3,{icon:ld(Y3,{}),"aria-label":"Flip Image",tooltip:"Flip Image",onClick:d,fontSize:20}),ld(S3,{icon:ld(T9,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{f(),i(0),l(!1)},fontSize:20})]}),ld(lle,{wrapperStyle:{width:"100%",height:"100%"},children:ld("img",{style:{transform:`rotate(${90*o}deg) scaleX(${s?-1:1})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>p(1,0,"easeOut")})})]})})}function ule(){const e=v5(),t=y5((e=>e.options.isLightBoxOpen)),{viewerImageToDisplay:n,shouldShowImageDetails:r,isOnFirstImage:o,isOnLastImage:i}=y5(sre),[s,l]=a.exports.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)};return Cte("Esc",(()=>{t&&e(qU(!1))}),[t]),cd("div",{className:"lightbox-container",children:[ld(S3,{icon:ld(M9,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(qU(!1))},fontSize:20}),cd("div",{className:"lightbox-display-container",children:[cd("div",{className:"lightbox-preview-wrapper",children:[ld(rre,{}),!r&&cd("div",{className:"current-image-next-prev-buttons",children:[ld("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!o&&ld(zT,{"aria-label":"Previous image",icon:ld(T5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(H$())}})}),ld("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!i&&ld(zT,{"aria-label":"Next image",icon:ld(A5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(F$())}})})]}),n&&cd(sd,{children:[ld(cle,{image:n.url,styleClass:"lightbox-image"}),r&&ld(are,{image:n})]})]}),ld(Hae,{})]})]})}function dle(){const e=v5(),t=y5((e=>e.options.seamBlur)),{t:n}=HY();return ld(Wte,{sliderMarkRightOffset:-4,label:n("options:seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:t=>{e(t$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(t$(16))}})}function hle(){const e=v5(),{t:t}=HY(),n=y5((e=>e.options.seamSize));return ld(Wte,{sliderMarkRightOffset:-6,label:t("options:seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:t=>{e(r$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(r$(96))})}function fle(){const{t:e}=HY(),t=y5((e=>e.options.seamSteps)),n=v5();return ld(Wte,{sliderMarkRightOffset:-4,label:e("options:seamSteps"),min:1,max:32,sliderNumberInputProps:{max:999},value:t,onChange:e=>{n(o$(e))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(o$(10))}})}function ple(){const e=v5(),{t:t}=HY(),n=y5((e=>e.options.seamStrength));return ld(Wte,{sliderMarkRightOffset:-7,label:t("options:seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:t=>{e(i$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(i$(.7))}})}const gle=()=>cd(CI,{direction:"column",gap:"1rem",children:[ld(hle,{}),ld(dle,{}),ld(ple,{}),ld(fle,{})]}),mle=uV(bne,(e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),vle=()=>{const e=v5(),{boundingBoxDimensions:t}=y5(mle),{t:n}=HY();return cd(CI,{direction:"column",gap:"1rem",children:[ld(Wte,{label:n("options:width"),min:64,max:1024,step:64,value:t.width,onChange:n=>{e(QZ({...t,width:Math.floor(n)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(QZ({...t,width:Math.floor(512)}))}}),ld(Wte,{label:n("options:height"),min:64,max:1024,step:64,value:t.height,onChange:n=>{e(QZ({...t,height:Math.floor(n)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(QZ({...t,height:Math.floor(512)}))}})]})},yle=uV(bne,(e=>{const{inpaintReplace:t,shouldUseInpaintReplace:n}=e;return{inpaintReplace:t,shouldUseInpaintReplace:n}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function ble(){const{inpaintReplace:e,shouldUseInpaintReplace:t}=y5(yle),n=v5(),{t:r}=HY();return cd(CI,{alignItems:"center",columnGap:"1rem",children:[ld(Wte,{label:r("options:inpaintReplace"),value:e,onChange:e=>{n(lX(e))},min:0,max:1,step:.05,isInteger:!1,isSliderDisabled:!t,withSliderMarks:!0,sliderMarkRightOffset:-2,withReset:!0,handleReset:()=>n(lX(1)),isResetDisabled:!t}),ld(E3,{isChecked:t,onChange:e=>n(NX(e.target.checked)),marginTop:"1.25rem"})]})}const xle=uV([I3,M3,bne],((e,t,n)=>{const{tileSize:r,infillMethod:o}=e,{infill_methods:i}=t,{boundingBoxScaleMethod:a,scaledBoundingBoxDimensions:s}=n;return{boundingBoxScale:a,scaledBoundingBoxDimensions:s,tileSize:r,infillMethod:o,availableInfillMethods:i,isManual:"manual"===a}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),wle=()=>{const e=v5(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:o,isManual:i,scaledBoundingBoxDimensions:a}=y5(xle),{t:s}=HY();return cd(CI,{direction:"column",gap:"1rem",children:[ld(L3,{label:s("options:scaleBeforeProcessing"),validValues:_Z,value:o,onChange:t=>{e(eX(t.target.value))}}),ld(Wte,{isInputDisabled:!i,isResetDisabled:!i,isSliderDisabled:!i,label:s("options:scaledWidth"),min:64,max:1024,step:64,value:a.width,onChange:t=>{e(WX({...a,width:Math.floor(t)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(WX({...a,width:Math.floor(512)}))}}),ld(Wte,{isInputDisabled:!i,isResetDisabled:!i,isSliderDisabled:!i,label:s("options:scaledHeight"),min:64,max:1024,step:64,value:a.height,onChange:t=>{e(WX({...a,height:Math.floor(t)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(WX({...a,height:Math.floor(512)}))}}),ld(ble,{}),ld(L3,{label:s("options:infillMethod"),value:n,validValues:r,onChange:t=>e($U(t.target.value))}),ld(Wte,{isInputDisabled:"tile"!==n,isResetDisabled:"tile"!==n,isSliderDisabled:"tile"!==n,sliderMarkRightOffset:-4,label:s("options:tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:t=>{e(k$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(k$(32))}})]})};function kle(){const{t:e}=HY(),t={boundingBox:{header:`${e("options:boundingBoxHeader")}`,feature:Nte.BOUNDING_BOX,content:ld(vle,{})},seamCorrection:{header:`${e("options:seamCorrectionHeader")}`,feature:Nte.SEAM_CORRECTION,content:ld(gle,{})},infillAndScaling:{header:`${e("options:infillScalingHeader")}`,feature:Nte.INFILL_AND_SCALING,content:ld(wle,{})},seed:{header:`${e("options:seed")}`,feature:Nte.SEED,content:ld(Kte,{})},variations:{header:`${e("options:variations")}`,feature:Nte.VARIATIONS,content:ld(ine,{}),additionalHeaderComponents:ld(nne,{})}};return cd(Xne,{children:[ld(Mne,{}),ld(Pne,{}),ld(fne,{}),ld(Vte,{label:e("options:img2imgStrength"),styleClass:"main-option-block image-to-image-strength-main-option"}),ld(yne,{accordionInfo:t})]})}const Sle=uV(bne,wne,A3,((e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}})),Cle=()=>{const e=v5(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=y5(Sle),i=a.exports.useRef(null);return a.exports.useLayoutEffect((()=>{window.setTimeout((()=>{if(!i.current)return;const{clientWidth:t,clientHeight:n}=i.current;e(rX({width:t,height:n})),e(o?XZ():ZZ()),e(aX(!1))}),0)}),[e,r,t,n,o]),ld("div",{ref:i,className:"inpainting-canvas-area",children:ld(hT,{thickness:"2px",speed:"1s",size:"xl"})})};var _le={exports:{}},Ele=function(e){var t={},n=a.exports,r=G.exports,o=Object.assign;function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n--s||o[a]!==i[s]){var l="\n"+o[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}}while(1<=a&&0<=s);break}}}finally{rt=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?nt(e):""}var it=Object.prototype.hasOwnProperty,at=[],st=-1;function lt(e){return{current:e}}function ct(e){0>st||(e.current=at[st],at[st]=null,st--)}function ut(e,t){st++,at[st]=e.current,e.current=t}var dt={},ht=lt(dt),ft=lt(!1),pt=dt;function gt(e,t){var n=e.type.contextTypes;if(!n)return dt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,i={};for(o in n)i[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function mt(e){return null!=(e=e.childContextTypes)}function vt(){ct(ft),ct(ht)}function yt(e,t,n){if(ht.current!==dt)throw Error(i(168));ut(ht,t),ut(ft,n)}function bt(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(i(108,C(e)||"Unknown",a));return o({},n,r)}function xt(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||dt,pt=ht.current,ut(ht,e),ut(ft,ft.current),!0}function wt(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=bt(e,t,pt),r.__reactInternalMemoizedMergedChildContext=e,ct(ft),ct(ht),ut(ht,e)):ct(ft),ut(ft,n)}var kt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(St(e)/Ct|0)|0},St=Math.log,Ct=Math.LN2;var _t=64,Et=4194304;function Lt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pt(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,a=268435455&n;if(0!==a){var s=a&~o;0!==s?r=Lt(s):0!==(i&=a)&&(r=Lt(i))}else 0!==(a=n&~o)?r=Lt(a):0!==i&&(r=Lt(i));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&o)&&((o=r&-r)>=(i=t&-t)||16===o&&0!=(4194240&i)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function It(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-kt(t)]=n}function Rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-kt(n),o=1<>=a,o-=a,cn=1<<32-kt(t)+o|n<h?(f=d,d=null):f=d.sibling;var p=m(o,d,s[h],l);if(null===p){null===d&&(d=f);break}e&&d&&null===p.alternate&&t(o,d),i=a(p,i,h),null===u?c=p:u.sibling=p,u=p,d=f}if(h===s.length)return n(o,d),vn&&dn(o,h),c;if(null===d){for(;hf?(p=h,h=null):p=h.sibling;var b=m(o,h,y.value,c);if(null===b){null===h&&(h=p);break}e&&h&&null===b.alternate&&t(o,h),s=a(b,s,f),null===d?u=b:d.sibling=b,d=b,h=p}if(y.done)return n(o,h),vn&&dn(o,f),u;if(null===h){for(;!y.done;f++,y=l.next())null!==(y=g(o,y.value,c))&&(s=a(y,s,f),null===d?u=y:d.sibling=y,d=y);return vn&&dn(o,f),u}for(h=r(o,h);!y.done;f++,y=l.next())null!==(y=v(h,o,f,y.value,c))&&(e&&null!==y.alternate&&h.delete(null===y.key?f:y.key),s=a(y,s,f),null===d?u=y:d.sibling=y,d=y);return e&&h.forEach((function(e){return t(o,e)})),vn&&dn(o,f),u}return function e(r,i,a,d){if("object"==typeof a&&null!==a&&a.type===u&&null===a.key&&(a=a.props.children),"object"==typeof a&&null!==a){switch(a.$$typeof){case l:e:{for(var h=a.key,f=i;null!==f;){if(f.key===h){if((h=a.type)===u){if(7===f.tag){n(r,f.sibling),(i=o(f,a.props.children)).return=r,r=i;break e}}else if(f.elementType===h||"object"==typeof h&&null!==h&&h.$$typeof===b&&dr(h)===f.type){n(r,f.sibling),(i=o(f,a.props)).ref=cr(r,f,a),i.return=r,r=i;break e}n(r,f);break}t(r,f),f=f.sibling}a.type===u?((i=fs(a.props.children,r.mode,d,a.key)).return=r,r=i):((d=hs(a.type,a.key,a.props,null,r.mode,d)).ref=cr(r,i,a),d.return=r,r=d)}return s(r);case c:e:{for(f=a.key;null!==i;){if(i.key===f){if(4===i.tag&&i.stateNode.containerInfo===a.containerInfo&&i.stateNode.implementation===a.implementation){n(r,i.sibling),(i=o(i,a.children||[])).return=r,r=i;break e}n(r,i);break}t(r,i),i=i.sibling}(i=ms(a,r.mode,d)).return=r,r=i}return s(r);case b:return e(r,i,(f=a._init)(a._payload),d)}if(A(a))return y(r,i,a,d);if(k(a))return x(r,i,a,d);ur(r,a)}return"string"==typeof a&&""!==a||"number"==typeof a?(a=""+a,null!==i&&6===i.tag?(n(r,i.sibling),(i=o(i,a)).return=r,r=i):(n(r,i),(i=gs(a,r.mode,d)).return=r,r=i),s(r)):n(r,i)}}var fr=hr(!0),pr=hr(!1),gr={},mr=lt(gr),vr=lt(gr),yr=lt(gr);function br(e){if(e===gr)throw Error(i(174));return e}function xr(e,t){ut(yr,t),ut(vr,e),ut(mr,gr),e=R(t),ct(mr),ut(mr,e)}function wr(){ct(mr),ct(vr),ct(yr)}function kr(e){var t=br(yr.current),n=br(mr.current);n!==(t=N(n,e.type,t))&&(ut(vr,e),ut(mr,t))}function Sr(e){vr.current===e&&(ct(mr),ct(vr))}var Cr=lt(0);function _r(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ze(n)||Be(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Er=[];function Lr(){for(var e=0;en?n:4,e(!0);var r=Or.transition;Or.transition={};try{e(!1),t()}finally{Nt=n,Or.transition=r}}function vo(){return Vr().memoizedState}function yo(e,t,n){var r=Ra(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xo(e))wo(t,n);else if(null!==(n=$n(e,t,n,r))){Na(n,e,r,Ia()),ko(n,t,r)}}function bo(e,t,n){var r=Ra(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xo(e))wo(t,o);else{var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=i(a,n);if(o.hasEagerState=!0,o.eagerState=s,Yt(s,a)){var l=t.interleaved;return null===l?(o.next=o,Un(t)):(o.next=l.next,l.next=o),void(t.interleaved=o)}}catch(U2){}null!==(n=$n(e,t,o,r))&&(Na(n,e,r,o=Ia()),ko(n,t,r))}}function xo(e){var t=e.alternate;return e===Tr||null!==t&&t===Tr}function wo(e,t){Nr=Rr=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ko(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Rt(e,n)}}var So={readContext:Wn,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:!1},Co={readContext:Wn,useCallback:function(e,t){return Wr().memoizedState=[e,void 0===t?null:t],e},useContext:Wn,useEffect:io,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,ro(4194308,4,co.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ro(4194308,4,e,t)},useInsertionEffect:function(e,t){return ro(4,2,e,t)},useMemo:function(e,t){var n=Wr();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wr();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=yo.bind(null,Tr,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Wr().memoizedState=e},useState:eo,useDebugValue:ho,useDeferredValue:function(e){return Wr().memoizedState=e},useTransition:function(){var e=eo(!1),t=e[0];return e=mo.bind(null,e[1]),Wr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Tr,o=Wr();if(vn){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===aa)throw Error(i(349));0!=(30&Mr)||Zr(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,io(Kr.bind(null,r,a,e),[e]),r.flags|=2048,to(9,Xr.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Wr(),t=aa.identifierPrefix;if(vn){var n=un;t=":"+t+"R"+(n=(cn&~(1<<32-kt(cn)-1)).toString(32)+n),0<(n=Dr++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=zr++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_o={readContext:Wn,useCallback:fo,useContext:Wn,useEffect:ao,useImperativeHandle:uo,useInsertionEffect:so,useLayoutEffect:lo,useMemo:po,useReducer:$r,useRef:no,useState:function(){return $r(Ur)},useDebugValue:ho,useDeferredValue:function(e){return go(Vr(),Ar.memoizedState,e)},useTransition:function(){return[$r(Ur)[0],Vr().memoizedState]},useMutableSource:qr,useSyncExternalStore:Yr,useId:vo,unstable_isNewReconciler:!1},Eo={readContext:Wn,useCallback:fo,useContext:Wn,useEffect:ao,useImperativeHandle:uo,useInsertionEffect:so,useLayoutEffect:lo,useMemo:po,useReducer:Gr,useRef:no,useState:function(){return Gr(Ur)},useDebugValue:ho,useDeferredValue:function(e){var t=Vr();return null===Ar?t.memoizedState=e:go(t,Ar.memoizedState,e)},useTransition:function(){return[Gr(Ur)[0],Vr().memoizedState]},useMutableSource:qr,useSyncExternalStore:Yr,useId:vo,unstable_isNewReconciler:!1};function Lo(e,t){try{var n="",r=t;do{n+=Tn(r),r=r.return}while(r);var o=n}catch(pue){o="\nError generating stack: "+pue.message+"\n"+pue.stack}return{value:e,source:t,stack:o,digest:null}}function Po(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function Oo(e,t){try{console.error(t.value)}catch(due){setTimeout((function(){throw due}))}}var Mo="function"==typeof WeakMap?WeakMap:Map;function To(e,t,n){(n=Xn(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Sa||(Sa=!0,Ca=r),Oo(0,t)},n}function Ao(e,t,n){(n=Xn(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Oo(0,t)}}var i=e.stateNode;return null!==i&&"function"==typeof i.componentDidCatch&&(n.callback=function(){Oo(0,t),"function"!=typeof r&&(null===_a?_a=new Set([this]):_a.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function Io(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new Mo;var o=new Set;r.set(t,o)}else void 0===(o=r.get(t))&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=rs.bind(null,e,t,n),t.then(e,e))}function Ro(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function No(e,t,n,r,o){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Xn(-1,1)).tag=2,Kn(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var Do=s.ReactCurrentOwner,zo=!1;function Bo(e,t,n,r){t.child=null===e?pr(t,null,n,r):fr(t,e.child,n,r)}function jo(e,t,n,r,o){n=n.render;var i=t.ref;return Hn(t,o),r=Fr(e,t,n,r,i,o),n=Hr(),null===e||zo?(vn&&n&&fn(t),t.flags|=1,Bo(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,li(e,t,o))}function Fo(e,t,n,r,o){if(null===e){var i=n.type;return"function"!=typeof i||us(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=hs(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,Ho(e,t,i,r,o))}if(i=e.child,0==(e.lanes&o)){var a=i.memoizedProps;if((n=null!==(n=n.compare)?n:Mn)(a,r)&&e.ref===t.ref)return li(e,t,o)}return t.flags|=1,(e=ds(i,r)).ref=t.ref,e.return=t,t.child=e}function Ho(e,t,n,r,o){if(null!==e){var i=e.memoizedProps;if(Mn(i,r)&&e.ref===t.ref){if(zo=!1,t.pendingProps=r=i,0==(e.lanes&o))return t.lanes=e.lanes,li(e,t,o);0!=(131072&e.flags)&&(zo=!0)}}return Uo(e,t,n,r,o)}function Wo(e,t,n){var r=t.pendingProps,o=r.children,i=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(ua,ca),ca|=n;else{if(0==(1073741824&n))return e=null!==i?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ut(ua,ca),ca|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==i?i.baseLanes:n,ut(ua,ca),ca|=r}else null!==i?(r=i.baseLanes|n,t.memoizedState=null):r=n,ut(ua,ca),ca|=r;return Bo(e,t,o,n),t.child}function Vo(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Uo(e,t,n,r,o){var i=mt(n)?pt:ht.current;return i=gt(t,i),Hn(t,o),n=Fr(e,t,n,r,i,o),r=Hr(),null===e||zo?(vn&&r&&fn(t),t.flags|=1,Bo(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,li(e,t,o))}function $o(e,t,n,r,o){if(mt(n)){var i=!0;xt(t)}else i=!1;if(Hn(t,o),null===t.stateNode)si(e,t),ar(t,n,r),lr(t,n,r,o),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,c=n.contextType;"object"==typeof c&&null!==c?c=Wn(c):c=gt(t,c=mt(n)?pt:ht.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==c)&&sr(t,a,r,c),qn=!1;var h=t.memoizedState;a.state=h,er(t,r,a,o),l=t.memoizedState,s!==r||h!==l||ft.current||qn?("function"==typeof u&&(rr(t,n,u,r),l=t.memoizedState),(s=qn||ir(t,n,s,r,h,l,c))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Zn(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:An(t.type,s),a.props=c,d=t.pendingProps,h=a.context,"object"==typeof(l=n.contextType)&&null!==l?l=Wn(l):l=gt(t,l=mt(n)?pt:ht.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||h!==l)&&sr(t,a,r,l),qn=!1,h=t.memoizedState,a.state=h,er(t,r,a,o);var p=t.memoizedState;s!==d||h!==p||ft.current||qn?("function"==typeof f&&(rr(t,n,f,r),p=t.memoizedState),(c=qn||ir(t,n,c,r,h,p,l)||!1)?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Go(e,t,n,r,i,o)}function Go(e,t,n,r,o,i){Vo(e,t);var a=0!=(128&t.flags);if(!r&&!a)return o&&wt(t,n,!1),li(e,t,i);r=t.stateNode,Do.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=fr(t,e.child,null,i),t.child=fr(t,null,s,i)):Bo(e,t,s,i),t.memoizedState=r.state,o&&wt(t,n,!0),t.child}function qo(e){var t=e.stateNode;t.pendingContext?yt(0,t.pendingContext,t.pendingContext!==t.context):t.context&&yt(0,t.context,!1),xr(e,t.containerInfo)}function Yo(e,t,n,r,o){return Ln(),Pn(o),t.flags|=256,Bo(e,t,n,r),t.child}var Zo,Xo,Ko,Qo,Jo={dehydrated:null,treeContext:null,retryLane:0};function ei(e){return{baseLanes:e,cachePool:null,transitions:null}}function ti(e,t,n){var r,o=t.pendingProps,a=Cr.current,s=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&a)),r?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),ut(Cr,1&a),null===e)return Sn(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:Be(e)?t.lanes=8:t.lanes=1073741824,null):(l=o.children,e=o.fallback,s?(o=t.mode,s=t.child,l={mode:"hidden",children:l},0==(1&o)&&null!==s?(s.childLanes=0,s.pendingProps=l):s=ps(l,o,0,null),e=fs(e,o,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=ei(n),t.memoizedState=Jo,e):ni(t,l));if(null!==(a=e.memoizedState)&&null!==(r=a.dehydrated))return function(e,t,n,r,o,a,s){if(n)return 256&t.flags?(t.flags&=-257,ri(e,t,s,r=Po(Error(i(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=r.fallback,o=t.mode,r=ps({mode:"visible",children:r.children},o,0,null),(a=fs(a,o,s,null)).flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,0!=(1&t.mode)&&fr(t,e.child,null,s),t.child.memoizedState=ei(s),t.memoizedState=Jo,a);if(0==(1&t.mode))return ri(e,t,s,null);if(Be(o))return r=je(o).digest,a=Error(i(419)),r=Po(a,r,void 0),ri(e,t,s,r);if(n=0!=(s&e.childLanes),zo||n){if(null!==(r=aa)){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!=(o&(r.suspendedLanes|s))?0:o)&&o!==a.retryLane&&(a.retryLane=o,Gn(e,o),Na(r,e,o,-1))}return qa(),ri(e,t,s,r=Po(Error(i(421))))}return ze(o)?(t.flags|=128,t.child=e.child,t=is.bind(null,e),Fe(o,t),null):(e=a.treeContext,K&&(mn=Ue(o),gn=t,vn=!0,bn=null,yn=!1,null!==e&&(an[sn++]=cn,an[sn++]=un,an[sn++]=ln,cn=e.id,un=e.overflow,ln=t)),t=ni(t,r.children),t.flags|=4096,t)}(e,t,l,o,r,a,n);if(s){s=o.fallback,l=t.mode,r=(a=e.child).sibling;var c={mode:"hidden",children:o.children};return 0==(1&l)&&t.child!==a?((o=t.child).childLanes=0,o.pendingProps=c,t.deletions=null):(o=ds(a,c)).subtreeFlags=14680064&a.subtreeFlags,null!==r?s=ds(r,s):(s=fs(s,l,n,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,l=null===(l=e.child.memoizedState)?ei(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},s.memoizedState=l,s.childLanes=e.childLanes&~n,t.memoizedState=Jo,o}return e=(s=e.child).sibling,o=ds(s,{mode:"visible",children:o.children}),0==(1&t.mode)&&(o.lanes=n),o.return=t,o.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function ni(e,t){return(t=ps({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ri(e,t,n,r){return null!==r&&Pn(r),fr(t,e.child,null,n),(e=ni(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function oi(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Fn(e.return,t,n)}function ii(e,t,n,r,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function ai(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Bo(e,t,r.children,n),0!=(2&(r=Cr.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&oi(e,n,t);else if(19===e.tag)oi(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ut(Cr,r),0==(1&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===_r(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),ii(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===_r(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}ii(t,!0,n,null,i);break;case"together":ii(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function si(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function li(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),fa|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=ds(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=ds(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function ci(e){e.flags|=4}function ui(e,t){if(null!==e&&e.child===t.child)return!0;if(0!=(16&t.flags))return!1;for(e=t.child;null!==e;){if(0!=(12854&e.flags)||0!=(12854&e.subtreeFlags))return!1;e=e.sibling}return!0}if(Z)Zo=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)j(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Xo=function(){},Ko=function(e,t,n,r,o){if((e=e.memoizedProps)!==r){var i=t.stateNode,a=br(mr.current);n=H(i,n,e,r,o,a),(t.updateQueue=n)&&ci(t)}},Qo=function(e,t,n,r){n!==r&&ci(t)};else if(X){Zo=function(e,t,n,r){for(var o=t.child;null!==o;){if(5===o.tag){var i=o.stateNode;n&&r&&(i=Ae(i,o.type,o.memoizedProps,o)),j(e,i)}else if(6===o.tag)i=o.stateNode,n&&r&&(i=Ie(i,o.memoizedProps,o)),j(e,i);else if(4!==o.tag)if(22===o.tag&&null!==o.memoizedState)null!==(i=o.child)&&(i.return=o),Zo(e,o,!0,!0);else if(null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}};var di=function(e,t,n,r){for(var o=t.child;null!==o;){if(5===o.tag){var i=o.stateNode;n&&r&&(i=Ae(i,o.type,o.memoizedProps,o)),Oe(e,i)}else if(6===o.tag)i=o.stateNode,n&&r&&(i=Ie(i,o.memoizedProps,o)),Oe(e,i);else if(4!==o.tag)if(22===o.tag&&null!==o.memoizedState)null!==(i=o.child)&&(i.return=o),di(e,o,!0,!0);else if(null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}};Xo=function(e,t){var n=t.stateNode;if(!ui(e,t)){e=n.containerInfo;var r=Pe(e);di(r,t,!1,!1),n.pendingChildren=r,ci(t),Me(e,r)}},Ko=function(e,t,n,r,o){var i=e.stateNode,a=e.memoizedProps;if((e=ui(e,t))&&a===r)t.stateNode=i;else{var s=t.stateNode,l=br(mr.current),c=null;a!==r&&(c=H(s,n,a,r,o,l)),e&&null===c?t.stateNode=i:(i=Le(i,c,n,a,r,t,e,s),F(i,n,r,o,l)&&ci(t),t.stateNode=i,e?ci(t):Zo(i,t,!1,!1))}},Qo=function(e,t,n,r){n!==r?(e=br(yr.current),n=br(mr.current),t.stateNode=V(r,e,n,t),ci(t)):t.stateNode=e.stateNode}}else Xo=function(){},Ko=function(){},Qo=function(){};function hi(e,t){if(!vn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function fi(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=14680064&o.subtreeFlags,r|=14680064&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pi(e,t,n){var r=t.pendingProps;switch(pn(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fi(t),null;case 1:case 17:return mt(t.type)&&vt(),fi(t),null;case 3:return n=t.stateNode,wr(),ct(ft),ct(ht),Lr(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(_n(t)?ci(t):null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==bn&&(ja(bn),bn=null))),Xo(e,t),fi(t),null;case 5:Sr(t),n=br(yr.current);var o=t.type;if(null!==e&&null!=t.stateNode)Ko(e,t,o,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(i(166));return fi(t),null}if(e=br(mr.current),_n(t)){if(!K)throw Error(i(175));e=$e(t.stateNode,t.type,t.memoizedProps,n,e,t,!yn),t.updateQueue=e,null!==e&&ci(t)}else{var a=B(o,r,n,e,t);Zo(a,t,!1,!1),t.stateNode=a,F(a,o,r,n,e)&&ci(t)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return fi(t),null;case 6:if(e&&null!=t.stateNode)Qo(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=br(yr.current),n=br(mr.current),_n(t)){if(!K)throw Error(i(176));if(e=t.stateNode,n=t.memoizedProps,(r=Ge(e,n,t,!yn))&&null!==(o=gn))switch(o.tag){case 3:et(o.stateNode.containerInfo,e,n,0!=(1&o.mode));break;case 5:tt(o.type,o.memoizedProps,o.stateNode,e,n,0!=(1&o.mode))}r&&ci(t)}else t.stateNode=V(r,e,n,t)}return fi(t),null;case 13:if(ct(Cr),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(vn&&null!==mn&&0!=(1&t.mode)&&0==(128&t.flags))En(),Ln(),t.flags|=98560,o=!1;else if(o=_n(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(i(318));if(!K)throw Error(i(344));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(i(317));qe(o,t)}else Ln(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;fi(t),o=!1}else null!==bn&&(ja(bn),bn=null),o=!0;if(!o)return 65536&t.flags?t:null}return 0!=(128&t.flags)?(t.lanes=n,t):((n=null!==r)!==(null!==e&&null!==e.memoizedState)&&n&&(t.child.flags|=8192,0!=(1&t.mode)&&(null===e||0!=(1&Cr.current)?0===da&&(da=3):qa())),null!==t.updateQueue&&(t.flags|=4),fi(t),null);case 4:return wr(),Xo(e,t),null===e&&J(t.stateNode.containerInfo),fi(t),null;case 10:return jn(t.type._context),fi(t),null;case 19:if(ct(Cr),null===(o=t.memoizedState))return fi(t),null;if(r=0!=(128&t.flags),null===(a=o.rendering))if(r)hi(o,!1);else{if(0!==da||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=_r(e))){for(t.flags|=128,hi(o,!1),null!==(e=a.updateQueue)&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,n=t.child;null!==n;)o=e,(r=n).flags&=14680066,null===(a=r.alternate)?(r.childLanes=0,r.lanes=o,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=a.childLanes,r.lanes=a.lanes,r.child=a.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=a.memoizedProps,r.memoizedState=a.memoizedState,r.updateQueue=a.updateQueue,r.type=a.type,o=a.dependencies,r.dependencies=null===o?null:{lanes:o.lanes,firstContext:o.firstContext}),n=n.sibling;return ut(Cr,1&Cr.current|2),t.child}e=e.sibling}null!==o.tail&&Ht()>ba&&(t.flags|=128,r=!0,hi(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=_r(a))){if(t.flags|=128,r=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),hi(o,!0),null===o.tail&&"hidden"===o.tailMode&&!a.alternate&&!vn)return fi(t),null}else 2*Ht()-o.renderingStartTime>ba&&1073741824!==n&&(t.flags|=128,r=!0,hi(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=o.last)?e.sibling=a:t.child=a,o.last=a)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ht(),t.sibling=null,e=Cr.current,ut(Cr,r?1&e|2:1&e),t):(fi(t),null);case 22:case 23:return Va(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&0!=(1&t.mode)?0!=(1073741824&ca)&&(fi(t),Z&&6&t.subtreeFlags&&(t.flags|=8192)):fi(t),null;case 24:case 25:return null}throw Error(i(156,t.tag))}function gi(e,t){switch(pn(t),t.tag){case 1:return mt(t.type)&&vt(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return wr(),ct(ft),ct(ht),Lr(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Sr(t),null;case 13:if(ct(Cr),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));Ln()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return ct(Cr),null;case 4:return wr(),null;case 10:return jn(t.type._context),null;case 22:case 23:return Va(),null;default:return null}}var mi=!1,vi=!1,yi="function"==typeof WeakSet?WeakSet:Set,bi=null;function xi(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(mue){ns(e,t,mue)}else n.current=null}function wi(e,t,n){try{n()}catch(mue){ns(e,t,mue)}}var ki=!1;function Si(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,void 0!==i&&wi(t,n,i)}o=o.next}while(o!==r)}}function Ci(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _i(e){var t=e.ref;if(null!==t){var n=e.stateNode;if(5===e.tag)e=I(n);else e=n;"function"==typeof t?t(e):t.current=e}}function Ei(e){var t=e.alternate;null!==t&&(e.alternate=null,Ei(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&te(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Li(e){return 5===e.tag||3===e.tag||4===e.tag}function Pi(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Li(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Oi(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ye(n,e,t):fe(n,e);else if(4!==r&&null!==(e=e.child))for(Oi(e,t,n),e=e.sibling;null!==e;)Oi(e,t,n),e=e.sibling}function Mi(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ve(n,e,t):he(n,e);else if(4!==r&&null!==(e=e.child))for(Mi(e,t,n),e=e.sibling;null!==e;)Mi(e,t,n),e=e.sibling}var Ti=null,Ai=!1;function Ii(e,t,n){for(n=n.child;null!==n;)Ri(e,t,n),n=n.sibling}function Ri(e,t,n){if(qt&&"function"==typeof qt.onCommitFiberUnmount)try{qt.onCommitFiberUnmount(Gt,n)}catch(vue){}switch(n.tag){case 5:vi||xi(n,t);case 6:if(Z){var r=Ti,o=Ai;Ti=null,Ii(e,t,n),Ai=o,null!==(Ti=r)&&(Ai?xe(Ti,n.stateNode):be(Ti,n.stateNode))}else Ii(e,t,n);break;case 18:Z&&null!==Ti&&(Ai?Qe(Ti,n.stateNode):Ke(Ti,n.stateNode));break;case 4:Z?(r=Ti,o=Ai,Ti=n.stateNode.containerInfo,Ai=!0,Ii(e,t,n),Ti=r,Ai=o):(X&&(r=n.stateNode.containerInfo,o=Pe(r),Te(r,o)),Ii(e,t,n));break;case 0:case 11:case 14:case 15:if(!vi&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){o=r=r.next;do{var i=o,a=i.destroy;i=i.tag,void 0!==a&&(0!=(2&i)||0!=(4&i))&&wi(n,t,a),o=o.next}while(o!==r)}Ii(e,t,n);break;case 1:if(!vi&&(xi(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(vue){ns(n,t,vue)}Ii(e,t,n);break;case 21:Ii(e,t,n);break;case 22:1&n.mode?(vi=(r=vi)||null!==n.memoizedState,Ii(e,t,n),vi=r):Ii(e,t,n);break;default:Ii(e,t,n)}}function Ni(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new yi),t.forEach((function(t){var r=as.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Di(e,t){var n=t.deletions;if(null!==n)for(var r=0;r";case $i:return":has("+(Qi(e)||"")+")";case Gi:return'[role="'+e.value+'"]';case Yi:return'"'+e.value+'"';case qi:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function Ji(e,t){var n=[];e=[e,0];for(var r=0;ro&&(o=s),r&=~a}if(r=o,10<(r=(120>(r=Ht()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ta(r/1960))-r)){e.timeoutHandle=U(Ja.bind(null,e,va,xa),r);break}Ja(e,va,xa);break;default:throw Error(i(329))}}}return Da(e,Ht()),e.callbackNode===n?za.bind(null,e):null}function Ba(e,t){var n=ma;return e.current.memoizedState.isDehydrated&&(Ua(e,t).flags|=256),2!==(e=Ya(e,t))&&(t=va,va=n,null!==t&&ja(t)),e}function ja(e){null===va?va=e:va.push.apply(va,e)}function Fa(e,t){for(t&=~ga,t&=~pa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0e?16:e,null===La)var r=!1;else{if(e=La,La=null,Pa=0,0!=(6&ia))throw Error(i(331));var o=ia;for(ia|=4,bi=e.current;null!==bi;){var a=bi,s=a.child;if(0!=(16&bi.flags)){var l=a.deletions;if(null!==l){for(var c=0;cHt()-ya?Ua(e,0):ga|=n),Da(e,t)}function os(e,t){0===t&&(0==(1&e.mode)?t=1:(t=Et,0==(130023424&(Et<<=1))&&(Et=4194304)));var n=Ia();null!==(e=Gn(e,t))&&(It(e,t,n),Da(e,n))}function is(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),os(e,n)}function as(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}null!==r&&r.delete(t),os(e,n)}function ss(e,t){return zt(e,t)}function ls(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cs(e,t,n,r){return new ls(e,t,n,r)}function us(e){return!(!(e=e.prototype)||!e.isReactComponent)}function ds(e,t){var n=e.alternate;return null===n?((n=cs(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function hs(e,t,n,r,o,a){var s=2;if(r=e,"function"==typeof e)us(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case u:return fs(n.children,o,a,t);case d:s=8,o|=8;break;case h:return(e=cs(12,n,t,2|o)).elementType=h,e.lanes=a,e;case m:return(e=cs(13,n,t,o)).elementType=m,e.lanes=a,e;case v:return(e=cs(19,n,t,o)).elementType=v,e.lanes=a,e;case x:return ps(n,o,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case f:s=10;break e;case p:s=9;break e;case g:s=11;break e;case y:s=14;break e;case b:s=16,r=null;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=cs(s,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function fs(e,t,n,r){return(e=cs(7,e,r,t)).lanes=n,e}function ps(e,t,n,r){return(e=cs(22,e,r,t)).elementType=x,e.lanes=n,e.stateNode={isHidden:!1},e}function gs(e,t,n){return(e=cs(6,e,null,t)).lanes=n,e}function ms(e,t,n){return(t=cs(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vs(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=At(0),this.expirationTimes=At(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.identifierPrefix=r,this.onRecoverableError=o,K&&(this.mutableSourceEagerHydrationData=null)}function ys(e,t,n,r,o,i,a,s,l){return e=new vs(e,t,n,s,l),1===t?(t=1,!0===i&&(t|=8)):t=0,i=cs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yn(i),e}function bs(e){if(!e)return dt;e:{if(_(e=e._reactInternals)!==e||1!==e.tag)throw Error(i(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(i(171))}if(1===e.tag){var n=e.type;if(mt(n))return bt(e,n,t)}return t}function xs(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(i(188));throw e=Object.keys(e).join(","),Error(i(268,e))}return null===(e=P(t))?null:e.stateNode}function ws(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n=u&&a>=h&&o<=d&&s<=f){e.splice(t,1);break}if(!(r!==u||n.width!==c.width||fs)){h>a&&(c.height+=h-a,c.y=a),fo)){u>r&&(c.width+=u-r,c.x=r),dn&&(n=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},t.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?I(e.child.stateNode):e.child.stateNode:null},t.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:s.ReactCurrentDispatcher,findHostInstanceByFiber:Ss,findFiberByHostInstance:e.findFiberByHostInstance||Cs,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Gt=t.inject(e),qt=t}catch(due){}e=!!t.checkDCE}}return e},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(e,t,n,r){if(!oe)throw Error(i(363));e=ea(e,t);var o=de(e,n,r).disconnect;return{disconnect:function(){o()}}},t.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},t.runWithPriority=function(e,t){var n=Nt;try{return Nt=e,t()}finally{Nt=n}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(e,t,n,r){var o=t.current,i=Ia(),a=Ra(o);return n=bs(n),null===t.context?t.context=n:t.pendingContext=n,(t=Xn(i,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Kn(o,t,a))&&(Na(e,o,a,i),Qn(e,o,a)),a},t}; + */!function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",s=16,l=32,c=64,u=128,d=256,h=1/0,f=9007199254740991,p=NaN,g=4294967295,m=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",s],["flip",512],["partial",l],["partialRight",c],["rearg",d]],v="[object Arguments]",y="[object Array]",b="[object Boolean]",x="[object Date]",w="[object Error]",k="[object Function]",S="[object GeneratorFunction]",C="[object Map]",_="[object Number]",E="[object Object]",L="[object Promise]",P="[object RegExp]",O="[object Set]",M="[object String]",T="[object Symbol]",A="[object WeakMap]",I="[object ArrayBuffer]",R="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",z="[object Int8Array]",B="[object Int16Array]",j="[object Int32Array]",F="[object Uint8Array]",H="[object Uint8ClampedArray]",W="[object Uint16Array]",V="[object Uint32Array]",U=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,Z=RegExp(q.source),X=RegExp(Y.source),K=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,re=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(re.source),ie=/^\s+/,ae=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,le=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,de=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,ge=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,ve=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,be=/^(?:0|[1-9]\d*)$/,xe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,we=/($^)/,ke=/['\n\r\u2028\u2029\\]/g,Se="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",Le="A-Z\\xc0-\\xd6\\xd8-\\xde",Pe="\\ufe0e\\ufe0f",Oe="\\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",Me="['’]",Te="["+Se+"]",Ae="["+Oe+"]",Ie="["+Ce+"]",Re="\\d+",Ne="["+_e+"]",De="["+Ee+"]",ze="[^"+Se+Oe+Re+_e+Ee+Le+"]",Be="\\ud83c[\\udffb-\\udfff]",je="[^"+Se+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",He="[\\ud800-\\udbff][\\udc00-\\udfff]",We="["+Le+"]",Ve="\\u200d",Ue="(?:"+De+"|"+ze+")",$e="(?:"+We+"|"+ze+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ye="(?:"+Ie+"|"+Be+")"+"?",Ze="["+Pe+"]?",Xe=Ze+Ye+("(?:"+Ve+"(?:"+[je,Fe,He].join("|")+")"+Ze+Ye+")*"),Ke="(?:"+[Ne,Fe,He].join("|")+")"+Xe,Qe="(?:"+[je+Ie+"?",Ie,Fe,He,Te].join("|")+")",Je=RegExp(Me,"g"),et=RegExp(Ie,"g"),tt=RegExp(Be+"(?="+Be+")|"+Qe+Xe,"g"),nt=RegExp([We+"?"+De+"+"+Ge+"(?="+[Ae,We,"$"].join("|")+")",$e+"+"+qe+"(?="+[Ae,We+Ue,"$"].join("|")+")",We+"?"+Ue+"+"+Ge,We+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Re,Ke].join("|"),"g"),rt=RegExp("["+Ve+Se+Ce+Pe+"]"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["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"],at=-1,st={};st[N]=st[D]=st[z]=st[B]=st[j]=st[F]=st[H]=st[W]=st[V]=!0,st[v]=st[y]=st[I]=st[b]=st[R]=st[x]=st[w]=st[k]=st[C]=st[_]=st[E]=st[P]=st[O]=st[M]=st[A]=!1;var lt={};lt[v]=lt[y]=lt[I]=lt[R]=lt[b]=lt[x]=lt[N]=lt[D]=lt[z]=lt[B]=lt[j]=lt[C]=lt[_]=lt[E]=lt[P]=lt[O]=lt[M]=lt[T]=lt[F]=lt[H]=lt[W]=lt[V]=!0,lt[w]=lt[k]=lt[A]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,dt=parseInt,ht="object"==typeof o&&o&&o.Object===Object&&o,ft="object"==typeof self&&self&&self.Object===Object&&self,pt=ht||ft||Function("return this")(),gt=t&&!t.nodeType&&t,mt=gt&&e&&!e.nodeType&&e,vt=mt&&mt.exports===gt,yt=vt&&ht.process,bt=function(){try{var e=mt&&mt.require&&mt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(j2){}}(),xt=bt&&bt.isArrayBuffer,wt=bt&&bt.isDate,kt=bt&&bt.isMap,St=bt&&bt.isRegExp,Ct=bt&&bt.isSet,_t=bt&&bt.isTypedArray;function Et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Lt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o-1}function It(e,t,n){for(var r=-1,o=null==e?0:e.length;++r-1;);return n}function nn(e,t){for(var n=e.length;n--&&Wt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var on=qt({"À":"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"}),an=qt({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+ct[e]}function ln(e){return rt.test(e)}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n",""":'"',"'":"'"});var yn=function e(t){var o,ae=(t=null==t?pt:yn.defaults(pt.Object(),t,yn.pick(pt,it))).Array,Se=t.Date,Ce=t.Error,_e=t.Function,Ee=t.Math,Le=t.Object,Pe=t.RegExp,Oe=t.String,Me=t.TypeError,Te=ae.prototype,Ae=_e.prototype,Ie=Le.prototype,Re=t["__core-js_shared__"],Ne=Ae.toString,De=Ie.hasOwnProperty,ze=0,Be=(o=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"",je=Ie.toString,Fe=Ne.call(Le),He=pt._,We=Pe("^"+Ne.call(De).replace(re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=vt?t.Buffer:n,Ue=t.Symbol,$e=t.Uint8Array,Ge=Ve?Ve.allocUnsafe:n,qe=un(Le.getPrototypeOf,Le),Ye=Le.create,Ze=Ie.propertyIsEnumerable,Xe=Te.splice,Ke=Ue?Ue.isConcatSpreadable:n,Qe=Ue?Ue.iterator:n,tt=Ue?Ue.toStringTag:n,rt=function(){try{var e=pi(Le,"defineProperty");return e({},"",{}),e}catch(j2){}}(),ct=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ht=Se&&Se.now!==pt.Date.now&&Se.now,ft=t.setTimeout!==pt.setTimeout&&t.setTimeout,gt=Ee.ceil,mt=Ee.floor,yt=Le.getOwnPropertySymbols,bt=Ve?Ve.isBuffer:n,jt=t.isFinite,qt=Te.join,bn=un(Le.keys,Le),xn=Ee.max,wn=Ee.min,kn=Se.now,Sn=t.parseInt,Cn=Ee.random,_n=Te.reverse,En=pi(t,"DataView"),Ln=pi(t,"Map"),Pn=pi(t,"Promise"),On=pi(t,"Set"),Mn=pi(t,"WeakMap"),Tn=pi(Le,"create"),An=Mn&&new Mn,In={},Rn=Hi(En),Nn=Hi(Ln),Dn=Hi(Pn),zn=Hi(On),Bn=Hi(Mn),jn=Ue?Ue.prototype:n,Fn=jn?jn.valueOf:n,Hn=jn?jn.toString:n;function Wn(e){if(os(e)&&!qa(e)&&!(e instanceof Gn)){if(e instanceof $n)return e;if(De.call(e,"__wrapped__"))return Wi(e)}return new $n(e)}var Vn=function(){function e(){}return function(t){if(!rs(t))return{};if(Ye)return Ye(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Un(){}function $n(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Gn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ur(e,t,r,o,i,a){var s,l=1&t,c=2&t,u=4&t;if(r&&(s=i?r(e,o,i,a):r(e)),s!==n)return s;if(!rs(e))return e;var d=qa(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&De.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!l)return Ao(e,s)}else{var h=vi(e),f=h==k||h==S;if(Ka(e))return Eo(e,l);if(h==E||h==v||f&&!i){if(s=c||f?{}:bi(e),!l)return c?function(e,t){return Io(e,mi(e),t)}(e,function(e,t){return e&&Io(t,Ns(t),e)}(s,e)):function(e,t){return Io(e,gi(e),t)}(e,ar(s,e))}else{if(!lt[h])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case I:return Lo(e);case b:case x:return new r(+e);case R:return function(e,t){var n=t?Lo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case D:case z:case B:case j:case F:case H:case W:case V:return Po(e,n);case C:return new r;case _:case M:return new r(e);case P:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case O:return new r;case T:return o=e,Fn?Le(Fn.call(o)):{}}var o}(e,h,l)}}a||(a=new Kn);var p=a.get(e);if(p)return p;a.set(e,s),cs(e)?e.forEach((function(n){s.add(ur(n,t,r,n,e,a))})):is(e)&&e.forEach((function(n,o){s.set(o,ur(n,t,r,o,e,a))}));var g=d?n:(u?c?si:ai:c?Ns:Rs)(e);return Pt(g||e,(function(n,o){g&&(n=e[o=n]),rr(s,o,ur(n,t,r,o,e,a))})),s}function dr(e,t,r){var o=r.length;if(null==e)return!o;for(e=Le(e);o--;){var i=r[o],a=t[i],s=e[i];if(s===n&&!(i in e)||!a(s))return!1}return!0}function hr(e,t,o){if("function"!=typeof e)throw new Me(r);return Ri((function(){e.apply(n,o)}),t)}function fr(e,t,n,r){var o=-1,i=At,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;n&&(t=Rt(t,Qt(n))),r?(i=It,a=!1):t.length>=200&&(i=en,a=!1,t=new Xn(t));e:for(;++o-1},Yn.prototype.set=function(e,t){var n=this.__data__,r=or(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Zn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(Ln||Yn),string:new qn}},Zn.prototype.delete=function(e){var t=hi(this,e).delete(e);return this.size-=t?1:0,t},Zn.prototype.get=function(e){return hi(this,e).get(e)},Zn.prototype.has=function(e){return hi(this,e).has(e)},Zn.prototype.set=function(e,t){var n=hi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(e){return this.__data__.set(e,i),this},Xn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new Yn,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Yn){var r=n.__data__;if(!Ln||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Zn(r)}return n.set(e,t),this.size=n.size,this};var pr=Do(kr),gr=Do(Sr,!0);function mr(e,t){var n=!0;return pr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function vr(e,t,r){for(var o=-1,i=e.length;++o0&&n(s)?t>1?br(s,t-1,n,r,o):Nt(o,s):r||(o[o.length]=s)}return o}var xr=zo(),wr=zo(!0);function kr(e,t){return e&&xr(e,t,Rs)}function Sr(e,t){return e&&wr(e,t,Rs)}function Cr(e,t){return Tt(t,(function(t){return es(e[t])}))}function _r(e,t){for(var r=0,o=(t=ko(t,e)).length;null!=e&&rt}function Or(e,t){return null!=e&&De.call(e,t)}function Mr(e,t){return null!=e&&t in Le(e)}function Tr(e,t,r){for(var o=r?It:At,i=e[0].length,a=e.length,s=a,l=ae(a),c=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Rt(d,Qt(t))),c=wn(d.length,c),l[s]=!r&&(t||i>=120&&d.length>=120)?new Xn(s&&d):n}d=e[0];var h=-1,f=l[0];e:for(;++h=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function qr(e,t,n){for(var r=-1,o=t.length,i={};++r-1;)s!==e&&Xe.call(s,l,1),Xe.call(e,l,1);return e}function Zr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;wi(o)?Xe.call(e,o,1):po(e,o)}}return e}function Xr(e,t){return e+mt(Cn()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Qr(e,t){return Ni(Oi(e,t,al),e+"")}function Jr(e){return Jn(Vs(e))}function eo(e,t){var n=Vs(e);return Bi(n,cr(t,0,n.length))}function to(e,t,r,o){if(!rs(e))return e;for(var i=-1,a=(t=ko(t,e)).length,s=a-1,l=e;null!=l&&++io?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=ae(o);++r>>1,a=e[i];null!==a&&!ds(a)&&(n?a<=t:a=200){var c=t?null:Qo(e);if(c)return hn(c);a=!1,o=en,l=new Xn}else l=t?[]:s;e:for(;++r=o?e:io(e,t,r)}var _o=ct||function(e){return pt.clearTimeout(e)};function Eo(e,t){if(t)return e.slice();var n=e.length,r=Ge?Ge(n):new e.constructor(n);return e.copy(r),r}function Lo(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Po(e,t){var n=t?Lo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Oo(e,t){if(e!==t){var r=e!==n,o=null===e,i=e==e,a=ds(e),s=t!==n,l=null===t,c=t==t,u=ds(t);if(!l&&!u&&!a&&e>t||a&&s&&c&&!l&&!u||o&&s&&c||!r&&c||!i)return 1;if(!o&&!a&&!u&&e1?r[i-1]:n,s=i>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(i--,a):n,s&&ki(r[0],r[1],s)&&(a=i<3?n:a,i=1),t=Le(t);++o-1?i[a?t[s]:s]:n}}function Wo(e){return ii((function(t){var o=t.length,i=o,a=$n.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new Me(r);if(a&&!l&&"wrapper"==ci(s))var l=new $n([],!0)}for(i=l?i:o;++i1&&y.reverse(),h&&cl))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&r?new Xn:n;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Pt(m,(function(n){var r="_."+n[0];t&n[1]&&!At(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(le);return t?t[1].split(ce):[]}(r),n)))}function zi(e){var t=0,r=0;return function(){var o=kn(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Bi(e,t){var r=-1,o=e.length,i=o-1;for(t=t===n?o:t;++r1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,la(e,r)}));function ga(e){var t=Wn(e);return t.__chain__=!0,t}function ma(e,t){return t(e)}var va=ii((function(e){var t=e.length,r=t?e[0]:0,o=this.__wrapped__,i=function(t){return lr(t,e)};return!(t>1||this.__actions__.length)&&o instanceof Gn&&wi(r)?((o=o.slice(r,+r+(t?1:0))).__actions__.push({func:ma,args:[i],thisArg:n}),new $n(o,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(i)}));var ya=Ro((function(e,t,n){De.call(e,n)?++e[n]:sr(e,n,1)}));var ba=Ho(Gi),xa=Ho(qi);function wa(e,t){return(qa(e)?Pt:pr)(e,di(t,3))}function ka(e,t){return(qa(e)?Ot:gr)(e,di(t,3))}var Sa=Ro((function(e,t,n){De.call(e,n)?e[n].push(t):sr(e,n,[t])}));var Ca=Qr((function(e,t,n){var r=-1,o="function"==typeof t,i=Za(e)?ae(e.length):[];return pr(e,(function(e){i[++r]=o?Et(t,e,n):Ar(e,t,n)})),i})),_a=Ro((function(e,t,n){sr(e,n,t)}));function Ea(e,t){return(qa(e)?Rt:Hr)(e,di(t,3))}var La=Ro((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Pa=Qr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ki(e,t[0],t[1])?t=[]:n>2&&ki(t[0],t[1],t[2])&&(t=[t[0]]),Gr(e,br(t,1),[])})),Oa=ht||function(){return pt.Date.now()};function Ma(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,ei(e,u,n,n,n,n,t)}function Ta(e,t){var o;if("function"!=typeof t)throw new Me(r);return e=vs(e),function(){return--e>0&&(o=t.apply(this,arguments)),e<=1&&(t=n),o}}var Aa=Qr((function(e,t,n){var r=1;if(n.length){var o=dn(n,ui(Aa));r|=l}return ei(e,r,t,n,o)})),Ia=Qr((function(e,t,n){var r=3;if(n.length){var o=dn(n,ui(Ia));r|=l}return ei(t,r,e,n,o)}));function Ra(e,t,o){var i,a,s,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Me(r);function g(t){var r=i,o=a;return i=a=n,d=t,l=e.apply(o,r)}function m(e){return d=e,c=Ri(y,t),h?g(e):l}function v(e){var r=e-u;return u===n||r>=t||r<0||f&&e-d>=s}function y(){var e=Oa();if(v(e))return b(e);c=Ri(y,function(e){var n=t-(e-u);return f?wn(n,s-(e-d)):n}(e))}function b(e){return c=n,p&&i?g(e):(i=a=n,l)}function x(){var e=Oa(),r=v(e);if(i=arguments,a=this,u=e,r){if(c===n)return m(u);if(f)return _o(c),c=Ri(y,t),g(u)}return c===n&&(c=Ri(y,t)),l}return t=bs(t)||0,rs(o)&&(h=!!o.leading,s=(f="maxWait"in o)?xn(bs(o.maxWait)||0,t):s,p="trailing"in o?!!o.trailing:p),x.cancel=function(){c!==n&&_o(c),d=0,i=u=a=c=n},x.flush=function(){return c===n?l:b(Oa())},x}var Na=Qr((function(e,t){return hr(e,1,t)})),Da=Qr((function(e,t,n){return hr(e,bs(t)||0,n)}));function za(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Me(r);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(za.Cache||Zn),n}function Ba(e){if("function"!=typeof e)throw new Me(r);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)}}za.Cache=Zn;var ja=So((function(e,t){var n=(t=1==t.length&&qa(t[0])?Rt(t[0],Qt(di())):Rt(br(t,1),Qt(di()))).length;return Qr((function(r){for(var o=-1,i=wn(r.length,n);++o=t})),Ga=Ir(function(){return arguments}())?Ir:function(e){return os(e)&&De.call(e,"callee")&&!Ze.call(e,"callee")},qa=ae.isArray,Ya=xt?Qt(xt):function(e){return os(e)&&Lr(e)==I};function Za(e){return null!=e&&ns(e.length)&&!es(e)}function Xa(e){return os(e)&&Za(e)}var Ka=bt||bl,Qa=wt?Qt(wt):function(e){return os(e)&&Lr(e)==x};function Ja(e){if(!os(e))return!1;var t=Lr(e);return t==w||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ss(e)}function es(e){if(!rs(e))return!1;var t=Lr(e);return t==k||t==S||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ts(e){return"number"==typeof e&&e==vs(e)}function ns(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function rs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function os(e){return null!=e&&"object"==typeof e}var is=kt?Qt(kt):function(e){return os(e)&&vi(e)==C};function as(e){return"number"==typeof e||os(e)&&Lr(e)==_}function ss(e){if(!os(e)||Lr(e)!=E)return!1;var t=qe(e);if(null===t)return!0;var n=De.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==Fe}var ls=St?Qt(St):function(e){return os(e)&&Lr(e)==P};var cs=Ct?Qt(Ct):function(e){return os(e)&&vi(e)==O};function us(e){return"string"==typeof e||!qa(e)&&os(e)&&Lr(e)==M}function ds(e){return"symbol"==typeof e||os(e)&&Lr(e)==T}var hs=_t?Qt(_t):function(e){return os(e)&&ns(e.length)&&!!st[Lr(e)]};var fs=Zo(Fr),ps=Zo((function(e,t){return e<=t}));function gs(e){if(!e)return[];if(Za(e))return us(e)?gn(e):Ao(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=vi(e);return(t==C?cn:t==O?hn:Vs)(e)}function ms(e){return e?(e=bs(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function vs(e){var t=ms(e),n=t%1;return t==t?n?t-n:t:0}function ys(e){return e?cr(vs(e),0,g):0}function bs(e){if("number"==typeof e)return e;if(ds(e))return p;if(rs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=rs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=me.test(e);return n||ye.test(e)?dt(e.slice(2),n?2:8):ge.test(e)?p:+e}function xs(e){return Io(e,Ns(e))}function ws(e){return null==e?"":ho(e)}var ks=No((function(e,t){if(Ei(t)||Za(t))Io(t,Rs(t),e);else for(var n in t)De.call(t,n)&&rr(e,n,t[n])})),Ss=No((function(e,t){Io(t,Ns(t),e)})),Cs=No((function(e,t,n,r){Io(t,Ns(t),e,r)})),_s=No((function(e,t,n,r){Io(t,Rs(t),e,r)})),Es=ii(lr);var Ls=Qr((function(e,t){e=Le(e);var r=-1,o=t.length,i=o>2?t[2]:n;for(i&&ki(t[0],t[1],i)&&(o=1);++r1),t})),Io(e,si(e),n),r&&(n=ur(n,7,ri));for(var o=t.length;o--;)po(n,t[o]);return n}));var js=ii((function(e,t){return null==e?{}:function(e,t){return qr(e,t,(function(t,n){return Ms(e,n)}))}(e,t)}));function Fs(e,t){if(null==e)return{};var n=Rt(si(e),(function(e){return[e]}));return t=di(t),qr(e,n,(function(e,n){return t(e,n[0])}))}var Hs=Jo(Rs),Ws=Jo(Ns);function Vs(e){return null==e?[]:Jt(e,Rs(e))}var Us=jo((function(e,t,n){return t=t.toLowerCase(),e+(n?$s(t):t)}));function $s(e){return Js(ws(e).toLowerCase())}function Gs(e){return(e=ws(e))&&e.replace(xe,on).replace(et,"")}var qs=jo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ys=jo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Zs=Bo("toLowerCase");var Xs=jo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Ks=jo((function(e,t,n){return e+(n?" ":"")+Js(t)}));var Qs=jo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Js=Bo("toUpperCase");function el(e,t,r){return e=ws(e),(t=r?n:t)===n?function(e){return ot.test(e)}(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var tl=Qr((function(e,t){try{return Et(e,n,t)}catch(j2){return Ja(j2)?j2:new Ce(j2)}})),nl=ii((function(e,t){return Pt(t,(function(t){t=Fi(t),sr(e,t,Aa(e[t],e))})),e}));function rl(e){return function(){return e}}var ol=Wo(),il=Wo(!0);function al(e){return e}function sl(e){return zr("function"==typeof e?e:ur(e,1))}var ll=Qr((function(e,t){return function(n){return Ar(n,e,t)}})),cl=Qr((function(e,t){return function(n){return Ar(e,n,t)}}));function ul(e,t,n){var r=Rs(t),o=Cr(t,r);null!=n||rs(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Cr(t,Rs(t)));var i=!(rs(n)&&"chain"in n&&!n.chain),a=es(e);return Pt(o,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),o=n.__actions__=Ao(this.__actions__);return o.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Nt([this.value()],arguments))})})),e}function dl(){}var hl=Go(Rt),fl=Go(Mt),pl=Go(Bt);function gl(e){return Si(e)?Gt(Fi(e)):function(e){return function(t){return _r(t,e)}}(e)}var ml=Yo(),vl=Yo(!0);function yl(){return[]}function bl(){return!1}var xl=$o((function(e,t){return e+t}),0),wl=Ko("ceil"),kl=$o((function(e,t){return e/t}),1),Sl=Ko("floor");var Cl,_l=$o((function(e,t){return e*t}),1),El=Ko("round"),Ll=$o((function(e,t){return e-t}),0);return Wn.after=function(e,t){if("function"!=typeof t)throw new Me(r);return e=vs(e),function(){if(--e<1)return t.apply(this,arguments)}},Wn.ary=Ma,Wn.assign=ks,Wn.assignIn=Ss,Wn.assignInWith=Cs,Wn.assignWith=_s,Wn.at=Es,Wn.before=Ta,Wn.bind=Aa,Wn.bindAll=nl,Wn.bindKey=Ia,Wn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qa(e)?e:[e]},Wn.chain=ga,Wn.chunk=function(e,t,r){t=(r?ki(e,t,r):t===n)?1:xn(vs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var i=0,a=0,s=ae(gt(o/t));ii?0:i+r),(o=o===n||o>i?i:vs(o))<0&&(o+=i),o=r>o?0:ys(o);r>>0)?(e=ws(e))&&("string"==typeof t||null!=t&&!ls(t))&&!(t=ho(t))&&ln(e)?Co(gn(e),0,r):e.split(t,r):[]},Wn.spread=function(e,t){if("function"!=typeof e)throw new Me(r);return t=null==t?0:xn(vs(t),0),Qr((function(n){var r=n[t],o=Co(n,0,t);return r&&Nt(o,r),Et(e,this,o)}))},Wn.tail=function(e){var t=null==e?0:e.length;return t?io(e,1,t):[]},Wn.take=function(e,t,r){return e&&e.length?io(e,0,(t=r||t===n?1:vs(t))<0?0:t):[]},Wn.takeRight=function(e,t,r){var o=null==e?0:e.length;return o?io(e,(t=o-(t=r||t===n?1:vs(t)))<0?0:t,o):[]},Wn.takeRightWhile=function(e,t){return e&&e.length?mo(e,di(t,3),!1,!0):[]},Wn.takeWhile=function(e,t){return e&&e.length?mo(e,di(t,3)):[]},Wn.tap=function(e,t){return t(e),e},Wn.throttle=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new Me(r);return rs(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),Ra(e,t,{leading:o,maxWait:t,trailing:i})},Wn.thru=ma,Wn.toArray=gs,Wn.toPairs=Hs,Wn.toPairsIn=Ws,Wn.toPath=function(e){return qa(e)?Rt(e,Fi):ds(e)?[e]:Ao(ji(ws(e)))},Wn.toPlainObject=xs,Wn.transform=function(e,t,n){var r=qa(e),o=r||Ka(e)||hs(e);if(t=di(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:rs(e)&&es(i)?Vn(qe(e)):{}}return(o?Pt:kr)(e,(function(e,r,o){return t(n,e,r,o)})),n},Wn.unary=function(e){return Ma(e,1)},Wn.union=oa,Wn.unionBy=ia,Wn.unionWith=aa,Wn.uniq=function(e){return e&&e.length?fo(e):[]},Wn.uniqBy=function(e,t){return e&&e.length?fo(e,di(t,2)):[]},Wn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?fo(e,n,t):[]},Wn.unset=function(e,t){return null==e||po(e,t)},Wn.unzip=sa,Wn.unzipWith=la,Wn.update=function(e,t,n){return null==e?e:go(e,t,wo(n))},Wn.updateWith=function(e,t,r,o){return o="function"==typeof o?o:n,null==e?e:go(e,t,wo(r),o)},Wn.values=Vs,Wn.valuesIn=function(e){return null==e?[]:Jt(e,Ns(e))},Wn.without=ca,Wn.words=el,Wn.wrap=function(e,t){return Fa(wo(t),e)},Wn.xor=ua,Wn.xorBy=da,Wn.xorWith=ha,Wn.zip=fa,Wn.zipObject=function(e,t){return bo(e||[],t||[],rr)},Wn.zipObjectDeep=function(e,t){return bo(e||[],t||[],to)},Wn.zipWith=pa,Wn.entries=Hs,Wn.entriesIn=Ws,Wn.extend=Ss,Wn.extendWith=Cs,ul(Wn,Wn),Wn.add=xl,Wn.attempt=tl,Wn.camelCase=Us,Wn.capitalize=$s,Wn.ceil=wl,Wn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=bs(r))==r?r:0),t!==n&&(t=(t=bs(t))==t?t:0),cr(bs(e),t,r)},Wn.clone=function(e){return ur(e,4)},Wn.cloneDeep=function(e){return ur(e,5)},Wn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:n)},Wn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:n)},Wn.conformsTo=function(e,t){return null==t||dr(e,t,Rs(t))},Wn.deburr=Gs,Wn.defaultTo=function(e,t){return null==e||e!=e?t:e},Wn.divide=kl,Wn.endsWith=function(e,t,r){e=ws(e),t=ho(t);var o=e.length,i=r=r===n?o:cr(vs(r),0,o);return(r-=t.length)>=0&&e.slice(r,i)==t},Wn.eq=Va,Wn.escape=function(e){return(e=ws(e))&&X.test(e)?e.replace(Y,an):e},Wn.escapeRegExp=function(e){return(e=ws(e))&&oe.test(e)?e.replace(re,"\\$&"):e},Wn.every=function(e,t,r){var o=qa(e)?Mt:mr;return r&&ki(e,t,r)&&(t=n),o(e,di(t,3))},Wn.find=ba,Wn.findIndex=Gi,Wn.findKey=function(e,t){return Ft(e,di(t,3),kr)},Wn.findLast=xa,Wn.findLastIndex=qi,Wn.findLastKey=function(e,t){return Ft(e,di(t,3),Sr)},Wn.floor=Sl,Wn.forEach=wa,Wn.forEachRight=ka,Wn.forIn=function(e,t){return null==e?e:xr(e,di(t,3),Ns)},Wn.forInRight=function(e,t){return null==e?e:wr(e,di(t,3),Ns)},Wn.forOwn=function(e,t){return e&&kr(e,di(t,3))},Wn.forOwnRight=function(e,t){return e&&Sr(e,di(t,3))},Wn.get=Os,Wn.gt=Ua,Wn.gte=$a,Wn.has=function(e,t){return null!=e&&yi(e,t,Or)},Wn.hasIn=Ms,Wn.head=Zi,Wn.identity=al,Wn.includes=function(e,t,n,r){e=Za(e)?e:Vs(e),n=n&&!r?vs(n):0;var o=e.length;return n<0&&(n=xn(o+n,0)),us(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Wt(e,t,n)>-1},Wn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:vs(n);return o<0&&(o=xn(r+o,0)),Wt(e,t,o)},Wn.inRange=function(e,t,r){return t=ms(t),r===n?(r=t,t=0):r=ms(r),function(e,t,n){return e>=wn(t,n)&&e=-9007199254740991&&e<=f},Wn.isSet=cs,Wn.isString=us,Wn.isSymbol=ds,Wn.isTypedArray=hs,Wn.isUndefined=function(e){return e===n},Wn.isWeakMap=function(e){return os(e)&&vi(e)==A},Wn.isWeakSet=function(e){return os(e)&&"[object WeakSet]"==Lr(e)},Wn.join=function(e,t){return null==e?"":qt.call(e,t)},Wn.kebabCase=qs,Wn.last=Ji,Wn.lastIndexOf=function(e,t,r){var o=null==e?0:e.length;if(!o)return-1;var i=o;return r!==n&&(i=(i=vs(r))<0?xn(o+i,0):wn(i,o-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):Ht(e,Ut,i,!0)},Wn.lowerCase=Ys,Wn.lowerFirst=Zs,Wn.lt=fs,Wn.lte=ps,Wn.max=function(e){return e&&e.length?vr(e,al,Pr):n},Wn.maxBy=function(e,t){return e&&e.length?vr(e,di(t,2),Pr):n},Wn.mean=function(e){return $t(e,al)},Wn.meanBy=function(e,t){return $t(e,di(t,2))},Wn.min=function(e){return e&&e.length?vr(e,al,Fr):n},Wn.minBy=function(e,t){return e&&e.length?vr(e,di(t,2),Fr):n},Wn.stubArray=yl,Wn.stubFalse=bl,Wn.stubObject=function(){return{}},Wn.stubString=function(){return""},Wn.stubTrue=function(){return!0},Wn.multiply=_l,Wn.nth=function(e,t){return e&&e.length?$r(e,vs(t)):n},Wn.noConflict=function(){return pt._===this&&(pt._=He),this},Wn.noop=dl,Wn.now=Oa,Wn.pad=function(e,t,n){e=ws(e);var r=(t=vs(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return qo(mt(o),n)+e+qo(gt(o),n)},Wn.padEnd=function(e,t,n){e=ws(e);var r=(t=vs(t))?pn(e):0;return t&&rt){var o=e;e=t,t=o}if(r||e%1||t%1){var i=Cn();return wn(e+i*(t-e+ut("1e-"+((i+"").length-1))),t)}return Xr(e,t)},Wn.reduce=function(e,t,n){var r=qa(e)?Dt:Yt,o=arguments.length<3;return r(e,di(t,4),n,o,pr)},Wn.reduceRight=function(e,t,n){var r=qa(e)?zt:Yt,o=arguments.length<3;return r(e,di(t,4),n,o,gr)},Wn.repeat=function(e,t,r){return t=(r?ki(e,t,r):t===n)?1:vs(t),Kr(ws(e),t)},Wn.replace=function(){var e=arguments,t=ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Wn.result=function(e,t,r){var o=-1,i=(t=ko(t,e)).length;for(i||(i=1,e=n);++of)return[];var n=g,r=wn(e,g);t=di(t),e-=g;for(var o=Xt(r,t);++n=a)return e;var l=r-pn(o);if(l<1)return o;var c=s?Co(s,0,l).join(""):e.slice(0,l);if(i===n)return c+o;if(s&&(l+=c.length-l),ls(i)){if(e.slice(l).search(i)){var u,d=c;for(i.global||(i=Pe(i.source,ws(pe.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var h=u.index;c=c.slice(0,h===n?l:h)}}else if(e.indexOf(ho(i),l)!=l){var f=c.lastIndexOf(i);f>-1&&(c=c.slice(0,f))}return c+o},Wn.unescape=function(e){return(e=ws(e))&&Z.test(e)?e.replace(q,vn):e},Wn.uniqueId=function(e){var t=++ze;return ws(e)+t},Wn.upperCase=Qs,Wn.upperFirst=Js,Wn.each=wa,Wn.eachRight=ka,Wn.first=Zi,ul(Wn,(Cl={},kr(Wn,(function(e,t){De.call(Wn.prototype,t)||(Cl[t]=e)})),Cl),{chain:!1}),Wn.VERSION="4.17.21",Pt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Wn[e].placeholder=Wn})),Pt(["drop","take"],(function(e,t){Gn.prototype[e]=function(r){r=r===n?1:xn(vs(r),0);var o=this.__filtered__&&!t?new Gn(this):this.clone();return o.__filtered__?o.__takeCount__=wn(r,o.__takeCount__):o.__views__.push({size:wn(r,g),type:e+(o.__dir__<0?"Right":"")}),o},Gn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Pt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Gn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:di(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Pt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Gn.prototype[e]=function(){return this[n](1).value()[0]}})),Pt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Gn.prototype[e]=function(){return this.__filtered__?new Gn(this):this[n](1)}})),Gn.prototype.compact=function(){return this.filter(al)},Gn.prototype.find=function(e){return this.filter(e).head()},Gn.prototype.findLast=function(e){return this.reverse().find(e)},Gn.prototype.invokeMap=Qr((function(e,t){return"function"==typeof e?new Gn(this):this.map((function(n){return Ar(n,e,t)}))})),Gn.prototype.reject=function(e){return this.filter(Ba(di(e)))},Gn.prototype.slice=function(e,t){e=vs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Gn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=vs(t))<0?r.dropRight(-t):r.take(t-e)),r)},Gn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Gn.prototype.toArray=function(){return this.take(g)},kr(Gn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),i=Wn[o?"take"+("last"==t?"Right":""):t],a=o||/^find/.test(t);i&&(Wn.prototype[t]=function(){var t=this.__wrapped__,s=o?[1]:arguments,l=t instanceof Gn,c=s[0],u=l||qa(t),d=function(e){var t=i.apply(Wn,Nt([e],s));return o&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=a&&!h,g=l&&!f;if(!a&&u){t=g?t:new Gn(this);var m=e.apply(t,s);return m.__actions__.push({func:ma,args:[d],thisArg:n}),new $n(m,h)}return p&&g?e.apply(this,s):(m=this.thru(d),p?o?m.value()[0]:m.value():m)})})),Pt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Wn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(qa(o)?o:[],e)}return this[n]((function(n){return t.apply(qa(n)?n:[],e)}))}})),kr(Gn.prototype,(function(e,t){var n=Wn[t];if(n){var r=n.name+"";De.call(In,r)||(In[r]=[]),In[r].push({name:t,func:n})}})),In[Vo(n,2).name]=[{name:"wrapper",func:n}],Gn.prototype.clone=function(){var e=new Gn(this.__wrapped__);return e.__actions__=Ao(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ao(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ao(this.__views__),e},Gn.prototype.reverse=function(){if(this.__filtered__){var e=new Gn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Gn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qa(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Wn.prototype.plant=function(e){for(var t,r=this;r instanceof Un;){var o=Wi(r);o.__index__=0,o.__values__=n,t?i.__wrapped__=o:t=o;var i=o;r=r.__wrapped__}return i.__wrapped__=e,t},Wn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Gn){var t=e;return this.__actions__.length&&(t=new Gn(this)),(t=t.reverse()).__actions__.push({func:ma,args:[ra],thisArg:n}),new $n(t,this.__chain__)}return this.thru(ra)},Wn.prototype.toJSON=Wn.prototype.valueOf=Wn.prototype.value=function(){return vo(this.__wrapped__,this.__actions__)},Wn.prototype.first=Wn.prototype.head,Qe&&(Wn.prototype[Qe]=function(){return this}),Wn}();mt?((mt.exports=yn)._=yn,gt._=yn):pt._=yn}).call(o)}(T$,T$.exports);const A$=T$.exports,I$=AV({name:"gallery",initialState:{currentImageUuid:"",shouldPinGallery:!0,shouldShowGallery:!0,galleryScrollPosition:0,galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldHoldGalleryOpen:!1,shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},reducers:{setCurrentImage:(e,t)=>{e.currentImage=t.payload,e.currentImageUuid=t.payload.uuid},removeImage:(e,t)=>{const{uuid:n,category:r}=t.payload,o=e.categories[r].images,i=o.filter((e=>e.uuid!==n));if(n===e.currentImageUuid){const t=o.findIndex((e=>e.uuid===n)),r=T$.exports.clamp(t,0,i.length-1);e.currentImage=i.length?i[r]:void 0,e.currentImageUuid=i.length?i[r].uuid:""}e.categories[r].images=i},addImage:(e,t)=>{const{image:n,category:r}=t.payload,{uuid:o,url:i,mtime:a}=n,s=e.categories[r];s.images.find((e=>e.url===i&&e.mtime===a))||(s.images.unshift(n),e.shouldAutoSwitchToNewImages&&(e.currentImageUuid=o,e.currentImage=n,e.currentCategory=r),e.intermediateImage=void 0,s.latest_mtime=a)},setIntermediateImage:(e,t)=>{e.intermediateImage=t.payload},clearIntermediateImage:e=>{e.intermediateImage=void 0},selectNextImage:e=>{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex((e=>e.uuid===t.uuid));if(r{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex((e=>e.uuid===t.uuid));if(r>0){const t=n[r-1];e.currentImage=t,e.currentImageUuid=t.uuid}}},addGalleryImages:(e,t)=>{const{images:n,areMoreImagesAvailable:r,category:o}=t.payload,i=e.categories[o].images;if(n.length>0){const t=n.filter((e=>!i.find((t=>t.url===e.url&&t.mtime===e.mtime))));if(e.categories[o].images=i.concat(t).sort(((e,t)=>t.mtime-e.mtime)),!e.currentImage){const t=n[0];e.currentImage=t,e.currentImageUuid=t.uuid}e.categories[o].latest_mtime=n[0].mtime,e.categories[o].earliest_mtime=n[n.length-1].mtime}void 0!==r&&(e.categories[o].areMoreImagesAvailable=r)},setShouldPinGallery:(e,t)=>{e.shouldPinGallery=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},setGalleryScrollPosition:(e,t)=>{e.galleryScrollPosition=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},setGalleryImageObjectFit:(e,t)=>{e.galleryImageObjectFit=t.payload},setShouldHoldGalleryOpen:(e,t)=>{e.shouldHoldGalleryOpen=t.payload},setShouldAutoSwitchToNewImages:(e,t)=>{e.shouldAutoSwitchToNewImages=t.payload},setCurrentCategory:(e,t)=>{e.currentCategory=t.payload},setGalleryWidth:(e,t)=>{e.galleryWidth=t.payload},setShouldUseSingleGalleryColumn:(e,t)=>{e.shouldUseSingleGalleryColumn=t.payload}}}),{addImage:R$,clearIntermediateImage:N$,removeImage:D$,setCurrentImage:z$,addGalleryImages:B$,setIntermediateImage:j$,selectNextImage:F$,selectPrevImage:H$,setShouldPinGallery:W$,setShouldShowGallery:V$,setGalleryScrollPosition:U$,setGalleryImageMinimumWidth:$$,setGalleryImageObjectFit:G$,setShouldHoldGalleryOpen:q$,setShouldAutoSwitchToNewImages:Y$,setCurrentCategory:Z$,setGalleryWidth:X$,setShouldUseSingleGalleryColumn:K$}=I$.actions,Q$=I$.reducer;function J$(e){return J$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J$(e)}function eG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tG(e){var t=function(e,t){if("object"!==J$(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==J$(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===J$(t)?t:String(t)}function nG(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{};eG(this,e),this.init(t,n)}return rG(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||pG,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(o())return{};var a=r(i.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return o()?{}:{obj:e,k:r(i.shift())}}function kG(e,t,n){var r=wG(e,t,Object);r.obj[r.k]=n}function SG(e,t){var n=wG(e,t),r=n.obj,o=n.k;if(r)return r[o]}function CG(e,t,n){var r=SG(e,n);return void 0!==r?r:SG(t,n)}function _G(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):_G(e[r],t[r],n):e[r]=t[r]);return e}function EG(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var LG={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function PG(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return LG[e]})):e}var OG="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,MG=[" ",",","?","!",";"];function TG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function AG(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;ii+a;)a++,l=o[s=r.slice(i,i+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var c=r.slice(i+a).join(n);return c?RG(l,c,n):void 0}o=o[r[i]]}return o}}var NG=function(e){aG(n,e);var t=IG(n);function n(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return eG(this,n),r=t.call(this),OG&&vG.call(oG(r)),r.data=e||{},r.options=o,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return rG(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=SG(this.data,a);return s||!i||"string"!=typeof n?s:RG(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),kG(this.data,a,r),o.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=SG(this.data,a)||{};r?_G(s,n,o):s=AG(AG({},s),n),kG(this.data,a,s),i.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?AG(AG({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(vG),DG={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,o){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r,o))})),t}};function zG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function BG(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};return eG(this,n),r=t.call(this),OG&&vG.call(oG(r)),xG(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,oG(r)),r.options=o,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=mG.create("translator"),r}return rG(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],i=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=MG.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var o=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),i=!o.test(e);if(!i){var a=e.indexOf(n);a>0&&!o.test(e.substring(0,a))&&(i=!0)}return i}(e,n,r));if(i&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:o};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(r)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,t,r){var o=this;if("object"!==J$(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var i=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var f=t.nsSeparator||this.options.nsSeparator;return i?(p.res="".concat(u).concat(f).concat(l),p):"".concat(u).concat(f).concat(l)}return i?(p.res=l,p):l}var p=this.resolve(e,t),g=p&&p.res,m=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,y=Object.prototype.toString.apply(g),b=["[object Number]","[object Function]","[object RegExp]"],x=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,k="string"!=typeof g&&"boolean"!=typeof g&&"number"!=typeof g;if(w&&g&&k&&b.indexOf(y)<0&&("string"!=typeof x||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,g,BG(BG({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return i?(p.res=S,p):S}if(a){var C="[object Array]"===y,_=C?[]:{},E=C?v:m;for(var L in g)if(Object.prototype.hasOwnProperty.call(g,L)){var P="".concat(E).concat(a).concat(L);_[L]=this.translate(P,BG(BG({},t),{joinArrays:!1,ns:c})),_[L]===P&&(_[L]=g[L])}g=_}}else if(w&&"string"==typeof x&&"[object Array]"===y)(g=g.join(x))&&(g=this.extendTranslation(g,e,t,r));else{var O=!1,M=!1,T=void 0!==t.count&&"string"!=typeof t.count,A=n.hasDefaultValue(t),I=T?this.pluralResolver.getSuffix(d,t.count,t):"",R=t["defaultValue".concat(I)]||t.defaultValue;!this.isValidLookup(g)&&A&&(O=!0,g=R),this.isValidLookup(g)||(M=!0,g=l);var N=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,D=N&&M?void 0:g,z=A&&R!==g&&this.options.updateMissing;if(M||O||z){if(this.logger.log(z?"updateKey":"missingKey",d,u,l,z?R:g),a){var B=this.resolve(l,BG(BG({},t),{},{keySeparator:!1}));B&&B.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var j=[],F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&F&&F[0])for(var H=0;H1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,h=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),f=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(i=e,!FG["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(FG["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){o=n;var i,l=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,c,n,e,s);else{var u;d&&(u=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+p)),f){var g="".concat(c).concat(a.options.contextSeparator).concat(s.context);l.push(g),d&&(l.push(g+u),h&&l.push(g+p))}}for(;i=l.pop();)a.isValidLookup(t)||(r=i,t=a.getResource(n,e,i,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(vG);function WG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var VG=function(){function e(t){eG(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mG.create("languageUtils")}return rG(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=WG(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=WG(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=WG(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],i=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),r.forEach((function(e){o.indexOf(e)<0&&i(n.formatLanguageCode(e))})),o}}]),e}(),UG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],$G={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},GG=["v1","v2","v3"],qG={zero:0,one:1,two:2,few:3,many:4,other:5};function YG(){var e={};return UG.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:$G[t.fc]}}))})),e}var ZG=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eG(this,e),this.languageUtils=t,this.options=n,this.logger=mG.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=YG()}return rG(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(n){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return qG[e]-qG[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var i=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):i():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!GG.includes(this.options.compatibilityJSON)}}]),e}();function XG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function KG(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};eG(this,e),this.logger=mG.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return rG(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:PG,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?EG(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?EG(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?EG(t.nestingPrefix):t.nestingPrefixEscaped||EG("$t("),this.nestingSuffix=t.nestingSuffix?EG(t.nestingSuffix):t.nestingSuffixEscaped||EG(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var o,i,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(s.formatSeparator)<0){var o=CG(t,l,e);return s.alwaysFormat?s.format(o,void 0,n,KG(KG(KG({},r),t),{},{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),c=i.join(s.formatSeparator).trim();return s.format(CG(t,l,a),c,n,KG(KG(KG({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){var n=o[1].trim();if(void 0===(i=u(n)))if("function"==typeof d){var l=d(e,o,r);i="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))i="";else{if(h){i=o[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),i=""}else"string"==typeof i||s.useRawValueToEscape||(i=bG(i));var c=t.safeValue(i);if(e=e.replace(o[0],c),h?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,o,i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var a=(i=this.interpolate(i,o)).match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o=KG(KG({},t),o))}catch(j2){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),j2),"".concat(e).concat(n).concat(i)}return delete o.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var l=[];(o=KG({},a)).applyPostProcessor=!1,delete o.defaultValue;var c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(s.call(this,n[1].trim(),o),o))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=bG(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,a.lng,KG(KG({},a),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function JG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function eq(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};eG(this,e),this.logger=mG.create("formatter"),this.options=t,this.formats={number:tq((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:tq((function(e,t){var n=new Intl.NumberFormat(e,eq(eq({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:tq((function(e,t){var n=new Intl.DateTimeFormat(e,eq({},t));return function(e){return n.format(e)}})),relativetime:tq((function(e,t){var n=new Intl.RelativeTimeFormat(e,eq({},t));return function(e){return n.format(e,t.range||"day")}})),list:tq((function(e,t){var n=new Intl.ListFormat(e,eq({},t));return function(e){return n.format(e)}}))},this.init(t)}return rG(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=tq(t)}},{key:"format",value:function(e,t,n,r){var o=this,i=t.split(this.formatSeparator).reduce((function(e,t){var i=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach((function(e){if(e){var t=dG(e.split(":")),r=t[0],o=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=o),"false"===o&&(n[r.trim()]=!1),"true"===o&&(n[r.trim()]=!0),isNaN(o)||(n[r.trim()]=parseInt(o,10))}}))}return{formatName:t,formatOptions:n}}(t),a=i.formatName,s=i.formatOptions;if(o.formats[a]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=o.formats[a](e,u,eq(eq(eq({},s),r),c))}catch(d){o.logger.warn(d)}return l}return o.logger.warn("there was no format function for ".concat(a)),e}),e);return i}}]),e}();function rq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function oq(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:{};return eG(this,n),i=t.call(this),OG&&vG.call(oG(i)),i.backend=e,i.store=r,i.services=o,i.languageUtils=o.languageUtils,i.options=a,i.logger=mG.create("backendConnector"),i.waitingReads=[],i.maxParallelReads=a.maxParallelReads||10,i.readingCalls=0,i.maxRetries=a.maxRetries>=0?a.maxRetries:5,i.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(o,a.backend,a),i}return rG(n,[{key:"queueLoad",value:function(e,t,n,r){var o=this,i={},a={},s={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?void 0===a[s]&&(a[s]=!0):(o.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===i[s]&&(i[s]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),n&&this.store.addResourceBundle(o,i,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var o=wG(e,t,Object),i=o.obj,a=o.k;i[a]=i[a]||[],r&&(i[a]=i[a].concat(n)),r||i[a].push(n)}(n.loaded,[o],i),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:o,wait:i,callback:a});else{this.readingCalls++;var s=function(s,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}s&&l&&o2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(i," for language ").concat(o," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(i," for language ").concat(o),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s=oq(oq({},i),{},{isUpdate:o}),l=this.backend.create.bind(this.backend);if(l.length<6)try{var c;(c=5===l.length?l(e,t,n,r,s):l(e,t,n,r))&&"function"==typeof c.then?c.then((function(e){return a(null,e)})).catch(a):a(null,c)}catch(Jhe){a(Jhe)}else l(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}]),n}(vG);function sq(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===J$(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===J$(e[2])||"object"===J$(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function lq(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function cq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function uq(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(eG(this,n),e=t.call(this),OG&&vG.call(oG(e)),e.options=lq(r),e.services={},e.logger=mG,e.modules={external:[]},fq(oG(e)),o&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,o),sG(e,oG(e));setTimeout((function(){e.init(r,o)}),0)}return e}return rG(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=sq();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=uq(uq(uq({},r),this.options),lq(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=uq(uq({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var i;this.modules.logger?mG.init(o(this.modules.logger),this.options):mG.init(null,this.options),this.modules.formatter?i=this.modules.formatter:"undefined"!=typeof Intl&&(i=nq);var a=new VG(this.options);this.store=new NG(this.options.resources,this.options);var s=this.services;s.logger=mG,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new ZG(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!i||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=o(i),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new QG(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new aq(o(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=yG(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hq,r=n,o="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return r();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(o)a(o);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=yG();return e||(e=this.languages),t||(t=this.options.ns),n||(n=hq),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&DG.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=yG();this.emit("languageChanging",e);var o=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},i=function(i){e||i||!n.services.languageDetector||(i=[]);var a="string"==typeof i?i:n.services.languageUtils.getBestMatchFromCodes(i);a&&(n.language||o(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,i){i?(o(i),n.translator.changeLanguage(i),n.isLanguageChangingTo=void 0,n.emit("languageChanged",i),n.logger.log("languageChanged",i)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,o=function e(t,o){var i;if("object"!==J$(o)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||o&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=yG();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=yG();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],o=e.filter((function(e){return r.indexOf(e)<0}));return o.length?(this.options.preload=r.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new VG(sq());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hq,o=uq(uq(uq({},this.options),t),{isClone:!0}),i=new n(o);void 0===t.debug&&void 0===t.prefix||(i.logger=i.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){i[t]=e[t]})),i.services=uq({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new HG(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new pq(e,t)}));var gq=pq.createInstance();function mq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vq(e){return vq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vq(e)}function yq(e){var t=function(e,t){if("object"!==vq(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==vq(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===vq(t)?t:String(t)}function bq(e,t){for(var n=0;n0){var a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+="; Max-Age=".concat(Math.floor(a))}if(r.domain){if(!Cq.test(r.domain))throw new TypeError("option domain is invalid");i+="; Domain=".concat(r.domain)}if(r.path){if(!Cq.test(r.path))throw new TypeError("option path is invalid");i+="; Path=".concat(r.path)}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");i+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},Eq=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+60*n*1e3)),r&&(o.domain=r),document.cookie=_q(e,encodeURIComponent(t),o)},Lq=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),r=0;r-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=n.substring(1).split("&"),o=0;o0)r[o].substring(0,i)===e.lookupQuerystring&&(t=r[o].substring(i+1))}}return t}},Mq=null,Tq=function(){if(null!==Mq)return Mq;try{Mq="undefined"!==window&&null!==window.localStorage;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(j2){Mq=!1}return Mq},Aq={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Tq()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Tq()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Iq=null,Rq=function(){if(null!==Iq)return Iq;try{Iq="undefined"!==window&&null!==window.sessionStorage;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(j2){Iq=!1}return Iq},Nq={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Rq()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Rq()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Dq={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n0?t:void 0}},zq={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},Bq={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},jq={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var Fq=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mq(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}var t,n,r;return t=e,n=[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=Sq(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Pq),this.addDetector(Oq),this.addDetector(Aq),this.addDetector(Nq),this.addDetector(Dq),this.addDetector(zq),this.addDetector(Bq),this.addDetector(jq)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var r=t.detectors[e].lookup(t.options);r&&"string"==typeof r&&(r=[r]),r&&(n=n.concat(r))}})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}],n&&bq(t.prototype,n),r&&bq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Hq(e){return Hq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hq(e)}Fq.type="languageDetector";var Wq=[],Vq=Wq.forEach,Uq=Wq.slice;function $q(e){return Vq.call(Uq.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}function Gq(){return"function"==typeof XMLHttpRequest||"object"===("undefined"==typeof XMLHttpRequest?"undefined":Hq(XMLHttpRequest))}function qq(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Yq,Zq={exports:{}},Xq={exports:{}};function Kq(){return Yq||(Yq=1,function(e,t){var n="undefined"!=typeof self?self:o,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(j2){return!1}}(),i="FormData"in e,a="ArrayBuffer"in e;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&o&&function(e){return e&&DataView.prototype.isPrototypeOf(e)}(e)?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var k=[301,302,303,307,308];w.redirect=function(e,t){if(-1===k.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(Jhe){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,n){return new Promise((function(r,i){var a=new b(e,n);if(a.signal&&a.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new w(o,n))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&o&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=h,e.Request=b,e.Response=w),t.Headers=h,t.Request=b,t.Response=w,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(Xq,Xq.exports)),Xq.exports}!function(e,t){var n;if("function"==typeof fetch&&(n=void 0!==o&&o.fetch?o.fetch:"undefined"!=typeof window&&window.fetch?window.fetch:fetch),void 0!==qq&&("undefined"==typeof window||void 0===window.document)){var r=n||Kq();r.default&&(r=r.default),t.default=r,e.exports=t.default}}(Zq,Zq.exports);const Qq=Zq.exports,Jq=r({__proto__:null,default:Qq},[Zq.exports]);function eY(e){return eY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eY(e)}var tY,nY,rY;"function"==typeof fetch&&(tY="undefined"!=typeof global&&global.fetch?global.fetch:"undefined"!=typeof window&&window.fetch?window.fetch:fetch),Gq()&&("undefined"!=typeof global&&global.XMLHttpRequest?nY=global.XMLHttpRequest:"undefined"!=typeof window&&window.XMLHttpRequest&&(nY=window.XMLHttpRequest)),"function"==typeof ActiveXObject&&("undefined"!=typeof global&&global.ActiveXObject?rY=global.ActiveXObject:"undefined"!=typeof window&&window.ActiveXObject&&(rY=window.ActiveXObject)),tY||!Jq||nY||rY||(tY=Qq||Jq),"function"!=typeof tY&&(tY=void 0);var oY=function(e,t){if(t&&"object"===eY(t)){var n="";for(var r in t)n+="&"+encodeURIComponent(r)+"="+encodeURIComponent(t[r]);if(!n)return e;e=e+(-1!==e.indexOf("?")?"&":"?")+n.slice(1)}return e},iY=function(e,t,n){tY(e,t).then((function(e){if(!e.ok)return n(e.statusText||"Error",{status:e.status});e.text().then((function(t){n(null,{status:e.status,data:t})})).catch(n)})).catch(n)},aY=!1,sY=function(e,t,n,r){return"function"==typeof n&&(r=n,n=void 0),r=r||function(){},tY&&0!==t.indexOf("file:")?function(e,t,n,r){e.queryStringParams&&(t=oY(t,e.queryStringParams));var o=$q({},"function"==typeof e.customHeaders?e.customHeaders():e.customHeaders);n&&(o["Content-Type"]="application/json");var i="function"==typeof e.requestOptions?e.requestOptions(n):e.requestOptions,a=$q({method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:o},aY?{}:i);try{iY(t,a,r)}catch(j2){if(!i||0===Object.keys(i).length||!j2.message||j2.message.indexOf("not implemented")<0)return r(j2);try{Object.keys(i).forEach((function(e){delete a[e]})),iY(t,a,r),aY=!0}catch(Jhe){r(Jhe)}}}(e,t,n,r):Gq()||"function"==typeof ActiveXObject?function(e,t,n,r){n&&"object"===eY(n)&&(n=oY("",n).slice(1)),e.queryStringParams&&(t=oY(t,e.queryStringParams));try{var o;(o=nY?new nY:new rY("MSXML2.XMLHTTP.3.0")).open(n?"POST":"GET",t,1),e.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!e.withCredentials,n&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var i=e.customHeaders;if(i="function"==typeof i?i():i)for(var a in i)o.setRequestHeader(a,i[a]);o.onreadystatechange=function(){o.readyState>3&&r(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(n)}catch(j2){console&&console.log(j2)}}(e,t,n,r):void r(new Error("No fetch and no xhr implementation found!"))};function lY(e){return lY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lY(e)}function cY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uY(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};cY(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}var t,n,r;return t=e,n=[{key:"init",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=$q(n,this.options||{},hY()),this.allOptions=r,this.services&&this.options.reloadInterval&&setInterval((function(){return t.reload()}),this.options.reloadInterval)}},{key:"readMulti",value:function(e,t,n){this._readAny(e,e,t,t,n)}},{key:"read",value:function(e,t,n){this._readAny([e],e,[t],t,n)}},{key:"_readAny",value:function(e,t,n,r,o){var i,a=this,s=this.options.loadPath;"function"==typeof this.options.loadPath&&(s=this.options.loadPath(e,n)),(s=function(e){return!!e&&"function"==typeof e.then}(i=s)?i:Promise.resolve(i)).then((function(i){if(!i)return o(null,{});var s=a.services.interpolator.interpolate(i,{lng:e.join("+"),ns:n.join("+")});a.loadUrl(s,o,t,r)}))}},{key:"loadUrl",value:function(e,t,n,r){var o=this;this.options.request(this.options,e,void 0,(function(i,a){if(a&&(a.status>=500&&a.status<600||!a.status))return t("failed loading "+e+"; status code: "+a.status,!0);if(a&&a.status>=400&&a.status<500)return t("failed loading "+e+"; status code: "+a.status,!1);if(!a&&i&&i.message&&i.message.indexOf("Failed to fetch")>-1)return t("failed loading "+e+": "+i.message,!0);if(i)return t(i,!1);var s,l;try{s="string"==typeof a.data?o.options.parse(a.data,n,r):a.data}catch(j2){l="failed parsing "+e+" to json"}if(l)return t(l,!1);t(null,s)}))}},{key:"create",value:function(e,t,n,r,o){var i=this;if(this.options.addPath){"string"==typeof e&&(e=[e]);var a=this.options.parsePayload(t,n,r),s=0,l=[],c=[];e.forEach((function(n){var r=i.options.addPath;"function"==typeof i.options.addPath&&(r=i.options.addPath(n,t));var u=i.services.interpolator.interpolate(r,{lng:n,ns:t});i.options.request(i.options,u,a,(function(t,n){s+=1,l.push(t),c.push(n),s===e.length&&o&&o(l,c)}))}))}}},{key:"reload",value:function(){var e=this,t=this.services,n=t.backendConnector,r=t.languageUtils,o=t.logger,i=n.language;if(!i||"cimode"!==i.toLowerCase()){var a=[],s=function(e){r.toResolveHierarchy(e).forEach((function(e){a.indexOf(e)<0&&a.push(e)}))};s(i),this.allOptions.preload&&this.allOptions.preload.forEach((function(e){return s(e)})),a.forEach((function(t){e.allOptions.ns.forEach((function(e){n.read(t,e,"read",null,null,(function(r,i){r&&o.warn("loading namespace ".concat(e," for language ").concat(t," failed"),r),!r&&i&&o.log("loaded namespace ".concat(e," for language ").concat(t),i),n.loaded("".concat(t,"|").concat(e),r,i)}))}))}))}}}],n&&uY(t.prototype,n),r&&uY(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function pY(e){return pY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pY(e)}function gY(e){var t=function(e,t){if("object"!==pY(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==pY(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===pY(t)?t:String(t)}function mY(e,t,n){return(t=gY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vY(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r2&&void 0!==arguments[2]?arguments[2]:{},r=t.languages[0],o=!!t.options&&t.options.fallbackLng,i=t.languages[t.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))&&(!!t.hasResourceBundle(r,e)||(!(t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages))||!(!a(r,e)||o&&!a(i,e))))}function kY(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.languages||!t.languages.length)return bY("i18n.languages were undefined or empty",t.languages),!0;var r=void 0!==t.options.ignoreJSONStructure;return r?t.hasLoadedNamespace(e,{precheck:function(t,r){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):wY(e,t,n)}var SY=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,CY={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},_Y=function(e){return CY[e]};function EY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function LY(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};OY=LY(LY({},OY),e)}(e.options.react),function(e){PY=e}(e)}},RY=a.exports.createContext(),NY=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.usedNamespaces={}}var t,n,r;return t=e,(n=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach((function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}])&&AY(t.prototype,n),r&&AY(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function DY(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=t.i18n,r=a.exports.useContext(RY)||{},o=r.i18n,i=r.defaultNS,s=n||o||TY();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new NY),!s){bY("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},c=[l,{},!1];return c.t=l,c.i18n={},c.ready=!1,c}s.options.react&&void 0!==s.options.react.wait&&bY("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var u=jY(jY(jY({},MY()),s.options.react),t),d=u.useSuspense,h=u.keyPrefix,f=e||i||s.options&&s.options.defaultNS;f="string"==typeof f?[f]:f||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(f);var p=(s.isInitialized||s.initializedStoreOnce)&&f.every((function(e){return kY(e,s,u)}));function g(){return s.getFixedT(null,"fallback"===u.nsMode?f:f[0],h)}var m=a.exports.useState(g),v=zY(m,2),y=v[0],b=v[1],x=f.join(),w=FY(x),k=a.exports.useRef(!0);a.exports.useEffect((function(){var e=u.bindI18n,t=u.bindI18nStore;function n(){k.current&&b(g)}return k.current=!0,p||d||xY(s,f,(function(){k.current&&b(g)})),p&&w&&w!==x&&k.current&&b(g),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){k.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,n)})),t&&s&&t.split(" ").forEach((function(e){return s.store.off(e,n)}))}}),[s,x]);var S=a.exports.useRef(!0);a.exports.useEffect((function(){k.current&&!S.current&&b(g),S.current=!1}),[s,h]);var C=[y,s,p];if(C.t=y,C.i18n=s,C.ready=p,p)return C;if(!p&&!d)return C;throw new Promise((function(e){xY(s,f,(function(){e()}))}))}gq.use(fY).use(Fq).use(IY).init({fallbackLng:"en",debug:!1,ns:["common","gallery","hotkeys","options","settings","modelmanager","toast","tooltip","unifiedcanvas"],backend:{loadPath:"/locales/{{ns}}/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const WY=AV({name:"system",initialState:{isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:gq.isInitialized?gq.t("common:statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null},reducers:{setShouldDisplayInProgressType:(e,t)=>{e.shouldDisplayInProgressType=t.payload},setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.currentStatus=t.payload},setSystemStatus:(e,t)=>({...e,...t.payload}),errorOccurred:e=>{e.hasError=!0,e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=gq.t("common:statusError"),e.wasErrorSeen=!1},errorSeen:e=>{e.hasError=!1,e.wasErrorSeen=!0,e.currentStatus=e.isConnected?gq.t("common:statusConnected"):gq.t("common:statusDisconnected")},addLogEntry:(e,t)=>{const{timestamp:n,message:r,level:o}=t.payload,i={timestamp:n,message:r,level:o||"info"};e.log.push(i)},setShouldShowLogViewer:(e,t)=>{e.shouldShowLogViewer=t.payload},setIsConnected:(e,t)=>{e.isConnected=t.payload,e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.hasError=!1},setSocketId:(e,t)=>{e.socketId=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setOpenAccordions:(e,t)=>{e.openAccordions=t.payload},setSystemConfig:(e,t)=>({...e,...t.payload}),setShouldDisplayGuides:(e,t)=>{e.shouldDisplayGuides=t.payload},processingCanceled:e=>{e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=gq.t("common:statusProcessingCanceled")},generationRequested:e=>{e.isProcessing=!0,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=gq.t("common:statusPreparing")},setModelList:(e,t)=>{e.model_list=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},modelChangeRequested:e=>{e.currentStatus=gq.t("common:statusLoadingModel"),e.isCancelable=!1,e.isProcessing=!0,e.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(e,t)=>{e.saveIntermediatesInterval=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},setProcessingIndeterminateTask:(e,t)=>{e.isProcessing=!0,e.currentStatus=t.payload,e.currentStatusHasSteps=!1},setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setFoundModels:(e,t)=>{e.foundModels=t.payload},setOpenModel:(e,t)=>{e.openModel=t.payload}}}),{setShouldDisplayInProgressType:VY,setIsProcessing:UY,addLogEntry:$Y,setShouldShowLogViewer:GY,setIsConnected:qY,setSocketId:YY,setShouldConfirmOnDelete:ZY,setOpenAccordions:XY,setSystemStatus:KY,setCurrentStatus:QY,setSystemConfig:JY,setShouldDisplayGuides:eZ,processingCanceled:tZ,errorOccurred:nZ,errorSeen:rZ,setModelList:oZ,setIsCancelable:iZ,modelChangeRequested:aZ,setSaveIntermediatesInterval:sZ,setEnableImageDebugging:lZ,generationRequested:cZ,addToast:uZ,clearToastQueue:dZ,setProcessingIndeterminateTask:hZ,setSearchFolder:fZ,setFoundModels:pZ,setOpenModel:gZ}=WY.actions,mZ=WY.reducer,vZ=(e,t)=>Math.floor(e/t)*t,yZ=(e,t)=>Math.round(e/t)*t,bZ=(e,t,n,r,o,i,a)=>({x:e/2-(n+o/2)*a,y:t/2-(r+i/2)*a}),xZ=(e,t,n,r,o=.95)=>{const i=e*o/n,a=t*o/r;return Math.min(1,Math.min(i,a))},wZ=.95,kZ=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),SZ=e=>{const{width:t,height:n}=e,r={width:t,height:n},o=t/n;let i=t*n,a=448;for(;i<262144;){if(a+=64,t===n){r.width=512,r.height=512;break}o>1?(r.width=a,r.height=yZ(a/o,64)):o<1&&(r.height=a,r.width=yZ(a*o,64)),i=r.width*r.height}return r},CZ=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],_Z=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],EZ=e=>"line"===e.kind&&"mask"===e.layer,LZ=e=>"image"===e.kind&&"base"===e.layer,PZ=e=>"line"===e.kind,OZ={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},MZ=AV({name:"canvas",initialState:{boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],inpaintReplace:.1,isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:OZ,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,shouldUseInpaintReplace:!1,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,"move"!==n&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;"move"!==t&&(e.tool="brush"===t?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.layerState.objects=e.layerState.objects.filter((e=>!EZ(e))),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{stageDimensions:r}=e,o={width:vZ(A$.clamp(n.width,64,512),64),height:vZ(A$.clamp(n.height,64,512),64)},i={x:yZ(n.width/2-o.width/2,64),y:yZ(n.height/2-o.height/2,64)};if("auto"===e.boundingBoxScaleMethod){const t=SZ(o);e.scaledBoundingBoxDimensions=t}e.boundingBoxDimensions=o,e.boundingBoxCoordinates=i,e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.layerState={...OZ,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const a=xZ(r.width,r.height,n.width,n.height,wZ),s=bZ(r.width,r.height,0,0,n.width,n.height,a);e.stageScale=a,e.stageCoordinates=s,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=(r=t.payload,{width:yZ(r.width,64),height:yZ(r.height,64)});var r;if(e.boundingBoxDimensions=n,"auto"===e.boundingBoxScaleMethod){const t=SZ(n);e.scaledBoundingBoxDimensions=t}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=kZ(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldUseInpaintReplace:(e,t)=>{e.shouldUseInpaintReplace=t.payload},setInpaintReplace:(e,t)=>{e.inpaintReplace=t.payload},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},addImageToStagingArea:(e,t)=>{const{boundingBox:n,image:r}=t.payload;n&&r&&(e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...OZ.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:o,brushSize:i,shouldRestrictStrokesToBox:a}=e;if("move"===n||"colorPicker"===n)return;const s=i/2,l="base"===r&&"brush"===n?{color:o}:{};e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const c={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(c.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(c),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(PZ);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(A$.cloneDeep(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.layerState=OZ,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(LZ),o={width:Math.floor(t),height:Math.floor(n)};if(!r){const t=xZ(o.width,o.height,512,512,wZ),n=bZ(o.width,o.height,0,0,512,512,t),r={width:512,height:512};if(e.stageScale=t,e.stageCoordinates=n,e.stageDimensions=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=r,"auto"===e.boundingBoxScaleMethod){const t=SZ(r);e.scaledBoundingBoxDimensions=t}return}const{width:i,height:a}=r,s=xZ(t,n,i,a,.95),l=bZ(o.width,o.height,0,0,i,a,s);e.minimumStageScale=s,e.stageScale=s,e.stageCoordinates=kZ(l),e.stageDimensions=o,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(LZ)){const t=xZ(r.width,r.height,512,512,wZ),n=bZ(r.width,r.height,0,0,512,512,t),o={width:512,height:512};if(e.stageScale=t,e.stageCoordinates=n,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=o,"auto"===e.boundingBoxScaleMethod){const t=SZ(o);e.scaledBoundingBoxDimensions=t}}},resetCanvasView:(e,t)=>{const{contentRect:n}=t.payload,{stageDimensions:{width:r,height:o}}=e,{x:i,y:a,width:s,height:l}=n;if(0!==s&&0!==l){const t=xZ(r,o,s,l,wZ),n=bZ(r,o,i,a,s,l,t);e.stageScale=t,e.stageCoordinates=n}else{const t=xZ(r,o,512,512,wZ),n=bZ(r,o,0,0,512,512,t),i={width:512,height:512};if(e.stageScale=t,e.stageCoordinates=n,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=i,"auto"===e.boundingBoxScaleMethod){const t=SZ(i);e.scaledBoundingBoxDimensions=t}}},nextStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:e=>{const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({...t[n]}),e.layerState.stagingArea={...OZ.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:o}=e,i=r.width/o,a=r.height/o;if(n.x<0||n.x+t.width>i||n.y<0||n.y+t.height>a){const t={width:vZ(A$.clamp(i,64,512),64),height:vZ(A$.clamp(a,64,512),64)},n={x:yZ(i/2-t.width/2,64),y:yZ(a/2-t.height/2,64)};if(e.boundingBoxDimensions=t,e.boundingBoxCoordinates=n,"auto"===e.boundingBoxScaleMethod){const n=SZ(t);e.scaledBoundingBoxDimensions=n}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,"auto"===t.payload){const t=SZ(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=t}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(A$.cloneDeep(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}}}),{addEraseRect:TZ,addFillRect:AZ,addImageToStagingArea:IZ,addLine:RZ,addPointToCurrentLine:NZ,clearCanvasHistory:DZ,clearMask:zZ,commitColorPickerColor:BZ,commitStagingAreaImage:jZ,discardStagedImages:FZ,fitBoundingBoxToStage:HZ,mouseLeftCanvas:WZ,nextStagingAreaImage:VZ,prevStagingAreaImage:UZ,redo:$Z,resetCanvas:GZ,resetCanvasInteractionState:qZ,resetCanvasView:YZ,resizeAndScaleCanvas:ZZ,resizeCanvas:XZ,setBoundingBoxCoordinates:KZ,setBoundingBoxDimensions:QZ,setBoundingBoxPreviewFill:JZ,setBoundingBoxScaleMethod:eX,setBrushColor:tX,setBrushSize:nX,setCanvasContainerDimensions:rX,setColorPickerColor:oX,setCursorPosition:iX,setDoesCanvasNeedScaling:aX,setInitialCanvasImage:sX,setInpaintReplace:lX,setIsDrawing:cX,setIsMaskEnabled:uX,setIsMouseOverBoundingBox:dX,setIsMoveBoundingBoxKeyHeld:hX,setIsMoveStageKeyHeld:fX,setIsMovingBoundingBox:pX,setIsMovingStage:gX,setIsTransformingBoundingBox:mX,setLayer:vX,setMaskColor:yX,setMergedCanvas:bX,setShouldAutoSave:xX,setShouldCropToBoundingBoxOnSave:wX,setShouldDarkenOutsideBoundingBox:kX,setShouldLockBoundingBox:SX,setShouldPreserveMaskedArea:CX,setShouldShowBoundingBox:_X,setShouldShowBrush:EX,setShouldShowBrushPreview:LX,setShouldShowCanvasDebugInfo:PX,setShouldShowCheckboardTransparency:OX,setShouldShowGrid:MX,setShouldShowIntermediates:TX,setShouldShowStagingImage:AX,setShouldShowStagingOutline:IX,setShouldSnapToGrid:RX,setShouldUseInpaintReplace:NX,setStageCoordinates:DX,setStageScale:zX,setTool:BX,toggleShouldLockBoundingBox:jX,toggleTool:FX,undo:HX,setScaledBoundingBoxDimensions:WX,setShouldRestrictStrokesToBox:VX}=MZ.actions,UX=MZ.reducer,$X=Object.create(null);$X.open="0",$X.close="1",$X.ping="2",$X.pong="3",$X.message="4",$X.upgrade="5",$X.noop="6";const GX=Object.create(null);Object.keys($X).forEach((e=>{GX[$X[e]]=e}));const qX={type:"error",data:"parser error"},YX="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),ZX="function"==typeof ArrayBuffer,XX=({type:e,data:t},n,r)=>YX&&t instanceof Blob?n?r(t):KX(t,r):ZX&&(t instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer)(t))?n?r(t):KX(new Blob([t]),r):r($X[e]+(t||"")),KX=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+e)},n.readAsDataURL(e)},QX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",JX="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e{if("string"!=typeof e)return{type:"message",data:rK(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:nK(e.substring(1),t)};return GX[n]?e.length>1?{type:GX[n],data:e.substring(1)}:{type:GX[n]}:qX},nK=(e,t)=>{if(eK){const n=(e=>{let t,n,r,o,i,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const c=new ArrayBuffer(a),u=new Uint8Array(c);for(t=0;t>4,u[l++]=(15&r)<<4|o>>2,u[l++]=(3&o)<<6|63&i;return c})(e);return rK(n,t)}return{base64:!0,data:e}},rK=(e,t)=>"blob"===t&&e instanceof ArrayBuffer?new Blob([e]):e,oK=String.fromCharCode(30);function iK(e){if(e)return function(e){for(var t in iK.prototype)e[t]=iK.prototype[t];return e}(e)}iK.prototype.on=iK.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},iK.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},iK.prototype.off=iK.prototype.removeListener=iK.prototype.removeAllListeners=iK.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const lK=setTimeout,cK=clearTimeout;function uK(e,t){t.useNativeTimers?(e.setTimeoutFn=lK.bind(aK),e.clearTimeoutFn=cK.bind(aK)):(e.setTimeoutFn=setTimeout.bind(aK),e.clearTimeoutFn=clearTimeout.bind(aK))}function dK(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}class hK extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class fK extends iK{constructor(e){super(),this.writable=!1,uK(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new hK(e,t,n)),this}open(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=tK(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const pK="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),gK={};let mK,vK=0,yK=0;function bK(e){let t="";do{t=pK[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function xK(){const e=bK(+new Date);return e!==mK?(vK=0,mK=e):e+"."+bK(vK++)}for(;yK<64;yK++)gK[pK[yK]]=yK;function wK(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}let kK=!1;try{kK="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Jhe){}const SK=kK;function CK(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||SK))return new XMLHttpRequest}catch(j2){}if(!t)try{return new(aK[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(j2){}}function _K(){}const EK=null!=new CK({xdomain:!1}).responseType;class LK extends iK{constructor(e,t){super(),uK(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.create()}create(){const e=sK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new CK(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&t.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(j2){}if("POST"===this.method)try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(j2){}try{t.setRequestHeader("Accept","*/*")}catch(j2){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{4===t.readyState&&(200===t.status||1223===t.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof t.status?t.status:0)}),0))},t.send(this.data)}catch(j2){return void this.setTimeoutFn((()=>{this.onError(j2)}),0)}"undefined"!=typeof document&&(this.index=LK.requestsCount++,LK.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=_K,e)try{this.xhr.abort()}catch(j2){}"undefined"!=typeof document&&delete LK.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(LK.requestsCount=0,LK.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",PK);else if("function"==typeof addEventListener){addEventListener("onpagehide"in aK?"pagehide":"unload",PK,!1)}function PK(){for(let e in LK.requests)LK.requests.hasOwnProperty(e)&&LK.requests[e].abort()}const OK="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),MK=aK.WebSocket||aK.MozWebSocket,TK="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const AK={websocket:class extends fK{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=TK?{}:sK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=TK?new MK(e,t,n):t?new MK(e,t):new MK(e)}catch(Jhe){return this.emitReserved("error",Jhe)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(j2){}r&&OK((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let n="";this.opts.port&&("wss"===t&&443!==Number(this.opts.port)||"ws"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=xK()),this.supportsBinary||(e.b64=1);const r=wK(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}check(){return!!MK}},polling:class extends fK{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}const t=e&&e.forceBase64;this.supportsBinary=EK&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(oK),r=[];for(let o=0;o{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach(((e,i)=>{XX(e,!1,(e=>{r[i]=e,++o===n&&t(r.join(oK))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let n="";!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=xK()),this.supportsBinary||e.sid||(e.b64=1),this.opts.port&&("https"===t&&443!==Number(this.opts.port)||"http"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port);const r=wK(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new LK(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},IK=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,RK=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function NK(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=IK.exec(e||""),i={},a=14;for(;a--;)i[RK[a]]=o[a]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,i.query),i}class DK extends iK{constructor(e,t={}){super(),e&&"object"==typeof e&&(t=e,e=null),e?(e=NK(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=NK(t.host).host),uK(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,o=n.length;r{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new AK[e](n)}open(){let e;if(this.opts.rememberUpgrade&&DK.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(j2){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),n=!1;DK.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;DK.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,c(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function a(){i("transport closed")}function s(){i("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",a),this.off("close",s),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",a),this.once("close",s),this.once("upgrading",l),t.open()}onOpen(){if(this.readyState="open",DK.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(e){DK.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||jK&&e instanceof Blob||FK&&e instanceof File}function WK(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t=0&&e.num0;case qK.ACK:case qK.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class ZK{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=$K(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const XK=Object.freeze(Object.defineProperty({__proto__:null,protocol:5,get PacketType(){return qK},Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==qK.EVENT&&e.type!==qK.ACK||!WK(e)?[this.encodeAsString(e)]:(e.type=e.type===qK.EVENT?qK.BINARY_EVENT:qK.BINARY_ACK,this.encodeAsBinary(e))}encodeAsString(e){let t=""+e.type;return e.type!==qK.BINARY_EVENT&&e.type!==qK.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=VK(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Decoder:YK},Symbol.toStringTag,{value:"Module"}));function KK(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const QK=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class JK extends iK{constructor(e,t,n){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[KK(e,"open",this.onopen.bind(this)),KK(e,"packet",this.onpacket.bind(this)),KK(e,"error",this.onerror.bind(this)),KK(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(QK.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');t.unshift(e);const n={type:qK.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){const n=this.flags.timeout;if(void 0===n)return void(this.acks[e]=t);const r=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(r),t.apply(this,[null,...e])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this.packet({type:qK.CONNECT,data:e})})):this.packet({type:qK.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case qK.CONNECT:if(e.data&&e.data.sid){const t=e.data.sid;this.onconnect(t)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qK.EVENT:case qK.BINARY_EVENT:this.onevent(e);break;case qK.ACK:case qK.BINARY_ACK:this.onack(e);break;case qK.DISCONNECT:this.ondisconnect();break;case qK.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:qK.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qK.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}eQ.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},eQ.prototype.reset=function(){this.attempts=0},eQ.prototype.setMin=function(e){this.ms=e},eQ.prototype.setMax=function(e){this.max=e},eQ.prototype.setJitter=function(e){this.jitter=e};class tQ extends iK{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,uK(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new eQ({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||XK;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new DK(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=KK(t,"open",(function(){n.onopen(),e&&e()})),o=KK(t,"error",(t=>{n.cleanup(),n._readyState="closed",this.emitReserved("error",t),e?e(t):n.maybeReconnectOnOpen()}));if(!1!==this._timeout){const e=this._timeout;0===e&&r();const n=this.setTimeoutFn((()=>{r(),t.close(),t.emit("error",new Error("timeout"))}),e);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(KK(e,"ping",this.onping.bind(this)),KK(e,"data",this.ondata.bind(this)),KK(e,"error",this.onerror.bind(this)),KK(e,"close",this.onclose.bind(this)),KK(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(j2){this.onclose("parse error",j2)}}ondecoded(e){OK((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n||(n=new JK(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const nQ={};function rQ(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=NK(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,a=nQ[o]&&i in nQ[o].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new tQ(r,t):(nQ[o]||(nQ[o]=new tQ(r,t)),s=nQ[o]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}let oQ;Object.assign(rQ,{Manager:tQ,Socket:JK,io:rQ,connect:rQ});const iQ=new Uint8Array(16);function aQ(){if(!oQ&&(oQ="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!oQ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oQ(iQ)}const sQ=[];for(let e=0;e<256;++e)sQ.push((e+256).toString(16).slice(1));const lQ={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function cQ(e,t,n){if(lQ.randomUUID&&!t&&!e)return lQ.randomUUID();const r=(e=e||{}).random||(e.rng||aQ)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(sQ[e[t+0]]+sQ[e[t+1]]+sQ[e[t+2]]+sQ[e[t+3]]+"-"+sQ[e[t+4]]+sQ[e[t+5]]+"-"+sQ[e[t+6]]+sQ[e[t+7]]+"-"+sQ[e[t+8]]+sQ[e[t+9]]+"-"+sQ[e[t+10]]+sQ[e[t+11]]+sQ[e[t+12]]+sQ[e[t+13]]+sQ[e[t+14]]+sQ[e[t+15]]).toLowerCase()}(r)}var uQ=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,dQ=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,hQ=/[^-+\dA-Z]/g;function fQ(e,t,n,r){if(1!==arguments.length||"string"!=typeof e||/\d/.test(e)||(t=e,e=void 0),(e=e||0===e?e:new Date)instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");var o=(t=String(pQ[t]||t||pQ.default)).slice(0,4);"UTC:"!==o&&"GMT:"!==o||(t=t.slice(4),n=!0,"GMT:"===o&&(r=!0));var i=function(){return n?"getUTC":"get"},a=function(){return e[i()+"Date"]()},s=function(){return e[i()+"Day"]()},l=function(){return e[i()+"Month"]()},c=function(){return e[i()+"FullYear"]()},u=function(){return e[i()+"Hours"]()},d=function(){return e[i()+"Minutes"]()},h=function(){return e[i()+"Seconds"]()},f=function(){return e[i()+"Milliseconds"]()},p=function(){return n?0:e.getTimezoneOffset()},g=function(){return yQ(e)},m=function(){return bQ(e)},v={d:function(){return a()},dd:function(){return mQ(a())},ddd:function(){return gQ.dayNames[s()]},DDD:function(){return vQ({y:c(),m:l(),d:a(),_:i(),dayName:gQ.dayNames[s()],short:!0})},dddd:function(){return gQ.dayNames[s()+7]},DDDD:function(){return vQ({y:c(),m:l(),d:a(),_:i(),dayName:gQ.dayNames[s()+7]})},m:function(){return l()+1},mm:function(){return mQ(l()+1)},mmm:function(){return gQ.monthNames[l()]},mmmm:function(){return gQ.monthNames[l()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return mQ(c(),4)},h:function(){return u()%12||12},hh:function(){return mQ(u()%12||12)},H:function(){return u()},HH:function(){return mQ(u())},M:function(){return d()},MM:function(){return mQ(d())},s:function(){return h()},ss:function(){return mQ(h())},l:function(){return mQ(f(),3)},L:function(){return mQ(Math.floor(f()/10))},t:function(){return u()<12?gQ.timeNames[0]:gQ.timeNames[1]},tt:function(){return u()<12?gQ.timeNames[2]:gQ.timeNames[3]},T:function(){return u()<12?gQ.timeNames[4]:gQ.timeNames[5]},TT:function(){return u()<12?gQ.timeNames[6]:gQ.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":xQ(e)},o:function(){return(p()>0?"-":"+")+mQ(100*Math.floor(Math.abs(p())/60)+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+mQ(Math.floor(Math.abs(p())/60),2)+":"+mQ(Math.floor(Math.abs(p())%60),2)},S:function(){return["th","st","nd","rd"][a()%10>3?0:(a()%100-a()%10!=10)*a()%10]},W:function(){return g()},WW:function(){return mQ(g())},N:function(){return m()}};return t.replace(uQ,(function(e){return e in v?v[e]():e.slice(1,e.length-1)}))}var pQ={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},gQ={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},mQ=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return String(e).padStart(t,"0")},vQ=function(e){var t=e.y,n=e.m,r=e.d,o=e._,i=e.dayName,a=e.short,s=void 0!==a&&a,l=new Date,c=new Date;c.setDate(c[o+"Date"]()-1);var u=new Date;u.setDate(u[o+"Date"]()+1);return l[o+"FullYear"]()===t&&l[o+"Month"]()===n&&l[o+"Date"]()===r?s?"Tdy":"Today":c[o+"FullYear"]()===t&&c[o+"Month"]()===n&&c[o+"Date"]()===r?s?"Ysd":"Yesterday":u[o+"FullYear"]()===t&&u[o+"Month"]()===n&&u[o+"Date"]()===r?s?"Tmw":"Tomorrow":i},yQ=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var o=(t-n)/6048e5;return 1+Math.floor(o)},bQ=function(e){var t=e.getDay();return 0===t&&(t=7),t},xQ=function(e){return(String(e).match(dQ)||[""]).pop().replace(hQ,"").replace(/GMT\+0000/g,"UTC")};const wQ=MV("socketio/generateImage"),kQ=MV("socketio/runESRGAN"),SQ=MV("socketio/runFacetool"),CQ=MV("socketio/deleteImage"),_Q=MV("socketio/requestImages"),EQ=MV("socketio/requestNewImages"),LQ=MV("socketio/cancelProcessing"),PQ=MV("socketio/requestSystemConfig"),OQ=MV("socketio/searchForModels"),MQ=MV("socketio/addNewModel"),TQ=MV("socketio/deleteModel"),AQ=MV("socketio/requestModelChange"),IQ=MV("socketio/saveStagingAreaImageToGallery"),RQ=MV("socketio/requestEmptyTempFolder"),NQ=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],DQ=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],zQ=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],BQ=[{key:"2x",value:2},{key:"4x",value:4}],jQ=4294967295,FQ=["gfpgan","codeformer"],HQ=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}],WQ=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);var VQ=Math.PI/180;const UQ="undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},$Q={_global:UQ,version:"8.3.14",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>$Q.angleDeg?e*VQ:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>$Q.DD.isDragging,isDragReady:()=>!!$Q.DD.node,releaseCanvasOnDestroy:!0,document:UQ.document,_injectGlobal(e){UQ.Konva=e}},GQ=e=>{$Q[e.prototype.getClassName()]=e};$Q._injectGlobal($Q);class qQ{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new qQ(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,o=this.m[1]*t+this.m[3]*n,i=this.m[0]*-n+this.m[2]*t,a=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,o=this.m[2]+this.m[0]*e,i=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],o=this.m[1]*e.m[2]+this.m[3]*e.m[3],i=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],a=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=o,this.m[4]=i,this.m[5]=a,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,o=this.m[0]*e,i=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=o,this.m[4]=i,this.m[5]=a,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],o=e*r-t*n;let i={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var a=Math.sqrt(e*e+t*t);i.rotation=t>0?Math.acos(e/a):-Math.acos(e/a),i.scaleX=a,i.scaleY=o/a,i.skewX=(e*n+t*r)/o,i.skewY=0}else if(0!=n||0!=r){var s=Math.sqrt(n*n+r*r);i.rotation=Math.PI/2-(r>0?Math.acos(-n/s):-Math.acos(n/s)),i.scaleX=o/s,i.scaleY=s,i.skewX=0,i.skewY=(e*n+t*r)/o}return i.rotation=tJ._getRotation(i.rotation),i}}var YQ=Math.PI/180,ZQ=180/Math.PI,XQ="Konva error: ",KQ={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},QQ=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,JQ=[];const eJ="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},tJ={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){JQ.push(e),1===JQ.length&&eJ((function(){const e=JQ;JQ=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(j2){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=tJ.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in KQ?{r:(t=KQ[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=QQ.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",tJ._namedColorToRBA(e)||tJ._hex3ColorToRGBA(e)||tJ._hex6ColorToRGBA(e)||tJ._rgbColorToRGBA(e)||tJ._rgbaColorToRGBA(e)||tJ._hslColorToRGBA(e)),_namedColorToRBA(e){var t=KQ[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let a,s,l;if(0===o)return l=255*i,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};a=i<.5?i*(1+o):i+o-i*o;const c=2*i-a,u=[0,0,0];for(let e=0;e<3;e++)s=r+1/3*-(e-1),s<0&&s++,s>1&&s--,l=6*s<1?c+6*(a-c)*s:2*s<1?a:3*s<2?c+(a-c)*(2/3-s)*6:c,u[e]=255*l;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.heighte.slice(0),degToRad:e=>e*YQ,radToDeg:e=>e*ZQ,_degToRad:e=>(tJ.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),tJ.degToRad(e)),_radToDeg:e=>(tJ.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),tJ.radToDeg(e)),_getRotation:e=>$Q.angleDeg?tJ.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(XQ+e)},error(e){console.error(XQ+e)},warn(e){$Q.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e1?(a=n,s=r,l=(n-o)*(n-o)+(r-i)*(r-i)):l=((a=e+u*(n-e))-o)*(a-o)+((s=t+u*(r-t))-i)*(s-i)}return[a,s,l]},_getProjectionToLine(e,t,n){var r=tJ.cloneObject(e),o=Number.MAX_VALUE;return t.forEach((function(i,a){if(n||a!==t.length-1){var s=t[(a+1)%t.length],l=tJ._getProjectionToSegment(i.x,i.y,s.x,s.y,e.x,e.y),c=l[0],u=l[1],d=l[2];dt.length){var a=t;t=e,e=a}for(r=0;re.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){$Q.releaseCanvasOnDestroy&&e.forEach((e=>{e.width=0,e.height=0}))}};function nJ(e){return tJ._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||tJ._isBoolean(e)?e:Object.prototype.toString.call(e)}function rJ(e){return e>255?255:e<0?0:Math.round(e)}function oJ(){if($Q.isUnminified)return function(e,t){return tJ._isNumber(e)||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function iJ(e){if($Q.isUnminified)return function(t,n){let r=tJ._isNumber(t),o=tJ._isArray(t)&&t.length==e;return r||o||tJ.warn(nJ(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}function aJ(){if($Q.isUnminified)return function(e,t){return tJ._isNumber(e)||"auto"===e||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function sJ(){if($Q.isUnminified)return function(e,t){return tJ._isString(e)||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function lJ(){if($Q.isUnminified)return function(e,t){const n=tJ._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function cJ(){if($Q.isUnminified)return function(e,t){return!0===e||!1===e||tJ.warn(nJ(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}var uJ="get",dJ="set";const hJ={addGetterSetter(e,t,n,r,o){hJ.addGetter(e,t,n),hJ.addSetter(e,t,r,o),hJ.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=uJ+tJ._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,r){var o=dJ+tJ._capitalize(t);e.prototype[o]||hJ.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var o=dJ+tJ._capitalize(t);e.prototype[o]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,o){var i,a,s=n.length,l=tJ._capitalize,c=uJ+l(t),u=dJ+l(t);e.prototype[c]=function(){var e={};for(i=0;i{this._setAttr(t+l(e),void 0)})),this._fireChangeEvent(t,a,e),o&&o.call(this),this},hJ.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=tJ._capitalize(t),r=dJ+n,o=uJ+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){tJ.error("Adding deprecated "+t);var o=uJ+tJ._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){tJ.error(i);var e=this.attrs[t];return void 0===e?n:e},hJ.addSetter(e,t,r,(function(){tJ.error(i)})),hJ.addOverloadedGetterSetter(e,t)},backCompat(e,t){tJ.each(t,(function(t,n){var r=e.prototype[n],o=uJ+tJ._capitalize(t),i=dJ+tJ._capitalize(t);function a(){r.apply(this,arguments),tJ.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=a,e.prototype[o]=a,e.prototype[i]=a}))},afterSetFilter(){this._filterUpToDate=!1}};function fJ(e){var t,n,r=[],o=e.length,i=tJ;for(t=0;t"number"==typeof e?Math.floor(e):e))),l+="("+i.join(",")+")")):(l+=r.property,e||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){var t=e.getLineCap();t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){var t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,a,s,l){var c=arguments,u=this._context;3===c.length?u.drawImage(e,t,n):5===c.length?u.drawImage(e,t,n,r,o):9===c.length&&u.drawImage(e,t,n,r,o,i,a,s,l)}ellipse(e,t,n,r,o,i,a,s){this._context.ellipse(e,t,n,r,o,i,a,s)}isPointInPath(e,t){return this._context.isPointInPath(e,t)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,r=pJ.length,o=this.setAttr,i=function(e){var r,o=n[e];n[e]=function(){return t=fJ(Array.prototype.slice.call(arguments,0)),r=o.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return kJ._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const t=[];kJ._dragElements.forEach(((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=tJ._getFirstPointerId(e));const a=i._changedPointerPositions.find((e=>e.id===n.pointerId));if(a){if("dragging"!==n.dragStatus){var s=o.dragDistance();if(Math.max(Math.abs(a.x-n.startPointerPos.x),Math.abs(a.y-n.startPointerPos.y)){t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const t=[];kJ._dragElements.forEach((n=>{const{node:r}=n,o=r.getStage();e&&o.setPointersPositions(e);if(!o._changedPointerPositions.find((e=>e.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(kJ.justDragged=!0,$Q._mouseListenClick=!1,$Q._touchListenClick=!1,$Q._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof $Q.Stage&&n.node;i&&-1===t.indexOf(i)&&t.push(i)})),t.forEach((e=>{e.draw()}))},_endDragAfter(e){kJ._dragElements.forEach(((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&kJ._dragElements.delete(n)}))}};$Q.isBrowser&&(window.addEventListener("mouseup",kJ._endDragBefore,!0),window.addEventListener("touchend",kJ._endDragBefore,!0),window.addEventListener("mousemove",kJ._drag),window.addEventListener("touchmove",kJ._drag),window.addEventListener("mouseup",kJ._endDragAfter,!1),window.addEventListener("touchend",kJ._endDragAfter,!1));var SJ="absoluteOpacity",CJ="allEventListeners",_J="absoluteTransform",EJ="absoluteScale",LJ="canvas",PJ="listening",OJ="mouseenter",MJ="mouseleave",TJ="Shape",AJ=" ",IJ="stage",RJ="transform",NJ="visible",DJ=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(AJ);let zJ=1;class BJ{constructor(e){this._id=zJ++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==RJ&&e!==_J||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===RJ||e===_J)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(AJ);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(LJ)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===_J&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(LJ)){const{scene:e,filter:t,hit:n}=this._cache.get(LJ);tJ.releaseCanvas(e,t,n),this._cache.delete(LJ)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(t.width||n.width),o=Math.ceil(t.height||n.height),i=t.pixelRatio,a=void 0===t.x?Math.floor(n.x):t.x,s=void 0===t.y?Math.floor(n.y):t.y,l=t.offset||0,c=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(r&&o){a-=l,s-=l;var d=new xJ({pixelRatio:i,width:r+=2*l+1,height:o+=2*l+1}),h=new xJ({pixelRatio:i,width:0,height:0}),f=new wJ({pixelRatio:u,width:r,height:o}),p=d.getContext(),g=f.getContext();return f.isCache=!0,d.isCache=!0,this._cache.delete(LJ),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(d.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),p.save(),g.save(),p.translate(-a,-s),g.translate(-a,-s),this._isUnderCache=!0,this._clearSelfAndDescendantCache(SJ),this._clearSelfAndDescendantCache(EJ),this.drawScene(d,this),this.drawHit(f,this),this._isUnderCache=!1,p.restore(),g.restore(),c&&(p.save(),p.beginPath(),p.rect(0,0,r,o),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(LJ,{scene:d,filter:h,hit:f,x:a,y:s}),this._requestDraw(),this}tJ.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(LJ)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,r,o,i,a=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],s=this.getAbsoluteTransform(t);return a.forEach((function(e){var t=s.point(e);void 0===n&&(n=o=t.x,r=i=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.x),i=Math.max(i,t.y)})),{x:n,y:r,width:o-n,height:i-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,r,o=this.filters(),i=this._getCanvasCache(),a=i.scene,s=i.filter,l=s.getContext();if(o){if(!this._filterUpToDate){var c=a.pixelRatio;s.setSize(a.width/a.pixelRatio,a.height/a.pixelRatio);try{for(e=o.length,l.clear(),l.drawImage(a._canvas,0,0,a.getWidth()/c,a.getHeight()/c),t=l.getImageData(0,0,s.getWidth(),s.getHeight()),n=0;n{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+tJ._capitalize(t),tJ._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(PJ,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(NJ,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;kJ._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var o=!t&&!$Q.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,o=this.getDepth(),i=this,a=0;return"Stage"!==i.nodeType&&function s(l){for(e=[],t=l.length,n=0;n0&&e[0].getDepth()<=o&&s(e)}(i.getStage().getChildren()),a}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(RJ),this._clearSelfAndDescendantCache(_J)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),o=new qQ,i=this.offset();return o.m=r.slice(),o.translate(i.x,i.y),o.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(RJ);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(RJ),this._clearSelfAndDescendantCache(_J),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var t=e.x,n=e.y,r=this.x(),o=this.y();return void 0!==t&&(r+=t),void 0!==n&&(o+=n),this.setPosition({x:r,y:o}),this}_eachAncestorReverse(e,t){var n,r,o=[],i=this.getParent();if(!t||t._id!==this._id){for(o.unshift(this);i&&(!t||i._id!==t._id);)o.unshift(i),i=i.parent;for(n=o.length,r=0;r0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return tJ.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return tJ.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&tJ.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(SJ,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,r,o={},i=this.getAttrs();for(e in o.attrs={},i)t=i[e],tJ.isObject(t)&&!tJ._isPlainObject(t)&&!tJ._isArray(t)||(n="function"==typeof this[e]&&this[e],delete i[e],r=n?n.call(this):null,i[e]=t,r!==t&&(o.attrs[e]=t));return o.className=this.getClassName(),tJ._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var o=this.parent;o;){if(o===n)return r;o._isMatch(e)&&r.push(o),o=o.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),o=r.length;for(t=0;t{try{const n=null==e?void 0:e.callback;n&&delete e.callback,tJ._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(Jhe){n(Jhe)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}))}catch(Jhe){n(Jhe)}}))}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():$Q.dragDistance}_off(e,t,n){var r,o,i,a=this.eventListeners[e];for(r=0;r=0)&&!this.isDragging()){var t=!1;kJ._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=kJ._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&kJ._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return tJ.haveIntersection(n,this.getClientRect())}static create(e,t){return tJ._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,r,o,i=BJ.prototype.getClassName.call(e),a=e.children;t&&(e.attrs.container=t),$Q[i]||(tJ.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape");if(n=new(0,$Q[i])(e.attrs),a)for(r=a.length,o=0;o0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(arguments.length>1){for(var t=0;t0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const o=r._isMatch(e);return o&&n.push(r),!(!o||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=BJ.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=BJ.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),o=r&&r.getContext(),i=this._getCanvasCache(),a=i&&i.scene,s=r&&r.isCache;if(!this.isVisible()&&!s)return this;if(a){o.save();var l=this.getAbsoluteTransform(t).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",r,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();var a=this.getAbsoluteTransform(t).getMatrix();o.transform(a[0],a[1],a[2],a[3],a[4],a[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n){var r,o=t&&t.getContext(),i=this.clipWidth(),a=this.clipHeight(),s=this.clipFunc(),l=i&&a||s;const c=n===this;if(l){o.save();var u=this.getAbsoluteTransform(n),d=u.getMatrix();if(o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o.beginPath(),s)s.call(this,o,this);else{var h=this.clipX(),f=this.clipY();o.rect(h,f,i,a)}o.clip(),d=u.copy().invert().getMatrix(),o.transform(d[0],d[1],d[2],d[3],d[4],d[5])}var p=!c&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(o.save(),o._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&o.restore(),l&&o.restore()}getClientRect(e){var t,n,r,o,i,a=(e=e||{}).skipTransform,s=e.relativeTo,l={x:1/0,y:1/0,width:0,height:0},c=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var a=t.getClientRect({relativeTo:c,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===a.width&&0===a.height||(void 0===n?(n=a.x,r=a.y,o=a.x+a.width,i=a.y+a.height):(n=Math.min(n,a.x),r=Math.min(r,a.y),o=Math.max(o,a.x+a.width),i=Math.max(i,a.y+a.height)))}}));for(var u=this.find("Shape"),d=!1,h=0;he.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",v0=e=>{const t=m0(e);return"pointer"===t?$Q.pointerEventsEnabled&&g0.pointer:"touch"===t?g0.touch:"mouse"===t?g0.mouse:void 0};function y0(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&tJ.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const b0=[];class x0 extends FJ{constructor(e){super(y0(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),b0.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{y0(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||tJ.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e-1&&b0.splice(t,1),tJ.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(tJ.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new xJ({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n5&&tJ.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),$Q.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return $J(e,this)}setPointerCapture(e){GJ(e,this)}releaseCapture(e){qJ(e)}getLayers(){return this.children}_bindContentEvents(){$Q.isBrowser&&p0.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=v0(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=v0(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=v0(e.type),n=m0(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),o=!kJ.isDragging||$Q.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=v0(e.type),n=m0(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((o=>{var i=this.getIntersection(o);kJ.justDragged=!1,$Q["_"+n+"ListenClick"]=!0;if(!(i&&i.isListening()))return;$Q.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const a=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&a&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=v0(e.type),n=m0(e.type);if(!t)return;if(kJ.isDragging&&kJ.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),!(!kJ.isDragging||$Q.hitOnDragEnabled))return;var r={};let o=!1;var i=this._getTargetShape(n);this._changedPointerPositions.forEach((a=>{const s=VJ(a.id)||this.getIntersection(a),l=a.id,c={evt:e,pointerId:l};var u=i!==s;if(u&&i&&(i._fireAndBubble(t.pointerout,Object.assign({},c),s),i._fireAndBubble(t.pointerleave,Object.assign({},c),s)),s){if(r[s._id])return;r[s._id]=!0}s&&s.isListening()?(o=!0,u&&(s._fireAndBubble(t.pointerover,Object.assign({},c),i),s._fireAndBubble(t.pointerenter,Object.assign({},c),i),this[n+"targetShape"]=s),s._fireAndBubble(t.pointermove,Object.assign({},c))):i&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:l}),this[n+"targetShape"]=null)})),o||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=v0(e.type),n=m0(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"];var i={};let a=!1;this._changedPointerPositions.forEach((s=>{const l=VJ(s.id)||this.getIntersection(s);if(l){if(l.releaseCapture(s.id),i[l._id])return;i[l._id]=!0}const c=s.id,u={evt:e,pointerId:c};let d=!1;$Q["_"+n+"InDblClickWindow"]?(d=!0,clearTimeout(this[n+"DblTimeout"])):kJ.justDragged||($Q["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){$Q["_"+n+"InDblClickWindow"]=!1}),$Q.dblClickWindow),l&&l.isListening()?(a=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,Object.assign({},u)),$Q["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,Object.assign({},u)),d&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,Object.assign({},u)))):(this[n+"ClickEndShape"]=null,$Q["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:c}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:c}))})),a||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),$Q["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(l0,{evt:e}):this._fire(l0,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(f0,{evt:e}):this._fire(f0,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=VJ(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(n0,UJ(e)),qJ(e.pointerId)}_lostpointercapture(e){qJ(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:tJ._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:tJ._getFirstPointerId(e)}])}_setPointerPosition(e){tJ.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new xJ({width:this.width(),height:this.height()}),this.bufferHitCanvas=new wJ({pixelRatio:1,width:this.width(),height:this.height()}),$Q.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return tJ.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}x0.prototype.nodeType="Stage",GQ(x0),hJ.addGetterSetter(x0,"container");var w0="hasShadow",k0="shadowRGBA",S0="patternImage",C0="linearGradient",_0="radialGradient";let E0;function L0(){return E0||(E0=tJ.createCanvasElement().getContext("2d"),E0)}const P0={};class O0 extends BJ{constructor(e){let t;for(super(e);t=tJ.getRandomColor(),!t||t in P0;);this.colorKey=t,P0[t]=this}getContext(){return tJ.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return tJ.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(w0,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(S0,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=L0().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new qQ;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate($Q.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(C0,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=L0(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y),i=0;ithis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return BJ.prototype.destroy.call(this),delete P0[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(!(null===(t=this.attrs.perfectDrawEnabled)||void 0===t||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=1!==this.getAbsoluteOpacity();if(n&&r&&o)return!0;const i=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&r&&i&&a)}setStrokeHitEnabled(e){tJ.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,i=r.width+o,a=r.height+o,s=!e.skipShadow&&this.hasShadow(),l=s?this.shadowOffsetX():0,c=s?this.shadowOffsetY():0,u=i+Math.abs(l),d=a+Math.abs(c),h=s&&this.shadowBlur()||0,f={width:u+2*h,height:d+2*h,x:-(o/2+h)+Math.min(l,0)+r.x,y:-(o/2+h)+Math.min(c,0)+r.y};return t?f:this._transformedRect(f,n)}drawScene(e,t){var n,r,o=this.getLayer(),i=e||o.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),l=this.getSceneFunc(),c=this.hasShadow(),u=i.isCache,d=t===this;if(!this.isVisible()&&!d)return this;if(s){a.save();var h=this.getAbsoluteTransform(t).getMatrix();return a.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!l)return this;if(a.save(),this._useBufferCanvas()&&!u){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var f=this.getAbsoluteTransform(t).getMatrix();r.transform(f[0],f[1],f[2],f[3],f[4],f[5]),l.call(this,r,this),r.restore();var p=n.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else{if(a._applyLineJoin(this),!d){f=this.getAbsoluteTransform(t).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),l.call(this,a,this)}return a.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),a=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),l=s&&s.hit;if(this.colorKey||tJ.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();var c=this.getAbsoluteTransform(t).getMatrix();return i.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!a)return this;i.save(),i._applyLineJoin(this);if(!(this===t)){var u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return a.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){var t,n,r,o,i,a=this._getCanvasCache(),s=this._getCachedSceneCanvas(),l=a.hit,c=l.getContext(),u=l.getWidth(),d=l.getHeight();c.clear(),c.drawImage(s._canvas,0,0,u,d);try{for(r=(n=(t=c.getImageData(0,0,u,d)).data).length,o=tJ._hexToRgb(this.colorKey),i=0;ie?(n[i]=o.r,n[i+1]=o.g,n[i+2]=o.b,n[i+3]=255):n[i+3]=0;c.putImageData(t,0,0)}catch(j2){tJ.error("Unable to draw hit graph from cached scene canvas. "+j2.message)}return this}hasPointerCapture(e){return $J(e,this)}setPointerCapture(e){GJ(e,this)}releaseCapture(e){qJ(e)}}O0.prototype._fillFunc=function(e){e.fill()},O0.prototype._strokeFunc=function(e){e.stroke()},O0.prototype._fillFuncHit=function(e){e.fill()},O0.prototype._strokeFuncHit=function(e){e.stroke()},O0.prototype._centroid=!1,O0.prototype.nodeType="Shape",GQ(O0),O0.prototype.eventListeners={},O0.prototype.on.call(O0.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(w0)})),O0.prototype.on.call(O0.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(k0)})),O0.prototype.on.call(O0.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(S0)})),O0.prototype.on.call(O0.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(C0)})),O0.prototype.on.call(O0.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(_0)})),hJ.addGetterSetter(O0,"stroke",void 0,lJ()),hJ.addGetterSetter(O0,"strokeWidth",2,oJ()),hJ.addGetterSetter(O0,"fillAfterStrokeEnabled",!1),hJ.addGetterSetter(O0,"hitStrokeWidth","auto",aJ()),hJ.addGetterSetter(O0,"strokeHitEnabled",!0,cJ()),hJ.addGetterSetter(O0,"perfectDrawEnabled",!0,cJ()),hJ.addGetterSetter(O0,"shadowForStrokeEnabled",!0,cJ()),hJ.addGetterSetter(O0,"lineJoin"),hJ.addGetterSetter(O0,"lineCap"),hJ.addGetterSetter(O0,"sceneFunc"),hJ.addGetterSetter(O0,"hitFunc"),hJ.addGetterSetter(O0,"dash"),hJ.addGetterSetter(O0,"dashOffset",0,oJ()),hJ.addGetterSetter(O0,"shadowColor",void 0,sJ()),hJ.addGetterSetter(O0,"shadowBlur",0,oJ()),hJ.addGetterSetter(O0,"shadowOpacity",1,oJ()),hJ.addComponentsGetterSetter(O0,"shadowOffset",["x","y"]),hJ.addGetterSetter(O0,"shadowOffsetX",0,oJ()),hJ.addGetterSetter(O0,"shadowOffsetY",0,oJ()),hJ.addGetterSetter(O0,"fillPatternImage"),hJ.addGetterSetter(O0,"fill",void 0,lJ()),hJ.addGetterSetter(O0,"fillPatternX",0,oJ()),hJ.addGetterSetter(O0,"fillPatternY",0,oJ()),hJ.addGetterSetter(O0,"fillLinearGradientColorStops"),hJ.addGetterSetter(O0,"strokeLinearGradientColorStops"),hJ.addGetterSetter(O0,"fillRadialGradientStartRadius",0),hJ.addGetterSetter(O0,"fillRadialGradientEndRadius",0),hJ.addGetterSetter(O0,"fillRadialGradientColorStops"),hJ.addGetterSetter(O0,"fillPatternRepeat","repeat"),hJ.addGetterSetter(O0,"fillEnabled",!0),hJ.addGetterSetter(O0,"strokeEnabled",!0),hJ.addGetterSetter(O0,"shadowEnabled",!0),hJ.addGetterSetter(O0,"dashEnabled",!0),hJ.addGetterSetter(O0,"strokeScaleEnabled",!0),hJ.addGetterSetter(O0,"fillPriority","color"),hJ.addComponentsGetterSetter(O0,"fillPatternOffset",["x","y"]),hJ.addGetterSetter(O0,"fillPatternOffsetX",0,oJ()),hJ.addGetterSetter(O0,"fillPatternOffsetY",0,oJ()),hJ.addComponentsGetterSetter(O0,"fillPatternScale",["x","y"]),hJ.addGetterSetter(O0,"fillPatternScaleX",1,oJ()),hJ.addGetterSetter(O0,"fillPatternScaleY",1,oJ()),hJ.addComponentsGetterSetter(O0,"fillLinearGradientStartPoint",["x","y"]),hJ.addComponentsGetterSetter(O0,"strokeLinearGradientStartPoint",["x","y"]),hJ.addGetterSetter(O0,"fillLinearGradientStartPointX",0),hJ.addGetterSetter(O0,"strokeLinearGradientStartPointX",0),hJ.addGetterSetter(O0,"fillLinearGradientStartPointY",0),hJ.addGetterSetter(O0,"strokeLinearGradientStartPointY",0),hJ.addComponentsGetterSetter(O0,"fillLinearGradientEndPoint",["x","y"]),hJ.addComponentsGetterSetter(O0,"strokeLinearGradientEndPoint",["x","y"]),hJ.addGetterSetter(O0,"fillLinearGradientEndPointX",0),hJ.addGetterSetter(O0,"strokeLinearGradientEndPointX",0),hJ.addGetterSetter(O0,"fillLinearGradientEndPointY",0),hJ.addGetterSetter(O0,"strokeLinearGradientEndPointY",0),hJ.addComponentsGetterSetter(O0,"fillRadialGradientStartPoint",["x","y"]),hJ.addGetterSetter(O0,"fillRadialGradientStartPointX",0),hJ.addGetterSetter(O0,"fillRadialGradientStartPointY",0),hJ.addComponentsGetterSetter(O0,"fillRadialGradientEndPoint",["x","y"]),hJ.addGetterSetter(O0,"fillRadialGradientEndPointX",0),hJ.addGetterSetter(O0,"fillRadialGradientEndPointY",0),hJ.addGetterSetter(O0,"fillPatternRotation",0),hJ.backCompat(O0,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var M0=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],T0=M0.length;class A0 extends FJ{constructor(e){super(e),this.canvas=new xJ,this.hitCanvas=new wJ({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),FJ.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),FJ.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){tJ.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return tJ.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return tJ.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}A0.prototype.nodeType="Layer",GQ(A0),hJ.addGetterSetter(A0,"imageSmoothingEnabled",!0),hJ.addGetterSetter(A0,"clearBeforeDraw",!0),hJ.addGetterSetter(A0,"hitGraphEnabled",!0,cJ());class I0 extends A0{constructor(e){super(e),this.listening(!1),tJ.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}I0.prototype.nodeType="FastLayer",GQ(I0);class R0 extends FJ{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&tJ.throw("You may only add groups and shapes to groups.")}}R0.prototype.nodeType="Group",GQ(R0);var N0=UQ.performance&&UQ.performance.now?function(){return UQ.performance.now()}:function(){return(new Date).getTime()};class D0{constructor(e,t){this.id=D0.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:N0(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t=[];return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,r=n.length;for(t=0;tthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class H0{constructor(e){var t,n,r=this,o=e.node,i=o._id,a=e.easing||W0.Linear,s=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=o,this._id=B0++;var l=o.getLayer()||(o instanceof $Q.Stage?o.getLayers():null);for(n in l||tJ.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new D0((function(){r.tween.onEnterFrame()}),l),this.tween=new F0(n,(function(e){r._tweenFunc(e)}),a,0,1,1e3*t,s),this._addListeners(),H0.attrs[i]||(H0.attrs[i]={}),H0.attrs[i][this._id]||(H0.attrs[i][this._id]={}),H0.tweens[i]||(H0.tweens[i]={}),e)void 0===z0[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,r,o,i,a,s,l,c,u=this.node,d=u._id;if((o=H0.tweens[d][e])&&delete H0.attrs[d][o][e],n=u.getAttr(e),tJ._isArray(t))if(r=[],a=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(l=n,n=tJ._prepareArrayForTween(n,t,u.closed())):(s=t,t=tJ._prepareArrayForTween(t,n,u.closed()))),0===e.indexOf("fill"))for(i=0;i{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=H0.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=H0.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=H0.tweens[t];for(e in this.pause(),r)delete H0.tweens[t][e];delete H0.attrs[t][n]}}H0.attrs={},H0.tweens={},BJ.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new H0(e).play()};const W0={BackEaseIn(e,t,n,r){var o=1.70158;return n*(e/=r)*e*((o+1)*e-o)+t},BackEaseOut(e,t,n,r){var o=1.70158;return n*((e=e/r-1)*e*((o+1)*e+o)+1)+t},BackEaseInOut(e,t,n,r){var o=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){var a=0;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),!o||o(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,t,n,r)=>n-W0.BounceEaseOut(r-e,0,n,r)+t,BounceEaseInOut:(e,t,n,r)=>en*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t},V0=tJ._assign($Q,{Util:tJ,Transform:qQ,Node:BJ,Container:FJ,Stage:x0,stages:b0,Layer:A0,FastLayer:I0,Group:R0,DD:kJ,Shape:O0,shapes:P0,Animation:D0,Tween:H0,Easings:W0,Context:gJ,Canvas:bJ});class U0 extends O0{_sceneFunc(e){var t=$Q.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=$Q.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),s=o*(o>0?e:t),l=i*(i>0?e:t),c=a*(a>0?t:e);return{x:s,y:n?-1*c:l,width:1*t-s,height:c-l}}}function $0(e,t,n,r,o,i,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),c=a*s/(s+l),u=a*l/(s+l);return[n-c*(o-e),r-c*(i-t),n+u*(o-e),r+u*(i-t)]}function G0(e,t){var n,r,o=e.length,i=[];for(n=2;n4){for(n=(t=this.getTensionPoints()).length,r=s?0:4,s||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);rc?l:c,g=l>c?1:l/c,m=l>c?c/l:1;e.translate(a,s),e.rotate(h),e.scale(g,m),e.arc(0,0,p,u,u+d,1-f),e.scale(1/g,1/m),e.rotate(-h),e.translate(-a,-s);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],o=t.points[4]+r,i=Math.PI/180;if(Math.abs(n-o)o;r-=i){const n=Y0.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+i;rthis.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===r)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var o=this.dataArray[n],i=o.points;switch(o.command){case"L":return Y0.getPointOnLine(e,o.start.x,o.start.y,i[0],i[1]);case"C":return Y0.getPointOnCubicBezier(e/o.pathLength,o.start.x,o.start.y,i[0],i[1],i[2],i[3],i[4],i[5]);case"Q":return Y0.getPointOnQuadraticBezier(e/o.pathLength,o.start.x,o.start.y,i[0],i[1],i[2],i[3]);case"A":var a=i[0],s=i[1],l=i[2],c=i[3],u=i[4],d=i[5],h=i[6];return u+=d*e/o.pathLength,Y0.getPointOnEllipticalArc(a,s,l,c,u,h)}return null}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPointOnLine(e,t,n,r,o,i,a){void 0===i&&(i=t),void 0===a&&(a=n);var s=(o-n)/(r-t+1e-8),l=Math.sqrt(e*e/(1+s*s));r0&&!isNaN(f[0]);){var v,y,b,x,w,k,S,C,_,E,L=null,P=[],O=l,M=c;switch(h){case"l":l+=f.shift(),c+=f.shift(),L="L",P.push(l,c);break;case"L":l=f.shift(),c=f.shift(),P.push(l,c);break;case"m":var T=f.shift(),A=f.shift();if(l+=T,c+=A,L="M",a.length>2&&"z"===a[a.length-1].command)for(var I=a.length-2;I>=0;I--)if("M"===a[I].command){l=a[I].points[0]+T,c=a[I].points[1]+A;break}P.push(l,c),h="l";break;case"M":l=f.shift(),c=f.shift(),L="M",P.push(l,c),h="L";break;case"h":l+=f.shift(),L="L",P.push(l,c);break;case"H":l=f.shift(),L="L",P.push(l,c);break;case"v":c+=f.shift(),L="L",P.push(l,c);break;case"V":c=f.shift(),L="L",P.push(l,c);break;case"C":P.push(f.shift(),f.shift(),f.shift(),f.shift()),l=f.shift(),c=f.shift(),P.push(l,c);break;case"c":P.push(l+f.shift(),c+f.shift(),l+f.shift(),c+f.shift()),l+=f.shift(),c+=f.shift(),L="C",P.push(l,c);break;case"S":y=l,b=c,"C"===(v=a[a.length-1]).command&&(y=l+(l-v.points[2]),b=c+(c-v.points[3])),P.push(y,b,f.shift(),f.shift()),l=f.shift(),c=f.shift(),L="C",P.push(l,c);break;case"s":y=l,b=c,"C"===(v=a[a.length-1]).command&&(y=l+(l-v.points[2]),b=c+(c-v.points[3])),P.push(y,b,l+f.shift(),c+f.shift()),l+=f.shift(),c+=f.shift(),L="C",P.push(l,c);break;case"Q":P.push(f.shift(),f.shift()),l=f.shift(),c=f.shift(),P.push(l,c);break;case"q":P.push(l+f.shift(),c+f.shift()),l+=f.shift(),c+=f.shift(),L="Q",P.push(l,c);break;case"T":y=l,b=c,"Q"===(v=a[a.length-1]).command&&(y=l+(l-v.points[0]),b=c+(c-v.points[1])),l=f.shift(),c=f.shift(),L="Q",P.push(y,b,l,c);break;case"t":y=l,b=c,"Q"===(v=a[a.length-1]).command&&(y=l+(l-v.points[0]),b=c+(c-v.points[1])),l+=f.shift(),c+=f.shift(),L="Q",P.push(y,b,l,c);break;case"A":x=f.shift(),w=f.shift(),k=f.shift(),S=f.shift(),C=f.shift(),_=l,E=c,l=f.shift(),c=f.shift(),L="A",P=this.convertEndpointToCenterParameterization(_,E,l,c,S,C,x,w,k);break;case"a":x=f.shift(),w=f.shift(),k=f.shift(),S=f.shift(),C=f.shift(),_=l,E=c,l+=f.shift(),c+=f.shift(),L="A",P=this.convertEndpointToCenterParameterization(_,E,l,c,S,C,x,w,k)}a.push({command:L||h,points:P,start:{x:O,y:M},pathLength:this.calcLength(O,M,L||h,P)})}"z"!==h&&"Z"!==h||a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,t,n,r){var o,i,a,s,l=Y0;switch(n){case"L":return l.getLineLength(e,t,r[0],r[1]);case"C":for(o=0,i=l.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),s=.01;s<=1;s+=.01)a=l.getPointOnCubicBezier(s,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),o+=l.getLineLength(i.x,i.y,a.x,a.y),i=a;return o;case"Q":for(o=0,i=l.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),s=.01;s<=1;s+=.01)a=l.getPointOnQuadraticBezier(s,e,t,r[0],r[1],r[2],r[3]),o+=l.getLineLength(i.x,i.y,a.x,a.y),i=a;return o;case"A":o=0;var c=r[4],u=r[5],d=r[4]+u,h=Math.PI/180;if(Math.abs(c-d)d;s-=h)a=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),o+=l.getLineLength(i.x,i.y,a.x,a.y),i=a;else for(s=c+h;s1&&(a*=Math.sqrt(h),s*=Math.sqrt(h));var f=Math.sqrt((a*a*(s*s)-a*a*(d*d)-s*s*(u*u))/(a*a*(d*d)+s*s*(u*u)));o===i&&(f*=-1),isNaN(f)&&(f=0);var p=f*a*d/s,g=f*-s*u/a,m=(e+n)/2+Math.cos(c)*p-Math.sin(c)*g,v=(t+r)/2+Math.sin(c)*p+Math.cos(c)*g,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},x=function(e,t){return(e[0]*t[1]=1&&(C=0),0===i&&C>0&&(C-=2*Math.PI),1===i&&C<0&&(C+=2*Math.PI),[m,v,a,s,w,C,c,i]}}Y0.prototype.className="Path",Y0.prototype._attrsAffectingSize=["data"],GQ(Y0),hJ.addGetterSetter(Y0,"data");class Z0 extends q0{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,o=0!==this.tension()&&n.length>4;o&&(r=this.getTensionPoints());var i,a,s=this.pointerLength(),l=n.length;if(o){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[l-2],n[l-1]],t=Y0.calcLength(r[r.length-4],r[r.length-3],"C",e),o=Y0.getPointOnQuadraticBezier(Math.min(1,1-s/t),e[0],e[1],e[2],e[3],e[4],e[5]);i=n[l-2]-o.x,a=n[l-1]-o.y}else i=n[l-2]-n[l-4],a=n[l-1]-n[l-3];var c=(Math.atan2(a,i)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[l-2],n[l-1]),e.rotate(c),e.moveTo(0,0),e.lineTo(-s,u/2),e.lineTo(-s,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(i=(r[0]+r[2])/2-n[0],a=(r[1]+r[3])/2-n[1]):(i=n[2]-n[0],a=n[3]-n[1]),e.rotate((Math.atan2(-a,-i)+t)%t),e.moveTo(0,0),e.lineTo(-s,u/2),e.lineTo(-s,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}Z0.prototype.className="Arrow",GQ(Z0),hJ.addGetterSetter(Z0,"pointerLength",10,oJ()),hJ.addGetterSetter(Z0,"pointerWidth",10,oJ()),hJ.addGetterSetter(Z0,"pointerAtBeginning",!1),hJ.addGetterSetter(Z0,"pointerAtEnding",!0);class X0 extends O0{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}X0.prototype._centroid=!0,X0.prototype.className="Circle",X0.prototype._attrsAffectingSize=["radius"],GQ(X0),hJ.addGetterSetter(X0,"radius",0,oJ());class K0 extends O0{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}K0.prototype.className="Ellipse",K0.prototype._centroid=!0,K0.prototype._attrsAffectingSize=["radiusX","radiusY"],GQ(K0),hJ.addComponentsGetterSetter(K0,"radius",["x","y"]),hJ.addGetterSetter(K0,"radiusX",0,oJ()),hJ.addGetterSetter(K0,"radiusY",0,oJ());class Q0 extends O0{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),r=this.attrs.image;let o;if(r){const e=this.attrs.cropWidth,i=this.attrs.cropHeight;o=e&&i?[r,this.cropX(),this.cropY(),e,i,0,0,t,n]:[r,0,0,t,n]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),r&&e.drawImage.apply(e,o)}_hitFunc(e){var t=this.width(),n=this.height();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var r=tJ.createImageElement();r.onload=function(){var e=new Q0({image:r});t(e)},r.onerror=n,r.crossOrigin="Anonymous",r.src=e}}Q0.prototype.className="Image",GQ(Q0),hJ.addGetterSetter(Q0,"image"),hJ.addComponentsGetterSetter(Q0,"crop",["x","y","width","height"]),hJ.addGetterSetter(Q0,"cropX",0,oJ()),hJ.addGetterSetter(Q0,"cropY",0,oJ()),hJ.addGetterSetter(Q0,"cropWidth",0,oJ()),hJ.addGetterSetter(Q0,"cropHeight",0,oJ());var J0=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],e1="up",t1="right",n1="down",r1="left",o1=J0.length;class i1 extends R0{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.y)})),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}l1.prototype.className="RegularPolygon",l1.prototype._centroid=!0,l1.prototype._attrsAffectingSize=["radius"],GQ(l1),hJ.addGetterSetter(l1,"radius",0,oJ()),hJ.addGetterSetter(l1,"sides",0,oJ());var c1=2*Math.PI;class u1 extends O0{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,c1,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),c1,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}u1.prototype.className="Ring",u1.prototype._centroid=!0,u1.prototype._attrsAffectingSize=["innerRadius","outerRadius"],GQ(u1),hJ.addGetterSetter(u1,"innerRadius",0,oJ()),hJ.addGetterSetter(u1,"outerRadius",0,oJ());class d1 extends O0{constructor(e){super(e),this._updated=!0,this.anim=new D0((()=>{var e=this._updated;return this._updated=!1,e})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,o=this.animations()[t],i=this.frameOffsets(),a=o[r+0],s=o[r+1],l=o[r+2],c=o[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,c),e.closePath(),e.fillStrokeShape(this)),u)if(i){var d=i[t],h=2*n;e.drawImage(u,a,s,l,c,d[h+0],d[h+1],l,c)}else e.drawImage(u,a,s,l,c,0,0,l,c)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,o=this.animations()[t],i=this.frameOffsets(),a=o[r+2],s=o[r+3];if(e.beginPath(),i){var l=i[t],c=2*n;e.rect(l[c+0],l[c+1],a,s)}else e.rect(0,0,a,s);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e1&&(m+=a)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=tJ._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===g1||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===g1||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return tJ.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=C1(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}_getContextFont(){return this.fontStyle()+x1+this.fontVariant()+x1+(this.fontSize()+"px ")+this.fontFamily().split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}_addTextLine(e){this.align()===m1&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return C1().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,a=o!==g1&&void 0!==o,s=i!==g1&&void 0!==i,l=this.padding(),c=o-2*l,u=i-2*l,d=0,h=this.wrap(),f="char"!==h&&h!==w1,p=this.ellipsis();this.textArr=[],C1().font=this._getContextFont();for(var g=p?this._getTextWidth("…"):0,m=0,v=e.length;mc)for(;y.length>0;){for(var x=0,w=y.length,k="",S=0;x>>1,_=y.slice(0,C+1),E=this._getTextWidth(_)+g;E<=c?(x=C+1,k=_,S=E):w=C}if(!k)break;if(f){var L,P=y[k.length];(L=(P===x1||"-"===P)&&S<=c?k.length:Math.max(k.lastIndexOf(x1),k.lastIndexOf("-"))+1)>0&&(x=L,k=k.slice(0,x),S=this._getTextWidth(k))}if(k=k.trimRight(),this._addTextLine(k),n=Math.max(n,S),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if((y=(y=y.slice(x)).trimLeft()).length>0&&(b=this._getTextWidth(y))<=c){this._addTextLine(y),d+=r,n=Math.max(n,b);break}}else this._addTextLine(y),d+=r,n=Math.max(n,b),this._shouldHandleEllipsis(d)&&mu)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==g1&&void 0!==r,i=r-2*this.padding();return!(this.wrap()!==w1)||o&&e+n>i}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==g1&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),o=this.textArr[this.textArr.length-1];if(o&&r){if(t)this._getTextWidth(o.text+"…")=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r0&&(a+=e.dataArray[s].pathLength);var l=0;"center"===r&&(l=Math.max(0,a/2-i/2)),"right"===r&&(l=Math.max(0,a-i));for(var c,u,d,h=f1(this.text()),f=this.text().split(" ").length-1,p=-1,g=0,m=function(){g=0;for(var t=e.dataArray,n=p+1;n0)return p=n,t[n];"M"===t[n].command&&(c={x:t[n].points[0],y:t[n].points[1]})}return{}},v=function(t){var o=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(o+=(a-i)/f);var s=0,l=0;for(u=void 0;Math.abs(o-s)/o>.01&&l<20;){l++;for(var h=s;void 0===d;)(d=m())&&h+d.pathLengtho?u=Y0.getPointOnLine(o,c.x,c.y,d.points[0],d.points[1],c.x,c.y):d=void 0;break;case"A":var v=d.points[4],y=d.points[5],b=d.points[4]+y;0===g?g=v+1e-8:o>s?g+=Math.PI/180*y/Math.abs(y):g-=Math.PI/360*y/Math.abs(y),(y<0&&g=0&&g>b)&&(g=b,p=!0),u=Y0.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],g,d.points[6]);break;case"C":0===g?g=o>d.pathLength?1e-8:o/d.pathLength:o>s?g+=(o-s)/d.pathLength/2:g=Math.max(g-(s-o)/d.pathLength/2,0),g>1&&(g=1,p=!0),u=Y0.getPointOnCubicBezier(g,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);break;case"Q":0===g?g=o/d.pathLength:o>s?g+=(o-s)/d.pathLength:g-=(s-o)/d.pathLength,g>1&&(g=1,p=!0),u=Y0.getPointOnQuadraticBezier(g,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3])}void 0!==u&&(s=Y0.getLineLength(c.x,c.y,u.x,u.y)),p&&(p=!1,d=void 0)}},y=l/(e._getTextSize("C").width+n)-1,b=0;be+`.${M1}`)).join(" "),A1="nodesRect",I1=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],R1={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const N1="ontouchstart"in $Q._global;var D1=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function z1(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:o})}function B1(e,t){const n=function(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}(e);return z1(e,t,n)}class j1 extends R0{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(T1,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return tJ.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return M1+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(I1.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+o,y:r.y+i}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(A1),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(A1,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),a=r.x*o.x-e.offsetX()*o.x,s=r.y*o.y-e.offsetY()*o.y;const l=($Q.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return z1({x:i.x+a*Math.cos(l)+s*Math.sin(-l),y:i.y+s*Math.cos(l)+a*Math.sin(l),width:r.width*o.x,height:r.height*o.y,rotation:l},-$Q.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],o=t.getAbsoluteTransform();r.forEach((function(t){var n=o.point(t);e.push(n)}))}));const t=new qQ;var n,r,o,i;t.rotate(-$Q.getAngle(this.rotation())),e.forEach((function(e){var a=t.point(e);void 0===n&&(n=o=a.x,r=i=a.y),n=Math.min(n,a.x),r=Math.min(r,a.y),o=Math.max(o,a.x),i=Math.max(i,a.y)})),t.invert();const a=t.point({x:n,y:r});return{x:a.x,y:a.y,width:o-n,height:i-r,rotation:$Q.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),D1.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new s1({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:N1?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=$Q.getAngle(this.rotation()),r=function(e,t){if("rotater"===e)return"crosshair";t+=tJ.degToRad(R1[e]||0);var n=(tJ.radToDeg(t)%360+360)%360;return tJ._inRange(n,337.5,360)||tJ._inRange(n,0,22.5)?"ns-resize":tJ._inRange(n,22.5,67.5)?"nesw-resize":tJ._inRange(n,67.5,112.5)?"ew-resize":tJ._inRange(n,112.5,157.5)?"nwse-resize":tJ._inRange(n,157.5,202.5)?"ns-resize":tJ._inRange(n,202.5,247.5)?"nesw-resize":tJ._inRange(n,247.5,292.5)?"ew-resize":tJ._inRange(n,292.5,337.5)?"nwse-resize":(tJ.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new O0({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*tJ._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var i=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-i.x,y:a.y-i.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}_handleMouseMove(e){var t,n,r,o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const a=i.getPointerPosition();let s={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(s=this.anchorDragBoundFunc()(l,s,e)),o.setAbsolutePosition(s);const c=o.getAbsolutePosition();if(l.x!==c.x||l.y!==c.y)if("rotater"!==this._movingAnchorName){var u=this.keepRatio()||e.shiftKey,d=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(u){var h=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(h.x-o.x(),2)+Math.pow(h.y-o.y(),2));var f=this.findOne(".top-left").x()>h.x?-1:1,p=this.findOne(".top-left").y()>h.y?-1:1;t=r*this.cos*f,n=r*this.sin*p,this.findOne(".top-left").x(h.x-t),this.findOne(".top-left").y(h.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(o.y());else if("top-right"===this._movingAnchorName){if(u){h=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-h.x,2)+Math.pow(h.y-o.y(),2));f=this.findOne(".top-right").x()h.y?-1:1;t=r*this.cos*f,n=r*this.sin*p,this.findOne(".top-right").x(h.x+t),this.findOne(".top-right").y(h.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(o.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(o.x());else if("bottom-left"===this._movingAnchorName){if(u){h=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(h.x-o.x(),2)+Math.pow(o.y()-h.y,2));f=h.x{t._fire("transformend",{evt:e,target:t})})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(tJ._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(tJ._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=this.flipEnabled();var o=new qQ;if(o.rotate($Q.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=o.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!r)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=o.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!r)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=o.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=o.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:tJ.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,a=new qQ;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/i,n.height/i);const s=new qQ;s.translate(e.x,e.y),s.rotate(e.rotation),s.scale(e.width/i,e.height/i);const l=s.multiply(a.invert());this._nodes.forEach((e=>{var n;const r=e.getParent().getAbsoluteTransform(),o=e.getTransform().copy();o.translate(e.offsetX(),e.offsetY());const i=new qQ;i.multiply(r.copy().invert()).multiply(l).multiply(r).multiply(o);const a=i.decompose();e.setAttrs(a),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(tJ._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(tJ._getRotation(t.rotation));var n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),a=this.padding(),s=this.anchorSize();this.find("._anchor").forEach((e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:s/2+a,offsetY:s/2+a,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:s/2+a,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:s/2-a,offsetY:s/2+a,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:s/2+a,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:s/2-a,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:s/2+a,offsetY:s/2-a,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:s/2-a,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:s/2-a,offsetY:s/2-a,visible:i&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*tJ._sign(r)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),R0.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return BJ.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}j1.prototype.className="Transformer",GQ(j1),hJ.addGetterSetter(j1,"enabledAnchors",D1,(function(e){return e instanceof Array||tJ.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===D1.indexOf(e)&&tJ.warn("Unknown anchor name: "+e+". Available names are: "+D1.join(", "))})),e||[]})),hJ.addGetterSetter(j1,"flipEnabled",!0,cJ()),hJ.addGetterSetter(j1,"resizeEnabled",!0),hJ.addGetterSetter(j1,"anchorSize",10,oJ()),hJ.addGetterSetter(j1,"rotateEnabled",!0),hJ.addGetterSetter(j1,"rotationSnaps",[]),hJ.addGetterSetter(j1,"rotateAnchorOffset",50,oJ()),hJ.addGetterSetter(j1,"rotationSnapTolerance",5,oJ()),hJ.addGetterSetter(j1,"borderEnabled",!0),hJ.addGetterSetter(j1,"anchorStroke","rgb(0, 161, 255)"),hJ.addGetterSetter(j1,"anchorStrokeWidth",1,oJ()),hJ.addGetterSetter(j1,"anchorFill","white"),hJ.addGetterSetter(j1,"anchorCornerRadius",0,oJ()),hJ.addGetterSetter(j1,"borderStroke","rgb(0, 161, 255)"),hJ.addGetterSetter(j1,"borderStrokeWidth",1,oJ()),hJ.addGetterSetter(j1,"borderDash"),hJ.addGetterSetter(j1,"keepRatio",!0),hJ.addGetterSetter(j1,"centeredScaling",!1),hJ.addGetterSetter(j1,"ignoreStroke",!1),hJ.addGetterSetter(j1,"padding",0,oJ()),hJ.addGetterSetter(j1,"node"),hJ.addGetterSetter(j1,"nodes"),hJ.addGetterSetter(j1,"boundBoxFunc"),hJ.addGetterSetter(j1,"anchorDragBoundFunc"),hJ.addGetterSetter(j1,"shouldOverdrawWholeArea",!1),hJ.addGetterSetter(j1,"useSingleNodeRotation",!0),hJ.backCompat(j1,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class F1 extends O0{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,$Q.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function H1(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}F1.prototype.className="Wedge",F1.prototype._centroid=!0,F1.prototype._attrsAffectingSize=["radius"],GQ(F1),hJ.addGetterSetter(F1,"radius",0,oJ()),hJ.addGetterSetter(F1,"angle",0,oJ()),hJ.addGetterSetter(F1,"clockwise",!1),hJ.backCompat(F1,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var W1=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],V1=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];hJ.addGetterSetter(BJ,"blurRadius",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"brightness",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"contrast",0,oJ(),hJ.afterSetFilter);function U1(e,t,n,r,o){var i=n-t,a=o-r;return 0===i?r+a/2:0===a?r:a*((e-t)/i)+r}hJ.addGetterSetter(BJ,"embossStrength",.5,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"embossWhiteLevel",.5,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"embossDirection","top-left",null,hJ.afterSetFilter),hJ.addGetterSetter(BJ,"embossBlend",!1,null,hJ.afterSetFilter);hJ.addGetterSetter(BJ,"enhance",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"hue",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"saturation",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"luminance",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"hue",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"saturation",0,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"value",0,oJ(),hJ.afterSetFilter);function $1(e,t,n){var r=4*(n*e.width+t),o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function G1(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}hJ.addGetterSetter(BJ,"kaleidoscopePower",2,oJ(),hJ.afterSetFilter),hJ.addGetterSetter(BJ,"kaleidoscopeAngle",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"threshold",0,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"noise",.2,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"pixelSize",8,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"levels",.5,oJ(),hJ.afterSetFilter);hJ.addGetterSetter(BJ,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"blue",0,rJ,hJ.afterSetFilter);hJ.addGetterSetter(BJ,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),hJ.addGetterSetter(BJ,"blue",0,rJ,hJ.afterSetFilter),hJ.addGetterSetter(BJ,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}));hJ.addGetterSetter(BJ,"threshold",.5,oJ(),hJ.afterSetFilter);const q1=V0.Util._assign(V0,{Arc:U0,Arrow:Z0,Circle:X0,Ellipse:K0,Image:Q0,Label:i1,Tag:a1,Line:q0,Path:Y0,Rect:s1,RegularPolygon:l1,Ring:u1,Sprite:d1,Star:h1,Text:_1,TextPath:O1,Transformer:j1,Wedge:F1,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,o,i,a,s,l,c,u,d,h,f,p,g,m,v,y,b,x,w,k,S,C,_,E=e.data,L=e.width,P=e.height,O=t+t+1,M=L-1,T=P-1,A=t+1,I=A*(A+1)/2,R=new H1,N=null,D=R,z=null,B=null,j=W1[t],F=V1[t];for(o=1;o>F,0!==C?(C=255/C,E[s]=(c*j>>F)*C,E[s+1]=(u*j>>F)*C,E[s+2]=(d*j>>F)*C):E[s]=E[s+1]=E[s+2]=0,c-=f,u-=p,d-=g,h-=m,f-=z.r,p-=z.g,g-=z.b,m-=z.a,i=l+((i=n+t+1)>F,C>0?(C=255/C,E[i]=(c*j>>F)*C,E[i+1]=(u*j>>F)*C,E[i+2]=(d*j>>F)*C):E[i]=E[i+1]=E[i+2]=0,c-=f,u-=p,d-=g,h-=m,f-=z.r,p-=z.g,g-=z.b,m-=z.a,i=n+((i=r+A)255?255:i,a=(a*=255)<0?0:a>255?255:a,s=(s*=255)<0?0:s>255?255:s,r[t]=i,r[t+1]=a,r[t+2]=s},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),o=this.embossBlend(),i=0,a=0,s=e.data,l=e.width,c=e.height,u=4*l,d=c;switch(r){case"top-left":i=-1,a=-1;break;case"top":i=-1,a=0;break;case"top-right":i=-1,a=1;break;case"right":i=0,a=1;break;case"bottom-right":i=1,a=1;break;case"bottom":i=1,a=0;break;case"bottom-left":i=1,a=-1;break;case"left":i=0,a=-1;break;default:tJ.error("Unknown emboss direction: "+r)}do{var h=(d-1)*u,f=i;d+f<1&&(f=0),d+f>c&&(f=0);var p=(d-1+f)*l*4,g=l;do{var m=h+4*(g-1),v=a;g+v<1&&(v=0),g+v>l&&(v=0);var y=p+4*(g-1+v),b=s[m]-s[y],x=s[m+1]-s[y+1],w=s[m+2]-s[y+2],k=b,S=k>0?k:-k;if((x>0?x:-x)>S&&(k=x),(w>0?w:-w)>S&&(k=w),k*=t,o){var C=s[m]+k,_=s[m+1]+k,E=s[m+2]+k;s[m]=C>255?255:C<0?0:C,s[m+1]=_>255?255:_<0?0:_,s[m+2]=E>255?255:E<0?0:E}else{var L=n-k;L<0?L=0:L>255&&(L=255),s[m]=s[m+1]=s[m+2]=L}}while(--g)}while(--d)},Enhance:function(e){var t,n,r,o,i=e.data,a=i.length,s=i[0],l=s,c=i[1],u=c,d=i[2],h=d,f=this.enhance();if(0!==f){for(o=0;ol&&(l=t),(n=i[o+1])u&&(u=n),(r=i[o+2])h&&(h=r);var p,g,m,v,y,b,x,w,k;for(l===s&&(l=255,s=0),u===c&&(u=255,c=0),h===d&&(h=255,d=0),f>0?(g=l+f*(255-l),m=s-f*(s-0),y=u+f*(255-u),b=c-f*(c-0),w=h+f*(255-h),k=d-f*(d-0)):(g=l+f*(l-(p=.5*(l+s))),m=s+f*(s-p),y=u+f*(u-(v=.5*(u+c))),b=c+f*(c-v),w=h+f*(h-(x=.5*(h+d))),k=d+f*(d-x)),o=0;ov?a:v;var y,b,x,w,k=u,S=c,C=360/S*Math.PI/180;for(b=0;bu&&(b=y,x=0,w=-1),n=0;nb?l:b;var x,w,k,S=h,C=d,_=n.polarRotation||0;for(o=0;o=0&&f=0&&p=0&&f=0&&p=1020?255:0}return a}(t,e.width,e.height),t=function(e,t,n){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),a=[],s=0;s=0&&f=0&&p=m))for(n=u;n=v||(o+=x[(r=4*(m*n+t))+0],i+=x[r+1],a+=x[r+2],s+=x[r+3],p+=1);for(o/=p,i/=p,a/=p,s/=p,t=l;t=m))for(n=u;n=v||(x[(r=4*(m*n+t))+0]=o,x[r+1]=i,x[r+2]=a,x[r+3]=s)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,o=r.length,i=255/n;for(t=0;t127&&(l=255-l),c>127&&(c=255-c),u>127&&(u=255-u),t[s]=l,t[s+1]=c,t[s+2]=u}while(--a)}while(--o)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,o=r.length;for(t=0;tY1,K1=()=>Z1,Q1=e=>{const t=X1(),{generationMode:n,optionsState:r,canvasState:o,systemState:i}=e,{cfgScale:a,codeformerFidelity:s,facetoolStrength:l,facetoolType:c,height:u,hiresFix:d,img2imgStrength:h,infillMethod:f,initialImage:p,iterations:g,perlin:m,prompt:v,sampler:y,seamBlur:b,seamless:x,seamSize:w,seamSteps:k,seamStrength:S,seed:C,seedWeights:_,shouldFitToWidthHeight:E,shouldGenerateVariations:L,shouldRandomizeSeed:P,shouldRunESRGAN:O,shouldRunFacetool:M,steps:T,threshold:A,tileSize:I,upscalingLevel:R,upscalingStrength:N,variationAmount:D,width:z}=r,{shouldDisplayInProgressType:B,saveIntermediatesInterval:j,enableImageDebugging:F}=i,H={prompt:v,iterations:g,steps:T,cfg_scale:a,threshold:A,perlin:m,height:u,width:z,sampler_name:y,seed:C,progress_images:"full-res"===B,progress_latents:"latents"===B,save_intermediates:j,generation_mode:n,init_mask:""};let W=!1,V=!1;if(H.seed=P?WQ(0,jQ):C,["txt2img","img2img"].includes(n)&&(H.seamless=x,H.hires_fix=d,O&&(W={level:R,strength:N}),M&&(V={type:c,strength:l},"codeformer"===c&&(V.codeformer_fidelity=s))),"img2img"===n&&p&&(H.init_img="string"==typeof p?p:p.url,H.strength=h,H.fit=E),"unifiedCanvas"===n&&t){const{layerState:{objects:e},boundingBoxCoordinates:n,boundingBoxDimensions:r,inpaintReplace:i,shouldUseInpaintReplace:a,stageScale:s,isMaskEnabled:l,shouldPreserveMaskedArea:c,boundingBoxScaleMethod:u,scaledBoundingBoxDimensions:d}=o,p={...n,...r},g=((e,t)=>{const{width:n,height:r}=t,o=document.createElement("div"),i=new q1.Stage({container:o,width:n,height:r}),a=new q1.Layer,s=new q1.Layer;a.add(new q1.Rect({...t,fill:"white"})),e.forEach((e=>s.add(new q1.Line({points:e.points,stroke:"black",strokeWidth:2*e.strokeWidth,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:"brush"===e.tool?"source-over":"destination-out"})))),i.add(a),i.add(s);const l=i.toDataURL({...t});return o.remove(),l})(l?e.filter(EZ):[],p);H.init_mask=g,H.fit=!1,H.strength=h,H.invert_mask=c,a&&(H.inpaint_replace=i),H.bounding_box=p;const m=t.scale();t.scale({x:1/s,y:1/s});const v=t.getAbsolutePosition(),y=t.toDataURL({x:p.x+v.x,y:p.y+v.y,width:p.width,height:p.height});F&&(e=>{const t=window.open("");t&&e.forEach((e=>{const n=new Image;n.src=e.base64,t.document.write(e.caption),t.document.write("
"),t.document.write(n.outerHTML),t.document.write("

")}))})([{base64:g,caption:"mask sent as init_mask"},{base64:y,caption:"image sent as init_img"}]),t.scale(m),H.init_img=y,H.progress_images=!1,"none"!==u&&(H.inpaint_width=d.width,H.inpaint_height=d.height),H.seam_size=w,H.seam_blur=b,H.seam_strength=S,H.seam_steps=k,H.tile_size=I,H.infill_method=f,H.force_outpaint=!1}return L?(H.variation_amount=D,_&&(H.with_variations=(e=>{const t=e.split(",").map((e=>e.split(":")));return t.map((e=>[parseInt(e[0]),parseFloat(e[1])]))})(_))):H.variation_amount=0,F&&(H.enable_image_debugging=F),{generationParameters:H,esrganParameters:W,facetoolParameters:V}},J1=()=>{const{origin:e}=new URL(window.location.href),t=rQ(e,{timeout:6e4,path:window.location.pathname+"socket.io"});let n=!1;return e=>r=>o=>{const{onConnect:i,onDisconnect:a,onError:s,onPostprocessingResult:l,onGenerationResult:c,onIntermediateResult:u,onProgressUpdate:d,onGalleryImages:h,onProcessingCanceled:f,onImageDeleted:p,onSystemConfig:g,onModelChanged:m,onFoundModels:v,onNewModelAdded:y,onModelDeleted:b,onModelChangeFailed:x,onTempFolderEmptied:w}=(e=>{const{dispatch:t,getState:n}=e;return{onConnect:()=>{try{t(qY(!0)),t(QY(gq.t("common:statusConnected"))),t(PQ());const e=n().gallery;e.categories.result.latest_mtime?t(EQ("result")):t(_Q("result")),e.categories.user.latest_mtime?t(EQ("user")):t(_Q("user"))}catch(j2){console.error(j2)}},onDisconnect:()=>{try{t(qY(!1)),t(QY(gq.t("common:statusDisconnected"))),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(j2){console.error(j2)}},onGenerationResult:e=>{try{const r=n(),{shouldLoopback:o,activeTab:i}=r.options,{boundingBox:a,generationMode:s,...l}=e,c={uuid:cQ(),...l};if(["txt2img","img2img"].includes(s)&&t(R$({category:"result",image:{...c,category:"result"}})),"unifiedCanvas"===s&&e.boundingBox){const{boundingBox:n}=e;t(IZ({image:{...c,category:"temp"},boundingBox:n})),r.canvas.shouldAutoSave&&t(R$({image:{...c,category:"result"},category:"result"}))}o&&"img2img"===LU[i]&&t(GU(c)),t(N$()),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Image generated: ${e.url}`}))}catch(j2){console.error(j2)}},onIntermediateResult:e=>{try{t(j$({uuid:cQ(),...e,category:"result"})),e.isBase64||t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Intermediate image generated: ${e.url}`}))}catch(j2){console.error(j2)}},onPostprocessingResult:e=>{try{t(R$({category:"result",image:{uuid:cQ(),...e,category:"result"}})),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Postprocessed: ${e.url}`}))}catch(j2){console.error(j2)}},onProgressUpdate:e=>{try{t(UY(!0)),t(KY(e))}catch(j2){console.error(j2)}},onError:e=>{const{message:n,additionalData:r}=e;try{t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Server error: ${n}`,level:"error"})),t(nZ()),t(N$())}catch(j2){console.error(j2)}},onGalleryImages:e=>{const{images:n,areMoreImagesAvailable:r,category:o}=e,i=n.map((e=>({uuid:cQ(),...e})));t(B$({images:i,areMoreImagesAvailable:r,category:o})),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Loaded ${n.length} images`}))},onProcessingCanceled:()=>{t(tZ());const{intermediateImage:e}=n().gallery;e&&(e.isBase64||(t(R$({category:"result",image:e})),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Intermediate image saved: ${e.url}`}))),t(N$())),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:e=>{const{url:r}=e;t(D$(e));const{initialImage:o,maskPath:i}=n().options;o!==r&&o?.url!==r||t(MU()),i===r&&t(ZU("")),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Image deleted: ${r}`}))},onSystemConfig:e=>{t(JY(e)),e.infill_methods.includes("patchmatch")||t($U(e.infill_methods[0]))},onFoundModels:e=>{const{search_folder:n,found_models:r}=e;t(fZ(n)),t(pZ(r))},onNewModelAdded:e=>{const{new_model_name:n,model_list:r,update:o}=e;t(oZ(r)),t(UY(!1)),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Model Added: ${n}`,level:"info"})),t(uZ({title:o?`${gq.t("modelmanager:modelUpdated")}: ${n}`:`${gq.t("modelmanager:modelAdded")}: ${n}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:e=>{const{deleted_model_name:n,model_list:r}=e;t(oZ(r)),t(UY(!1)),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`${gq.t("modelmanager:modelAdded")}: ${n}`,level:"info"})),t(uZ({title:`${gq.t("modelmanager:modelEntryDeleted")}: ${n}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:e=>{const{model_name:n,model_list:r}=e;t(oZ(r)),t(QY(gq.t("common:statusModelChanged"))),t(UY(!1)),t(iZ(!0)),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Model changed: ${n}`,level:"info"}))},onModelChangeFailed:e=>{const{model_name:n,model_list:r}=e;t(oZ(r)),t(UY(!1)),t(iZ(!0)),t(nZ()),t($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Model change failed: ${n}`,level:"error"}))},onTempFolderEmptied:()=>{t(uZ({title:gq.t("toast:tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}})(e),{emitGenerateImage:k,emitRunESRGAN:S,emitRunFacetool:C,emitDeleteImage:_,emitRequestImages:E,emitRequestNewImages:L,emitCancelProcessing:P,emitRequestSystemConfig:O,emitSearchForModels:M,emitAddNewModel:T,emitDeleteModel:A,emitRequestModelChange:I,emitSaveStagingAreaImageToGallery:R,emitRequestEmptyTempFolder:N}=((e,t)=>{const{dispatch:n,getState:r}=e;return{emitGenerateImage:e=>{n(UY(!0));const o=r(),{options:i,system:a,canvas:s}=o,l={generationMode:e,optionsState:i,canvasState:s,systemState:a};n(cZ());const{generationParameters:c,esrganParameters:u,facetoolParameters:d}=Q1(l);t.emit("generateImage",c,u,d),c.init_mask&&(c.init_mask=c.init_mask.substr(0,64).concat("...")),c.init_img&&(c.init_img=c.init_img.substr(0,64).concat("...")),n($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...c,...u,...d})}`}))},emitRunESRGAN:e=>{n(UY(!0));const o=r().options,{upscalingLevel:i,upscalingStrength:a}=o,s={upscale:[i,a]};t.emit("runPostprocessing",e,{type:"esrgan",...s}),n($Y({timestamp:fQ(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:e.url,...s})}`}))},emitRunFacetool:e=>{n(UY(!0));const o=r().options,{facetoolType:i,facetoolStrength:a,codeformerFidelity:s}=o,l={facetool_strength:a};"codeformer"===i&&(l.codeformer_fidelity=s),t.emit("runPostprocessing",e,{type:i,...l}),n($Y({timestamp:fQ(new Date,"isoDateTime"),message:`Face restoration (${i}) requested: ${JSON.stringify({file:e.url,...l})}`}))},emitDeleteImage:e=>{const{url:r,uuid:o,category:i,thumbnail:a}=e;n(D$(e)),t.emit("deleteImage",r,a,o,i)},emitRequestImages:e=>{const n=r().gallery,{earliest_mtime:o}=n.categories[e];t.emit("requestImages",e,o)},emitRequestNewImages:e=>{const n=r().gallery,{latest_mtime:o}=n.categories[e];t.emit("requestLatestImages",e,o)},emitCancelProcessing:()=>{t.emit("cancel")},emitRequestSystemConfig:()=>{t.emit("requestSystemConfig")},emitSearchForModels:e=>{t.emit("searchForModels",e)},emitAddNewModel:e=>{t.emit("addNewModel",e)},emitDeleteModel:e=>{t.emit("deleteModel",e)},emitRequestModelChange:e=>{n(aZ()),t.emit("requestModelChange",e)},emitSaveStagingAreaImageToGallery:e=>{t.emit("requestSaveStagingAreaImageToGallery",e)},emitRequestEmptyTempFolder:()=>{t.emit("requestEmptyTempFolder")}}})(e,t);switch(n||(t.on("connect",(()=>i())),t.on("disconnect",(()=>a())),t.on("error",(e=>s(e))),t.on("generationResult",(e=>c(e))),t.on("postprocessingResult",(e=>l(e))),t.on("intermediateResult",(e=>u(e))),t.on("progressUpdate",(e=>d(e))),t.on("galleryImages",(e=>h(e))),t.on("processingCanceled",(()=>{f()})),t.on("imageDeleted",(e=>{p(e)})),t.on("systemConfig",(e=>{g(e)})),t.on("foundModels",(e=>{v(e)})),t.on("newModelAdded",(e=>{y(e)})),t.on("modelDeleted",(e=>{b(e)})),t.on("modelChanged",(e=>{m(e)})),t.on("modelChangeFailed",(e=>{x(e)})),t.on("tempFolderEmptied",(()=>{w()})),n=!0),o.type){case"socketio/generateImage":k(o.payload);break;case"socketio/runESRGAN":S(o.payload);break;case"socketio/runFacetool":C(o.payload);break;case"socketio/deleteImage":_(o.payload);break;case"socketio/requestImages":E(o.payload);break;case"socketio/requestNewImages":L(o.payload);break;case"socketio/cancelProcessing":P();break;case"socketio/requestSystemConfig":O();break;case"socketio/searchForModels":M(o.payload);break;case"socketio/addNewModel":T(o.payload);break;case"socketio/deleteModel":A(o.payload);break;case"socketio/requestModelChange":I(o.payload);break;case"socketio/saveStagingAreaImageToGallery":R(o.payload);break;case"socketio/requestEmptyTempFolder":N()}r(o)}},e2=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map((e=>`canvas.${e}`)),t2=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel"].map((e=>`system.${e}`)),n2=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","shouldHoldGalleryOpen","intermediateImage"].map((e=>`gallery.${e}`)),r2=nV({options:M$,gallery:Q$,system:mZ,canvas:UX}),o2=function(e,t){var n=void 0!==e.version?e.version:-1;e.debug;var r=void 0===e.stateReconciler?ZV:e.stateReconciler,o=e.getStoredState||QV,i=void 0!==e.timeout?e.timeout:5e3,a=null,s=!1,l=!0,c=function(e){return e._persist.rehydrated&&a&&!l&&a.update(e),e};return function(u,d){var h=u||{},f=h._persist,p=oU(h,["_persist"]);if(d.type===VV){var g=!1,m=function(t,n){g||(d.rehydrate(e.key,t,n),g=!0)};if(i&&setTimeout((function(){!g&&m(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))}),i),l=!1,a||(a=XV(e)),f)return nU({},t(p,d),{_persist:f});if("function"!=typeof d.rehydrate||"function"!=typeof d.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return d.register(e.key),o(e).then((function(t){var r=e.migrate||function(e,t){return Promise.resolve(e)};r(t,n).then((function(e){m(e)}),(function(e){m(void 0,e)}))}),(function(e){m(void 0,e)})),nU({},t(p,d),{_persist:{version:n,rehydrated:!1}})}if(d.type===UV)return s=!0,d.result(function(e){var t=e.storage,n="".concat(void 0!==e.keyPrefix?e.keyPrefix:jV).concat(e.key);return t.removeItem(n,eU)}(e)),nU({},t(p,d),{_persist:f});if(d.type===FV)return d.result(a&&a.flush()),nU({},t(p,d),{_persist:f});if(d.type===WV)l=!0;else if(d.type===HV){if(s)return nU({},p,{_persist:nU({},f,{rehydrated:!0})});if(d.key===e.key){var v=t(p,d),y=d.payload,b=nU({},!1!==r&&void 0!==y?r(y,u,v,e):v,{_persist:nU({},f,{rehydrated:!0})});return c(b)}}if(!f)return t(u,d);var x=t(p,d);return x===p?u:c(nU({},x,{_persist:f}))}}(xU.getPersistConfig({key:"root",storage:yU,rootReducer:r2,blacklist:[...e2,...t2,...n2],debounce:300}),r2),i2=function(e){var t,n=OV(),r=e||{},o=r.reducer,i=void 0===o?void 0:o,a=r.middleware,s=void 0===a?n():a,l=r.devTools,c=void 0===l||l,u=r.preloadedState,d=void 0===u?void 0:u,h=r.enhancers,f=void 0===h?void 0:h;if("function"==typeof i)t=i;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=nV(i)}var p=s;"function"==typeof p&&(p=p(n));var g=oV.apply(void 0,p),m=rV;c&&(m=EV(CV({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=mV([g],f):"function"==typeof f&&(v=f(v)),tV(t,d,m.apply(void 0,v))}({reducer:o2,middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(J1()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}});var a2={exports:{}},s2={},l2=a.exports;var c2="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},u2=l2.useState,d2=l2.useEffect,h2=l2.useLayoutEffect,f2=l2.useDebugValue;function p2(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!c2(e,n)}catch(pue){return!0}}var g2="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=u2({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return h2((function(){o.value=n,o.getSnapshot=t,p2(o)&&i({inst:o})}),[e,n,t]),d2((function(){return p2(o)&&i({inst:o}),e((function(){p2(o)&&i({inst:o})}))}),[e]),f2(n),n};s2.useSyncExternalStore=void 0!==l2.useSyncExternalStore?l2.useSyncExternalStore:g2,function(e){e.exports=s2}(a2);var m2={exports:{}},v2={},y2=a.exports,b2=a2.exports;var x2="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},w2=b2.useSyncExternalStore,k2=y2.useRef,S2=y2.useEffect,C2=y2.useMemo,_2=y2.useDebugValue;v2.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=k2(null);if(null===i.current){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=C2((function(){function e(e){if(!l){if(l=!0,i=e,e=r(e),void 0!==o&&a.hasValue){var t=a.value;if(o(t,e))return s=t}return s=e}if(t=s,x2(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(i=e,s=n)}var i,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,o]);var s=w2(e,i[0],i[1]);return S2((function(){a.hasValue=!0,a.value=s}),[s]),_2(s),s},function(e){e.exports=v2}(m2);let E2=function(e){e()};const L2=()=>E2,P2=a.exports.createContext(null);function O2(){return a.exports.useContext(P2)}let M2=()=>{throw new Error("uSES not initialized!")};const T2=(e,t)=>e===t;function A2(e=P2){const t=e===P2?O2:()=>a.exports.useContext(e);return function(e,n=T2){const{store:r,subscription:o,getServerState:i}=t(),s=M2(o.addNestedSub,r.getState,i||r.getState,e,n);return a.exports.useDebugValue(s),s}}const I2=A2();var R2,N2={},D2=Symbol.for("react.element"),z2=Symbol.for("react.portal"),B2=Symbol.for("react.fragment"),j2=Symbol.for("react.strict_mode"),F2=Symbol.for("react.profiler"),H2=Symbol.for("react.provider"),W2=Symbol.for("react.context"),V2=Symbol.for("react.server_context"),U2=Symbol.for("react.forward_ref"),$2=Symbol.for("react.suspense"),G2=Symbol.for("react.suspense_list"),q2=Symbol.for("react.memo"),Y2=Symbol.for("react.lazy"),Z2=Symbol.for("react.offscreen");function X2(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case D2:switch(e=e.type){case B2:case F2:case j2:case $2:case G2:return e;default:switch(e=e&&e.$$typeof){case V2:case W2:case U2:case Y2:case q2:case H2:return e;default:return t}}case z2:return t}}}R2=Symbol.for("react.module.reference"),N2.ContextConsumer=W2,N2.ContextProvider=H2,N2.Element=D2,N2.ForwardRef=U2,N2.Fragment=B2,N2.Lazy=Y2,N2.Memo=q2,N2.Portal=z2,N2.Profiler=F2,N2.StrictMode=j2,N2.Suspense=$2,N2.SuspenseList=G2,N2.isAsyncMode=function(){return!1},N2.isConcurrentMode=function(){return!1},N2.isContextConsumer=function(e){return X2(e)===W2},N2.isContextProvider=function(e){return X2(e)===H2},N2.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D2},N2.isForwardRef=function(e){return X2(e)===U2},N2.isFragment=function(e){return X2(e)===B2},N2.isLazy=function(e){return X2(e)===Y2},N2.isMemo=function(e){return X2(e)===q2},N2.isPortal=function(e){return X2(e)===z2},N2.isProfiler=function(e){return X2(e)===F2},N2.isStrictMode=function(e){return X2(e)===j2},N2.isSuspense=function(e){return X2(e)===$2},N2.isSuspenseList=function(e){return X2(e)===G2},N2.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===B2||e===F2||e===j2||e===$2||e===G2||e===Z2||"object"==typeof e&&null!==e&&(e.$$typeof===Y2||e.$$typeof===q2||e.$$typeof===H2||e.$$typeof===W2||e.$$typeof===U2||e.$$typeof===R2||void 0!==e.getModuleId)},N2.typeOf=X2,function(e){e.exports=N2}({exports:{}});const K2={notify(){},get:()=>[]};function Q2(e,t){let n,r=K2;function o(){a.onStateChange&&a.onStateChange()}function i(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){const e=L2();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const a={addNestedSub:function(e){return i(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=K2)},getListeners:()=>r};return a}const J2=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?a.exports.useLayoutEffect:a.exports.useEffect;function e5({store:e,context:t,children:n,serverState:r}){const o=a.exports.useMemo((()=>{const t=Q2(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0}}),[e,r]),i=a.exports.useMemo((()=>e.getState()),[e]);J2((()=>{const{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),i!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[o,i]);return ld((t||P2).Provider,{value:o,children:n})}function t5(e=P2){const t=e===P2?O2:()=>a.exports.useContext(e);return function(){const{store:e}=t();return e}}const n5=t5();function r5(e=P2){const t=e===P2?n5:t5(e);return function(){return t().dispatch}}const o5=r5();var i5;function a5(e){return a5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a5(e)}function s5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l5(e,t){for(var n=0;n{M2=e})(m2.exports.useSyncExternalStoreWithSelector),i5=U.exports.unstable_batchedUpdates,E2=i5;var p5=function(e){function t(){var e,n;s5(this,t);for(var r=arguments.length,o=new Array(r),i=0;ild(CI,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",children:ld(hT,{thickness:"2px",speed:"1s",emptyColor:"gray.200",color:"gray.400",size:"xl"})}),v5=o5,y5=I2,b5=uV((e=>e.system),(e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),x5=()=>{const{isProcessing:e,currentStep:t,totalSteps:n,currentStatusHasSteps:r}=y5(b5),o=t?Math.round(100*t/n):0;return ld(eF,{value:o,isIndeterminate:e&&!r,className:"progress-bar"})};var w5={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},k5=H.createContext&&H.createContext(w5),S5=globalThis&&globalThis.__assign||function(){return S5=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{tooltip:n="",styleClass:r,tooltipProps:o,asCheckbox:i,isChecked:a,...s}=e;return ld(YH,{label:n,hasArrow:!0,...o,...o?.placement?{placement:o.placement}:{placement:"top"},children:ld(zT,{ref:t,className:r?`invokeai__icon-button ${r}`:"invokeai__icon-button","data-as-checkbox":i,"data-selected":void 0!==a?a:void 0,...s})})}));function C3(e){const{title:t,hotkey:n,description:r}=e;return cd("div",{className:"hotkey-modal-item",children:[cd("div",{className:"hotkey-info",children:[ld("p",{className:"hotkey-title",children:t}),r&&ld("p",{className:"hotkey-description",children:r})]}),ld("div",{className:"hotkey-key",children:n})]})}function _3({children:e}){const{isOpen:t,onOpen:n,onClose:r}=QA(),{t:o}=HY(),i=[{title:o("hotkeys:invoke.title"),desc:o("hotkeys:invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys:cancel.title"),desc:o("hotkeys:cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys:focusPrompt.title"),desc:o("hotkeys:focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys:toggleOptions.title"),desc:o("hotkeys:toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys:pinOptions.title"),desc:o("hotkeys:pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys:toggleViewer.title"),desc:o("hotkeys:toggleViewer.desc"),hotkey:"Z"},{title:o("hotkeys:toggleGallery.title"),desc:o("hotkeys:toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys:maximizeWorkSpace.title"),desc:o("hotkeys:maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys:changeTabs.title"),desc:o("hotkeys:changeTabs.desc"),hotkey:"1-5"},{title:o("hotkeys:consoleToggle.title"),desc:o("hotkeys:consoleToggle.desc"),hotkey:"`"}],s=[{title:o("hotkeys:setPrompt.title"),desc:o("hotkeys:setPrompt.desc"),hotkey:"P"},{title:o("hotkeys:setSeed.title"),desc:o("hotkeys:setSeed.desc"),hotkey:"S"},{title:o("hotkeys:setParameters.title"),desc:o("hotkeys:setParameters.desc"),hotkey:"A"},{title:o("hotkeys:restoreFaces.title"),desc:o("hotkeys:restoreFaces.desc"),hotkey:"Shift+R"},{title:o("hotkeys:upscale.title"),desc:o("hotkeys:upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys:showInfo.title"),desc:o("hotkeys:showInfo.desc"),hotkey:"I"},{title:o("hotkeys:sendToImageToImage.title"),desc:o("hotkeys:sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys:deleteImage.title"),desc:o("hotkeys:deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys:closePanels.title"),desc:o("hotkeys:closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys:previousImage.title"),desc:o("hotkeys:previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys:nextImage.title"),desc:o("hotkeys:nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys:toggleGalleryPin.title"),desc:o("hotkeys:toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:o("hotkeys:increaseGalleryThumbSize.title"),desc:o("hotkeys:increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys:decreaseGalleryThumbSize.title"),desc:o("hotkeys:decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],c=[{title:o("hotkeys:selectBrush.title"),desc:o("hotkeys:selectBrush.desc"),hotkey:"B"},{title:o("hotkeys:selectEraser.title"),desc:o("hotkeys:selectEraser.desc"),hotkey:"E"},{title:o("hotkeys:decreaseBrushSize.title"),desc:o("hotkeys:decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys:increaseBrushSize.title"),desc:o("hotkeys:increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys:decreaseBrushOpacity.title"),desc:o("hotkeys:decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys:increaseBrushOpacity.title"),desc:o("hotkeys:increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys:moveTool.title"),desc:o("hotkeys:moveTool.desc"),hotkey:"V"},{title:o("hotkeys:fillBoundingBox.title"),desc:o("hotkeys:fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys:eraseBoundingBox.title"),desc:o("hotkeys:eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys:colorPicker.title"),desc:o("hotkeys:colorPicker.desc"),hotkey:"C"},{title:o("hotkeys:toggleSnap.title"),desc:o("hotkeys:toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys:quickToggleMove.title"),desc:o("hotkeys:quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys:toggleLayer.title"),desc:o("hotkeys:toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys:clearMask.title"),desc:o("hotkeys:clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys:hideMask.title"),desc:o("hotkeys:hideMask.desc"),hotkey:"H"},{title:o("hotkeys:showHideBoundingBox.title"),desc:o("hotkeys:showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys:mergeVisible.title"),desc:o("hotkeys:mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys:saveToGallery.title"),desc:o("hotkeys:saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys:copyToClipboard.title"),desc:o("hotkeys:copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys:downloadImage.title"),desc:o("hotkeys:downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys:undoStroke.title"),desc:o("hotkeys:undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys:redoStroke.title"),desc:o("hotkeys:redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys:resetView.title"),desc:o("hotkeys:resetView.desc"),hotkey:"R"},{title:o("hotkeys:previousStagingImage.title"),desc:o("hotkeys:previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys:nextStagingImage.title"),desc:o("hotkeys:nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys:acceptStagingImage.title"),desc:o("hotkeys:acceptStagingImage.desc"),hotkey:"Enter"}],u=e=>{const t=[];return e.forEach(((e,n)=>{t.push(ld(C3,{title:e.title,description:e.desc,hotkey:e.hotkey},n))})),ld("div",{className:"hotkey-modal-category",children:t})};return cd(sd,{children:[a.exports.cloneElement(e,{onClick:n}),cd(RB,{isOpen:t,onClose:r,children:[ld(GB,{}),cd(WB,{className:" modal hotkeys-modal",children:[ld(DB,{className:"modal-close-btn"}),ld("h1",{children:"Keyboard Shorcuts"}),ld("div",{className:"hotkeys-modal-items",children:cd(uT,{allowMultiple:!0,children:[cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:appHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(i)})]}),cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:generalHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(s)})]}),cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:galleryHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(l)})]}),cd(lT,{children:[cd(nT,{className:"hotkeys-modal-button",children:[ld("h2",{children:o("hotkeys:unifiedCanvasHotkeys")}),ld(sT,{})]}),ld(cT,{children:u(c)})]})]})})]})]})]})}const E3=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:i,styleClass:a,...s}=e;return cd(GT,{isDisabled:n,width:r,className:`invokeai__switch-form-control ${a}`,display:"flex",columnGap:"1rem",alignItems:"center",justifyContent:"space-between",...o,children:[ld(eA,{className:"invokeai__switch-form-label",whiteSpace:"nowrap",marginRight:0,marginTop:.5,marginBottom:.5,fontSize:"sm",fontWeight:"bold",width:"auto",...i,children:t}),ld(nH,{className:"invokeai__switch-root",...s})]})},L3=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:o,tooltipProps:i,size:a="sm",fontSize:s="sm",styleClass:l,...c}=e;return cd(GT,{isDisabled:n,className:`invokeai__select ${l}`,onClick:e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.nativeEvent.stopPropagation(),e.nativeEvent.cancelBubble=!0},children:[t&&ld(eA,{className:"invokeai__select-label",fontSize:s,fontWeight:"bold",marginRight:0,marginBottom:0,whiteSpace:"nowrap",children:t}),ld(YH,{label:o,...i,children:ld(rF,{className:"invokeai__select-picker",fontSize:s,size:a,...c,children:r.map((e=>"string"==typeof e||"number"==typeof e?ld("option",{value:e,className:"invokeai__select-option",children:e},e):ld("option",{value:e.value,className:"invokeai__select-option",children:e.key},e.value)))})})]})},P3=/^-?(0\.)?\.?$/,O3=e=>{const{label:t,labelFontSize:n="sm",styleClass:r,isDisabled:o=!1,showStepper:i=!0,width:s,textAlign:l,isInvalid:c,value:u,onChange:d,min:h,max:f,isInteger:p=!0,formControlProps:g,formLabelProps:m,numberInputFieldProps:v,numberInputStepperProps:y,tooltipProps:b,...x}=e,[w,k]=a.exports.useState(String(u));a.exports.useEffect((()=>{w.match(P3)||u===Number(w)||k(String(u))}),[u,w]);return ld(YH,{...b,children:cd(GT,{isDisabled:o,isInvalid:c,className:r?`invokeai__number-input-form-control ${r}`:"invokeai__number-input-form-control",...g,children:[t&&ld(eA,{className:"invokeai__number-input-form-label",style:{display:t?"block":"none"},fontSize:n,fontWeight:"bold",marginRight:0,marginBottom:0,whiteSpace:"nowrap",...m,children:t}),cd(fj,{className:"invokeai__number-input-root",value:w,min:h,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:e=>{k(e),e.match(P3)||d(p?Math.floor(Number(e)):Number(e))},onBlur:e=>{const t=A$.clamp(p?Math.floor(Number(e.target.value)):Number(e.target.value),h,f);k(String(t)),d(t)},width:s,...x,children:[ld(gj,{className:"invokeai__number-input-field",textAlign:l,...v}),i&&cd("div",{className:"invokeai__number-input-stepper",children:[ld(yj,{...y,className:"invokeai__number-input-stepper-button"}),ld(vj,{...y,className:"invokeai__number-input-stepper-button"})]})]})]})})},M3=e=>e.system,T3=e=>e.system.toastQueue,A3=uV((e=>e.options),(e=>LU[e.activeTab]),{memoizeOptions:{equalityCheck:A$.isEqual}});uV((e=>e.options),(e=>{const{shouldRandomizeSeed:t,shouldGenerateVariations:n}=e;return t||n}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});const I3=e=>e.options,R3=uV([M3,I3],((e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,model_list:i,saveIntermediatesInterval:a,enableImageDebugging:s}=e,{shouldUseCanvasBetaLayout:l}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,models:A$.map(i,((e,t)=>t)),saveIntermediatesInterval:a,enableImageDebugging:s,shouldUseCanvasBetaLayout:l}}),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),N3=({children:e})=>{const t=v5(),{t:n}=HY(),r=y5((e=>e.options.steps)),{isOpen:o,onOpen:i,onClose:s}=QA(),{isOpen:l,onOpen:c,onClose:u}=QA(),{shouldDisplayInProgressType:d,shouldConfirmOnDelete:h,shouldDisplayGuides:f,saveIntermediatesInterval:p,enableImageDebugging:g,shouldUseCanvasBetaLayout:m}=y5(R3);return cd(sd,{children:[a.exports.cloneElement(e,{onClick:i}),cd(RB,{isOpen:o,onClose:s,size:"lg",children:[ld(GB,{}),cd(WB,{className:"modal settings-modal",children:[ld(UB,{className:"settings-modal-header",children:n("common:settingsLabel")}),ld(DB,{className:"modal-close-btn"}),cd(NB,{className:"settings-modal-content",children:[cd("div",{className:"settings-modal-items",children:[cd("div",{className:"settings-modal-item",style:{gridAutoFlow:"row",rowGap:"0.5rem"},children:[ld(L3,{label:n("settings:displayInProgress"),validValues:HQ,value:d,onChange:e=>t(VY(e.target.value))}),"full-res"===d&&ld(O3,{label:n("settings:saveSteps"),min:1,max:r,step:1,onChange:e=>{e>r&&(e=r),e<1&&(e=1),t(sZ(e))},value:p,width:"auto",textAlign:"center"})]}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:confirmOnDelete"),isChecked:h,onChange:e=>t(ZY(e.target.checked))}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:displayHelpIcons"),isChecked:f,onChange:e=>t(eZ(e.target.checked))}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:useCanvasBeta"),isChecked:m,onChange:e=>t(L$(e.target.checked))})]}),cd("div",{className:"settings-modal-items",children:[ld("h2",{style:{fontWeight:"bold"},children:"Developer"}),ld(E3,{styleClass:"settings-modal-item",label:n("settings:enableImageDebugging"),isChecked:g,onChange:e=>t(lZ(e.target.checked))})]}),cd("div",{className:"settings-modal-reset",children:[ld(PI,{size:"md",children:n("settings:resetWebUI")}),ld(RT,{colorScheme:"red",onClick:()=>{g5.purge().then((()=>{s(),c()}))},children:n("settings:resetWebUI")}),ld(VI,{children:n("settings:resetWebUIDesc1")}),ld(VI,{children:n("settings:resetWebUIDesc2")})]})]}),ld(VB,{children:ld(RT,{onClick:s,className:"modal-close-btn",children:n("common:close")})})]})]}),cd(RB,{closeOnOverlayClick:!1,isOpen:l,onClose:u,isCentered:!0,children:[ld(GB,{bg:"blackAlpha.300",backdropFilter:"blur(40px)"}),ld(WB,{children:ld(NB,{pb:6,pt:6,children:ld(CI,{justifyContent:"center",children:ld(VI,{fontSize:"lg",children:ld(VI,{children:n("settings:resetComplete")})})})})})]})]})},D3=uV((e=>e.system),(e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),z3=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:o,hasError:i,wasErrorSeen:a}=y5(D3),s=v5(),{t:l}=HY();let c;c=e&&!i?"status-good":"status-bad";let u=o;[l("common:statusGenerating"),l("common:statusPreparing"),l("common:statusSavingImage"),l("common:statusRestoringFaces"),l("common:statusUpscaling")].includes(u)&&(c="status-working"),u&&t&&r>1&&(u=l(u)+` (${n}/${r})`);return ld(YH,{label:i&&!a?"Click to clear, check logs for details":void 0,children:ld(VI,{cursor:i&&!a?"pointer":"initial",onClick:()=>{!i&&a||s(rZ())},className:`status ${c}`,children:l(u)})})},B3=e=>{const{triggerComponent:t,children:n,styleClass:r,hasArrow:o=!0,...i}=e;return cd(Aj,{...i,children:[ld(Wj,{children:t}),cd(Fj,{className:`invokeai__popover-content ${r}`,children:[o&&ld(Ij,{className:"invokeai__popover-arrow"}),n]})]})},j3=ok(((e,t)=>{const{children:n,tooltip:r="",tooltipProps:o,styleClass:i,...a}=e;return ld(YH,{label:r,...o,children:ld(RT,{ref:t,className:["invokeai__button",i].join(" "),...a,children:n})})}));function F3(){const{t:e}=HY(),{setColorMode:t,colorMode:n}=dd(),r=v5(),o=y5((e=>e.options.currentTheme)),i={dark:e("common:darkTheme"),light:e("common:lightTheme"),green:e("common:greenTheme")};a.exports.useEffect((()=>{n!==o&&t(o)}),[t,n,o]);return ld(B3,{trigger:"hover",triggerComponent:ld(S3,{"aria-label":e("common:themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:ld(i3,{})}),children:ld(WI,{align:"stretch",children:(()=>{const e=[];return Object.keys(i).forEach((t=>{e.push(ld(j3,{style:{width:"6rem"},leftIcon:o===t?ld(B5,{}):void 0,size:"sm",onClick:()=>(e=>{r(jU(e))})(t),children:i[t]},t))})),e})()})})}const H3=uV([M3],(e=>{const{isProcessing:t,model_list:n}=e,r=A$.map(n,((e,t)=>t)),o=A$.reduce(n,((e,t,n)=>("active"===t.status&&(e=n),e)),"");return{models:r,activeModel:o,isProcessing:t,activeDesc:n[o].description}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),W3=()=>{const e=v5(),{models:t,activeModel:n,isProcessing:r,activeDesc:o}=y5(H3);return ld(CI,{style:{paddingLeft:"0.3rem"},children:ld(L3,{style:{fontSize:"0.8rem"},tooltip:o,isDisabled:r,value:n,validValues:t,onChange:t=>{e(AQ(t.target.value))}})})};function V3(e){const{label:t="",styleClass:n,isDisabled:r=!1,fontSize:o="sm",width:i,size:a="sm",isInvalid:s,...l}=e;return cd(GT,{className:`input ${n}`,isInvalid:s,isDisabled:r,children:[""!==t&&ld(eA,{fontSize:o,fontWeight:"bold",alignItems:"center",whiteSpace:"nowrap",marginBottom:0,marginRight:0,className:"input-label",children:t}),ld(eI,{...l,className:"input-entry",size:a,width:i})]})}const U3=e=>{const{label:t,styleClass:n,...r}=e;return ld(TA,{className:`invokeai__checkbox ${n}`,...r,children:t})};function $3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"}}]})(e)}function G3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function q3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function Y3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function Z3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function X3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function K3(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}var Q3=Array.isArray,J3=Object.keys,e4=Object.prototype.hasOwnProperty,t4="undefined"!=typeof Element;function n4(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,o,i=Q3(e),a=Q3(t);if(i&&a){if((r=e.length)!=t.length)return!1;for(n=r;0!=n--;)if(!n4(e[n],t[n]))return!1;return!0}if(i!=a)return!1;var s=e instanceof Date,l=t instanceof Date;if(s!=l)return!1;if(s&&l)return e.getTime()==t.getTime();var c=e instanceof RegExp,u=t instanceof RegExp;if(c!=u)return!1;if(c&&u)return e.toString()==t.toString();var d=J3(e);if((r=d.length)!==J3(t).length)return!1;for(n=r;0!=n--;)if(!e4.call(t,d[n]))return!1;if(t4&&e instanceof Element&&t instanceof Element)return e===t;for(n=r;0!=n--;)if(!("_owner"===(o=d[n])&&e.$$typeof||n4(e[o],t[o])))return!1;return!0}return e!=e&&t!=t}var r4=function(e,t){try{return n4(e,t)}catch(n){if(n.message&&n.message.match(/stack|recursion/i)||-2146828260===n.number)return console.warn("Warning: react-fast-compare does not handle circular references.",n.name,n.message),!1;throw n}},o4=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i4}(e)}(e)};var i4="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a4(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l4((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function s4(e,t,n){return e.concat(t).map((function(e){return a4(e,n)}))}function l4(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||s4,n.isMergeableObject=n.isMergeableObject||o4;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):function(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach((function(t){r[t]=a4(e[t],n)})),Object.keys(t).forEach((function(o){n.isMergeableObject(t[o])&&e[o]?r[o]=l4(e[o],t[o],n):r[o]=a4(t[o],n)})),r}(e,t,n):a4(t,n)}l4.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l4(e,n,t)}),{})};var c4=l4;const u4="object"==typeof global&&global&&global.Object===Object&&global;var d4="object"==typeof self&&self&&self.Object===Object&&self;const h4=u4||d4||Function("return this")();const f4=h4.Symbol;var p4=Object.prototype,g4=p4.hasOwnProperty,m4=p4.toString,v4=f4?f4.toStringTag:void 0;var y4=Object.prototype.toString;var b4=f4?f4.toStringTag:void 0;function x4(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":b4&&b4 in Object(e)?function(e){var t=g4.call(e,v4),n=e[v4];try{e[v4]=void 0;var r=!0}catch(j2){}var o=m4.call(e);return r&&(t?e[v4]=n:delete e[v4]),o}(e):function(e){return y4.call(e)}(e)}function w4(e,t){return function(n){return e(t(n))}}const k4=w4(Object.getPrototypeOf,Object);function S4(e){return null!=e&&"object"==typeof e}var C4=Function.prototype,_4=Object.prototype,E4=C4.toString,L4=_4.hasOwnProperty,P4=E4.call(Object);function O4(e){if(!S4(e)||"[object Object]"!=x4(e))return!1;var t=k4(e);if(null===t)return!0;var n=L4.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&E4.call(n)==P4}function M4(e,t){return e===t||e!=e&&t!=t}function T4(e,t){for(var n=e.length;n--;)if(M4(e[n][0],t))return n;return-1}var A4=Array.prototype.splice;function I4(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},I4.prototype.set=function(e,t){var n=this.__data__,r=T4(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function N4(e){if(!R4(e))return!1;var t=x4(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}const D4=h4["__core-js_shared__"];var z4,B4=(z4=/[^.]+$/.exec(D4&&D4.keys&&D4.keys.IE_PROTO||""))?"Symbol(src)_1."+z4:"";var j4=Function.prototype.toString;function F4(e){if(null!=e){try{return j4.call(e)}catch(j2){}try{return e+""}catch(j2){}}return""}var H4=/^\[object .+?Constructor\]$/,W4=Function.prototype,V4=Object.prototype,U4=W4.toString,$4=V4.hasOwnProperty,G4=RegExp("^"+U4.call($4).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q4(e){return!(!R4(e)||(t=e,B4&&B4 in t))&&(N4(e)?G4:H4).test(F4(e));var t}function Y4(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return q4(n)?n:void 0}const Z4=Y4(h4,"Map");const X4=Y4(Object,"create");var K4=Object.prototype.hasOwnProperty;var Q4=Object.prototype.hasOwnProperty;function J4(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}var k6={};function S6(e){return function(t){return e(t)}}k6["[object Float32Array]"]=k6["[object Float64Array]"]=k6["[object Int8Array]"]=k6["[object Int16Array]"]=k6["[object Int32Array]"]=k6["[object Uint8Array]"]=k6["[object Uint8ClampedArray]"]=k6["[object Uint16Array]"]=k6["[object Uint32Array]"]=!0,k6["[object Arguments]"]=k6["[object Array]"]=k6["[object ArrayBuffer]"]=k6["[object Boolean]"]=k6["[object DataView]"]=k6["[object Date]"]=k6["[object Error]"]=k6["[object Function]"]=k6["[object Map]"]=k6["[object Number]"]=k6["[object Object]"]=k6["[object RegExp]"]=k6["[object Set]"]=k6["[object String]"]=k6["[object WeakMap]"]=!1;var C6="object"==typeof t&&t&&!t.nodeType&&t,_6=C6&&"object"==typeof n&&n&&!n.nodeType&&n,E6=_6&&_6.exports===C6&&u4.process,L6=function(){try{var e=_6&&_6.require&&_6.require("util").types;return e||E6&&E6.binding&&E6.binding("util")}catch(j2){}}();const P6=L6;var O6=P6&&P6.isTypedArray,M6=O6?S6(O6):function(e){return S4(e)&&w6(e.length)&&!!k6[x4(e)]};const T6=M6;var A6=Object.prototype.hasOwnProperty;function I6(e,t){var n=p6(e),r=!n&&f6(e),o=!n&&!r&&y6(e),i=!n&&!r&&!o&&T6(e),a=n||r||o||i,s=a?function(e,t){for(var n=-1,r=Array(e);++n=0||(o[n]=e[n]);return o}function n9(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var r9=function(e){return Array.isArray(e)&&0===e.length},o9=function(e){return"function"==typeof e},i9=function(e){return null!==e&&"object"==typeof e},a9=function(e){return String(Math.floor(Number(e)))===e},s9=function(e){return"[object String]"===Object.prototype.toString.call(e)},l9=function(e){return 0===a.exports.Children.count(e)},c9=function(e){return i9(e)&&o9(e.then)};function u9(e,t,n,r){void 0===r&&(r=0);for(var o=Q7(t);e&&r=0?[]:{}}}return(0===i?e:o)[a[i]]===n?e:(void 0===n?delete o[a[i]]:o[a[i]]=n,0===i&&void 0===n&&delete r[a[i]],r)}function h9(e,t,n,r){void 0===n&&(n=new WeakMap),void 0===r&&(r={});for(var o=0,i=Object.keys(e);o=n.length)break;i=n[o++]}else{if((o=n.next()).done)break;i=o.value}var a=i;u9(t,a.path)||(t=d9(t,a.path,a.message))}}return t}(n)):t(n)}))}))}),[f.validationSchema]),_=a.exports.useCallback((function(e,t){return new Promise((function(n){return n(b.current[e].validate(t))}))}),[]),E=a.exports.useCallback((function(e){var t=Object.keys(b.current).filter((function(e){return o9(b.current[e].validate)})),n=t.length>0?t.map((function(t){return _(t,u9(e,t))})):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(n).then((function(e){return e.reduce((function(e,n,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===n||n&&(e=d9(e,t[r],n)),e}),{})}))}),[_]),L=a.exports.useCallback((function(e){return Promise.all([E(e),f.validationSchema?C(e):{},f.validate?S(e):{}]).then((function(e){var t=e[0],n=e[1],r=e[2];return c4.all([t,n,r],{arrayMerge:k9})}))}),[f.validate,f.validationSchema,E,S,C]),P=C9((function(e){return void 0===e&&(e=w.values),k({type:"SET_ISVALIDATING",payload:!0}),L(e).then((function(e){return y.current&&(k({type:"SET_ISVALIDATING",payload:!1}),k({type:"SET_ERRORS",payload:e})),e}))}));a.exports.useEffect((function(){s&&!0===y.current&&r4(p.current,f.initialValues)&&P(p.current)}),[s,P]);var O=a.exports.useCallback((function(e){var t=e&&e.values?e.values:p.current,n=e&&e.errors?e.errors:g.current?g.current:f.initialErrors||{},r=e&&e.touched?e.touched:m.current?m.current:f.initialTouched||{},o=e&&e.status?e.status:v.current?v.current:f.initialStatus;p.current=t,g.current=n,m.current=r,v.current=o;var i=function(){k({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:o,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})};if(f.onReset){var a=f.onReset(w.values,Y);c9(a)?a.then(i):i()}else i()}),[f.initialErrors,f.initialStatus,f.initialTouched]);a.exports.useEffect((function(){!0!==y.current||r4(p.current,f.initialValues)||(u&&(p.current=f.initialValues,O()),s&&P(p.current))}),[u,f.initialValues,O,s,P]),a.exports.useEffect((function(){u&&!0===y.current&&!r4(g.current,f.initialErrors)&&(g.current=f.initialErrors||v9,k({type:"SET_ERRORS",payload:f.initialErrors||v9}))}),[u,f.initialErrors]),a.exports.useEffect((function(){u&&!0===y.current&&!r4(m.current,f.initialTouched)&&(m.current=f.initialTouched||y9,k({type:"SET_TOUCHED",payload:f.initialTouched||y9}))}),[u,f.initialTouched]),a.exports.useEffect((function(){u&&!0===y.current&&!r4(v.current,f.initialStatus)&&(v.current=f.initialStatus,k({type:"SET_STATUS",payload:f.initialStatus}))}),[u,f.initialStatus,f.initialTouched]);var M=C9((function(e){if(b.current[e]&&o9(b.current[e].validate)){var t=u9(w.values,e),n=b.current[e].validate(t);return c9(n)?(k({type:"SET_ISVALIDATING",payload:!0}),n.then((function(e){return e})).then((function(t){k({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),k({type:"SET_ISVALIDATING",payload:!1})}))):(k({type:"SET_FIELD_ERROR",payload:{field:e,value:n}}),Promise.resolve(n))}return f.validationSchema?(k({type:"SET_ISVALIDATING",payload:!0}),C(w.values,e).then((function(e){return e})).then((function(t){k({type:"SET_FIELD_ERROR",payload:{field:e,value:t[e]}}),k({type:"SET_ISVALIDATING",payload:!1})}))):Promise.resolve()})),T=a.exports.useCallback((function(e,t){var n=t.validate;b.current[e]={validate:n}}),[]),A=a.exports.useCallback((function(e){delete b.current[e]}),[]),I=C9((function(e,t){return k({type:"SET_TOUCHED",payload:e}),(void 0===t?o:t)?P(w.values):Promise.resolve()})),R=a.exports.useCallback((function(e){k({type:"SET_ERRORS",payload:e})}),[]),N=C9((function(e,t){var r=o9(e)?e(w.values):e;return k({type:"SET_VALUES",payload:r}),(void 0===t?n:t)?P(r):Promise.resolve()})),D=a.exports.useCallback((function(e,t){k({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})}),[]),z=C9((function(e,t,r){return k({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),(void 0===r?n:r)?P(d9(w.values,e,t)):Promise.resolve()})),B=a.exports.useCallback((function(e,t){var n,r=t,o=e;if(!s9(e)){e.persist&&e.persist();var i=e.target?e.target:e.currentTarget,a=i.type,s=i.name,l=i.id,c=i.value,u=i.checked,d=(i.outerHTML,i.options),h=i.multiple;r=t||(s||l),o=/number|range/.test(a)?(n=parseFloat(c),isNaN(n)?"":n):/checkbox/.test(a)?function(e,t,n){if("boolean"==typeof e)return Boolean(t);var r=[],o=!1,i=-1;if(Array.isArray(e))r=e,o=(i=e.indexOf(n))>=0;else if(!n||"true"==n||"false"==n)return Boolean(t);if(t&&n&&!o)return r.concat(n);if(!o)return r;return r.slice(0,i).concat(r.slice(i+1))}(u9(w.values,r),u,c):d&&h?function(e){return Array.from(e).filter((function(e){return e.selected})).map((function(e){return e.value}))}(d):c}r&&z(r,o)}),[z,w.values]),j=C9((function(e){if(s9(e))return function(t){return B(t,e)};B(e)})),F=C9((function(e,t,n){return void 0===t&&(t=!0),k({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),(void 0===n?o:n)?P(w.values):Promise.resolve()})),H=a.exports.useCallback((function(e,t){e.persist&&e.persist();var n=e.target,r=n.name,o=n.id,i=(n.outerHTML,t||(r||o));F(i,!0)}),[F]),W=C9((function(e){if(s9(e))return function(t){return H(t,e)};H(e)})),V=a.exports.useCallback((function(e){o9(e)?k({type:"SET_FORMIK_STATE",payload:e}):k({type:"SET_FORMIK_STATE",payload:function(){return e}})}),[]),U=a.exports.useCallback((function(e){k({type:"SET_STATUS",payload:e})}),[]),$=a.exports.useCallback((function(e){k({type:"SET_ISSUBMITTING",payload:e})}),[]),G=C9((function(){return k({type:"SUBMIT_ATTEMPT"}),P().then((function(e){var t=e instanceof Error;if(!t&&0===Object.keys(e).length){var n;try{if(void 0===(n=Z()))return}catch(r){throw r}return Promise.resolve(n).then((function(e){return y.current&&k({type:"SUBMIT_SUCCESS"}),e})).catch((function(e){if(y.current)throw k({type:"SUBMIT_FAILURE"}),e}))}if(y.current&&(k({type:"SUBMIT_FAILURE"}),t))throw e}))})),q=C9((function(e){e&&e.preventDefault&&o9(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&o9(e.stopPropagation)&&e.stopPropagation(),G().catch((function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)}))})),Y={resetForm:O,validateForm:P,validateField:M,setErrors:R,setFieldError:D,setFieldTouched:F,setFieldValue:z,setStatus:U,setSubmitting:$,setTouched:I,setValues:N,setFormikState:V,submitForm:G},Z=C9((function(){return d(w.values,Y)})),X=C9((function(e){e&&e.preventDefault&&o9(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&o9(e.stopPropagation)&&e.stopPropagation(),O()})),K=a.exports.useCallback((function(e){return{value:u9(w.values,e),error:u9(w.errors,e),touched:!!u9(w.touched,e),initialValue:u9(p.current,e),initialTouched:!!u9(m.current,e),initialError:u9(g.current,e)}}),[w.errors,w.touched,w.values]),Q=a.exports.useCallback((function(e){return{setValue:function(t,n){return z(e,t,n)},setTouched:function(t,n){return F(e,t,n)},setError:function(t){return D(e,t)}}}),[z,F,D]),J=a.exports.useCallback((function(e){var t=i9(e),n=t?e.name:e,r=u9(w.values,n),o={name:n,value:r,onChange:j,onBlur:W};if(t){var i=e.type,a=e.value,s=e.as,l=e.multiple;"checkbox"===i?void 0===a?o.checked=!!r:(o.checked=!(!Array.isArray(r)||!~r.indexOf(a)),o.value=a):"radio"===i?(o.checked=r===a,o.value=a):"select"===s&&l&&(o.value=o.value||[],o.multiple=!0)}return o}),[W,j,w.values]),ee=a.exports.useMemo((function(){return!r4(p.current,w.values)}),[p.current,w.values]),te=a.exports.useMemo((function(){return void 0!==l?ee?w.errors&&0===Object.keys(w.errors).length:!1!==l&&o9(l)?l(f):l:w.errors&&0===Object.keys(w.errors).length}),[l,ee,w.errors,f]);return e9({},w,{initialValues:p.current,initialErrors:g.current,initialTouched:m.current,initialStatus:v.current,handleBlur:W,handleChange:j,handleReset:X,handleSubmit:q,resetForm:O,setErrors:R,setFormikState:V,setFieldTouched:F,setFieldValue:z,setFieldError:D,setStatus:U,setSubmitting:$,setTouched:I,setValues:N,submitForm:G,validateForm:P,validateField:M,isValid:te,dirty:ee,unregisterField:A,registerField:T,getFieldProps:J,getFieldMeta:K,getFieldHelpers:Q,validateOnBlur:o,validateOnChange:n,validateOnMount:s})}function x9(e){var t=b9(e),n=e.component,r=e.children,o=e.render,i=e.innerRef;return a.exports.useImperativeHandle(i,(function(){return t})),a.exports.createElement(p9,{value:t},n?a.exports.createElement(n,t):o?o(t):r?o9(r)?r(t):l9(r)?null:a.exports.Children.only(r):null)}function w9(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);!0===Array.isArray(e[r])?t[r]=e[r].map((function(e){return!0===Array.isArray(e)||O4(e)?w9(e):""!==e?e:void 0})):O4(e[r])?t[r]=w9(e[r]):t[r]=""!==e[r]?e[r]:void 0}return t}function k9(e,t,n){var r=e.slice();return t.forEach((function(t,o){if(void 0===r[o]){var i=!1!==n.clone&&n.isMergeableObject(t);r[o]=i?c4(Array.isArray(t)?[]:{},t,n):t}else n.isMergeableObject(t)?r[o]=c4(e[o],t,n):-1===e.indexOf(t)&&r.push(t)})),r}var S9="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?a.exports.useLayoutEffect:a.exports.useEffect;function C9(e){var t=a.exports.useRef(e);return S9((function(){t.current=e})),a.exports.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;re?t:e}),0);return Array.from(e9({},e,{length:t+1}))}return[]},P9=function(e){var t,n;function r(t){var n;return(n=e.call(this,t)||this).updateArrayField=function(e,t,r){var o=n.props,i=o.name;(0,o.formik.setFormikState)((function(n){var o="function"==typeof r?r:e,a="function"==typeof t?t:e,s=d9(n.values,i,e(u9(n.values,i))),l=r?o(u9(n.errors,i)):void 0,c=t?a(u9(n.touched,i)):void 0;return r9(l)&&(l=void 0),r9(c)&&(c=void 0),e9({},n,{values:s,errors:r?d9(n.errors,i,l):n.errors,touched:t?d9(n.touched,i,c):n.touched})}))},n.push=function(e){return n.updateArrayField((function(t){return[].concat(L9(t),[J7(e)])}),!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=L9(e),o=r[t];return r[t]=r[n],r[n]=o,r}(n,e,t)}),!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=L9(e),o=r[t];return r.splice(t,1),r.splice(n,0,o),r}(n,e,t)}),!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField((function(n){return E9(n,e,t)}),(function(t){return E9(t,e,null)}),(function(t){return E9(t,e,null)}))},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=L9(e);return r[t]=n,r}(n,e,t)}),!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField((function(n){var r=n?[e].concat(n):[e];return t<0&&(t=r.length),r}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n})),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(n9(n)),n.pop=n.pop.bind(n9(n)),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=r.prototype;return o.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!r4(u9(e.formik.values,e.name),u9(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},o.remove=function(e){var t;return this.updateArrayField((function(n){var r=n?L9(n):[];return t||(t=r[e]),o9(r.splice)&&r.splice(e,1),r}),!0,!0),t},o.pop=function(){var e;return this.updateArrayField((function(t){var n=t;return e||(e=n&&n.pop&&n.pop()),n}),!0,!0),e},o.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},t=this.props,n=t.component,r=t.render,o=t.children,i=t.name,s=e9({},e,{form:t9(t.formik,["validate","validationSchema"]),name:i});return n?a.exports.createElement(n,s):r?r(s):o?"function"==typeof o?o(s):l9(o)?null:a.exports.Children.only(o):null},r}(a.exports.Component);function O9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21 11H6.414l5.293-5.293-1.414-1.414L2.586 12l7.707 7.707 1.414-1.414L6.414 13H21z"}}]})(e)}function M9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19.002 3h-14c-1.103 0-2 .897-2 2v4h2V5h14v14h-14v-4h-2v4c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.898-2-2-2z"}},{tag:"path",attr:{d:"m11 16 5-4-5-4v3.001H3v2h8z"}}]})(e)}function T9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}function A9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6.758 8.758 5.344 7.344a8.048 8.048 0 0 0-1.841 2.859l1.873.701a6.048 6.048 0 0 1 1.382-2.146zM19 12.999a7.935 7.935 0 0 0-2.344-5.655A7.917 7.917 0 0 0 12 5.069V2L7 6l5 4V7.089a5.944 5.944 0 0 1 3.242 1.669A5.956 5.956 0 0 1 17 13v.002c0 .33-.033.655-.086.977-.007.043-.011.088-.019.131a6.053 6.053 0 0 1-1.138 2.536c-.16.209-.331.412-.516.597a5.954 5.954 0 0 1-.728.613 5.906 5.906 0 0 1-2.277 1.015c-.142.03-.285.05-.43.069-.062.009-.122.021-.184.027a6.104 6.104 0 0 1-1.898-.103L9.3 20.819a8.087 8.087 0 0 0 2.534.136c.069-.007.138-.021.207-.03.205-.026.409-.056.61-.098l.053-.009-.001-.005a7.877 7.877 0 0 0 2.136-.795l.001.001.028-.019a7.906 7.906 0 0 0 1.01-.67c.27-.209.532-.43.777-.675.248-.247.47-.513.681-.785.021-.028.049-.053.07-.081l-.006-.004a7.899 7.899 0 0 0 1.093-1.997l.008.003c.029-.078.05-.158.076-.237.037-.11.075-.221.107-.333.04-.14.073-.281.105-.423.022-.099.048-.195.066-.295.032-.171.056-.344.076-.516.01-.076.023-.15.03-.227.023-.249.037-.5.037-.753.002-.002.002-.004.002-.008zM6.197 16.597l-1.6 1.201a8.045 8.045 0 0 0 2.569 2.225l.961-1.754a6.018 6.018 0 0 1-1.93-1.672zM5 13c0-.145.005-.287.015-.429l-1.994-.143a7.977 7.977 0 0 0 .483 3.372l1.873-.701A5.975 5.975 0 0 1 5 13z"}}]})(e)}function I9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.242 17.242a6.04 6.04 0 0 1-1.37 1.027l.961 1.754a8.068 8.068 0 0 0 2.569-2.225l-1.6-1.201a5.938 5.938 0 0 1-.56.645zm1.743-4.671a5.975 5.975 0 0 1-.362 2.528l1.873.701a7.977 7.977 0 0 0 .483-3.371l-1.994.142zm1.512-2.368a8.048 8.048 0 0 0-1.841-2.859l-1.414 1.414a6.071 6.071 0 0 1 1.382 2.146l1.873-.701zm-8.128 8.763c-.047-.005-.094-.015-.141-.021a6.701 6.701 0 0 1-.468-.075 5.923 5.923 0 0 1-2.421-1.122 5.954 5.954 0 0 1-.583-.506 6.138 6.138 0 0 1-.516-.597 5.91 5.91 0 0 1-.891-1.634 6.086 6.086 0 0 1-.247-.902c-.008-.043-.012-.088-.019-.131A6.332 6.332 0 0 1 6 13.002V13c0-1.603.624-3.109 1.758-4.242A5.944 5.944 0 0 1 11 7.089V10l5-4-5-4v3.069a7.917 7.917 0 0 0-4.656 2.275A7.936 7.936 0 0 0 4 12.999v.009c0 .253.014.504.037.753.007.076.021.15.03.227.021.172.044.345.076.516.019.1.044.196.066.295.032.142.065.283.105.423.032.112.07.223.107.333.026.079.047.159.076.237l.008-.003A7.948 7.948 0 0 0 5.6 17.785l-.007.005c.021.028.049.053.07.081.211.272.433.538.681.785a8.236 8.236 0 0 0 .966.816c.265.192.537.372.821.529l.028.019.001-.001a7.877 7.877 0 0 0 2.136.795l-.001.005.053.009c.201.042.405.071.61.098.069.009.138.023.207.03a8.038 8.038 0 0 0 2.532-.137l-.424-1.955a6.11 6.11 0 0 1-1.904.102z"}}]})(e)}function R9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M11 6H9v3H6v2h3v3h2v-3h3V9h-3z"}},{tag:"path",attr:{d:"M10 2c-4.411 0-8 3.589-8 8s3.589 8 8 8a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8zm0 14c-3.309 0-6-2.691-6-6s2.691-6 6-6 6 2.691 6 6-2.691 6-6 6z"}}]})(e)}function N9(e){return E5({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6 9h8v2H6z"}},{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"}}]})(e)}P9.defaultProps={validateOnChange:!0};const D9=uV([M3],(e=>{const{model_list:t}=e,n=[];return A$.forEach(t,(e=>{n.push(e.weights)})),n}));function z9(){const{t:e}=HY();return ld(mI,{position:"absolute",zIndex:2,right:4,top:4,fontSize:"0.7rem",fontWeight:"bold",backgroundColor:"var(--accent-color)",padding:"0.2rem 0.5rem",borderRadius:"0.2rem",alignItems:"center",children:e("modelmanager:modelExists")})}function B9({model:e,modelsToAdd:t,setModelsToAdd:n}){const r=y5(D9);return cd(mI,{position:"relative",children:[r.includes(e.location)?ld(z9,{}):null,ld(U3,{value:e.name,label:ld(sd,{children:cd(WI,{alignItems:"start",children:[ld("p",{style:{fontWeight:"bold"},children:e.name}),ld("p",{style:{fontStyle:"italic"},children:e.location})]})}),isChecked:t.includes(e.name),isDisabled:r.includes(e.location),onChange:e=>{t.includes(e.target.value)?n(A$.remove(t,(t=>t!==e.target.value))):n([...t,e.target.value])},padding:"1rem",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",_checked:{backgroundColor:"var(--accent-color)",color:"var(--text-color)"},_disabled:{backgroundColor:"var(--background-color-secondary)"}})]})}function j9(){const e=v5(),{t:t}=HY(),n=y5((e=>e.system.searchFolder)),r=y5((e=>e.system.foundModels)),o=y5(D9),i=y5((e=>e.options.shouldShowExistingModelsInSearch)),a=y5((e=>e.system.isProcessing)),[s,l]=H.useState([]);return cd(sd,{children:[n?cd(CI,{flexDirection:"column",padding:"1rem",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",rowGap:"0.5rem",position:"relative",children:[ld("p",{style:{fontWeight:"bold",fontSize:"0.8rem",backgroundColor:"var(--background-color-secondary)",padding:"0.2rem 1rem",width:"max-content",borderRadius:"0.2rem"},children:t("modelmanager:checkpointFolder")}),ld("p",{style:{fontWeight:"bold",fontSize:"0.8rem",maxWidth:"80%"},children:n}),ld(S3,{"aria-label":t("modelmanager:scanAgain"),tooltip:t("modelmanager:scanAgain"),icon:ld(T9,{}),position:"absolute",right:16,fontSize:18,disabled:a,onClick:()=>e(OQ(n))}),ld(S3,{"aria-label":t("modelmanager:clearCheckpointFolder"),icon:ld(s3,{style:{transform:"rotate(45deg)"}}),position:"absolute",right:5,onClick:()=>{e(fZ(null)),e(pZ(null)),l([])}})]}):ld(x9,{initialValues:{checkpointFolder:""},onSubmit:t=>{(t=>{e(OQ(t.checkpointFolder))})(t)},children:({handleSubmit:e})=>ld("form",{onSubmit:e,children:cd(HI,{columnGap:"0.5rem",children:[ld(GT,{isRequired:!0,width:"max-content",children:ld(_9,{as:V3,id:"checkpointFolder",name:"checkpointFolder",type:"text",width:"lg",size:"md",label:t("modelmanager:checkpointFolder")})}),ld(S3,{icon:ld($3,{}),"aria-label":t("modelmanager:findModels"),tooltip:t("modelmanager:findModels"),type:"submit",disabled:a})]})})}),r&&cd(CI,{flexDirection:"column",rowGap:"1rem",children:[cd(CI,{justifyContent:"space-between",alignItems:"center",children:[cd("p",{children:[t("modelmanager:modelsFound"),": ",r.length]}),cd("p",{children:[t("modelmanager:selected"),": ",s.length]})]}),cd(CI,{columnGap:"0.5rem",justifyContent:"space-between",children:[cd(CI,{columnGap:"0.5rem",children:[ld(j3,{isDisabled:s.length===r.length,onClick:()=>{l([]),r&&r.forEach((e=>{o.includes(e.location)||l((t=>[...t,e.name]))}))},children:t("modelmanager:selectAll")}),ld(j3,{isDisabled:0===s.length,onClick:()=>{l([])},children:t("modelmanager:deselectAll")}),ld(U3,{label:t("modelmanager:showExisting"),isChecked:i,onChange:()=>e(P$(!i))})]}),ld(j3,{isDisabled:0===s.length,onClick:()=>{const t=r?.filter((e=>s.includes(e.name)));t?.forEach((t=>{const n={name:t.name,description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:t.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(MQ(n))})),l([])},backgroundColor:s.length>0?"var(--accent-color) !important":"",children:t("modelmanager:addSelected")})]}),cd(CI,{rowGap:"1rem",flexDirection:"column",maxHeight:"18rem",overflowY:"scroll",paddingRight:"1rem",paddingLeft:"0.2rem",borderRadius:"0.2rem",children:[r.length>0?0===s.length&&ld(VI,{fontWeight:"bold",fontSize:14,padding:"0.5rem",borderRadius:"0.2rem",margin:"0 0.5rem 0 1rem",textAlign:"center",backgroundColor:"var(--notice-color)",boxShadow:"0 0 200px 6px var(--notice-color)",marginTop:"1rem",width:"max-content",children:t("modelmanager:selectAndAdd")}):ld(VI,{fontWeight:"bold",fontSize:14,padding:"0.5rem",borderRadius:"0.2rem",textAlign:"center",backgroundColor:"var(--status-bad-color)",children:t("modelmanager:noModelsFound")}),(()=>{const e=[],t=[];return r&&r.forEach(((n,r)=>{o.includes(n.location)?t.push(ld(B9,{model:n,modelsToAdd:s,setModelsToAdd:l},r)):e.push(ld(B9,{model:n,modelsToAdd:s,setModelsToAdd:l},r))})),cd(sd,{children:[e,i&&t]})})()]})]})]})}function F9(){const e=v5(),{t:t}=HY(),n=y5((e=>e.system.isProcessing));function r(e){let n;return function(e){return/\s/.test(e)}(e)&&(n=t("modelmanager:cannotUseSpaces")),n}const[o,i]=H.useState(!1);return cd(sd,{children:[ld(S3,{"aria-label":t("common:back"),tooltip:t("common:back"),onClick:()=>e(O$(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",right:12,top:3,icon:ld(O9,{})}),ld(j9,{}),ld(U3,{label:t("modelmanager:addManually"),isChecked:o,onChange:()=>i(!o)}),o&&ld(x9,{initialValues:{name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},onSubmit:t=>{e(MQ(t)),e(O$(null))},children:({handleSubmit:e,errors:o,touched:i})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",children:[ld(VI,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelmanager:manual")}),cd(GT,{isInvalid:!!o.name&&i.name,isRequired:!0,children:[ld(eA,{htmlFor:"name",fontSize:"sm",children:t("modelmanager:name")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"name",name:"name",type:"text",validate:r,width:"2xl"}),o.name&&i.name?ld(QT,{children:o.name}):ld(qT,{margin:0,children:t("modelmanager:nameValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.description&&i.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:t("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"2xl"}),o.description&&i.description?ld(QT,{children:o.description}):ld(qT,{margin:0,children:t("modelmanager:descriptionValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.config&&i.config,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:t("modelmanager:config")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"config",name:"config",type:"text",width:"2xl"}),o.config&&i.config?ld(QT,{children:o.config}):ld(qT,{margin:0,children:t("modelmanager:configValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.weights&&i.weights,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:t("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"weights",name:"weights",type:"text",width:"2xl"}),o.weights&&i.weights?ld(QT,{children:o.weights}):ld(qT,{margin:0,children:t("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.vae&&i.vae,children:[ld(eA,{htmlFor:"vae",fontSize:"sm",children:t("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae",name:"vae",type:"text",width:"2xl"}),o.vae&&i.vae?ld(QT,{children:o.vae}):ld(qT,{margin:0,children:t("modelmanager:vaeLocationValidationMsg")})]})]}),cd(HI,{width:"100%",children:[cd(GT,{isInvalid:!!o.width&&i.width,children:[ld(eA,{htmlFor:"width",fontSize:"sm",children:t("modelmanager:width")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"width",name:"width",children:({field:e,form:t})=>ld(O3,{id:"width",name:"width",min:64,max:2048,step:64,width:"90%",value:t.values.width,onChange:n=>t.setFieldValue(e.name,Number(n))})}),o.width&&i.width?ld(QT,{children:o.width}):ld(qT,{margin:0,children:t("modelmanager:widthValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.height&&i.height,children:[ld(eA,{htmlFor:"height",fontSize:"sm",children:t("modelmanager:height")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"height",name:"height",children:({field:e,form:t})=>ld(O3,{id:"height",name:"height",min:64,max:2048,width:"90%",step:64,value:t.values.height,onChange:n=>t.setFieldValue(e.name,Number(n))})}),o.height&&i.height?ld(QT,{children:o.height}):ld(qT,{margin:0,children:t("modelmanager:heightValidationMsg")})]})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelmanager:addModel")})]})})})]})}function H9({children:e}){return ld(CI,{flexDirection:"column",backgroundColor:"var(--background-color)",padding:"1rem 1rem",borderRadius:"0.5rem",rowGap:"1rem",width:"100%",children:e})}function W9(){const e=v5(),{t:t}=HY(),n=y5((e=>e.system.isProcessing));function r(e){let n;return function(e){return/\s/.test(e)}(e)&&(n=t("modelmanager:cannotUseSpaces")),n}return cd(CI,{children:[ld(S3,{"aria-label":t("common:back"),tooltip:t("common:back"),onClick:()=>e(O$(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",right:12,top:3,icon:ld(O9,{})}),ld(x9,{initialValues:{name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},onSubmit:t=>{const n=t;""===t.path&&(n.path=void 0),""===t.repo_id&&(n.repo_id=void 0),""===t.vae.path&&(void 0===t.path?n.vae.path=void 0:n.vae.path=t.path+"/vae"),""===t.vae.repo_id&&(n.vae.repo_id=void 0),e(MQ(n)),e(O$(null))},children:({handleSubmit:e,errors:o,touched:i})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",children:[ld(H9,{children:cd(GT,{isInvalid:!!o.name&&i.name,isRequired:!0,children:[ld(eA,{htmlFor:"name",fontSize:"sm",children:t("modelmanager:name")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"name",name:"name",type:"text",validate:r,width:"2xl",isRequired:!0}),o.name&&i.name?ld(QT,{children:o.name}):ld(qT,{margin:0,children:t("modelmanager:nameValidationMsg")})]})]})}),ld(H9,{children:cd(GT,{isInvalid:!!o.description&&i.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:t("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),o.description&&i.description?ld(QT,{children:o.description}):ld(qT,{margin:0,children:t("modelmanager:descriptionValidationMsg")})]})]})}),cd(H9,{children:[ld(VI,{fontWeight:"bold",fontSize:"sm",children:t("modelmanager:formMessageDiffusersModelLocation")}),ld(VI,{fontSize:"sm",fontStyle:"italic",color:"var(--text-color-secondary)",children:t("modelmanager:formMessageDiffusersModelLocationDesc")}),cd(GT,{isInvalid:!!o.path&&i.path,children:[ld(eA,{htmlFor:"path",fontSize:"sm",children:t("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"path",name:"path",type:"text",width:"2xl"}),o.path&&i.path?ld(QT,{children:o.path}):ld(qT,{margin:0,children:t("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.repo_id&&i.repo_id,children:[ld(eA,{htmlFor:"repo_id",fontSize:"sm",children:t("modelmanager:repo_id")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),o.repo_id&&i.repo_id?ld(QT,{children:o.repo_id}):ld(qT,{margin:0,children:t("modelmanager:repoIDValidationMsg")})]})]})]}),cd(H9,{children:[ld(VI,{fontWeight:"bold",children:t("modelmanager:formMessageDiffusersVAELocation")}),ld(VI,{fontSize:"sm",fontStyle:"italic",color:"var(--text-color-secondary)",children:t("modelmanager:formMessageDiffusersVAELocationDesc")}),cd(GT,{isInvalid:!!o.vae?.path&&i.vae?.path,children:[ld(eA,{htmlFor:"vae.path",fontSize:"sm",children:t("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),o.vae?.path&&i.vae?.path?ld(QT,{children:o.vae?.path}):ld(qT,{margin:0,children:t("modelmanager:vaeLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!o.vae?.repo_id&&i.vae?.repo_id,children:[ld(eA,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelmanager:vaeRepoID")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),o.vae?.repo_id&&i.vae?.repo_id?ld(QT,{children:o.vae?.repo_id}):ld(qT,{margin:0,children:t("modelmanager:vaeRepoIDValidationMsg")})]})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelmanager:addModel")})]})})})]})}function V9({text:e,onClick:t}){return ld(CI,{position:"relative",width:"50%",height:"200px",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",justifyContent:"center",alignItems:"center",_hover:{cursor:"pointer",backgroundColor:"var(--accent-color)"},onClick:t,children:ld(VI,{fontWeight:"bold",children:e})})}function U9(){const{isOpen:e,onOpen:t,onClose:n}=QA(),r=y5((e=>e.options.addNewModelUIOption)),o=v5(),{t:i}=HY();return cd(sd,{children:[ld(j3,{"aria-label":i("modelmanager:addNewModel"),tooltip:i("modelmanager:addNewModel"),onClick:t,className:"modal-close-btn",size:"sm",children:cd(CI,{columnGap:"0.5rem",alignItems:"center",children:[ld(s3,{}),i("modelmanager:addNew")]})}),cd(RB,{isOpen:e,onClose:()=>{n(),o(O$(null))},size:"3xl",closeOnOverlayClick:!1,children:[ld(GB,{}),cd(WB,{className:"modal add-model-modal",fontFamily:"Inter",children:[ld(UB,{children:i("modelmanager:addNewModel")}),ld(DB,{marginTop:"0.3rem"}),cd(NB,{className:"add-model-modal-body",children:[null==r&&cd(CI,{columnGap:"1rem",children:[ld(V9,{text:i("modelmanager:addCheckpointModel"),onClick:()=>o(O$("ckpt"))}),ld(V9,{text:i("modelmanager:addDiffuserModel"),onClick:()=>o(O$("diffusers"))})]}),"ckpt"==r&&ld(F9,{}),"diffusers"==r&&ld(W9,{})]})]})]})]})}Sk({d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",displayName:"CopyIcon"}),Sk({d:"M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z",displayName:"SearchIcon"}),Sk({d:"M23.414,20.591l-4.645-4.645a10.256,10.256,0,1,0-2.828,2.829l4.645,4.644a2.025,2.025,0,0,0,2.828,0A2,2,0,0,0,23.414,20.591ZM10.25,3.005A7.25,7.25,0,1,1,3,10.255,7.258,7.258,0,0,1,10.25,3.005Z",displayName:"Search2Icon"}),Sk({d:"M21.4,13.7C20.6,13.9,19.8,14,19,14c-5,0-9-4-9-9c0-0.8,0.1-1.6,0.3-2.4c0.1-0.3,0-0.7-0.3-1 c-0.3-0.3-0.6-0.4-1-0.3C4.3,2.7,1,7.1,1,12c0,6.1,4.9,11,11,11c4.9,0,9.3-3.3,10.6-8.1c0.1-0.3,0-0.7-0.3-1 C22.1,13.7,21.7,13.6,21.4,13.7z",displayName:"MoonIcon"}),Sk({displayName:"SunIcon",path:cd("g",{strokeLinejoin:"round",strokeLinecap:"round",strokeWidth:"2",fill:"none",stroke:"currentColor",children:[ld("circle",{cx:"12",cy:"12",r:"5"}),ld("path",{d:"M12 1v2"}),ld("path",{d:"M12 21v2"}),ld("path",{d:"M4.22 4.22l1.42 1.42"}),ld("path",{d:"M18.36 18.36l1.42 1.42"}),ld("path",{d:"M1 12h2"}),ld("path",{d:"M21 12h2"}),ld("path",{d:"M4.22 19.78l1.42-1.42"}),ld("path",{d:"M18.36 5.64l1.42-1.42"})]})}),Sk({d:"M0,12a1.5,1.5,0,0,0,1.5,1.5h8.75a.25.25,0,0,1,.25.25V22.5a1.5,1.5,0,0,0,3,0V13.75a.25.25,0,0,1,.25-.25H22.5a1.5,1.5,0,0,0,0-3H13.75a.25.25,0,0,1-.25-.25V1.5a1.5,1.5,0,0,0-3,0v8.75a.25.25,0,0,1-.25.25H1.5A1.5,1.5,0,0,0,0,12Z",displayName:"AddIcon"}),Sk({displayName:"SmallAddIcon",viewBox:"0 0 20 20",path:ld("path",{fill:"currentColor",d:"M14 9h-3V6c0-.55-.45-1-1-1s-1 .45-1 1v3H6c-.55 0-1 .45-1 1s.45 1 1 1h3v3c0 .55.45 1 1 1s1-.45 1-1v-3h3c.55 0 1-.45 1-1s-.45-1-1-1z",fillRule:"evenodd"})}),Sk({viewBox:"0 0 14 14",d:"M14,7.77 L14,6.17 L12.06,5.53 L11.61,4.44 L12.49,2.6 L11.36,1.47 L9.55,2.38 L8.46,1.93 L7.77,0.01 L6.17,0.01 L5.54,1.95 L4.43,2.4 L2.59,1.52 L1.46,2.65 L2.37,4.46 L1.92,5.55 L0,6.23 L0,7.82 L1.94,8.46 L2.39,9.55 L1.51,11.39 L2.64,12.52 L4.45,11.61 L5.54,12.06 L6.23,13.98 L7.82,13.98 L8.45,12.04 L9.56,11.59 L11.4,12.47 L12.53,11.34 L11.61,9.53 L12.08,8.44 L14,7.75 L14,7.77 Z M7,10 C5.34,10 4,8.66 4,7 C4,5.34 5.34,4 7,4 C8.66,4 10,5.34 10,7 C10,8.66 8.66,10 7,10 Z",displayName:"SettingsIcon"}),Sk({displayName:"CheckCircleIcon",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"}),Sk({d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-9.5,6a2,2,0,1,1,3,1.723V19.5a1,1,0,0,1-2,0V17.223A1.994,1.994,0,0,1,10,15.5ZM7.75,6.75a4.25,4.25,0,0,1,8.5,0V9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5Z",displayName:"LockIcon"}),Sk({d:"M19.5,9.5h-.75V6.75A6.751,6.751,0,0,0,5.533,4.811a1.25,1.25,0,1,0,2.395.717A4.251,4.251,0,0,1,16.25,6.75V9a.5.5,0,0,1-.5.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-9.5,6a2,2,0,1,1,3,1.723V19.5a1,1,0,0,1-2,0V17.223A1.994,1.994,0,0,1,10,15.5Z",displayName:"UnlockIcon"}),Sk({displayName:"ViewIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M23.432,10.524C20.787,7.614,16.4,4.538,12,4.6,7.6,4.537,3.213,7.615.568,10.524a2.211,2.211,0,0,0,0,2.948C3.182,16.351,7.507,19.4,11.839,19.4h.308c4.347,0,8.671-3.049,11.288-5.929A2.21,2.21,0,0,0,23.432,10.524ZM7.4,12A4.6,4.6,0,1,1,12,16.6,4.6,4.6,0,0,1,7.4,12Z"}),ld("circle",{cx:"12",cy:"12",r:"2"})]})}),Sk({displayName:"ViewOffIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M23.2,10.549a20.954,20.954,0,0,0-4.3-3.6l4-3.995a1,1,0,1,0-1.414-1.414l-.018.018a.737.737,0,0,1-.173.291l-19.5,19.5c-.008.007-.018.009-.026.017a1,1,0,0,0,1.631,1.088l4.146-4.146a11.26,11.26,0,0,0,4.31.939h.3c4.256,0,8.489-2.984,11.051-5.8A2.171,2.171,0,0,0,23.2,10.549ZM16.313,13.27a4.581,4.581,0,0,1-3,3.028,4.3,4.3,0,0,1-3.1-.19.253.253,0,0,1-.068-.407l5.56-5.559a.252.252,0,0,1,.407.067A4.3,4.3,0,0,1,16.313,13.27Z"}),ld("path",{d:"M7.615,13.4a.244.244,0,0,0,.061-.24A4.315,4.315,0,0,1,7.5,12,4.5,4.5,0,0,1,12,7.5a4.276,4.276,0,0,1,1.16.173.244.244,0,0,0,.24-.062l1.941-1.942a.254.254,0,0,0-.1-.421A10.413,10.413,0,0,0,12,4.75C7.7,4.692,3.4,7.7.813,10.549a2.15,2.15,0,0,0-.007,2.9,21.209,21.209,0,0,0,3.438,3.03.256.256,0,0,0,.326-.029Z"})]})}),Sk({d:"M11.2857,6.05714 L10.08571,4.85714 L7.85714,7.14786 L7.85714,1 L6.14286,1 L6.14286,7.14786 L3.91429,4.85714 L2.71429,6.05714 L7,10.42857 L11.2857,6.05714 Z M1,11.2857 L1,13 L13,13 L13,11.2857 L1,11.2857 Z",displayName:"DownloadIcon",viewBox:"0 0 14 14"});var $9=Sk({displayName:"DeleteIcon",path:ld("g",{fill:"currentColor",children:ld("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});Sk({displayName:"RepeatIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M10.319,4.936a7.239,7.239,0,0,1,7.1,2.252,1.25,1.25,0,1,0,1.872-1.657A9.737,9.737,0,0,0,9.743,2.5,10.269,10.269,0,0,0,2.378,9.61a.249.249,0,0,1-.271.178l-1.033-.13A.491.491,0,0,0,.6,9.877a.5.5,0,0,0-.019.526l2.476,4.342a.5.5,0,0,0,.373.248.43.43,0,0,0,.062,0,.5.5,0,0,0,.359-.152l3.477-3.593a.5.5,0,0,0-.3-.844L5.15,10.172a.25.25,0,0,1-.2-.333A7.7,7.7,0,0,1,10.319,4.936Z"}),ld("path",{d:"M23.406,14.1a.5.5,0,0,0,.015-.526l-2.5-4.329A.5.5,0,0,0,20.546,9a.489.489,0,0,0-.421.151l-3.456,3.614a.5.5,0,0,0,.3.842l1.848.221a.249.249,0,0,1,.183.117.253.253,0,0,1,.023.216,7.688,7.688,0,0,1-5.369,4.9,7.243,7.243,0,0,1-7.1-2.253,1.25,1.25,0,1,0-1.872,1.656,9.74,9.74,0,0,0,9.549,3.03,10.261,10.261,0,0,0,7.369-7.12.251.251,0,0,1,.27-.179l1.058.127a.422.422,0,0,0,.06,0A.5.5,0,0,0,23.406,14.1Z"})]})}),Sk({displayName:"RepeatClockIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M12.965,6a1,1,0,0,0-1,1v5.5a1,1,0,0,0,1,1h5a1,1,0,0,0,0-2h-3.75a.25.25,0,0,1-.25-.25V7A1,1,0,0,0,12.965,6Z"}),ld("path",{d:"M12.567,1.258A10.822,10.822,0,0,0,2.818,8.4a.25.25,0,0,1-.271.163L.858,8.309a.514.514,0,0,0-.485.213.5.5,0,0,0-.021.53l2.679,4.7a.5.5,0,0,0,.786.107l3.77-3.746a.5.5,0,0,0-.279-.85L5.593,9.007a.25.25,0,0,1-.192-.35,8.259,8.259,0,1,1,7.866,11.59,1.25,1.25,0,0,0,.045,2.5h.047a10.751,10.751,0,1,0-.792-21.487Z"})]})});var G9=Sk({displayName:"EditIcon",path:cd("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[ld("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),ld("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})});Sk({d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z",displayName:"ChevronLeftIcon"}),Sk({d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",displayName:"ChevronRightIcon"}),Sk({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}),Sk({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),Sk({d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",displayName:"ArrowBackIcon"}),Sk({d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",displayName:"ArrowForwardIcon"}),Sk({d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z",displayName:"ArrowUpIcon"}),Sk({viewBox:"0 0 16 16",d:"M11.891 9.992a1 1 0 1 1 1.416 1.415l-4.3 4.3a1 1 0 0 1-1.414 0l-4.3-4.3A1 1 0 0 1 4.71 9.992l3.59 3.591 3.591-3.591zm0-3.984L8.3 2.417 4.709 6.008a1 1 0 0 1-1.416-1.415l4.3-4.3a1 1 0 0 1 1.414 0l4.3 4.3a1 1 0 1 1-1.416 1.415z",displayName:"ArrowUpDownIcon"}),Sk({d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z",displayName:"ArrowDownIcon"});var q9=Sk({displayName:"ExternalLinkIcon",path:cd("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[ld("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),ld("path",{d:"M15 3h6v6"}),ld("path",{d:"M10 14L21 3"})]})});Sk({displayName:"LinkIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M10.458,18.374,7.721,21.11a2.853,2.853,0,0,1-3.942,0l-.892-.891a2.787,2.787,0,0,1,0-3.941l5.8-5.8a2.789,2.789,0,0,1,3.942,0l.893.892A1,1,0,0,0,14.94,9.952l-.893-.892a4.791,4.791,0,0,0-6.771,0l-5.8,5.8a4.787,4.787,0,0,0,0,6.77l.892.891a4.785,4.785,0,0,0,6.771,0l2.736-2.735a1,1,0,1,0-1.414-1.415Z"}),ld("path",{d:"M22.526,2.363l-.892-.892a4.8,4.8,0,0,0-6.77,0l-2.905,2.9a1,1,0,0,0,1.414,1.414l2.9-2.9a2.79,2.79,0,0,1,3.941,0l.893.893a2.786,2.786,0,0,1,0,3.942l-5.8,5.8a2.769,2.769,0,0,1-1.971.817h0a2.766,2.766,0,0,1-1.969-.816,1,1,0,1,0-1.415,1.412,4.751,4.751,0,0,0,3.384,1.4h0a4.752,4.752,0,0,0,3.385-1.4l5.8-5.8a4.786,4.786,0,0,0,0-6.771Z"})]})}),Sk({displayName:"PlusSquareIcon",path:cd("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[ld("rect",{height:"18",width:"18",rx:"2",ry:"2",x:"3",y:"3"}),ld("path",{d:"M12 8v8"}),ld("path",{d:"M8 12h8"})]})}),Sk({displayName:"CalendarIcon",viewBox:"0 0 14 14",d:"M10.8889,5.5 L3.11111,5.5 L3.11111,7.05556 L10.8889,7.05556 L10.8889,5.5 Z M12.4444,1.05556 L11.6667,1.05556 L11.6667,0 L10.1111,0 L10.1111,1.05556 L3.88889,1.05556 L3.88889,0 L2.33333,0 L2.33333,1.05556 L1.55556,1.05556 C0.692222,1.05556 0.00777777,1.75556 0.00777777,2.61111 L0,12.5 C0,13.3556 0.692222,14 1.55556,14 L12.4444,14 C13.3,14 14,13.3556 14,12.5 L14,2.61111 C14,1.75556 13.3,1.05556 12.4444,1.05556 Z M12.4444,12.5 L1.55556,12.5 L1.55556,3.94444 L12.4444,3.94444 L12.4444,12.5 Z M8.55556,8.61111 L3.11111,8.61111 L3.11111,10.1667 L8.55556,10.1667 L8.55556,8.61111 Z"}),Sk({d:"M0.913134,0.920639 C1.49851,0.331726 2.29348,0 3.12342,0 L10.8766,0 C11.7065,0 12.5015,0.331725 13.0869,0.920639 C13.6721,1.50939 14,2.30689 14,3.13746 L14,8.12943 C13.9962,8.51443 13.9059,8.97125 13.7629,9.32852 C13.6128,9.683 13.3552,10.0709 13.0869,10.3462 C12.813,10.6163 12.4265,10.8761 12.0734,11.0274 C11.7172,11.1716 11.2607,11.263 10.8766,11.2669 L10.1234,11.2669 L10.1234,12.5676 L10.1209,12.5676 C10.1204,12.793 10.0633,13.0791 9.97807,13.262 C9.8627,13.466 9.61158,13.7198 9.40818,13.8382 L9.40824,13.8383 C9.4077,13.8386 9.40716,13.8388 9.40661,13.8391 C9.40621,13.8393 9.4058,13.8396 9.40539,13.8398 L9.40535,13.8397 C9.22958,13.9254 8.94505,13.9951 8.75059,14 L8.74789,14 C8.35724,13.9963 7.98473,13.8383 7.71035,13.5617 L5.39553,11.2669 L3.12342,11.2669 C2.29348,11.2669 1.49851,10.9352 0.913134,10.3462 C0.644826,10.0709 0.387187,9.683 0.23711,9.32852 C0.0941235,8.97125 0.00379528,8.51443 0,8.12943 L0,3.13746 C0,2.30689 0.327915,1.50939 0.913134,0.920639 Z M3.12342,1.59494 C2.71959,1.59494 2.33133,1.75628 2.04431,2.04503 C1.75713,2.33395 1.59494,2.72681 1.59494,3.13746 L1.59494,8.12943 C1.59114,8.35901 1.62114,8.51076 1.71193,8.72129 C1.79563,8.9346 1.88065,9.06264 2.04431,9.22185 C2.33133,9.5106 2.71959,9.67195 3.12342,9.67195 L5.72383,9.67195 C5.93413,9.67195 6.13592,9.75502 6.28527,9.90308 L8.52848,12.1269 L8.52848,10.4694 C8.52848,10.029 8.88552,9.67195 9.32595,9.67195 L10.8766,9.67195 C11.1034,9.67583 11.2517,9.64614 11.4599,9.55518 C11.6712,9.47132 11.7976,9.38635 11.9557,9.22185 C12.1193,9.06264 12.2044,8.9346 12.2881,8.72129 C12.3789,8.51076 12.4089,8.35901 12.4051,8.12943 L12.4051,3.13746 C12.4051,2.72681 12.2429,2.33394 11.9557,2.04503 C11.6687,1.75628 11.2804,1.59494 10.8766,1.59494 L3.12342,1.59494 Z",displayName:"ChatIcon",viewBox:"0 0 14 14"}),Sk({displayName:"TimeIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm0,22A10,10,0,1,1,22,12,10.011,10.011,0,0,1,12,22Z"}),ld("path",{d:"M17.134,15.81,12.5,11.561V6.5a1,1,0,0,0-2,0V12a1,1,0,0,0,.324.738l4.959,4.545a1.01,1.01,0,0,0,1.413-.061A1,1,0,0,0,17.134,15.81Z"})]})}),Sk({displayName:"ArrowRightIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M13.584,12a2.643,2.643,0,0,1-.775,1.875L3.268,23.416a1.768,1.768,0,0,1-2.5-2.5l8.739-8.739a.25.25,0,0,0,0-.354L.768,3.084a1.768,1.768,0,0,1,2.5-2.5l9.541,9.541A2.643,2.643,0,0,1,13.584,12Z"}),ld("path",{d:"M23.75,12a2.643,2.643,0,0,1-.775,1.875l-9.541,9.541a1.768,1.768,0,0,1-2.5-2.5l8.739-8.739a.25.25,0,0,0,0-.354L10.934,3.084a1.768,1.768,0,0,1,2.5-2.5l9.541,9.541A2.643,2.643,0,0,1,23.75,12Z"})]})}),Sk({displayName:"ArrowLeftIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M10.416,12a2.643,2.643,0,0,1,.775-1.875L20.732.584a1.768,1.768,0,0,1,2.5,2.5l-8.739,8.739a.25.25,0,0,0,0,.354l8.739,8.739a1.768,1.768,0,0,1-2.5,2.5l-9.541-9.541A2.643,2.643,0,0,1,10.416,12Z"}),ld("path",{d:"M.25,12a2.643,2.643,0,0,1,.775-1.875L10.566.584a1.768,1.768,0,0,1,2.5,2.5L4.327,11.823a.25.25,0,0,0,0,.354l8.739,8.739a1.768,1.768,0,0,1-2.5,2.5L1.025,13.875A2.643,2.643,0,0,1,.25,12Z"})]})}),Sk({displayName:"AtSignIcon",d:"M12,.5A11.634,11.634,0,0,0,.262,12,11.634,11.634,0,0,0,12,23.5a11.836,11.836,0,0,0,6.624-2,1.25,1.25,0,1,0-1.393-2.076A9.34,9.34,0,0,1,12,21a9.132,9.132,0,0,1-9.238-9A9.132,9.132,0,0,1,12,3a9.132,9.132,0,0,1,9.238,9v.891a1.943,1.943,0,0,1-3.884,0V12A5.355,5.355,0,1,0,12,17.261a5.376,5.376,0,0,0,3.861-1.634,4.438,4.438,0,0,0,7.877-2.736V12A11.634,11.634,0,0,0,12,.5Zm0,14.261A2.763,2.763,0,1,1,14.854,12,2.812,2.812,0,0,1,12,14.761Z"}),Sk({displayName:"AttachmentIcon",d:"M21.843,3.455a6.961,6.961,0,0,0-9.846,0L1.619,13.832a5.128,5.128,0,0,0,7.252,7.252L17.3,12.653A3.293,3.293,0,1,0,12.646,8L7.457,13.184A1,1,0,1,0,8.871,14.6L14.06,9.409a1.294,1.294,0,0,1,1.829,1.83L7.457,19.67a3.128,3.128,0,0,1-4.424-4.424L13.411,4.869a4.962,4.962,0,1,1,7.018,7.018L12.646,19.67a1,1,0,1,0,1.414,1.414L21.843,13.3a6.96,6.96,0,0,0,0-9.846Z"}),Sk({displayName:"UpDownIcon",viewBox:"-1 -1 9 11",d:"M 3.5 0L 3.98809 -0.569442L 3.5 -0.987808L 3.01191 -0.569442L 3.5 0ZM 3.5 9L 3.01191 9.56944L 3.5 9.98781L 3.98809 9.56944L 3.5 9ZM 0.488094 3.56944L 3.98809 0.569442L 3.01191 -0.569442L -0.488094 2.43056L 0.488094 3.56944ZM 3.01191 0.569442L 6.51191 3.56944L 7.48809 2.43056L 3.98809 -0.569442L 3.01191 0.569442ZM -0.488094 6.56944L 3.01191 9.56944L 3.98809 8.43056L 0.488094 5.43056L -0.488094 6.56944ZM 3.98809 9.56944L 7.48809 6.56944L 6.51191 5.43056L 3.01191 8.43056L 3.98809 9.56944Z"}),Sk({d:"M23.555,8.729a1.505,1.505,0,0,0-1.406-.98H16.062a.5.5,0,0,1-.472-.334L13.405,1.222a1.5,1.5,0,0,0-2.81,0l-.005.016L8.41,7.415a.5.5,0,0,1-.471.334H1.85A1.5,1.5,0,0,0,.887,10.4l5.184,4.3a.5.5,0,0,1,.155.543L4.048,21.774a1.5,1.5,0,0,0,2.31,1.684l5.346-3.92a.5.5,0,0,1,.591,0l5.344,3.919a1.5,1.5,0,0,0,2.312-1.683l-2.178-6.535a.5.5,0,0,1,.155-.543l5.194-4.306A1.5,1.5,0,0,0,23.555,8.729Z",displayName:"StarIcon"}),Sk({displayName:"EmailIcon",path:cd("g",{fill:"currentColor",children:[ld("path",{d:"M11.114,14.556a1.252,1.252,0,0,0,1.768,0L22.568,4.87a.5.5,0,0,0-.281-.849A1.966,1.966,0,0,0,22,4H2a1.966,1.966,0,0,0-.289.021.5.5,0,0,0-.281.849Z"}),ld("path",{d:"M23.888,5.832a.182.182,0,0,0-.2.039l-6.2,6.2a.251.251,0,0,0,0,.354l5.043,5.043a.75.75,0,1,1-1.06,1.061l-5.043-5.043a.25.25,0,0,0-.354,0l-2.129,2.129a2.75,2.75,0,0,1-3.888,0L7.926,13.488a.251.251,0,0,0-.354,0L2.529,18.531a.75.75,0,0,1-1.06-1.061l5.043-5.043a.251.251,0,0,0,0-.354l-6.2-6.2a.18.18,0,0,0-.2-.039A.182.182,0,0,0,0,6V18a2,2,0,0,0,2,2H22a2,2,0,0,0,2-2V6A.181.181,0,0,0,23.888,5.832Z"})]})}),Sk({d:"M2.20731,0.0127209 C2.1105,-0.0066419 1.99432,-0.00664663 1.91687,0.032079 C0.871279,0.438698 0.212942,1.92964 0.0580392,2.95587 C-0.426031,6.28627 2.20731,9.17133 4.62766,11.0689 C6.77694,12.7534 10.9012,15.5223 13.3409,12.8503 C13.6507,12.5211 14.0186,12.037 13.9993,11.553 C13.9412,10.7397 13.186,10.1588 12.6051,9.71349 C12.1598,9.38432 11.2304,8.47427 10.6495,8.49363 C10.1267,8.51299 9.79754,9.05515 9.46837,9.38432 L8.88748,9.96521 C8.79067,10.062 7.55145,9.24878 7.41591,9.15197 C6.91248,8.8228 6.4284,8.45491 6.00242,8.04829 C5.57644,7.64167 5.18919,7.19632 4.86002,6.73161 C4.7632,6.59607 3.96933,5.41495 4.04678,5.31813 C4.04678,5.31813 4.72448,4.58234 4.91811,4.2919 C5.32473,3.67229 5.63453,3.18822 5.16982,2.45243 C4.99556,2.18135 4.78257,1.96836 4.55021,1.73601 C4.14359,1.34875 3.73698,0.942131 3.27227,0.612963 C3.02055,0.419335 2.59457,0.0708094 2.20731,0.0127209 Z",displayName:"PhoneIcon",viewBox:"0 0 14 14"}),Sk({viewBox:"0 0 10 10",d:"M3,2 C2.44771525,2 2,1.55228475 2,1 C2,0.44771525 2.44771525,0 3,0 C3.55228475,0 4,0.44771525 4,1 C4,1.55228475 3.55228475,2 3,2 Z M3,6 C2.44771525,6 2,5.55228475 2,5 C2,4.44771525 2.44771525,4 3,4 C3.55228475,4 4,4.44771525 4,5 C4,5.55228475 3.55228475,6 3,6 Z M3,10 C2.44771525,10 2,9.55228475 2,9 C2,8.44771525 2.44771525,8 3,8 C3.55228475,8 4,8.44771525 4,9 C4,9.55228475 3.55228475,10 3,10 Z M7,2 C6.44771525,2 6,1.55228475 6,1 C6,0.44771525 6.44771525,0 7,0 C7.55228475,0 8,0.44771525 8,1 C8,1.55228475 7.55228475,2 7,2 Z M7,6 C6.44771525,6 6,5.55228475 6,5 C6,4.44771525 6.44771525,4 7,4 C7.55228475,4 8,4.44771525 8,5 C8,5.55228475 7.55228475,6 7,6 Z M7,10 C6.44771525,10 6,9.55228475 6,9 C6,8.44771525 6.44771525,8 7,8 C7.55228475,8 8,8.44771525 8,9 C8,9.55228475 7.55228475,10 7,10 Z",displayName:"DragHandleIcon"}),Sk({displayName:"SpinnerIcon",path:cd(sd,{children:[ld("defs",{children:cd("linearGradient",{x1:"28.154%",y1:"63.74%",x2:"74.629%",y2:"17.783%",id:"a",children:[ld("stop",{stopColor:"currentColor",offset:"0%"}),ld("stop",{stopColor:"#fff",stopOpacity:"0",offset:"100%"})]})}),cd("g",{transform:"translate(2)",fill:"none",children:[ld("circle",{stroke:"url(#a)",strokeWidth:"4",cx:"10",cy:"12",r:"10"}),ld("path",{d:"M10 2C4.477 2 0 6.477 0 12",stroke:"currentColor",strokeWidth:"4"}),ld("rect",{fill:"currentColor",x:"8",width:"4",height:"4",rx:"8"})]})]})}),Sk({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),Sk({displayName:"SmallCloseIcon",viewBox:"0 0 16 16",path:ld("path",{d:"M9.41 8l2.29-2.29c.19-.18.3-.43.3-.71a1.003 1.003 0 0 0-1.71-.71L8 6.59l-2.29-2.3a1.003 1.003 0 0 0-1.42 1.42L6.59 8 4.3 10.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71L8 9.41l2.29 2.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71L9.41 8z",fillRule:"evenodd",fill:"currentColor"})}),Sk({d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z",displayName:"NotAllowedIcon"}),Sk({d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z",displayName:"TriangleDownIcon"}),Sk({d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z",displayName:"TriangleUpIcon"}),Sk({displayName:"InfoOutlineIcon",path:cd("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"2",children:[ld("circle",{cx:"12",cy:"12",fill:"none",r:"11",stroke:"currentColor"}),ld("line",{fill:"none",x1:"11.959",x2:"11.959",y1:"11",y2:"17"}),ld("circle",{cx:"11.959",cy:"7",r:"1",stroke:"none"})]})}),Sk({displayName:"BellIcon",d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"}),Sk({d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"}),Sk({d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm0,19a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,12,19Zm1.6-6.08a1,1,0,0,0-.6.917,1,1,0,1,1-2,0,3,3,0,0,1,1.8-2.75A2,2,0,1,0,10,9.255a1,1,0,1,1-2,0,4,4,0,1,1,5.6,3.666Z",displayName:"QuestionIcon"}),Sk({displayName:"QuestionOutlineIcon",path:cd("g",{stroke:"currentColor",strokeWidth:"1.5",children:[ld("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),ld("path",{fill:"none",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),ld("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]})}),Sk({d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z",displayName:"WarningIcon"}),Sk({displayName:"WarningTwoIcon",d:"M23.119,20,13.772,2.15h0a2,2,0,0,0-3.543,0L.881,20a2,2,0,0,0,1.772,2.928H21.347A2,2,0,0,0,23.119,20ZM11,8.423a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Zm1.05,11.51h-.028a1.528,1.528,0,0,1-1.522-1.47,1.476,1.476,0,0,1,1.448-1.53h.028A1.527,1.527,0,0,1,13.5,18.4,1.475,1.475,0,0,1,12.05,19.933Z"}),Sk({viewBox:"0 0 14 14",path:ld("g",{fill:"currentColor",children:ld("polygon",{points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})})}),Sk({displayName:"MinusIcon",path:ld("g",{fill:"currentColor",children:ld("rect",{height:"4",width:"20",x:"2",y:"10"})})}),Sk({displayName:"HamburgerIcon",viewBox:"0 0 24 24",d:"M 3 5 A 1.0001 1.0001 0 1 0 3 7 L 21 7 A 1.0001 1.0001 0 1 0 21 5 L 3 5 z M 3 11 A 1.0001 1.0001 0 1 0 3 13 L 21 13 A 1.0001 1.0001 0 1 0 21 11 L 3 11 z M 3 17 A 1.0001 1.0001 0 1 0 3 19 L 21 19 A 1.0001 1.0001 0 1 0 21 17 L 3 17 z"});const Y9=ok(((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:o="Cancel",cancelCallback:i,children:s,title:l,triggerComponent:c}=e,{isOpen:u,onOpen:d,onClose:h}=QA(),f=a.exports.useRef(null);return cd(sd,{children:[a.exports.cloneElement(c,{onClick:d,ref:t}),ld(qB,{isOpen:u,leastDestructiveRef:f,onClose:h,children:ld(GB,{children:cd(YB,{className:"modal",children:[ld(UB,{fontSize:"lg",fontWeight:"bold",children:l}),ld(NB,{children:s}),cd(VB,{children:[ld(RT,{ref:f,onClick:()=>{i&&i(),h()},className:"modal-close-btn",children:o}),ld(RT,{colorScheme:"red",onClick:()=>{r(),h()},ml:3,children:n})]})]})})})]})}));function Z9(e){const{isProcessing:t,isConnected:n}=y5((e=>e.system)),r=y5((e=>e.system.openModel)),{t:o}=HY(),i=v5(),{name:a,status:s,description:l}=e,c=()=>{i(gZ(a))};return cd(CI,{alignItems:"center",padding:"0.5rem 0.5rem",borderRadius:"0.2rem",backgroundColor:a===r?"var(--accent-color)":"",_hover:{backgroundColor:a===r?"var(--accent-color)":"var(--background-color)"},children:[ld(mI,{onClick:c,cursor:"pointer",children:ld(YH,{label:l,hasArrow:!0,placement:"bottom",children:ld(VI,{fontWeight:"bold",children:a})})}),ld(zI,{onClick:c,cursor:"pointer"}),cd(CI,{gap:2,alignItems:"center",children:[ld(VI,{color:(()=>{switch(s){case"active":return"var(--status-good-color)";case"cached":return"var(--status-working-color)";case"not loaded":return"var(--text-color-secondary)"}})(),children:s}),ld(RT,{size:"sm",onClick:()=>{i(AQ(a))},isDisabled:"active"===s||t||!n,className:"modal-close-btn",children:o("modelmanager:load")}),ld(S3,{icon:ld(G9,{}),size:"sm",onClick:c,"aria-label":"Modify Config",isDisabled:"active"===s||t||!n,className:" modal-close-btn"}),ld(Y9,{title:o("modelmanager:deleteModel"),acceptCallback:()=>{i(TQ(a)),i(gZ(null))},acceptButtonText:o("modelmanager:delete"),triggerComponent:ld(S3,{icon:ld($9,{}),size:"sm","aria-label":o("modelmanager:deleteConfig"),isDisabled:"active"===s||t||!n,className:" modal-close-btn",style:{backgroundColor:"var(--btn-delete-image)"}}),children:cd(CI,{rowGap:"1rem",flexDirection:"column",children:[ld("p",{style:{fontWeight:"bold"},children:o("modelmanager:deleteMsg1")}),ld("p",{style:{color:"var(--text-color-secondary"},children:o("modelmanager:deleteMsg2")})]})})]})]})}const X9=uV((e=>e.system),(e=>{const t=A$.map(e.model_list,((e,t)=>({name:t,...e})));return t}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function K9({label:e,isActive:t,onClick:n}){return ld(j3,{onClick:n,isActive:t,_active:{backgroundColor:"var(--accent-color)",_hover:{backgroundColor:"var(--accent-color)"}},size:"sm",children:e})}const Q9=()=>{const e=y5(X9),[t,n]=a.exports.useState(""),[r,o]=a.exports.useState("all"),[i,s]=a.exports.useTransition(),{t:l}=HY(),c=a.exports.useMemo((()=>{const n=[],o=[],i=[],a=[];return e.forEach(((e,s)=>{e.name.toLowerCase().includes(t.toLowerCase())&&(i.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s)),e.format===r&&a.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s))),"diffusers"!==e.format?n.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s)):o.push(ld(Z9,{name:e.name,status:e.status,description:e.description},s))})),""!==t?ld(mI,"all"===r?{marginTop:"1rem",children:i}:{marginTop:"1rem",children:a}):cd(CI,{flexDirection:"column",rowGap:"1.5rem",children:["all"===r&&cd(sd,{children:[cd(mI,{children:[ld(VI,{fontWeight:"bold",backgroundColor:"var(--background-color)",padding:"0.5rem 1rem",borderRadius:"0.5rem",margin:"1rem 0",width:"max-content",fontSize:"14",children:l("modelmanager:checkpointModels")}),n]}),cd(mI,{children:[ld(VI,{fontWeight:"bold",backgroundColor:"var(--background-color)",padding:"0.5rem 1rem",borderRadius:"0.5rem",marginBottom:"0.5rem",width:"max-content",fontSize:"14",children:l("modelmanager:diffusersModels")}),o]})]}),"ckpt"===r&&ld(CI,{flexDirection:"column",marginTop:"1rem",children:n}),"diffusers"===r&&ld(CI,{flexDirection:"column",marginTop:"1rem",children:o})]})}),[e,t,l,r]);return cd(CI,{flexDirection:"column",rowGap:"2rem",width:"50%",minWidth:"50%",children:[cd(CI,{justifyContent:"space-between",children:[ld(VI,{fontSize:"1.4rem",fontWeight:"bold",children:l("modelmanager:availableModels")}),ld(U9,{})]}),ld(V3,{onChange:e=>{s((()=>{n(e.target.value)}))},label:l("modelmanager:search")}),cd(CI,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-360,overflow:"scroll",paddingRight:"1rem",children:[cd(CI,{columnGap:"0.5rem",children:[ld(K9,{label:l("modelmanager:allModels"),onClick:()=>o("all"),isActive:"all"===r}),ld(K9,{label:l("modelmanager:checkpointModels"),onClick:()=>o("ckpt"),isActive:"ckpt"===r}),ld(K9,{label:l("modelmanager:diffusersModels"),onClick:()=>o("diffusers"),isActive:"diffusers"===r})]}),c]})]})},J9=uV([M3],(e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function e8(){const{openModel:e,model_list:t}=y5(J9),n=y5((e=>e.system.isProcessing)),r=v5(),{t:o}=HY(),[i,s]=a.exports.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});a.exports.useEffect((()=>{if(e){const n=A$.pickBy(t,((t,n)=>A$.isEqual(n,e)));s({name:e,description:n[e]?.description,path:n[e]?.path,repo_id:n[e]?.repo_id,vae:{repo_id:n[e]?.vae?.repo_id?n[e]?.vae?.repo_id:"",path:n[e]?.vae?.path?n[e]?.vae?.path:""},default:n[e]?.default,format:"diffusers"})}}),[t,e]);return e?cd(CI,{flexDirection:"column",rowGap:"1rem",width:"100%",children:[ld(CI,{alignItems:"center",children:ld(VI,{fontSize:"lg",fontWeight:"bold",children:e})}),ld(CI,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingRight:"2rem",children:ld(x9,{enableReinitialize:!0,initialValues:i,onSubmit:e=>{r(MQ(e))},children:({handleSubmit:e,errors:t,touched:r})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",alignItems:"start",children:[cd(GT,{isInvalid:!!t.description&&r.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:o("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"lg"}),t.description&&r.description?ld(QT,{children:t.description}):ld(qT,{margin:0,children:o("modelmanager:descriptionValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.path&&r.path,isRequired:!0,children:[ld(eA,{htmlFor:"path",fontSize:"sm",children:o("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"path",name:"path",type:"text",width:"lg"}),t.path&&r.path?ld(QT,{children:t.path}):ld(qT,{margin:0,children:o("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.repo_id&&r.repo_id,children:[ld(eA,{htmlFor:"repo_id",fontSize:"sm",children:o("modelmanager:repo_id")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"repo_id",name:"repo_id",type:"text",width:"lg"}),t.repo_id&&r.repo_id?ld(QT,{children:t.repo_id}):ld(qT,{margin:0,children:o("modelmanager:repoIDValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.vae?.path&&r.vae?.path,children:[ld(eA,{htmlFor:"vae.path",fontSize:"sm",children:o("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.path",name:"vae.path",type:"text",width:"lg"}),t.vae?.path&&r.vae?.path?ld(QT,{children:t.vae?.path}):ld(qT,{margin:0,children:o("modelmanager:vaeLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.vae?.repo_id&&r.vae?.repo_id,children:[ld(eA,{htmlFor:"vae.repo_id",fontSize:"sm",children:o("modelmanager:vaeRepoID")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"lg"}),t.vae?.repo_id&&r.vae?.repo_id?ld(QT,{children:t.vae?.repo_id}):ld(qT,{margin:0,children:o("modelmanager:vaeRepoIDValidationMsg")})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelmanager:updateModel")})]})})})})]}):ld(CI,{width:"100%",height:"250px",justifyContent:"center",alignItems:"center",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",children:ld(VI,{fontWeight:"bold",color:"var(--subtext-color-bright)",children:"Pick A Model To Edit"})})}const t8=uV([M3],(e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function n8(){const{openModel:e,model_list:t}=y5(t8),n=y5((e=>e.system.isProcessing)),r=v5(),{t:o}=HY(),[i,s]=a.exports.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});a.exports.useEffect((()=>{if(e){const n=A$.pickBy(t,((t,n)=>A$.isEqual(n,e)));s({name:e,description:n[e]?.description,config:n[e]?.config,weights:n[e]?.weights,vae:n[e]?.vae,width:n[e]?.width,height:n[e]?.height,default:n[e]?.default,format:"ckpt"})}}),[t,e]);return e?cd(CI,{flexDirection:"column",rowGap:"1rem",width:"100%",children:[ld(CI,{alignItems:"center",children:ld(VI,{fontSize:"lg",fontWeight:"bold",children:e})}),ld(CI,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingRight:"2rem",children:ld(x9,{enableReinitialize:!0,initialValues:i,onSubmit:e=>{r(MQ({...e,width:Number(e.width),height:Number(e.height)}))},children:({handleSubmit:e,errors:t,touched:r})=>ld("form",{onSubmit:e,children:cd(WI,{rowGap:"0.5rem",alignItems:"start",children:[cd(GT,{isInvalid:!!t.description&&r.description,isRequired:!0,children:[ld(eA,{htmlFor:"description",fontSize:"sm",children:o("modelmanager:description")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"description",name:"description",type:"text",width:"lg"}),t.description&&r.description?ld(QT,{children:t.description}):ld(qT,{margin:0,children:o("modelmanager:descriptionValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.config&&r.config,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:o("modelmanager:config")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"config",name:"config",type:"text",width:"lg"}),t.config&&r.config?ld(QT,{children:t.config}):ld(qT,{margin:0,children:o("modelmanager:configValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.weights&&r.weights,isRequired:!0,children:[ld(eA,{htmlFor:"config",fontSize:"sm",children:o("modelmanager:modelLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"weights",name:"weights",type:"text",width:"lg"}),t.weights&&r.weights?ld(QT,{children:t.weights}):ld(qT,{margin:0,children:o("modelmanager:modelLocationValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.vae&&r.vae,children:[ld(eA,{htmlFor:"vae",fontSize:"sm",children:o("modelmanager:vaeLocation")}),cd(WI,{alignItems:"start",children:[ld(_9,{as:V3,id:"vae",name:"vae",type:"text",width:"lg"}),t.vae&&r.vae?ld(QT,{children:t.vae}):ld(qT,{margin:0,children:o("modelmanager:vaeLocationValidationMsg")})]})]}),cd(HI,{width:"100%",children:[cd(GT,{isInvalid:!!t.width&&r.width,children:[ld(eA,{htmlFor:"width",fontSize:"sm",children:o("modelmanager:width")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"width",name:"width",children:({field:e,form:t})=>ld(O3,{id:"width",name:"width",min:64,max:2048,step:64,value:t.values.width,onChange:n=>t.setFieldValue(e.name,Number(n))})}),t.width&&r.width?ld(QT,{children:t.width}):ld(qT,{margin:0,children:o("modelmanager:widthValidationMsg")})]})]}),cd(GT,{isInvalid:!!t.height&&r.height,children:[ld(eA,{htmlFor:"height",fontSize:"sm",children:o("modelmanager:height")}),cd(WI,{alignItems:"start",children:[ld(_9,{id:"height",name:"height",children:({field:e,form:t})=>ld(O3,{id:"height",name:"height",min:64,max:2048,step:64,value:t.values.height,onChange:n=>t.setFieldValue(e.name,Number(n))})}),t.height&&r.height?ld(QT,{children:t.height}):ld(qT,{margin:0,children:o("modelmanager:heightValidationMsg")})]})]})]}),ld(j3,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelmanager:updateModel")})]})})})})]}):ld(CI,{width:"100%",height:"250px",justifyContent:"center",alignItems:"center",backgroundColor:"var(--background-color)",borderRadius:"0.5rem",children:ld(VI,{fontWeight:"bold",color:"var(--subtext-color-bright)",children:"Pick A Model To Edit"})})}function r8({children:e}){const{isOpen:t,onOpen:n,onClose:r}=QA(),o=y5((e=>e.system.model_list)),i=y5((e=>e.system.openModel)),{t:s}=HY();return cd(sd,{children:[a.exports.cloneElement(e,{onClick:n}),cd(RB,{isOpen:t,onClose:r,size:"6xl",children:[ld(GB,{}),cd(WB,{className:"modal",fontFamily:"Inter",children:[ld(DB,{className:"modal-close-btn"}),ld(UB,{fontWeight:"bold",children:s("modelmanager:modelManager")}),cd(CI,{padding:"0 1.5rem 1.5rem 1.5rem",width:"100%",columnGap:"2rem",children:[ld(Q9,{}),i&&"diffusers"===o[i].format?ld(e8,{}):ld(n8,{})]})]})]})]})}function o8(){const{t:e,i18n:t}=HY(),n={en:e("common:langEnglish"),ru:e("common:langRussian"),it:e("common:langItalian"),pt_br:e("common:langBrPortuguese"),de:e("common:langGerman"),pl:e("common:langPolish"),zh_cn:e("common:langSimplifiedChinese"),es:e("common:langSpanish"),ja:e("common:langJapanese")};return ld(B3,{trigger:"hover",triggerComponent:ld(S3,{"aria-label":e("common:languagePickerLabel"),tooltip:e("common:languagePickerLabel"),icon:ld(e3,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:ld(WI,{children:(()=>{const e=[];return Object.keys(n).forEach((r=>{e.push(ld(j3,{"data-selected":localStorage.getItem("i18nextLng")===r,onClick:()=>t.changeLanguage(r),className:"modal-close-btn lang-select-btn","aria-label":n[r],tooltip:n[r],size:"sm",minWidth:"200px",children:n[r]},r))})),e})()})})}const i8=()=>{const{t:e}=HY(),t=y5((e=>e.system.app_version));return cd("div",{className:"site-header",children:[cd("div",{className:"site-header-left-side",children:[ld("img",{src:k3,alt:"invoke-ai-logo"}),cd(CI,{alignItems:"center",columnGap:"0.6rem",children:[cd(VI,{fontSize:"1.4rem",children:["invoke ",ld("strong",{children:"ai"})]}),ld(VI,{fontWeight:"bold",color:"var(--text-color-secondary)",marginTop:"0.2rem",children:t})]})]}),cd("div",{className:"site-header-right-side",children:[ld(z3,{}),ld(W3,{}),ld(r8,{children:ld(S3,{"aria-label":e("modelmanager:modelManager"),tooltip:e("modelmanager:modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:ld(W5,{})})}),ld(_3,{children:ld(S3,{"aria-label":e("common:hotkeysLabel"),tooltip:e("common:hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:ld(J5,{})})}),ld(F3,{}),ld(o8,{}),ld(S3,{"aria-label":e("common:reportBugLabel"),tooltip:e("common:reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:ld(MI,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:ld(z5,{})})}),ld(S3,{"aria-label":e("common:githubLabel"),tooltip:e("common:githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:ld(MI,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:ld(O5,{})})}),ld(S3,{"aria-label":e("common:discordLabel"),tooltip:e("common:discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:ld(MI,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:ld(P5,{})})}),ld(N3,{children:ld(S3,{"aria-label":e("common:settingsLabel"),tooltip:e("common:settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:ld(q3,{})})})]})]})};var a8=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),s8=globalThis&&globalThis.__assign||function(){return s8=Object.assign||function(e){for(var t,n=1,r=arguments.length;n()=>(t||e((t={exports:{}}).exports,t),t.exports),I8=(e,t,n)=>(n=null!=e?E8(M8(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of O8(t))!T8.call(e,o)&&o!==n&&L8(e,o,{get:()=>t[o],enumerable:!(r=P8(t,o))||r.enumerable});return e})(!t&&e&&e.__esModule?n:L8(n,"default",{value:e,enumerable:!0}),e)),R8=A8(((e,t)=>{t.exports=function(){this.__data__=[],this.size=0}})),N8=A8(((e,t)=>{t.exports=function(e,t){return e===t||e!=e&&t!=t}})),D8=A8(((e,t)=>{var n=N8();t.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}})),z8=A8(((e,t)=>{var n=D8(),r=Array.prototype.splice;t.exports=function(e){var t=this.__data__,o=n(t,e);return!(o<0)&&(o==t.length-1?t.pop():r.call(t,o,1),--this.size,!0)}})),B8=A8(((e,t)=>{var n=D8();t.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}})),j8=A8(((e,t)=>{var n=D8();t.exports=function(e){return n(this.__data__,e)>-1}})),F8=A8(((e,t)=>{var n=D8();t.exports=function(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}})),H8=A8(((e,t)=>{var n=R8(),r=z8(),o=B8(),i=j8(),a=F8();function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var n=H8();t.exports=function(){this.__data__=new n,this.size=0}})),V8=A8(((e,t)=>{t.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}})),U8=A8(((e,t)=>{t.exports=function(e){return this.__data__.get(e)}})),$8=A8(((e,t)=>{t.exports=function(e){return this.__data__.has(e)}})),G8=A8(((e,t)=>{var n="object"==typeof global&&global&&global.Object===Object&&global;t.exports=n})),q8=A8(((e,t)=>{var n=G8(),r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")();t.exports=o})),Y8=A8(((e,t)=>{var n=q8().Symbol;t.exports=n})),Z8=A8(((e,t)=>{var n=Y8(),r=Object.prototype,o=r.hasOwnProperty,i=r.toString,a=n?n.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch{}var s=i.call(e);return r&&(t?e[a]=n:delete e[a]),s}})),X8=A8(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){return n.call(e)}})),K8=A8(((e,t)=>{var n=Y8(),r=Z8(),o=X8(),i=n?n.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?r(e):o(e)}})),Q8=A8(((e,t)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}})),J8=A8(((e,t)=>{var n=K8(),r=Q8();t.exports=function(e){if(!r(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}})),eee=A8(((e,t)=>{var n=q8()["__core-js_shared__"];t.exports=n})),tee=A8(((e,t)=>{var n=eee(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();t.exports=function(e){return!!r&&r in e}})),nee=A8(((e,t)=>{var n=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return n.call(e)}catch{}try{return e+""}catch{}}return""}})),ree=A8(((e,t)=>{var n=J8(),r=tee(),o=Q8(),i=nee(),a=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!o(e)||r(e))&&(n(e)?d:a).test(i(e))}})),oee=A8(((e,t)=>{t.exports=function(e,t){return e?.[t]}})),iee=A8(((e,t)=>{var n=ree(),r=oee();t.exports=function(e,t){var o=r(e,t);return n(o)?o:void 0}})),aee=A8(((e,t)=>{var n=iee()(q8(),"Map");t.exports=n})),see=A8(((e,t)=>{var n=iee()(Object,"create");t.exports=n})),lee=A8(((e,t)=>{var n=see();t.exports=function(){this.__data__=n?n(null):{},this.size=0}})),cee=A8(((e,t)=>{t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}})),uee=A8(((e,t)=>{var n=see(),r=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(n){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return r.call(t,e)?t[e]:void 0}})),dee=A8(((e,t)=>{var n=see(),r=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:r.call(t,e)}})),hee=A8(((e,t)=>{var n=see();t.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}})),fee=A8(((e,t)=>{var n=lee(),r=cee(),o=uee(),i=dee(),a=hee();function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var n=fee(),r=H8(),o=aee();t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||r),string:new n}}})),gee=A8(((e,t)=>{t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}})),mee=A8(((e,t)=>{var n=gee();t.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}})),vee=A8(((e,t)=>{var n=mee();t.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}})),yee=A8(((e,t)=>{var n=mee();t.exports=function(e){return n(this,e).get(e)}})),bee=A8(((e,t)=>{var n=mee();t.exports=function(e){return n(this,e).has(e)}})),xee=A8(((e,t)=>{var n=mee();t.exports=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}})),wee=A8(((e,t)=>{var n=pee(),r=vee(),o=yee(),i=bee(),a=xee();function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var n=H8(),r=aee(),o=wee();t.exports=function(e,t){var i=this.__data__;if(i instanceof n){var a=i.__data__;if(!r||a.length<199)return a.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(a)}return i.set(e,t),this.size=i.size,this}})),See=A8(((e,t)=>{var n=H8(),r=W8(),o=V8(),i=U8(),a=$8(),s=kee();function l(e){var t=this.__data__=new n(e);this.size=t.size}l.prototype.clear=r,l.prototype.delete=o,l.prototype.get=i,l.prototype.has=a,l.prototype.set=s,t.exports=l})),Cee=A8(((e,t)=>{t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}})),_ee=A8(((e,t)=>{t.exports=function(e){return this.__data__.has(e)}})),Eee=A8(((e,t)=>{var n=wee(),r=Cee(),o=_ee();function i(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new n;++t{t.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{t.exports=function(e,t){return e.has(t)}})),Oee=A8(((e,t)=>{var n=Eee(),r=Lee(),o=Pee();t.exports=function(e,t,i,a,s,l){var c=1&i,u=e.length,d=t.length;if(u!=d&&!(c&&d>u))return!1;var h=l.get(e),f=l.get(t);if(h&&f)return h==t&&f==e;var p=-1,g=!0,m=2&i?new n:void 0;for(l.set(e,t),l.set(t,e);++p{var n=q8().Uint8Array;t.exports=n})),Tee=A8(((e,t)=>{t.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}})),Aee=A8(((e,t)=>{t.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}})),Iee=A8(((e,t)=>{var n=Y8(),r=Mee(),o=N8(),i=Oee(),a=Tee(),s=Aee(),l=n?n.prototype:void 0,c=l?l.valueOf:void 0;t.exports=function(e,t,n,l,u,d,h){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new r(e),new r(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var p=1&l;if(f||(f=s),e.size!=t.size&&!p)return!1;var g=h.get(e);if(g)return g==t;l|=2,h.set(e,t);var m=i(f(e),f(t),l,u,d,h);return h.delete(e),m;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}})),Ree=A8(((e,t)=>{t.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n{var n=Array.isArray;t.exports=n})),Dee=A8(((e,t)=>{var n=Ree(),r=Nee();t.exports=function(e,t,o){var i=t(e);return r(e)?i:n(i,o(e))}})),zee=A8(((e,t)=>{t.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n{t.exports=function(){return[]}})),jee=A8(((e,t)=>{var n=zee(),r=Bee(),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(e){return null==e?[]:(e=Object(e),n(i(e),(function(t){return o.call(e,t)})))}:r;t.exports=a})),Fee=A8(((e,t)=>{t.exports=function(e,t){for(var n=-1,r=Array(e);++n{t.exports=function(e){return null!=e&&"object"==typeof e}})),Wee=A8(((e,t)=>{var n=K8(),r=Hee();t.exports=function(e){return r(e)&&"[object Arguments]"==n(e)}})),Vee=A8(((e,t)=>{var n=Wee(),r=Hee(),o=Object.prototype,i=o.hasOwnProperty,a=o.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(e){return r(e)&&i.call(e,"callee")&&!a.call(e,"callee")};t.exports=s})),Uee=A8(((e,t)=>{t.exports=function(){return!1}})),$ee=A8(((e,t)=>{var n=q8(),r=Uee(),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;t.exports=s})),Gee=A8(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var r=typeof e;return!!(t=t??9007199254740991)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e{t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}})),Yee=A8(((e,t)=>{var n=K8(),r=qee(),o=Hee(),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(e){return o(e)&&r(e.length)&&!!i[n(e)]}})),Zee=A8(((e,t)=>{t.exports=function(e){return function(t){return e(t)}}})),Xee=A8(((e,t)=>{var n=G8(),r="object"==typeof e&&e&&!e.nodeType&&e,o=r&&"object"==typeof t&&t&&!t.nodeType&&t,i=o&&o.exports===r&&n.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch{}}();t.exports=a})),Kee=A8(((e,t)=>{var n=Yee(),r=Zee(),o=Xee(),i=o&&o.isTypedArray,a=i?r(i):n;t.exports=a})),Qee=A8(((e,t)=>{var n=Fee(),r=Vee(),o=Nee(),i=$ee(),a=Gee(),s=Kee(),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=o(e),u=!c&&r(e),d=!c&&!u&&i(e),h=!c&&!u&&!d&&s(e),f=c||u||d||h,p=f?n(e.length,String):[],g=p.length;for(var m in e)(t||l.call(e,m))&&(!f||!("length"==m||d&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,g)))&&p.push(m);return p}})),Jee=A8(((e,t)=>{var n=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}})),ete=A8(((e,t)=>{t.exports=function(e,t){return function(n){return e(t(n))}}})),tte=A8(((e,t)=>{var n=ete()(Object.keys,Object);t.exports=n})),nte=A8(((e,t)=>{var n=Jee(),r=tte(),o=Object.prototype.hasOwnProperty;t.exports=function(e){if(!n(e))return r(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}})),rte=A8(((e,t)=>{var n=J8(),r=qee();t.exports=function(e){return null!=e&&r(e.length)&&!n(e)}})),ote=A8(((e,t)=>{var n=Qee(),r=nte(),o=rte();t.exports=function(e){return o(e)?n(e):r(e)}})),ite=A8(((e,t)=>{var n=Dee(),r=jee(),o=ote();t.exports=function(e){return n(e,o,r)}})),ate=A8(((e,t)=>{var n=ite(),r=Object.prototype.hasOwnProperty;t.exports=function(e,t,o,i,a,s){var l=1&o,c=n(e),u=c.length;if(u!=n(t).length&&!l)return!1;for(var d=u;d--;){var h=c[d];if(!(l?h in t:r.call(t,h)))return!1}var f=s.get(e),p=s.get(t);if(f&&p)return f==t&&p==e;var g=!0;s.set(e,t),s.set(t,e);for(var m=l;++d{var n=iee()(q8(),"DataView");t.exports=n})),lte=A8(((e,t)=>{var n=iee()(q8(),"Promise");t.exports=n})),cte=A8(((e,t)=>{var n=iee()(q8(),"Set");t.exports=n})),ute=A8(((e,t)=>{var n=iee()(q8(),"WeakMap");t.exports=n})),dte=A8(((e,t)=>{var n=ste(),r=aee(),o=lte(),i=cte(),a=ute(),s=K8(),l=nee(),c="[object Map]",u="[object Promise]",d="[object Set]",h="[object WeakMap]",f="[object DataView]",p=l(n),g=l(r),m=l(o),v=l(i),y=l(a),b=s;(n&&b(new n(new ArrayBuffer(1)))!=f||r&&b(new r)!=c||o&&b(o.resolve())!=u||i&&b(new i)!=d||a&&b(new a)!=h)&&(b=function(e){var t=s(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):"";if(r)switch(r){case p:return f;case g:return c;case m:return u;case v:return d;case y:return h}return t}),t.exports=b})),hte=A8(((e,t)=>{var n=See(),r=Oee(),o=Iee(),i=ate(),a=dte(),s=Nee(),l=$ee(),c=Kee(),u="[object Arguments]",d="[object Array]",h="[object Object]",f=Object.prototype.hasOwnProperty;t.exports=function(e,t,p,g,m,v){var y=s(e),b=s(t),x=y?d:a(e),w=b?d:a(t),k=(x=x==u?h:x)==h,S=(w=w==u?h:w)==h,C=x==w;if(C&&l(e)){if(!l(t))return!1;y=!0,k=!1}if(C&&!k)return v||(v=new n),y||c(e)?r(e,t,p,g,m,v):o(e,t,x,p,g,m,v);if(!(1&p)){var _=k&&f.call(e,"__wrapped__"),E=S&&f.call(t,"__wrapped__");if(_||E){var L=_?e.value():e,P=E?t.value():t;return v||(v=new n),m(L,P,p,g,v)}}return!!C&&(v||(v=new n),i(e,t,p,g,m,v))}})),fte=A8(((e,t)=>{var n=hte(),r=Hee();t.exports=function e(t,o,i,a,s){return t===o||(null==t||null==o||!r(t)&&!r(o)?t!=t&&o!=o:n(t,o,i,a,e,s))}})),pte=A8(((e,t)=>{var n=fte();t.exports=function(e,t){return n(e,t)}})),gte=["ctrl","shift","alt","meta","mod"],mte={esc:"escape",return:"enter",left:"arrowleft",up:"arrowup",right:"arrowright",down:"arrowdown"};function vte(e,t=","){return"string"==typeof e?e.split(t):e}function yte(e,t="+"){let n=e.toLocaleLowerCase().split(t).map((e=>e.trim())).map((e=>mte[e]||e)),r={alt:n.includes("alt"),ctrl:n.includes("ctrl"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod")},o=n.filter((e=>!gte.includes(e)));return{...r,keys:o}}function bte({target:e},t=!1){let n=e&&e.tagName;return t instanceof Array?Boolean(n&&t&&t.some((e=>e.toLowerCase()===n.toLowerCase()))):Boolean(n&&t&&!0===t)}var xte=a.exports.createContext(void 0),wte=a.exports.createContext({hotkeys:[],enabledScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),kte=I8(pte());var Ste=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()};function Cte(e,t,n,r){let o=a.exports.useRef(null),{current:i}=a.exports.useRef(new Set),s=n instanceof Array?r instanceof Array?void 0:r:n,l=n instanceof Array?n:r instanceof Array?r:[],c=a.exports.useCallback(t,[...l]),u=function(e){let t=a.exports.useRef(void 0);return(0,kte.default)(t.current,e)||(t.current=e),t.current}(s),{enabledScopes:d}=a.exports.useContext(wte),h=a.exports.useContext(xte);return a.exports.useLayoutEffect((()=>{if(!1===u?.enabled||!function(e,t){return 0===e.length&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a '),!0):!t||e.some((e=>t.includes(e)))||e.includes("*")}(d,u?.scopes))return;let t=t=>{if(!function(e){return bte(e,["input","textarea","select"])}(t)||bte(t,u?.enableOnFormTags)){if(null!==o.current&&document.activeElement!==o.current&&!o.current.contains(document.activeElement))return void Ste(t);t.target?.isContentEditable&&!u?.enableOnContentEditable||vte(e,u?.splitKey).forEach((e=>{let n=yte(e,u?.combinationKey);if(((e,t,n)=>{let{alt:r,ctrl:o,meta:i,mod:a,shift:s,keys:l}=t,{altKey:c,ctrlKey:u,metaKey:d,shiftKey:h,key:f,code:p}=e,g=p.toLowerCase().replace("key",""),m=f.toLowerCase();if(c!==r&&"alt"!==m||h!==s&&"shift"!==m)return!1;if(a){if(!d&&!u)return!1}else if(d!==i&&"meta"!==g||u!==o&&"ctrl"!==g)return!1;return!(!l||1!==l.length||!l.includes(m)&&!l.includes(g))||(l?l.every((e=>n.has(e))):!l)})(t,n,i)||n.keys?.includes("*")){if(function(e,t,n){("function"==typeof n&&n(e,t)||!0===n)&&e.preventDefault()}(t,n,u?.preventDefault),!function(e,t,n){return"function"==typeof n?n(e,t):!0===n||void 0===n}(t,n,u?.enabled))return void Ste(t);c(t,n)}}))}},n=e=>{i.add(e.key.toLowerCase()),(void 0===u?.keydown&&!0!==u?.keyup||u?.keydown)&&t(e)},r=e=>{"meta"!==e.key.toLowerCase()?i.delete(e.key.toLowerCase()):i.clear(),u?.keyup&&t(e)};return(o.current||document).addEventListener("keyup",r),(o.current||document).addEventListener("keydown",n),h&&vte(e,u?.splitKey).forEach((e=>h.addHotkey(yte(e,u?.combinationKey)))),()=>{(o.current||document).removeEventListener("keyup",r),(o.current||document).removeEventListener("keydown",n),h&&vte(e,u?.splitKey).forEach((e=>h.removeHotkey(yte(e,u?.combinationKey))))}}),[e,c,u,d]),o}I8(pte());var _te=new Set;window.addEventListener("DOMContentLoaded",(()=>{document.addEventListener("keydown",(e=>{!function(e){(Array.isArray(e)?e:[e]).forEach((e=>_te.add(yte(e))))}(e.key)})),document.addEventListener("keyup",(e=>{!function(e){(Array.isArray(e)?e:[e]).forEach((e=>{let t=yte(e);for(let n of _te)n.keys?.every((e=>t.keys?.includes(e)))&&_te.delete(n)}))}(e.key)}))}));const Ete=uV((e=>e.system),(e=>e.log),{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),Lte=uV((e=>e.system),(e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),Pte=()=>{const e=v5(),t=y5(Ete),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:o}=y5(Lte),[i,s]=a.exports.useState(!0),l=a.exports.useRef(null);a.exports.useLayoutEffect((()=>{null!==l.current&&i&&(l.current.scrollTop=l.current.scrollHeight)}),[i,t,n]);Cte("`",(()=>{e(GY(!n))}),[n]),Cte("esc",(()=>{e(GY(!1))}));return cd(sd,{children:[n&&ld(_8,{defaultSize:{width:"100%",height:200},style:{display:"flex",position:"fixed",left:0,bottom:0,zIndex:9999},maxHeight:"90vh",children:ld("div",{className:"console",ref:l,onScroll:()=>{l.current&&i&&l.current.scrollTop{const{timestamp:n,message:r,level:o}=e;return cd("div",{className:`console-entry console-${o}-color`,children:[cd("p",{className:"console-timestamp",children:[n,":"]}),ld("p",{className:"console-message",children:r})]},t)}))})}),n&&ld(YH,{hasArrow:!0,label:i?"Autoscroll On":"Autoscroll Off",children:ld(zT,{className:"console-autoscroll-icon-button","data-autoscroll-enabled":i,size:"sm","aria-label":"Toggle autoscroll",variant:"solid",icon:ld(M5,{}),onClick:()=>s(!i)})}),ld(YH,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:ld(zT,{className:"console-toggle-icon-button","data-error-seen":r||!o,size:"sm",position:"fixed",variant:"solid","aria-label":"Toggle Log Viewer",icon:ld(n?r3:j5,{}),onClick:()=>{e(rZ()),e(GY(!n))}})})]})};function Ote(){const{t:e}=HY();return cd("div",{className:"work-in-progress nodes-work-in-progress",children:[ld("h1",{children:e("common:nodes")}),ld("p",{children:e("common:nodesDesc")})]})}const Mte=()=>{const{t:e}=HY();return cd("div",{className:"work-in-progress post-processing-work-in-progress",children:[ld("h1",{children:e("common:postProcessing")}),ld("p",{children:e("common:postProcessDesc1")}),ld("p",{children:e("common:postProcessDesc2")}),ld("p",{children:e("common:postProcessDesc3")})]})},Tte=Sk({displayName:"ImageToImageIcon",viewBox:"0 0 3543 3543",path:ld("g",{transform:"matrix(1.10943,0,0,1.10943,-206.981,-213.533)",children:ld("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M688.533,2405.95L542.987,2405.95C349.532,2405.95 192.47,2248.89 192.47,2055.44L192.47,542.987C192.47,349.532 349.532,192.47 542.987,192.47L2527.88,192.47C2721.33,192.47 2878.4,349.532 2878.4,542.987L2878.4,1172.79L3023.94,1172.79C3217.4,1172.79 3374.46,1329.85 3374.46,1523.3C3374.46,1523.3 3374.46,3035.75 3374.46,3035.75C3374.46,3229.21 3217.4,3386.27 3023.94,3386.27L1039.05,3386.27C845.595,3386.27 688.533,3229.21 688.533,3035.75L688.533,2405.95ZM3286.96,2634.37L3286.96,1523.3C3286.96,1378.14 3169.11,1260.29 3023.94,1260.29C3023.94,1260.29 1039.05,1260.29 1039.05,1260.29C893.887,1260.29 776.033,1378.14 776.033,1523.3L776.033,2489.79L1440.94,1736.22L2385.83,2775.59L2880.71,2200.41L3286.96,2634.37ZM2622.05,1405.51C2778.5,1405.51 2905.51,1532.53 2905.51,1688.98C2905.51,1845.42 2778.5,1972.44 2622.05,1972.44C2465.6,1972.44 2338.58,1845.42 2338.58,1688.98C2338.58,1532.53 2465.6,1405.51 2622.05,1405.51ZM2790.9,1172.79L1323.86,1172.79L944.882,755.906L279.97,1509.47L279.97,542.987C279.97,397.824 397.824,279.97 542.987,279.97C542.987,279.97 2527.88,279.97 2527.88,279.97C2673.04,279.97 2790.9,397.824 2790.9,542.987L2790.9,1172.79ZM2125.98,425.197C2282.43,425.197 2409.45,552.213 2409.45,708.661C2409.45,865.11 2282.43,992.126 2125.98,992.126C1969.54,992.126 1842.52,865.11 1842.52,708.661C1842.52,552.213 1969.54,425.197 2125.98,425.197Z"})})}),Ate=Sk({displayName:"NodesIcon",viewBox:"0 0 3543 3543",path:ld("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3543.31,770.787C3543.31,515.578 3336.11,308.38 3080.9,308.38L462.407,308.38C207.197,308.38 0,515.578 0,770.787L0,2766.03C0,3021.24 207.197,3228.44 462.407,3228.44L3080.9,3228.44C3336.11,3228.44 3543.31,3021.24 3543.31,2766.03C3543.31,2766.03 3543.31,770.787 3543.31,770.787ZM3427.88,770.787L3427.88,2766.03C3427.88,2957.53 3272.4,3113.01 3080.9,3113.01C3080.9,3113.01 462.407,3113.01 462.407,3113.01C270.906,3113.01 115.431,2957.53 115.431,2766.03L115.431,770.787C115.431,579.286 270.906,423.812 462.407,423.812L3080.9,423.812C3272.4,423.812 3427.88,579.286 3427.88,770.787ZM1214.23,1130.69L1321.47,1130.69C1324.01,1130.69 1326.54,1130.53 1329.05,1130.2C1329.05,1130.2 1367.3,1125.33 1397.94,1149.8C1421.63,1168.72 1437.33,1204.3 1437.33,1265.48L1437.33,2078.74L1220.99,2078.74C1146.83,2078.74 1086.61,2138.95 1086.61,2213.12L1086.61,2762.46C1086.61,2836.63 1146.83,2896.84 1220.99,2896.84L1770.34,2896.84C1844.5,2896.84 1904.71,2836.63 1904.71,2762.46L1904.71,2213.12C1904.71,2138.95 1844.5,2078.74 1770.34,2078.74L1554,2078.74L1554,1604.84C1625.84,1658.19 1703.39,1658.1 1703.39,1658.1C1703.54,1658.1 1703.69,1658.11 1703.84,1658.11L2362.2,1658.11L2362.2,1874.44C2362.2,1948.61 2422.42,2008.82 2496.58,2008.82L3045.93,2008.82C3120.09,2008.82 3180.3,1948.61 3180.3,1874.44L3180.3,1325.1C3180.3,1250.93 3120.09,1190.72 3045.93,1190.72L2496.58,1190.72C2422.42,1190.72 2362.2,1250.93 2362.2,1325.1L2362.2,1558.97L2362.2,1541.44L1704.23,1541.44C1702.2,1541.37 1650.96,1539.37 1609.51,1499.26C1577.72,1468.49 1554,1416.47 1554,1331.69L1554,1265.48C1554,1153.86 1513.98,1093.17 1470.76,1058.64C1411.24,1011.1 1338.98,1012.58 1319.15,1014.03L1214.23,1014.03L1214.23,796.992C1214.23,722.828 1154.02,662.617 1079.85,662.617L530.507,662.617C456.343,662.617 396.131,722.828 396.131,796.992L396.131,1346.34C396.131,1420.5 456.343,1480.71 530.507,1480.71L1079.85,1480.71C1154.02,1480.71 1214.23,1420.5 1214.23,1346.34L1214.23,1130.69Z"})}),Ite=Sk({displayName:"PostprocessingIcon",viewBox:"0 0 3543 3543",path:ld("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M709.477,1596.53L992.591,1275.66L2239.09,2646.81L2891.95,1888.03L3427.88,2460.51L3427.88,994.78C3427.88,954.66 3421.05,916.122 3408.5,880.254L3521.9,855.419C3535.8,899.386 3543.31,946.214 3543.31,994.78L3543.31,2990.02C3543.31,3245.23 3336.11,3452.43 3080.9,3452.43C3080.9,3452.43 462.407,3452.43 462.407,3452.43C207.197,3452.43 -0,3245.23 -0,2990.02L-0,994.78C-0,739.571 207.197,532.373 462.407,532.373L505.419,532.373L504.644,532.546L807.104,600.085C820.223,601.729 832.422,607.722 841.77,617.116C850.131,625.517 855.784,636.21 858.055,647.804L462.407,647.804C270.906,647.804 115.431,803.279 115.431,994.78L115.431,2075.73L-0,2101.5L115.431,2127.28L115.431,2269.78L220.47,2150.73L482.345,2209.21C503.267,2211.83 522.722,2221.39 537.63,2236.37C552.538,2251.35 562.049,2270.9 564.657,2291.93L671.84,2776.17L779.022,2291.93C781.631,2270.9 791.141,2251.35 806.05,2236.37C820.958,2221.39 840.413,2211.83 861.334,2209.21L1353.15,2101.5L861.334,1993.8C840.413,1991.18 820.958,1981.62 806.05,1966.64C791.141,1951.66 781.631,1932.11 779.022,1911.08L709.477,1596.53ZM671.84,1573.09L725.556,2006.07C726.863,2016.61 731.63,2026.4 739.101,2033.91C746.573,2041.42 756.323,2046.21 766.808,2047.53L1197.68,2101.5L766.808,2155.48C756.323,2156.8 746.573,2161.59 739.101,2169.09C731.63,2176.6 726.863,2186.4 725.556,2196.94L671.84,2629.92L618.124,2196.94C616.817,2186.4 612.05,2176.6 604.579,2169.09C597.107,2161.59 587.357,2156.8 576.872,2155.48L146.001,2101.5L576.872,2047.53C587.357,2046.21 597.107,2041.42 604.579,2033.91C612.05,2026.4 616.817,2016.61 618.124,2006.07L671.84,1573.09ZM609.035,1710.36L564.657,1911.08C562.049,1932.11 552.538,1951.66 537.63,1966.64C522.722,1981.62 503.267,1991.18 482.345,1993.8L328.665,2028.11L609.035,1710.36ZM2297.12,938.615L2451.12,973.003C2480.59,976.695 2507.99,990.158 2528.99,1011.26C2549.99,1032.37 2563.39,1059.9 2567.07,1089.52L2672.73,1566.9C2634.5,1580.11 2593.44,1587.29 2550.72,1587.29C2344.33,1587.29 2176.77,1419.73 2176.77,1213.34C2176.77,1104.78 2223.13,1006.96 2297.12,938.615ZM2718.05,76.925L2793.72,686.847C2795.56,701.69 2802.27,715.491 2812.8,726.068C2823.32,736.644 2837.06,743.391 2851.83,745.242L3458.78,821.28L2851.83,897.318C2837.06,899.168 2823.32,905.916 2812.8,916.492C2802.27,927.068 2795.56,940.87 2793.72,955.712L2718.05,1565.63L2642.38,955.712C2640.54,940.87 2633.83,927.068 2623.3,916.492C2612.78,905.916 2599.04,899.168 2584.27,897.318L1977.32,821.28L2584.27,745.242C2599.04,743.391 2612.78,736.644 2623.3,726.068C2633.83,715.491 2640.54,701.69 2642.38,686.847L2718.05,76.925ZM2883.68,1043.06C2909.88,1094.13 2924.67,1152.02 2924.67,1213.34C2924.67,1335.4 2866.06,1443.88 2775.49,1512.14L2869.03,1089.52C2871.07,1073.15 2876.07,1057.42 2883.68,1043.06ZM925.928,201.2L959.611,472.704C960.431,479.311 963.42,485.455 968.105,490.163C972.79,494.871 978.904,497.875 985.479,498.698L1255.66,532.546L985.479,566.395C978.904,567.218 972.79,570.222 968.105,574.93C963.42,579.638 960.431,585.781 959.611,592.388L925.928,863.893L892.245,592.388C891.425,585.781 888.436,579.638 883.751,574.93C879.066,570.222 872.952,567.218 866.378,566.395L596.195,532.546L866.378,498.698C872.952,497.875 879.066,494.871 883.751,490.163C888.436,485.455 891.425,479.311 892.245,472.704L925.928,201.2ZM2864.47,532.373L3080.9,532.373C3258.7,532.373 3413.2,632.945 3490.58,780.281L3319.31,742.773C3257.14,683.925 3173.2,647.804 3080.9,647.804L2927.07,647.804C2919.95,642.994 2913.25,637.473 2907.11,631.298C2886.11,610.194 2872.71,582.655 2869.03,553.04L2864.47,532.373ZM1352.36,532.373L2571.64,532.373L2567.07,553.04C2563.39,582.655 2549.99,610.194 2528.99,631.298C2522.85,637.473 2516.16,642.994 2509.03,647.804L993.801,647.804C996.072,636.21 1001.73,625.517 1010.09,617.116C1019.43,607.722 1031.63,601.729 1044.75,600.085L1353.15,532.546L1352.36,532.373Z"})}),Rte=Sk({displayName:"TextToImageIcon",viewBox:"0 0 3543 3543",path:ld("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",transform:"matrix(1.11667,0,0,1.1066,-231.131,-213.062)",children:ld("path",{d:"M2209.59,1137.35L2209.59,1098.17C2177.13,1108.99 2125.74,1121.91 2055.41,1136.94C2054.77,1137.08 2054.14,1137.21 2053.49,1137.35L1662.79,1137.35C1687.75,1101.98 1720.8,1074.35 1761.93,1054.44C1808.52,1031.9 1875.69,1012.22 1963.45,995.386C2081.86,973.146 2163.91,952.409 2209.59,933.174L2209.59,907.929C2209.59,859.241 2197.57,824.529 2173.53,803.792C2149.48,783.054 2104.1,772.686 2037.38,772.686C1992.3,772.686 1957.14,781.552 1931.89,799.284C1906.64,817.015 1886.21,848.121 1870.58,892.601L1640.67,851.127C1666.51,758.56 1710.99,690.037 1774.11,645.557C1837.22,601.077 1930.99,578.837 2055.41,578.837C2168.42,578.837 2252.57,592.211 2307.87,618.959C2363.17,645.707 2402.09,679.668 2424.63,720.842C2447.17,762.016 2458.44,837.602 2458.44,947.6L2456.7,1137.35L3021.34,1137.35C3214.79,1137.35 3371.86,1294.41 3371.86,1487.87C3371.86,1487.87 3371.86,3000.32 3371.86,3000.32C3371.86,3193.78 3214.79,3350.84 3021.34,3350.84C3021.34,3350.84 1036.45,3350.84 1036.45,3350.84C842.991,3350.84 685.93,3193.78 685.93,3000.32L685.93,1487.87C685.93,1400.21 718.174,1320.03 771.448,1258.54L772.123,1257.76L607.408,1257.76L498.311,1558L215.202,1558L730.028,236.22L1012.24,236.22L1373.06,1137.35L2209.59,1137.35ZM3284.36,2598.93L3284.36,1487.87C3284.36,1342.71 3166.5,1224.85 3021.34,1224.85C3021.34,1224.85 1036.45,1224.85 1036.45,1224.85C891.284,1224.85 773.43,1342.71 773.43,1487.87L773.43,2454.35L1438.34,1700.79L2383.22,2740.16L2878.11,2164.98L3284.36,2598.93ZM2619.44,1370.08C2775.89,1370.08 2902.91,1497.1 2902.91,1653.54C2902.91,1809.99 2775.89,1937.01 2619.44,1937.01C2462.99,1937.01 2335.98,1809.99 2335.98,1653.54C2335.98,1497.1 2462.99,1370.08 2619.44,1370.08ZM772.877,1256.89L772.849,1256.93L773.167,1256.57L772.877,1256.89ZM773.634,1256.04L773.563,1256.12L773.985,1255.64L773.634,1256.04ZM774.394,1255.18L774.276,1255.31L774.746,1254.78L774.394,1255.18ZM775.157,1254.32L774.988,1254.51L775.493,1253.95L775.157,1254.32ZM775.923,1253.47L775.698,1253.72L776.237,1253.12L775.923,1253.47ZM776.691,1252.62L776.403,1252.94L776.979,1252.3L776.691,1252.62ZM777.462,1251.77L777.098,1252.17L777.723,1251.49L777.462,1251.77ZM925.081,1155.44C868.026,1174.57 817.508,1207.99 777.775,1251.43C817.511,1207.99 868.031,1174.57 925.081,1155.44ZM925.646,1155.25L925.108,1155.43L926.103,1155.1L925.646,1155.25ZM935.286,1152.2C932.214,1153.12 929.159,1154.09 926.13,1155.09C929.165,1154.09 932.219,1153.12 935.286,1152.2ZM935.716,1152.07L935.384,1152.17L936.292,1151.89L935.716,1152.07ZM936.843,1151.73L936.451,1151.85L937.327,1151.59L936.843,1151.73ZM937.972,1151.4L937.514,1151.53L938.377,1151.28L937.972,1151.4ZM939.102,1151.07L938.57,1151.22L939.438,1150.97L939.102,1151.07ZM940.233,1150.74L939.613,1150.92L940.505,1150.67L940.233,1150.74ZM946.659,1148.98C944.639,1149.51 942.626,1150.07 940.626,1150.63C942.631,1150.06 944.642,1149.51 946.659,1148.98ZM947.056,1148.87L946.829,1148.93L947.659,1148.71L947.056,1148.87ZM948.198,1148.57L947.919,1148.65L948.705,1148.44L948.198,1148.57ZM949.342,1148.28L949.008,1148.37L949.771,1148.17L949.342,1148.28ZM950.488,1147.99L950.096,1148.09L950.848,1147.9L950.488,1147.99ZM951.635,1147.7L951.182,1147.81L951.932,1147.63L951.635,1147.7ZM952.783,1147.42L952.262,1147.55L953.022,1147.36L952.783,1147.42ZM953.933,1147.14L953.327,1147.28L954.115,1147.09L953.933,1147.14ZM958.213,1146.13C956.927,1146.42 955.644,1146.73 954.354,1147.04C955.637,1146.73 956.923,1146.43 958.213,1146.13ZM958.547,1146.06L958.409,1146.09L959.174,1145.91L958.547,1146.06ZM959.704,1145.79L959.517,1145.84L960.229,1145.68L959.704,1145.79ZM960.863,1145.54L960.626,1145.59L961.311,1145.44L960.863,1145.54ZM962.023,1145.28L961.736,1145.35L962.406,1145.2L962.023,1145.28ZM963.184,1145.03L962.846,1145.11L963.508,1144.97L963.184,1145.03ZM964.347,1144.79L963.956,1144.87L964.615,1144.73L964.347,1144.79ZM965.511,1144.55L965.066,1144.64L965.725,1144.5L965.511,1144.55ZM966.677,1144.31L966.172,1144.41L966.838,1144.28L966.677,1144.31ZM967.844,1144.08L967.269,1144.19L967.953,1144.05L967.844,1144.08ZM970.183,1143.62C969.793,1143.69 969.403,1143.77 969.013,1143.85L969.055,1143.84C969.413,1143.77 969.771,1143.7 970.129,1143.63L970.183,1143.62ZM971.354,1143.4L971.245,1143.42L971.882,1143.3L971.354,1143.4ZM972.526,1143.18L972.37,1143.21L972.987,1143.09L972.526,1143.18ZM973.7,1142.96L973.496,1143L974.103,1142.89L973.7,1142.96ZM974.876,1142.75L974.624,1142.8L975.225,1142.69L974.876,1142.75ZM976.052,1142.55L975.754,1142.6L976.349,1142.49L976.052,1142.55ZM977.23,1142.34L976.885,1142.4L977.476,1142.3L977.23,1142.34ZM978.41,1142.14L978.019,1142.21L978.605,1142.11L978.41,1142.14ZM979.59,1141.95L979.156,1142.02L979.736,1141.92L979.59,1141.95ZM980.772,1141.76L980.299,1141.83L980.868,1141.74L980.772,1141.76ZM981.955,1141.57L981.464,1141.65L982.002,1141.56L981.955,1141.57ZM983.14,1141.39L983.1,1141.39L983.605,1141.32L983.14,1141.39ZM984.326,1141.21L984.239,1141.22L984.778,1141.14L984.326,1141.21ZM985.513,1141.03L985.379,1141.05L985.928,1140.97L985.513,1141.03ZM986.702,1140.86L986.521,1140.89L987.073,1140.81L986.702,1140.86ZM987.891,1140.69L987.665,1140.73L988.218,1140.65L987.891,1140.69ZM989.082,1140.53L988.811,1140.57L989.363,1140.49L989.082,1140.53ZM990.275,1140.37L989.96,1140.41L990.508,1140.34L990.275,1140.37ZM991.468,1140.22L991.113,1140.26L991.654,1140.19L991.468,1140.22ZM992.663,1140.07L992.273,1140.12L992.8,1140.05L992.663,1140.07ZM993.859,1139.92L993.447,1139.97L993.948,1139.91L993.859,1139.92ZM995.056,1139.78L994.671,1139.82L995.097,1139.77L995.056,1139.78ZM996.255,1139.64L996.23,1139.64L996.578,1139.6L996.255,1139.64ZM997.454,1139.5L997.383,1139.51L997.852,1139.46L997.454,1139.5ZM998.655,1139.37L998.537,1139.38L999.041,1139.33L998.655,1139.37ZM999.857,1139.24L999.693,1139.26L1000.21,1139.21L999.857,1139.24ZM1001.06,1139.12L1000.85,1139.14L1001.38,1139.09L1001.06,1139.12ZM1002.26,1139L1002.01,1139.03L1002.54,1138.98L1002.26,1139ZM1003.47,1138.89L1003.18,1138.91L1003.7,1138.87L1003.47,1138.89ZM1004.68,1138.78L1004.34,1138.81L1004.86,1138.76L1004.68,1138.78ZM1005.89,1138.67L1005.52,1138.7L1006.02,1138.66L1005.89,1138.67ZM1007.1,1138.57L1006.71,1138.6L1007.18,1138.56L1007.1,1138.57ZM1008.31,1138.47L1007.96,1138.5L1008.35,1138.46L1008.31,1138.47ZM1009.52,1138.37L1009.5,1138.38L1009.72,1138.36L1009.52,1138.37ZM1010.73,1138.28L1010.67,1138.29L1011.1,1138.26L1010.73,1138.28ZM1011.94,1138.2L1011.84,1138.2L1012.32,1138.17L1011.94,1138.2ZM1013.16,1138.12L1013,1138.13L1013.51,1138.09L1013.16,1138.12ZM1014.37,1138.04L1014.17,1138.05L1014.69,1138.02L1014.37,1138.04ZM1015.59,1137.96L1015.35,1137.98L1015.86,1137.95L1015.59,1137.96ZM1016.81,1137.89L1016.52,1137.91L1017.04,1137.88L1016.81,1137.89ZM1018.03,1137.83L1017.7,1137.85L1018.21,1137.82L1018.03,1137.83ZM1019.25,1137.77L1018.89,1137.79L1019.39,1137.76L1019.25,1137.77ZM1020.47,1137.71L1020.1,1137.73L1020.56,1137.71L1020.47,1137.71ZM1021.69,1137.66L1021.36,1137.67L1021.74,1137.66L1021.69,1137.66ZM1022.92,1137.61L1022.91,1137.61L1023.02,1137.61L1022.92,1137.61ZM1024.14,1137.57L1024.09,1137.57L1024.49,1137.55L1024.14,1137.57ZM1025.37,1137.52L1025.27,1137.53L1025.74,1137.51L1025.37,1137.52ZM1026.6,1137.49L1026.45,1137.49L1026.94,1137.48L1026.6,1137.49ZM1027.82,1137.46L1027.63,1137.46L1028.14,1137.45L1027.82,1137.46ZM1029.05,1137.43L1028.81,1137.43L1029.33,1137.42L1029.05,1137.43ZM1030.28,1137.41L1030,1137.41L1030.52,1137.4L1030.28,1137.41ZM1031.51,1137.39L1031.19,1137.39L1031.7,1137.38L1031.51,1137.39ZM1032.75,1137.37L1032.39,1137.38L1032.89,1137.37L1032.75,1137.37ZM1033.98,1137.36L1033.61,1137.36L1034.07,1137.36L1033.98,1137.36ZM1035.21,1137.35L1034.87,1137.36L1035.26,1137.35L1035.21,1137.35ZM1050.1,1035.06L867.977,544.575L689.455,1035.06L1050.1,1035.06Z"})})});var Nte=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(Nte||{});const Dte=e=>{const t=(()=>{const{t:e}=HY();return a.exports.useMemo((()=>({0:{text:e("tooltip:feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},1:{text:e("tooltip:feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},2:{text:e("tooltip:feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},3:{text:e("tooltip:feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},4:{text:e("tooltip:feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},5:{text:e("tooltip:feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},6:{text:e("tooltip:feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},7:{text:e("tooltip:feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},8:{text:e("tooltip:feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},9:{text:e("tooltip:feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},10:{text:e("tooltip:feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}})),[e])})();return t[e]},zte=uV((e=>e.options),(e=>({facetoolStrength:e.facetoolStrength,facetoolType:e.facetoolType,codeformerFidelity:e.codeformerFidelity})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),Bte=uV((e=>e.system),(e=>({isGFPGANAvailable:e.isGFPGANAvailable})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),jte=()=>{const e=v5(),{facetoolStrength:t,facetoolType:n,codeformerFidelity:r}=y5(zte),{isGFPGANAvailable:o}=y5(Bte),{t:i}=HY();return cd(CI,{direction:"column",gap:2,children:[ld(L3,{label:i("options:type"),validValues:FQ.concat(),value:n,onChange:t=>e(HU(t.target.value))}),ld(O3,{isDisabled:!o,label:i("options:strength"),step:.05,min:0,max:1,onChange:t=>e(FU(t)),value:t,width:"90px",isInteger:!1}),"codeformer"===n&&ld(O3,{isDisabled:!o,label:i("options:codeformerFidelity"),step:.05,min:0,max:1,onChange:t=>e(BU(t)),value:r,width:"90px",isInteger:!1})]})};function Fte(){const e=y5((e=>e.system.isGFPGANAvailable)),t=y5((e=>e.options.shouldRunFacetool)),n=v5();return ld(E3,{isDisabled:!e,isChecked:t,onChange:e=>n(g$(e.target.checked))})}function Hte(){const e=v5(),t=y5((e=>e.options.shouldFitToWidthHeight)),{t:n}=HY();return ld(E3,{label:n("options:imageFit"),isChecked:t,onChange:t=>e(l$(t.target.checked))})}function Wte(e){const[t,n]=a.exports.useState(!1),{label:r,value:o,min:i=1,max:s=100,step:l=1,onChange:c,width:u="100%",tooltipSuffix:d="",withSliderMarks:h=!1,sliderMarkLeftOffset:f=0,sliderMarkRightOffset:p=-7,withInput:g=!1,isInteger:m=!1,inputWidth:v="5.5rem",inputReadOnly:y=!1,withReset:b=!1,hideTooltip:x=!1,isCompact:w=!1,handleReset:k,isResetDisabled:S,isSliderDisabled:C,isInputDisabled:_,styleClass:E,sliderFormControlProps:L,sliderFormLabelProps:P,sliderMarkProps:O,sliderTrackProps:M,sliderThumbProps:T,sliderNumberInputProps:A,sliderNumberInputFieldProps:I,sliderNumberInputStepperProps:R,sliderTooltipProps:N,sliderIAIIconButtonProps:D,...z}=e,[B,j]=a.exports.useState(String(o));a.exports.useEffect((()=>{j(o)}),[o]);const F=a.exports.useMemo((()=>A?.max?A.max:s),[s,A?.max]);return cd(GT,{className:E?`invokeai__slider-component ${E}`:"invokeai__slider-component","data-markers":h,style:w?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:"1rem",margin:0,padding:0}:{},...L,children:[ld(eA,{className:"invokeai__slider-component-label",...P,children:r}),cd(HI,{w:"100%",gap:2,alignItems:"center",children:[cd(ZF,{"aria-label":r,value:o,min:i,max:s,step:l,onChange:e=>{c(e)},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:C,width:u,...z,children:[h&&cd(sd,{children:[ld(JF,{value:i,className:"invokeai__slider-mark invokeai__slider-mark-start",ml:f,...O,children:i}),ld(JF,{value:s,className:"invokeai__slider-mark invokeai__slider-mark-end",ml:p,...O,children:s})]}),ld(KF,{className:"invokeai__slider_track",...M,children:ld(QF,{className:"invokeai__slider_track-filled"})}),ld(YH,{hasArrow:!0,className:"invokeai__slider-component-tooltip",placement:"top",isOpen:t,label:`${o}${d}`,hidden:x,...N,children:ld(XF,{className:"invokeai__slider-thumb",...T})})]}),g&&cd(fj,{min:i,max:F,step:l,value:B,onChange:e=>{j(e)},onBlur:e=>{""===e.target.value&&(e.target.value=String(i));const t=A$.clamp(m?Math.floor(Number(e.target.value)):Number(B),i,F);c(t)},className:"invokeai__slider-number-field",isDisabled:_,...A,children:[ld(gj,{className:"invokeai__slider-number-input",width:v,readOnly:y,minWidth:v,...I}),cd(pj,{...R,children:[ld(yj,{onClick:()=>c(Number(B)),className:"invokeai__slider-number-stepper"}),ld(vj,{onClick:()=>c(Number(B)),className:"invokeai__slider-number-stepper"})]})]}),b&&ld(S3,{size:"sm","aria-label":"Reset",tooltip:"Reset",icon:ld(T9,{}),onClick:()=>{k&&k()},isDisabled:S,...D})]})]})}function Vte(e){const{t:t}=HY(),{label:n=`${t("options:strength")}`,styleClass:r}=e,o=y5((e=>e.options.img2imgStrength)),i=v5();return ld(Wte,{label:n,step:.01,min:.01,max:.99,onChange:e=>i(UU(e)),value:o,isInteger:!1,styleClass:r,withInput:!0,withSliderMarks:!0,inputWidth:"5.5rem",withReset:!0,handleReset:()=>{i(UU(.75))}})}const Ute=()=>{const e=v5(),t=y5((e=>e.options.seamless)),{t:n}=HY();return ld(CI,{gap:2,direction:"column",children:ld(E3,{label:n("options:seamlessTiling"),fontSize:"md",isChecked:t,onChange:t=>e(n$(t.target.checked))})})},$te=()=>ld(CI,{gap:2,direction:"column",children:ld(Ute,{})});function Gte(){const e=v5(),{t:t}=HY(),n=y5((e=>e.options.shouldRandomizeSeed));return ld(E3,{label:t("options:randomizeSeed"),isChecked:n,onChange:t=>e(f$(t.target.checked))})}function qte(){const e=y5((e=>e.options.seed)),t=y5((e=>e.options.shouldRandomizeSeed)),n=y5((e=>e.options.shouldGenerateVariations)),{t:r}=HY(),o=v5();return ld(O3,{label:r("options:seed"),step:1,precision:0,flexGrow:1,min:0,max:jQ,isDisabled:t,isInvalid:e<0&&n,onChange:e=>o(a$(e)),value:e,width:"auto"})}function Yte(){const e=v5(),t=y5((e=>e.options.shouldRandomizeSeed)),{t:n}=HY();return ld(RT,{size:"sm",isDisabled:t,onClick:()=>e(a$(WQ(0,jQ))),padding:"0 1.5rem",children:ld("p",{children:n("options:shuffle")})})}function Zte(){const e=v5(),t=y5((e=>e.options.threshold)),{t:n}=HY();return ld(O3,{label:n("options:noiseThreshold"),min:0,max:1e3,step:.1,onChange:t=>e(w$(t)),value:t,isInteger:!1})}function Xte(){const e=v5(),t=y5((e=>e.options.perlin)),{t:n}=HY();return ld(O3,{label:n("options:perlinNoise"),min:0,max:1,step:.05,onChange:t=>e(QU(t)),value:t,isInteger:!1})}const Kte=()=>cd(CI,{gap:2,direction:"column",children:[ld(Gte,{}),cd(CI,{gap:2,children:[ld(qte,{}),ld(Yte,{})]}),ld(CI,{gap:2,children:ld(Zte,{})}),ld(CI,{gap:2,children:ld(Xte,{})})]}),Qte=uV((e=>e.options),(e=>({upscalingLevel:e.upscalingLevel,upscalingStrength:e.upscalingStrength})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),Jte=uV((e=>e.system),(e=>({isESRGANAvailable:e.isESRGANAvailable})),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),ene=()=>{const e=v5(),{upscalingLevel:t,upscalingStrength:n}=y5(Qte),{isESRGANAvailable:r}=y5(Jte),{t:o}=HY();return cd("div",{className:"upscale-options",children:[ld(L3,{isDisabled:!r,label:o("options:scale"),value:t,onChange:t=>e(S$(Number(t.target.value))),validValues:BQ}),ld(O3,{isDisabled:!r,label:o("options:strength"),step:.05,min:0,max:1,onChange:t=>e(C$(t)),value:n,isInteger:!1})]})};function tne(){const e=y5((e=>e.system.isESRGANAvailable)),t=y5((e=>e.options.shouldRunESRGAN)),n=v5();return ld(E3,{isDisabled:!e,isChecked:t,onChange:e=>n(p$(e.target.checked))})}function nne(){const e=y5((e=>e.options.shouldGenerateVariations)),t=v5();return ld(E3,{isChecked:e,width:"auto",onChange:e=>t(c$(e.target.checked))})}function rne(){const e=y5((e=>e.options.seedWeights)),t=y5((e=>e.options.shouldGenerateVariations)),{t:n}=HY(),r=v5();return ld(V3,{label:n("options:seedWeights"),value:e,isInvalid:t&&!(_U(e)||""===e),isDisabled:!t,onChange:e=>r(s$(e.target.value))})}function one(){const e=y5((e=>e.options.variationAmount)),t=y5((e=>e.options.shouldGenerateVariations)),{t:n}=HY(),r=v5();return ld(O3,{label:n("options:variationAmount"),value:e,step:.01,min:0,max:1,isDisabled:!t,onChange:e=>r(_$(e)),isInteger:!1})}const ine=()=>cd(CI,{gap:2,direction:"column",children:[ld(one,{}),ld(rne,{})]});function ane(){const e=v5(),t=y5((e=>e.options.cfgScale)),{t:n}=HY();return ld(O3,{label:n("options:cfgScale"),step:.5,min:1.01,max:200,onChange:t=>e(zU(t)),value:t,width:"auto",styleClass:"main-option-block",textAlign:"center",isInteger:!1})}function sne(){const e=y5((e=>e.options.height)),t=y5(A3),n=v5(),{t:r}=HY();return ld(L3,{isDisabled:"unifiedCanvas"===t,label:r("options:height"),value:e,flexGrow:1,onChange:e=>n(WU(Number(e.target.value))),validValues:zQ,styleClass:"main-option-block"})}const lne=uV([e=>e.options],(e=>{const{iterations:t}=e;return{iterations:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function cne(){const e=v5(),{iterations:t}=y5(lne),{t:n}=HY();return ld(O3,{label:n("options:images"),step:1,min:1,max:9999,onChange:t=>e(YU(t)),value:t,width:"auto",labelFontSize:.5,styleClass:"main-option-block",textAlign:"center"})}function une(){const e=y5((e=>e.options.sampler)),t=v5(),{t:n}=HY();return ld(L3,{label:n("options:sampler"),value:e,onChange:e=>t(e$(e.target.value)),validValues:NQ,styleClass:"main-option-block"})}function dne(){const e=v5(),t=y5((e=>e.options.steps)),{t:n}=HY();return ld(O3,{label:n("options:steps"),min:1,max:9999,step:1,onChange:t=>e(x$(t)),value:t,width:"auto",styleClass:"main-option-block",textAlign:"center"})}function hne(){const e=y5((e=>e.options.width)),t=y5(A3),{t:n}=HY(),r=v5();return ld(L3,{isDisabled:"unifiedCanvas"===t,label:n("options:width"),value:e,flexGrow:1,onChange:e=>r(E$(Number(e.target.value))),validValues:DQ,styleClass:"main-option-block"})}function fne(){return ld("div",{className:"main-options",children:cd("div",{className:"main-options-list",children:[cd("div",{className:"main-options-row",children:[ld(cne,{}),ld(dne,{}),ld(ane,{})]}),cd("div",{className:"main-options-row",children:[ld(hne,{}),ld(sne,{}),ld(une,{})]})]})})}const pne=uV((e=>e.system),(e=>e.shouldDisplayGuides)),gne=({children:e,feature:t})=>{const n=y5(pne),{text:r}=Dte(t);return n?cd(Aj,{trigger:"hover",children:[ld(Wj,{children:ld(mI,{children:e})}),cd(Fj,{className:"guide-popover-content",maxWidth:"400px",onClick:e=>e.preventDefault(),cursor:"initial",children:[ld(Ij,{className:"guide-popover-arrow"}),ld("div",{className:"guide-popover-guide-content",children:r})]})]}):null},mne=ok((({feature:e,icon:t=G3},n)=>ld(gne,{feature:e,children:ld(mI,{ref:n,children:ld(kk,{marginBottom:"-.15rem",as:t})})})));function vne(e){const{header:t,feature:n,content:r,additionalHeaderComponents:o}=e;return cd(lT,{className:"advanced-settings-item",children:[ld(nT,{className:"advanced-settings-header",children:cd(CI,{width:"100%",gap:"0.5rem",align:"center",children:[ld(mI,{flexGrow:1,textAlign:"left",children:t}),o,n&&ld(mne,{feature:n}),ld(sT,{})]})}),ld(cT,{className:"advanced-settings-panel",children:r})]})}const yne=e=>{const{accordionInfo:t}=e,n=y5((e=>e.system.openAccordions)),r=v5();return ld(uT,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:e=>r(XY(e)),className:"advanced-settings",children:(()=>{const e=[];return t&&Object.keys(t).forEach((n=>{const{header:r,feature:o,content:i,additionalHeaderComponents:a}=t[n];e.push(ld(vne,{header:r,feature:o,content:i,additionalHeaderComponents:a},n))})),e})()})},bne=e=>e.canvas,xne=uV([bne,A3,M3],((e,t,n)=>e.layerState.stagingArea.images.length>0||"unifiedCanvas"===t&&n.isProcessing)),wne=e=>e.canvas.layerState.objects.find(LZ),kne=uV([e=>e.options,e=>e.system,wne,A3],((e,t,n,r)=>{const{prompt:o,shouldGenerateVariations:i,seedWeights:a,initialImage:s,seed:l}=e,{isProcessing:c,isConnected:u}=t;let d=!0;const h=[];return o&&!Boolean(o.match(/^[\s\r\n]+$/))||(d=!1,h.push("Missing prompt")),"img2img"!==r||s||(d=!1,h.push("No initial image selected")),c&&(d=!1,h.push("System Busy")),u||(d=!1,h.push("System Disconnected")),i&&(!_U(a)&&""!==a||-1===l)&&(d=!1,h.push("Seed-Weights badly formatted.")),{isReady:d,reasonsWhyNotReady:h}}),{memoizeOptions:{equalityCheck:A$.isEqual,resultEqualityCheck:A$.isEqual}});function Sne(e){const{iconButton:t=!1,...n}=e,r=v5(),{isReady:o}=y5(kne),i=y5(A3),a=()=>{r(wQ(i))},{t:s}=HY();return Cte(["ctrl+enter","meta+enter"],(()=>{r(wQ(i))}),{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,i]),ld("div",{style:{flexGrow:4},children:t?ld(S3,{"aria-label":s("options:invoke"),type:"submit",icon:ld(a3,{}),isDisabled:!o,onClick:a,className:"invoke-btn",tooltip:s("options:invoke"),tooltipProps:{placement:"bottom"},...n}):ld(j3,{"aria-label":s("options:invoke"),type:"submit",isDisabled:!o,onClick:a,className:"invoke-btn",...n,children:"Invoke"})})}const Cne=uV((e=>e.system),(e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable})),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function _ne(e){const{...t}=e,n=v5(),{isProcessing:r,isConnected:o,isCancelable:i}=y5(Cne),a=()=>n(LQ()),{t:s}=HY();return Cte("shift+x",(()=>{(o||r)&&i&&a()}),[o,r,i]),ld(S3,{icon:ld(K3,{}),tooltip:s("options:cancel"),"aria-label":s("options:cancel"),isDisabled:!o||!r||!i,onClick:a,styleClass:"cancel-btn",...t})}const Ene=uV((e=>e.options),(e=>e.shouldLoopback)),Lne=()=>{const e=v5(),t=y5(Ene),{t:n}=HY();return ld(S3,{"aria-label":n("options:toggleLoopback"),tooltip:n("options:toggleLoopback"),styleClass:"loopback-btn",asCheckbox:!0,isChecked:t,icon:ld(c3,{}),onClick:()=>{e(d$(!t))}})},Pne=()=>{const e=y5(A3);return cd("div",{className:"process-buttons",children:[ld(Sne,{}),"img2img"===e&&ld(Lne,{}),ld(_ne,{})]})},One=uV([e=>e.options,A3],((e,t)=>({prompt:e.prompt,activeTabName:t})),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Mne=()=>{const e=v5(),{prompt:t,activeTabName:n}=y5(One),{isReady:r}=y5(kne),o=a.exports.useRef(null),{t:i}=HY();Cte("alt+a",(()=>{o.current?.focus()}),[]);return ld("div",{className:"prompt-bar",children:ld(GT,{isInvalid:0===t.length||Boolean(t.match(/^[\s\r\n]+$/)),children:ld(_H,{id:"prompt",name:"prompt",placeholder:i("options:promptPlaceholder"),size:"lg",value:t,onChange:t=>{e(JU(t.target.value))},onKeyDown:t=>{"Enter"===t.key&&!1===t.shiftKey&&r&&(t.preventDefault(),e(wQ(n)))},resize:"vertical",height:30,ref:o,_placeholder:{color:"var(--text-color-secondary)"}})})})};function Tne(e){return E5({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function Ane(e){return E5({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function Ine(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}const Rne=!1,Nne=H.createContext(null);var Dne=function(e){return e.scrollTop},zne="unmounted",Bne="exited",jne="entering",Fne="entered",Hne="exiting",Wne=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,i=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?i?(o=Bne,r.appearStatus=jne):o=Fne:o=t.unmountOnExit||t.mountOnEnter?zne:Bne,r.state={status:o},r.nextCallback=null,r}DD(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===zne?{status:Bne}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==jne&&n!==Fne&&(t=jne):n!==jne&&n!==Fne||(t=Hne)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===jne){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:Zu.findDOMNode(this);n&&Dne(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Bne&&this.setState({status:zne})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[Zu.findDOMNode(this),r],i=o[0],a=o[1],s=this.getTimeouts(),l=r?s.appear:s.enter;!e&&!n||Rne?this.safeSetState({status:Fne},(function(){t.props.onEntered(i)})):(this.props.onEnter(i,a),this.safeSetState({status:jne},(function(){t.props.onEntering(i,a),t.onTransitionEnd(l,(function(){t.safeSetState({status:Fne},(function(){t.props.onEntered(i,a)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:Zu.findDOMNode(this);t&&!Rne?(this.props.onExit(r),this.safeSetState({status:Hne},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:Bne},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:Bne},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Zu.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],i=o[0],a=o[1];this.props.addEndListener(i,a)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===zne)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=gD(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return ld(Nne.Provider,{value:null,children:"function"==typeof n?n(e,r):H.cloneElement(H.Children.only(n),r)})},t}(H.Component);function Vne(){}Wne.contextType=Nne,Wne.propTypes={},Wne.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Vne,onEntering:Vne,onEntered:Vne,onExit:Vne,onExiting:Vne,onExited:Vne},Wne.UNMOUNTED=zne,Wne.EXITED=Bne,Wne.ENTERING=jne,Wne.ENTERED=Fne,Wne.EXITING=Hne;const Une=Wne;var $ne=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r}))},Gne=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=Ine(n.className,r):n.setAttribute("class",Ine(n.className&&n.className.baseVal||"",r)));var n,r}))},qne=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;oe.options),(e=>{const{shouldShowOptionsPanel:t,shouldHoldOptionsPanelOpen:n,shouldPinOptionsPanel:r,optionsPanelScrollPosition:o}=e;return{shouldShowOptionsPanel:t,shouldHoldOptionsPanelOpen:n,shouldPinOptionsPanel:r,optionsPanelScrollPosition:o}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Xne=e=>{const t=v5(),{shouldShowOptionsPanel:n,shouldHoldOptionsPanelOpen:r,shouldPinOptionsPanel:o}=y5(Zne),i=a.exports.useRef(null),s=a.exports.useRef(null),l=a.exports.useRef(null),{children:c}=e;Cte("o",(()=>{t(v$(!n)),o&&setTimeout((()=>t(aX(!0))),400)}),[n,o]),Cte("esc",(()=>{t(v$(!1))}),{enabled:()=>!o,preventDefault:!0},[o]),Cte("shift+o",(()=>{h(),t(aX(!0))}),[o]);const u=a.exports.useCallback((()=>{o||(t(XU(s.current?s.current.scrollTop:0)),t(v$(!1)),t(u$(!1)))}),[t,o]),d=()=>{l.current&&window.clearTimeout(l.current)},h=()=>{t(h$(!o)),t(aX(!0))};return a.exports.useEffect((()=>{function e(e){i.current&&!i.current.contains(e.target)&&u()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[u]),ld(Yne,{nodeRef:i,in:n||r&&!o,unmountOnExit:!0,timeout:200,classNames:"options-panel-wrapper",children:ld("div",{className:"options-panel-wrapper","data-pinned":o,tabIndex:1,ref:i,onMouseEnter:o?void 0:d,onMouseOver:o?void 0:d,style:{borderRight:o?"":"0.3rem solid var(--tab-list-text-inactive)"},children:ld("div",{className:"options-panel-margin",children:cd("div",{className:"options-panel",ref:s,onMouseLeave:e=>{e.target!==s.current?d():!o&&(l.current=window.setTimeout((()=>u()),500))},children:[ld(YH,{label:"Pin Options Panel",children:ld("div",{className:"options-panel-pin-button","data-selected":o,onClick:h,children:ld(o?Tne:Ane,{})})}),!o&&cd("div",{className:"invoke-ai-logo-wrapper",children:[ld("img",{src:k3,alt:"invoke-ai-logo"}),cd("h1",{children:["invoke ",ld("strong",{children:"ai"})]})]}),c]})})})})};function Kne(){const{t:e}=HY(),t={seed:{header:`${e("options:seed")}`,feature:Nte.SEED,content:ld(Kte,{})},variations:{header:`${e("options:variations")}`,feature:Nte.VARIATIONS,content:ld(ine,{}),additionalHeaderComponents:ld(nne,{})},face_restore:{header:`${e("options:faceRestoration")}`,feature:Nte.FACE_CORRECTION,content:ld(jte,{}),additionalHeaderComponents:ld(Fte,{})},upscale:{header:`${e("options:upscaling")}`,feature:Nte.UPSCALE,content:ld(ene,{}),additionalHeaderComponents:ld(tne,{})},other:{header:`${e("options:otherOptions")}`,feature:Nte.OTHER,content:ld($te,{})}},n=v5(),r=y5(A3);return a.exports.useEffect((()=>{if("img2img"===r){(()=>n(VU(!1)))()}}),[r,n]),cd(Xne,{children:[ld(Mne,{}),ld(Pne,{}),ld(fne,{}),ld(Vte,{label:e("options:img2imgStrength"),styleClass:"main-option-block image-to-image-strength-main-option"}),ld(Hte,{}),ld(yne,{accordionInfo:t})]})}const Qne=a.exports.createContext(null),Jne=e=>{const{styleClass:t}=e,n=a.exports.useContext(Qne);return ld("div",{className:`image-uploader-button-outer ${t}`,onClick:()=>{n&&n()},children:cd("div",{className:"image-upload-button",children:[ld(b3,{}),ld(PI,{size:"lg",children:"Click or Drag and Drop"})]})})},ere=uV((e=>e.system),(e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),tre=a.exports.forwardRef((({image:e,children:t},n)=>{const{isOpen:r,onOpen:o,onClose:i}=QA(),s=v5(),{shouldConfirmOnDelete:l,isConnected:c,isProcessing:u}=y5(ere),d=a.exports.useRef(null),h=()=>{c&&!u&&e&&s(CQ(e)),i()};Cte("delete",(()=>{l?o():h()}),[e,l]);return cd(sd,{children:[a.exports.cloneElement(t,{onClick:e?e=>{e.stopPropagation(),l?o():h()}:void 0,ref:n}),ld(qB,{isOpen:r,leastDestructiveRef:d,onClose:i,children:ld(GB,{children:cd(YB,{className:"modal",children:[ld(UB,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),ld(NB,{children:cd(CI,{direction:"column",gap:5,children:[ld(VI,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),ld(GT,{children:cd(CI,{alignItems:"center",children:[ld(eA,{mb:0,children:"Don't ask me again"}),ld(nH,{checked:!l,onChange:e=>s(ZY(!e.target.checked))})]})})]})}),cd(VB,{children:[ld(RT,{ref:d,onClick:i,className:"modal-close-btn",children:"Cancel"}),ld(RT,{colorScheme:"red",onClick:h,ml:3,children:"Delete"})]})]})})})]})})),nre=uV([e=>e.system,e=>e.options,e=>e.gallery,A3],((e,t,n,r)=>{const{isProcessing:o,isConnected:i,isGFPGANAvailable:a,isESRGANAvailable:s}=e,{upscalingLevel:l,facetoolStrength:c,shouldShowImageDetails:u,isLightBoxOpen:d}=t,{intermediateImage:h,currentImage:f}=n;return{isProcessing:o,isConnected:i,isGFPGANAvailable:a,isESRGANAvailable:s,upscalingLevel:l,facetoolStrength:c,shouldDisableToolbarButtons:Boolean(h)||!f,currentImage:f,shouldShowImageDetails:u,activeTabName:r,isLightBoxOpen:d}}),{memoizeOptions:{resultEqualityCheck:T$.exports.isEqual}}),rre=()=>{const e=v5(),{isProcessing:t,isConnected:n,isGFPGANAvailable:r,isESRGANAvailable:o,upscalingLevel:i,facetoolStrength:a,shouldDisableToolbarButtons:s,shouldShowImageDetails:l,currentImage:c,isLightBoxOpen:u,activeTabName:d}=y5(nre),h=zH(),{t:f}=HY(),p=()=>{c&&(u&&e(qU(!1)),e(GU(c)),e(IU("img2img")))};Cte("shift+i",(()=>{c?(p(),h({title:f("toast:sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:imageNotLoaded"),description:f("toast:imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const g=()=>{c&&(c.metadata&&e(NU(c.metadata)),"img2img"===c.metadata?.image.type?e(IU("img2img")):"txt2img"===c.metadata?.image.type&&e(IU("txt2img")))};Cte("a",(()=>{["txt2img","img2img"].includes(c?.metadata?.image?.type)?(g(),h({title:f("toast:parametersSet"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:parametersNotSet"),description:f("toast:parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const m=()=>{c?.metadata&&e(a$(c.metadata.image.seed))};Cte("s",(()=>{c?.metadata?.image?.seed?(m(),h({title:f("toast:seedSet"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:seedNotSet"),description:f("toast:seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const v=()=>c?.metadata?.image?.prompt&&e(JU(c.metadata.image.prompt));Cte("p",(()=>{c?.metadata?.image?.prompt?(v(),h({title:f("toast:promptSet"),status:"success",duration:2500,isClosable:!0})):h({title:f("toast:promptNotSet"),description:f("toast:promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})}),[c]);const y=()=>{c&&e(kQ(c))};Cte("Shift+U",(()=>{o&&!s&&n&&!t&&i?y():h({title:f("toast:upscalingFailed"),status:"error",duration:2500,isClosable:!0})}),[c,o,s,n,t,i]);const b=()=>{c&&e(SQ(c))};Cte("Shift+R",(()=>{r&&!s&&n&&!t&&a?b():h({title:f("toast:faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})}),[c,r,s,n,t,a]);const x=()=>e(m$(!l));Cte("i",(()=>{c?x():h({title:f("toast:metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})}),[c,l]);return cd("div",{className:"current-image-options",children:[cd(DT,{isAttached:!0,children:[ld(B3,{trigger:"hover",triggerComponent:ld(S3,{"aria-label":`${f("options:sendTo")}...`,icon:ld(f3,{})}),children:cd("div",{className:"current-image-send-to-popover",children:[ld(j3,{size:"sm",onClick:p,leftIcon:ld(p3,{}),children:f("options:sendToImg2Img")}),ld(j3,{size:"sm",onClick:()=>{c&&(u&&e(qU(!1)),e(sX(c)),e(aX(!0)),"unifiedCanvas"!==d&&e(IU("unifiedCanvas")),h({title:f("toast:sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))},leftIcon:ld(p3,{}),children:f("options:sendToUnifiedCanvas")}),ld(j3,{size:"sm",onClick:()=>{navigator.clipboard.writeText(c?window.location.toString()+c.url:"").then((()=>{h({title:f("toast:imageLinkCopied"),status:"success",duration:2500,isClosable:!0})}))},leftIcon:ld(F5,{}),children:f("options:copyImageToLink")}),ld(j3,{leftIcon:ld(V5,{}),size:"sm",children:ld(MI,{download:!0,href:c?.url,children:f("options:downloadImage")})})]})}),ld(S3,{icon:ld(G5,{}),tooltip:u?`${f("options:closeViewer")} (Z)`:`${f("options:openInViewer")} (Z)`,"aria-label":u?`${f("options:closeViewer")} (Z)`:`${f("options:openInViewer")} (Z)`,"data-selected":u,onClick:()=>{e(qU(!u))}})]}),cd(DT,{isAttached:!0,children:[ld(S3,{icon:ld(l3,{}),tooltip:`${f("options:usePrompt")} (P)`,"aria-label":`${f("options:usePrompt")} (P)`,isDisabled:!c?.metadata?.image?.prompt,onClick:v}),ld(S3,{icon:ld(h3,{}),tooltip:`${f("options:useSeed")} (S)`,"aria-label":`${f("options:useSeed")} (S)`,isDisabled:!c?.metadata?.image?.seed,onClick:m}),ld(S3,{icon:ld(D5,{}),tooltip:`${f("options:useAll")} (A)`,"aria-label":`${f("options:useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes(c?.metadata?.image?.type),onClick:g})]}),cd(DT,{isAttached:!0,children:[ld(B3,{trigger:"hover",triggerComponent:ld(S3,{icon:ld(K5,{}),"aria-label":f("options:restoreFaces")}),children:cd("div",{className:"current-image-postprocessing-popover",children:[ld(jte,{}),ld(j3,{isDisabled:!(r&&c&&n&&!t&&a),onClick:b,children:f("options:restoreFaces")})]})}),ld(B3,{trigger:"hover",triggerComponent:ld(S3,{icon:ld($5,{}),"aria-label":f("options:upscale")}),children:cd("div",{className:"current-image-postprocessing-popover",children:[ld(ene,{}),ld(j3,{isDisabled:!(o&&c&&n&&!t&&i),onClick:y,children:f("options:upscaleImage")})]})})]}),ld(DT,{isAttached:!0,children:ld(S3,{icon:ld(j5,{}),tooltip:`${f("options:info")} (I)`,"aria-label":`${f("options:info")} (I)`,"data-selected":l,onClick:x})}),ld(tre,{image:c,children:ld(S3,{icon:ld(v3,{}),tooltip:`${f("options:deleteImage")} (Del)`,"aria-label":`${f("options:deleteImage")} (Del)`,isDisabled:!c||!n||t,style:{backgroundColor:"var(--btn-delete-image)"}})})]})};function ore(e){return E5({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const ire=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:i=!1})=>cd(CI,{gap:2,children:[n&&ld(YH,{label:`Recall ${e}`,children:ld(zT,{"aria-label":"Use this parameter",icon:ld(ore,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),i&&ld(YH,{label:`Copy ${e}`,children:ld(zT,{"aria-label":`Copy ${e}`,icon:ld(F5,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),cd(CI,{direction:o?"column":"row",children:[cd(VI,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?cd(MI,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",ld(q9,{mx:"2px"})]}):ld(VI,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}),are=a.exports.memo((({image:e,styleClass:t})=>{const n=v5();Cte("esc",(()=>{n(m$(!1))}));const r=e?.metadata?.image||{},o=e?.dreamPrompt,{cfg_scale:i,fit:a,height:s,hires_fix:l,init_image_path:c,mask_image_path:u,orig_path:d,perlin:h,postprocessing:f,prompt:p,sampler:g,scale:m,seamless:v,seed:y,steps:b,strength:x,threshold:w,type:k,variations:S,width:C}=r,_=JSON.stringify(e.metadata,null,2);return ld("div",{className:`image-metadata-viewer ${t}`,children:cd(CI,{gap:1,direction:"column",width:"100%",children:[cd(CI,{gap:2,children:[ld(VI,{fontWeight:"semibold",children:"File:"}),cd(MI,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,ld(q9,{mx:"2px"})]})]}),Object.keys(r).length>0?cd(sd,{children:[k&&ld(ire,{label:"Generation type",value:k}),e.metadata?.model_weights&&ld(ire,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(k)&&ld(ire,{label:"Original image",value:d}),"gfpgan"===k&&void 0!==x&&ld(ire,{label:"Fix faces strength",value:x,onClick:()=>n(FU(x))}),"esrgan"===k&&void 0!==m&&ld(ire,{label:"Upscaling scale",value:m,onClick:()=>n(S$(m))}),"esrgan"===k&&void 0!==x&&ld(ire,{label:"Upscaling strength",value:x,onClick:()=>n(C$(x))}),p&&ld(ire,{label:"Prompt",labelPosition:"top",value:CU(p),onClick:()=>n(JU(p))}),void 0!==y&&ld(ire,{label:"Seed",value:y,onClick:()=>n(a$(y))}),void 0!==w&&ld(ire,{label:"Noise Threshold",value:w,onClick:()=>n(w$(w))}),void 0!==h&&ld(ire,{label:"Perlin Noise",value:h,onClick:()=>n(QU(h))}),g&&ld(ire,{label:"Sampler",value:g,onClick:()=>n(e$(g))}),b&&ld(ire,{label:"Steps",value:b,onClick:()=>n(x$(b))}),void 0!==i&&ld(ire,{label:"CFG scale",value:i,onClick:()=>n(zU(i))}),S&&S.length>0&&ld(ire,{label:"Seed-weight pairs",value:EU(S),onClick:()=>n(s$(EU(S)))}),v&&ld(ire,{label:"Seamless",value:v,onClick:()=>n(n$(v))}),l&&ld(ire,{label:"High Resolution Optimization",value:l,onClick:()=>n(VU(l))}),C&&ld(ire,{label:"Width",value:C,onClick:()=>n(E$(C))}),s&&ld(ire,{label:"Height",value:s,onClick:()=>n(WU(s))}),c&&ld(ire,{label:"Initial image",value:c,isLink:!0,onClick:()=>n(GU(c))}),u&&ld(ire,{label:"Mask image",value:u,isLink:!0,onClick:()=>n(ZU(u))}),"img2img"===k&&x&&ld(ire,{label:"Image to image strength",value:x,onClick:()=>n(UU(x))}),a&&ld(ire,{label:"Image to image fit",value:a,onClick:()=>n(l$(a))}),f&&f.length>0&&cd(sd,{children:[ld(PI,{size:"sm",children:"Postprocessing"}),f.map(((e,t)=>{if("esrgan"===e.type){const{scale:r,strength:o}=e;return cd(CI,{pl:"2rem",gap:1,direction:"column",children:[ld(VI,{size:"md",children:`${t+1}: Upscale (ESRGAN)`}),ld(ire,{label:"Scale",value:r,onClick:()=>n(S$(r))}),ld(ire,{label:"Strength",value:o,onClick:()=>n(C$(o))})]},t)}if("gfpgan"===e.type){const{strength:r}=e;return cd(CI,{pl:"2rem",gap:1,direction:"column",children:[ld(VI,{size:"md",children:`${t+1}: Face restoration (GFPGAN)`}),ld(ire,{label:"Strength",value:r,onClick:()=>{n(FU(r)),n(HU("gfpgan"))}})]},t)}if("codeformer"===e.type){const{strength:r,fidelity:o}=e;return cd(CI,{pl:"2rem",gap:1,direction:"column",children:[ld(VI,{size:"md",children:`${t+1}: Face restoration (Codeformer)`}),ld(ire,{label:"Strength",value:r,onClick:()=>{n(FU(r)),n(HU("codeformer"))}}),o&&ld(ire,{label:"Fidelity",value:o,onClick:()=>{n(BU(o)),n(HU("codeformer"))}})]},t)}}))]}),o&&ld(ire,{withCopy:!0,label:"Dream Prompt",value:o}),cd(CI,{gap:2,direction:"column",children:[cd(CI,{gap:2,children:[ld(YH,{label:"Copy metadata JSON",children:ld(zT,{"aria-label":"Copy metadata JSON",icon:ld(F5,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(_)})}),ld(VI,{fontWeight:"semibold",children:"Metadata JSON:"})]}),ld("div",{className:"image-json-viewer",children:ld("pre",{children:_})})]})]}):ld(bI,{width:"100%",pt:10,children:ld(VI,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})}),((e,t)=>e.image.uuid===t.image.uuid)),sre=uV([e=>e.gallery,e=>e.options],((e,t)=>{const{currentCategory:n,currentImage:r,intermediateImage:o}=e,{shouldShowImageDetails:i}=t,a=e.categories[r?r.category:"result"].images,s=a.findIndex((t=>t.uuid===e?.currentImage?.uuid)),l=a.length;return{imageToDisplay:o||r,isIntermediate:Boolean(o),viewerImageToDisplay:r,currentCategory:n,isOnFirstImage:0===s,isOnLastImage:!isNaN(s)&&s===l-1,shouldShowImageDetails:i,shouldShowPrevImageButton:0===s,shouldShowNextImageButton:!isNaN(s)&&s===l-1}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function lre(){const e=v5(),{isOnFirstImage:t,isOnLastImage:n,shouldShowImageDetails:r,imageToDisplay:o,isIntermediate:i}=y5(sre),[s,l]=a.exports.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)};return cd("div",{className:"current-image-preview",children:[o&&ld(ET,{src:o.url,width:o.width,height:o.height,style:{imageRendering:i?"pixelated":"initial"}}),!r&&cd("div",{className:"current-image-next-prev-buttons",children:[ld("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!t&&ld(zT,{"aria-label":"Previous image",icon:ld(T5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(H$())}})}),ld("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!n&&ld(zT,{"aria-label":"Next image",icon:ld(A5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(F$())}})})]}),r&&o&&ld(are,{image:o,styleClass:"current-image-metadata"})]})}const cre=uV([e=>e.gallery,e=>e.options,A3],((e,t,n)=>{const{currentImage:r,intermediateImage:o}=e,{shouldShowImageDetails:i}=t;return{activeTabName:n,shouldShowImageDetails:i,hasAnImageToDisplay:r||o}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),ure=()=>{const{hasAnImageToDisplay:e,activeTabName:t}=y5(cre);return ld("div",{className:"current-image-area","data-tab-name":t,children:e?cd(sd,{children:[ld(rre,{}),ld(lre,{})]}):ld("div",{className:"current-image-display-placeholder",children:ld(X3,{})})})},dre=()=>{const e=a.exports.useContext(Qne);return ld(S3,{"aria-label":"Upload Image",tooltip:"Upload Image",icon:ld(b3,{}),onClick:e||void 0})};function hre(){const e=y5((e=>e.options.initialImage)),{t:t}=HY(),n=v5(),r=zH();return cd(sd,{children:[cd("div",{className:"init-image-preview-header",children:[ld("h2",{children:t("options:initialImage")}),ld(dre,{})]}),e&&ld("div",{className:"init-image-preview",children:ld(ET,{fit:"contain",maxWidth:"100%",maxHeight:"100%",src:"string"==typeof e?e:e.url,onError:()=>{r({title:t("toast:parametersFailed"),description:t("toast:parametersFailedDesc"),status:"error",isClosable:!0}),n(MU())}})})]})}const fre=()=>{const e=y5((e=>e.options.initialImage)),{currentImage:t}=y5((e=>e.gallery));return cd("div",{className:"workarea-split-view",children:[ld("div",{className:"workarea-split-view-left",children:e?ld("div",{className:"image-to-image-area",children:ld(hre,{})}):ld(Jne,{})}),t&&ld("div",{className:"workarea-split-view-right",children:ld(ure,{})})]})};function pre(e){return E5({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14 1H3L2 2v11l1 1h11l1-1V2l-1-1zM8 13H3V2h5v11zm6 0H9V2h5v11z"}}]})(e)}function gre(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function mre(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>a.exports.createContext(e)));return function(n){const r=(null==n?void 0:n[e])||t;return a.exports.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=a.exports.createContext(r),i=n.length;function s(t){const{scope:n,children:r,...s}=t,l=(null==n?void 0:n[e][i])||o,c=a.exports.useMemo((()=>s),Object.values(s));return a.exports.createElement(l.Provider,{value:c},r)}return n=[...n,r],s.displayName=t+"Provider",[s,function(n,s){const l=(null==s?void 0:s[e][i])||o,c=a.exports.useContext(l);if(c)return c;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},vre(r,...t)]}function vre(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return a.exports.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function yre(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function bre(...e){return a.exports.useCallback(yre(...e),e)}const xre=a.exports.forwardRef(((e,t)=>{const{children:n,...r}=e,o=a.exports.Children.toArray(n),i=o.find(Sre);if(i){const e=i.props.children,n=o.map((t=>t===i?a.exports.Children.count(e)>1?a.exports.Children.only(null):a.exports.isValidElement(e)?e.props.children:null:t));return a.exports.createElement(wre,vp({},r,{ref:t}),a.exports.isValidElement(e)?a.exports.cloneElement(e,void 0,n):null)}return a.exports.createElement(wre,vp({},r,{ref:t}),n)}));xre.displayName="Slot";const wre=a.exports.forwardRef(((e,t)=>{const{children:n,...r}=e;return a.exports.isValidElement(n)?a.exports.cloneElement(n,{...Cre(r,n.props),ref:yre(t,n.ref)}):a.exports.Children.count(n)>1?a.exports.Children.only(null):null}));wre.displayName="SlotClone";const kre=({children:e})=>a.exports.createElement(a.exports.Fragment,null,e);function Sre(e){return a.exports.isValidElement(e)&&e.type===kre}function Cre(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const _re=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=a.exports.forwardRef(((e,n)=>{const{asChild:r,...o}=e,i=r?xre:t;return a.exports.useEffect((()=>{window[Symbol.for("radix-ui")]=!0}),[]),a.exports.createElement(i,vp({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});function Ere(e,t){e&&U.exports.flushSync((()=>e.dispatchEvent(t)))}function Lre(e){const t=e+"CollectionProvider",[n,r]=mre(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=e+"CollectionSlot",s=e+"CollectionItemSlot",l="data-radix-collection-item";return[{Provider:e=>{const{scope:t,children:n}=e,r=H.useRef(null),i=H.useRef(new Map).current;return H.createElement(o,{scope:t,itemMap:i,collectionRef:r},n)},Slot:H.forwardRef(((e,t)=>{const{scope:n,children:r}=e,o=bre(t,i(a,n).collectionRef);return H.createElement(xre,{ref:o},r)})),ItemSlot:H.forwardRef(((e,t)=>{const{scope:n,children:r,...o}=e,a=H.useRef(null),c=bre(t,a),u=i(s,n);return H.useEffect((()=>(u.itemMap.set(a,{ref:a,...o}),()=>{u.itemMap.delete(a)}))),H.createElement(xre,{[l]:"",ref:c},r)}))},function(t){const n=i(e+"CollectionConsumer",t),r=H.useCallback((()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${l}]`)),r=Array.from(n.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)));return r}),[n.collectionRef,n.itemMap]);return r},r]}const Pre=a.exports.createContext(void 0);function Ore(e){const t=a.exports.useContext(Pre);return e||t||"ltr"}function Mre(e){const t=a.exports.useRef(e);return a.exports.useEffect((()=>{t.current=e})),a.exports.useMemo((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}const Tre="dismissableLayer.update",Are="dismissableLayer.pointerDownOutside",Ire="dismissableLayer.focusOutside";let Rre;const Nre=a.exports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dre=a.exports.forwardRef(((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=a.exports.useContext(Nre),[h,f]=a.exports.useState(null),p=null!==(n=null==h?void 0:h.ownerDocument)&&void 0!==n?n:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,g]=a.exports.useState({}),m=bre(t,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=h?v.indexOf(h):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,k=x>=b,S=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=Mre(e),r=a.exports.useRef(!1),o=a.exports.useRef((()=>{}));return a.exports.useEffect((()=>{const e=e=>{if(e.target&&!r.current){const i={originalEvent:e};function a(){Bre(Are,n,i,{discrete:!0})}"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=a,t.addEventListener("click",o.current,{once:!0})):a()}r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));k&&!n&&(null==i||i(e),null==l||l(e),e.defaultPrevented||null==c||c())}),p),C=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=Mre(e),r=a.exports.useRef(!1);return a.exports.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Bre(Ire,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(null==s||s(e),null==l||l(e),e.defaultPrevented||null==c||c())}),p);return function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=Mre(e);a.exports.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)}),[n,t])}((e=>{x===d.layers.size-1&&(null==o||o(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),p),a.exports.useEffect((()=>{if(h)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Rre=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),zre(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Rre)}}),[h,p,r,d]),a.exports.useEffect((()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),zre())}),[h,d]),a.exports.useEffect((()=>{const e=()=>g({});return document.addEventListener(Tre,e),()=>document.removeEventListener(Tre,e)}),[]),a.exports.createElement(_re.div,vp({},u,{ref:m,style:{pointerEvents:w?k?"auto":"none":void 0,...e.style},onFocusCapture:gre(e.onFocusCapture,C.onFocusCapture),onBlurCapture:gre(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:gre(e.onPointerDownCapture,S.onPointerDownCapture)}))}));function zre(){const e=new CustomEvent(Tre);document.dispatchEvent(e)}function Bre(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ere(o,i):o.dispatchEvent(i)}let jre=0;function Fre(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}const Hre="focusScope.autoFocusOnMount",Wre="focusScope.autoFocusOnUnmount",Vre={bubbles:!1,cancelable:!0},Ure=a.exports.forwardRef(((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[l,c]=a.exports.useState(null),u=Mre(o),d=Mre(i),h=a.exports.useRef(null),f=bre(t,(e=>c(e))),p=a.exports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.exports.useEffect((()=>{if(r){function e(e){if(p.paused||!l)return;const t=e.target;l.contains(t)?h.current=t:Yre(h.current,{select:!0})}function t(e){!p.paused&&l&&(l.contains(e.relatedTarget)||Yre(h.current,{select:!0}))}return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t)}}}),[r,l,p.paused]),a.exports.useEffect((()=>{if(l){Zre.add(p);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(Hre,Vre);l.addEventListener(Hre,u),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Yre(r,{select:t}),document.activeElement!==n)return}((e=$re(l),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Yre(l))}return()=>{l.removeEventListener(Hre,u),setTimeout((()=>{const e=new CustomEvent(Wre,Vre);l.addEventListener(Wre,d),l.dispatchEvent(e),e.defaultPrevented||Yre(null!=t?t:document.body,{select:!0}),l.removeEventListener(Wre,d),Zre.remove(p)}),0)}}var e}),[l,u,d,p]);const g=a.exports.useCallback((e=>{if(!n&&!r)return;if(p.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,i]=function(e){const t=$re(e),n=Gre(t,e),r=Gre(t.reverse(),e);return[n,r]}(t);r&&i?e.shiftKey||o!==i?e.shiftKey&&o===r&&(e.preventDefault(),n&&Yre(i,{select:!0})):(e.preventDefault(),n&&Yre(r,{select:!0})):o===t&&e.preventDefault()}}),[n,r,p.paused]);return a.exports.createElement(_re.div,vp({tabIndex:-1},s,{ref:f,onKeyDown:g}))}));function $re(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gre(e,t){for(const n of e)if(!qre(n,{upTo:t}))return n}function qre(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Yre(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const Zre=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=Xre(e,t),e.unshift(t)},remove(t){var n;e=Xre(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function Xre(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const Kre=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?a.exports.useLayoutEffect:()=>{},Qre=W["useId".toString()]||(()=>{});let Jre=0;function eoe(e){return e.split("-")[0]}function toe(e){return e.split("-")[1]}function noe(e){return["top","bottom"].includes(eoe(e))?"x":"y"}function roe(e){return"y"===e?"height":"width"}function ooe(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,s=noe(t),l=roe(s),c=r[l]/2-o[l]/2,u="x"===s;let d;switch(eoe(t)){case"top":d={x:i,y:r.y-o.height};break;case"bottom":d={x:i,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:a};break;case"left":d={x:r.x-o.width,y:a};break;default:d={x:r.x,y:r.y}}switch(toe(t)){case"start":d[s]-=c*(n&&u?-1:1);break;case"end":d[s]+=c*(n&&u?-1:1)}return d}function ioe(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function aoe(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function soe(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=t,p=ioe(f),g=s[h?"floating"===d?"reference":"floating":d],m=aoe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v=aoe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===d?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),strategy:l}):a[d]);return{top:m.top-v.top+p.top,bottom:v.bottom-m.bottom+p.bottom,left:m.left-v.left+p.left,right:v.right-m.right+p.right}}const loe=Math.min,coe=Math.max;function uoe(e,t,n){return coe(e,loe(t,n))}const doe=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:s,platform:l}=t;if(null==n)return{};const c=ioe(r),u={x:o,y:i},d=noe(a),h=toe(a),f=roe(d),p=await l.getDimensions(n),g="y"===d?"top":"left",m="y"===d?"bottom":"right",v=s.reference[f]+s.reference[d]-u[d]-s.floating[f],y=u[d]-s.reference[d],b=await(null==l.getOffsetParent?void 0:l.getOffsetParent(n));let x=b?"y"===d?b.clientHeight||0:b.clientWidth||0:0;0===x&&(x=s.floating[f]);const w=v/2-y/2,k=c[g],S=x-p[f]-c[m],C=x/2-p[f]/2+w,_=uoe(k,C,S),E=("start"===h?c[g]:c[m])>0&&C!==_&&s.reference[f]<=s.floating[f];return{[d]:u[d]-(E?Choe[e]))}const poe={start:"end",end:"start"};function goe(e){return e.replace(/start|end/g,(e=>poe[e]))}const moe=["top","right","bottom","left"];const voe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",flipAlignment:f=!0,...p}=e,g=eoe(r),m=d||(g===a||!f?[foe(a)]:function(e){const t=foe(e);return[goe(e),t,goe(t)]}(a)),v=[a,...m],y=await soe(t,p),b=[];let x=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&b.push(y[g]),u){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=toe(e),o=noe(e),i=roe(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=foe(a)),{main:a,cross:foe(a)}}(r,i,await(null==s.isRTL?void 0:s.isRTL(l.floating)));b.push(y[e],y[t])}if(x=[...x,{placement:r,overflows:b}],!b.every((e=>e<=0))){var w,k;const e=(null!=(w=null==(k=o.flip)?void 0:k.index)?w:0)+1,t=v[e];if(t)return{data:{index:e,overflows:x},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var S;const e=null==(S=x.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:S[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};function yoe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function boe(e){return moe.some((t=>e[t]>=0))}const xoe=function(e){let{strategy:t="referenceHidden",...n}=void 0===e?{}:e;return{name:"hide",async fn(e){const{rects:r}=e;switch(t){case"referenceHidden":{const t=yoe(await soe(e,{...n,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:boe(t)}}}case"escaped":{const t=yoe(await soe(e,{...n,altBoundary:!0}),r.floating);return{data:{escapedOffsets:t,escaped:boe(t)}}}default:return{}}}}};const woe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=eoe(n),s=toe(n),l="x"===noe(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d="function"==typeof t?t(e):t;let{mainAxis:h,crossAxis:f,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(f="end"===s?-1*p:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function koe(e){return"x"===e?"y":"x"}const Soe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=e,c={x:n,y:r},u=await soe(t,l),d=noe(eoe(o)),h=koe(d);let f=c[d],p=c[h];if(i){const e="y"===d?"bottom":"right";f=uoe(f+u["y"===d?"top":"left"],f,f-u[e])}if(a){const e="y"===h?"bottom":"right";p=uoe(p+u["y"===h?"top":"left"],p,p-u[e])}const g=s.fn({...t,[d]:f,[h]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Coe=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=e,u={x:n,y:r},d=noe(o),h=koe(d);let f=u[d],p=u[h];const g="function"==typeof s?s({...i,placement:o}):s,m="number"==typeof g?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+m.mainAxis,n=i.reference[d]+i.reference[e]-m.mainAxis;fn&&(f=n)}if(c){var v,y,b,x;const e="y"===d?"width":"height",t=["top","left"].includes(eoe(o)),n=i.reference[h]-i.floating[e]+(t&&null!=(v=null==(y=a.offset)?void 0:y[h])?v:0)+(t?0:m.crossAxis),r=i.reference[h]+i.reference[e]+(t?0:null!=(b=null==(x=a.offset)?void 0:x[h])?b:0)-(t?m.crossAxis:0);pr&&(p=r)}return{[d]:f,[h]:p}}}};function _oe(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function Eoe(e){if(null==e)return window;if(!_oe(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function Loe(e){return Eoe(e).getComputedStyle(e)}function Poe(e){return _oe(e)?"":e?(e.nodeName||"").toLowerCase():""}function Ooe(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function Moe(e){return e instanceof Eoe(e).HTMLElement}function Toe(e){return e instanceof Eoe(e).Element}function Aoe(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof Eoe(e).ShadowRoot||e instanceof ShadowRoot}function Ioe(e){const{overflow:t,overflowX:n,overflowY:r}=Loe(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function Roe(e){return["table","td","th"].includes(Poe(e))}function Noe(e){const t=/firefox/i.test(Ooe()),n=Loe(e);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter}function Doe(){return!/^((?!chrome|android).)*safari/i.test(Ooe())}const zoe=Math.min,Boe=Math.max,joe=Math.round;function Foe(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const s=e.getBoundingClientRect();let l=1,c=1;t&&Moe(e)&&(l=e.offsetWidth>0&&joe(s.width)/e.offsetWidth||1,c=e.offsetHeight>0&&joe(s.height)/e.offsetHeight||1);const u=Toe(e)?Eoe(e):window,d=!Doe()&&n,h=(s.left+(d&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/l,f=(s.top+(d&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,p=s.width/l,g=s.height/c;return{width:p,height:g,top:f,right:h+p,bottom:f+g,left:h,x:h,y:f}}function Hoe(e){return((function(e){return e instanceof Eoe(e).Node}(e)?e.ownerDocument:e.document)||window.document).documentElement}function Woe(e){return Toe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Voe(e){return Foe(Hoe(e)).left+Woe(e).scrollLeft}function Uoe(e,t,n){const r=Moe(t),o=Hoe(t),i=Foe(e,r&&function(e){const t=Foe(e);return joe(t.width)!==e.offsetWidth||joe(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==Poe(t)||Ioe(o))&&(a=Woe(t)),Moe(t)){const e=Foe(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=Voe(o));return{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function $oe(e){return"html"===Poe(e)?e:e.assignedSlot||e.parentNode||(Aoe(e)?e.host:null)||Hoe(e)}function Goe(e){return Moe(e)&&"fixed"!==getComputedStyle(e).position?e.offsetParent:null}function qoe(e){const t=Eoe(e);let n=Goe(e);for(;n&&Roe(n)&&"static"===getComputedStyle(n).position;)n=Goe(n);return n&&("html"===Poe(n)||"body"===Poe(n)&&"static"===getComputedStyle(n).position&&!Noe(n))?t:n||function(e){let t=$oe(e);for(Aoe(t)&&(t=t.host);Moe(t)&&!["html","body"].includes(Poe(t));){if(Noe(t))return t;t=t.parentNode}return null}(e)||t}function Yoe(e){if(Moe(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=Foe(e);return{width:t.width,height:t.height}}function Zoe(e){const t=$oe(e);return["html","body","#document"].includes(Poe(t))?e.ownerDocument.body:Moe(t)&&Ioe(t)?t:Zoe(t)}function Xoe(e,t){var n;void 0===t&&(t=[]);const r=Zoe(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=Eoe(r),a=o?[i].concat(i.visualViewport||[],Ioe(r)?r:[]):r,s=t.concat(a);return o?s:s.concat(Xoe(a))}function Koe(e,t,n){return"viewport"===t?aoe(function(e,t){const n=Eoe(e),r=Hoe(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Doe();(e||!e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n)):Toe(t)?function(e,t){const n=Foe(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):aoe(function(e){var t;const n=Hoe(e),r=Woe(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=Boe(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Boe(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let s=-r.scrollLeft+Voe(e);const l=-r.scrollTop;return"rtl"===Loe(o||n).direction&&(s+=Boe(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:l}}(Hoe(e)))}function Qoe(e){const t=Xoe(e),n=["absolute","fixed"].includes(Loe(e).position)&&Moe(e)?qoe(e):e;return Toe(n)?t.filter((e=>Toe(e)&&function(e,t){const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Aoe(n)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(e,n)&&"body"!==Poe(e))):[]}const Joe={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?Qoe(t):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=Koe(t,n,o);return e.top=Boe(r.top,e.top),e.right=zoe(r.right,e.right),e.bottom=zoe(r.bottom,e.bottom),e.left=Boe(r.left,e.left),e}),Koe(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Moe(n),i=Hoe(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==Poe(n)||Ioe(i))&&(a=Woe(n)),Moe(n))){const e=Foe(n,!0);s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+s.x,y:t.y-a.scrollTop+s.y}},isElement:Toe,getDimensions:Yoe,getOffsetParent:qoe,getDocumentElement:Hoe,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:Uoe(t,qoe(n),r),floating:{...Yoe(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===Loe(e).direction};function eie(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=!0,animationFrame:s=!1}=r,l=o&&!s,c=i&&!s,u=l||c?[...Toe(e)?Xoe(e):[],...Xoe(t)]:[];u.forEach((e=>{l&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)}));let d,h=null;if(a){let r=!0;h=new ResizeObserver((()=>{r||n(),r=!1})),Toe(e)&&!s&&h.observe(e),h.observe(t)}let f=s?Foe(e):null;return s&&function t(){const r=Foe(e);!f||r.x===f.x&&r.y===f.y&&r.width===f.width&&r.height===f.height||n();f=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{l&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)})),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(d)}}const tie=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=await(null==a.isRTL?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:u}=ooe(l,r,s),d=r,h={},f=0;for(let p=0;p{t.current=e})),t}(o),c=a.exports.useRef(null),[u,d]=a.exports.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[h,f]=a.exports.useState(t);rie(null==h?void 0:h.map((e=>{let{options:t}=e;return t})),null==t?void 0:t.map((e=>{let{options:t}=e;return t})))||f(t);const p=a.exports.useCallback((()=>{i.current&&s.current&&tie(i.current,s.current,{middleware:h,placement:n,strategy:r}).then((e=>{g.current&&U.exports.flushSync((()=>{d(e)}))}))}),[h,n,r]);nie((()=>{g.current&&p()}),[p]);const g=a.exports.useRef(!1);nie((()=>(g.current=!0,()=>{g.current=!1})),[]);const m=a.exports.useCallback((()=>{if("function"==typeof c.current&&(c.current(),c.current=null),i.current&&s.current)if(l.current){const e=l.current(i.current,s.current,p);c.current=e}else p()}),[p,l]),v=a.exports.useCallback((e=>{i.current=e,m()}),[m]),y=a.exports.useCallback((e=>{s.current=e,m()}),[m]),b=a.exports.useMemo((()=>({reference:i,floating:s})),[]);return a.exports.useMemo((()=>({...u,update:p,refs:b,reference:v,floating:y})),[u,p,b,v,y])}const iie=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn:e=>function(e){return Object.prototype.hasOwnProperty.call(e,"current")}(t)?null!=t.current?doe({element:t.current,padding:n}).fn(e):{}:t?doe({element:t,padding:n}).fn(e):{}}};const aie="Popper",[sie,lie]=mre(aie),[cie,uie]=sie(aie),die=a.exports.forwardRef(((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=uie("PopperAnchor",n),s=a.exports.useRef(null),l=bre(t,s);return a.exports.useEffect((()=>{i.onAnchorChange((null==r?void 0:r.current)||s.current)})),r?null:a.exports.createElement(_re.div,vp({},o,{ref:l}))})),hie="PopperContent",[fie,pie]=sie(hie),[gie,mie]=sie(hie,{hasParent:!1,positionUpdateFns:new Set}),vie=a.exports.forwardRef(((e,t)=>{var n,r,o,i,s,l,c,u;const{__scopePopper:d,side:h="bottom",sideOffset:f=0,align:p="center",alignOffset:g=0,arrowPadding:m=0,collisionBoundary:v=[],collisionPadding:y=0,sticky:b="partial",hideWhenDetached:x=!1,avoidCollisions:w=!0,...k}=e,S=uie(hie,d),[C,_]=a.exports.useState(null),E=bre(t,(e=>_(e))),[L,P]=a.exports.useState(null),O=function(e){const[t,n]=a.exports.useState(void 0);return Kre((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(L),M=null!==(n=null==O?void 0:O.width)&&void 0!==n?n:0,T=null!==(r=null==O?void 0:O.height)&&void 0!==r?r:0,A=h+("center"!==p?"-"+p:""),I="number"==typeof y?y:{top:0,right:0,bottom:0,left:0,...y},R=Array.isArray(v)?v:[v],N=R.length>0,D={padding:I,boundary:R.filter(bie),altBoundary:N},{reference:z,floating:B,strategy:j,x:F,y:H,placement:W,middlewareData:V,update:U}=oie({strategy:"fixed",placement:A,whileElementsMounted:eie,middleware:[woe({mainAxis:f+T,alignmentAxis:g}),w?Soe({mainAxis:!0,crossAxis:!1,limiter:"partial"===b?Coe():void 0,...D}):void 0,L?iie({element:L,padding:m}):void 0,w?voe({...D}):void 0,xie({arrowWidth:M,arrowHeight:T}),x?xoe({strategy:"referenceHidden"}):void 0].filter(yie)});Kre((()=>{z(S.anchor)}),[z,S.anchor]);const $=null!==F&&null!==H,[G,q]=wie(W),Y=null===(o=V.arrow)||void 0===o?void 0:o.x,Z=null===(i=V.arrow)||void 0===i?void 0:i.y,X=0!==(null===(s=V.arrow)||void 0===s?void 0:s.centerOffset),[K,Q]=a.exports.useState();Kre((()=>{C&&Q(window.getComputedStyle(C).zIndex)}),[C]);const{hasParent:J,positionUpdateFns:ee}=mie(hie,d),te=!J;a.exports.useLayoutEffect((()=>{if(!te)return ee.add(U),()=>{ee.delete(U)}}),[te,ee,U]),a.exports.useLayoutEffect((()=>{te&&$&&Array.from(ee).reverse().forEach((e=>requestAnimationFrame(e)))}),[te,$,ee]);const ne={"data-side":G,"data-align":q,...k,ref:E,style:{...k.style,animation:$?void 0:"none",opacity:null!==(l=V.hide)&&void 0!==l&&l.referenceHidden?0:void 0}};return a.exports.createElement("div",{ref:B,"data-radix-popper-content-wrapper":"",style:{position:j,left:0,top:0,transform:$?`translate3d(${Math.round(F)}px, ${Math.round(H)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[null===(c=V.transformOrigin)||void 0===c?void 0:c.x,null===(u=V.transformOrigin)||void 0===u?void 0:u.y].join(" ")}},a.exports.createElement(fie,{scope:d,placedSide:G,onArrowChange:P,arrowX:Y,arrowY:Z,shouldHideArrow:X},te?a.exports.createElement(gie,{scope:d,hasParent:!0,positionUpdateFns:ee},a.exports.createElement(_re.div,ne)):a.exports.createElement(_re.div,ne)))}));function yie(e){return void 0!==e}function bie(e){return null!==e}const xie=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,a;const{placement:s,rects:l,middlewareData:c}=t,u=0!==(null===(n=c.arrow)||void 0===n?void 0:n.centerOffset),d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[f,p]=wie(s),g={start:"0%",center:"50%",end:"100%"}[p],m=(null!==(r=null===(o=c.arrow)||void 0===o?void 0:o.x)&&void 0!==r?r:0)+d/2,v=(null!==(i=null===(a=c.arrow)||void 0===a?void 0:a.y)&&void 0!==i?i:0)+h/2;let y="",b="";return"bottom"===f?(y=u?g:`${m}px`,b=-h+"px"):"top"===f?(y=u?g:`${m}px`,b=`${l.floating.height+h}px`):"right"===f?(y=-h+"px",b=u?g:`${v}px`):"left"===f&&(y=`${l.floating.width+h}px`,b=u?g:`${v}px`),{data:{x:y,y:b}}}});function wie(e){const[t,n="center"]=e.split("-");return[t,n]}const kie=e=>{const{__scopePopper:t,children:n}=e,[r,o]=a.exports.useState(null);return a.exports.createElement(cie,{scope:t,anchor:r,onAnchorChange:o},n)},Sie=die,Cie=vie;const _ie=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=a.exports.useState(),r=a.exports.useRef({}),o=a.exports.useRef(e),i=a.exports.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return a.exports.useReducer(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.exports.useEffect((()=>{const e=Eie(r.current);i.current="mounted"===l?e:"none"}),[l]),Kre((()=>{const t=r.current,n=o.current;if(n!==e){const r=i.current,a=Eie(t);if(e)c("MOUNT");else if("none"===a||"none"===(null==t?void 0:t.display))c("UNMOUNT");else{c(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),Kre((()=>{if(t){const e=e=>{const n=Eie(r.current).includes(e.animationName);e.target===t&&n&&U.exports.flushSync((()=>c("ANIMATION_END")))},n=e=>{e.target===t&&(i.current=Eie(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.exports.useCallback((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):a.exports.Children.only(n),i=bre(r.ref,o.ref);return"function"==typeof n||r.isPresent?a.exports.cloneElement(o,{ref:i}):null};function Eie(e){return(null==e?void 0:e.animationName)||"none"}function Lie({prop:e,defaultProp:t,onChange:n=(()=>{})}){const[r,o]=function({defaultProp:e,onChange:t}){const n=a.exports.useState(e),[r]=n,o=a.exports.useRef(r),i=Mre(t);return a.exports.useEffect((()=>{o.current!==r&&(i(r),o.current=r)}),[r,o,i]),n}({defaultProp:t,onChange:n}),i=void 0!==e,s=i?e:r,l=Mre(n),c=a.exports.useCallback((t=>{if(i){const n="function"==typeof t?t(e):t;n!==e&&l(n)}else o(t)}),[i,e,o,l]);return[s,c]}_ie.displayName="Presence";const Pie="rovingFocusGroup.onEntryFocus",Oie={bubbles:!1,cancelable:!0},Mie="RovingFocusGroup",[Tie,Aie,Iie]=Lre(Mie),[Rie,Nie]=mre(Mie,[Iie]),[Die,zie]=Rie(Mie),Bie=a.exports.forwardRef(((e,t)=>a.exports.createElement(Tie.Provider,{scope:e.__scopeRovingFocusGroup},a.exports.createElement(Tie.Slot,{scope:e.__scopeRovingFocusGroup},a.exports.createElement(jie,vp({},e,{ref:t})))))),jie=a.exports.forwardRef(((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,...d}=e,h=a.exports.useRef(null),f=bre(t,h),p=Ore(i),[g=null,m]=Lie({prop:s,defaultProp:l,onChange:c}),[v,y]=a.exports.useState(!1),b=Mre(u),x=Aie(n),w=a.exports.useRef(!1),[k,S]=a.exports.useState(0);return a.exports.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(Pie,b),()=>e.removeEventListener(Pie,b)}),[b]),a.exports.createElement(Die,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:g,onItemFocus:a.exports.useCallback((e=>m(e)),[m]),onItemShiftTab:a.exports.useCallback((()=>y(!0)),[]),onFocusableItemAdd:a.exports.useCallback((()=>S((e=>e+1))),[]),onFocusableItemRemove:a.exports.useCallback((()=>S((e=>e-1))),[])},a.exports.createElement(_re.div,vp({tabIndex:v||0===k?-1:0,"data-orientation":r},d,{ref:f,style:{outline:"none",...e.style},onMouseDown:gre(e.onMouseDown,(()=>{w.current=!0})),onFocus:gre(e.onFocus,(e=>{const t=!w.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(Pie,Oie);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=x().filter((e=>e.focusable));Wie([e.find((e=>e.active)),e.find((e=>e.id===g)),...e].filter(Boolean).map((e=>e.ref.current)))}}w.current=!1})),onBlur:gre(e.onBlur,(()=>y(!1)))})))})),Fie=a.exports.forwardRef(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,...i}=e,s=function(e){const[t,n]=a.exports.useState(Qre());return Kre((()=>{e||n((e=>null!=e?e:String(Jre++)))}),[e]),e||(t?`radix-${t}`:"")}(),l=zie("RovingFocusGroupItem",n),c=l.currentTabStopId===s,u=Aie(n),{onFocusableItemAdd:d,onFocusableItemRemove:h}=l;return a.exports.useEffect((()=>{if(r)return d(),()=>h()}),[r,d,h]),a.exports.createElement(Tie.ItemSlot,{scope:n,id:s,focusable:r,active:o},a.exports.createElement(_re.span,vp({tabIndex:c?0:-1,"data-orientation":l.orientation},i,{ref:t,onMouseDown:gre(e.onMouseDown,(e=>{r?l.onItemFocus(s):e.preventDefault()})),onFocus:gre(e.onFocus,(()=>l.onItemFocus(s))),onKeyDown:gre(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void l.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:Hie[r]}(e,l.orientation,l.dir);if(void 0!==t){e.preventDefault();let o=u().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=l.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>Wie(o)))}var n,r}))})))})),Hie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wie(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}const Vie=Bie,Uie=Fie,$ie=["Enter"," "],Gie=["ArrowUp","PageDown","End"],qie=["ArrowDown","PageUp","Home",...Gie],Yie="Menu",[Zie,Xie,Kie]=Lre(Yie),[Qie,Jie]=mre(Yie,[Kie,lie,Nie]),eae=lie(),tae=Nie(),[nae,rae]=Qie(Yie),[oae,iae]=Qie(Yie),aae=a.exports.forwardRef(((e,t)=>{const{__scopeMenu:n,...r}=e,o=eae(n);return a.exports.createElement(Sie,vp({},o,r,{ref:t}))})),[sae,lae]=Qie("MenuPortal",{forceMount:void 0}),cae="MenuContent",[uae,dae]=Qie(cae),hae=a.exports.forwardRef(((e,t)=>{const n=lae(cae,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=rae(cae,e.__scopeMenu),s=iae(cae,e.__scopeMenu);return a.exports.createElement(Zie.Provider,{scope:e.__scopeMenu},a.exports.createElement(_ie,{present:r||i.open},a.exports.createElement(Zie.Slot,{scope:e.__scopeMenu},s.modal?a.exports.createElement(fae,vp({},o,{ref:t})):a.exports.createElement(pae,vp({},o,{ref:t})))))})),fae=a.exports.forwardRef(((e,t)=>{const n=rae(cae,e.__scopeMenu),r=a.exports.useRef(null),o=bre(t,r);return a.exports.useEffect((()=>{const e=r.current;if(e)return pD(e)}),[]),a.exports.createElement(gae,vp({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gre(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))})),pae=a.exports.forwardRef(((e,t)=>{const n=rae(cae,e.__scopeMenu);return a.exports.createElement(gae,vp({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))})),gae=a.exports.forwardRef(((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,m=rae(cae,n),v=iae(cae,n),y=eae(n),b=tae(n),x=Xie(n),[w,k]=a.exports.useState(null),S=a.exports.useRef(null),C=bre(t,S,m.onContentChange),_=a.exports.useRef(0),E=a.exports.useRef(""),L=a.exports.useRef(0),P=a.exports.useRef(null),O=a.exports.useRef("right"),M=a.exports.useRef(0),T=p?_B:a.exports.Fragment,A=p?{as:xre,allowPinchZoom:!0}:void 0,I=e=>{var t,n;const r=E.current+e,o=x().filter((e=>!e.disabled)),i=document.activeElement,a=null===(t=o.find((e=>e.ref.current===i)))||void 0===t?void 0:t.textValue,s=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0])),o=r?t[0]:t,i=n?e.indexOf(n):-1;let a=(s=e,l=Math.max(i,0),s.map(((e,t)=>s[(l+t)%s.length])));var s,l;1===o.length&&(a=a.filter((e=>e!==n)));const c=a.find((e=>e.toLowerCase().startsWith(o.toLowerCase())));return c!==n?c:void 0}(o.map((e=>e.textValue)),r,a),l=null===(n=o.find((e=>e.textValue===s)))||void 0===n?void 0:n.ref.current;!function e(t){E.current=t,window.clearTimeout(_.current),""!==t&&(_.current=window.setTimeout((()=>e("")),1e3))}(r),l&&setTimeout((()=>l.focus()))};a.exports.useEffect((()=>()=>window.clearTimeout(_.current)),[]),a.exports.useEffect((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:Fre()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:Fre()),jre++,()=>{1===jre&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),jre--}}),[]);const R=a.exports.useCallback((e=>{var t,n;return O.current===(null===(t=P.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;ir!=c>r&&n<(l-e)*(r-s)/(c-s)+e&&(o=!o)}return o}(n,t)}(e,null===(n=P.current)||void 0===n?void 0:n.area)}),[]);return a.exports.createElement(uae,{scope:n,searchRef:E,onItemEnter:a.exports.useCallback((e=>{R(e)&&e.preventDefault()}),[R]),onItemLeave:a.exports.useCallback((e=>{var t;R(e)||(null===(t=S.current)||void 0===t||t.focus(),k(null))}),[R]),onTriggerLeave:a.exports.useCallback((e=>{R(e)&&e.preventDefault()}),[R]),pointerGraceTimerRef:L,onPointerGraceIntentChange:a.exports.useCallback((e=>{P.current=e}),[])},a.exports.createElement(T,A,a.exports.createElement(Ure,{asChild:!0,trapped:o,onMountAutoFocus:gre(i,(e=>{var t;e.preventDefault(),null===(t=S.current)||void 0===t||t.focus()})),onUnmountAutoFocus:s},a.exports.createElement(Dre,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f},a.exports.createElement(Vie,vp({asChild:!0},b,{dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:w,onCurrentTabStopIdChange:k,onEntryFocus:e=>{v.isUsingKeyboardRef.current||e.preventDefault()}}),a.exports.createElement(Cie,vp({role:"menu","aria-orientation":"vertical","data-state":(N=m.open,N?"open":"closed"),"data-radix-menu-content":"",dir:v.dir},y,g,{ref:C,style:{outline:"none",...g.style},onKeyDown:gre(g.onKeyDown,(e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&r&&I(e.key));const o=S.current;if(e.target!==o)return;if(!qie.includes(e.key))return;e.preventDefault();const i=x().filter((e=>!e.disabled)).map((e=>e.ref.current));Gie.includes(e.key)&&i.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(i)})),onBlur:gre(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(_.current),E.current="")})),onPointerMove:gre(e.onPointerMove,xae((e=>{const t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>M.current?"right":"left";O.current=t,M.current=e.clientX}})))})))))));var N})),mae="MenuItem",vae="menu.itemSelect",yae=a.exports.forwardRef(((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=a.exports.useRef(null),s=iae(mae,e.__scopeMenu),l=dae(mae,e.__scopeMenu),c=bre(t,i),u=a.exports.useRef(!1);return a.exports.createElement(bae,vp({},o,{ref:c,disabled:n,onClick:gre(e.onClick,(()=>{const e=i.current;if(!n&&e){const t=new CustomEvent(vae,{bubbles:!0,cancelable:!0});e.addEventListener(vae,(e=>null==r?void 0:r(e)),{once:!0}),Ere(e,t),t.defaultPrevented?u.current=!1:s.onClose()}})),onPointerDown:t=>{var n;null===(n=e.onPointerDown)||void 0===n||n.call(e,t),u.current=!0},onPointerUp:gre(e.onPointerUp,(e=>{var t;u.current||null===(t=e.currentTarget)||void 0===t||t.click()})),onKeyDown:gre(e.onKeyDown,(e=>{const t=""!==l.searchRef.current;n||t&&" "===e.key||$ie.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))}))})),bae=a.exports.forwardRef(((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=dae(mae,n),l=tae(n),c=a.exports.useRef(null),u=bre(t,c),[d,h]=a.exports.useState(!1),[f,p]=a.exports.useState("");return a.exports.useEffect((()=>{const e=c.current;var t;e&&p((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[i.children]),a.exports.createElement(Zie.ItemSlot,{scope:n,disabled:r,textValue:null!=o?o:f},a.exports.createElement(Uie,vp({asChild:!0},l,{focusable:!r}),a.exports.createElement(_re.div,vp({role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:u,onPointerMove:gre(e.onPointerMove,xae((e=>{if(r)s.onItemLeave(e);else if(s.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:gre(e.onPointerLeave,xae((e=>s.onItemLeave(e)))),onFocus:gre(e.onFocus,(()=>h(!0))),onBlur:gre(e.onBlur,(()=>h(!1)))}))))}));Qie("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});Qie("MenuItemIndicator",{checked:!1});function xae(e){return t=>"mouse"===t.pointerType?e(t):void 0}Qie("MenuSub");const wae=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,l=eae(t),[c,u]=a.exports.useState(null),d=a.exports.useRef(!1),h=Mre(i),f=Ore(o);return a.exports.useEffect((()=>{const e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),a.exports.createElement(kie,l,a.exports.createElement(nae,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:u},a.exports.createElement(oae,{scope:t,onClose:a.exports.useCallback((()=>h(!1)),[h]),isUsingKeyboardRef:d,dir:f,modal:s},r)))},kae=aae,Sae=hae,Cae=yae,_ae="ContextMenu",[Eae,Lae]=mre(_ae,[Jie]),Pae=Jie(),[Oae,Mae]=Eae(_ae);function Tae(e){return t=>"mouse"!==t.pointerType?e(t):void 0}const Aae=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:o,modal:i=!0}=e,[s,l]=a.exports.useState(!1),c=Pae(t),u=Mre(r),d=a.exports.useCallback((e=>{l(e),u(e)}),[u]);return a.exports.createElement(Oae,{scope:t,open:s,onOpenChange:d,modal:i},a.exports.createElement(wae,vp({},c,{dir:o,open:s,onOpenChange:d,modal:i}),n))},Iae=a.exports.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Mae("ContextMenuTrigger",n),i=Pae(n),s=a.exports.useRef({x:0,y:0}),l=a.exports.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),c=a.exports.useRef(0),u=a.exports.useCallback((()=>window.clearTimeout(c.current)),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},o.onOpenChange(!0)};return a.exports.useEffect((()=>u),[u]),a.exports.createElement(a.exports.Fragment,null,a.exports.createElement(kae,vp({},i,{virtualRef:l})),a.exports.createElement(_re.span,vp({"data-state":o.open?"open":"closed"},r,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:gre(e.onContextMenu,(e=>{u(),d(e),e.preventDefault()})),onPointerDown:gre(e.onPointerDown,Tae((e=>{u(),c.current=window.setTimeout((()=>d(e)),700)}))),onPointerMove:gre(e.onPointerMove,Tae(u)),onPointerCancel:gre(e.onPointerCancel,Tae(u)),onPointerUp:gre(e.onPointerUp,Tae(u))})))})),Rae=a.exports.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Mae("ContextMenuContent",n),i=Pae(n),s=a.exports.useRef(!1);return a.exports.createElement(Sae,vp({},i,r,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var n;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),!t.defaultPrevented&&s.current&&t.preventDefault(),s.current=!1},onInteractOutside:t=>{var n;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||o.modal||(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}}))})),Nae=a.exports.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Pae(n);return a.exports.createElement(Cae,vp({},o,r,{ref:t}))})),Dae=uV([e=>e.gallery,e=>e.options,xne,A3],((e,t,n,r)=>{const{categories:o,currentCategory:i,currentImageUuid:a,shouldPinGallery:s,shouldShowGallery:l,galleryScrollPosition:c,galleryImageMinimumWidth:u,galleryImageObjectFit:d,shouldHoldGalleryOpen:h,shouldAutoSwitchToNewImages:f,galleryWidth:p,shouldUseSingleGalleryColumn:g}=e,{isLightBoxOpen:m}=t;return{currentImageUuid:a,shouldPinGallery:s,shouldShowGallery:l,galleryScrollPosition:c,galleryImageMinimumWidth:u,galleryImageObjectFit:d,galleryGridTemplateColumns:g?"auto":`repeat(auto-fill, minmax(${u}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:h,shouldAutoSwitchToNewImages:f,images:o[i].images,areMoreImagesAvailable:o[i].areMoreImagesAvailable,currentCategory:i,galleryWidth:p,isLightBoxOpen:m,isStaging:n,shouldEnableResize:!(m||"unifiedCanvas"===r&&s),shouldUseSingleGalleryColumn:g}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),zae=uV([e=>e.options,e=>e.gallery,e=>e.system,A3],((e,t,n,r)=>({mayDeleteImage:n.isConnected&&!n.isProcessing,galleryImageObjectFit:t.galleryImageObjectFit,galleryImageMinimumWidth:t.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:t.shouldUseSingleGalleryColumn,activeTabName:r,isLightBoxOpen:e.isLightBoxOpen})),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Bae=a.exports.memo((e=>{const t=v5(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:o,mayDeleteImage:i,isLightBoxOpen:s,shouldUseSingleGalleryColumn:l}=y5(zae),{image:c,isSelected:u}=e,{url:d,thumbnail:h,uuid:f,metadata:p}=c,[g,m]=a.exports.useState(!1),v=zH(),{t:y}=HY();return cd(Aae,{onOpenChange:e=>{t(q$(e))},children:[ld(Iae,{children:cd(mI,{position:"relative",className:"hoverable-image",onMouseOver:()=>m(!0),onMouseOut:()=>m(!1),userSelect:"none",draggable:!0,onDragStart:e=>{e.dataTransfer.setData("invokeai/imageUuid",f),e.dataTransfer.effectAllowed="move"},children:[ld(ET,{className:"hoverable-image-image",objectFit:l?"contain":r,rounded:"md",src:h||d,loading:"lazy"}),ld("div",{className:"hoverable-image-content",onClick:()=>t(z$(c)),children:u&&ld(kk,{width:"50%",height:"50%",as:B5,className:"hoverable-image-check"})}),g&&o>=64&&ld("div",{className:"hoverable-image-delete-button",children:ld(tre,{image:c,children:ld(zT,{"aria-label":y("options:deleteImage"),icon:ld(m3,{}),size:"xs",variant:"imageHoverIconButton",fontSize:14,isDisabled:!i})})})]},f)}),cd(Rae,{className:"hoverable-image-context-menu",sticky:"always",onInteractOutside:e=>{e.detail.originalEvent.preventDefault()},children:[ld(Nae,{onClickCapture:()=>{t(qU(!0)),t(z$(c))},children:y("options:openInViewer")}),ld(Nae,{onClickCapture:()=>{c.metadata&&t(JU(c.metadata.image.prompt)),v({title:y("toast:promptSet"),status:"success",duration:2500,isClosable:!0})},disabled:void 0===c?.metadata?.image?.prompt,children:y("options:usePrompt")}),ld(Nae,{onClickCapture:()=>{c.metadata&&t(a$(c.metadata.image.seed)),v({title:y("toast:seedSet"),status:"success",duration:2500,isClosable:!0})},disabled:void 0===c?.metadata?.image?.seed,children:y("options:useSeed")}),ld(Nae,{onClickCapture:()=>{p&&t(DU(p)),v({title:y("toast:parametersSet"),status:"success",duration:2500,isClosable:!0})},disabled:!["txt2img","img2img"].includes(c?.metadata?.image?.type),children:y("options:useAll")}),ld(Nae,{onClickCapture:async()=>{if(p?.image?.init_image_path){if((await fetch(p.image.init_image_path)).ok)return t(IU("img2img")),t(RU(p)),void v({title:y("toast:initialImageSet"),status:"success",duration:2500,isClosable:!0})}v({title:y("toast:initialImageNotSet"),description:y("toast:initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},disabled:"img2img"!==c?.metadata?.image?.type,children:y("options:useInitImg")}),ld(Nae,{onClickCapture:()=>{s&&t(qU(!1)),t(GU(c)),"img2img"!==n&&t(IU("img2img")),v({title:y("toast:sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},children:y("options:sendToImg2Img")}),ld(Nae,{onClickCapture:()=>{s&&t(qU(!1)),t(sX(c)),t(ZZ()),"unifiedCanvas"!==n&&t(IU("unifiedCanvas")),v({title:y("toast:sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},children:y("options:sendToUnifiedCanvas")}),ld(Nae,{"data-warning":!0,children:ld(tre,{image:c,children:ld("p",{children:y("options:deleteImage")})})})]})]})}),((e,t)=>e.image.uuid===t.image.uuid&&e.isSelected===t.isSelected)),jae=320,Fae={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}};function Hae(){const e=v5(),{t:t}=HY(),{images:n,currentCategory:r,currentImageUuid:o,shouldPinGallery:i,shouldShowGallery:s,galleryScrollPosition:l,galleryImageMinimumWidth:c,galleryGridTemplateColumns:u,activeTabName:d,galleryImageObjectFit:h,shouldHoldGalleryOpen:f,shouldAutoSwitchToNewImages:p,areMoreImagesAvailable:g,galleryWidth:m,isLightBoxOpen:v,isStaging:y,shouldEnableResize:b,shouldUseSingleGalleryColumn:x}=y5(Dae),{galleryMinWidth:w,galleryMaxWidth:k}=v?{galleryMinWidth:400,galleryMaxWidth:400}:Fae[d],[S,C]=a.exports.useState(m>=jae),[_,E]=a.exports.useState(!1),[L,P]=a.exports.useState(0),O=a.exports.useRef(null),M=a.exports.useRef(null),T=a.exports.useRef(null);a.exports.useEffect((()=>{m>=jae&&C(!1)}),[m]);const A=()=>{e(W$(!i)),e(aX(!0))},I=()=>{e(V$(!0)),i&&e(aX(!0))},R=a.exports.useCallback((()=>{e(V$(!1)),e(q$(!1)),e(U$(M.current?M.current.scrollTop:0)),setTimeout((()=>i&&e(aX(!0))),400)}),[e,i]),N=()=>{T.current&&window.clearTimeout(T.current)};Cte("g",(()=>{s?R():I()}),[s,i]),Cte("left",(()=>{e(H$())}),{enabled:!y||"unifiedCanvas"!==d},[y]),Cte("right",(()=>{e(F$())}),{enabled:!y||"unifiedCanvas"!==d},[y]),Cte("shift+g",(()=>{A()}),[i]),Cte("esc",(()=>{e(V$(!1))}),{enabled:()=>!i,preventDefault:!0},[i]);return Cte("shift+up",(()=>{if(c<256){const t=A$.clamp(c+32,32,256);e($$(t))}}),[c]),Cte("shift+down",(()=>{if(c>32){const t=A$.clamp(c-32,32,256);e($$(t))}}),[c]),a.exports.useEffect((()=>{M.current&&(M.current.scrollTop=l)}),[l,s]),a.exports.useEffect((()=>{function e(e){i||!O.current||O.current.contains(e.target)||R()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[R,i]),ld(Yne,{nodeRef:O,in:s||f,unmountOnExit:!0,timeout:200,classNames:"image-gallery-wrapper",children:cd("div",{className:"image-gallery-wrapper",style:{zIndex:i?1:100},"data-pinned":i,ref:O,onMouseLeave:i?void 0:()=>{f||(T.current=window.setTimeout((()=>R()),500))},onMouseEnter:i?void 0:N,onMouseOver:i?void 0:N,children:[cd(_8,{minWidth:w,maxWidth:i?k:window.innerWidth,className:"image-gallery-popup",handleStyles:{left:{width:"15px"}},enable:{left:b},size:{width:m,height:i?"100%":"100vh"},onResizeStart:(e,t,n)=>{P(n.clientHeight),n.style.height=`${n.clientHeight}px`,i&&(n.style.position="fixed",n.style.right="1rem",E(!0))},onResizeStop:(t,n,r,o)=>{const a=i?A$.clamp(Number(m)+o.width,w,Number(k)):Number(m)+o.width;e(X$(a)),r.removeAttribute("data-resize-alert"),i&&(r.style.position="relative",r.style.removeProperty("right"),r.style.setProperty("height",i?"100%":"100vh"),E(!1),e(aX(!0)))},onResize:(t,n,r,o)=>{const a=A$.clamp(Number(m)+o.width,w,Number(i?k:.95*window.innerWidth));a>=jae&&!S?C(!0):aa-40&&e($$(a-40)),i&&(a>=k?r.setAttribute("data-resize-alert","true"):r.removeAttribute("data-resize-alert")),r.style.height=`${L}px`},children:[cd("div",{className:"image-gallery-header",children:[ld(DT,{size:"sm",isAttached:!0,variant:"solid",className:"image-gallery-category-btn-group",children:cd(sd,S?{children:[ld(j3,{size:"sm","data-selected":"result"===r,onClick:()=>e(Z$("result")),children:t("gallery:generations")}),ld(j3,{size:"sm","data-selected":"user"===r,onClick:()=>e(Z$("user")),children:t("gallery:uploads")})]}:{children:[ld(S3,{"aria-label":t("gallery:showGenerations"),tooltip:t("gallery:showGenerations"),"data-selected":"result"===r,icon:ld(Q5,{}),onClick:()=>e(Z$("result"))}),ld(S3,{"aria-label":t("gallery:showUploads"),tooltip:t("gallery:showUploads"),"data-selected":"user"===r,icon:ld(x3,{}),onClick:()=>e(Z$("user"))})]})}),cd("div",{className:"image-gallery-header-right-icons",children:[ld(B3,{isLazy:!0,trigger:"hover",placement:"left",triggerComponent:ld(S3,{size:"sm","aria-label":t("gallery:gallerySettings"),icon:ld(w3,{}),className:"image-gallery-icon-btn",cursor:"pointer"}),children:cd("div",{className:"image-gallery-settings-popover",children:[cd("div",{children:[ld(Wte,{value:c,onChange:t=>{e($$(t))},min:32,max:256,hideTooltip:!0,label:t("gallery:galleryImageSize")}),ld(S3,{size:"sm","aria-label":t("gallery:galleryImageResetSize"),tooltip:t("gallery:galleryImageResetSize"),onClick:()=>e($$(64)),icon:ld(T9,{}),"data-selected":i,styleClass:"image-gallery-icon-btn"})]}),ld("div",{children:ld(U3,{label:t("gallery:maintainAspectRatio"),isChecked:"contain"===h,onChange:()=>e(G$("contain"===h?"cover":"contain"))})}),ld("div",{children:ld(U3,{label:t("gallery:autoSwitchNewImages"),isChecked:p,onChange:t=>e(Y$(t.target.checked))})}),ld("div",{children:ld(U3,{label:t("gallery:singleColumnLayout"),isChecked:x,onChange:t=>e(K$(t.target.checked))})})]})}),ld(S3,{size:"sm",className:"image-gallery-icon-btn","aria-label":t("gallery:pinGallery"),tooltip:`${t("gallery:pinGallery")} (Shift+G)`,onClick:A,icon:ld(i?Tne:Ane,{})})]})]}),ld("div",{className:"image-gallery-container",ref:M,children:n.length||g?cd(sd,{children:[ld("div",{className:"image-gallery",style:{gridTemplateColumns:u},children:n.map((e=>{const{uuid:t}=e;return ld(Bae,{image:e,isSelected:o===t},t)}))}),ld(RT,{onClick:()=>{e(_Q(r))},isDisabled:!g,className:"image-gallery-load-more-btn",children:t(g?"gallery:loadMore":"gallery:allImagesLoaded")})]}):cd("div",{className:"image-gallery-container-placeholder",children:[ld(Z3,{}),ld("p",{children:t("gallery:noImagesInGallery")})]})})]}),_&&ld("div",{style:{width:m+"px",height:"100%"}})]})})}const Wae=uV((e=>e.gallery),(e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images}))),Vae=uV([e=>e.options,A3],((e,t)=>{const{showDualDisplay:n,shouldPinOptionsPanel:r,isLightBoxOpen:o}=e;return{showDualDisplay:n,shouldPinOptionsPanel:r,isLightBoxOpen:o,shouldShowDualDisplayButton:["inpainting"].includes(t),activeTabName:t}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),Uae=e=>{const t=v5(),{optionsPanel:n,children:r,styleClass:o}=e,{activeTabName:i,showDualDisplay:a,isLightBoxOpen:s,shouldShowDualDisplayButton:l}=y5(Vae),c=(()=>{const{resultImages:e,userImages:t}=y5(Wae);return n=>{const r=e.find((e=>e.uuid===n));if(r)return r;return t.find((e=>e.uuid===n))||void 0}})();return ld("div",{className:o?`workarea-wrapper ${o}`:"workarea-wrapper",children:cd("div",{className:"workarea-main",children:[n,cd("div",{className:"workarea-children-wrapper",onDrop:e=>{const n=e.dataTransfer.getData("invokeai/imageUuid"),r=c(n);r&&("img2img"===i?t(GU(r)):"unifiedCanvas"===i&&t(sX(r)))},children:[r,l&&ld(YH,{label:"Toggle Split View",children:ld("div",{className:"workarea-split-button","data-selected":a,onClick:()=>{t(b$(!a)),t(aX(!0))},children:ld(pre,{})})})]}),!s&&ld(Hae,{})]})})};function $ae(){return ld(Uae,{optionsPanel:ld(Kne,{}),children:ld(fre,{})})}const Gae=()=>{const e=v5(),t=y5((e=>e.options.hiresFix)),{t:n}=HY();return ld(CI,{gap:2,direction:"column",children:ld(E3,{label:n("options:hiresOptim"),fontSize:"md",isChecked:t,onChange:t=>e(VU(t.target.checked))})})},qae=()=>cd(CI,{gap:2,direction:"column",children:[ld(Ute,{}),ld(Gae,{})]});function Yae(){const{t:e}=HY(),t={seed:{header:`${e("options:seed")}`,feature:Nte.SEED,content:ld(Kte,{})},variations:{header:`${e("options:variations")}`,feature:Nte.VARIATIONS,content:ld(ine,{}),additionalHeaderComponents:ld(nne,{})},face_restore:{header:`${e("options:faceRestoration")}`,feature:Nte.FACE_CORRECTION,content:ld(jte,{}),additionalHeaderComponents:ld(Fte,{})},upscale:{header:`${e("options:upscaling")}`,feature:Nte.UPSCALE,content:ld(ene,{}),additionalHeaderComponents:ld(tne,{})},other:{header:`${e("options:otherOptions")}`,feature:Nte.OTHER,content:ld(qae,{})}};return cd(Xne,{children:[ld(Mne,{}),ld(Pne,{}),ld(fne,{}),ld(yne,{accordionInfo:t})]})}const Zae=()=>ld("div",{className:"workarea-single-view",children:ld("div",{className:"text-to-image-area",children:ld(ure,{})})});function Xae(){return ld(Uae,{optionsPanel:ld(Yae,{}),children:ld(Zae,{})})}var Kae=function(e,t){return Kae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Kae(e,t)};var Qae=function(){return Qae=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=n?(r(1),e.animation=null):e.animation&&(r(a),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function ase(e,t,n,r){var o=function(e){var t=e.scale,n=e.positionX,r=e.positionY;if(isNaN(t)||isNaN(n)||isNaN(r))return!1;return!0}(t);if(e.mounted&&o){var i=e.setTransformState,a=e.transformState,s=a.scale,l=a.positionX,c=a.positionY,u=t.scale-s,d=t.positionX-l,h=t.positionY-c;0===n?i(t.scale,t.positionX,t.positionY):ise(e,r,n,(function(e){i(s+u*e,l+d*e,c+h*e)}))}}var sse=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,o=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var i=function(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,i=t.offsetWidth*n,a=t.offsetHeight*n;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:i,newDiffWidth:r-i,newContentHeight:a,newDiffHeight:o-a}}(n,r,t),a=i.wrapperWidth,s=i.wrapperHeight,l=function(e,t,n,r,o,i,a){var s=e>t?n*(a?1:.5):0,l=r>o?i*(a?1:.5):0;return{minPositionX:e-t-s,maxPositionX:s,minPositionY:r-o-l,maxPositionY:l}}(a,i.newContentWidth,i.newDiffWidth,s,i.newContentHeight,i.newDiffHeight,Boolean(o));return l},lse=function(e,t){var n=sse(e,t);return e.bounds=n,n};function cse(e,t,n,r,o,i,a){var s=n.minPositionX,l=n.minPositionY,c=n.maxPositionX,u=n.maxPositionY,d=0,h=0;return a&&(d=o,h=i),{x:use(e,s-d,c+d,r),y:use(t,l-h,u+h,r)}}var use=function(e,t,n,r){return ese(r?en?n:e:e,2)};function dse(e,t,n,r,o,i){var a=e.transformState,s=a.scale,l=a.positionX,c=a.positionY,u=r-s;return"number"!=typeof t||"number"!=typeof n?(console.error("Mouse X and Y position were not provided!"),{x:l,y:c}):cse(l-t*u,c-n*u,o,i,0,0,null)}function hse(e,t,n,r,o){var i=t-(o?r:0);return!isNaN(n)&&e>=n?n:!isNaN(t)&&e<=i?i:e}var fse=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,o=e.wrapperComponent,i=t.target,a=null==o?void 0:o.contains(i);return!!(r&&i&&a)&&!Fse(i,n)},pse=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup.panning.disabled;return!(!t||!n||r)};var gse=function(e,t){var n=e.setup,r=e.transformState.scale,o=n.minScale;return t>0&&r>=o?t:0};function mse(e,t,n,r,o,i,a,s,l,c){if(o){var u;if(t>a&&n>a)return(u=a+(e-a)*c)>l?l:ui?i:u}return r?t:use(e,i,a,o)}function vse(e,t){var n=function(e){var t=e.mounted,n=e.setup,r=n.disabled,o=n.velocityAnimation,i=e.transformState.scale;return!(o.disabled&&!(i>1)&&r&&!t)}(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,i=e.setup,a=e.wrapperComponent,s=i.velocityAnimation.equalToMove,l=Date.now();if(r&&o&&a){var c=function(e,t){return t?Math.min(1,e.offsetWidth/window.innerWidth):1}(a,s),u=t.x-r.x,d=t.y-r.y,h=u/c,f=d/c,p=l-o,g=u*u+d*d,m=Math.sqrt(g)/p;e.velocity={velocityX:h,velocityY:f,total:m}}e.lastMousePosition=t,e.velocityTime=l}}function yse(e,t){var n=e.transformState.scale;ose(e),lse(e,n),t.touches?function(e,t){var n=t.touches,r=e.transformState,o=r.positionX,i=r.positionY;if(e.isPanning=!0,1===n.length){var a=n[0].clientX,s=n[0].clientY;e.startCoords={x:a-o,y:s-i}}}(e,t):function(e,t){var n=e.transformState,r=n.positionX,o=n.positionY;e.isPanning=!0;var i=t.clientX,a=t.clientY;e.startCoords={x:i-r,y:a-o}}(e,t)}function bse(e,t,n){var r=e.startCoords,o=e.setup.alignmentAnimation,i=o.sizeX,a=o.sizeY;if(r){var s=function(e,t,n){var r=e.startCoords,o=e.transformState,i=e.setup.panning,a=i.lockAxisX,s=i.lockAxisY,l=o.positionX,c=o.positionY;if(!r)return{x:l,y:c};var u=t-r.x,d=n-r.y;return{x:a?l:u,y:s?c:d}}(e,t,n),l=s.x,c=s.y,u=gse(e,i),d=gse(e,a);vse(e,{x:l,y:c}),function(e,t,n,r,o){var i=e.setup.limitToBounds,a=e.wrapperComponent,s=e.bounds,l=e.transformState,c=l.scale,u=l.positionX,d=l.positionY;if(a&&t!==u&&n!==d&&s){var h=cse(t,n,s,i,r,o,a),f=h.x,p=h.y;e.setTransformState(c,f,p)}}(e,l,c,u,d)}}function xse(e){if(e.isPanning){var t=e.setup.panning.velocityDisabled,n=e.velocity,r=e.wrapperComponent,o=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var i=null==r?void 0:r.getBoundingClientRect(),a=null==o?void 0:o.getBoundingClientRect(),s=(null==i?void 0:i.width)||0,l=(null==i?void 0:i.height)||0,c=(null==a?void 0:a.width)||0,u=(null==a?void 0:a.height)||0,d=s.1&&d?function(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,i=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,i=o.disabled,a=o.velocityAnimation,s=e.transformState.scale;return!(a.disabled&&!(s>1)&&i&&!t||!n||!r)}(e);if(i&&t&&n&&o){var a=t.velocityX,s=t.velocityY,l=t.total,c=n.maxPositionX,u=n.minPositionX,d=n.maxPositionY,h=n.minPositionY,f=r.limitToBounds,p=r.alignmentAnimation,g=r.zoomAnimation,m=r.panning,v=m.lockAxisY,y=m.lockAxisX,b=g.animationType,x=p.sizeX,w=p.sizeY,k=p.velocityAlignmentTime,S=function(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,i=n.sensitivity;return r?o*t*i:o}(e,l),C=Math.max(S,k),_=gse(e,x),E=gse(e,w),L=_*o.offsetWidth/100,P=E*o.offsetHeight/100,O=c+L,M=u-L,T=d+P,A=h-P,I=e.transformState,R=(new Date).getTime();ise(e,b,C,(function(t){var n=e.transformState,r=n.scale,o=n.positionX,i=n.positionY,l=((new Date).getTime()-R)/k,g=1-(0,nse[p.animationType])(Math.min(1,l)),m=1-t,b=o+a*m,x=i+s*m,w=mse(b,I.positionX,o,y,f,u,c,M,O,g),S=mse(x,I.positionY,i,v,f,h,d,A,T,g);o===b&&i===x||e.setTransformState(r,w,S)}))}}(e):wse(e)}}function wse(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,i=o.disabled,a=o.sizeX,s=o.sizeY,l=o.animationTime,c=o.animationType;if(!(i||td||nf||rd?c.offsetWidth:e.setup.minPositionX||0,r>f?c.offsetHeight:e.setup.minPositionY||0,o,e.bounds,s||l),y=v.x,b=v.y;return{scale:o,positionX:g?y:n,positionY:m?b:r}}}(e);u&&ase(e,u,l,c)}}function kse(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,i=e.setup,a=i.minScale,s=i.limitToBounds,l=i.zoomAnimation,c=l.disabled,u=l.animationTime,d=l.animationType,h=c||r>=a;if((r>=1||s)&&wse(e),!h&&o&&e.mounted){var f=Sse(e,a,t||o.offsetWidth/2,n||o.offsetHeight/2);f&&ase(e,f,u,d)}}function Sse(e,t,n,r){var o=e.setup,i=o.minScale,a=o.maxScale,s=o.limitToBounds,l=hse(ese(t,2),i,a,0,!1),c=dse(e,n,r,l,lse(e,l),s);return{scale:l,positionX:c.x,positionY:c.y}}var Cse={previousScale:1,scale:1,positionX:0,positionY:0},_se=Qae(Qae({},Cse),{setComponents:function(){},contextInstance:null}),Ese={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,wheel:{step:.2,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},Lse=function(e){var t,n,r,o;return{previousScale:null!==(t=e.initialScale)&&void 0!==t?t:Cse.scale,scale:null!==(n=e.initialScale)&&void 0!==n?n:Cse.scale,positionX:null!==(r=e.initialPositionX)&&void 0!==r?r:Cse.positionX,positionY:null!==(o=e.initialPositionY)&&void 0!==o?o:Cse.positionY}},Pse=function(e){var t=Qae({},Ese);return Object.keys(e).forEach((function(n){var r=void 0!==e[n];if(void 0!==Ese[n]&&r){var o=Object.prototype.toString.call(Ese[n]),i="[object Object]"===o,a="[object Array]"===o;t[n]=i?Qae(Qae({},Ese[n]),e[n]):a?Jae(Jae([],Ese[n]),e[n]):e[n]}})),t},Ose=function(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,i=e.setup,a=i.maxScale,s=i.minScale,l=i.zoomAnimation.size;if(!o)throw new Error("Wrapper is not mounted");var c=r*Math.exp(t*n);return hse(ese(c,3),s,a,l,!1)};function Mse(e,t,n,r,o){var i=e.wrapperComponent,a=e.transformState,s=a.scale,l=a.positionX,c=a.positionY;if(!i)return console.error("No WrapperComponent found");var u=(i.offsetWidth/2-l)/s,d=(i.offsetHeight/2-c)/s,h=Sse(e,Ose(e,t,n),u,d);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");ase(e,h,r,o)}function Tse(e,t,n){var r=e.setup,o=e.wrapperComponent,i=r.limitToBounds,a=Lse(e.props),s=e.transformState,l=s.scale,c=s.positionX,u=s.positionY;if(o){var d=sse(e,a.scale),h=cse(a.positionX,a.positionY,d,i,0,0,o),f={scale:a.scale,positionX:h.x,positionY:h.y};l===a.scale&&c===a.positionX&&u===a.positionY||ase(e,f,t,n)}}var Ase=function(e){return function(t,n,r){void 0===t&&(t=.5),void 0===n&&(n=300),void 0===r&&(r="easeOut"),Mse(e,1,t,n,r)}},Ise=function(e){return function(t,n,r){void 0===t&&(t=.5),void 0===n&&(n=300),void 0===r&&(r="easeOut"),Mse(e,-1,t,n,r)}},Rse=function(e){return function(t,n,r,o,i){void 0===o&&(o=300),void 0===i&&(i="easeOut");var a=e.transformState,s=a.positionX,l=a.positionY,c=a.scale,u=e.wrapperComponent,d=e.contentComponent;if(!e.setup.disabled&&u&&d){var h={positionX:isNaN(t)?s:t,positionY:isNaN(n)?l:n,scale:isNaN(r)?c:r};ase(e,h,o,i)}}},Nse=function(e){return function(t,n){void 0===t&&(t=200),void 0===n&&(n="easeOut"),Tse(e,t,n)}},Dse=function(e){return function(t,n,r){void 0===n&&(n=200),void 0===r&&(r="easeOut");var o=e.transformState,i=e.wrapperComponent,a=e.contentComponent;if(i&&a){var s=Vse(t||o.scale,i,a);ase(e,s,n,r)}}},zse=function(e){return function(t,n,r,o){void 0===r&&(r=600),void 0===o&&(o="easeOut"),ose(e);var i=e.wrapperComponent,a="string"==typeof t?document.getElementById(t):t;if(i&&function(e){return e?void 0!==(null==e?void 0:e.offsetWidth)&&void 0!==(null==e?void 0:e.offsetHeight)||(console.error("Zoom node is not valid - it must contain offsetWidth and offsetHeight"),!1):(console.error("Zoom node not found"),!1)}(a)&&a&&i.contains(a)){var s=function(e,t,n){var r=e.wrapperComponent,o=e.setup,i=o.limitToBounds,a=o.minScale,s=o.maxScale;if(!r)return Cse;var l=r.getBoundingClientRect(),c=function(e){for(var t=e,n=0,r=0;t;)n+=t.offsetLeft,r+=t.offsetTop,t=t.offsetParent;return{x:n,y:r}}(t),u=c.x,d=c.y,h=t.offsetWidth,f=t.offsetHeight,p=r.offsetWidth/h,g=r.offsetHeight/f,m=hse(n||Math.min(p,g),a,s,0,!1),v=(l.width-h*m)/2,y=(l.height-f*m)/2,b=cse((l.left-u)*m+v,(l.top-d)*m+y,sse(e,m),i,0,0,r);return{positionX:b.x,positionY:b.y,scale:m}}(e,a,n);ase(e,s,r,o)}}},Bse=function(e){return{instance:e,state:e.transformState,zoomIn:Ase(e),zoomOut:Ise(e),setTransform:Rse(e),resetTransform:Nse(e),centerView:Dse(e),zoomToElement:zse(e)}};function jse(){try{return{get passive(){return!0,!1}}}catch(Jhe){return!1}}var Fse=function(e,t){var n=e.tagName.toUpperCase();return!!t.find((function(e){return e.toUpperCase()===n}))||!!t.find((function(t){return e.classList.contains(t)}))},Hse=function(e){e&&clearTimeout(e)},Wse=function(e,t,n){return"translate3d("+e+"px, "+t+"px, 0) scale("+n+")"},Vse=function(e,t,n){var r=n.offsetWidth*e,o=n.offsetHeight*e;return{scale:e,positionX:(t.offsetWidth-r)/2,positionY:(t.offsetHeight-o)/2}},Use=function(e,t){var n=e.setup.wheel,r=n.disabled,o=n.wheelDisabled,i=n.touchPadDisabled,a=n.excluded,s=e.isInitialized,l=e.isPanning,c=t.target;return!(!s||l||r||!c)&&(!(o&&!t.ctrlKey)&&((!i||!t.ctrlKey)&&!Fse(c,a)))};function $se(e,t,n){var r=t.getBoundingClientRect(),o=0,i=0;if("clientX"in e)o=(e.clientX-r.left)/n,i=(e.clientY-r.top)/n;else{var a=e.touches[0];o=(a.clientX-r.left)/n,i=(a.clientY-r.top)/n}return(isNaN(o)||isNaN(i))&&console.error("No mouse or touch offset found"),{x:o,y:i}}var Gse=function(e,t){var n=e.setup.pinch,r=n.disabled,o=n.excluded,i=e.isInitialized,a=t.target;return!(!i||r||!a)&&!Fse(a,o)},qse=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance;return!(!n||t||!r)},Yse=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},Zse=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(ose(e),tse(Bse(e),t,r),tse(Bse(e),t,o))},Xse=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,i=e.contentComponent,a=e.setup,s=e.transformState.scale,l=a.limitToBounds,c=a.centerZoomedOut,u=a.zoomAnimation,d=a.wheel,h=u.size,f=u.disabled,p=d.step;if(!i)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var g=function(e,t){var n,r,o=e?e.deltaY<0?1:-1:0;return r=o,"number"==typeof(n=t)?n:r}(t,null),m=function(e,t,n,r,o){var i=e.transformState.scale,a=e.wrapperComponent,s=e.setup,l=s.maxScale,c=s.minScale,u=s.zoomAnimation,d=u.size,h=u.disabled;if(!a)throw new Error("Wrapper is not mounted");var f=i+t*(i-i*n)*n;if(o)return f;var p=!r&&!h;return hse(ese(f,3),c,l,d,p)}(e,g,p,!t.ctrlKey);if(s!==m){var v=lse(e,m),y=$se(t,i,s),b=l&&(f||0===h||c),x=dse(e,y.x,y.y,m,v,b),w=x.x,k=x.y;e.previousWheelEvent=t,e.setTransformState(m,w,k),tse(Bse(e),t,r),tse(Bse(e),t,o)}},Kse=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;Hse(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout((function(){e.mounted&&(kse(e,t.x,t.y),e.wheelAnimationTimer=null)}),100);var i=function(e,t){var n=e.previousWheelEvent,r=e.transformState.scale,o=e.setup,i=o.maxScale,a=o.minScale;return!!n&&(ra||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY))}(e,t);i&&(Hse(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout((function(){e.mounted&&(e.wheelStopEventTimer=null,tse(Bse(e),t,r),tse(Bse(e),t,o))}),160))},Qse=function(e,t){var n=Yse(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,ose(e)},Jse=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,i=e.setup,a=i.limitToBounds,s=i.centerZoomedOut,l=i.zoomAnimation,c=l.disabled,u=l.size;if(null!==r&&n){var d=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,i=ese(o[0].clientX-r.left,5),a=ese(o[0].clientY-r.top,5);return{x:(i+ese(o[1].clientX-r.left,5))/2/t,y:(a+ese(o[1].clientY-r.top,5))/2/t}}(t,o,n);if(isFinite(d.x)&&isFinite(d.y)){var h=Yse(t),f=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,i=o.maxScale,a=o.minScale,s=o.zoomAnimation,l=s.size,c=s.disabled;if(!n||null===r||!t)throw new Error("Pinch touches distance was not provided");return t<0?e.transformState.scale:hse(ese(t/r*n,2),a,i,l,!c)}(e,h);if(f!==o){var p=lse(e,f),g=a&&(c||0===u||s),m=dse(e,d.x,d.y,f,p,g),v=m.x,y=m.y;e.pinchMidpoint=d,e.lastDistance=h,e.setTransformState(f,v,y)}}}},ele=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,kse(e,null==t?void 0:t.x,null==t?void 0:t.y)};function tle(e,t){var n=e.setup.doubleClick,r=n.disabled,o=n.mode,i=n.step,a=n.animationTime,s=n.animationType;if(!r){if("reset"===o)return Tse(e,a,s);var l=e.transformState.scale,c=e.contentComponent;if(!c)return console.error("No ContentComponent found");var u=Ose(e,"zoomOut"===o?-1:1,i),d=$se(t,c,l),h=Sse(e,u,d.x,d.y);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");ase(e,h,a,s)}}var nle=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,i=r.doubleClick,a=i.disabled,s=i.excluded,l=t.target,c=null==o?void 0:o.contains(l),u=n&&l&&c&&!a;return!!u&&(!Fse(l,s)&&!!u)},rle=H.createContext(_se),ole=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mounted=!0,t.transformState=Lse(t.props),t.setup=Pse(t.props),t.wrapperComponent=null,t.contentComponent=null,t.isInitialized=!1,t.bounds=null,t.previousWheelEvent=null,t.wheelStopEventTimer=null,t.wheelAnimationTimer=null,t.isPanning=!1,t.startCoords=null,t.lastTouch=null,t.distance=null,t.lastDistance=null,t.pinchStartDistance=null,t.pinchStartScale=null,t.pinchMidpoint=null,t.velocity=null,t.velocityTime=null,t.lastMousePosition=null,t.animate=!1,t.animation=null,t.maxBounds=null,t.pressedKeys={},t.handleInitializeWrapperEvents=function(e){var n=jse();e.addEventListener("wheel",t.onWheelZoom,n),e.addEventListener("dblclick",t.onDoubleClick,n),e.addEventListener("touchstart",t.onTouchPanningStart,n),e.addEventListener("touchmove",t.onTouchPanning,n),e.addEventListener("touchend",t.onTouchPanningStop,n)},t.handleInitialize=function(){var e=t.setup.centerOnInit;t.applyTransformation(),t.forceUpdate(),e&&(setTimeout((function(){t.mounted&&t.setCenter()}),50),setTimeout((function(){t.mounted&&t.setCenter()}),100),setTimeout((function(){t.mounted&&t.setCenter()}),200))},t.onWheelZoom=function(e){t.setup.disabled||Use(t,e)&&t.isPressingKeys(t.setup.wheel.activationKeys)&&(Zse(t,e),Xse(t,e),Kse(t,e))},t.onPanningStart=function(e){var n=t.setup.disabled,r=t.props.onPanningStart;n||fse(t,e)&&t.isPressingKeys(t.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),ose(t),yse(t,e),tse(Bse(t),e,r))},t.onPanning=function(e){var n=t.setup.disabled,r=t.props.onPanning;n||pse(t)&&t.isPressingKeys(t.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),bse(t,e.clientX,e.clientY),tse(Bse(t),e,r))},t.onPanningStop=function(e){var n=t.props.onPanningStop;t.isPanning&&(xse(t),tse(Bse(t),e,n))},t.onPinchStart=function(e){var n=t.setup.disabled,r=t.props,o=r.onPinchingStart,i=r.onZoomStart;n||Gse(t,e)&&(Qse(t,e),ose(t),tse(Bse(t),e,o),tse(Bse(t),e,i))},t.onPinch=function(e){var n=t.setup.disabled,r=t.props,o=r.onPinching,i=r.onZoom;n||qse(t)&&(e.preventDefault(),e.stopPropagation(),Jse(t,e),tse(Bse(t),e,o),tse(Bse(t),e,i))},t.onPinchStop=function(e){var n=t.props,r=n.onPinchingStop,o=n.onZoomStop;t.pinchStartScale&&(ele(t),tse(Bse(t),e,r),tse(Bse(t),e,o))},t.onTouchPanningStart=function(e){var n=t.setup.disabled,r=t.props.onPanningStart;if(!n&&fse(t,e))if(t.lastTouch&&+new Date-t.lastTouch<200&&1===e.touches.length)t.onDoubleClick(e);else{t.lastTouch=+new Date,ose(t);var o=e.touches,i=1===o.length,a=2===o.length;i&&(ose(t),yse(t,e),tse(Bse(t),e,r)),a&&t.onPinchStart(e)}},t.onTouchPanning=function(e){var n=t.setup.disabled,r=t.props.onPanning;if(t.isPanning&&1===e.touches.length){if(n)return;if(!pse(t))return;e.preventDefault(),e.stopPropagation();var o=e.touches[0];bse(t,o.clientX,o.clientY),tse(Bse(t),e,r)}else e.touches.length>1&&t.onPinch(e)},t.onTouchPanningStop=function(e){t.onPanningStop(e),t.onPinchStop(e)},t.onDoubleClick=function(e){t.setup.disabled||nle(t,e)&&tle(t,e)},t.clearPanning=function(e){t.isPanning&&t.onPanningStop(e)},t.setKeyPressed=function(e){t.pressedKeys[e.key]=!0},t.setKeyUnPressed=function(e){t.pressedKeys[e.key]=!1},t.isPressingKeys=function(e){return!e.length||Boolean(e.find((function(e){return t.pressedKeys[e]})))},t.setComponents=function(e,n){t.wrapperComponent=e,t.contentComponent=n,lse(t,t.transformState.scale),t.handleInitializeWrapperEvents(e),t.handleInitialize(),t.handleRef(),t.isInitialized=!0,tse(Bse(t),void 0,t.props.onInit)},t.setTransformState=function(e,n,r){isNaN(e)||isNaN(n)||isNaN(r)?console.error("Detected NaN set state values"):(e!==t.transformState.scale&&(t.transformState.previousScale=t.transformState.scale,t.transformState.scale=e),t.transformState.positionX=n,t.transformState.positionY=r,t.applyTransformation())},t.setCenter=function(){if(t.wrapperComponent&&t.contentComponent){var e=Vse(t.transformState.scale,t.wrapperComponent,t.contentComponent);t.setTransformState(e.scale,e.positionX,e.positionY)}},t.applyTransformation=function(){if(t.mounted&&t.contentComponent){var e=t.transformState,n=e.scale,r=e.positionX,o=e.positionY,i=Wse(r,o,n);t.contentComponent.style.transform=i,t.handleRef()}},t.handleRef=function(){t.props.setRef(Bse(t))},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Kae(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){var e=jse();window.addEventListener("mousedown",this.onPanningStart,e),window.addEventListener("mousemove",this.onPanning,e),window.addEventListener("mouseup",this.onPanningStop,e),document.addEventListener("mouseleave",this.clearPanning,e),window.addEventListener("keyup",this.setKeyUnPressed,e),window.addEventListener("keydown",this.setKeyPressed,e),this.handleRef()},t.prototype.componentWillUnmount=function(){var e=jse();window.removeEventListener("mousedown",this.onPanningStart,e),window.removeEventListener("mousemove",this.onPanning,e),window.removeEventListener("mouseup",this.onPanningStop,e),window.removeEventListener("keyup",this.setKeyUnPressed,e),window.removeEventListener("keydown",this.setKeyPressed,e),ose(this)},t.prototype.componentDidUpdate=function(e){e!==this.props&&(lse(this,this.transformState.scale),this.setup=Pse(this.props))},t.prototype.render=function(){var e=Bse(this),t=this.props.children,n="function"==typeof t?t(e):t;return ld(rle.Provider,{value:Qae(Qae({},this.transformState),{setComponents:this.setComponents,contextInstance:this}),children:n})},t}(a.exports.Component),ile=H.forwardRef((function(e,t){var n=a.exports.useState(null),r=n[0],o=n[1];return a.exports.useImperativeHandle(t,(function(){return r}),[r]),ld(ole,{...Qae({},e,{setRef:o})})}));var ale="transform-component-module_wrapper__1_Fgj",sle="transform-component-module_content__2jYgh";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".transform-component-module_wrapper__1_Fgj {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n}\n.transform-component-module_content__2jYgh {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__2jYgh img {\n pointer-events: none;\n}\n");var lle=function(e){var t=e.children,n=e.wrapperClass,r=void 0===n?"":n,o=e.contentClass,i=void 0===o?"":o,s=e.wrapperStyle,l=e.contentStyle,c=a.exports.useContext(rle).setComponents,u=a.exports.useRef(null),d=a.exports.useRef(null);return a.exports.useEffect((function(){var e=u.current,t=d.current;null!==e&&null!==t&&c&&c(e,t)}),[]),ld("div",{ref:u,className:"react-transform-wrapper "+ale+" "+r,style:s,children:ld("div",{ref:d,className:"react-transform-component "+sle+" "+i,style:l,children:t})})};function cle({image:e,alt:t,ref:n,styleClass:r}){const[o,i]=a.exports.useState(0),[s,l]=a.exports.useState(!1),c=()=>{i(-3===o?0:o-1)},u=()=>{i(3===o?0:o+1)},d=()=>{l(!s)};return ld(ile,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:({zoomIn:a,zoomOut:h,resetTransform:f,centerView:p})=>cd(sd,{children:[cd("div",{className:"lightbox-image-options",children:[ld(S3,{icon:ld(R9,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>a(),fontSize:20}),ld(S3,{icon:ld(N9,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>h(),fontSize:20}),ld(S3,{icon:ld(A9,{}),"aria-label":"Rotate Left",tooltip:"Rotate Left",onClick:c,fontSize:20}),ld(S3,{icon:ld(I9,{}),"aria-label":"Rotate Right",tooltip:"Rotate Right",onClick:u,fontSize:20}),ld(S3,{icon:ld(Y3,{}),"aria-label":"Flip Image",tooltip:"Flip Image",onClick:d,fontSize:20}),ld(S3,{icon:ld(T9,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{f(),i(0),l(!1)},fontSize:20})]}),ld(lle,{wrapperStyle:{width:"100%",height:"100%"},children:ld("img",{style:{transform:`rotate(${90*o}deg) scaleX(${s?-1:1})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>p(1,0,"easeOut")})})]})})}function ule(){const e=v5(),t=y5((e=>e.options.isLightBoxOpen)),{viewerImageToDisplay:n,shouldShowImageDetails:r,isOnFirstImage:o,isOnLastImage:i}=y5(sre),[s,l]=a.exports.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)};return Cte("Esc",(()=>{t&&e(qU(!1))}),[t]),cd("div",{className:"lightbox-container",children:[ld(S3,{icon:ld(M9,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(qU(!1))},fontSize:20}),cd("div",{className:"lightbox-display-container",children:[cd("div",{className:"lightbox-preview-wrapper",children:[ld(rre,{}),!r&&cd("div",{className:"current-image-next-prev-buttons",children:[ld("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!o&&ld(zT,{"aria-label":"Previous image",icon:ld(T5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(H$())}})}),ld("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:c,onMouseOut:u,children:s&&!i&&ld(zT,{"aria-label":"Next image",icon:ld(A5,{className:"next-prev-button"}),variant:"unstyled",onClick:()=>{e(F$())}})})]}),n&&cd(sd,{children:[ld(cle,{image:n.url,styleClass:"lightbox-image"}),r&&ld(are,{image:n})]})]}),ld(Hae,{})]})]})}function dle(){const e=v5(),t=y5((e=>e.options.seamBlur)),{t:n}=HY();return ld(Wte,{sliderMarkRightOffset:-4,label:n("options:seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:t=>{e(t$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(t$(16))}})}function hle(){const e=v5(),{t:t}=HY(),n=y5((e=>e.options.seamSize));return ld(Wte,{sliderMarkRightOffset:-6,label:t("options:seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:t=>{e(r$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(r$(96))})}function fle(){const{t:e}=HY(),t=y5((e=>e.options.seamSteps)),n=v5();return ld(Wte,{sliderMarkRightOffset:-4,label:e("options:seamSteps"),min:1,max:32,sliderNumberInputProps:{max:999},value:t,onChange:e=>{n(o$(e))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(o$(10))}})}function ple(){const e=v5(),{t:t}=HY(),n=y5((e=>e.options.seamStrength));return ld(Wte,{sliderMarkRightOffset:-7,label:t("options:seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:t=>{e(i$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(i$(.7))}})}const gle=()=>cd(CI,{direction:"column",gap:"1rem",children:[ld(hle,{}),ld(dle,{}),ld(ple,{}),ld(fle,{})]}),mle=uV(bne,(e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),vle=()=>{const e=v5(),{boundingBoxDimensions:t}=y5(mle),{t:n}=HY();return cd(CI,{direction:"column",gap:"1rem",children:[ld(Wte,{label:n("options:width"),min:64,max:1024,step:64,value:t.width,onChange:n=>{e(QZ({...t,width:Math.floor(n)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(QZ({...t,width:Math.floor(512)}))}}),ld(Wte,{label:n("options:height"),min:64,max:1024,step:64,value:t.height,onChange:n=>{e(QZ({...t,height:Math.floor(n)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(QZ({...t,height:Math.floor(512)}))}})]})},yle=uV(bne,(e=>{const{inpaintReplace:t,shouldUseInpaintReplace:n}=e;return{inpaintReplace:t,shouldUseInpaintReplace:n}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}});function ble(){const{inpaintReplace:e,shouldUseInpaintReplace:t}=y5(yle),n=v5(),{t:r}=HY();return cd(CI,{alignItems:"center",columnGap:"0.2rem",children:[ld(Wte,{label:r("options:inpaintReplace"),value:e,onChange:e=>{n(lX(e))},min:0,max:1,step:.05,isInteger:!1,isSliderDisabled:!t,withSliderMarks:!0,sliderMarkRightOffset:-2,withReset:!0,handleReset:()=>n(lX(.1)),withInput:!0,isResetDisabled:!t}),ld(E3,{isChecked:t,onChange:e=>n(NX(e.target.checked)),marginTop:"1.25rem"})]})}const xle=uV([I3,M3,bne],((e,t,n)=>{const{tileSize:r,infillMethod:o}=e,{infill_methods:i}=t,{boundingBoxScaleMethod:a,scaledBoundingBoxDimensions:s}=n;return{boundingBoxScale:a,scaledBoundingBoxDimensions:s,tileSize:r,infillMethod:o,availableInfillMethods:i,isManual:"manual"===a}}),{memoizeOptions:{resultEqualityCheck:A$.isEqual}}),wle=()=>{const e=v5(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:o,isManual:i,scaledBoundingBoxDimensions:a}=y5(xle),{t:s}=HY();return cd(CI,{direction:"column",gap:"1rem",children:[ld(L3,{label:s("options:scaleBeforeProcessing"),validValues:_Z,value:o,onChange:t=>{e(eX(t.target.value))}}),ld(Wte,{isInputDisabled:!i,isResetDisabled:!i,isSliderDisabled:!i,label:s("options:scaledWidth"),min:64,max:1024,step:64,value:a.width,onChange:t=>{e(WX({...a,width:Math.floor(t)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(WX({...a,width:Math.floor(512)}))}}),ld(Wte,{isInputDisabled:!i,isResetDisabled:!i,isSliderDisabled:!i,label:s("options:scaledHeight"),min:64,max:1024,step:64,value:a.height,onChange:t=>{e(WX({...a,height:Math.floor(t)}))},sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:()=>{e(WX({...a,height:Math.floor(512)}))}}),ld(ble,{}),ld(L3,{label:s("options:infillMethod"),value:n,validValues:r,onChange:t=>e($U(t.target.value))}),ld(Wte,{isInputDisabled:"tile"!==n,isResetDisabled:"tile"!==n,isSliderDisabled:"tile"!==n,sliderMarkRightOffset:-4,label:s("options:tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:t=>{e(k$(t))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(k$(32))}})]})};function kle(){const{t:e}=HY(),t={boundingBox:{header:`${e("options:boundingBoxHeader")}`,feature:Nte.BOUNDING_BOX,content:ld(vle,{})},seamCorrection:{header:`${e("options:seamCorrectionHeader")}`,feature:Nte.SEAM_CORRECTION,content:ld(gle,{})},infillAndScaling:{header:`${e("options:infillScalingHeader")}`,feature:Nte.INFILL_AND_SCALING,content:ld(wle,{})},seed:{header:`${e("options:seed")}`,feature:Nte.SEED,content:ld(Kte,{})},variations:{header:`${e("options:variations")}`,feature:Nte.VARIATIONS,content:ld(ine,{}),additionalHeaderComponents:ld(nne,{})}};return cd(Xne,{children:[ld(Mne,{}),ld(Pne,{}),ld(fne,{}),ld(Vte,{label:e("options:img2imgStrength"),styleClass:"main-option-block image-to-image-strength-main-option"}),ld(yne,{accordionInfo:t})]})}const Sle=uV(bne,wne,A3,((e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}})),Cle=()=>{const e=v5(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=y5(Sle),i=a.exports.useRef(null);return a.exports.useLayoutEffect((()=>{window.setTimeout((()=>{if(!i.current)return;const{clientWidth:t,clientHeight:n}=i.current;e(rX({width:t,height:n})),e(o?XZ():ZZ()),e(aX(!1))}),0)}),[e,r,t,n,o]),ld("div",{ref:i,className:"inpainting-canvas-area",children:ld(hT,{thickness:"2px",speed:"1s",size:"xl"})})};var _le={exports:{}},Ele=function(e){var t={},n=a.exports,r=G.exports,o=Object.assign;function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n--s||o[a]!==i[s]){var l="\n"+o[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}}while(1<=a&&0<=s);break}}}finally{rt=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?nt(e):""}var it=Object.prototype.hasOwnProperty,at=[],st=-1;function lt(e){return{current:e}}function ct(e){0>st||(e.current=at[st],at[st]=null,st--)}function ut(e,t){st++,at[st]=e.current,e.current=t}var dt={},ht=lt(dt),ft=lt(!1),pt=dt;function gt(e,t){var n=e.type.contextTypes;if(!n)return dt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,i={};for(o in n)i[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function mt(e){return null!=(e=e.childContextTypes)}function vt(){ct(ft),ct(ht)}function yt(e,t,n){if(ht.current!==dt)throw Error(i(168));ut(ht,t),ut(ft,n)}function bt(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(i(108,C(e)||"Unknown",a));return o({},n,r)}function xt(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||dt,pt=ht.current,ut(ht,e),ut(ft,ft.current),!0}function wt(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=bt(e,t,pt),r.__reactInternalMemoizedMergedChildContext=e,ct(ft),ct(ht),ut(ht,e)):ct(ft),ut(ft,n)}var kt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(St(e)/Ct|0)|0},St=Math.log,Ct=Math.LN2;var _t=64,Et=4194304;function Lt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pt(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,a=268435455&n;if(0!==a){var s=a&~o;0!==s?r=Lt(s):0!==(i&=a)&&(r=Lt(i))}else 0!==(a=n&~o)?r=Lt(a):0!==i&&(r=Lt(i));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&o)&&((o=r&-r)>=(i=t&-t)||16===o&&0!=(4194240&i)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function It(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-kt(t)]=n}function Rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-kt(n),o=1<>=a,o-=a,cn=1<<32-kt(t)+o|n<h?(f=d,d=null):f=d.sibling;var p=m(o,d,s[h],l);if(null===p){null===d&&(d=f);break}e&&d&&null===p.alternate&&t(o,d),i=a(p,i,h),null===u?c=p:u.sibling=p,u=p,d=f}if(h===s.length)return n(o,d),vn&&dn(o,h),c;if(null===d){for(;hf?(p=h,h=null):p=h.sibling;var b=m(o,h,y.value,c);if(null===b){null===h&&(h=p);break}e&&h&&null===b.alternate&&t(o,h),s=a(b,s,f),null===d?u=b:d.sibling=b,d=b,h=p}if(y.done)return n(o,h),vn&&dn(o,f),u;if(null===h){for(;!y.done;f++,y=l.next())null!==(y=g(o,y.value,c))&&(s=a(y,s,f),null===d?u=y:d.sibling=y,d=y);return vn&&dn(o,f),u}for(h=r(o,h);!y.done;f++,y=l.next())null!==(y=v(h,o,f,y.value,c))&&(e&&null!==y.alternate&&h.delete(null===y.key?f:y.key),s=a(y,s,f),null===d?u=y:d.sibling=y,d=y);return e&&h.forEach((function(e){return t(o,e)})),vn&&dn(o,f),u}return function e(r,i,a,d){if("object"==typeof a&&null!==a&&a.type===u&&null===a.key&&(a=a.props.children),"object"==typeof a&&null!==a){switch(a.$$typeof){case l:e:{for(var h=a.key,f=i;null!==f;){if(f.key===h){if((h=a.type)===u){if(7===f.tag){n(r,f.sibling),(i=o(f,a.props.children)).return=r,r=i;break e}}else if(f.elementType===h||"object"==typeof h&&null!==h&&h.$$typeof===b&&dr(h)===f.type){n(r,f.sibling),(i=o(f,a.props)).ref=cr(r,f,a),i.return=r,r=i;break e}n(r,f);break}t(r,f),f=f.sibling}a.type===u?((i=fs(a.props.children,r.mode,d,a.key)).return=r,r=i):((d=hs(a.type,a.key,a.props,null,r.mode,d)).ref=cr(r,i,a),d.return=r,r=d)}return s(r);case c:e:{for(f=a.key;null!==i;){if(i.key===f){if(4===i.tag&&i.stateNode.containerInfo===a.containerInfo&&i.stateNode.implementation===a.implementation){n(r,i.sibling),(i=o(i,a.children||[])).return=r,r=i;break e}n(r,i);break}t(r,i),i=i.sibling}(i=ms(a,r.mode,d)).return=r,r=i}return s(r);case b:return e(r,i,(f=a._init)(a._payload),d)}if(A(a))return y(r,i,a,d);if(k(a))return x(r,i,a,d);ur(r,a)}return"string"==typeof a&&""!==a||"number"==typeof a?(a=""+a,null!==i&&6===i.tag?(n(r,i.sibling),(i=o(i,a)).return=r,r=i):(n(r,i),(i=gs(a,r.mode,d)).return=r,r=i),s(r)):n(r,i)}}var fr=hr(!0),pr=hr(!1),gr={},mr=lt(gr),vr=lt(gr),yr=lt(gr);function br(e){if(e===gr)throw Error(i(174));return e}function xr(e,t){ut(yr,t),ut(vr,e),ut(mr,gr),e=R(t),ct(mr),ut(mr,e)}function wr(){ct(mr),ct(vr),ct(yr)}function kr(e){var t=br(yr.current),n=br(mr.current);n!==(t=N(n,e.type,t))&&(ut(vr,e),ut(mr,t))}function Sr(e){vr.current===e&&(ct(mr),ct(vr))}var Cr=lt(0);function _r(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ze(n)||Be(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Er=[];function Lr(){for(var e=0;en?n:4,e(!0);var r=Or.transition;Or.transition={};try{e(!1),t()}finally{Nt=n,Or.transition=r}}function vo(){return Vr().memoizedState}function yo(e,t,n){var r=Ra(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xo(e))wo(t,n);else if(null!==(n=$n(e,t,n,r))){Na(n,e,r,Ia()),ko(n,t,r)}}function bo(e,t,n){var r=Ra(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xo(e))wo(t,o);else{var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=i(a,n);if(o.hasEagerState=!0,o.eagerState=s,Yt(s,a)){var l=t.interleaved;return null===l?(o.next=o,Un(t)):(o.next=l.next,l.next=o),void(t.interleaved=o)}}catch(U2){}null!==(n=$n(e,t,o,r))&&(Na(n,e,r,o=Ia()),ko(n,t,r))}}function xo(e){var t=e.alternate;return e===Tr||null!==t&&t===Tr}function wo(e,t){Nr=Rr=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ko(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Rt(e,n)}}var So={readContext:Wn,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:!1},Co={readContext:Wn,useCallback:function(e,t){return Wr().memoizedState=[e,void 0===t?null:t],e},useContext:Wn,useEffect:io,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,ro(4194308,4,co.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ro(4194308,4,e,t)},useInsertionEffect:function(e,t){return ro(4,2,e,t)},useMemo:function(e,t){var n=Wr();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wr();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=yo.bind(null,Tr,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Wr().memoizedState=e},useState:eo,useDebugValue:ho,useDeferredValue:function(e){return Wr().memoizedState=e},useTransition:function(){var e=eo(!1),t=e[0];return e=mo.bind(null,e[1]),Wr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Tr,o=Wr();if(vn){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===aa)throw Error(i(349));0!=(30&Mr)||Zr(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,io(Kr.bind(null,r,a,e),[e]),r.flags|=2048,to(9,Xr.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Wr(),t=aa.identifierPrefix;if(vn){var n=un;t=":"+t+"R"+(n=(cn&~(1<<32-kt(cn)-1)).toString(32)+n),0<(n=Dr++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=zr++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_o={readContext:Wn,useCallback:fo,useContext:Wn,useEffect:ao,useImperativeHandle:uo,useInsertionEffect:so,useLayoutEffect:lo,useMemo:po,useReducer:$r,useRef:no,useState:function(){return $r(Ur)},useDebugValue:ho,useDeferredValue:function(e){return go(Vr(),Ar.memoizedState,e)},useTransition:function(){return[$r(Ur)[0],Vr().memoizedState]},useMutableSource:qr,useSyncExternalStore:Yr,useId:vo,unstable_isNewReconciler:!1},Eo={readContext:Wn,useCallback:fo,useContext:Wn,useEffect:ao,useImperativeHandle:uo,useInsertionEffect:so,useLayoutEffect:lo,useMemo:po,useReducer:Gr,useRef:no,useState:function(){return Gr(Ur)},useDebugValue:ho,useDeferredValue:function(e){var t=Vr();return null===Ar?t.memoizedState=e:go(t,Ar.memoizedState,e)},useTransition:function(){return[Gr(Ur)[0],Vr().memoizedState]},useMutableSource:qr,useSyncExternalStore:Yr,useId:vo,unstable_isNewReconciler:!1};function Lo(e,t){try{var n="",r=t;do{n+=Tn(r),r=r.return}while(r);var o=n}catch(pue){o="\nError generating stack: "+pue.message+"\n"+pue.stack}return{value:e,source:t,stack:o,digest:null}}function Po(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function Oo(e,t){try{console.error(t.value)}catch(due){setTimeout((function(){throw due}))}}var Mo="function"==typeof WeakMap?WeakMap:Map;function To(e,t,n){(n=Xn(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Sa||(Sa=!0,Ca=r),Oo(0,t)},n}function Ao(e,t,n){(n=Xn(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Oo(0,t)}}var i=e.stateNode;return null!==i&&"function"==typeof i.componentDidCatch&&(n.callback=function(){Oo(0,t),"function"!=typeof r&&(null===_a?_a=new Set([this]):_a.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function Io(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new Mo;var o=new Set;r.set(t,o)}else void 0===(o=r.get(t))&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=rs.bind(null,e,t,n),t.then(e,e))}function Ro(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function No(e,t,n,r,o){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Xn(-1,1)).tag=2,Kn(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var Do=s.ReactCurrentOwner,zo=!1;function Bo(e,t,n,r){t.child=null===e?pr(t,null,n,r):fr(t,e.child,n,r)}function jo(e,t,n,r,o){n=n.render;var i=t.ref;return Hn(t,o),r=Fr(e,t,n,r,i,o),n=Hr(),null===e||zo?(vn&&n&&fn(t),t.flags|=1,Bo(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,li(e,t,o))}function Fo(e,t,n,r,o){if(null===e){var i=n.type;return"function"!=typeof i||us(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=hs(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,Ho(e,t,i,r,o))}if(i=e.child,0==(e.lanes&o)){var a=i.memoizedProps;if((n=null!==(n=n.compare)?n:Mn)(a,r)&&e.ref===t.ref)return li(e,t,o)}return t.flags|=1,(e=ds(i,r)).ref=t.ref,e.return=t,t.child=e}function Ho(e,t,n,r,o){if(null!==e){var i=e.memoizedProps;if(Mn(i,r)&&e.ref===t.ref){if(zo=!1,t.pendingProps=r=i,0==(e.lanes&o))return t.lanes=e.lanes,li(e,t,o);0!=(131072&e.flags)&&(zo=!0)}}return Uo(e,t,n,r,o)}function Wo(e,t,n){var r=t.pendingProps,o=r.children,i=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(ua,ca),ca|=n;else{if(0==(1073741824&n))return e=null!==i?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ut(ua,ca),ca|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==i?i.baseLanes:n,ut(ua,ca),ca|=r}else null!==i?(r=i.baseLanes|n,t.memoizedState=null):r=n,ut(ua,ca),ca|=r;return Bo(e,t,o,n),t.child}function Vo(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Uo(e,t,n,r,o){var i=mt(n)?pt:ht.current;return i=gt(t,i),Hn(t,o),n=Fr(e,t,n,r,i,o),r=Hr(),null===e||zo?(vn&&r&&fn(t),t.flags|=1,Bo(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,li(e,t,o))}function $o(e,t,n,r,o){if(mt(n)){var i=!0;xt(t)}else i=!1;if(Hn(t,o),null===t.stateNode)si(e,t),ar(t,n,r),lr(t,n,r,o),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,c=n.contextType;"object"==typeof c&&null!==c?c=Wn(c):c=gt(t,c=mt(n)?pt:ht.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==c)&&sr(t,a,r,c),qn=!1;var h=t.memoizedState;a.state=h,er(t,r,a,o),l=t.memoizedState,s!==r||h!==l||ft.current||qn?("function"==typeof u&&(rr(t,n,u,r),l=t.memoizedState),(s=qn||ir(t,n,s,r,h,l,c))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Zn(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:An(t.type,s),a.props=c,d=t.pendingProps,h=a.context,"object"==typeof(l=n.contextType)&&null!==l?l=Wn(l):l=gt(t,l=mt(n)?pt:ht.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||h!==l)&&sr(t,a,r,l),qn=!1,h=t.memoizedState,a.state=h,er(t,r,a,o);var p=t.memoizedState;s!==d||h!==p||ft.current||qn?("function"==typeof f&&(rr(t,n,f,r),p=t.memoizedState),(c=qn||ir(t,n,c,r,h,p,l)||!1)?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Go(e,t,n,r,i,o)}function Go(e,t,n,r,o,i){Vo(e,t);var a=0!=(128&t.flags);if(!r&&!a)return o&&wt(t,n,!1),li(e,t,i);r=t.stateNode,Do.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=fr(t,e.child,null,i),t.child=fr(t,null,s,i)):Bo(e,t,s,i),t.memoizedState=r.state,o&&wt(t,n,!0),t.child}function qo(e){var t=e.stateNode;t.pendingContext?yt(0,t.pendingContext,t.pendingContext!==t.context):t.context&&yt(0,t.context,!1),xr(e,t.containerInfo)}function Yo(e,t,n,r,o){return Ln(),Pn(o),t.flags|=256,Bo(e,t,n,r),t.child}var Zo,Xo,Ko,Qo,Jo={dehydrated:null,treeContext:null,retryLane:0};function ei(e){return{baseLanes:e,cachePool:null,transitions:null}}function ti(e,t,n){var r,o=t.pendingProps,a=Cr.current,s=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&a)),r?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),ut(Cr,1&a),null===e)return Sn(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:Be(e)?t.lanes=8:t.lanes=1073741824,null):(l=o.children,e=o.fallback,s?(o=t.mode,s=t.child,l={mode:"hidden",children:l},0==(1&o)&&null!==s?(s.childLanes=0,s.pendingProps=l):s=ps(l,o,0,null),e=fs(e,o,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=ei(n),t.memoizedState=Jo,e):ni(t,l));if(null!==(a=e.memoizedState)&&null!==(r=a.dehydrated))return function(e,t,n,r,o,a,s){if(n)return 256&t.flags?(t.flags&=-257,ri(e,t,s,r=Po(Error(i(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=r.fallback,o=t.mode,r=ps({mode:"visible",children:r.children},o,0,null),(a=fs(a,o,s,null)).flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,0!=(1&t.mode)&&fr(t,e.child,null,s),t.child.memoizedState=ei(s),t.memoizedState=Jo,a);if(0==(1&t.mode))return ri(e,t,s,null);if(Be(o))return r=je(o).digest,a=Error(i(419)),r=Po(a,r,void 0),ri(e,t,s,r);if(n=0!=(s&e.childLanes),zo||n){if(null!==(r=aa)){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!=(o&(r.suspendedLanes|s))?0:o)&&o!==a.retryLane&&(a.retryLane=o,Gn(e,o),Na(r,e,o,-1))}return qa(),ri(e,t,s,r=Po(Error(i(421))))}return ze(o)?(t.flags|=128,t.child=e.child,t=is.bind(null,e),Fe(o,t),null):(e=a.treeContext,K&&(mn=Ue(o),gn=t,vn=!0,bn=null,yn=!1,null!==e&&(an[sn++]=cn,an[sn++]=un,an[sn++]=ln,cn=e.id,un=e.overflow,ln=t)),t=ni(t,r.children),t.flags|=4096,t)}(e,t,l,o,r,a,n);if(s){s=o.fallback,l=t.mode,r=(a=e.child).sibling;var c={mode:"hidden",children:o.children};return 0==(1&l)&&t.child!==a?((o=t.child).childLanes=0,o.pendingProps=c,t.deletions=null):(o=ds(a,c)).subtreeFlags=14680064&a.subtreeFlags,null!==r?s=ds(r,s):(s=fs(s,l,n,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,l=null===(l=e.child.memoizedState)?ei(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},s.memoizedState=l,s.childLanes=e.childLanes&~n,t.memoizedState=Jo,o}return e=(s=e.child).sibling,o=ds(s,{mode:"visible",children:o.children}),0==(1&t.mode)&&(o.lanes=n),o.return=t,o.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function ni(e,t){return(t=ps({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ri(e,t,n,r){return null!==r&&Pn(r),fr(t,e.child,null,n),(e=ni(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function oi(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Fn(e.return,t,n)}function ii(e,t,n,r,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function ai(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Bo(e,t,r.children,n),0!=(2&(r=Cr.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&oi(e,n,t);else if(19===e.tag)oi(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ut(Cr,r),0==(1&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===_r(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),ii(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===_r(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}ii(t,!0,n,null,i);break;case"together":ii(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function si(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function li(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),fa|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=ds(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=ds(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function ci(e){e.flags|=4}function ui(e,t){if(null!==e&&e.child===t.child)return!0;if(0!=(16&t.flags))return!1;for(e=t.child;null!==e;){if(0!=(12854&e.flags)||0!=(12854&e.subtreeFlags))return!1;e=e.sibling}return!0}if(Z)Zo=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)j(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Xo=function(){},Ko=function(e,t,n,r,o){if((e=e.memoizedProps)!==r){var i=t.stateNode,a=br(mr.current);n=H(i,n,e,r,o,a),(t.updateQueue=n)&&ci(t)}},Qo=function(e,t,n,r){n!==r&&ci(t)};else if(X){Zo=function(e,t,n,r){for(var o=t.child;null!==o;){if(5===o.tag){var i=o.stateNode;n&&r&&(i=Ae(i,o.type,o.memoizedProps,o)),j(e,i)}else if(6===o.tag)i=o.stateNode,n&&r&&(i=Ie(i,o.memoizedProps,o)),j(e,i);else if(4!==o.tag)if(22===o.tag&&null!==o.memoizedState)null!==(i=o.child)&&(i.return=o),Zo(e,o,!0,!0);else if(null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}};var di=function(e,t,n,r){for(var o=t.child;null!==o;){if(5===o.tag){var i=o.stateNode;n&&r&&(i=Ae(i,o.type,o.memoizedProps,o)),Oe(e,i)}else if(6===o.tag)i=o.stateNode,n&&r&&(i=Ie(i,o.memoizedProps,o)),Oe(e,i);else if(4!==o.tag)if(22===o.tag&&null!==o.memoizedState)null!==(i=o.child)&&(i.return=o),di(e,o,!0,!0);else if(null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}};Xo=function(e,t){var n=t.stateNode;if(!ui(e,t)){e=n.containerInfo;var r=Pe(e);di(r,t,!1,!1),n.pendingChildren=r,ci(t),Me(e,r)}},Ko=function(e,t,n,r,o){var i=e.stateNode,a=e.memoizedProps;if((e=ui(e,t))&&a===r)t.stateNode=i;else{var s=t.stateNode,l=br(mr.current),c=null;a!==r&&(c=H(s,n,a,r,o,l)),e&&null===c?t.stateNode=i:(i=Le(i,c,n,a,r,t,e,s),F(i,n,r,o,l)&&ci(t),t.stateNode=i,e?ci(t):Zo(i,t,!1,!1))}},Qo=function(e,t,n,r){n!==r?(e=br(yr.current),n=br(mr.current),t.stateNode=V(r,e,n,t),ci(t)):t.stateNode=e.stateNode}}else Xo=function(){},Ko=function(){},Qo=function(){};function hi(e,t){if(!vn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function fi(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=14680064&o.subtreeFlags,r|=14680064&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pi(e,t,n){var r=t.pendingProps;switch(pn(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fi(t),null;case 1:case 17:return mt(t.type)&&vt(),fi(t),null;case 3:return n=t.stateNode,wr(),ct(ft),ct(ht),Lr(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(_n(t)?ci(t):null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==bn&&(ja(bn),bn=null))),Xo(e,t),fi(t),null;case 5:Sr(t),n=br(yr.current);var o=t.type;if(null!==e&&null!=t.stateNode)Ko(e,t,o,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(i(166));return fi(t),null}if(e=br(mr.current),_n(t)){if(!K)throw Error(i(175));e=$e(t.stateNode,t.type,t.memoizedProps,n,e,t,!yn),t.updateQueue=e,null!==e&&ci(t)}else{var a=B(o,r,n,e,t);Zo(a,t,!1,!1),t.stateNode=a,F(a,o,r,n,e)&&ci(t)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return fi(t),null;case 6:if(e&&null!=t.stateNode)Qo(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=br(yr.current),n=br(mr.current),_n(t)){if(!K)throw Error(i(176));if(e=t.stateNode,n=t.memoizedProps,(r=Ge(e,n,t,!yn))&&null!==(o=gn))switch(o.tag){case 3:et(o.stateNode.containerInfo,e,n,0!=(1&o.mode));break;case 5:tt(o.type,o.memoizedProps,o.stateNode,e,n,0!=(1&o.mode))}r&&ci(t)}else t.stateNode=V(r,e,n,t)}return fi(t),null;case 13:if(ct(Cr),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(vn&&null!==mn&&0!=(1&t.mode)&&0==(128&t.flags))En(),Ln(),t.flags|=98560,o=!1;else if(o=_n(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(i(318));if(!K)throw Error(i(344));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(i(317));qe(o,t)}else Ln(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;fi(t),o=!1}else null!==bn&&(ja(bn),bn=null),o=!0;if(!o)return 65536&t.flags?t:null}return 0!=(128&t.flags)?(t.lanes=n,t):((n=null!==r)!==(null!==e&&null!==e.memoizedState)&&n&&(t.child.flags|=8192,0!=(1&t.mode)&&(null===e||0!=(1&Cr.current)?0===da&&(da=3):qa())),null!==t.updateQueue&&(t.flags|=4),fi(t),null);case 4:return wr(),Xo(e,t),null===e&&J(t.stateNode.containerInfo),fi(t),null;case 10:return jn(t.type._context),fi(t),null;case 19:if(ct(Cr),null===(o=t.memoizedState))return fi(t),null;if(r=0!=(128&t.flags),null===(a=o.rendering))if(r)hi(o,!1);else{if(0!==da||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=_r(e))){for(t.flags|=128,hi(o,!1),null!==(e=a.updateQueue)&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,n=t.child;null!==n;)o=e,(r=n).flags&=14680066,null===(a=r.alternate)?(r.childLanes=0,r.lanes=o,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=a.childLanes,r.lanes=a.lanes,r.child=a.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=a.memoizedProps,r.memoizedState=a.memoizedState,r.updateQueue=a.updateQueue,r.type=a.type,o=a.dependencies,r.dependencies=null===o?null:{lanes:o.lanes,firstContext:o.firstContext}),n=n.sibling;return ut(Cr,1&Cr.current|2),t.child}e=e.sibling}null!==o.tail&&Ht()>ba&&(t.flags|=128,r=!0,hi(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=_r(a))){if(t.flags|=128,r=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),hi(o,!0),null===o.tail&&"hidden"===o.tailMode&&!a.alternate&&!vn)return fi(t),null}else 2*Ht()-o.renderingStartTime>ba&&1073741824!==n&&(t.flags|=128,r=!0,hi(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=o.last)?e.sibling=a:t.child=a,o.last=a)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ht(),t.sibling=null,e=Cr.current,ut(Cr,r?1&e|2:1&e),t):(fi(t),null);case 22:case 23:return Va(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&0!=(1&t.mode)?0!=(1073741824&ca)&&(fi(t),Z&&6&t.subtreeFlags&&(t.flags|=8192)):fi(t),null;case 24:case 25:return null}throw Error(i(156,t.tag))}function gi(e,t){switch(pn(t),t.tag){case 1:return mt(t.type)&&vt(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return wr(),ct(ft),ct(ht),Lr(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Sr(t),null;case 13:if(ct(Cr),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));Ln()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return ct(Cr),null;case 4:return wr(),null;case 10:return jn(t.type._context),null;case 22:case 23:return Va(),null;default:return null}}var mi=!1,vi=!1,yi="function"==typeof WeakSet?WeakSet:Set,bi=null;function xi(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(mue){ns(e,t,mue)}else n.current=null}function wi(e,t,n){try{n()}catch(mue){ns(e,t,mue)}}var ki=!1;function Si(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,void 0!==i&&wi(t,n,i)}o=o.next}while(o!==r)}}function Ci(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _i(e){var t=e.ref;if(null!==t){var n=e.stateNode;if(5===e.tag)e=I(n);else e=n;"function"==typeof t?t(e):t.current=e}}function Ei(e){var t=e.alternate;null!==t&&(e.alternate=null,Ei(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&te(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Li(e){return 5===e.tag||3===e.tag||4===e.tag}function Pi(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Li(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Oi(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ye(n,e,t):fe(n,e);else if(4!==r&&null!==(e=e.child))for(Oi(e,t,n),e=e.sibling;null!==e;)Oi(e,t,n),e=e.sibling}function Mi(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ve(n,e,t):he(n,e);else if(4!==r&&null!==(e=e.child))for(Mi(e,t,n),e=e.sibling;null!==e;)Mi(e,t,n),e=e.sibling}var Ti=null,Ai=!1;function Ii(e,t,n){for(n=n.child;null!==n;)Ri(e,t,n),n=n.sibling}function Ri(e,t,n){if(qt&&"function"==typeof qt.onCommitFiberUnmount)try{qt.onCommitFiberUnmount(Gt,n)}catch(vue){}switch(n.tag){case 5:vi||xi(n,t);case 6:if(Z){var r=Ti,o=Ai;Ti=null,Ii(e,t,n),Ai=o,null!==(Ti=r)&&(Ai?xe(Ti,n.stateNode):be(Ti,n.stateNode))}else Ii(e,t,n);break;case 18:Z&&null!==Ti&&(Ai?Qe(Ti,n.stateNode):Ke(Ti,n.stateNode));break;case 4:Z?(r=Ti,o=Ai,Ti=n.stateNode.containerInfo,Ai=!0,Ii(e,t,n),Ti=r,Ai=o):(X&&(r=n.stateNode.containerInfo,o=Pe(r),Te(r,o)),Ii(e,t,n));break;case 0:case 11:case 14:case 15:if(!vi&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){o=r=r.next;do{var i=o,a=i.destroy;i=i.tag,void 0!==a&&(0!=(2&i)||0!=(4&i))&&wi(n,t,a),o=o.next}while(o!==r)}Ii(e,t,n);break;case 1:if(!vi&&(xi(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(vue){ns(n,t,vue)}Ii(e,t,n);break;case 21:Ii(e,t,n);break;case 22:1&n.mode?(vi=(r=vi)||null!==n.memoizedState,Ii(e,t,n),vi=r):Ii(e,t,n);break;default:Ii(e,t,n)}}function Ni(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new yi),t.forEach((function(t){var r=as.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Di(e,t){var n=t.deletions;if(null!==n)for(var r=0;r";case $i:return":has("+(Qi(e)||"")+")";case Gi:return'[role="'+e.value+'"]';case Yi:return'"'+e.value+'"';case qi:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function Ji(e,t){var n=[];e=[e,0];for(var r=0;ro&&(o=s),r&=~a}if(r=o,10<(r=(120>(r=Ht()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ta(r/1960))-r)){e.timeoutHandle=U(Ja.bind(null,e,va,xa),r);break}Ja(e,va,xa);break;default:throw Error(i(329))}}}return Da(e,Ht()),e.callbackNode===n?za.bind(null,e):null}function Ba(e,t){var n=ma;return e.current.memoizedState.isDehydrated&&(Ua(e,t).flags|=256),2!==(e=Ya(e,t))&&(t=va,va=n,null!==t&&ja(t)),e}function ja(e){null===va?va=e:va.push.apply(va,e)}function Fa(e,t){for(t&=~ga,t&=~pa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0e?16:e,null===La)var r=!1;else{if(e=La,La=null,Pa=0,0!=(6&ia))throw Error(i(331));var o=ia;for(ia|=4,bi=e.current;null!==bi;){var a=bi,s=a.child;if(0!=(16&bi.flags)){var l=a.deletions;if(null!==l){for(var c=0;cHt()-ya?Ua(e,0):ga|=n),Da(e,t)}function os(e,t){0===t&&(0==(1&e.mode)?t=1:(t=Et,0==(130023424&(Et<<=1))&&(Et=4194304)));var n=Ia();null!==(e=Gn(e,t))&&(It(e,t,n),Da(e,n))}function is(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),os(e,n)}function as(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}null!==r&&r.delete(t),os(e,n)}function ss(e,t){return zt(e,t)}function ls(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cs(e,t,n,r){return new ls(e,t,n,r)}function us(e){return!(!(e=e.prototype)||!e.isReactComponent)}function ds(e,t){var n=e.alternate;return null===n?((n=cs(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function hs(e,t,n,r,o,a){var s=2;if(r=e,"function"==typeof e)us(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case u:return fs(n.children,o,a,t);case d:s=8,o|=8;break;case h:return(e=cs(12,n,t,2|o)).elementType=h,e.lanes=a,e;case m:return(e=cs(13,n,t,o)).elementType=m,e.lanes=a,e;case v:return(e=cs(19,n,t,o)).elementType=v,e.lanes=a,e;case x:return ps(n,o,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case f:s=10;break e;case p:s=9;break e;case g:s=11;break e;case y:s=14;break e;case b:s=16,r=null;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=cs(s,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function fs(e,t,n,r){return(e=cs(7,e,r,t)).lanes=n,e}function ps(e,t,n,r){return(e=cs(22,e,r,t)).elementType=x,e.lanes=n,e.stateNode={isHidden:!1},e}function gs(e,t,n){return(e=cs(6,e,null,t)).lanes=n,e}function ms(e,t,n){return(t=cs(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vs(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=At(0),this.expirationTimes=At(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.identifierPrefix=r,this.onRecoverableError=o,K&&(this.mutableSourceEagerHydrationData=null)}function ys(e,t,n,r,o,i,a,s,l){return e=new vs(e,t,n,s,l),1===t?(t=1,!0===i&&(t|=8)):t=0,i=cs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yn(i),e}function bs(e){if(!e)return dt;e:{if(_(e=e._reactInternals)!==e||1!==e.tag)throw Error(i(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(i(171))}if(1===e.tag){var n=e.type;if(mt(n))return bt(e,n,t)}return t}function xs(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(i(188));throw e=Object.keys(e).join(","),Error(i(268,e))}return null===(e=P(t))?null:e.stateNode}function ws(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n=u&&a>=h&&o<=d&&s<=f){e.splice(t,1);break}if(!(r!==u||n.width!==c.width||fs)){h>a&&(c.height+=h-a,c.y=a),fo)){u>r&&(c.width+=u-r,c.x=r),dn&&(n=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},t.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?I(e.child.stateNode):e.child.stateNode:null},t.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:s.ReactCurrentDispatcher,findHostInstanceByFiber:Ss,findFiberByHostInstance:e.findFiberByHostInstance||Cs,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Gt=t.inject(e),qt=t}catch(due){}e=!!t.checkDCE}}return e},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(e,t,n,r){if(!oe)throw Error(i(363));e=ea(e,t);var o=de(e,n,r).disconnect;return{disconnect:function(){o()}}},t.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},t.runWithPriority=function(e,t){var n=Nt;try{return Nt=e,t()}finally{Nt=n}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(e,t,n,r){var o=t.current,i=Ia(),a=Ra(o);return n=bs(n),null===t.context?t.context=n:t.pendingContext=n,(t=Xn(i,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Kn(o,t,a))&&(Na(e,o,a,i),Qn(e,o,a)),a},t}; /** * @license React * react-reconciler.production.min.js diff --git a/frontend/dist/assets/index.6d38ba64.js b/frontend/dist/assets/index.b451449e.js similarity index 99% rename from frontend/dist/assets/index.6d38ba64.js rename to frontend/dist/assets/index.b451449e.js index 1a6c302431..282b938fdb 100644 --- a/frontend/dist/assets/index.6d38ba64.js +++ b/frontend/dist/assets/index.b451449e.js @@ -506,7 +506,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho .transform-component-module_content__2jYgh img { pointer-events: none; } -`,SN={wrapper:"transform-component-module_wrapper__1_Fgj",content:"transform-component-module_content__2jYgh"};hNe(pNe);var gNe=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,i=e.contentClass,o=i===void 0?"":i,a=e.wrapperStyle,s=e.contentStyle,l=C.exports.useContext(KY).setComponents,u=C.exports.useRef(null),d=C.exports.useRef(null);return C.exports.useEffect(function(){var p=u.current,m=d.current;p!==null&&m!==null&&l&&l(p,m)},[]),y("div",{ref:u,className:"react-transform-wrapper "+SN.wrapper+" "+r,style:a,children:y("div",{ref:d,className:"react-transform-component "+SN.content+" "+o,style:s,children:t})})};function mNe({image:e,alt:t,ref:n,styleClass:r}){const[i,o]=C.exports.useState(0),[a,s]=C.exports.useState(!1),l=()=>{o(i===-3?0:i-1)},u=()=>{o(i===3?0:i+1)},d=()=>{s(!a)};return y(fNe,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:({zoomIn:p,zoomOut:m,resetTransform:v,centerView:b})=>V(nn,{children:[V("div",{className:"lightbox-image-options",children:[y(Qe,{icon:y(uLe,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>p(),fontSize:20}),y(Qe,{icon:y(cLe,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>m(),fontSize:20}),y(Qe,{icon:y(sLe,{}),"aria-label":"Rotate Left",tooltip:"Rotate Left",onClick:l,fontSize:20}),y(Qe,{icon:y(lLe,{}),"aria-label":"Rotate Right",tooltip:"Rotate Right",onClick:u,fontSize:20}),y(Qe,{icon:y(d_e,{}),"aria-label":"Flip Image",tooltip:"Flip Image",onClick:d,fontSize:20}),y(Qe,{icon:y(qx,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{v(),o(0),s(!1)},fontSize:20})]}),y(gNe,{wrapperStyle:{width:"100%",height:"100%"},children:y("img",{style:{transform:`rotate(${i*90}deg) scaleX(${a?-1:1})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>b(1,0,"easeOut")})})]})})}function vNe(){const e=Ie(),t=pe(m=>m.options.isLightBoxOpen),{viewerImageToDisplay:n,shouldShowImageDetails:r,isOnFirstImage:i,isOnLastImage:o}=pe(iY),[a,s]=C.exports.useState(!1),l=()=>{s(!0)},u=()=>{s(!1)},d=()=>{e(KE())},p=()=>{e(YE())};return Je("Esc",()=>{t&&e(Qu(!1))},[t]),V("div",{className:"lightbox-container",children:[y(Qe,{icon:y(aLe,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Qu(!1))},fontSize:20}),V("div",{className:"lightbox-display-container",children:[V("div",{className:"lightbox-preview-wrapper",children:[y(nY,{}),!r&&V("div",{className:"current-image-next-prev-buttons",children:[y("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:l,onMouseOut:u,children:a&&!i&&y(hs,{"aria-label":"Previous image",icon:y(FG,{className:"next-prev-button"}),variant:"unstyled",onClick:d})}),y("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:l,onMouseOut:u,children:a&&!o&&y(hs,{"aria-label":"Next image",icon:y($G,{className:"next-prev-button"}),variant:"unstyled",onClick:p})})]}),n&&V(nn,{children:[y(mNe,{image:n.url,styleClass:"lightbox-image"}),r&&y(rY,{image:n})]})]}),y(NY,{})]})]})}function yNe(){const e=Ie(),t=pe(r=>r.options.seamBlur),{t:n}=Ue();return y(ia,{sliderMarkRightOffset:-4,label:n("options:seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(SR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(SR(16))}})}function bNe(){const e=Ie(),{t}=Ue(),n=pe(r=>r.options.seamSize);return y(ia,{sliderMarkRightOffset:-6,label:t("options:seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(xR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(xR(96))})}function SNe(){const{t:e}=Ue(),t=pe(r=>r.options.seamSteps),n=Ie();return y(ia,{sliderMarkRightOffset:-4,label:e("options:seamSteps"),min:1,max:32,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(wR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(wR(10))}})}function xNe(){const e=Ie(),{t}=Ue(),n=pe(r=>r.options.seamStrength);return y(ia,{sliderMarkRightOffset:-7,label:t("options:seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(CR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(CR(.7))}})}const wNe=()=>V(Xe,{direction:"column",gap:"1rem",children:[y(bNe,{}),y(yNe,{}),y(xNe,{}),y(SNe,{})]}),CNe=lt(on,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:$e.isEqual}}),_Ne=()=>{const e=Ie(),{boundingBoxDimensions:t}=pe(CNe),{t:n}=Ue(),r=s=>{e(kv({...t,width:Math.floor(s)}))},i=s=>{e(kv({...t,height:Math.floor(s)}))},o=()=>{e(kv({...t,width:Math.floor(512)}))},a=()=>{e(kv({...t,height:Math.floor(512)}))};return V(Xe,{direction:"column",gap:"1rem",children:[y(ia,{label:n("options:width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:o}),y(ia,{label:n("options:height"),min:64,max:1024,step:64,value:t.height,onChange:i,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:a})]})},kNe=lt(on,e=>{const{inpaintReplace:t,shouldUseInpaintReplace:n}=e;return{inpaintReplace:t,shouldUseInpaintReplace:n}},{memoizeOptions:{resultEqualityCheck:$e.isEqual}});function ENe(){const{inpaintReplace:e,shouldUseInpaintReplace:t}=pe(kNe),n=Ie(),{t:r}=Ue();return V(Xe,{alignItems:"center",columnGap:"1rem",children:[y(ia,{label:r("options:inpaintReplace"),value:e,onChange:i=>{n(pI(i))},min:0,max:1,step:.05,isInteger:!1,isSliderDisabled:!t,withSliderMarks:!0,sliderMarkRightOffset:-2,withReset:!0,handleReset:()=>n(pI(1)),isResetDisabled:!t}),y(as,{isChecked:t,onChange:i=>n(Xwe(i.target.checked)),marginTop:"1.25rem"})]})}const PNe=lt([KG,bs,on],(e,t,n)=>{const{tileSize:r,infillMethod:i}=e,{infill_methods:o}=t,{boundingBoxScaleMethod:a,scaledBoundingBoxDimensions:s}=n;return{boundingBoxScale:a,scaledBoundingBoxDimensions:s,tileSize:r,infillMethod:i,availableInfillMethods:o,isManual:a==="manual"}},{memoizeOptions:{resultEqualityCheck:$e.isEqual}}),TNe=()=>{const e=Ie(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:i,isManual:o,scaledBoundingBoxDimensions:a}=pe(PNe),{t:s}=Ue(),l=v=>{e(_b({...a,width:Math.floor(v)}))},u=v=>{e(_b({...a,height:Math.floor(v)}))},d=()=>{e(_b({...a,width:Math.floor(512)}))},p=()=>{e(_b({...a,height:Math.floor(512)}))},m=v=>{e(Vwe(v.target.value))};return V(Xe,{direction:"column",gap:"1rem",children:[y(il,{label:s("options:scaleBeforeProcessing"),validValues:Ewe,value:i,onChange:m}),y(ia,{isInputDisabled:!o,isResetDisabled:!o,isSliderDisabled:!o,label:s("options:scaledWidth"),min:64,max:1024,step:64,value:a.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:d}),y(ia,{isInputDisabled:!o,isResetDisabled:!o,isSliderDisabled:!o,label:s("options:scaledHeight"),min:64,max:1024,step:64,value:a.height,onChange:u,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:p}),y(ENe,{}),y(il,{label:s("options:infillMethod"),value:n,validValues:r,onChange:v=>e(TU(v.target.value))}),y(ia,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",sliderMarkRightOffset:-4,label:s("options:tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:v=>{e(_R(v))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_R(32))}})]})};function LNe(){const{t:e}=Ue(),t={boundingBox:{header:`${e("options:boundingBoxHeader")}`,feature:uo.BOUNDING_BOX,content:y(_Ne,{})},seamCorrection:{header:`${e("options:seamCorrectionHeader")}`,feature:uo.SEAM_CORRECTION,content:y(wNe,{})},infillAndScaling:{header:`${e("options:infillScalingHeader")}`,feature:uo.INFILL_AND_SCALING,content:y(TNe,{})},seed:{header:`${e("options:seed")}`,feature:uo.SEED,content:y(OP,{})},variations:{header:`${e("options:variations")}`,feature:uo.VARIATIONS,content:y(IP,{}),additionalHeaderComponents:y(RP,{})}};return V(HP,{children:[y(zP,{}),y($P,{}),y(DP,{}),y(Gq,{label:e("options:img2imgStrength"),styleClass:"main-option-block image-to-image-strength-main-option"}),y(NP,{accordionInfo:t})]})}const ANe=lt(on,Kq,Mr,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:i}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:i}}),XY=()=>{const e=Ie(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:i}=pe(ANe),o=C.exports.useRef(null);return C.exports.useLayoutEffect(()=>{window.setTimeout(()=>{if(!o.current)return;const{clientWidth:a,clientHeight:s}=o.current;e(Uwe({width:a,height:s})),e(i?Hwe():_x()),e(xi(!1))},0)},[e,r,t,n,i]),y("div",{ref:o,className:"inpainting-canvas-area",children:y(Sy,{thickness:"2px",speed:"1s",size:"xl"})})};var ZY={exports:{}};/** +`,SN={wrapper:"transform-component-module_wrapper__1_Fgj",content:"transform-component-module_content__2jYgh"};hNe(pNe);var gNe=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,i=e.contentClass,o=i===void 0?"":i,a=e.wrapperStyle,s=e.contentStyle,l=C.exports.useContext(KY).setComponents,u=C.exports.useRef(null),d=C.exports.useRef(null);return C.exports.useEffect(function(){var p=u.current,m=d.current;p!==null&&m!==null&&l&&l(p,m)},[]),y("div",{ref:u,className:"react-transform-wrapper "+SN.wrapper+" "+r,style:a,children:y("div",{ref:d,className:"react-transform-component "+SN.content+" "+o,style:s,children:t})})};function mNe({image:e,alt:t,ref:n,styleClass:r}){const[i,o]=C.exports.useState(0),[a,s]=C.exports.useState(!1),l=()=>{o(i===-3?0:i-1)},u=()=>{o(i===3?0:i+1)},d=()=>{s(!a)};return y(fNe,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:({zoomIn:p,zoomOut:m,resetTransform:v,centerView:b})=>V(nn,{children:[V("div",{className:"lightbox-image-options",children:[y(Qe,{icon:y(uLe,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>p(),fontSize:20}),y(Qe,{icon:y(cLe,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>m(),fontSize:20}),y(Qe,{icon:y(sLe,{}),"aria-label":"Rotate Left",tooltip:"Rotate Left",onClick:l,fontSize:20}),y(Qe,{icon:y(lLe,{}),"aria-label":"Rotate Right",tooltip:"Rotate Right",onClick:u,fontSize:20}),y(Qe,{icon:y(d_e,{}),"aria-label":"Flip Image",tooltip:"Flip Image",onClick:d,fontSize:20}),y(Qe,{icon:y(qx,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{v(),o(0),s(!1)},fontSize:20})]}),y(gNe,{wrapperStyle:{width:"100%",height:"100%"},children:y("img",{style:{transform:`rotate(${i*90}deg) scaleX(${a?-1:1})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>b(1,0,"easeOut")})})]})})}function vNe(){const e=Ie(),t=pe(m=>m.options.isLightBoxOpen),{viewerImageToDisplay:n,shouldShowImageDetails:r,isOnFirstImage:i,isOnLastImage:o}=pe(iY),[a,s]=C.exports.useState(!1),l=()=>{s(!0)},u=()=>{s(!1)},d=()=>{e(KE())},p=()=>{e(YE())};return Je("Esc",()=>{t&&e(Qu(!1))},[t]),V("div",{className:"lightbox-container",children:[y(Qe,{icon:y(aLe,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Qu(!1))},fontSize:20}),V("div",{className:"lightbox-display-container",children:[V("div",{className:"lightbox-preview-wrapper",children:[y(nY,{}),!r&&V("div",{className:"current-image-next-prev-buttons",children:[y("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:l,onMouseOut:u,children:a&&!i&&y(hs,{"aria-label":"Previous image",icon:y(FG,{className:"next-prev-button"}),variant:"unstyled",onClick:d})}),y("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:l,onMouseOut:u,children:a&&!o&&y(hs,{"aria-label":"Next image",icon:y($G,{className:"next-prev-button"}),variant:"unstyled",onClick:p})})]}),n&&V(nn,{children:[y(mNe,{image:n.url,styleClass:"lightbox-image"}),r&&y(rY,{image:n})]})]}),y(NY,{})]})]})}function yNe(){const e=Ie(),t=pe(r=>r.options.seamBlur),{t:n}=Ue();return y(ia,{sliderMarkRightOffset:-4,label:n("options:seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(SR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(SR(16))}})}function bNe(){const e=Ie(),{t}=Ue(),n=pe(r=>r.options.seamSize);return y(ia,{sliderMarkRightOffset:-6,label:t("options:seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(xR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(xR(96))})}function SNe(){const{t:e}=Ue(),t=pe(r=>r.options.seamSteps),n=Ie();return y(ia,{sliderMarkRightOffset:-4,label:e("options:seamSteps"),min:1,max:32,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(wR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(wR(10))}})}function xNe(){const e=Ie(),{t}=Ue(),n=pe(r=>r.options.seamStrength);return y(ia,{sliderMarkRightOffset:-7,label:t("options:seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(CR(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(CR(.7))}})}const wNe=()=>V(Xe,{direction:"column",gap:"1rem",children:[y(bNe,{}),y(yNe,{}),y(xNe,{}),y(SNe,{})]}),CNe=lt(on,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:$e.isEqual}}),_Ne=()=>{const e=Ie(),{boundingBoxDimensions:t}=pe(CNe),{t:n}=Ue(),r=s=>{e(kv({...t,width:Math.floor(s)}))},i=s=>{e(kv({...t,height:Math.floor(s)}))},o=()=>{e(kv({...t,width:Math.floor(512)}))},a=()=>{e(kv({...t,height:Math.floor(512)}))};return V(Xe,{direction:"column",gap:"1rem",children:[y(ia,{label:n("options:width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:o}),y(ia,{label:n("options:height"),min:64,max:1024,step:64,value:t.height,onChange:i,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:a})]})},kNe=lt(on,e=>{const{inpaintReplace:t,shouldUseInpaintReplace:n}=e;return{inpaintReplace:t,shouldUseInpaintReplace:n}},{memoizeOptions:{resultEqualityCheck:$e.isEqual}});function ENe(){const{inpaintReplace:e,shouldUseInpaintReplace:t}=pe(kNe),n=Ie(),{t:r}=Ue();return V(Xe,{alignItems:"center",columnGap:"0.2rem",children:[y(ia,{label:r("options:inpaintReplace"),value:e,onChange:i=>{n(pI(i))},min:0,max:1,step:.05,isInteger:!1,isSliderDisabled:!t,withSliderMarks:!0,sliderMarkRightOffset:-2,withReset:!0,handleReset:()=>n(pI(.1)),withInput:!0,isResetDisabled:!t}),y(as,{isChecked:t,onChange:i=>n(Xwe(i.target.checked)),marginTop:"1.25rem"})]})}const PNe=lt([KG,bs,on],(e,t,n)=>{const{tileSize:r,infillMethod:i}=e,{infill_methods:o}=t,{boundingBoxScaleMethod:a,scaledBoundingBoxDimensions:s}=n;return{boundingBoxScale:a,scaledBoundingBoxDimensions:s,tileSize:r,infillMethod:i,availableInfillMethods:o,isManual:a==="manual"}},{memoizeOptions:{resultEqualityCheck:$e.isEqual}}),TNe=()=>{const e=Ie(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:i,isManual:o,scaledBoundingBoxDimensions:a}=pe(PNe),{t:s}=Ue(),l=v=>{e(_b({...a,width:Math.floor(v)}))},u=v=>{e(_b({...a,height:Math.floor(v)}))},d=()=>{e(_b({...a,width:Math.floor(512)}))},p=()=>{e(_b({...a,height:Math.floor(512)}))},m=v=>{e(Vwe(v.target.value))};return V(Xe,{direction:"column",gap:"1rem",children:[y(il,{label:s("options:scaleBeforeProcessing"),validValues:Ewe,value:i,onChange:m}),y(ia,{isInputDisabled:!o,isResetDisabled:!o,isSliderDisabled:!o,label:s("options:scaledWidth"),min:64,max:1024,step:64,value:a.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:d}),y(ia,{isInputDisabled:!o,isResetDisabled:!o,isSliderDisabled:!o,label:s("options:scaledHeight"),min:64,max:1024,step:64,value:a.height,onChange:u,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:p}),y(ENe,{}),y(il,{label:s("options:infillMethod"),value:n,validValues:r,onChange:v=>e(TU(v.target.value))}),y(ia,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",sliderMarkRightOffset:-4,label:s("options:tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:v=>{e(_R(v))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_R(32))}})]})};function LNe(){const{t:e}=Ue(),t={boundingBox:{header:`${e("options:boundingBoxHeader")}`,feature:uo.BOUNDING_BOX,content:y(_Ne,{})},seamCorrection:{header:`${e("options:seamCorrectionHeader")}`,feature:uo.SEAM_CORRECTION,content:y(wNe,{})},infillAndScaling:{header:`${e("options:infillScalingHeader")}`,feature:uo.INFILL_AND_SCALING,content:y(TNe,{})},seed:{header:`${e("options:seed")}`,feature:uo.SEED,content:y(OP,{})},variations:{header:`${e("options:variations")}`,feature:uo.VARIATIONS,content:y(IP,{}),additionalHeaderComponents:y(RP,{})}};return V(HP,{children:[y(zP,{}),y($P,{}),y(DP,{}),y(Gq,{label:e("options:img2imgStrength"),styleClass:"main-option-block image-to-image-strength-main-option"}),y(NP,{accordionInfo:t})]})}const ANe=lt(on,Kq,Mr,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:i}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:i}}),XY=()=>{const e=Ie(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:i}=pe(ANe),o=C.exports.useRef(null);return C.exports.useLayoutEffect(()=>{window.setTimeout(()=>{if(!o.current)return;const{clientWidth:a,clientHeight:s}=o.current;e(Uwe({width:a,height:s})),e(i?Hwe():_x()),e(xi(!1))},0)},[e,r,t,n,i]),y("div",{ref:o,className:"inpainting-canvas-area",children:y(Sy,{thickness:"2px",speed:"1s",size:"xl"})})};var ZY={exports:{}};/** * @license React * react-reconciler.production.min.js * diff --git a/frontend/dist/index.html b/frontend/dist/index.html index fd2570e10d..cc1bc734cd 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ InvokeAI - A Stable Diffusion Toolkit - + @@ -18,6 +18,6 @@ - + diff --git a/frontend/src/features/options/components/AdvancedOptions/Canvas/InpaintReplace.tsx b/frontend/src/features/options/components/AdvancedOptions/Canvas/InpaintReplace.tsx index 7905ebe61b..414714dd6c 100644 --- a/frontend/src/features/options/components/AdvancedOptions/Canvas/InpaintReplace.tsx +++ b/frontend/src/features/options/components/AdvancedOptions/Canvas/InpaintReplace.tsx @@ -36,7 +36,7 @@ export default function InpaintReplace() { const { t } = useTranslation(); return ( - + dispatch(setInpaintReplace(1))} + handleReset={() => dispatch(setInpaintReplace(0.1))} + withInput isResetDisabled={!shouldUseInpaintReplace} />