hive-react-kit 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -60,7 +60,7 @@
60
60
  ${a}`;class n extends Error{constructor(a,i,o=new Map){super(a),Object.defineProperty(this,"validationErrors",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="ArgumentError",Error.captureStackTrace?Error.captureStackTrace(this,i):this.stack=r(this,(0,t.generateStackTrace)()),this.validationErrors=o}}return Ma.ArgumentError=n,Ma}var $a={},Ts={},Go;function U0(){return Go||(Go=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.default=()=>Math.random().toString(16).slice(2)),Ts}var Jo;function V0(){if(Jo)return $a;Jo=1,Object.defineProperty($a,"__esModule",{value:!0}),$a.not=void 0;const t=U0(),r=tr(),n=s=>{const a=s.addValidator;return s.addValidator=i=>{const{validator:o,message:c,negatedMessage:d}=i,f=(0,t.default)();return i.message=(l,h)=>d?d(l,h):c(l,f).replace(/ to /,"$&not ").replace(f,h),i.validator=l=>!o(l),s[r.validatorSymbol].push(i),s.addValidator=a,s},s};return $a.not=n,$a}var Gn={},Yo;function ys(){return Yo||(Yo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isPredicate=t.testSymbol=void 0,t.testSymbol=Symbol("test");const r=n=>!!n[t.testSymbol];t.isPredicate=r})(Gn)),Gn}var Ia={},Zo;function cd(){if(Zo)return Ia;Zo=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.generateArgumentErrorMessage=void 0;const t=(r,n=!1)=>{const s=[],a=[...r.entries()],i=a.some(([,o])=>o.size!==1);if(a.length===1){const[,o]=a[0];if(!n&&o.size===1){const[c]=o;return c}for(const c of o)s.push(`${n?" - ":""}${c}`);return s.join(`
61
61
  `)}if(!i)return a.map(([,[o]])=>` - ${o}`).join(`
62
62
  `);for(const[o,c]of a){s.push(`Errors from the "${o}" predicate:`);for(const d of c)s.push(` - ${d}`)}return s.join(`
63
- `)};return Ia.generateArgumentErrorMessage=t,Ia}var Xo;function tr(){return Xo||(Xo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Predicate=t.validatorSymbol=void 0;const r=Pa(),n=bo(),s=V0(),a=ys(),i=cd();t.validatorSymbol=Symbol("validators");class o{constructor(d,f={}){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:{validators:[]}}),this.context={...this.context,...this.options};const l=this.type.charAt(0).toLowerCase()+this.type.slice(1);this.addValidator({message:(h,u)=>`Expected ${u?.slice(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${(0,r.default)(h)}\``,validator:h=>r.default[l](h)})}[a.testSymbol](d,f,l,h){const u=new Map;for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&d===void 0)continue;let w;try{w=p(d)}catch(m){w=m}if(w===!0)continue;const x=r.default.function_(l)?l():l,g=x&&h?`\`${x}\``:x,v=g?`${this.type} ${g}`:this.type,N=x||this.type,j=u.get(N),y=b(d,v,w);j?j.add(y):u.set(N,new Set([y]))}if(u.size>0){const p=(0,i.generateArgumentErrorMessage)(u);throw new n.ArgumentError(p,f,u)}}get[t.validatorSymbol](){return this.context.validators}get not(){return(0,s.not)(this)}validate(d){return this.addValidator({message:(f,l,h)=>typeof h=="string"?`(${l}) ${h}`:h(l),validator:f=>{const{message:l,validator:h}=d(f);return h?!0:l}})}is(d){return this.addValidator({message:(f,l,h)=>h?`(${l}) ${h}`:`Expected ${l} \`${f}\` to pass custom validation function`,validator:d})}message(d){const{validators:f}=this.context;return f[f.length-1].message=(l,h)=>typeof d=="function"?d(l,h):d,this}addValidator(d){return this.context.validators.push(d),this}}t.Predicate=o})(Wn)),Wn}var Ds={},Jn={},Fa={},Yn,Ko;function q0(){return Ko||(Ko=1,Yn=function(t){return!isNaN(Date.parse(t))}),Yn}var Qo;function H0(){if(Qo)return Fa;Qo=1,Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.StringPredicate=void 0;const t=Pa(),r=q0(),n=tr();class s extends n.Predicate{constructor(i){super("string",i)}length(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have length \`${i}\`, got \`${o}\``,validator:o=>o.length===i})}minLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a minimum length of \`${i}\`, got \`${o}\``,validator:o=>o.length>=i,negatedMessage:(o,c)=>`Expected ${c} to have a maximum length of \`${i-1}\`, got \`${o}\``})}maxLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a maximum length of \`${i}\`, got \`${o}\``,validator:o=>o.length<=i,negatedMessage:(o,c)=>`Expected ${c} to have a minimum length of \`${i+1}\`, got \`${o}\``})}matches(i){return this.addValidator({message:(o,c)=>`Expected ${c} to match \`${i}\`, got \`${o}\``,validator:o=>i.test(o)})}startsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to start with \`${i}\`, got \`${o}\``,validator:o=>o.startsWith(i)})}endsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to end with \`${i}\`, got \`${o}\``,validator:o=>o.endsWith(i)})}includes(i){return this.addValidator({message:(o,c)=>`Expected ${c} to include \`${i}\`, got \`${o}\``,validator:o=>o.includes(i)})}oneOf(i){return this.addValidator({message:(o,c)=>{let d=JSON.stringify(i);if(i.length>10){const f=i.length-10;d=JSON.stringify(i.slice(0,10)).replace(/]$/,`,…+${f} more]`)}return`Expected ${c} to be one of \`${d}\`, got \`${o}\``},validator:o=>i.includes(o)})}get empty(){return this.addValidator({message:(i,o)=>`Expected ${o} to be empty, got \`${i}\``,validator:i=>i===""})}get nonEmpty(){return this.addValidator({message:(i,o)=>`Expected ${o} to not be empty`,validator:i=>i!==""})}equals(i){return this.addValidator({message:(o,c)=>`Expected ${c} to be equal to \`${i}\`, got \`${o}\``,validator:o=>o===i})}get alphanumeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphanumeric, got \`${i}\``,validator:i=>/^[a-z\d]+$/i.test(i)})}get alphabetical(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphabetical, got \`${i}\``,validator:i=>/^[a-z]+$/gi.test(i)})}get numeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be numeric, got \`${i}\``,validator:i=>/^[+-]?\d+$/i.test(i)})}get date(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a date, got \`${i}\``,validator:r})}get lowercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be lowercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toLowerCase()})}get uppercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be uppercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toUpperCase()})}get url(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a URL, got \`${i}\``,validator:t.default.urlString})}}return Fa.StringPredicate=s,Fa}var Ba={},el;function z0(){if(el)return Ba;el=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.NumberPredicate=void 0;const t=Pa(),r=tr();class n extends r.Predicate{constructor(a){super("number",a)}inRange(a,i){return this.addValidator({message:(o,c)=>`Expected ${c} to be in range [${a}..${i}], got ${o}`,validator:o=>t.default.inRange(o,[a,i])})}greaterThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than ${a}, got ${i}`,validator:i=>i>a})}greaterThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than or equal to ${a}, got ${i}`,validator:i=>i>=a})}lessThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than ${a}, got ${i}`,validator:i=>i<a})}lessThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than or equal to ${a}, got ${i}`,validator:i=>i<=a})}equal(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be equal to ${a}, got ${i}`,validator:i=>i===a})}oneOf(a){return this.addValidator({message:(i,o)=>{let c=JSON.stringify(a);if(a.length>10){const d=a.length-10;c=JSON.stringify(a.slice(0,10)).replace(/]$/,`,…+${d} more]`)}return`Expected ${o} to be one of \`${c}\`, got ${i}`},validator:i=>a.includes(i)})}get integer(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer, got ${a}`,validator:a=>t.default.integer(a)})}get finite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be finite, got ${a}`,validator:a=>!t.default.infinite(a)})}get infinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be infinite, got ${a}`,validator:a=>t.default.infinite(a)})}get positive(){return this.addValidator({message:(a,i)=>`Expected ${i} to be positive, got ${a}`,validator:a=>a>0})}get negative(){return this.addValidator({message:(a,i)=>`Expected ${i} to be negative, got ${a}`,validator:a=>a<0})}get integerOrInfinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer or infinite, got ${a}`,validator:a=>t.default.integer(a)||t.default.infinite(a)})}get uint8(){return this.integer.inRange(0,255)}get uint16(){return this.integer.inRange(0,65535)}get uint32(){return this.integer.inRange(0,4294967295)}get int8(){return this.integer.inRange(-128,127)}get int16(){return this.integer.inRange(-32768,32767)}get int32(){return this.integer.inRange(-2147483648,2147483647)}}return Ba.NumberPredicate=n,Ba}var Ua={},tl;function W0(){if(tl)return Ua;tl=1,Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.BigIntPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("bigint",s)}}return Ua.BigIntPredicate=r,Ua}var Va={},rl;function G0(){if(rl)return Va;rl=1,Object.defineProperty(Va,"__esModule",{value:!0}),Va.BooleanPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("boolean",s)}get true(){return this.addValidator({message:(s,a)=>`Expected ${a} to be true, got ${s}`,validator:s=>s})}get false(){return this.addValidator({message:(s,a)=>`Expected ${a} to be false, got ${s}`,validator:s=>!s})}}return Va.BooleanPredicate=r,Va}var qa={},hs={exports:{}};hs.exports;var al;function An(){return al||(al=1,(function(t,r){var n=200,s="__lodash_hash_undefined__",a=1,i=2,o=9007199254740991,c="[object Arguments]",d="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",u="[object Error]",p="[object Function]",b="[object GeneratorFunction]",w="[object Map]",x="[object Number]",g="[object Null]",v="[object Object]",N="[object Promise]",j="[object Proxy]",y="[object RegExp]",m="[object Set]",_="[object String]",E="[object Symbol]",A="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",D="[object DataView]",L="[object Float32Array]",z="[object Float64Array]",U="[object Int8Array]",H="[object Int16Array]",F="[object Int32Array]",Y="[object Uint8Array]",G="[object Uint8ClampedArray]",ne="[object Uint16Array]",ie="[object Uint32Array]",xe=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,B={};B[L]=B[z]=B[U]=B[H]=B[F]=B[Y]=B[G]=B[ne]=B[ie]=!0,B[c]=B[d]=B[T]=B[l]=B[D]=B[h]=B[u]=B[p]=B[w]=B[x]=B[v]=B[y]=B[m]=B[_]=B[C]=!1;var pe=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,ee=typeof self=="object"&&self&&self.Object===Object&&self,te=pe||ee||Function("return this")(),_e=r&&!r.nodeType&&r,Ie=_e&&!0&&t&&!t.nodeType&&t,K=Ie&&Ie.exports===_e,le=K&&pe.process,oe=(function(){try{return le&&le.binding&&le.binding("util")}catch{}})(),Ne=oe&&oe.isTypedArray;function Ce(R,J){for(var X=-1,M=R==null?0:R.length,ce=0,me=[];++X<M;){var qe=R[X];J(qe,X,R)&&(me[ce++]=qe)}return me}function Me(R,J){for(var X=-1,M=J.length,ce=R.length;++X<M;)R[ce+X]=J[X];return R}function Fe(R,J){for(var X=-1,M=R==null?0:R.length;++X<M;)if(J(R[X],X,R))return!0;return!1}function ue(R,J){for(var X=-1,M=Array(R);++X<R;)M[X]=J(X);return M}function Re(R){return function(J){return R(J)}}function ae(R,J){return R.has(J)}function de(R,J){return R?.[J]}function ve(R){var J=-1,X=Array(R.size);return R.forEach(function(M,ce){X[++J]=[ce,M]}),X}function fe(R,J){return function(X){return R(J(X))}}function ke(R){var J=-1,X=Array(R.size);return R.forEach(function(M){X[++J]=M}),X}var Se=Array.prototype,Be=Function.prototype,Ge=Object.prototype,pt=te["__core-js_shared__"],jt=Be.toString,gt=Ge.hasOwnProperty,St=(function(){var R=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""})(),Ct=Ge.toString,Tt=RegExp("^"+jt.call(gt).replace(xe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bt=K?te.Buffer:void 0,Ke=te.Symbol,at=te.Uint8Array,_t=Ge.propertyIsEnumerable,Ut=Se.splice,kt=Ke?Ke.toStringTag:void 0,Vt=Object.getOwnPropertySymbols,S=Bt?Bt.isBuffer:void 0,P=fe(Object.keys,Object),I=Zt(te,"DataView"),Z=Zt(te,"Map"),be=Zt(te,"Promise"),Oe=Zt(te,"Set"),Ze=Zt(te,"WeakMap"),Ue=Zt(Object,"create"),He=se(I),bt=se(Z),Dt=se(be),Mt=se(Oe),$t=se(Ze),Yt=Ke?Ke.prototype:void 0,Et=Yt?Yt.valueOf:void 0;function ft(R){var J=-1,X=R==null?0:R.length;for(this.clear();++J<X;){var M=R[J];this.set(M[0],M[1])}}function ge(){this.__data__=Ue?Ue(null):{},this.size=0}function Te(R){var J=this.has(R)&&delete this.__data__[R];return this.size-=J?1:0,J}function Pe(R){var J=this.__data__;if(Ue){var X=J[R];return X===s?void 0:X}return gt.call(J,R)?J[R]:void 0}function ze(R){var J=this.__data__;return Ue?J[R]!==void 0:gt.call(J,R)}function Ve(R,J){var X=this.__data__;return this.size+=this.has(R)?0:1,X[R]=Ue&&J===void 0?s:J,this}ft.prototype.clear=ge,ft.prototype.delete=Te,ft.prototype.get=Pe,ft.prototype.has=ze,ft.prototype.set=Ve;function xt(R){var J=-1,X=R==null?0:R.length;for(this.clear();++J<X;){var M=R[J];this.set(M[0],M[1])}}function Je(){this.__data__=[],this.size=0}function cr(R){var J=this.__data__,X=mt(J,R);if(X<0)return!1;var M=J.length-1;return X==M?J.pop():Ut.call(J,X,1),--this.size,!0}function Or(R){var J=this.__data__,X=mt(J,R);return X<0?void 0:J[X][1]}function rr(R){return mt(this.__data__,R)>-1}function Lr(R,J){var X=this.__data__,M=mt(X,R);return M<0?(++this.size,X.push([R,J])):X[M][1]=J,this}xt.prototype.clear=Je,xt.prototype.delete=cr,xt.prototype.get=Or,xt.prototype.has=rr,xt.prototype.set=Lr;function Ht(R){var J=-1,X=R==null?0:R.length;for(this.clear();++J<X;){var M=R[J];this.set(M[0],M[1])}}function Mr(){this.size=0,this.__data__={hash:new ft,map:new(Z||xt),string:new ft}}function $e(R){var J=We(this,R).delete(R);return this.size-=J?1:0,J}function ar(R){return We(this,R).get(R)}function kr(R){return We(this,R).has(R)}function ut(R,J){var X=We(this,R),M=X.size;return X.set(R,J),this.size+=X.size==M?0:1,this}Ht.prototype.clear=Mr,Ht.prototype.delete=$e,Ht.prototype.get=ar,Ht.prototype.has=kr,Ht.prototype.set=ut;function W(R){var J=-1,X=R==null?0:R.length;for(this.__data__=new Ht;++J<X;)this.add(R[J])}function Q(R){return this.__data__.set(R,s),this}function we(R){return this.__data__.has(R)}W.prototype.add=W.prototype.push=Q,W.prototype.has=we;function Ae(R){var J=this.__data__=new xt(R);this.size=J.size}function ht(){this.__data__=new xt,this.size=0}function Ye(R){var J=this.__data__,X=J.delete(R);return this.size=J.size,X}function yt(R){return this.__data__.get(R)}function Ot(R){return this.__data__.has(R)}function Jt(R,J){var X=this.__data__;if(X instanceof xt){var M=X.__data__;if(!Z||M.length<n-1)return M.push([R,J]),this.size=++X.size,this;X=this.__data__=new Ht(M)}return X.set(R,J),this.size=X.size,this}Ae.prototype.clear=ht,Ae.prototype.delete=Ye,Ae.prototype.get=yt,Ae.prototype.has=Ot,Ae.prototype.set=Jt;function At(R,J){var X=lt(R),M=!X&&De(R),ce=!X&&!M&&Qe(R),me=!X&&!M&&!ce&&dt(R),qe=X||M||ce||me,nt=qe?ue(R.length,String):[],it=nt.length;for(var ot in R)gt.call(R,ot)&&!(qe&&(ot=="length"||ce&&(ot=="offset"||ot=="parent")||me&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||dr(ot,it)))&&nt.push(ot);return nt}function mt(R,J){for(var X=R.length;X--;)if(ye(R[X][0],J))return X;return-1}function Rt(R,J,X){var M=J(R);return lt(R)?M:Me(M,X(R))}function qt(R){return R==null?R===void 0?A:g:kt&&kt in Object(R)?ir(R):he(R)}function It(R){return Lt(R)&&qt(R)==c}function sr(R,J,X,M,ce){return R===J?!0:R==null||J==null||!Lt(R)&&!Lt(J)?R!==R&&J!==J:xr(R,J,X,M,sr,ce)}function xr(R,J,X,M,ce,me){var qe=lt(R),nt=lt(J),it=qe?d:vt(R),ot=nt?d:vt(J);it=it==c?v:it,ot=ot==c?v:ot;var Ft=it==v,Kt=ot==v,zt=it==ot;if(zt&&Qe(R)){if(!Qe(J))return!1;qe=!0,Ft=!1}if(zt&&!Ft)return me||(me=new Ae),qe||dt(R)?nr(R,J,X,M,ce,me):yr(R,J,it,X,M,ce,me);if(!(X&a)){var wt=Ft&&gt.call(R,"__wrapped__"),fr=Kt&&gt.call(J,"__wrapped__");if(wt||fr){var Sr=wt?R.value():R,Br=fr?J.value():J;return me||(me=new Ae),ce(Sr,Br,X,M,me)}}return zt?(me||(me=new Ae),Ir(R,J,X,M,ce,me)):!1}function br(R){if(!Xt(R)||$(R))return!1;var J=et(R)?Tt:V;return J.test(se(R))}function lr(R){return Lt(R)&&Pt(R.length)&&!!B[qt(R)]}function ur(R){if(!re(R))return P(R);var J=[];for(var X in Object(R))gt.call(R,X)&&X!="constructor"&&J.push(X);return J}function nr(R,J,X,M,ce,me){var qe=X&a,nt=R.length,it=J.length;if(nt!=it&&!(qe&&it>nt))return!1;var ot=me.get(R);if(ot&&me.get(J))return ot==J;var Ft=-1,Kt=!0,zt=X&i?new W:void 0;for(me.set(R,J),me.set(J,R);++Ft<nt;){var wt=R[Ft],fr=J[Ft];if(M)var Sr=qe?M(fr,wt,Ft,J,R,me):M(wt,fr,Ft,R,J,me);if(Sr!==void 0){if(Sr)continue;Kt=!1;break}if(zt){if(!Fe(J,function(Br,aa){if(!ae(zt,aa)&&(wt===Br||ce(wt,Br,X,M,me)))return zt.push(aa)})){Kt=!1;break}}else if(!(wt===fr||ce(wt,fr,X,M,me))){Kt=!1;break}}return me.delete(R),me.delete(J),Kt}function yr(R,J,X,M,ce,me,qe){switch(X){case D:if(R.byteLength!=J.byteLength||R.byteOffset!=J.byteOffset)return!1;R=R.buffer,J=J.buffer;case T:return!(R.byteLength!=J.byteLength||!me(new at(R),new at(J)));case l:case h:case x:return ye(+R,+J);case u:return R.name==J.name&&R.message==J.message;case y:case _:return R==J+"";case w:var nt=ve;case m:var it=M&a;if(nt||(nt=ke),R.size!=J.size&&!it)return!1;var ot=qe.get(R);if(ot)return ot==J;M|=i,qe.set(R,J);var Ft=nr(nt(R),nt(J),M,ce,me,qe);return qe.delete(R),Ft;case E:if(Et)return Et.call(R)==Et.call(J)}return!1}function Ir(R,J,X,M,ce,me){var qe=X&a,nt=st(R),it=nt.length,ot=st(J),Ft=ot.length;if(it!=Ft&&!qe)return!1;for(var Kt=it;Kt--;){var zt=nt[Kt];if(!(qe?zt in J:gt.call(J,zt)))return!1}var wt=me.get(R);if(wt&&me.get(J))return wt==J;var fr=!0;me.set(R,J),me.set(J,R);for(var Sr=qe;++Kt<it;){zt=nt[Kt];var Br=R[zt],aa=J[zt];if(M)var Fo=qe?M(aa,Br,zt,J,R,me):M(Br,aa,zt,R,J,me);if(!(Fo===void 0?Br===aa||ce(Br,aa,X,M,me):Fo)){fr=!1;break}Sr||(Sr=zt=="constructor")}if(fr&&!Sr){var ks=R.constructor,Es=J.constructor;ks!=Es&&"constructor"in R&&"constructor"in J&&!(typeof ks=="function"&&ks instanceof ks&&typeof Es=="function"&&Es instanceof Es)&&(fr=!1)}return me.delete(R),me.delete(J),fr}function st(R){return Rt(R,or,Fr)}function We(R,J){var X=R.__data__;return vr(J)?X[typeof J=="string"?"string":"hash"]:X.map}function Zt(R,J){var X=de(R,J);return br(X)?X:void 0}function ir(R){var J=gt.call(R,kt),X=R[kt];try{R[kt]=void 0;var M=!0}catch{}var ce=Ct.call(R);return M&&(J?R[kt]=X:delete R[kt]),ce}var Fr=Vt?function(R){return R==null?[]:(R=Object(R),Ce(Vt(R),function(J){return _t.call(R,J)}))}:Yr,vt=qt;(I&&vt(new I(new ArrayBuffer(1)))!=D||Z&&vt(new Z)!=w||be&&vt(be.resolve())!=N||Oe&&vt(new Oe)!=m||Ze&&vt(new Ze)!=C)&&(vt=function(R){var J=qt(R),X=J==v?R.constructor:void 0,M=X?se(X):"";if(M)switch(M){case He:return D;case bt:return w;case Dt:return N;case Mt:return m;case $t:return C}return J});function dr(R,J){return J=J??o,!!J&&(typeof R=="number"||q.test(R))&&R>-1&&R%1==0&&R<J}function vr(R){var J=typeof R;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?R!=="__proto__":R===null}function $(R){return!!St&&St in R}function re(R){var J=R&&R.constructor,X=typeof J=="function"&&J.prototype||Ge;return R===X}function he(R){return Ct.call(R)}function se(R){if(R!=null){try{return jt.call(R)}catch{}try{return R+""}catch{}}return""}function ye(R,J){return R===J||R!==R&&J!==J}var De=It((function(){return arguments})())?It:function(R){return Lt(R)&&gt.call(R,"callee")&&!_t.call(R,"callee")},lt=Array.isArray;function Xe(R){return R!=null&&Pt(R.length)&&!et(R)}var Qe=S||ra;function ct(R,J){return sr(R,J)}function et(R){if(!Xt(R))return!1;var J=qt(R);return J==p||J==b||J==f||J==j}function Pt(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=o}function Xt(R){var J=typeof R;return R!=null&&(J=="object"||J=="function")}function Lt(R){return R!=null&&typeof R=="object"}var dt=Ne?Re(Ne):lr;function or(R){return Xe(R)?At(R):ur(R)}function Yr(){return[]}function ra(){return!1}t.exports=ct})(hs,hs.exports)),hs.exports}var ia={},Ps={},sl;function Sn(){if(sl)return Ps;sl=1,Object.defineProperty(Ps,"__esModule",{value:!0});const t=ys();function r(n,s,a,i=!0){a[t.testSymbol](n,r,s,i)}return Ps.default=r,Ps}var nl;function dd(){if(nl)return ia;nl=1,Object.defineProperty(ia,"__esModule",{value:!0}),ia.exact=ia.partial=void 0;const t=Pa(),r=Sn(),n=ys();function s(i,o,c){try{for(const d of Object.keys(o)){const f=c?`${c}.${d}`:d;if((0,n.isPredicate)(o[d]))(0,r.default)(i[d],f,o[d]);else if(t.default.plainObject(o[d])){const l=s(i[d],o[d],f);if(l!==!0)return l}}return!0}catch(d){return d.message}}ia.partial=s;function a(i,o,c,d){try{const f=new Set(Object.keys(i));for(const l of Object.keys(o)){f.delete(l);const h=c?`${c}.${l}`:l;if((0,n.isPredicate)(o[l]))(0,r.default)(i[l],h,o[l]);else if(t.default.plainObject(o[l])){if(!Object.prototype.hasOwnProperty.call(i,l))return`Expected \`${h}\` to exist`;const u=a(i[l],o[l],h);if(u!==!0)return u}}if(f.size>0){const l=[...f.keys()][0],h=c?`${c}.${l}`:l;return`Did not expect ${d?"element":"property"} \`${h}\` to exist, got \`${i[l]}\``}return!0}catch(f){return f.message}}return ia.exact=a,ia}var Os={},il;function Cn(){if(il)return Os;il=1,Object.defineProperty(Os,"__esModule",{value:!0});const t=Sn();return Os.default=(r,n,s)=>{try{for(const a of r)(0,t.default)(a,n,s,!1);return!0}catch(a){return a.message}},Os}var ol;function J0(){if(ol)return qa;ol=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ArrayPredicate=void 0;const t=An(),r=tr(),n=dd(),s=Cn();class a extends r.Predicate{constructor(o){super("array",o)}length(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have length \`${o}\`, got \`${c.length}\``,validator:c=>c.length===o})}minLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum length of \`${o-1}\`, got \`${c.length}\``})}maxLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum length of \`${o+1}\`, got \`${c.length}\``})}startsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to start with \`${o}\`, got \`${c[0]}\``,validator:c=>c[0]===o})}endsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to end with \`${o}\`, got \`${c[c.length-1]}\``,validator:c=>c[c.length-1]===o})}includes(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include all elements of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.every(d=>c.includes(d))})}includesAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include any element of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.some(d=>c.includes(d))})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify(o)}\``,validator:o=>o.length===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.length>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>t(c,o)})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c,"values",o)})}exactShape(o){const c=o;return this.addValidator({message:(d,f,l)=>`${l.replace("Expected","Expected element")} in ${f}`,validator:d=>(0,n.exact)(d,c,void 0,!0)})}}return qa.ArrayPredicate=a,qa}var Ha={},Zn,ll;function Y0(){return ll||(ll=1,Zn=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")}),Zn}var Xn,ul;function Z0(){if(ul)return Xn;ul=1;const t=Y0(),r=new Set(["__proto__","prototype","constructor"]),n=a=>!a.some(i=>r.has(i));function s(a){const i=a.split("."),o=[];for(let c=0;c<i.length;c++){let d=i[c];for(;d[d.length-1]==="\\"&&i[c+1]!==void 0;)d=d.slice(0,-1)+".",d+=i[++c];o.push(d)}return n(o)?o:[]}return Xn={get(a,i,o){if(!t(a)||typeof i!="string")return o===void 0?a:o;const c=s(i);if(c.length!==0){for(let d=0;d<c.length;d++)if(a=a[c[d]],a==null){if(d!==c.length-1)return o;break}return a===void 0?o:a}},set(a,i,o){if(!t(a)||typeof i!="string")return a;const c=a,d=s(i);for(let f=0;f<d.length;f++){const l=d[f];t(a[l])||(a[l]={}),f===d.length-1&&(a[l]=o),a=a[l]}return c},delete(a,i){if(!t(a)||typeof i!="string")return!1;const o=s(i);for(let c=0;c<o.length;c++){const d=o[c];if(c===o.length-1)return delete a[d],!0;if(a=a[d],!t(a))return!1}},has(a,i){if(!t(a)||typeof i!="string")return!1;const o=s(i);if(o.length===0)return!1;for(let c=0;c<o.length;c++)if(t(a)){if(!(o[c]in a))return!1;a=a[o[c]]}else return!1;return!0}},Xn}var Ls={},cl;function vs(){return cl||(cl=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.default=(t,r,n=5)=>{const s=[];for(const a of r)if(!t.has(a)&&(s.push(a),s.length===n))return s;return s.length===0?!0:s}),Ls}var Ms={},dl;function X0(){if(dl)return Ms;dl=1,Object.defineProperty(Ms,"__esModule",{value:!0});const t=Pa(),r=Sn(),n=(s,a)=>t.default.plainObject(s)?Object.values(s).every(i=>n(i,a)):((0,r.default)(s,"deep values",a,!1),!0);return Ms.default=(s,a)=>{try{return n(s,a)}catch(i){return i.message}},Ms}var fl;function K0(){if(fl)return Ha;fl=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.ObjectPredicate=void 0;const t=Pa(),r=Z0(),n=An(),s=vs(),a=Cn(),i=X0(),o=dd(),c=tr();class d extends c.Predicate{constructor(l){super("object",l)}get plain(){return this.addValidator({message:(l,h)=>`Expected ${h} to be a plain object`,validator:l=>t.default.plainObject(l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(l)}\``,validator:l=>Object.keys(l).length===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>Object.keys(l).length>0})}valuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,a.default)(Object.values(h),"values",l)})}deepValuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,i.default)(h,l)})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(l)}\`, got \`${JSON.stringify(h)}\``,validator:h=>n(h,l)})}instanceOf(l){return this.addValidator({message:(h,u)=>{var p;let{name:b}=(p=h?.constructor)!==null&&p!==void 0?p:{};return(!b||b==="Object")&&(b=JSON.stringify(h)),`Expected ${u} \`${b}\` to be of type \`${l.name}\``},validator:h=>h instanceof l})}hasKeys(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have keys \`${JSON.stringify(p)}\``,validator:h=>(0,s.default)({has:u=>r.has(h,u)},l)})}hasAnyKeys(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any key of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>r.has(h,u))})}partialShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.partial)(h,l)})}exactShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.exact)(h,l)})}}return Ha.ObjectPredicate=d,Ha}var za={},hl;function Q0(){if(hl)return za;hl=1,Object.defineProperty(za,"__esModule",{value:!0}),za.DatePredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("date",s)}before(s){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be before ${s.toISOString()}`,validator:a=>a.getTime()<s.getTime()})}after(s){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be after ${s.toISOString()}`,validator:a=>a.getTime()>s.getTime()})}}return za.DatePredicate=r,za}var Wa={},ml;function ef(){if(ml)return Wa;ml=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ErrorPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("error",s)}name(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have name \`${s}\`, got \`${a.name}\``,validator:a=>a.name===s})}message(s){return this.addValidator({message:(a,i)=>`Expected ${i} message to be \`${s}\`, got \`${a.message}\``,validator:a=>a.message===s})}messageIncludes(s){return this.addValidator({message:(a,i)=>`Expected ${i} message to include \`${s}\`, got \`${a.message}\``,validator:a=>a.message.includes(s)})}hasKeys(...s){return this.addValidator({message:(a,i)=>`Expected ${i} message to have keys \`${s.join("`, `")}\``,validator:a=>s.every(i=>Object.prototype.hasOwnProperty.call(a,i))})}instanceOf(s){return this.addValidator({message:(a,i)=>`Expected ${i} \`${a.name}\` to be of type \`${s.name}\``,validator:a=>a instanceof s})}get typeError(){return this.instanceOf(TypeError)}get evalError(){return this.instanceOf(EvalError)}get rangeError(){return this.instanceOf(RangeError)}get referenceError(){return this.instanceOf(ReferenceError)}get syntaxError(){return this.instanceOf(SyntaxError)}get uriError(){return this.instanceOf(URIError)}}return Wa.ErrorPredicate=r,Wa}var Ga={},pl;function tf(){if(pl)return Ga;pl=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.MapPredicate=void 0;const t=An(),r=vs(),n=Cn(),s=tr();class a extends s.Predicate{constructor(o){super("Map",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}hasKeys(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have keys \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAnyKeys(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any key of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}hasValues(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have values \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(new Set(c.values()),o)})}hasAnyValues(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any value of \`${JSON.stringify(o)}\``,validator:c=>{const d=new Set(c.values());return o.some(f=>d.has(f))}})}keysOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c.keys(),"keys",o)})}valuesOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c.values(),"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ga.MapPredicate=a,Ga}var Ja={},gl;function rf(){if(gl)return Ja;gl=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.WeakMapPredicate=void 0;const t=vs(),r=tr();class n extends r.Predicate{constructor(a){super("WeakMap",a)}hasKeys(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have keys \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAnyKeys(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any key of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Ja.WeakMapPredicate=n,Ja}var Ya={},xl;function af(){if(xl)return Ya;xl=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.SetPredicate=void 0;const t=An(),r=vs(),n=Cn(),s=tr();class a extends s.Predicate{constructor(o){super("Set",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}has(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have items \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any item of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c,"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ya.SetPredicate=a,Ya}var Za={},bl;function sf(){if(bl)return Za;bl=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.WeakSetPredicate=void 0;const t=vs(),r=tr();class n extends r.Predicate{constructor(a){super("WeakSet",a)}has(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have items \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAny(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any item of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Za.WeakSetPredicate=n,Za}var Xa={},yl;function nf(){if(yl)return Xa;yl=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.TypedArrayPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===s})}minByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s-1}\`, got \`${a.byteLength}\``})}maxByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s+1}\`, got \`${a.byteLength}\``})}length(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have length \`${s}\`, got \`${a.length}\``,validator:a=>a.length===s})}minLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum length of \`${s}\`, got \`${a.length}\``,validator:a=>a.length>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum length of \`${s-1}\`, got \`${a.length}\``})}maxLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum length of \`${s}\`, got \`${a.length}\``,validator:a=>a.length<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum length of \`${s+1}\`, got \`${a.length}\``})}}return Xa.TypedArrayPredicate=r,Xa}var Ka={},vl;function of(){if(vl)return Ka;vl=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.ArrayBufferPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===s})}minByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s-1}\`, got \`${a.byteLength}\``})}maxByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s+1}\`, got \`${a.byteLength}\``})}}return Ka.ArrayBufferPredicate=r,Ka}var Qa={},wl;function lf(){if(wl)return Qa;wl=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.DataViewPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("DataView",s)}byteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===s})}minByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s-1}\`, got \`${a.byteLength}\``})}maxByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s+1}\`, got \`${a.byteLength}\``})}}return Qa.DataViewPredicate=r,Qa}var es={},Nl;function uf(){if(Nl)return es;Nl=1,Object.defineProperty(es,"__esModule",{value:!0}),es.AnyPredicate=void 0;const t=bo(),r=ys(),n=cd();class s{constructor(i,o={}){Object.defineProperty(this,"predicates",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o})}[r.testSymbol](i,o,c,d){const f=new Map;for(const l of this.predicates)try{o(i,c,l,d);return}catch(h){if(i===void 0&&this.options.optional===!0)return;if(h instanceof t.ArgumentError)for(const[u,p]of h.validationErrors.entries()){const b=f.get(u);f.set(u,new Set([...b??[],...p]))}}if(f.size>0){const l=(0,n.generateArgumentErrorMessage)(f,!0);throw new t.ArgumentError(`Any predicate failed with the following errors:
63
+ `)};return Ia.generateArgumentErrorMessage=t,Ia}var Xo;function tr(){return Xo||(Xo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Predicate=t.validatorSymbol=void 0;const r=Pa(),n=bo(),s=V0(),a=ys(),i=cd();t.validatorSymbol=Symbol("validators");class o{constructor(d,f={}){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:{validators:[]}}),this.context={...this.context,...this.options};const l=this.type.charAt(0).toLowerCase()+this.type.slice(1);this.addValidator({message:(h,u)=>`Expected ${u?.slice(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${(0,r.default)(h)}\``,validator:h=>r.default[l](h)})}[a.testSymbol](d,f,l,h){const u=new Map;for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&d===void 0)continue;let w;try{w=p(d)}catch(m){w=m}if(w===!0)continue;const x=r.default.function_(l)?l():l,g=x&&h?`\`${x}\``:x,v=g?`${this.type} ${g}`:this.type,N=x||this.type,j=u.get(N),y=b(d,v,w);j?j.add(y):u.set(N,new Set([y]))}if(u.size>0){const p=(0,i.generateArgumentErrorMessage)(u);throw new n.ArgumentError(p,f,u)}}get[t.validatorSymbol](){return this.context.validators}get not(){return(0,s.not)(this)}validate(d){return this.addValidator({message:(f,l,h)=>typeof h=="string"?`(${l}) ${h}`:h(l),validator:f=>{const{message:l,validator:h}=d(f);return h?!0:l}})}is(d){return this.addValidator({message:(f,l,h)=>h?`(${l}) ${h}`:`Expected ${l} \`${f}\` to pass custom validation function`,validator:d})}message(d){const{validators:f}=this.context;return f[f.length-1].message=(l,h)=>typeof d=="function"?d(l,h):d,this}addValidator(d){return this.context.validators.push(d),this}}t.Predicate=o})(Wn)),Wn}var Ds={},Jn={},Fa={},Yn,Ko;function q0(){return Ko||(Ko=1,Yn=function(t){return!isNaN(Date.parse(t))}),Yn}var Qo;function H0(){if(Qo)return Fa;Qo=1,Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.StringPredicate=void 0;const t=Pa(),r=q0(),n=tr();class s extends n.Predicate{constructor(i){super("string",i)}length(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have length \`${i}\`, got \`${o}\``,validator:o=>o.length===i})}minLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a minimum length of \`${i}\`, got \`${o}\``,validator:o=>o.length>=i,negatedMessage:(o,c)=>`Expected ${c} to have a maximum length of \`${i-1}\`, got \`${o}\``})}maxLength(i){return this.addValidator({message:(o,c)=>`Expected ${c} to have a maximum length of \`${i}\`, got \`${o}\``,validator:o=>o.length<=i,negatedMessage:(o,c)=>`Expected ${c} to have a minimum length of \`${i+1}\`, got \`${o}\``})}matches(i){return this.addValidator({message:(o,c)=>`Expected ${c} to match \`${i}\`, got \`${o}\``,validator:o=>i.test(o)})}startsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to start with \`${i}\`, got \`${o}\``,validator:o=>o.startsWith(i)})}endsWith(i){return this.addValidator({message:(o,c)=>`Expected ${c} to end with \`${i}\`, got \`${o}\``,validator:o=>o.endsWith(i)})}includes(i){return this.addValidator({message:(o,c)=>`Expected ${c} to include \`${i}\`, got \`${o}\``,validator:o=>o.includes(i)})}oneOf(i){return this.addValidator({message:(o,c)=>{let d=JSON.stringify(i);if(i.length>10){const f=i.length-10;d=JSON.stringify(i.slice(0,10)).replace(/]$/,`,…+${f} more]`)}return`Expected ${c} to be one of \`${d}\`, got \`${o}\``},validator:o=>i.includes(o)})}get empty(){return this.addValidator({message:(i,o)=>`Expected ${o} to be empty, got \`${i}\``,validator:i=>i===""})}get nonEmpty(){return this.addValidator({message:(i,o)=>`Expected ${o} to not be empty`,validator:i=>i!==""})}equals(i){return this.addValidator({message:(o,c)=>`Expected ${c} to be equal to \`${i}\`, got \`${o}\``,validator:o=>o===i})}get alphanumeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphanumeric, got \`${i}\``,validator:i=>/^[a-z\d]+$/i.test(i)})}get alphabetical(){return this.addValidator({message:(i,o)=>`Expected ${o} to be alphabetical, got \`${i}\``,validator:i=>/^[a-z]+$/gi.test(i)})}get numeric(){return this.addValidator({message:(i,o)=>`Expected ${o} to be numeric, got \`${i}\``,validator:i=>/^[+-]?\d+$/i.test(i)})}get date(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a date, got \`${i}\``,validator:r})}get lowercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be lowercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toLowerCase()})}get uppercase(){return this.addValidator({message:(i,o)=>`Expected ${o} to be uppercase, got \`${i}\``,validator:i=>i.trim()!==""&&i===i.toUpperCase()})}get url(){return this.addValidator({message:(i,o)=>`Expected ${o} to be a URL, got \`${i}\``,validator:t.default.urlString})}}return Fa.StringPredicate=s,Fa}var Ba={},el;function z0(){if(el)return Ba;el=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.NumberPredicate=void 0;const t=Pa(),r=tr();class n extends r.Predicate{constructor(a){super("number",a)}inRange(a,i){return this.addValidator({message:(o,c)=>`Expected ${c} to be in range [${a}..${i}], got ${o}`,validator:o=>t.default.inRange(o,[a,i])})}greaterThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than ${a}, got ${i}`,validator:i=>i>a})}greaterThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be greater than or equal to ${a}, got ${i}`,validator:i=>i>=a})}lessThan(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than ${a}, got ${i}`,validator:i=>i<a})}lessThanOrEqual(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be less than or equal to ${a}, got ${i}`,validator:i=>i<=a})}equal(a){return this.addValidator({message:(i,o)=>`Expected ${o} to be equal to ${a}, got ${i}`,validator:i=>i===a})}oneOf(a){return this.addValidator({message:(i,o)=>{let c=JSON.stringify(a);if(a.length>10){const d=a.length-10;c=JSON.stringify(a.slice(0,10)).replace(/]$/,`,…+${d} more]`)}return`Expected ${o} to be one of \`${c}\`, got ${i}`},validator:i=>a.includes(i)})}get integer(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer, got ${a}`,validator:a=>t.default.integer(a)})}get finite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be finite, got ${a}`,validator:a=>!t.default.infinite(a)})}get infinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be infinite, got ${a}`,validator:a=>t.default.infinite(a)})}get positive(){return this.addValidator({message:(a,i)=>`Expected ${i} to be positive, got ${a}`,validator:a=>a>0})}get negative(){return this.addValidator({message:(a,i)=>`Expected ${i} to be negative, got ${a}`,validator:a=>a<0})}get integerOrInfinite(){return this.addValidator({message:(a,i)=>`Expected ${i} to be an integer or infinite, got ${a}`,validator:a=>t.default.integer(a)||t.default.infinite(a)})}get uint8(){return this.integer.inRange(0,255)}get uint16(){return this.integer.inRange(0,65535)}get uint32(){return this.integer.inRange(0,4294967295)}get int8(){return this.integer.inRange(-128,127)}get int16(){return this.integer.inRange(-32768,32767)}get int32(){return this.integer.inRange(-2147483648,2147483647)}}return Ba.NumberPredicate=n,Ba}var Ua={},tl;function W0(){if(tl)return Ua;tl=1,Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.BigIntPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("bigint",s)}}return Ua.BigIntPredicate=r,Ua}var Va={},rl;function G0(){if(rl)return Va;rl=1,Object.defineProperty(Va,"__esModule",{value:!0}),Va.BooleanPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("boolean",s)}get true(){return this.addValidator({message:(s,a)=>`Expected ${a} to be true, got ${s}`,validator:s=>s})}get false(){return this.addValidator({message:(s,a)=>`Expected ${a} to be false, got ${s}`,validator:s=>!s})}}return Va.BooleanPredicate=r,Va}var qa={},hs={exports:{}};hs.exports;var al;function An(){return al||(al=1,(function(t,r){var n=200,s="__lodash_hash_undefined__",a=1,i=2,o=9007199254740991,c="[object Arguments]",d="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",h="[object Date]",u="[object Error]",p="[object Function]",b="[object GeneratorFunction]",w="[object Map]",x="[object Number]",g="[object Null]",v="[object Object]",N="[object Promise]",j="[object Proxy]",y="[object RegExp]",m="[object Set]",_="[object String]",E="[object Symbol]",A="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",D="[object DataView]",L="[object Float32Array]",z="[object Float64Array]",U="[object Int8Array]",H="[object Int16Array]",F="[object Int32Array]",Y="[object Uint8Array]",G="[object Uint8ClampedArray]",ne="[object Uint16Array]",ie="[object Uint32Array]",xe=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,B={};B[L]=B[z]=B[U]=B[H]=B[F]=B[Y]=B[G]=B[ne]=B[ie]=!0,B[c]=B[d]=B[T]=B[l]=B[D]=B[h]=B[u]=B[p]=B[w]=B[x]=B[v]=B[y]=B[m]=B[_]=B[C]=!1;var pe=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,ee=typeof self=="object"&&self&&self.Object===Object&&self,te=pe||ee||Function("return this")(),_e=r&&!r.nodeType&&r,Ie=_e&&!0&&t&&!t.nodeType&&t,K=Ie&&Ie.exports===_e,le=K&&pe.process,oe=(function(){try{return le&&le.binding&&le.binding("util")}catch{}})(),Ne=oe&&oe.isTypedArray;function Ce(R,J){for(var X=-1,M=R==null?0:R.length,ce=0,me=[];++X<M;){var qe=R[X];J(qe,X,R)&&(me[ce++]=qe)}return me}function Me(R,J){for(var X=-1,M=J.length,ce=R.length;++X<M;)R[ce+X]=J[X];return R}function Fe(R,J){for(var X=-1,M=R==null?0:R.length;++X<M;)if(J(R[X],X,R))return!0;return!1}function ue(R,J){for(var X=-1,M=Array(R);++X<R;)M[X]=J(X);return M}function Re(R){return function(J){return R(J)}}function ae(R,J){return R.has(J)}function de(R,J){return R?.[J]}function ve(R){var J=-1,X=Array(R.size);return R.forEach(function(M,ce){X[++J]=[ce,M]}),X}function fe(R,J){return function(X){return R(J(X))}}function ke(R){var J=-1,X=Array(R.size);return R.forEach(function(M){X[++J]=M}),X}var Se=Array.prototype,Be=Function.prototype,Ge=Object.prototype,pt=te["__core-js_shared__"],jt=Be.toString,gt=Ge.hasOwnProperty,St=(function(){var R=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""})(),Ct=Ge.toString,Tt=RegExp("^"+jt.call(gt).replace(xe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bt=K?te.Buffer:void 0,Ke=te.Symbol,at=te.Uint8Array,_t=Ge.propertyIsEnumerable,Ut=Se.splice,kt=Ke?Ke.toStringTag:void 0,Vt=Object.getOwnPropertySymbols,S=Bt?Bt.isBuffer:void 0,P=fe(Object.keys,Object),I=Xt(te,"DataView"),Z=Xt(te,"Map"),be=Xt(te,"Promise"),Oe=Xt(te,"Set"),Ze=Xt(te,"WeakMap"),Ue=Xt(Object,"create"),He=se(I),bt=se(Z),Dt=se(be),Mt=se(Oe),$t=se(Ze),Zt=Ke?Ke.prototype:void 0,Et=Zt?Zt.valueOf:void 0;function ft(R){var J=-1,X=R==null?0:R.length;for(this.clear();++J<X;){var M=R[J];this.set(M[0],M[1])}}function ge(){this.__data__=Ue?Ue(null):{},this.size=0}function Te(R){var J=this.has(R)&&delete this.__data__[R];return this.size-=J?1:0,J}function Pe(R){var J=this.__data__;if(Ue){var X=J[R];return X===s?void 0:X}return gt.call(J,R)?J[R]:void 0}function ze(R){var J=this.__data__;return Ue?J[R]!==void 0:gt.call(J,R)}function Ve(R,J){var X=this.__data__;return this.size+=this.has(R)?0:1,X[R]=Ue&&J===void 0?s:J,this}ft.prototype.clear=ge,ft.prototype.delete=Te,ft.prototype.get=Pe,ft.prototype.has=ze,ft.prototype.set=Ve;function xt(R){var J=-1,X=R==null?0:R.length;for(this.clear();++J<X;){var M=R[J];this.set(M[0],M[1])}}function Je(){this.__data__=[],this.size=0}function cr(R){var J=this.__data__,X=mt(J,R);if(X<0)return!1;var M=J.length-1;return X==M?J.pop():Ut.call(J,X,1),--this.size,!0}function Or(R){var J=this.__data__,X=mt(J,R);return X<0?void 0:J[X][1]}function rr(R){return mt(this.__data__,R)>-1}function Lr(R,J){var X=this.__data__,M=mt(X,R);return M<0?(++this.size,X.push([R,J])):X[M][1]=J,this}xt.prototype.clear=Je,xt.prototype.delete=cr,xt.prototype.get=Or,xt.prototype.has=rr,xt.prototype.set=Lr;function Ht(R){var J=-1,X=R==null?0:R.length;for(this.clear();++J<X;){var M=R[J];this.set(M[0],M[1])}}function Mr(){this.size=0,this.__data__={hash:new ft,map:new(Z||xt),string:new ft}}function $e(R){var J=We(this,R).delete(R);return this.size-=J?1:0,J}function ar(R){return We(this,R).get(R)}function kr(R){return We(this,R).has(R)}function ut(R,J){var X=We(this,R),M=X.size;return X.set(R,J),this.size+=X.size==M?0:1,this}Ht.prototype.clear=Mr,Ht.prototype.delete=$e,Ht.prototype.get=ar,Ht.prototype.has=kr,Ht.prototype.set=ut;function W(R){var J=-1,X=R==null?0:R.length;for(this.__data__=new Ht;++J<X;)this.add(R[J])}function Q(R){return this.__data__.set(R,s),this}function we(R){return this.__data__.has(R)}W.prototype.add=W.prototype.push=Q,W.prototype.has=we;function Ae(R){var J=this.__data__=new xt(R);this.size=J.size}function ht(){this.__data__=new xt,this.size=0}function Ye(R){var J=this.__data__,X=J.delete(R);return this.size=J.size,X}function yt(R){return this.__data__.get(R)}function Ot(R){return this.__data__.has(R)}function Jt(R,J){var X=this.__data__;if(X instanceof xt){var M=X.__data__;if(!Z||M.length<n-1)return M.push([R,J]),this.size=++X.size,this;X=this.__data__=new Ht(M)}return X.set(R,J),this.size=X.size,this}Ae.prototype.clear=ht,Ae.prototype.delete=Ye,Ae.prototype.get=yt,Ae.prototype.has=Ot,Ae.prototype.set=Jt;function At(R,J){var X=lt(R),M=!X&&De(R),ce=!X&&!M&&Qe(R),me=!X&&!M&&!ce&&dt(R),qe=X||M||ce||me,nt=qe?ue(R.length,String):[],it=nt.length;for(var ot in R)gt.call(R,ot)&&!(qe&&(ot=="length"||ce&&(ot=="offset"||ot=="parent")||me&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||dr(ot,it)))&&nt.push(ot);return nt}function mt(R,J){for(var X=R.length;X--;)if(ye(R[X][0],J))return X;return-1}function Rt(R,J,X){var M=J(R);return lt(R)?M:Me(M,X(R))}function qt(R){return R==null?R===void 0?A:g:kt&&kt in Object(R)?ir(R):he(R)}function It(R){return Lt(R)&&qt(R)==c}function sr(R,J,X,M,ce){return R===J?!0:R==null||J==null||!Lt(R)&&!Lt(J)?R!==R&&J!==J:xr(R,J,X,M,sr,ce)}function xr(R,J,X,M,ce,me){var qe=lt(R),nt=lt(J),it=qe?d:vt(R),ot=nt?d:vt(J);it=it==c?v:it,ot=ot==c?v:ot;var Ft=it==v,Qt=ot==v,zt=it==ot;if(zt&&Qe(R)){if(!Qe(J))return!1;qe=!0,Ft=!1}if(zt&&!Ft)return me||(me=new Ae),qe||dt(R)?nr(R,J,X,M,ce,me):yr(R,J,it,X,M,ce,me);if(!(X&a)){var wt=Ft&&gt.call(R,"__wrapped__"),fr=Qt&&gt.call(J,"__wrapped__");if(wt||fr){var Sr=wt?R.value():R,Br=fr?J.value():J;return me||(me=new Ae),ce(Sr,Br,X,M,me)}}return zt?(me||(me=new Ae),Ir(R,J,X,M,ce,me)):!1}function br(R){if(!Kt(R)||$(R))return!1;var J=et(R)?Tt:V;return J.test(se(R))}function lr(R){return Lt(R)&&Pt(R.length)&&!!B[qt(R)]}function ur(R){if(!re(R))return P(R);var J=[];for(var X in Object(R))gt.call(R,X)&&X!="constructor"&&J.push(X);return J}function nr(R,J,X,M,ce,me){var qe=X&a,nt=R.length,it=J.length;if(nt!=it&&!(qe&&it>nt))return!1;var ot=me.get(R);if(ot&&me.get(J))return ot==J;var Ft=-1,Qt=!0,zt=X&i?new W:void 0;for(me.set(R,J),me.set(J,R);++Ft<nt;){var wt=R[Ft],fr=J[Ft];if(M)var Sr=qe?M(fr,wt,Ft,J,R,me):M(wt,fr,Ft,R,J,me);if(Sr!==void 0){if(Sr)continue;Qt=!1;break}if(zt){if(!Fe(J,function(Br,aa){if(!ae(zt,aa)&&(wt===Br||ce(wt,Br,X,M,me)))return zt.push(aa)})){Qt=!1;break}}else if(!(wt===fr||ce(wt,fr,X,M,me))){Qt=!1;break}}return me.delete(R),me.delete(J),Qt}function yr(R,J,X,M,ce,me,qe){switch(X){case D:if(R.byteLength!=J.byteLength||R.byteOffset!=J.byteOffset)return!1;R=R.buffer,J=J.buffer;case T:return!(R.byteLength!=J.byteLength||!me(new at(R),new at(J)));case l:case h:case x:return ye(+R,+J);case u:return R.name==J.name&&R.message==J.message;case y:case _:return R==J+"";case w:var nt=ve;case m:var it=M&a;if(nt||(nt=ke),R.size!=J.size&&!it)return!1;var ot=qe.get(R);if(ot)return ot==J;M|=i,qe.set(R,J);var Ft=nr(nt(R),nt(J),M,ce,me,qe);return qe.delete(R),Ft;case E:if(Et)return Et.call(R)==Et.call(J)}return!1}function Ir(R,J,X,M,ce,me){var qe=X&a,nt=st(R),it=nt.length,ot=st(J),Ft=ot.length;if(it!=Ft&&!qe)return!1;for(var Qt=it;Qt--;){var zt=nt[Qt];if(!(qe?zt in J:gt.call(J,zt)))return!1}var wt=me.get(R);if(wt&&me.get(J))return wt==J;var fr=!0;me.set(R,J),me.set(J,R);for(var Sr=qe;++Qt<it;){zt=nt[Qt];var Br=R[zt],aa=J[zt];if(M)var Fo=qe?M(aa,Br,zt,J,R,me):M(Br,aa,zt,R,J,me);if(!(Fo===void 0?Br===aa||ce(Br,aa,X,M,me):Fo)){fr=!1;break}Sr||(Sr=zt=="constructor")}if(fr&&!Sr){var ks=R.constructor,Es=J.constructor;ks!=Es&&"constructor"in R&&"constructor"in J&&!(typeof ks=="function"&&ks instanceof ks&&typeof Es=="function"&&Es instanceof Es)&&(fr=!1)}return me.delete(R),me.delete(J),fr}function st(R){return Rt(R,or,Fr)}function We(R,J){var X=R.__data__;return vr(J)?X[typeof J=="string"?"string":"hash"]:X.map}function Xt(R,J){var X=de(R,J);return br(X)?X:void 0}function ir(R){var J=gt.call(R,kt),X=R[kt];try{R[kt]=void 0;var M=!0}catch{}var ce=Ct.call(R);return M&&(J?R[kt]=X:delete R[kt]),ce}var Fr=Vt?function(R){return R==null?[]:(R=Object(R),Ce(Vt(R),function(J){return _t.call(R,J)}))}:Yr,vt=qt;(I&&vt(new I(new ArrayBuffer(1)))!=D||Z&&vt(new Z)!=w||be&&vt(be.resolve())!=N||Oe&&vt(new Oe)!=m||Ze&&vt(new Ze)!=C)&&(vt=function(R){var J=qt(R),X=J==v?R.constructor:void 0,M=X?se(X):"";if(M)switch(M){case He:return D;case bt:return w;case Dt:return N;case Mt:return m;case $t:return C}return J});function dr(R,J){return J=J??o,!!J&&(typeof R=="number"||q.test(R))&&R>-1&&R%1==0&&R<J}function vr(R){var J=typeof R;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?R!=="__proto__":R===null}function $(R){return!!St&&St in R}function re(R){var J=R&&R.constructor,X=typeof J=="function"&&J.prototype||Ge;return R===X}function he(R){return Ct.call(R)}function se(R){if(R!=null){try{return jt.call(R)}catch{}try{return R+""}catch{}}return""}function ye(R,J){return R===J||R!==R&&J!==J}var De=It((function(){return arguments})())?It:function(R){return Lt(R)&&gt.call(R,"callee")&&!_t.call(R,"callee")},lt=Array.isArray;function Xe(R){return R!=null&&Pt(R.length)&&!et(R)}var Qe=S||ra;function ct(R,J){return sr(R,J)}function et(R){if(!Kt(R))return!1;var J=qt(R);return J==p||J==b||J==f||J==j}function Pt(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=o}function Kt(R){var J=typeof R;return R!=null&&(J=="object"||J=="function")}function Lt(R){return R!=null&&typeof R=="object"}var dt=Ne?Re(Ne):lr;function or(R){return Xe(R)?At(R):ur(R)}function Yr(){return[]}function ra(){return!1}t.exports=ct})(hs,hs.exports)),hs.exports}var ia={},Ps={},sl;function Sn(){if(sl)return Ps;sl=1,Object.defineProperty(Ps,"__esModule",{value:!0});const t=ys();function r(n,s,a,i=!0){a[t.testSymbol](n,r,s,i)}return Ps.default=r,Ps}var nl;function dd(){if(nl)return ia;nl=1,Object.defineProperty(ia,"__esModule",{value:!0}),ia.exact=ia.partial=void 0;const t=Pa(),r=Sn(),n=ys();function s(i,o,c){try{for(const d of Object.keys(o)){const f=c?`${c}.${d}`:d;if((0,n.isPredicate)(o[d]))(0,r.default)(i[d],f,o[d]);else if(t.default.plainObject(o[d])){const l=s(i[d],o[d],f);if(l!==!0)return l}}return!0}catch(d){return d.message}}ia.partial=s;function a(i,o,c,d){try{const f=new Set(Object.keys(i));for(const l of Object.keys(o)){f.delete(l);const h=c?`${c}.${l}`:l;if((0,n.isPredicate)(o[l]))(0,r.default)(i[l],h,o[l]);else if(t.default.plainObject(o[l])){if(!Object.prototype.hasOwnProperty.call(i,l))return`Expected \`${h}\` to exist`;const u=a(i[l],o[l],h);if(u!==!0)return u}}if(f.size>0){const l=[...f.keys()][0],h=c?`${c}.${l}`:l;return`Did not expect ${d?"element":"property"} \`${h}\` to exist, got \`${i[l]}\``}return!0}catch(f){return f.message}}return ia.exact=a,ia}var Os={},il;function Cn(){if(il)return Os;il=1,Object.defineProperty(Os,"__esModule",{value:!0});const t=Sn();return Os.default=(r,n,s)=>{try{for(const a of r)(0,t.default)(a,n,s,!1);return!0}catch(a){return a.message}},Os}var ol;function J0(){if(ol)return qa;ol=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.ArrayPredicate=void 0;const t=An(),r=tr(),n=dd(),s=Cn();class a extends r.Predicate{constructor(o){super("array",o)}length(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have length \`${o}\`, got \`${c.length}\``,validator:c=>c.length===o})}minLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum length of \`${o-1}\`, got \`${c.length}\``})}maxLength(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum length of \`${o}\`, got \`${c.length}\``,validator:c=>c.length<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum length of \`${o+1}\`, got \`${c.length}\``})}startsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to start with \`${o}\`, got \`${c[0]}\``,validator:c=>c[0]===o})}endsWith(o){return this.addValidator({message:(c,d)=>`Expected ${d} to end with \`${o}\`, got \`${c[c.length-1]}\``,validator:c=>c[c.length-1]===o})}includes(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include all elements of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.every(d=>c.includes(d))})}includesAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to include any element of \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>o.some(d=>c.includes(d))})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify(o)}\``,validator:o=>o.length===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.length>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify(o)}\`, got \`${JSON.stringify(c)}\``,validator:c=>t(c,o)})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,s.default)(c,"values",o)})}exactShape(o){const c=o;return this.addValidator({message:(d,f,l)=>`${l.replace("Expected","Expected element")} in ${f}`,validator:d=>(0,n.exact)(d,c,void 0,!0)})}}return qa.ArrayPredicate=a,qa}var Ha={},Zn,ll;function Y0(){return ll||(ll=1,Zn=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")}),Zn}var Xn,ul;function Z0(){if(ul)return Xn;ul=1;const t=Y0(),r=new Set(["__proto__","prototype","constructor"]),n=a=>!a.some(i=>r.has(i));function s(a){const i=a.split("."),o=[];for(let c=0;c<i.length;c++){let d=i[c];for(;d[d.length-1]==="\\"&&i[c+1]!==void 0;)d=d.slice(0,-1)+".",d+=i[++c];o.push(d)}return n(o)?o:[]}return Xn={get(a,i,o){if(!t(a)||typeof i!="string")return o===void 0?a:o;const c=s(i);if(c.length!==0){for(let d=0;d<c.length;d++)if(a=a[c[d]],a==null){if(d!==c.length-1)return o;break}return a===void 0?o:a}},set(a,i,o){if(!t(a)||typeof i!="string")return a;const c=a,d=s(i);for(let f=0;f<d.length;f++){const l=d[f];t(a[l])||(a[l]={}),f===d.length-1&&(a[l]=o),a=a[l]}return c},delete(a,i){if(!t(a)||typeof i!="string")return!1;const o=s(i);for(let c=0;c<o.length;c++){const d=o[c];if(c===o.length-1)return delete a[d],!0;if(a=a[d],!t(a))return!1}},has(a,i){if(!t(a)||typeof i!="string")return!1;const o=s(i);if(o.length===0)return!1;for(let c=0;c<o.length;c++)if(t(a)){if(!(o[c]in a))return!1;a=a[o[c]]}else return!1;return!0}},Xn}var Ls={},cl;function vs(){return cl||(cl=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.default=(t,r,n=5)=>{const s=[];for(const a of r)if(!t.has(a)&&(s.push(a),s.length===n))return s;return s.length===0?!0:s}),Ls}var Ms={},dl;function X0(){if(dl)return Ms;dl=1,Object.defineProperty(Ms,"__esModule",{value:!0});const t=Pa(),r=Sn(),n=(s,a)=>t.default.plainObject(s)?Object.values(s).every(i=>n(i,a)):((0,r.default)(s,"deep values",a,!1),!0);return Ms.default=(s,a)=>{try{return n(s,a)}catch(i){return i.message}},Ms}var fl;function K0(){if(fl)return Ha;fl=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.ObjectPredicate=void 0;const t=Pa(),r=Z0(),n=An(),s=vs(),a=Cn(),i=X0(),o=dd(),c=tr();class d extends c.Predicate{constructor(l){super("object",l)}get plain(){return this.addValidator({message:(l,h)=>`Expected ${h} to be a plain object`,validator:l=>t.default.plainObject(l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(l)}\``,validator:l=>Object.keys(l).length===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>Object.keys(l).length>0})}valuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,a.default)(Object.values(h),"values",l)})}deepValuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>(0,i.default)(h,l)})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(l)}\`, got \`${JSON.stringify(h)}\``,validator:h=>n(h,l)})}instanceOf(l){return this.addValidator({message:(h,u)=>{var p;let{name:b}=(p=h?.constructor)!==null&&p!==void 0?p:{};return(!b||b==="Object")&&(b=JSON.stringify(h)),`Expected ${u} \`${b}\` to be of type \`${l.name}\``},validator:h=>h instanceof l})}hasKeys(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have keys \`${JSON.stringify(p)}\``,validator:h=>(0,s.default)({has:u=>r.has(h,u)},l)})}hasAnyKeys(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any key of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>r.has(h,u))})}partialShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.partial)(h,l)})}exactShape(l){return this.addValidator({message:(h,u,p)=>`${p.replace("Expected","Expected property")} in ${u}`,validator:h=>(0,o.exact)(h,l)})}}return Ha.ObjectPredicate=d,Ha}var za={},hl;function Q0(){if(hl)return za;hl=1,Object.defineProperty(za,"__esModule",{value:!0}),za.DatePredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("date",s)}before(s){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be before ${s.toISOString()}`,validator:a=>a.getTime()<s.getTime()})}after(s){return this.addValidator({message:(a,i)=>`Expected ${i} ${a.toISOString()} to be after ${s.toISOString()}`,validator:a=>a.getTime()>s.getTime()})}}return za.DatePredicate=r,za}var Wa={},ml;function ef(){if(ml)return Wa;ml=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ErrorPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("error",s)}name(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have name \`${s}\`, got \`${a.name}\``,validator:a=>a.name===s})}message(s){return this.addValidator({message:(a,i)=>`Expected ${i} message to be \`${s}\`, got \`${a.message}\``,validator:a=>a.message===s})}messageIncludes(s){return this.addValidator({message:(a,i)=>`Expected ${i} message to include \`${s}\`, got \`${a.message}\``,validator:a=>a.message.includes(s)})}hasKeys(...s){return this.addValidator({message:(a,i)=>`Expected ${i} message to have keys \`${s.join("`, `")}\``,validator:a=>s.every(i=>Object.prototype.hasOwnProperty.call(a,i))})}instanceOf(s){return this.addValidator({message:(a,i)=>`Expected ${i} \`${a.name}\` to be of type \`${s.name}\``,validator:a=>a instanceof s})}get typeError(){return this.instanceOf(TypeError)}get evalError(){return this.instanceOf(EvalError)}get rangeError(){return this.instanceOf(RangeError)}get referenceError(){return this.instanceOf(ReferenceError)}get syntaxError(){return this.instanceOf(SyntaxError)}get uriError(){return this.instanceOf(URIError)}}return Wa.ErrorPredicate=r,Wa}var Ga={},pl;function tf(){if(pl)return Ga;pl=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.MapPredicate=void 0;const t=An(),r=vs(),n=Cn(),s=tr();class a extends s.Predicate{constructor(o){super("Map",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}hasKeys(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have keys \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAnyKeys(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any key of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}hasValues(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have values \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(new Set(c.values()),o)})}hasAnyValues(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any value of \`${JSON.stringify(o)}\``,validator:c=>{const d=new Set(c.values());return o.some(f=>d.has(f))}})}keysOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c.keys(),"keys",o)})}valuesOfType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c.values(),"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ga.MapPredicate=a,Ga}var Ja={},gl;function rf(){if(gl)return Ja;gl=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.WeakMapPredicate=void 0;const t=vs(),r=tr();class n extends r.Predicate{constructor(a){super("WeakMap",a)}hasKeys(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have keys \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAnyKeys(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any key of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Ja.WeakMapPredicate=n,Ja}var Ya={},xl;function af(){if(xl)return Ya;xl=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.SetPredicate=void 0;const t=An(),r=vs(),n=Cn(),s=tr();class a extends s.Predicate{constructor(o){super("Set",o)}size(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have size \`${o}\`, got \`${c.size}\``,validator:c=>c.size===o})}minSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a minimum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size>=o,negatedMessage:(c,d)=>`Expected ${d} to have a maximum size of \`${o-1}\`, got \`${c.size}\``})}maxSize(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have a maximum size of \`${o}\`, got \`${c.size}\``,validator:c=>c.size<=o,negatedMessage:(c,d)=>`Expected ${d} to have a minimum size of \`${o+1}\`, got \`${c.size}\``})}has(...o){return this.addValidator({message:(c,d,f)=>`Expected ${d} to have items \`${JSON.stringify(f)}\``,validator:c=>(0,r.default)(c,o)})}hasAny(...o){return this.addValidator({message:(c,d)=>`Expected ${d} to have any item of \`${JSON.stringify(o)}\``,validator:c=>o.some(d=>c.has(d))})}ofType(o){return this.addValidator({message:(c,d,f)=>`(${d}) ${f}`,validator:c=>(0,n.default)(c,"values",o)})}get empty(){return this.addValidator({message:(o,c)=>`Expected ${c} to be empty, got \`${JSON.stringify([...o])}\``,validator:o=>o.size===0})}get nonEmpty(){return this.addValidator({message:(o,c)=>`Expected ${c} to not be empty`,validator:o=>o.size>0})}deepEqual(o){return this.addValidator({message:(c,d)=>`Expected ${d} to be deeply equal to \`${JSON.stringify([...o])}\`, got \`${JSON.stringify([...c])}\``,validator:c=>t(c,o)})}}return Ya.SetPredicate=a,Ya}var Za={},bl;function sf(){if(bl)return Za;bl=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.WeakSetPredicate=void 0;const t=vs(),r=tr();class n extends r.Predicate{constructor(a){super("WeakSet",a)}has(...a){return this.addValidator({message:(i,o,c)=>`Expected ${o} to have items \`${JSON.stringify(c)}\``,validator:i=>(0,t.default)(i,a)})}hasAny(...a){return this.addValidator({message:(i,o)=>`Expected ${o} to have any item of \`${JSON.stringify(a)}\``,validator:i=>a.some(o=>i.has(o))})}}return Za.WeakSetPredicate=n,Za}var Xa={},yl;function nf(){if(yl)return Xa;yl=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.TypedArrayPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===s})}minByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s-1}\`, got \`${a.byteLength}\``})}maxByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s+1}\`, got \`${a.byteLength}\``})}length(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have length \`${s}\`, got \`${a.length}\``,validator:a=>a.length===s})}minLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum length of \`${s}\`, got \`${a.length}\``,validator:a=>a.length>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum length of \`${s-1}\`, got \`${a.length}\``})}maxLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum length of \`${s}\`, got \`${a.length}\``,validator:a=>a.length<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum length of \`${s+1}\`, got \`${a.length}\``})}}return Xa.TypedArrayPredicate=r,Xa}var Ka={},vl;function of(){if(vl)return Ka;vl=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.ArrayBufferPredicate=void 0;const t=tr();class r extends t.Predicate{byteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===s})}minByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s-1}\`, got \`${a.byteLength}\``})}maxByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s+1}\`, got \`${a.byteLength}\``})}}return Ka.ArrayBufferPredicate=r,Ka}var Qa={},wl;function lf(){if(wl)return Qa;wl=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.DataViewPredicate=void 0;const t=tr();class r extends t.Predicate{constructor(s){super("DataView",s)}byteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength===s})}minByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength>=s,negatedMessage:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s-1}\`, got \`${a.byteLength}\``})}maxByteLength(s){return this.addValidator({message:(a,i)=>`Expected ${i} to have a maximum byte length of \`${s}\`, got \`${a.byteLength}\``,validator:a=>a.byteLength<=s,negatedMessage:(a,i)=>`Expected ${i} to have a minimum byte length of \`${s+1}\`, got \`${a.byteLength}\``})}}return Qa.DataViewPredicate=r,Qa}var es={},Nl;function uf(){if(Nl)return es;Nl=1,Object.defineProperty(es,"__esModule",{value:!0}),es.AnyPredicate=void 0;const t=bo(),r=ys(),n=cd();class s{constructor(i,o={}){Object.defineProperty(this,"predicates",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o})}[r.testSymbol](i,o,c,d){const f=new Map;for(const l of this.predicates)try{o(i,c,l,d);return}catch(h){if(i===void 0&&this.options.optional===!0)return;if(h instanceof t.ArgumentError)for(const[u,p]of h.validationErrors.entries()){const b=f.get(u);f.set(u,new Set([...b??[],...p]))}}if(f.size>0){const l=(0,n.generateArgumentErrorMessage)(f,!0);throw new t.ArgumentError(`Any predicate failed with the following errors:
64
64
  ${l}`,o,f)}}}return es.AnyPredicate=s,es}var jl;function io(){return jl||(jl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AnyPredicate=t.DataViewPredicate=t.ArrayBufferPredicate=t.TypedArrayPredicate=t.WeakSetPredicate=t.SetPredicate=t.WeakMapPredicate=t.MapPredicate=t.ErrorPredicate=t.DatePredicate=t.ObjectPredicate=t.ArrayPredicate=t.BooleanPredicate=t.BigIntPredicate=t.NumberPredicate=t.StringPredicate=void 0;const r=H0();Object.defineProperty(t,"StringPredicate",{enumerable:!0,get:function(){return r.StringPredicate}});const n=z0();Object.defineProperty(t,"NumberPredicate",{enumerable:!0,get:function(){return n.NumberPredicate}});const s=W0();Object.defineProperty(t,"BigIntPredicate",{enumerable:!0,get:function(){return s.BigIntPredicate}});const a=G0();Object.defineProperty(t,"BooleanPredicate",{enumerable:!0,get:function(){return a.BooleanPredicate}});const i=tr(),o=J0();Object.defineProperty(t,"ArrayPredicate",{enumerable:!0,get:function(){return o.ArrayPredicate}});const c=K0();Object.defineProperty(t,"ObjectPredicate",{enumerable:!0,get:function(){return c.ObjectPredicate}});const d=Q0();Object.defineProperty(t,"DatePredicate",{enumerable:!0,get:function(){return d.DatePredicate}});const f=ef();Object.defineProperty(t,"ErrorPredicate",{enumerable:!0,get:function(){return f.ErrorPredicate}});const l=tf();Object.defineProperty(t,"MapPredicate",{enumerable:!0,get:function(){return l.MapPredicate}});const h=rf();Object.defineProperty(t,"WeakMapPredicate",{enumerable:!0,get:function(){return h.WeakMapPredicate}});const u=af();Object.defineProperty(t,"SetPredicate",{enumerable:!0,get:function(){return u.SetPredicate}});const p=sf();Object.defineProperty(t,"WeakSetPredicate",{enumerable:!0,get:function(){return p.WeakSetPredicate}});const b=nf();Object.defineProperty(t,"TypedArrayPredicate",{enumerable:!0,get:function(){return b.TypedArrayPredicate}});const w=of();Object.defineProperty(t,"ArrayBufferPredicate",{enumerable:!0,get:function(){return w.ArrayBufferPredicate}});const x=lf();Object.defineProperty(t,"DataViewPredicate",{enumerable:!0,get:function(){return x.DataViewPredicate}});const g=uf();Object.defineProperty(t,"AnyPredicate",{enumerable:!0,get:function(){return g.AnyPredicate}}),t.default=(v,N)=>(Object.defineProperties(v,{string:{get:()=>new r.StringPredicate(N)},number:{get:()=>new n.NumberPredicate(N)},bigint:{get:()=>new s.BigIntPredicate(N)},boolean:{get:()=>new a.BooleanPredicate(N)},undefined:{get:()=>new i.Predicate("undefined",N)},null:{get:()=>new i.Predicate("null",N)},nullOrUndefined:{get:()=>new i.Predicate("nullOrUndefined",N)},nan:{get:()=>new i.Predicate("nan",N)},symbol:{get:()=>new i.Predicate("symbol",N)},array:{get:()=>new o.ArrayPredicate(N)},object:{get:()=>new c.ObjectPredicate(N)},date:{get:()=>new d.DatePredicate(N)},error:{get:()=>new f.ErrorPredicate(N)},map:{get:()=>new l.MapPredicate(N)},weakMap:{get:()=>new h.WeakMapPredicate(N)},set:{get:()=>new u.SetPredicate(N)},weakSet:{get:()=>new p.WeakSetPredicate(N)},function:{get:()=>new i.Predicate("Function",N)},buffer:{get:()=>new i.Predicate("Buffer",N)},regExp:{get:()=>new i.Predicate("RegExp",N)},promise:{get:()=>new i.Predicate("Promise",N)},typedArray:{get:()=>new b.TypedArrayPredicate("TypedArray",N)},int8Array:{get:()=>new b.TypedArrayPredicate("Int8Array",N)},uint8Array:{get:()=>new b.TypedArrayPredicate("Uint8Array",N)},uint8ClampedArray:{get:()=>new b.TypedArrayPredicate("Uint8ClampedArray",N)},int16Array:{get:()=>new b.TypedArrayPredicate("Int16Array",N)},uint16Array:{get:()=>new b.TypedArrayPredicate("Uint16Array",N)},int32Array:{get:()=>new b.TypedArrayPredicate("Int32Array",N)},uint32Array:{get:()=>new b.TypedArrayPredicate("Uint32Array",N)},float32Array:{get:()=>new b.TypedArrayPredicate("Float32Array",N)},float64Array:{get:()=>new b.TypedArrayPredicate("Float64Array",N)},arrayBuffer:{get:()=>new w.ArrayBufferPredicate("ArrayBuffer",N)},sharedArrayBuffer:{get:()=>new w.ArrayBufferPredicate("SharedArrayBuffer",N)},dataView:{get:()=>new x.DataViewPredicate(N)},iterable:{get:()=>new i.Predicate("Iterable",N)},any:{value:(...j)=>new g.AnyPredicate(j,N)}}),v)})(Jn)),Jn}var _l;function cf(){if(_l)return Ds;_l=1,Object.defineProperty(Ds,"__esModule",{value:!0});const t=io();return Ds.default=r=>(Object.defineProperties(r,{optional:{get:()=>(0,t.default)({},{optional:!0})}}),r),Ds}var kl;function ws(){return kl||(kl=1,(function(t){var r=na&&na.__createBinding||(Object.create?(function(p,b,w,x){x===void 0&&(x=w);var g=Object.getOwnPropertyDescriptor(b,w);(!g||("get"in g?!b.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return b[w]}}),Object.defineProperty(p,x,g)}):(function(p,b,w,x){x===void 0&&(x=w),p[x]=b[w]})),n=na&&na.__exportStar||function(p,b){for(var w in p)w!=="default"&&!Object.prototype.hasOwnProperty.call(b,w)&&r(b,p,w)};Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentError=t.Predicate=void 0;const s=I0(),a=F0(),i=tr();Object.defineProperty(t,"Predicate",{enumerable:!0,get:function(){return i.Predicate}});const o=ys(),c=cf(),d=io(),f=Sn(),l=(p,b,w)=>{if(!(0,o.isPredicate)(b)&&typeof b!="string")throw new TypeError(`Expected second argument to be a predicate or a string, got \`${typeof b}\``);if((0,o.isPredicate)(b)){const x=(0,s.default)();(0,f.default)(p,()=>(0,a.inferLabel)(x),b);return}(0,f.default)(p,b,w)};Object.defineProperties(l,{isValid:{value:(p,b)=>{try{return(0,f.default)(p,"",b),!0}catch{return!1}}},create:{value:(p,b)=>(w,x)=>{if((0,o.isPredicate)(p)){const g=(0,s.default)();(0,f.default)(w,x??(()=>(0,a.inferLabel)(g)),p);return}(0,f.default)(w,x??p,b)}}});const h=(0,d.default)((0,c.default)(l));t.default=h,n(io(),t);var u=bo();Object.defineProperty(t,"ArgumentError",{enumerable:!0,get:function(){return u.ArgumentError}})})(na)),na}var Rs;function fd(t){return Rs=Rs||document.createElement("textarea"),Rs.innerHTML="&"+t+";",Rs.value}function df(t){return Object.prototype.toString.call(t)}function ff(t){return df(t)==="[object String]"}var hf=Object.prototype.hasOwnProperty;function hd(t,r){return t?hf.call(t,r):!1}function yo(t){var r=[].slice.call(arguments,1);return r.forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(s){t[s]=n[s]})}}),t}var mf=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Ta(t){return t.indexOf("\\")<0?t:t.replace(mf,"$1")}function vo(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function wn(t){if(t>65535){t-=65536;var r=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(r,n)}return String.fromCharCode(t)}var pf=/&([a-z#][a-z0-9]{1,31});/gi,gf=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function xf(t,r){var n=0,s=fd(r);return r!==s?s:r.charCodeAt(0)===35&&gf.test(r)&&(n=r[1].toLowerCase()==="x"?parseInt(r.slice(2),16):parseInt(r.slice(1),10),vo(n))?wn(n):t}function Qr(t){return t.indexOf("&")<0?t:t.replace(pf,xf)}var bf=/[&<>"]/,yf=/[&<>"]/g,vf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function wf(t){return vf[t]}function gr(t){return bf.test(t)?t.replace(yf,wf):t}var Nf=Object.freeze({isString:ff,has:hd,assign:yo,unescapeMd:Ta,isValidEntityCode:vo,fromCodePoint:wn,replaceEntities:Qr,escapeHtml:gr}),Le={};Le.blockquote_open=function(){return`<blockquote>
65
65
  `};Le.blockquote_close=function(t,r){return"</blockquote>"+ba(t,r)};Le.code=function(t,r){return t[r].block?"<pre><code>"+gr(t[r].content)+"</code></pre>"+ba(t,r):"<code>"+gr(t[r].content)+"</code>"};Le.fence=function(t,r,n,s,a){var i=t[r],o="",c=n.langPrefix,d="",f,l,h;if(i.params){if(f=i.params.split(/\s+/g),l=f.join(" "),hd(a.rules.fence_custom,f[0]))return a.rules.fence_custom[f[0]](t,r,n,s,a);d=gr(Qr(Ta(l))),o=' class="'+c+d+'"'}return n.highlight?h=n.highlight.apply(n.highlight,[i.content].concat(f))||gr(i.content):h=gr(i.content),"<pre><code"+o+">"+h+"</code></pre>"+ba(t,r)};Le.fence_custom={};Le.heading_open=function(t,r){return"<h"+t[r].hLevel+">"};Le.heading_close=function(t,r){return"</h"+t[r].hLevel+`>
66
66
  `};Le.hr=function(t,r,n){return(n.xhtmlOut?"<hr />":"<hr>")+ba(t,r)};Le.bullet_list_open=function(){return`<ul>
@@ -100,11 +100,11 @@ new Remarkable().use(linkify)
100
100
  `),this.inline=new Dn,this.block=new No,this.core=new bd,this.renderer=new wo,this.ruler=new _r,this.options={},this.configure(Gh[t]),this.set(r||{})}ta.prototype.set=function(t){yo(this.options,t)};ta.prototype.configure=function(t){var r=this;if(!t)throw new Error("Wrong `remarkable` preset, check name/content");t.options&&r.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&r[n].ruler.enable(t.components[n].rules,!0)})};ta.prototype.use=function(t,r){return t(this,r),this};ta.prototype.parse=function(t,r){var n=new vd(this,t,r);return this.core.process(n),n.tokens};ta.prototype.render=function(t,r){return r=r||{},this.renderer.render(this.parse(t,r),this.options,r)};ta.prototype.parseInline=function(t,r){var n=new vd(this,t,r);return n.inlineMode=!0,this.core.process(n),n.tokens};ta.prototype.renderInline=function(t,r){return r=r||{},this.renderer.render(this.parseInline(t,r),this.options,r)};const Jh=Object.freeze(Object.defineProperty({__proto__:null,Remarkable:ta,utils:Nf},Symbol.toStringTag,{value:"Module"})),Yh=xo(Jh);var Ur={},Zr={};function Zh(t,r){var n=Object.setPrototypeOf;n?n(t,r):t.__proto__=r}function wd(t,r){r===void 0&&(r=t.constructor);var n=Error.captureStackTrace;n&&n(t,r)}var Xh=(function(){var t=function(n,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=i[o])},t(n,s)};return function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function s(){this.constructor=r}r.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}})(),Kh=(function(t){Xh(r,t);function r(n,s){var a=this.constructor,i=t.call(this,n,s)||this;return Object.defineProperty(i,"name",{value:a.name,enumerable:!1,configurable:!0}),Zh(i,a.prototype),wd(i),i}return r})(Error),Qh=function(t,r,n){if(n||arguments.length===2)for(var s=0,a=r.length,i;s<a;s++)(i||!(s in r))&&(i||(i=Array.prototype.slice.call(r,0,s)),i[s]=r[s]);return t.concat(i||Array.prototype.slice.call(r))};function em(t,r){r===void 0&&(r=Error);function n(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];if(!(this instanceof n))return new(n.bind.apply(n,Qh([void 0],s,!1)));r.apply(this,s),Object.defineProperty(this,"name",{value:t.name||r.name,enumerable:!1,configurable:!0}),t.apply(this,s),wd(this,n)}return Object.defineProperties(n,{prototype:{value:Object.create(r.prototype,{constructor:{value:n,writable:!0,configurable:!0}})}})}const tm=Object.freeze(Object.defineProperty({__proto__:null,CustomError:Kh,customErrorFactory:em},Symbol.toStringTag,{value:"Module"})),rm=xo(tm);var ri={};const am={},sm=Object.freeze(Object.defineProperty({__proto__:null,default:am},Symbol.toStringTag,{value:"Module"})),jr=xo(sm);var ai,Ml;function nm(){if(Ml)return ai;Ml=1;const t=jr,r=/\s+at.*(?:\(|\s)(.*)\)?/,n=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,s=typeof t.homedir>"u"?"":t.homedir();return ai=(a,i)=>(i=Object.assign({pretty:!1},i),a.replace(/\\/g,"/").split(`
101
101
  `).filter(o=>{const c=o.match(r);if(c===null||!c[1])return!0;const d=c[1];return d.includes(".app/Contents/Resources/electron.asar")||d.includes(".app/Contents/Resources/default_app.asar")?!1:!n.test(d)}).filter(o=>o.trim()!=="").map(o=>i.pretty?o.replace(r,(c,d)=>c.replace(d,d.replace(s,"~"))):o).join(`
102
102
  `)),ai}var si,Rl;function Nd(){if(Rl)return si;Rl=1;var t=function(v){return r(v)&&!n(v)};function r(g){return!!g&&typeof g=="object"}function n(g){var v=Object.prototype.toString.call(g);return v==="[object RegExp]"||v==="[object Date]"||i(g)}var s=typeof Symbol=="function"&&Symbol.for,a=s?Symbol.for("react.element"):60103;function i(g){return g.$$typeof===a}function o(g){return Array.isArray(g)?[]:{}}function c(g,v){return v.clone!==!1&&v.isMergeableObject(g)?w(o(g),g,v):g}function d(g,v,N){return g.concat(v).map(function(j){return c(j,N)})}function f(g,v){if(!v.customMerge)return w;var N=v.customMerge(g);return typeof N=="function"?N:w}function l(g){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(g).filter(function(v){return Object.propertyIsEnumerable.call(g,v)}):[]}function h(g){return Object.keys(g).concat(l(g))}function u(g,v){try{return v in g}catch{return!1}}function p(g,v){return u(g,v)&&!(Object.hasOwnProperty.call(g,v)&&Object.propertyIsEnumerable.call(g,v))}function b(g,v,N){var j={};return N.isMergeableObject(g)&&h(g).forEach(function(y){j[y]=c(g[y],N)}),h(v).forEach(function(y){p(g,y)||(u(g,y)&&N.isMergeableObject(v[y])?j[y]=f(y,N)(g[y],v[y],N):j[y]=c(v[y],N))}),j}function w(g,v,N){N=N||{},N.arrayMerge=N.arrayMerge||d,N.isMergeableObject=N.isMergeableObject||t,N.cloneUnlessOtherwiseSpecified=c;var j=Array.isArray(v),y=Array.isArray(g),m=j===y;return m?j?N.arrayMerge(g,v,N):b(g,v,N):c(v,N)}w.all=function(v,N){if(!Array.isArray(v))throw new Error("first argument should be an array");return v.reduce(function(j,y){return w(j,y,N)},{})};var x=w;return si=x,si}var ni={},$l;function lo(){return $l||($l=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),(function(r){r.DEFAULT={cleanStack:!0}})(t.Options||(t.Options={}))})(ni)),ni}var Il;function Fl(){return Il||(Il=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=nm(),n=Nd(),s=lo();(function(a){function i(d,f,l,h){h===void 0&&(h=s.Options.DEFAULT);var u=d;return f&&(u.cause=f),u.stack=o(u.stack,f,h),l&&c(u,l),u}a.make=i;function o(d,f,l){var h=d||"";f&&(h+=`
103
- Caused by: `+(f.stack||f));function u(p){return r(p,{pretty:!0})}return l&&l.cleanStack&&(h=u(h)),h}a.appendToStack=o;function c(d,f){for(var l in f)if(f.hasOwnProperty(l)){var h=d.hasOwnProperty(l)&&typeof d[l]=="object";d[l]=h?n(d[l],f[l]):f[l]}}})(t.ChainedErrorFactory||(t.ChainedErrorFactory={}))})(ri)),ri}var Bl;function Pn(){if(Bl)return Zr;Bl=1;var t=Zr&&Zr.__extends||(function(){var c=function(d,f){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var u in h)h.hasOwnProperty(u)&&(l[u]=h[u])},c(d,f)};return function(d,f){c(d,f);function l(){this.constructor=d}d.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}})();Object.defineProperty(Zr,"__esModule",{value:!0});var r=rm,n=Fl(),s=lo(),a=(function(c){t(d,c);function d(f,l,h){h===void 0&&(h=s.Options.DEFAULT);var u=c.call(this,f)||this;return u.cause=l,u.stack=n.ChainedErrorFactory.appendToStack(u.stack,l,h),u}return d})(r.CustomError);Zr.default=a;var i=Fl();Zr.ChainedErrorFactory=i.ChainedErrorFactory;var o=lo();return Zr.Options=o.Options,Zr}var Ul;function im(){if(Ul)return Ur;Ul=1;var t=Ur&&Ur.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.SecurityError=Ur.SecurityChecker=void 0;const r=t(Pn());let n=class{static checkSecurity(i,o){if(!o.allowScriptTag&&this.containsScriptTag(i))throw new s("Renderer rejected the input because of insecure content: text contains script tag")}static containsScriptTag(i){return/<\s*script/gi.test(i)}};Ur.SecurityChecker=n;class s extends r.default{constructor(i,o){super(i,o)}}return Ur.SecurityError=s,Ur}var hr={},ts={},Vr={},oa={},Vl;function On(){if(Vl)return oa;Vl=1;function t(i,o,c){if(c===void 0&&(c=Array.prototype),i&&typeof c.find=="function")return c.find.call(i,o);for(var d=0;d<i.length;d++)if(Object.prototype.hasOwnProperty.call(i,d)){var f=i[d];if(o.call(void 0,f,d,i))return f}}function r(i,o){return o===void 0&&(o=Object),o&&typeof o.freeze=="function"?o.freeze(i):i}function n(i,o){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(i[c]=o[c]);return i}var s=r({HTML:"text/html",isHTML:function(i){return i===s.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return oa.assign=n,oa.find=t,oa.freeze=r,oa.MIME_TYPE=s,oa.NAMESPACE=a,oa}var ql;function jd(){if(ql)return Vr;ql=1;var t=On(),r=t.find,n=t.NAMESPACE;function s(S){return S!==""}function a(S){return S?S.split(/[\t\n\f\r ]+/).filter(s):[]}function i(S,P){return S.hasOwnProperty(P)||(S[P]=!0),S}function o(S){if(!S)return[];var P=a(S);return Object.keys(P.reduce(i,{}))}function c(S){return function(P){return S&&S.indexOf(P)!==-1}}function d(S,P){for(var I in S)Object.prototype.hasOwnProperty.call(S,I)&&(P[I]=S[I])}function f(S,P){var I=S.prototype;if(!(I instanceof P)){let Z=function(){};Z.prototype=P.prototype,Z=new Z,d(I,Z),S.prototype=I=Z}I.constructor!=S&&(typeof S!="function"&&console.error("unknown Class:"+S),I.constructor=S)}var l={},h=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,p=l.TEXT_NODE=3,b=l.CDATA_SECTION_NODE=4,w=l.ENTITY_REFERENCE_NODE=5,x=l.ENTITY_NODE=6,g=l.PROCESSING_INSTRUCTION_NODE=7,v=l.COMMENT_NODE=8,N=l.DOCUMENT_NODE=9,j=l.DOCUMENT_TYPE_NODE=10,y=l.DOCUMENT_FRAGMENT_NODE=11,m=l.NOTATION_NODE=12,_={},E={};_.INDEX_SIZE_ERR=(E[1]="Index size error",1),_.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2);var A=_.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3);_.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4),_.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5),_.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6),_.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7);var C=_.NOT_FOUND_ERR=(E[8]="Not found",8);_.NOT_SUPPORTED_ERR=(E[9]="Not supported",9);var T=_.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10);_.INVALID_STATE_ERR=(E[11]="Invalid state",11),_.SYNTAX_ERR=(E[12]="Syntax error",12),_.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13),_.NAMESPACE_ERR=(E[14]="Invalid namespace",14),_.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function D(S,P){if(P instanceof Error)var I=P;else I=this,Error.call(this,E[S]),this.message=E[S],Error.captureStackTrace&&Error.captureStackTrace(this,D);return I.code=S,P&&(this.message=this.message+": "+P),I}D.prototype=Error.prototype,d(_,D);function L(){}L.prototype={length:0,item:function(S){return S>=0&&S<this.length?this[S]:null},toString:function(S,P){for(var I=[],Z=0;Z<this.length;Z++)_t(this[Z],I,S,P);return I.join("")},filter:function(S){return Array.prototype.filter.call(this,S)},indexOf:function(S){return Array.prototype.indexOf.call(this,S)}};function z(S,P){this._node=S,this._refresh=P,U(this)}function U(S){var P=S._node._inc||S._node.ownerDocument._inc;if(S._inc!==P){var I=S._refresh(S._node);if(Vt(S,"length",I.length),!S.$$length||I.length<S.$$length)for(var Z=I.length;Z in S;Z++)Object.prototype.hasOwnProperty.call(S,Z)&&delete S[Z];d(I,S),S._inc=P}}z.prototype.item=function(S){return U(this),this[S]||null},f(z,L);function H(){}function F(S,P){for(var I=S.length;I--;)if(S[I]===P)return I}function Y(S,P,I,Z){if(Z?P[F(P,Z)]=I:P[P.length++]=I,S){I.ownerElement=S;var be=S.ownerDocument;be&&(Z&&pe(be,S,Z),B(be,S,I))}}function G(S,P,I){var Z=F(P,I);if(Z>=0){for(var be=P.length-1;Z<be;)P[Z]=P[++Z];if(P.length=be,S){var Oe=S.ownerDocument;Oe&&(pe(Oe,S,I),I.ownerElement=null)}}else throw new D(C,new Error(S.tagName+"@"+I))}H.prototype={length:0,item:L.prototype.item,getNamedItem:function(S){for(var P=this.length;P--;){var I=this[P];if(I.nodeName==S)return I}},setNamedItem:function(S){var P=S.ownerElement;if(P&&P!=this._ownerElement)throw new D(T);var I=this.getNamedItem(S.nodeName);return Y(this._ownerElement,this,S,I),I},setNamedItemNS:function(S){var P=S.ownerElement,I;if(P&&P!=this._ownerElement)throw new D(T);return I=this.getNamedItemNS(S.namespaceURI,S.localName),Y(this._ownerElement,this,S,I),I},removeNamedItem:function(S){var P=this.getNamedItem(S);return G(this._ownerElement,this,P),P},removeNamedItemNS:function(S,P){var I=this.getNamedItemNS(S,P);return G(this._ownerElement,this,I),I},getNamedItemNS:function(S,P){for(var I=this.length;I--;){var Z=this[I];if(Z.localName==P&&Z.namespaceURI==S)return Z}return null}};function ne(){}ne.prototype={hasFeature:function(S,P){return!0},createDocument:function(S,P,I){var Z=new q;if(Z.implementation=this,Z.childNodes=new L,Z.doctype=I||null,I&&Z.appendChild(I),P){var be=Z.createElementNS(S,P);Z.appendChild(be)}return Z},createDocumentType:function(S,P,I){var Z=new Ge;return Z.name=S,Z.nodeName=S,Z.publicId=P||"",Z.systemId=I||"",Z}};function ie(){}ie.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(S,P){return Re(this,S,P)},replaceChild:function(S,P){Re(this,S,P,ue),P&&this.removeChild(P)},removeChild:function(S){return te(this,S)},appendChild:function(S){return this.insertBefore(S,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(S){return kt(this.ownerDocument||this,this,S)},normalize:function(){for(var S=this.firstChild;S;){var P=S.nextSibling;P&&P.nodeType==p&&S.nodeType==p?(this.removeChild(P),S.appendData(P.data)):(S.normalize(),S=P)}},isSupported:function(S,P){return this.ownerDocument.implementation.hasFeature(S,P)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(S){for(var P=this;P;){var I=P._nsMap;if(I){for(var Z in I)if(Object.prototype.hasOwnProperty.call(I,Z)&&I[Z]===S)return Z}P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},lookupNamespaceURI:function(S){for(var P=this;P;){var I=P._nsMap;if(I&&Object.prototype.hasOwnProperty.call(I,S))return I[S];P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},isDefaultNamespace:function(S){var P=this.lookupPrefix(S);return P==null}};function xe(S){return S=="<"&&"&lt;"||S==">"&&"&gt;"||S=="&"&&"&amp;"||S=='"'&&"&quot;"||"&#"+S.charCodeAt()+";"}d(l,ie),d(l,ie.prototype);function V(S,P){if(P(S))return!0;if(S=S.firstChild)do if(V(S,P))return!0;while(S=S.nextSibling)}function q(){this.ownerDocument=this}function B(S,P,I){S&&S._inc++;var Z=I.namespaceURI;Z===n.XMLNS&&(P._nsMap[I.prefix?I.localName:""]=I.value)}function pe(S,P,I,Z){S&&S._inc++;var be=I.namespaceURI;be===n.XMLNS&&delete P._nsMap[I.prefix?I.localName:""]}function ee(S,P,I){if(S&&S._inc){S._inc++;var Z=P.childNodes;if(I)Z[Z.length++]=I;else{for(var be=P.firstChild,Oe=0;be;)Z[Oe++]=be,be=be.nextSibling;Z.length=Oe,delete Z[Z.length]}}}function te(S,P){var I=P.previousSibling,Z=P.nextSibling;return I?I.nextSibling=Z:S.firstChild=Z,Z?Z.previousSibling=I:S.lastChild=I,P.parentNode=null,P.previousSibling=null,P.nextSibling=null,ee(S.ownerDocument,S),P}function _e(S){return S&&(S.nodeType===ie.DOCUMENT_NODE||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.ELEMENT_NODE)}function Ie(S){return S&&(le(S)||oe(S)||K(S)||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.COMMENT_NODE||S.nodeType===ie.PROCESSING_INSTRUCTION_NODE)}function K(S){return S&&S.nodeType===ie.DOCUMENT_TYPE_NODE}function le(S){return S&&S.nodeType===ie.ELEMENT_NODE}function oe(S){return S&&S.nodeType===ie.TEXT_NODE}function Ne(S,P){var I=S.childNodes||[];if(r(I,le)||K(P))return!1;var Z=r(I,K);return!(P&&Z&&I.indexOf(Z)>I.indexOf(P))}function Ce(S,P){var I=S.childNodes||[];function Z(Oe){return le(Oe)&&Oe!==P}if(r(I,Z))return!1;var be=r(I,K);return!(P&&be&&I.indexOf(be)>I.indexOf(P))}function Me(S,P,I){if(!_e(S))throw new D(A,"Unexpected parent node type "+S.nodeType);if(I&&I.parentNode!==S)throw new D(C,"child not in parent");if(!Ie(P)||K(P)&&S.nodeType!==ie.DOCUMENT_NODE)throw new D(A,"Unexpected node type "+P.nodeType+" for parent node type "+S.nodeType)}function Fe(S,P,I){var Z=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ne(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ne(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(Z,K))throw new D(A,"Only one doctype is allowed");var Ze=r(Z,le);if(I&&Z.indexOf(Ze)<Z.indexOf(I))throw new D(A,"Doctype can only be inserted before an element");if(!I&&Ze)throw new D(A,"Doctype can not be appended since element is present")}}function ue(S,P,I){var Z=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ce(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ce(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(Z,function(He){return K(He)&&He!==I}))throw new D(A,"Only one doctype is allowed");var Ze=r(Z,le);if(I&&Z.indexOf(Ze)<Z.indexOf(I))throw new D(A,"Doctype can only be inserted before an element")}}function Re(S,P,I,Z){Me(S,P,I),S.nodeType===ie.DOCUMENT_NODE&&(Z||Fe)(S,P,I);var be=P.parentNode;if(be&&be.removeChild(P),P.nodeType===y){var Oe=P.firstChild;if(Oe==null)return P;var Ze=P.lastChild}else Oe=Ze=P;var Ue=I?I.previousSibling:S.lastChild;Oe.previousSibling=Ue,Ze.nextSibling=I,Ue?Ue.nextSibling=Oe:S.firstChild=Oe,I==null?S.lastChild=Ze:I.previousSibling=Ze;do Oe.parentNode=S;while(Oe!==Ze&&(Oe=Oe.nextSibling));return ee(S.ownerDocument||S,S),P.nodeType==y&&(P.firstChild=P.lastChild=null),P}function ae(S,P){return P.parentNode&&P.parentNode.removeChild(P),P.parentNode=S,P.previousSibling=S.lastChild,P.nextSibling=null,P.previousSibling?P.previousSibling.nextSibling=P:S.firstChild=P,S.lastChild=P,ee(S.ownerDocument,S,P),P}q.prototype={nodeName:"#document",nodeType:N,doctype:null,documentElement:null,_inc:1,insertBefore:function(S,P){if(S.nodeType==y){for(var I=S.firstChild;I;){var Z=I.nextSibling;this.insertBefore(I,P),I=Z}return S}return Re(this,S,P),S.ownerDocument=this,this.documentElement===null&&S.nodeType===h&&(this.documentElement=S),S},removeChild:function(S){return this.documentElement==S&&(this.documentElement=null),te(this,S)},replaceChild:function(S,P){Re(this,S,P,ue),S.ownerDocument=this,P&&this.removeChild(P),le(S)&&(this.documentElement=S)},importNode:function(S,P){return Ut(this,S,P)},getElementById:function(S){var P=null;return V(this.documentElement,function(I){if(I.nodeType==h&&I.getAttribute("id")==S)return P=I,!0}),P},getElementsByClassName:function(S){var P=o(S);return new z(this,function(I){var Z=[];return P.length>0&&V(I.documentElement,function(be){if(be!==I&&be.nodeType===h){var Oe=be.getAttribute("class");if(Oe){var Ze=S===Oe;if(!Ze){var Ue=o(Oe);Ze=P.every(c(Ue))}Ze&&Z.push(be)}}}),Z})},createElement:function(S){var P=new de;P.ownerDocument=this,P.nodeName=S,P.tagName=S,P.localName=S,P.childNodes=new L;var I=P.attributes=new H;return I._ownerElement=P,P},createDocumentFragment:function(){var S=new St;return S.ownerDocument=this,S.childNodes=new L,S},createTextNode:function(S){var P=new ke;return P.ownerDocument=this,P.appendData(S),P},createComment:function(S){var P=new Se;return P.ownerDocument=this,P.appendData(S),P},createCDATASection:function(S){var P=new Be;return P.ownerDocument=this,P.appendData(S),P},createProcessingInstruction:function(S,P){var I=new Ct;return I.ownerDocument=this,I.tagName=I.nodeName=I.target=S,I.nodeValue=I.data=P,I},createAttribute:function(S){var P=new ve;return P.ownerDocument=this,P.name=S,P.nodeName=S,P.localName=S,P.specified=!0,P},createEntityReference:function(S){var P=new gt;return P.ownerDocument=this,P.nodeName=S,P},createElementNS:function(S,P){var I=new de,Z=P.split(":"),be=I.attributes=new H;return I.childNodes=new L,I.ownerDocument=this,I.nodeName=P,I.tagName=P,I.namespaceURI=S,Z.length==2?(I.prefix=Z[0],I.localName=Z[1]):I.localName=P,be._ownerElement=I,I},createAttributeNS:function(S,P){var I=new ve,Z=P.split(":");return I.ownerDocument=this,I.nodeName=P,I.name=P,I.namespaceURI=S,I.specified=!0,Z.length==2?(I.prefix=Z[0],I.localName=Z[1]):I.localName=P,I}},f(q,ie);function de(){this._nsMap={}}de.prototype={nodeType:h,hasAttribute:function(S){return this.getAttributeNode(S)!=null},getAttribute:function(S){var P=this.getAttributeNode(S);return P&&P.value||""},getAttributeNode:function(S){return this.attributes.getNamedItem(S)},setAttribute:function(S,P){var I=this.ownerDocument.createAttribute(S);I.value=I.nodeValue=""+P,this.setAttributeNode(I)},removeAttribute:function(S){var P=this.getAttributeNode(S);P&&this.removeAttributeNode(P)},appendChild:function(S){return S.nodeType===y?this.insertBefore(S,null):ae(this,S)},setAttributeNode:function(S){return this.attributes.setNamedItem(S)},setAttributeNodeNS:function(S){return this.attributes.setNamedItemNS(S)},removeAttributeNode:function(S){return this.attributes.removeNamedItem(S.nodeName)},removeAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);I&&this.removeAttributeNode(I)},hasAttributeNS:function(S,P){return this.getAttributeNodeNS(S,P)!=null},getAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);return I&&I.value||""},setAttributeNS:function(S,P,I){var Z=this.ownerDocument.createAttributeNS(S,P);Z.value=Z.nodeValue=""+I,this.setAttributeNode(Z)},getAttributeNodeNS:function(S,P){return this.attributes.getNamedItemNS(S,P)},getElementsByTagName:function(S){return new z(this,function(P){var I=[];return V(P,function(Z){Z!==P&&Z.nodeType==h&&(S==="*"||Z.tagName==S)&&I.push(Z)}),I})},getElementsByTagNameNS:function(S,P){return new z(this,function(I){var Z=[];return V(I,function(be){be!==I&&be.nodeType===h&&(S==="*"||be.namespaceURI===S)&&(P==="*"||be.localName==P)&&Z.push(be)}),Z})}},q.prototype.getElementsByTagName=de.prototype.getElementsByTagName,q.prototype.getElementsByTagNameNS=de.prototype.getElementsByTagNameNS,f(de,ie);function ve(){}ve.prototype.nodeType=u,f(ve,ie);function fe(){}fe.prototype={data:"",substringData:function(S,P){return this.data.substring(S,S+P)},appendData:function(S){S=this.data+S,this.nodeValue=this.data=S,this.length=S.length},insertData:function(S,P){this.replaceData(S,0,P)},appendChild:function(S){throw new Error(E[A])},deleteData:function(S,P){this.replaceData(S,P,"")},replaceData:function(S,P,I){var Z=this.data.substring(0,S),be=this.data.substring(S+P);I=Z+I+be,this.nodeValue=this.data=I,this.length=I.length}},f(fe,ie);function ke(){}ke.prototype={nodeName:"#text",nodeType:p,splitText:function(S){var P=this.data,I=P.substring(S);P=P.substring(0,S),this.data=this.nodeValue=P,this.length=P.length;var Z=this.ownerDocument.createTextNode(I);return this.parentNode&&this.parentNode.insertBefore(Z,this.nextSibling),Z}},f(ke,fe);function Se(){}Se.prototype={nodeName:"#comment",nodeType:v},f(Se,fe);function Be(){}Be.prototype={nodeName:"#cdata-section",nodeType:b},f(Be,fe);function Ge(){}Ge.prototype.nodeType=j,f(Ge,ie);function pt(){}pt.prototype.nodeType=m,f(pt,ie);function jt(){}jt.prototype.nodeType=x,f(jt,ie);function gt(){}gt.prototype.nodeType=w,f(gt,ie);function St(){}St.prototype.nodeName="#document-fragment",St.prototype.nodeType=y,f(St,ie);function Ct(){}Ct.prototype.nodeType=g,f(Ct,ie);function Tt(){}Tt.prototype.serializeToString=function(S,P,I){return Bt.call(S,P,I)},ie.prototype.toString=Bt;function Bt(S,P){var I=[],Z=this.nodeType==9&&this.documentElement||this,be=Z.prefix,Oe=Z.namespaceURI;if(Oe&&be==null){var be=Z.lookupPrefix(Oe);if(be==null)var Ze=[{namespace:Oe,prefix:null}]}return _t(this,I,S,P,Ze),I.join("")}function Ke(S,P,I){var Z=S.prefix||"",be=S.namespaceURI;if(!be||Z==="xml"&&be===n.XML||be===n.XMLNS)return!1;for(var Oe=I.length;Oe--;){var Ze=I[Oe];if(Ze.prefix===Z)return Ze.namespace!==be}return!0}function at(S,P,I){S.push(" ",P,'="',I.replace(/[<>&"\t\n\r]/g,xe),'"')}function _t(S,P,I,Z,be){if(be||(be=[]),Z)if(S=Z(S),S){if(typeof S=="string"){P.push(S);return}}else return;switch(S.nodeType){case h:var Oe=S.attributes,Ze=Oe.length,Te=S.firstChild,Ue=S.tagName;I=n.isHTML(S.namespaceURI)||I;var He=Ue;if(!I&&!S.prefix&&S.namespaceURI){for(var bt,Dt=0;Dt<Oe.length;Dt++)if(Oe.item(Dt).name==="xmlns"){bt=Oe.item(Dt).value;break}if(!bt)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.prefix===""&&$t.namespace===S.namespaceURI){bt=$t.namespace;break}}if(bt!==S.namespaceURI)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.namespace===S.namespaceURI){$t.prefix&&(He=$t.prefix+":"+Ue);break}}}P.push("<",He);for(var Yt=0;Yt<Ze;Yt++){var Et=Oe.item(Yt);Et.prefix=="xmlns"?be.push({prefix:Et.localName,namespace:Et.value}):Et.nodeName=="xmlns"&&be.push({prefix:"",namespace:Et.value})}for(var Yt=0;Yt<Ze;Yt++){var Et=Oe.item(Yt);if(Ke(Et,I,be)){var ft=Et.prefix||"",ge=Et.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}_t(Et,P,I,Z,be)}if(Ue===He&&Ke(S,I,be)){var ft=S.prefix||"",ge=S.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}if(Te||I&&!/^(?:meta|link|img|br|hr|input)$/i.test(Ue)){if(P.push(">"),I&&/^script$/i.test(Ue))for(;Te;)Te.data?P.push(Te.data):_t(Te,P,I,Z,be.slice()),Te=Te.nextSibling;else for(;Te;)_t(Te,P,I,Z,be.slice()),Te=Te.nextSibling;P.push("</",He,">")}else P.push("/>");return;case N:case y:for(var Te=S.firstChild;Te;)_t(Te,P,I,Z,be.slice()),Te=Te.nextSibling;return;case u:return at(P,S.name,S.value);case p:return P.push(S.data.replace(/[<&>]/g,xe));case b:return P.push("<![CDATA[",S.data,"]]>");case v:return P.push("<!--",S.data,"-->");case j:var Pe=S.publicId,ze=S.systemId;if(P.push("<!DOCTYPE ",S.name),Pe)P.push(" PUBLIC ",Pe),ze&&ze!="."&&P.push(" ",ze),P.push(">");else if(ze&&ze!=".")P.push(" SYSTEM ",ze,">");else{var Ve=S.internalSubset;Ve&&P.push(" [",Ve,"]"),P.push(">")}return;case g:return P.push("<?",S.target," ",S.data,"?>");case w:return P.push("&",S.nodeName,";");default:P.push("??",S.nodeName)}}function Ut(S,P,I){var Z;switch(P.nodeType){case h:Z=P.cloneNode(!1),Z.ownerDocument=S;case y:break;case u:I=!0;break}if(Z||(Z=P.cloneNode(!1)),Z.ownerDocument=S,Z.parentNode=null,I)for(var be=P.firstChild;be;)Z.appendChild(Ut(S,be,I)),be=be.nextSibling;return Z}function kt(S,P,I){var Z=new P.constructor;for(var be in P)if(Object.prototype.hasOwnProperty.call(P,be)){var Oe=P[be];typeof Oe!="object"&&Oe!=Z[be]&&(Z[be]=Oe)}switch(P.childNodes&&(Z.childNodes=new L),Z.ownerDocument=S,Z.nodeType){case h:var Ze=P.attributes,Ue=Z.attributes=new H,He=Ze.length;Ue._ownerElement=Z;for(var bt=0;bt<He;bt++)Z.setAttributeNode(kt(S,Ze.item(bt),!0));break;case u:I=!0}if(I)for(var Dt=P.firstChild;Dt;)Z.appendChild(kt(S,Dt,I)),Dt=Dt.nextSibling;return Z}function Vt(S,P,I){S[P]=I}try{if(Object.defineProperty){let S=function(P){switch(P.nodeType){case h:case y:var I=[];for(P=P.firstChild;P;)P.nodeType!==7&&P.nodeType!==8&&I.push(S(P)),P=P.nextSibling;return I.join("");default:return P.nodeValue}};Object.defineProperty(z.prototype,"length",{get:function(){return U(this),this.$$length}}),Object.defineProperty(ie.prototype,"textContent",{get:function(){return S(this)},set:function(P){switch(this.nodeType){case h:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(P||String(P))&&this.appendChild(this.ownerDocument.createTextNode(P));break;default:this.data=P,this.value=P,this.nodeValue=P}}}),Vt=function(P,I,Z){P["$$"+I]=Z}}}catch{}return Vr.DocumentType=Ge,Vr.DOMException=D,Vr.DOMImplementation=ne,Vr.Element=de,Vr.Node=ie,Vr.NodeList=L,Vr.XMLSerializer=Tt,Vr}var rs={},ii={},Hl;function om(){return Hl||(Hl=1,(function(t){var r=On().freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
103
+ Caused by: `+(f.stack||f));function u(p){return r(p,{pretty:!0})}return l&&l.cleanStack&&(h=u(h)),h}a.appendToStack=o;function c(d,f){for(var l in f)if(f.hasOwnProperty(l)){var h=d.hasOwnProperty(l)&&typeof d[l]=="object";d[l]=h?n(d[l],f[l]):f[l]}}})(t.ChainedErrorFactory||(t.ChainedErrorFactory={}))})(ri)),ri}var Bl;function Pn(){if(Bl)return Zr;Bl=1;var t=Zr&&Zr.__extends||(function(){var c=function(d,f){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var u in h)h.hasOwnProperty(u)&&(l[u]=h[u])},c(d,f)};return function(d,f){c(d,f);function l(){this.constructor=d}d.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}})();Object.defineProperty(Zr,"__esModule",{value:!0});var r=rm,n=Fl(),s=lo(),a=(function(c){t(d,c);function d(f,l,h){h===void 0&&(h=s.Options.DEFAULT);var u=c.call(this,f)||this;return u.cause=l,u.stack=n.ChainedErrorFactory.appendToStack(u.stack,l,h),u}return d})(r.CustomError);Zr.default=a;var i=Fl();Zr.ChainedErrorFactory=i.ChainedErrorFactory;var o=lo();return Zr.Options=o.Options,Zr}var Ul;function im(){if(Ul)return Ur;Ul=1;var t=Ur&&Ur.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.SecurityError=Ur.SecurityChecker=void 0;const r=t(Pn());let n=class{static checkSecurity(i,o){if(!o.allowScriptTag&&this.containsScriptTag(i))throw new s("Renderer rejected the input because of insecure content: text contains script tag")}static containsScriptTag(i){return/<\s*script/gi.test(i)}};Ur.SecurityChecker=n;class s extends r.default{constructor(i,o){super(i,o)}}return Ur.SecurityError=s,Ur}var hr={},ts={},Vr={},oa={},Vl;function On(){if(Vl)return oa;Vl=1;function t(i,o,c){if(c===void 0&&(c=Array.prototype),i&&typeof c.find=="function")return c.find.call(i,o);for(var d=0;d<i.length;d++)if(Object.prototype.hasOwnProperty.call(i,d)){var f=i[d];if(o.call(void 0,f,d,i))return f}}function r(i,o){return o===void 0&&(o=Object),o&&typeof o.freeze=="function"?o.freeze(i):i}function n(i,o){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(i[c]=o[c]);return i}var s=r({HTML:"text/html",isHTML:function(i){return i===s.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return oa.assign=n,oa.find=t,oa.freeze=r,oa.MIME_TYPE=s,oa.NAMESPACE=a,oa}var ql;function jd(){if(ql)return Vr;ql=1;var t=On(),r=t.find,n=t.NAMESPACE;function s(S){return S!==""}function a(S){return S?S.split(/[\t\n\f\r ]+/).filter(s):[]}function i(S,P){return S.hasOwnProperty(P)||(S[P]=!0),S}function o(S){if(!S)return[];var P=a(S);return Object.keys(P.reduce(i,{}))}function c(S){return function(P){return S&&S.indexOf(P)!==-1}}function d(S,P){for(var I in S)Object.prototype.hasOwnProperty.call(S,I)&&(P[I]=S[I])}function f(S,P){var I=S.prototype;if(!(I instanceof P)){let Z=function(){};Z.prototype=P.prototype,Z=new Z,d(I,Z),S.prototype=I=Z}I.constructor!=S&&(typeof S!="function"&&console.error("unknown Class:"+S),I.constructor=S)}var l={},h=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,p=l.TEXT_NODE=3,b=l.CDATA_SECTION_NODE=4,w=l.ENTITY_REFERENCE_NODE=5,x=l.ENTITY_NODE=6,g=l.PROCESSING_INSTRUCTION_NODE=7,v=l.COMMENT_NODE=8,N=l.DOCUMENT_NODE=9,j=l.DOCUMENT_TYPE_NODE=10,y=l.DOCUMENT_FRAGMENT_NODE=11,m=l.NOTATION_NODE=12,_={},E={};_.INDEX_SIZE_ERR=(E[1]="Index size error",1),_.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2);var A=_.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3);_.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4),_.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5),_.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6),_.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7);var C=_.NOT_FOUND_ERR=(E[8]="Not found",8);_.NOT_SUPPORTED_ERR=(E[9]="Not supported",9);var T=_.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10);_.INVALID_STATE_ERR=(E[11]="Invalid state",11),_.SYNTAX_ERR=(E[12]="Syntax error",12),_.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13),_.NAMESPACE_ERR=(E[14]="Invalid namespace",14),_.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function D(S,P){if(P instanceof Error)var I=P;else I=this,Error.call(this,E[S]),this.message=E[S],Error.captureStackTrace&&Error.captureStackTrace(this,D);return I.code=S,P&&(this.message=this.message+": "+P),I}D.prototype=Error.prototype,d(_,D);function L(){}L.prototype={length:0,item:function(S){return S>=0&&S<this.length?this[S]:null},toString:function(S,P){for(var I=[],Z=0;Z<this.length;Z++)_t(this[Z],I,S,P);return I.join("")},filter:function(S){return Array.prototype.filter.call(this,S)},indexOf:function(S){return Array.prototype.indexOf.call(this,S)}};function z(S,P){this._node=S,this._refresh=P,U(this)}function U(S){var P=S._node._inc||S._node.ownerDocument._inc;if(S._inc!==P){var I=S._refresh(S._node);if(Vt(S,"length",I.length),!S.$$length||I.length<S.$$length)for(var Z=I.length;Z in S;Z++)Object.prototype.hasOwnProperty.call(S,Z)&&delete S[Z];d(I,S),S._inc=P}}z.prototype.item=function(S){return U(this),this[S]||null},f(z,L);function H(){}function F(S,P){for(var I=S.length;I--;)if(S[I]===P)return I}function Y(S,P,I,Z){if(Z?P[F(P,Z)]=I:P[P.length++]=I,S){I.ownerElement=S;var be=S.ownerDocument;be&&(Z&&pe(be,S,Z),B(be,S,I))}}function G(S,P,I){var Z=F(P,I);if(Z>=0){for(var be=P.length-1;Z<be;)P[Z]=P[++Z];if(P.length=be,S){var Oe=S.ownerDocument;Oe&&(pe(Oe,S,I),I.ownerElement=null)}}else throw new D(C,new Error(S.tagName+"@"+I))}H.prototype={length:0,item:L.prototype.item,getNamedItem:function(S){for(var P=this.length;P--;){var I=this[P];if(I.nodeName==S)return I}},setNamedItem:function(S){var P=S.ownerElement;if(P&&P!=this._ownerElement)throw new D(T);var I=this.getNamedItem(S.nodeName);return Y(this._ownerElement,this,S,I),I},setNamedItemNS:function(S){var P=S.ownerElement,I;if(P&&P!=this._ownerElement)throw new D(T);return I=this.getNamedItemNS(S.namespaceURI,S.localName),Y(this._ownerElement,this,S,I),I},removeNamedItem:function(S){var P=this.getNamedItem(S);return G(this._ownerElement,this,P),P},removeNamedItemNS:function(S,P){var I=this.getNamedItemNS(S,P);return G(this._ownerElement,this,I),I},getNamedItemNS:function(S,P){for(var I=this.length;I--;){var Z=this[I];if(Z.localName==P&&Z.namespaceURI==S)return Z}return null}};function ne(){}ne.prototype={hasFeature:function(S,P){return!0},createDocument:function(S,P,I){var Z=new q;if(Z.implementation=this,Z.childNodes=new L,Z.doctype=I||null,I&&Z.appendChild(I),P){var be=Z.createElementNS(S,P);Z.appendChild(be)}return Z},createDocumentType:function(S,P,I){var Z=new Ge;return Z.name=S,Z.nodeName=S,Z.publicId=P||"",Z.systemId=I||"",Z}};function ie(){}ie.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(S,P){return Re(this,S,P)},replaceChild:function(S,P){Re(this,S,P,ue),P&&this.removeChild(P)},removeChild:function(S){return te(this,S)},appendChild:function(S){return this.insertBefore(S,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(S){return kt(this.ownerDocument||this,this,S)},normalize:function(){for(var S=this.firstChild;S;){var P=S.nextSibling;P&&P.nodeType==p&&S.nodeType==p?(this.removeChild(P),S.appendData(P.data)):(S.normalize(),S=P)}},isSupported:function(S,P){return this.ownerDocument.implementation.hasFeature(S,P)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(S){for(var P=this;P;){var I=P._nsMap;if(I){for(var Z in I)if(Object.prototype.hasOwnProperty.call(I,Z)&&I[Z]===S)return Z}P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},lookupNamespaceURI:function(S){for(var P=this;P;){var I=P._nsMap;if(I&&Object.prototype.hasOwnProperty.call(I,S))return I[S];P=P.nodeType==u?P.ownerDocument:P.parentNode}return null},isDefaultNamespace:function(S){var P=this.lookupPrefix(S);return P==null}};function xe(S){return S=="<"&&"&lt;"||S==">"&&"&gt;"||S=="&"&&"&amp;"||S=='"'&&"&quot;"||"&#"+S.charCodeAt()+";"}d(l,ie),d(l,ie.prototype);function V(S,P){if(P(S))return!0;if(S=S.firstChild)do if(V(S,P))return!0;while(S=S.nextSibling)}function q(){this.ownerDocument=this}function B(S,P,I){S&&S._inc++;var Z=I.namespaceURI;Z===n.XMLNS&&(P._nsMap[I.prefix?I.localName:""]=I.value)}function pe(S,P,I,Z){S&&S._inc++;var be=I.namespaceURI;be===n.XMLNS&&delete P._nsMap[I.prefix?I.localName:""]}function ee(S,P,I){if(S&&S._inc){S._inc++;var Z=P.childNodes;if(I)Z[Z.length++]=I;else{for(var be=P.firstChild,Oe=0;be;)Z[Oe++]=be,be=be.nextSibling;Z.length=Oe,delete Z[Z.length]}}}function te(S,P){var I=P.previousSibling,Z=P.nextSibling;return I?I.nextSibling=Z:S.firstChild=Z,Z?Z.previousSibling=I:S.lastChild=I,P.parentNode=null,P.previousSibling=null,P.nextSibling=null,ee(S.ownerDocument,S),P}function _e(S){return S&&(S.nodeType===ie.DOCUMENT_NODE||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.ELEMENT_NODE)}function Ie(S){return S&&(le(S)||oe(S)||K(S)||S.nodeType===ie.DOCUMENT_FRAGMENT_NODE||S.nodeType===ie.COMMENT_NODE||S.nodeType===ie.PROCESSING_INSTRUCTION_NODE)}function K(S){return S&&S.nodeType===ie.DOCUMENT_TYPE_NODE}function le(S){return S&&S.nodeType===ie.ELEMENT_NODE}function oe(S){return S&&S.nodeType===ie.TEXT_NODE}function Ne(S,P){var I=S.childNodes||[];if(r(I,le)||K(P))return!1;var Z=r(I,K);return!(P&&Z&&I.indexOf(Z)>I.indexOf(P))}function Ce(S,P){var I=S.childNodes||[];function Z(Oe){return le(Oe)&&Oe!==P}if(r(I,Z))return!1;var be=r(I,K);return!(P&&be&&I.indexOf(be)>I.indexOf(P))}function Me(S,P,I){if(!_e(S))throw new D(A,"Unexpected parent node type "+S.nodeType);if(I&&I.parentNode!==S)throw new D(C,"child not in parent");if(!Ie(P)||K(P)&&S.nodeType!==ie.DOCUMENT_NODE)throw new D(A,"Unexpected node type "+P.nodeType+" for parent node type "+S.nodeType)}function Fe(S,P,I){var Z=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ne(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ne(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(Z,K))throw new D(A,"Only one doctype is allowed");var Ze=r(Z,le);if(I&&Z.indexOf(Ze)<Z.indexOf(I))throw new D(A,"Doctype can only be inserted before an element");if(!I&&Ze)throw new D(A,"Doctype can not be appended since element is present")}}function ue(S,P,I){var Z=S.childNodes||[],be=P.childNodes||[];if(P.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var Oe=be.filter(le);if(Oe.length>1||r(be,oe))throw new D(A,"More than one element or text in fragment");if(Oe.length===1&&!Ce(S,I))throw new D(A,"Element in fragment can not be inserted before doctype")}if(le(P)&&!Ce(S,I))throw new D(A,"Only one element can be added and only after doctype");if(K(P)){if(r(Z,function(He){return K(He)&&He!==I}))throw new D(A,"Only one doctype is allowed");var Ze=r(Z,le);if(I&&Z.indexOf(Ze)<Z.indexOf(I))throw new D(A,"Doctype can only be inserted before an element")}}function Re(S,P,I,Z){Me(S,P,I),S.nodeType===ie.DOCUMENT_NODE&&(Z||Fe)(S,P,I);var be=P.parentNode;if(be&&be.removeChild(P),P.nodeType===y){var Oe=P.firstChild;if(Oe==null)return P;var Ze=P.lastChild}else Oe=Ze=P;var Ue=I?I.previousSibling:S.lastChild;Oe.previousSibling=Ue,Ze.nextSibling=I,Ue?Ue.nextSibling=Oe:S.firstChild=Oe,I==null?S.lastChild=Ze:I.previousSibling=Ze;do Oe.parentNode=S;while(Oe!==Ze&&(Oe=Oe.nextSibling));return ee(S.ownerDocument||S,S),P.nodeType==y&&(P.firstChild=P.lastChild=null),P}function ae(S,P){return P.parentNode&&P.parentNode.removeChild(P),P.parentNode=S,P.previousSibling=S.lastChild,P.nextSibling=null,P.previousSibling?P.previousSibling.nextSibling=P:S.firstChild=P,S.lastChild=P,ee(S.ownerDocument,S,P),P}q.prototype={nodeName:"#document",nodeType:N,doctype:null,documentElement:null,_inc:1,insertBefore:function(S,P){if(S.nodeType==y){for(var I=S.firstChild;I;){var Z=I.nextSibling;this.insertBefore(I,P),I=Z}return S}return Re(this,S,P),S.ownerDocument=this,this.documentElement===null&&S.nodeType===h&&(this.documentElement=S),S},removeChild:function(S){return this.documentElement==S&&(this.documentElement=null),te(this,S)},replaceChild:function(S,P){Re(this,S,P,ue),S.ownerDocument=this,P&&this.removeChild(P),le(S)&&(this.documentElement=S)},importNode:function(S,P){return Ut(this,S,P)},getElementById:function(S){var P=null;return V(this.documentElement,function(I){if(I.nodeType==h&&I.getAttribute("id")==S)return P=I,!0}),P},getElementsByClassName:function(S){var P=o(S);return new z(this,function(I){var Z=[];return P.length>0&&V(I.documentElement,function(be){if(be!==I&&be.nodeType===h){var Oe=be.getAttribute("class");if(Oe){var Ze=S===Oe;if(!Ze){var Ue=o(Oe);Ze=P.every(c(Ue))}Ze&&Z.push(be)}}}),Z})},createElement:function(S){var P=new de;P.ownerDocument=this,P.nodeName=S,P.tagName=S,P.localName=S,P.childNodes=new L;var I=P.attributes=new H;return I._ownerElement=P,P},createDocumentFragment:function(){var S=new St;return S.ownerDocument=this,S.childNodes=new L,S},createTextNode:function(S){var P=new ke;return P.ownerDocument=this,P.appendData(S),P},createComment:function(S){var P=new Se;return P.ownerDocument=this,P.appendData(S),P},createCDATASection:function(S){var P=new Be;return P.ownerDocument=this,P.appendData(S),P},createProcessingInstruction:function(S,P){var I=new Ct;return I.ownerDocument=this,I.tagName=I.nodeName=I.target=S,I.nodeValue=I.data=P,I},createAttribute:function(S){var P=new ve;return P.ownerDocument=this,P.name=S,P.nodeName=S,P.localName=S,P.specified=!0,P},createEntityReference:function(S){var P=new gt;return P.ownerDocument=this,P.nodeName=S,P},createElementNS:function(S,P){var I=new de,Z=P.split(":"),be=I.attributes=new H;return I.childNodes=new L,I.ownerDocument=this,I.nodeName=P,I.tagName=P,I.namespaceURI=S,Z.length==2?(I.prefix=Z[0],I.localName=Z[1]):I.localName=P,be._ownerElement=I,I},createAttributeNS:function(S,P){var I=new ve,Z=P.split(":");return I.ownerDocument=this,I.nodeName=P,I.name=P,I.namespaceURI=S,I.specified=!0,Z.length==2?(I.prefix=Z[0],I.localName=Z[1]):I.localName=P,I}},f(q,ie);function de(){this._nsMap={}}de.prototype={nodeType:h,hasAttribute:function(S){return this.getAttributeNode(S)!=null},getAttribute:function(S){var P=this.getAttributeNode(S);return P&&P.value||""},getAttributeNode:function(S){return this.attributes.getNamedItem(S)},setAttribute:function(S,P){var I=this.ownerDocument.createAttribute(S);I.value=I.nodeValue=""+P,this.setAttributeNode(I)},removeAttribute:function(S){var P=this.getAttributeNode(S);P&&this.removeAttributeNode(P)},appendChild:function(S){return S.nodeType===y?this.insertBefore(S,null):ae(this,S)},setAttributeNode:function(S){return this.attributes.setNamedItem(S)},setAttributeNodeNS:function(S){return this.attributes.setNamedItemNS(S)},removeAttributeNode:function(S){return this.attributes.removeNamedItem(S.nodeName)},removeAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);I&&this.removeAttributeNode(I)},hasAttributeNS:function(S,P){return this.getAttributeNodeNS(S,P)!=null},getAttributeNS:function(S,P){var I=this.getAttributeNodeNS(S,P);return I&&I.value||""},setAttributeNS:function(S,P,I){var Z=this.ownerDocument.createAttributeNS(S,P);Z.value=Z.nodeValue=""+I,this.setAttributeNode(Z)},getAttributeNodeNS:function(S,P){return this.attributes.getNamedItemNS(S,P)},getElementsByTagName:function(S){return new z(this,function(P){var I=[];return V(P,function(Z){Z!==P&&Z.nodeType==h&&(S==="*"||Z.tagName==S)&&I.push(Z)}),I})},getElementsByTagNameNS:function(S,P){return new z(this,function(I){var Z=[];return V(I,function(be){be!==I&&be.nodeType===h&&(S==="*"||be.namespaceURI===S)&&(P==="*"||be.localName==P)&&Z.push(be)}),Z})}},q.prototype.getElementsByTagName=de.prototype.getElementsByTagName,q.prototype.getElementsByTagNameNS=de.prototype.getElementsByTagNameNS,f(de,ie);function ve(){}ve.prototype.nodeType=u,f(ve,ie);function fe(){}fe.prototype={data:"",substringData:function(S,P){return this.data.substring(S,S+P)},appendData:function(S){S=this.data+S,this.nodeValue=this.data=S,this.length=S.length},insertData:function(S,P){this.replaceData(S,0,P)},appendChild:function(S){throw new Error(E[A])},deleteData:function(S,P){this.replaceData(S,P,"")},replaceData:function(S,P,I){var Z=this.data.substring(0,S),be=this.data.substring(S+P);I=Z+I+be,this.nodeValue=this.data=I,this.length=I.length}},f(fe,ie);function ke(){}ke.prototype={nodeName:"#text",nodeType:p,splitText:function(S){var P=this.data,I=P.substring(S);P=P.substring(0,S),this.data=this.nodeValue=P,this.length=P.length;var Z=this.ownerDocument.createTextNode(I);return this.parentNode&&this.parentNode.insertBefore(Z,this.nextSibling),Z}},f(ke,fe);function Se(){}Se.prototype={nodeName:"#comment",nodeType:v},f(Se,fe);function Be(){}Be.prototype={nodeName:"#cdata-section",nodeType:b},f(Be,fe);function Ge(){}Ge.prototype.nodeType=j,f(Ge,ie);function pt(){}pt.prototype.nodeType=m,f(pt,ie);function jt(){}jt.prototype.nodeType=x,f(jt,ie);function gt(){}gt.prototype.nodeType=w,f(gt,ie);function St(){}St.prototype.nodeName="#document-fragment",St.prototype.nodeType=y,f(St,ie);function Ct(){}Ct.prototype.nodeType=g,f(Ct,ie);function Tt(){}Tt.prototype.serializeToString=function(S,P,I){return Bt.call(S,P,I)},ie.prototype.toString=Bt;function Bt(S,P){var I=[],Z=this.nodeType==9&&this.documentElement||this,be=Z.prefix,Oe=Z.namespaceURI;if(Oe&&be==null){var be=Z.lookupPrefix(Oe);if(be==null)var Ze=[{namespace:Oe,prefix:null}]}return _t(this,I,S,P,Ze),I.join("")}function Ke(S,P,I){var Z=S.prefix||"",be=S.namespaceURI;if(!be||Z==="xml"&&be===n.XML||be===n.XMLNS)return!1;for(var Oe=I.length;Oe--;){var Ze=I[Oe];if(Ze.prefix===Z)return Ze.namespace!==be}return!0}function at(S,P,I){S.push(" ",P,'="',I.replace(/[<>&"\t\n\r]/g,xe),'"')}function _t(S,P,I,Z,be){if(be||(be=[]),Z)if(S=Z(S),S){if(typeof S=="string"){P.push(S);return}}else return;switch(S.nodeType){case h:var Oe=S.attributes,Ze=Oe.length,Te=S.firstChild,Ue=S.tagName;I=n.isHTML(S.namespaceURI)||I;var He=Ue;if(!I&&!S.prefix&&S.namespaceURI){for(var bt,Dt=0;Dt<Oe.length;Dt++)if(Oe.item(Dt).name==="xmlns"){bt=Oe.item(Dt).value;break}if(!bt)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.prefix===""&&$t.namespace===S.namespaceURI){bt=$t.namespace;break}}if(bt!==S.namespaceURI)for(var Mt=be.length-1;Mt>=0;Mt--){var $t=be[Mt];if($t.namespace===S.namespaceURI){$t.prefix&&(He=$t.prefix+":"+Ue);break}}}P.push("<",He);for(var Zt=0;Zt<Ze;Zt++){var Et=Oe.item(Zt);Et.prefix=="xmlns"?be.push({prefix:Et.localName,namespace:Et.value}):Et.nodeName=="xmlns"&&be.push({prefix:"",namespace:Et.value})}for(var Zt=0;Zt<Ze;Zt++){var Et=Oe.item(Zt);if(Ke(Et,I,be)){var ft=Et.prefix||"",ge=Et.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}_t(Et,P,I,Z,be)}if(Ue===He&&Ke(S,I,be)){var ft=S.prefix||"",ge=S.namespaceURI;at(P,ft?"xmlns:"+ft:"xmlns",ge),be.push({prefix:ft,namespace:ge})}if(Te||I&&!/^(?:meta|link|img|br|hr|input)$/i.test(Ue)){if(P.push(">"),I&&/^script$/i.test(Ue))for(;Te;)Te.data?P.push(Te.data):_t(Te,P,I,Z,be.slice()),Te=Te.nextSibling;else for(;Te;)_t(Te,P,I,Z,be.slice()),Te=Te.nextSibling;P.push("</",He,">")}else P.push("/>");return;case N:case y:for(var Te=S.firstChild;Te;)_t(Te,P,I,Z,be.slice()),Te=Te.nextSibling;return;case u:return at(P,S.name,S.value);case p:return P.push(S.data.replace(/[<&>]/g,xe));case b:return P.push("<![CDATA[",S.data,"]]>");case v:return P.push("<!--",S.data,"-->");case j:var Pe=S.publicId,ze=S.systemId;if(P.push("<!DOCTYPE ",S.name),Pe)P.push(" PUBLIC ",Pe),ze&&ze!="."&&P.push(" ",ze),P.push(">");else if(ze&&ze!=".")P.push(" SYSTEM ",ze,">");else{var Ve=S.internalSubset;Ve&&P.push(" [",Ve,"]"),P.push(">")}return;case g:return P.push("<?",S.target," ",S.data,"?>");case w:return P.push("&",S.nodeName,";");default:P.push("??",S.nodeName)}}function Ut(S,P,I){var Z;switch(P.nodeType){case h:Z=P.cloneNode(!1),Z.ownerDocument=S;case y:break;case u:I=!0;break}if(Z||(Z=P.cloneNode(!1)),Z.ownerDocument=S,Z.parentNode=null,I)for(var be=P.firstChild;be;)Z.appendChild(Ut(S,be,I)),be=be.nextSibling;return Z}function kt(S,P,I){var Z=new P.constructor;for(var be in P)if(Object.prototype.hasOwnProperty.call(P,be)){var Oe=P[be];typeof Oe!="object"&&Oe!=Z[be]&&(Z[be]=Oe)}switch(P.childNodes&&(Z.childNodes=new L),Z.ownerDocument=S,Z.nodeType){case h:var Ze=P.attributes,Ue=Z.attributes=new H,He=Ze.length;Ue._ownerElement=Z;for(var bt=0;bt<He;bt++)Z.setAttributeNode(kt(S,Ze.item(bt),!0));break;case u:I=!0}if(I)for(var Dt=P.firstChild;Dt;)Z.appendChild(kt(S,Dt,I)),Dt=Dt.nextSibling;return Z}function Vt(S,P,I){S[P]=I}try{if(Object.defineProperty){let S=function(P){switch(P.nodeType){case h:case y:var I=[];for(P=P.firstChild;P;)P.nodeType!==7&&P.nodeType!==8&&I.push(S(P)),P=P.nextSibling;return I.join("");default:return P.nodeValue}};Object.defineProperty(z.prototype,"length",{get:function(){return U(this),this.$$length}}),Object.defineProperty(ie.prototype,"textContent",{get:function(){return S(this)},set:function(P){switch(this.nodeType){case h:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(P||String(P))&&this.appendChild(this.ownerDocument.createTextNode(P));break;default:this.data=P,this.value=P,this.nodeValue=P}}}),Vt=function(P,I,Z){P["$$"+I]=Z}}}catch{}return Vr.DocumentType=Ge,Vr.DOMException=D,Vr.DOMImplementation=ne,Vr.Element=de,Vr.Node=ie,Vr.NodeList=L,Vr.XMLSerializer=Tt,Vr}var rs={},ii={},Hl;function om(){return Hl||(Hl=1,(function(t){var r=On().freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
104
104
  `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(ii)),ii}var Fs={},zl;function lm(){if(zl)return Fs;zl=1;var t=On().NAMESPACE,r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,n=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),s=new RegExp("^"+r.source+n.source+"*(?::"+r.source+n.source+"*)?$"),a=0,i=1,o=2,c=3,d=4,f=5,l=6,h=7;function u(A,C){this.message=A,this.locator=C,Error.captureStackTrace&&Error.captureStackTrace(this,u)}u.prototype=new Error,u.prototype.name=u.name;function p(){}p.prototype={parse:function(A,C,T){var D=this.domBuilder;D.startDocument(),j(C,C={}),b(A,C,T,D,this.errorHandler),D.endDocument()}};function b(A,C,T,D,L){function z(de){if(de>65535){de-=65536;var ve=55296+(de>>10),fe=56320+(de&1023);return String.fromCharCode(ve,fe)}else return String.fromCharCode(de)}function U(de){var ve=de.slice(1,-1);return Object.hasOwnProperty.call(T,ve)?T[ve]:ve.charAt(0)==="#"?z(parseInt(ve.substr(1).replace("x","0x"))):(L.error("entity not found:"+de),de)}function H(de){if(de>q){var ve=A.substring(q,de).replace(/&#?\w+;/g,U);ie&&F(q),D.characters(ve,0,de-q),q=de}}function F(de,ve){for(;de>=G&&(ve=ne.exec(A));)Y=ve.index,G=Y+ve[0].length,ie.lineNumber++;ie.columnNumber=de-Y+1}for(var Y=0,G=0,ne=/.*(?:\r\n?|\n)|.*$/g,ie=D.locator,xe=[{currentNSMap:C}],V={},q=0;;){try{var B=A.indexOf("<",q);if(B<0){if(!A.substr(q).match(/^\s*$/)){var pe=D.doc,ee=pe.createTextNode(A.substr(q));pe.appendChild(ee),D.currentElement=ee}return}switch(B>q&&H(B),A.charAt(B+1)){case"/":var Me=A.indexOf(">",B+3),te=A.substring(B+2,Me).replace(/[ \t\n\r]+$/g,""),_e=xe.pop();Me<0?(te=A.substring(B+2).replace(/[\s<].*/,""),L.error("end tag name: "+te+" is not complete:"+_e.tagName),Me=B+1+te.length):te.match(/\s</)&&(te=te.replace(/[\s<].*/,""),L.error("end tag name: "+te+" maybe not complete"),Me=B+1+te.length);var Ie=_e.localNSMap,K=_e.tagName==te,le=K||_e.tagName&&_e.tagName.toLowerCase()==te.toLowerCase();if(le){if(D.endElement(_e.uri,_e.localName,te),Ie)for(var oe in Ie)Object.prototype.hasOwnProperty.call(Ie,oe)&&D.endPrefixMapping(oe);K||L.fatalError("end tag name: "+te+" is not match the current start tagName:"+_e.tagName)}else xe.push(_e);Me++;break;case"?":ie&&F(B),Me=m(A,B,D);break;case"!":ie&&F(B),Me=y(A,B,D,L);break;default:ie&&F(B);var Ne=new _,Ce=xe[xe.length-1].currentNSMap,Me=x(A,B,Ne,Ce,U,L),Fe=Ne.length;if(!Ne.closed&&N(A,Me,Ne.tagName,V)&&(Ne.closed=!0,T.nbsp||L.warning("unclosed xml attribute")),ie&&Fe){for(var ue=w(ie,{}),Re=0;Re<Fe;Re++){var ae=Ne[Re];F(ae.offset),ae.locator=w(ie,{})}D.locator=ue,g(Ne,D,Ce)&&xe.push(Ne),D.locator=ie}else g(Ne,D,Ce)&&xe.push(Ne);t.isHTML(Ne.uri)&&!Ne.closed?Me=v(A,Me,Ne.tagName,U,D):Me++}}catch(de){if(de instanceof u)throw de;L.error("element parse error: "+de),Me=-1}Me>q?q=Me:H(Math.max(B,q)+1)}}function w(A,C){return C.lineNumber=A.lineNumber,C.columnNumber=A.columnNumber,C}function x(A,C,T,D,L,z){function U(ie,xe,V){T.attributeNames.hasOwnProperty(ie)&&z.fatalError("Attribute "+ie+" redefined"),T.addValue(ie,xe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,L),V)}for(var H,F,Y=++C,G=a;;){var ne=A.charAt(Y);switch(ne){case"=":if(G===i)H=A.slice(C,Y),G=c;else if(G===o)G=c;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(G===c||G===i)if(G===i&&(z.warning('attribute value must after "="'),H=A.slice(C,Y)),C=Y+1,Y=A.indexOf(ne,C),Y>0)F=A.slice(C,Y),U(H,F,C-1),G=f;else throw new Error("attribute value no end '"+ne+"' match");else if(G==d)F=A.slice(C,Y),U(H,F,C),z.warning('attribute "'+H+'" missed start quot('+ne+")!!"),C=Y+1,G=f;else throw new Error('attribute value must after "="');break;case"/":switch(G){case a:T.setTagName(A.slice(C,Y));case f:case l:case h:G=h,T.closed=!0;case d:case i:break;case o:T.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return z.error("unexpected end of input"),G==a&&T.setTagName(A.slice(C,Y)),Y;case">":switch(G){case a:T.setTagName(A.slice(C,Y));case f:case l:case h:break;case d:case i:F=A.slice(C,Y),F.slice(-1)==="/"&&(T.closed=!0,F=F.slice(0,-1));case o:G===o&&(F=H),G==d?(z.warning('attribute "'+F+'" missed quot(")!'),U(H,F,C)):((!t.isHTML(D[""])||!F.match(/^(?:disabled|checked|selected)$/i))&&z.warning('attribute "'+F+'" missed value!! "'+F+'" instead!!'),U(F,F,C));break;case c:throw new Error("attribute value missed!!")}return Y;case"€":ne=" ";default:if(ne<=" ")switch(G){case a:T.setTagName(A.slice(C,Y)),G=l;break;case i:H=A.slice(C,Y),G=o;break;case d:var F=A.slice(C,Y);z.warning('attribute "'+F+'" missed quot(")!!'),U(H,F,C);case f:G=l;break}else switch(G){case o:T.tagName,(!t.isHTML(D[""])||!H.match(/^(?:disabled|checked|selected)$/i))&&z.warning('attribute "'+H+'" missed value!! "'+H+'" instead2!!'),U(H,H,C),C=Y,G=i;break;case f:z.warning('attribute space is required"'+H+'"!!');case l:G=i,C=Y;break;case c:G=d,C=Y;break;case h:throw new Error("elements closed character '/' and '>' must be connected to")}}Y++}}function g(A,C,T){for(var D=A.tagName,L=null,ne=A.length;ne--;){var z=A[ne],U=z.qName,H=z.value,ie=U.indexOf(":");if(ie>0)var F=z.prefix=U.slice(0,ie),Y=U.slice(ie+1),G=F==="xmlns"&&Y;else Y=U,F=null,G=U==="xmlns"&&"";z.localName=Y,G!==!1&&(L==null&&(L={},j(T,T={})),T[G]=L[G]=H,z.uri=t.XMLNS,C.startPrefixMapping(G,H))}for(var ne=A.length;ne--;){z=A[ne];var F=z.prefix;F&&(F==="xml"&&(z.uri=t.XML),F!=="xmlns"&&(z.uri=T[F||""]))}var ie=D.indexOf(":");ie>0?(F=A.prefix=D.slice(0,ie),Y=A.localName=D.slice(ie+1)):(F=null,Y=A.localName=D);var xe=A.uri=T[F||""];if(C.startElement(xe,Y,D,A),A.closed){if(C.endElement(xe,Y,D),L)for(F in L)Object.prototype.hasOwnProperty.call(L,F)&&C.endPrefixMapping(F)}else return A.currentNSMap=T,A.localNSMap=L,!0}function v(A,C,T,D,L){if(/^(?:script|textarea)$/i.test(T)){var z=A.indexOf("</"+T+">",C),U=A.substring(C+1,z);if(/[&<]/.test(U))return/^script$/i.test(T)?(L.characters(U,0,U.length),z):(U=U.replace(/&#?\w+;/g,D),L.characters(U,0,U.length),z)}return C+1}function N(A,C,T,D){var L=D[T];return L==null&&(L=A.lastIndexOf("</"+T+">"),L<C&&(L=A.lastIndexOf("</"+T)),D[T]=L),L<C}function j(A,C){for(var T in A)Object.prototype.hasOwnProperty.call(A,T)&&(C[T]=A[T])}function y(A,C,T,D){var L=A.charAt(C+2);switch(L){case"-":if(A.charAt(C+3)==="-"){var z=A.indexOf("-->",C+4);return z>C?(T.comment(A,C+4,z-C-4),z+3):(D.error("Unclosed comment"),-1)}else return-1;default:if(A.substr(C+3,6)=="CDATA["){var z=A.indexOf("]]>",C+9);return T.startCDATA(),T.characters(A,C+9,z-C-9),T.endCDATA(),z+3}var U=E(A,C),H=U.length;if(H>1&&/!doctype/i.test(U[0][0])){var F=U[1][0],Y=!1,G=!1;H>3&&(/^public$/i.test(U[2][0])?(Y=U[3][0],G=H>4&&U[4][0]):/^system$/i.test(U[2][0])&&(G=U[3][0]));var ne=U[H-1];return T.startDTD(F,Y,G),T.endDTD(),ne.index+ne[0].length}}return-1}function m(A,C,T){var D=A.indexOf("?>",C);if(D){var L=A.substring(C,D).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return L?(L[0].length,T.processingInstruction(L[1],L[2]),D+2):-1}return-1}function _(){this.attributeNames={}}_.prototype={setTagName:function(A){if(!s.test(A))throw new Error("invalid tagName:"+A);this.tagName=A},addValue:function(A,C,T){if(!s.test(A))throw new Error("invalid attribute:"+A);this.attributeNames[A]=this.length,this[this.length++]={qName:A,value:C,offset:T}},length:0,getLocalName:function(A){return this[A].localName},getLocator:function(A){return this[A].locator},getQName:function(A){return this[A].qName},getURI:function(A){return this[A].uri},getValue:function(A){return this[A].value}};function E(A,C){var T,D=[],L=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(L.lastIndex=C,L.exec(A);T=L.exec(A);)if(D.push(T),T[1])return D}return Fs.XMLReader=p,Fs.ParseError=u,Fs}var Wl;function um(){if(Wl)return rs;Wl=1;var t=On(),r=jd(),n=om(),s=lm(),a=r.DOMImplementation,i=t.NAMESPACE,o=s.ParseError,c=s.XMLReader;function d(x){return x.replace(/\r[\n\u0085]/g,`
105
105
  `).replace(/[\r\u0085\u2028]/g,`
106
106
  `)}function f(x){this.options=x||{locator:{}}}f.prototype.parseFromString=function(x,g){var v=this.options,N=new c,j=v.domBuilder||new h,y=v.errorHandler,m=v.locator,_=v.xmlns||{},E=/\/x?html?$/.test(g),A=E?n.HTML_ENTITIES:n.XML_ENTITIES;m&&j.setDocumentLocator(m),N.errorHandler=l(y,j,m),N.domBuilder=v.domBuilder||j,E&&(_[""]=i.HTML),_.xml=_.xml||i.XML;var C=v.normalizeLineEndings||d;return x&&typeof x=="string"?N.parse(C(x),_,A):N.errorHandler.error("invalid doc source"),j.doc};function l(x,g,v){if(!x){if(g instanceof h)return g;x=g}var N={},j=x instanceof Function;v=v||{};function y(m){var _=x[m];!_&&j&&(_=x.length==2?function(E){x(m,E)}:x),N[m]=_&&function(E){_("[xmldom "+m+"] "+E+p(v))}||function(){}}return y("warning"),y("error"),y("fatalError"),N}function h(){this.cdata=!1}function u(x,g){g.lineNumber=x.lineNumber,g.columnNumber=x.columnNumber}h.prototype={startDocument:function(){this.doc=new a().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(x,g,v,N){var j=this.doc,y=j.createElementNS(x,v||g),m=N.length;w(this,y),this.currentElement=y,this.locator&&u(this.locator,y);for(var _=0;_<m;_++){var x=N.getURI(_),E=N.getValue(_),v=N.getQName(_),A=j.createAttributeNS(x,v);this.locator&&u(N.getLocator(_),A),A.value=A.nodeValue=E,y.setAttributeNode(A)}},endElement:function(x,g,v){var N=this.currentElement;N.tagName,this.currentElement=N.parentNode},startPrefixMapping:function(x,g){},endPrefixMapping:function(x){},processingInstruction:function(x,g){var v=this.doc.createProcessingInstruction(x,g);this.locator&&u(this.locator,v),w(this,v)},ignorableWhitespace:function(x,g,v){},characters:function(x,g,v){if(x=b.apply(this,arguments),x){if(this.cdata)var N=this.doc.createCDATASection(x);else var N=this.doc.createTextNode(x);this.currentElement?this.currentElement.appendChild(N):/^\s*$/.test(x)&&this.doc.appendChild(N),this.locator&&u(this.locator,N)}},skippedEntity:function(x){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(x){(this.locator=x)&&(x.lineNumber=0)},comment:function(x,g,v){x=b.apply(this,arguments);var N=this.doc.createComment(x);this.locator&&u(this.locator,N),w(this,N)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(x,g,v){var N=this.doc.implementation;if(N&&N.createDocumentType){var j=N.createDocumentType(x,g,v);this.locator&&u(this.locator,j),w(this,j),this.doc.doctype=j}},warning:function(x){console.warn("[xmldom warning] "+x,p(this.locator))},error:function(x){console.error("[xmldom error] "+x,p(this.locator))},fatalError:function(x){throw new o(x,this.locator)}};function p(x){if(x)return`
107
- @`+(x.systemId||"")+"#[line:"+x.lineNumber+",col:"+x.columnNumber+"]"}function b(x,g,v){return typeof x=="string"?x.substr(g,v):x.length>=g+v||g?new java.lang.String(x,g,v)+"":x}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(x){h.prototype[x]=function(){return null}});function w(x,g){x.currentElement?x.currentElement.appendChild(g):x.doc.appendChild(g)}return rs.__DOMHandler=h,rs.normalizeLineEndings=d,rs.DOMParser=f,rs}var Gl;function cm(){if(Gl)return ts;Gl=1;var t=jd();return ts.DOMImplementation=t.DOMImplementation,ts.XMLSerializer=t.XMLSerializer,ts.DOMParser=um().DOMParser,ts}var as={},Er={},Bs={},oi={},Us={},Jl;function Ln(){if(Jl)return Us;Jl=1,Object.defineProperty(Us,"__esModule",{value:!0});const t=Pn();let r=class extends t.default{constructor(s,a){super(s,a)}};return Us.UniverseLogError=r,Us}var Yl;function Ns(){return Yl||(Yl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const r=Ln();(function(n){n.error="error",n.warn="warn",n.info="info",n.http="http",n.verbose="verbose",n.debug="debug",n.silly="silly"})(t.LogLevel||(t.LogLevel={})),(function(n){n.LEVELS_VALUES={[n.error]:0,[n.warn]:1,[n.info]:2,[n.http]:3,[n.verbose]:4,[n.debug]:5,[n.silly]:6},n.LEVELS_BY_NAME={[n.error]:n.error,[n.warn]:n.warn,[n.info]:n.info,[n.http]:n.http,[n.verbose]:n.verbose,[n.debug]:n.debug,[n.silly]:n.silly},n.DEFAULT_LEVEL=n.info;function s(d){if(typeof n.LEVELS_BY_NAME[d]>"u"){const f=Object.keys(n.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return n.LEVELS_BY_NAME[d]}n.valueOf=s;function a(d){if(typeof n.LEVELS_VALUES[d]>"u"){const f=Object.keys(n.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return n.LEVELS_VALUES[d]}n.levelToValue=a;function i(d){return a(d.level)<=a(d.threshold)}n.isLessOrEquallyVerbose=i;function o(d,f){return n.LEVELS_VALUES[d]>n.LEVELS_VALUES[f]?d:f}n.moreVerbose=o;function c(d,f){return n.LEVELS_VALUES[d]<n.LEVELS_VALUES[f]?d:f}n.lessVerbose=c})(t.LogLevel||(t.LogLevel={}))})(oi)),oi}var Vs={},ka={},li={exports:{}},Zl;function _d(){return Zl||(Zl=1,(function(t){t.exports=(function(n){var s={};function a(i){if(s[i])return s[i].exports;var o=s[i]={i,l:!1,exports:{}};return n[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=n,a.c=s,a.d=function(i,o,c){a.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:c})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,o){if(1&o&&(i=a(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var d in i)a.d(c,d,(function(f){return i[f]}).bind(null,d));return c},a.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(o,"a",o),o},a.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},a.p="",a(a.s=4)})([function(n,s,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=a(8),d=a(2),f=a(16);s.validatorSymbol=Symbol("validators"),s.Predicate=class{constructor(l,h={}){this.type=l,this.options=h,this.context={validators:[]},this.context=Object.assign({},this.context,this.options);const u=this.type[0].toLowerCase()+this.type.slice(1);this.addValidator({message:(p,b)=>`Expected ${b&&b.substring(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${o.default(p)}\``,validator:p=>o.default[u](p)})}[d.testSymbol](l,h,u){for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&l===void 0)continue;const w=p(l);if(w===!0)continue;let x=u;throw typeof u=="function"&&(x=u()),x=x?`${this.type} \`${x}\``:this.type,new c.ArgumentError(b(l,x,w),h)}}get[s.validatorSymbol](){return this.context.validators}get not(){return f.not(this)}validate(l){return this.addValidator({message:(h,u,p)=>typeof p=="string"?`(${u}) ${p}`:p(u),validator:h=>{const{message:u,validator:p}=l(h);return!!p||u}})}is(l){return this.addValidator({message:(h,u,p)=>p?`(${u}) ${p}`:`Expected ${u} \`${h}\` to pass custom validation function`,validator:l})}addValidator(l){return this.context.validators.push(l),this}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=typeof URL>"u"?a(15).URL:URL,{toString:o}=Object.prototype,c=g=>v=>typeof v===g,d=g=>{const v=o.call(g).slice(8,-1);if(v)return v},f=g=>v=>d(v)===g;function l(g){switch(g){case null:return"null";case!0:case!1:return"boolean"}switch(typeof g){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"bigint":return"bigint";case"symbol":return"symbol"}if(l.function_(g))return"Function";if(l.observable(g))return"Observable";if(l.array(g))return"Array";if(l.buffer(g))return"Buffer";const v=d(g);if(v)return v;if(g instanceof String||g instanceof Boolean||g instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}const h=g=>typeof g=="object";l.undefined=c("undefined"),l.string=c("string"),l.number=c("number"),l.bigint=c("bigint"),l.function_=c("function"),l.null_=(g=>g===null),l.class_=(g=>l.function_(g)&&g.toString().startsWith("class ")),l.boolean=(g=>g===!0||g===!1),l.symbol=c("symbol"),l.numericString=(g=>l.string(g)&&g.length>0&&!Number.isNaN(Number(g))),l.array=Array.isArray,l.buffer=(g=>!l.nullOrUndefined(g)&&!l.nullOrUndefined(g.constructor)&&l.function_(g.constructor.isBuffer)&&g.constructor.isBuffer(g)),l.nullOrUndefined=(g=>l.null_(g)||l.undefined(g)),l.object=(g=>!l.nullOrUndefined(g)&&(l.function_(g)||h(g))),l.iterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.iterator])),l.asyncIterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.asyncIterator])),l.generator=(g=>l.iterable(g)&&l.function_(g.next)&&l.function_(g.throw)),l.nativePromise=(g=>f("Promise")(g)),l.promise=(g=>l.nativePromise(g)||(v=>!l.null_(v)&&h(v)&&l.function_(v.then)&&l.function_(v.catch))(g)),l.generatorFunction=f("GeneratorFunction"),l.asyncFunction=f("AsyncFunction"),l.boundFunction=(g=>l.function_(g)&&!g.hasOwnProperty("prototype")),l.regExp=f("RegExp"),l.date=f("Date"),l.error=f("Error"),l.map=(g=>f("Map")(g)),l.set=(g=>f("Set")(g)),l.weakMap=(g=>f("WeakMap")(g)),l.weakSet=(g=>f("WeakSet")(g)),l.int8Array=f("Int8Array"),l.uint8Array=f("Uint8Array"),l.uint8ClampedArray=f("Uint8ClampedArray"),l.int16Array=f("Int16Array"),l.uint16Array=f("Uint16Array"),l.int32Array=f("Int32Array"),l.uint32Array=f("Uint32Array"),l.float32Array=f("Float32Array"),l.float64Array=f("Float64Array"),l.bigint64Array=f("BigInt64Array"),l.biguint64Array=f("BigUint64Array"),l.arrayBuffer=f("ArrayBuffer"),l.sharedArrayBuffer=f("SharedArrayBuffer"),l.dataView=f("DataView"),l.directInstanceOf=((g,v)=>Object.getPrototypeOf(g)===v.prototype),l.urlInstance=(g=>f("URL")(g)),l.urlString=(g=>{if(!l.string(g))return!1;try{return new i(g),!0}catch{return!1}}),l.truthy=(g=>!!g),l.falsy=(g=>!g),l.nan=(g=>Number.isNaN(g));const u=new Set(["undefined","string","number","bigint","boolean","symbol"]);l.primitive=(g=>l.null_(g)||u.has(typeof g)),l.integer=(g=>Number.isInteger(g)),l.safeInteger=(g=>Number.isSafeInteger(g)),l.plainObject=(g=>{if(d(g)!=="Object")return!1;const v=Object.getPrototypeOf(g);return v===null||v===Object.getPrototypeOf({})});const p=new Set(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]);l.typedArray=(g=>{const v=d(g);return v!==void 0&&p.has(v)}),l.arrayLike=(g=>!l.nullOrUndefined(g)&&!l.function_(g)&&(v=>l.safeInteger(v)&&v>=0)(g.length)),l.inRange=((g,v)=>{if(l.number(v))return g>=Math.min(0,v)&&g<=Math.max(v,0);if(l.array(v)&&v.length===2)return g>=Math.min(...v)&&g<=Math.max(...v);throw new TypeError(`Invalid range: ${JSON.stringify(v)}`)});const b=["innerHTML","ownerDocument","style","attributes","nodeValue"];l.domElement=(g=>l.object(g)&&g.nodeType===1&&l.string(g.nodeName)&&!l.plainObject(g)&&b.every(v=>v in g)),l.observable=(g=>!!g&&(!(!g[Symbol.observable]||g!==g[Symbol.observable]())||!(!g["@@observable"]||g!==g["@@observable"]()))),l.nodeStream=(g=>!l.nullOrUndefined(g)&&h(g)&&l.function_(g.pipe)&&!l.observable(g)),l.infinite=(g=>g===1/0||g===-1/0);const w=g=>v=>l.integer(v)&&Math.abs(v%2)===g;l.evenInteger=w(0),l.oddInteger=w(1),l.emptyArray=(g=>l.array(g)&&g.length===0),l.nonEmptyArray=(g=>l.array(g)&&g.length>0),l.emptyString=(g=>l.string(g)&&g.length===0),l.nonEmptyString=(g=>l.string(g)&&g.length>0),l.emptyStringOrWhitespace=(g=>l.emptyString(g)||(v=>l.string(v)&&/\S/.test(v)===!1)(g)),l.emptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length===0),l.nonEmptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length>0),l.emptySet=(g=>l.set(g)&&g.size===0),l.nonEmptySet=(g=>l.set(g)&&g.size>0),l.emptyMap=(g=>l.map(g)&&g.size===0),l.nonEmptyMap=(g=>l.map(g)&&g.size>0);const x=(g,v,N)=>{if(l.function_(v)===!1)throw new TypeError(`Invalid predicate: ${JSON.stringify(v)}`);if(N.length===0)throw new TypeError("Invalid number of values");return g.call(N,v)};l.any=((g,...v)=>x(Array.prototype.some,g,v)),l.all=((g,...v)=>x(Array.prototype.every,g,v)),Object.defineProperties(l,{class:{value:l.class_},function:{value:l.function_},null:{value:l.null_}}),n.exports=l,s.default=l},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.testSymbol=Symbol("test"),s.isPredicate=(i=>!!(i&&i[s.testSymbol]))},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.default=((i,o,c=5)=>{const d=[];for(const f of o)if(!i.has(f)&&(d.push(f),d.length===c))return d;return d.length===0||d})},function(n,s,a){var i=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(10)),c=a(11),d=a(0);s.Predicate=d.Predicate;const f=a(2),l=i(a(17)),h=i(a(6)),u=i(a(9)),p=(w,x,g)=>{if(!f.isPredicate(x)&&typeof x!="string")throw new TypeError(`Expected second argument to be a predicate or a string, got \`${typeof x}\``);if(f.isPredicate(x)){const v=o.default();u.default(w,()=>c.inferLabel(v),x)}else u.default(w,x,g)};Object.defineProperties(p,{isValid:{value:(w,x)=>{try{return p(w,x),!0}catch{return!1}}},create:{value:(w,x)=>g=>{if(f.isPredicate(w)){const v=o.default();u.default(g,()=>c.inferLabel(v),w)}else u.default(g,w,x)}}}),s.default=h.default(l.default(p));var b=a(6);s.StringPredicate=b.StringPredicate,s.NumberPredicate=b.NumberPredicate,s.BooleanPredicate=b.BooleanPredicate,s.ArrayPredicate=b.ArrayPredicate,s.ObjectPredicate=b.ObjectPredicate,s.DatePredicate=b.DatePredicate,s.ErrorPredicate=b.ErrorPredicate,s.MapPredicate=b.MapPredicate,s.WeakMapPredicate=b.WeakMapPredicate,s.SetPredicate=b.SetPredicate,s.WeakSetPredicate=b.WeakSetPredicate,s.AnyPredicate=b.AnyPredicate},function(n,s,a){(function(i){var o=200,c="__lodash_hash_undefined__",d=1,f=2,l=9007199254740991,h="[object Arguments]",u="[object Array]",p="[object AsyncFunction]",b="[object Boolean]",w="[object Date]",x="[object Error]",g="[object Function]",v="[object GeneratorFunction]",N="[object Map]",j="[object Number]",y="[object Null]",m="[object Object]",_="[object Proxy]",E="[object RegExp]",A="[object Set]",C="[object String]",T="[object Symbol]",D="[object Undefined]",L="[object ArrayBuffer]",z="[object DataView]",U=/^\[object .+?Constructor\]$/,H=/^(?:0|[1-9]\d*)$/,F={};F["[object Float32Array]"]=F["[object Float64Array]"]=F["[object Int8Array]"]=F["[object Int16Array]"]=F["[object Int32Array]"]=F["[object Uint8Array]"]=F["[object Uint8ClampedArray]"]=F["[object Uint16Array]"]=F["[object Uint32Array]"]=!0,F[h]=F[u]=F[L]=F[b]=F[z]=F[w]=F[x]=F[g]=F[N]=F[j]=F[m]=F[E]=F[A]=F[C]=F["[object WeakMap]"]=!1;var Y=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,G=typeof self=="object"&&self&&self.Object===Object&&self,ne=Y||G||Function("return this")(),ie=s&&!s.nodeType&&s,xe=ie&&typeof i=="object"&&i&&!i.nodeType&&i,V=xe&&xe.exports===ie,q=V&&Y.process,B=(function(){try{return q&&q.binding&&q.binding("util")}catch{}})(),pe=B&&B.isTypedArray;function ee(W,Q){for(var we=-1,Ae=W==null?0:W.length;++we<Ae;)if(Q(W[we],we,W))return!0;return!1}function te(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae,ht){we[++Q]=[ht,Ae]}),we}function _e(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae){we[++Q]=Ae}),we}var Ie,K,le,oe=Array.prototype,Ne=Function.prototype,Ce=Object.prototype,Me=ne["__core-js_shared__"],Fe=Ne.toString,ue=Ce.hasOwnProperty,Re=(Ie=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+Ie:"",ae=Ce.toString,de=RegExp("^"+Fe.call(ue).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ve=V?ne.Buffer:void 0,fe=ne.Symbol,ke=ne.Uint8Array,Se=Ce.propertyIsEnumerable,Be=oe.splice,Ge=fe?fe.toStringTag:void 0,pt=Object.getOwnPropertySymbols,jt=ve?ve.isBuffer:void 0,gt=(K=Object.keys,le=Object,function(W){return K(le(W))}),St=Pe(ne,"DataView"),Ct=Pe(ne,"Map"),Tt=Pe(ne,"Promise"),Bt=Pe(ne,"Set"),Ke=Pe(ne,"WeakMap"),at=Pe(Object,"create"),_t=Je(St),Ut=Je(Ct),kt=Je(Tt),Vt=Je(Bt),S=Je(Ke),P=fe?fe.prototype:void 0,I=P?P.valueOf:void 0;function Z(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function be(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Oe(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Ze(W){var Q=-1,we=W==null?0:W.length;for(this.__data__=new Oe;++Q<we;)this.add(W[Q])}function Ue(W){var Q=this.__data__=new be(W);this.size=Q.size}function He(W,Q){var we=rr(W),Ae=!we&&Or(W),ht=!we&&!Ae&&Lr(W),Ye=!we&&!Ae&&!ht&&kr(W),yt=we||Ae||ht||Ye,Ot=yt?(function(mt,Rt){for(var qt=-1,It=Array(mt);++qt<mt;)It[qt]=Rt(qt);return It})(W.length,String):[],Jt=Ot.length;for(var At in W)!ue.call(W,At)||yt&&(At=="length"||ht&&(At=="offset"||At=="parent")||Ye&&(At=="buffer"||At=="byteLength"||At=="byteOffset")||xt(At,Jt))||Ot.push(At);return Ot}function bt(W,Q){for(var we=W.length;we--;)if(cr(W[we][0],Q))return we;return-1}function Dt(W){return W==null?W===void 0?D:y:Ge&&Ge in Object(W)?(function(Q){var we=ue.call(Q,Ge),Ae=Q[Ge];try{Q[Ge]=void 0;var ht=!0}catch{}var Ye=ae.call(Q);return ht&&(we?Q[Ge]=Ae:delete Q[Ge]),Ye})(W):(function(Q){return ae.call(Q)})(W)}function Mt(W){return ar(W)&&Dt(W)==h}function $t(W,Q,we,Ae,ht){return W===Q||(W==null||Q==null||!ar(W)&&!ar(Q)?W!=W&&Q!=Q:(function(Ye,yt,Ot,Jt,At,mt){var Rt=rr(Ye),qt=rr(yt),It=Rt?u:Ve(Ye),sr=qt?u:Ve(yt),xr=(It=It==h?m:It)==m,br=(sr=sr==h?m:sr)==m,lr=It==sr;if(lr&&Lr(Ye)){if(!Lr(yt))return!1;Rt=!0,xr=!1}if(lr&&!xr)return mt||(mt=new Ue),Rt||kr(Ye)?ft(Ye,yt,Ot,Jt,At,mt):(function(st,We,Zt,ir,Fr,vt,dr){switch(Zt){case z:if(st.byteLength!=We.byteLength||st.byteOffset!=We.byteOffset)return!1;st=st.buffer,We=We.buffer;case L:return!(st.byteLength!=We.byteLength||!vt(new ke(st),new ke(We)));case b:case w:case j:return cr(+st,+We);case x:return st.name==We.name&&st.message==We.message;case E:case C:return st==We+"";case N:var vr=te;case A:var $=ir&d;if(vr||(vr=_e),st.size!=We.size&&!$)return!1;var re=dr.get(st);if(re)return re==We;ir|=f,dr.set(st,We);var he=ft(vr(st),vr(We),ir,Fr,vt,dr);return dr.delete(st),he;case T:if(I)return I.call(st)==I.call(We)}return!1})(Ye,yt,It,Ot,Jt,At,mt);if(!(Ot&d)){var ur=xr&&ue.call(Ye,"__wrapped__"),nr=br&&ue.call(yt,"__wrapped__");if(ur||nr){var yr=ur?Ye.value():Ye,Ir=nr?yt.value():yt;return mt||(mt=new Ue),At(yr,Ir,Ot,Jt,mt)}}return lr?(mt||(mt=new Ue),(function(st,We,Zt,ir,Fr,vt){var dr=Zt&d,vr=ge(st),$=vr.length,re=ge(We).length;if($!=re&&!dr)return!1;for(var he=$;he--;){var se=vr[he];if(!(dr?se in We:ue.call(We,se)))return!1}var ye=vt.get(st);if(ye&&vt.get(We))return ye==We;var De=!0;vt.set(st,We),vt.set(We,st);for(var lt=dr;++he<$;){se=vr[he];var Xe=st[se],Qe=We[se];if(ir)var ct=dr?ir(Qe,Xe,se,We,st,vt):ir(Xe,Qe,se,st,We,vt);if(!(ct===void 0?Xe===Qe||Fr(Xe,Qe,Zt,ir,vt):ct)){De=!1;break}lt||(lt=se=="constructor")}if(De&&!lt){var et=st.constructor,Pt=We.constructor;et!=Pt&&"constructor"in st&&"constructor"in We&&!(typeof et=="function"&&et instanceof et&&typeof Pt=="function"&&Pt instanceof Pt)&&(De=!1)}return vt.delete(st),vt.delete(We),De})(Ye,yt,Ot,Jt,At,mt)):!1})(W,Q,we,Ae,$t,ht))}function Yt(W){return!(!$e(W)||(Q=W,Re&&Re in Q))&&(Ht(W)?de:U).test(Je(W));var Q}function Et(W){if(we=(Q=W)&&Q.constructor,Ae=typeof we=="function"&&we.prototype||Ce,Q!==Ae)return gt(W);var Q,we,Ae,ht=[];for(var Ye in Object(W))ue.call(W,Ye)&&Ye!="constructor"&&ht.push(Ye);return ht}function ft(W,Q,we,Ae,ht,Ye){var yt=we&d,Ot=W.length,Jt=Q.length;if(Ot!=Jt&&!(yt&&Jt>Ot))return!1;var At=Ye.get(W);if(At&&Ye.get(Q))return At==Q;var mt=-1,Rt=!0,qt=we&f?new Ze:void 0;for(Ye.set(W,Q),Ye.set(Q,W);++mt<Ot;){var It=W[mt],sr=Q[mt];if(Ae)var xr=yt?Ae(sr,It,mt,Q,W,Ye):Ae(It,sr,mt,W,Q,Ye);if(xr!==void 0){if(xr)continue;Rt=!1;break}if(qt){if(!ee(Q,function(br,lr){if(ur=lr,!qt.has(ur)&&(It===br||ht(It,br,we,Ae,Ye)))return qt.push(lr);var ur})){Rt=!1;break}}else if(It!==sr&&!ht(It,sr,we,Ae,Ye)){Rt=!1;break}}return Ye.delete(W),Ye.delete(Q),Rt}function ge(W){return(function(Q,we,Ae){var ht=we(Q);return rr(Q)?ht:(function(Ye,yt){for(var Ot=-1,Jt=yt.length,At=Ye.length;++Ot<Jt;)Ye[At+Ot]=yt[Ot];return Ye})(ht,Ae(Q))})(W,ut,ze)}function Te(W,Q){var we,Ae,ht=W.__data__;return((Ae=typeof(we=Q))=="string"||Ae=="number"||Ae=="symbol"||Ae=="boolean"?we!=="__proto__":we===null)?ht[typeof Q=="string"?"string":"hash"]:ht.map}function Pe(W,Q){var we=(function(Ae,ht){return Ae?.[ht]})(W,Q);return Yt(we)?we:void 0}Z.prototype.clear=function(){this.__data__=at?at(null):{},this.size=0},Z.prototype.delete=function(W){var Q=this.has(W)&&delete this.__data__[W];return this.size-=Q?1:0,Q},Z.prototype.get=function(W){var Q=this.__data__;if(at){var we=Q[W];return we===c?void 0:we}return ue.call(Q,W)?Q[W]:void 0},Z.prototype.has=function(W){var Q=this.__data__;return at?Q[W]!==void 0:ue.call(Q,W)},Z.prototype.set=function(W,Q){var we=this.__data__;return this.size+=this.has(W)?0:1,we[W]=at&&Q===void 0?c:Q,this},be.prototype.clear=function(){this.__data__=[],this.size=0},be.prototype.delete=function(W){var Q=this.__data__,we=bt(Q,W);return!(we<0||(we==Q.length-1?Q.pop():Be.call(Q,we,1),--this.size,0))},be.prototype.get=function(W){var Q=this.__data__,we=bt(Q,W);return we<0?void 0:Q[we][1]},be.prototype.has=function(W){return bt(this.__data__,W)>-1},be.prototype.set=function(W,Q){var we=this.__data__,Ae=bt(we,W);return Ae<0?(++this.size,we.push([W,Q])):we[Ae][1]=Q,this},Oe.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(Ct||be),string:new Z}},Oe.prototype.delete=function(W){var Q=Te(this,W).delete(W);return this.size-=Q?1:0,Q},Oe.prototype.get=function(W){return Te(this,W).get(W)},Oe.prototype.has=function(W){return Te(this,W).has(W)},Oe.prototype.set=function(W,Q){var we=Te(this,W),Ae=we.size;return we.set(W,Q),this.size+=we.size==Ae?0:1,this},Ze.prototype.add=Ze.prototype.push=function(W){return this.__data__.set(W,c),this},Ze.prototype.has=function(W){return this.__data__.has(W)},Ue.prototype.clear=function(){this.__data__=new be,this.size=0},Ue.prototype.delete=function(W){var Q=this.__data__,we=Q.delete(W);return this.size=Q.size,we},Ue.prototype.get=function(W){return this.__data__.get(W)},Ue.prototype.has=function(W){return this.__data__.has(W)},Ue.prototype.set=function(W,Q){var we=this.__data__;if(we instanceof be){var Ae=we.__data__;if(!Ct||Ae.length<o-1)return Ae.push([W,Q]),this.size=++we.size,this;we=this.__data__=new Oe(Ae)}return we.set(W,Q),this.size=we.size,this};var ze=pt?function(W){return W==null?[]:(W=Object(W),(function(Q,we){for(var Ae=-1,ht=Q==null?0:Q.length,Ye=0,yt=[];++Ae<ht;){var Ot=Q[Ae];we(Ot,Ae,Q)&&(yt[Ye++]=Ot)}return yt})(pt(W),function(Q){return Se.call(W,Q)}))}:function(){return[]},Ve=Dt;function xt(W,Q){return!!(Q=Q??l)&&(typeof W=="number"||H.test(W))&&W>-1&&W%1==0&&W<Q}function Je(W){if(W!=null){try{return Fe.call(W)}catch{}try{return W+""}catch{}}return""}function cr(W,Q){return W===Q||W!=W&&Q!=Q}(St&&Ve(new St(new ArrayBuffer(1)))!=z||Ct&&Ve(new Ct)!=N||Tt&&Ve(Tt.resolve())!="[object Promise]"||Bt&&Ve(new Bt)!=A||Ke&&Ve(new Ke)!="[object WeakMap]")&&(Ve=function(W){var Q=Dt(W),we=Q==m?W.constructor:void 0,Ae=we?Je(we):"";if(Ae)switch(Ae){case _t:return z;case Ut:return N;case kt:return"[object Promise]";case Vt:return A;case S:return"[object WeakMap]"}return Q});var Or=Mt((function(){return arguments})())?Mt:function(W){return ar(W)&&ue.call(W,"callee")&&!Se.call(W,"callee")},rr=Array.isArray,Lr=jt||function(){return!1};function Ht(W){if(!$e(W))return!1;var Q=Dt(W);return Q==g||Q==v||Q==p||Q==_}function Mr(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=l}function $e(W){var Q=typeof W;return W!=null&&(Q=="object"||Q=="function")}function ar(W){return W!=null&&typeof W=="object"}var kr=pe?(function(W){return function(Q){return W(Q)}})(pe):function(W){return ar(W)&&Mr(W.length)&&!!F[Dt(W)]};function ut(W){return(Q=W)!=null&&Mr(Q.length)&&!Ht(Q)?He(W):Et(W);var Q}i.exports=function(W,Q){return $t(W,Q)}}).call(this,a(23)(n))},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(18);s.StringPredicate=i.StringPredicate;const o=a(20);s.NumberPredicate=o.NumberPredicate;const c=a(21);s.BooleanPredicate=c.BooleanPredicate;const d=a(0),f=a(22);s.ArrayPredicate=f.ArrayPredicate;const l=a(24);s.ObjectPredicate=l.ObjectPredicate;const h=a(29);s.DatePredicate=h.DatePredicate;const u=a(30);s.ErrorPredicate=u.ErrorPredicate;const p=a(31);s.MapPredicate=p.MapPredicate;const b=a(32);s.WeakMapPredicate=b.WeakMapPredicate;const w=a(33);s.SetPredicate=w.SetPredicate;const x=a(34);s.WeakSetPredicate=x.WeakSetPredicate;const g=a(35);s.AnyPredicate=g.AnyPredicate,s.default=((v,N)=>(Object.defineProperties(v,{string:{get:()=>new i.StringPredicate(N)},number:{get:()=>new o.NumberPredicate(N)},boolean:{get:()=>new c.BooleanPredicate(N)},undefined:{get:()=>new d.Predicate("undefined",N)},null:{get:()=>new d.Predicate("null",N)},nullOrUndefined:{get:()=>new d.Predicate("nullOrUndefined",N)},nan:{get:()=>new d.Predicate("nan",N)},symbol:{get:()=>new d.Predicate("symbol",N)},array:{get:()=>new f.ArrayPredicate(N)},object:{get:()=>new l.ObjectPredicate(N)},date:{get:()=>new h.DatePredicate(N)},error:{get:()=>new u.ErrorPredicate(N)},map:{get:()=>new p.MapPredicate(N)},weakMap:{get:()=>new b.WeakMapPredicate(N)},set:{get:()=>new w.SetPredicate(N)},weakSet:{get:()=>new x.WeakSetPredicate(N)},function:{get:()=>new d.Predicate("Function",N)},buffer:{get:()=>new d.Predicate("Buffer",N)},regExp:{get:()=>new d.Predicate("RegExp",N)},promise:{get:()=>new d.Predicate("Promise",N)},typedArray:{get:()=>new d.Predicate("TypedArray",N)},int8Array:{get:()=>new d.Predicate("Int8Array",N)},uint8Array:{get:()=>new d.Predicate("Uint8Array",N)},uint8ClampedArray:{get:()=>new d.Predicate("Uint8ClampedArray",N)},int16Array:{get:()=>new d.Predicate("Int16Array",N)},uint16Array:{get:()=>new d.Predicate("Uint16Array",N)},int32Array:{get:()=>new d.Predicate("Int32Array",N)},uint32Array:{get:()=>new d.Predicate("Uint32Array",N)},float32Array:{get:()=>new d.Predicate("Float32Array",N)},float64Array:{get:()=>new d.Predicate("Float64Array",N)},arrayBuffer:{get:()=>new d.Predicate("ArrayBuffer",N)},dataView:{get:()=>new d.Predicate("DataView",N)},iterable:{get:()=>new d.Predicate("Iterable",N)},any:{value:(...j)=>new g.AnyPredicate(j,N)}}),v))},function(n,s,a){var i=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(4));s.default=((c,d)=>{try{for(const f of c)o.default(f,d);return!0}catch(f){return f.message}})},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.ArgumentError=class extends Error{constructor(i,o){super(i),"captureStackTrace"in Error&&Error.captureStackTrace(this,o),this.name="ArgumentError"}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(2);s.default=function o(c,d,f){f[i.testSymbol](c,o,d)}},function(n,s,a){const i=()=>{const o=Error.prepareStackTrace;Error.prepareStackTrace=((d,f)=>f);const c=new Error().stack.slice(1);return Error.prepareStackTrace=o,c};n.exports=i,n.exports.default=i},function(n,s,a){var i=this&&this.__importStar||function(h){if(h&&h.__esModule)return h;var u={};if(h!=null)for(var p in h)Object.hasOwnProperty.call(h,p)&&(u[p]=h[p]);return u.default=h,u},o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(s,"__esModule",{value:!0});const c=i(a(12)),d=o(a(13)),f=o(a(14)),l=/^.*?\((.*?)[,)]/;s.inferLabel=(h=>{if(!f.default)return;const u=h[1],p=u.getFileName(),b=u.getLineNumber(),w=u.getColumnNumber();if(!p||b===null||w===null)return;let x=[];try{x=c.readFileSync(p,"utf8").split(`
107
+ @`+(x.systemId||"")+"#[line:"+x.lineNumber+",col:"+x.columnNumber+"]"}function b(x,g,v){return typeof x=="string"?x.substr(g,v):x.length>=g+v||g?new java.lang.String(x,g,v)+"":x}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(x){h.prototype[x]=function(){return null}});function w(x,g){x.currentElement?x.currentElement.appendChild(g):x.doc.appendChild(g)}return rs.__DOMHandler=h,rs.normalizeLineEndings=d,rs.DOMParser=f,rs}var Gl;function cm(){if(Gl)return ts;Gl=1;var t=jd();return ts.DOMImplementation=t.DOMImplementation,ts.XMLSerializer=t.XMLSerializer,ts.DOMParser=um().DOMParser,ts}var as={},Er={},Bs={},oi={},Us={},Jl;function Ln(){if(Jl)return Us;Jl=1,Object.defineProperty(Us,"__esModule",{value:!0});const t=Pn();let r=class extends t.default{constructor(s,a){super(s,a)}};return Us.UniverseLogError=r,Us}var Yl;function Ns(){return Yl||(Yl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const r=Ln();(function(n){n.error="error",n.warn="warn",n.info="info",n.http="http",n.verbose="verbose",n.debug="debug",n.silly="silly"})(t.LogLevel||(t.LogLevel={})),(function(n){n.LEVELS_VALUES={[n.error]:0,[n.warn]:1,[n.info]:2,[n.http]:3,[n.verbose]:4,[n.debug]:5,[n.silly]:6},n.LEVELS_BY_NAME={[n.error]:n.error,[n.warn]:n.warn,[n.info]:n.info,[n.http]:n.http,[n.verbose]:n.verbose,[n.debug]:n.debug,[n.silly]:n.silly},n.DEFAULT_LEVEL=n.info;function s(d){if(typeof n.LEVELS_BY_NAME[d]>"u"){const f=Object.keys(n.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return n.LEVELS_BY_NAME[d]}n.valueOf=s;function a(d){if(typeof n.LEVELS_VALUES[d]>"u"){const f=Object.keys(n.LEVELS_BY_NAME).join(", ");throw new r.UniverseLogError(`There is no such log level: '${d}'. Available levels: [ ${f} ]`)}return n.LEVELS_VALUES[d]}n.levelToValue=a;function i(d){return a(d.level)<=a(d.threshold)}n.isLessOrEquallyVerbose=i;function o(d,f){return n.LEVELS_VALUES[d]>n.LEVELS_VALUES[f]?d:f}n.moreVerbose=o;function c(d,f){return n.LEVELS_VALUES[d]<n.LEVELS_VALUES[f]?d:f}n.lessVerbose=c})(t.LogLevel||(t.LogLevel={}))})(oi)),oi}var Vs={},ka={},li={exports:{}},Zl;function _d(){return Zl||(Zl=1,(function(t){t.exports=(function(n){var s={};function a(i){if(s[i])return s[i].exports;var o=s[i]={i,l:!1,exports:{}};return n[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=n,a.c=s,a.d=function(i,o,c){a.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:c})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,o){if(1&o&&(i=a(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var d in i)a.d(c,d,(function(f){return i[f]}).bind(null,d));return c},a.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(o,"a",o),o},a.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},a.p="",a(a.s=4)})([function(n,s,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=a(8),d=a(2),f=a(16);s.validatorSymbol=Symbol("validators"),s.Predicate=class{constructor(l,h={}){this.type=l,this.options=h,this.context={validators:[]},this.context=Object.assign({},this.context,this.options);const u=this.type[0].toLowerCase()+this.type.slice(1);this.addValidator({message:(p,b)=>`Expected ${b&&b.substring(this.type.length+1)||"argument"} to be of type \`${this.type}\` but received type \`${o.default(p)}\``,validator:p=>o.default[u](p)})}[d.testSymbol](l,h,u){for(const{validator:p,message:b}of this.context.validators){if(this.options.optional===!0&&l===void 0)continue;const w=p(l);if(w===!0)continue;let x=u;throw typeof u=="function"&&(x=u()),x=x?`${this.type} \`${x}\``:this.type,new c.ArgumentError(b(l,x,w),h)}}get[s.validatorSymbol](){return this.context.validators}get not(){return f.not(this)}validate(l){return this.addValidator({message:(h,u,p)=>typeof p=="string"?`(${u}) ${p}`:p(u),validator:h=>{const{message:u,validator:p}=l(h);return!!p||u}})}is(l){return this.addValidator({message:(h,u,p)=>p?`(${u}) ${p}`:`Expected ${u} \`${h}\` to pass custom validation function`,validator:l})}addValidator(l){return this.context.validators.push(l),this}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=typeof URL>"u"?a(15).URL:URL,{toString:o}=Object.prototype,c=g=>v=>typeof v===g,d=g=>{const v=o.call(g).slice(8,-1);if(v)return v},f=g=>v=>d(v)===g;function l(g){switch(g){case null:return"null";case!0:case!1:return"boolean"}switch(typeof g){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"bigint":return"bigint";case"symbol":return"symbol"}if(l.function_(g))return"Function";if(l.observable(g))return"Observable";if(l.array(g))return"Array";if(l.buffer(g))return"Buffer";const v=d(g);if(v)return v;if(g instanceof String||g instanceof Boolean||g instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}const h=g=>typeof g=="object";l.undefined=c("undefined"),l.string=c("string"),l.number=c("number"),l.bigint=c("bigint"),l.function_=c("function"),l.null_=(g=>g===null),l.class_=(g=>l.function_(g)&&g.toString().startsWith("class ")),l.boolean=(g=>g===!0||g===!1),l.symbol=c("symbol"),l.numericString=(g=>l.string(g)&&g.length>0&&!Number.isNaN(Number(g))),l.array=Array.isArray,l.buffer=(g=>!l.nullOrUndefined(g)&&!l.nullOrUndefined(g.constructor)&&l.function_(g.constructor.isBuffer)&&g.constructor.isBuffer(g)),l.nullOrUndefined=(g=>l.null_(g)||l.undefined(g)),l.object=(g=>!l.nullOrUndefined(g)&&(l.function_(g)||h(g))),l.iterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.iterator])),l.asyncIterable=(g=>!l.nullOrUndefined(g)&&l.function_(g[Symbol.asyncIterator])),l.generator=(g=>l.iterable(g)&&l.function_(g.next)&&l.function_(g.throw)),l.nativePromise=(g=>f("Promise")(g)),l.promise=(g=>l.nativePromise(g)||(v=>!l.null_(v)&&h(v)&&l.function_(v.then)&&l.function_(v.catch))(g)),l.generatorFunction=f("GeneratorFunction"),l.asyncFunction=f("AsyncFunction"),l.boundFunction=(g=>l.function_(g)&&!g.hasOwnProperty("prototype")),l.regExp=f("RegExp"),l.date=f("Date"),l.error=f("Error"),l.map=(g=>f("Map")(g)),l.set=(g=>f("Set")(g)),l.weakMap=(g=>f("WeakMap")(g)),l.weakSet=(g=>f("WeakSet")(g)),l.int8Array=f("Int8Array"),l.uint8Array=f("Uint8Array"),l.uint8ClampedArray=f("Uint8ClampedArray"),l.int16Array=f("Int16Array"),l.uint16Array=f("Uint16Array"),l.int32Array=f("Int32Array"),l.uint32Array=f("Uint32Array"),l.float32Array=f("Float32Array"),l.float64Array=f("Float64Array"),l.bigint64Array=f("BigInt64Array"),l.biguint64Array=f("BigUint64Array"),l.arrayBuffer=f("ArrayBuffer"),l.sharedArrayBuffer=f("SharedArrayBuffer"),l.dataView=f("DataView"),l.directInstanceOf=((g,v)=>Object.getPrototypeOf(g)===v.prototype),l.urlInstance=(g=>f("URL")(g)),l.urlString=(g=>{if(!l.string(g))return!1;try{return new i(g),!0}catch{return!1}}),l.truthy=(g=>!!g),l.falsy=(g=>!g),l.nan=(g=>Number.isNaN(g));const u=new Set(["undefined","string","number","bigint","boolean","symbol"]);l.primitive=(g=>l.null_(g)||u.has(typeof g)),l.integer=(g=>Number.isInteger(g)),l.safeInteger=(g=>Number.isSafeInteger(g)),l.plainObject=(g=>{if(d(g)!=="Object")return!1;const v=Object.getPrototypeOf(g);return v===null||v===Object.getPrototypeOf({})});const p=new Set(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]);l.typedArray=(g=>{const v=d(g);return v!==void 0&&p.has(v)}),l.arrayLike=(g=>!l.nullOrUndefined(g)&&!l.function_(g)&&(v=>l.safeInteger(v)&&v>=0)(g.length)),l.inRange=((g,v)=>{if(l.number(v))return g>=Math.min(0,v)&&g<=Math.max(v,0);if(l.array(v)&&v.length===2)return g>=Math.min(...v)&&g<=Math.max(...v);throw new TypeError(`Invalid range: ${JSON.stringify(v)}`)});const b=["innerHTML","ownerDocument","style","attributes","nodeValue"];l.domElement=(g=>l.object(g)&&g.nodeType===1&&l.string(g.nodeName)&&!l.plainObject(g)&&b.every(v=>v in g)),l.observable=(g=>!!g&&(!(!g[Symbol.observable]||g!==g[Symbol.observable]())||!(!g["@@observable"]||g!==g["@@observable"]()))),l.nodeStream=(g=>!l.nullOrUndefined(g)&&h(g)&&l.function_(g.pipe)&&!l.observable(g)),l.infinite=(g=>g===1/0||g===-1/0);const w=g=>v=>l.integer(v)&&Math.abs(v%2)===g;l.evenInteger=w(0),l.oddInteger=w(1),l.emptyArray=(g=>l.array(g)&&g.length===0),l.nonEmptyArray=(g=>l.array(g)&&g.length>0),l.emptyString=(g=>l.string(g)&&g.length===0),l.nonEmptyString=(g=>l.string(g)&&g.length>0),l.emptyStringOrWhitespace=(g=>l.emptyString(g)||(v=>l.string(v)&&/\S/.test(v)===!1)(g)),l.emptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length===0),l.nonEmptyObject=(g=>l.object(g)&&!l.map(g)&&!l.set(g)&&Object.keys(g).length>0),l.emptySet=(g=>l.set(g)&&g.size===0),l.nonEmptySet=(g=>l.set(g)&&g.size>0),l.emptyMap=(g=>l.map(g)&&g.size===0),l.nonEmptyMap=(g=>l.map(g)&&g.size>0);const x=(g,v,N)=>{if(l.function_(v)===!1)throw new TypeError(`Invalid predicate: ${JSON.stringify(v)}`);if(N.length===0)throw new TypeError("Invalid number of values");return g.call(N,v)};l.any=((g,...v)=>x(Array.prototype.some,g,v)),l.all=((g,...v)=>x(Array.prototype.every,g,v)),Object.defineProperties(l,{class:{value:l.class_},function:{value:l.function_},null:{value:l.null_}}),n.exports=l,s.default=l},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.testSymbol=Symbol("test"),s.isPredicate=(i=>!!(i&&i[s.testSymbol]))},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.default=((i,o,c=5)=>{const d=[];for(const f of o)if(!i.has(f)&&(d.push(f),d.length===c))return d;return d.length===0||d})},function(n,s,a){var i=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(10)),c=a(11),d=a(0);s.Predicate=d.Predicate;const f=a(2),l=i(a(17)),h=i(a(6)),u=i(a(9)),p=(w,x,g)=>{if(!f.isPredicate(x)&&typeof x!="string")throw new TypeError(`Expected second argument to be a predicate or a string, got \`${typeof x}\``);if(f.isPredicate(x)){const v=o.default();u.default(w,()=>c.inferLabel(v),x)}else u.default(w,x,g)};Object.defineProperties(p,{isValid:{value:(w,x)=>{try{return p(w,x),!0}catch{return!1}}},create:{value:(w,x)=>g=>{if(f.isPredicate(w)){const v=o.default();u.default(g,()=>c.inferLabel(v),w)}else u.default(g,w,x)}}}),s.default=h.default(l.default(p));var b=a(6);s.StringPredicate=b.StringPredicate,s.NumberPredicate=b.NumberPredicate,s.BooleanPredicate=b.BooleanPredicate,s.ArrayPredicate=b.ArrayPredicate,s.ObjectPredicate=b.ObjectPredicate,s.DatePredicate=b.DatePredicate,s.ErrorPredicate=b.ErrorPredicate,s.MapPredicate=b.MapPredicate,s.WeakMapPredicate=b.WeakMapPredicate,s.SetPredicate=b.SetPredicate,s.WeakSetPredicate=b.WeakSetPredicate,s.AnyPredicate=b.AnyPredicate},function(n,s,a){(function(i){var o=200,c="__lodash_hash_undefined__",d=1,f=2,l=9007199254740991,h="[object Arguments]",u="[object Array]",p="[object AsyncFunction]",b="[object Boolean]",w="[object Date]",x="[object Error]",g="[object Function]",v="[object GeneratorFunction]",N="[object Map]",j="[object Number]",y="[object Null]",m="[object Object]",_="[object Proxy]",E="[object RegExp]",A="[object Set]",C="[object String]",T="[object Symbol]",D="[object Undefined]",L="[object ArrayBuffer]",z="[object DataView]",U=/^\[object .+?Constructor\]$/,H=/^(?:0|[1-9]\d*)$/,F={};F["[object Float32Array]"]=F["[object Float64Array]"]=F["[object Int8Array]"]=F["[object Int16Array]"]=F["[object Int32Array]"]=F["[object Uint8Array]"]=F["[object Uint8ClampedArray]"]=F["[object Uint16Array]"]=F["[object Uint32Array]"]=!0,F[h]=F[u]=F[L]=F[b]=F[z]=F[w]=F[x]=F[g]=F[N]=F[j]=F[m]=F[E]=F[A]=F[C]=F["[object WeakMap]"]=!1;var Y=typeof Kr=="object"&&Kr&&Kr.Object===Object&&Kr,G=typeof self=="object"&&self&&self.Object===Object&&self,ne=Y||G||Function("return this")(),ie=s&&!s.nodeType&&s,xe=ie&&typeof i=="object"&&i&&!i.nodeType&&i,V=xe&&xe.exports===ie,q=V&&Y.process,B=(function(){try{return q&&q.binding&&q.binding("util")}catch{}})(),pe=B&&B.isTypedArray;function ee(W,Q){for(var we=-1,Ae=W==null?0:W.length;++we<Ae;)if(Q(W[we],we,W))return!0;return!1}function te(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae,ht){we[++Q]=[ht,Ae]}),we}function _e(W){var Q=-1,we=Array(W.size);return W.forEach(function(Ae){we[++Q]=Ae}),we}var Ie,K,le,oe=Array.prototype,Ne=Function.prototype,Ce=Object.prototype,Me=ne["__core-js_shared__"],Fe=Ne.toString,ue=Ce.hasOwnProperty,Re=(Ie=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+Ie:"",ae=Ce.toString,de=RegExp("^"+Fe.call(ue).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ve=V?ne.Buffer:void 0,fe=ne.Symbol,ke=ne.Uint8Array,Se=Ce.propertyIsEnumerable,Be=oe.splice,Ge=fe?fe.toStringTag:void 0,pt=Object.getOwnPropertySymbols,jt=ve?ve.isBuffer:void 0,gt=(K=Object.keys,le=Object,function(W){return K(le(W))}),St=Pe(ne,"DataView"),Ct=Pe(ne,"Map"),Tt=Pe(ne,"Promise"),Bt=Pe(ne,"Set"),Ke=Pe(ne,"WeakMap"),at=Pe(Object,"create"),_t=Je(St),Ut=Je(Ct),kt=Je(Tt),Vt=Je(Bt),S=Je(Ke),P=fe?fe.prototype:void 0,I=P?P.valueOf:void 0;function Z(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function be(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Oe(W){var Q=-1,we=W==null?0:W.length;for(this.clear();++Q<we;){var Ae=W[Q];this.set(Ae[0],Ae[1])}}function Ze(W){var Q=-1,we=W==null?0:W.length;for(this.__data__=new Oe;++Q<we;)this.add(W[Q])}function Ue(W){var Q=this.__data__=new be(W);this.size=Q.size}function He(W,Q){var we=rr(W),Ae=!we&&Or(W),ht=!we&&!Ae&&Lr(W),Ye=!we&&!Ae&&!ht&&kr(W),yt=we||Ae||ht||Ye,Ot=yt?(function(mt,Rt){for(var qt=-1,It=Array(mt);++qt<mt;)It[qt]=Rt(qt);return It})(W.length,String):[],Jt=Ot.length;for(var At in W)!ue.call(W,At)||yt&&(At=="length"||ht&&(At=="offset"||At=="parent")||Ye&&(At=="buffer"||At=="byteLength"||At=="byteOffset")||xt(At,Jt))||Ot.push(At);return Ot}function bt(W,Q){for(var we=W.length;we--;)if(cr(W[we][0],Q))return we;return-1}function Dt(W){return W==null?W===void 0?D:y:Ge&&Ge in Object(W)?(function(Q){var we=ue.call(Q,Ge),Ae=Q[Ge];try{Q[Ge]=void 0;var ht=!0}catch{}var Ye=ae.call(Q);return ht&&(we?Q[Ge]=Ae:delete Q[Ge]),Ye})(W):(function(Q){return ae.call(Q)})(W)}function Mt(W){return ar(W)&&Dt(W)==h}function $t(W,Q,we,Ae,ht){return W===Q||(W==null||Q==null||!ar(W)&&!ar(Q)?W!=W&&Q!=Q:(function(Ye,yt,Ot,Jt,At,mt){var Rt=rr(Ye),qt=rr(yt),It=Rt?u:Ve(Ye),sr=qt?u:Ve(yt),xr=(It=It==h?m:It)==m,br=(sr=sr==h?m:sr)==m,lr=It==sr;if(lr&&Lr(Ye)){if(!Lr(yt))return!1;Rt=!0,xr=!1}if(lr&&!xr)return mt||(mt=new Ue),Rt||kr(Ye)?ft(Ye,yt,Ot,Jt,At,mt):(function(st,We,Xt,ir,Fr,vt,dr){switch(Xt){case z:if(st.byteLength!=We.byteLength||st.byteOffset!=We.byteOffset)return!1;st=st.buffer,We=We.buffer;case L:return!(st.byteLength!=We.byteLength||!vt(new ke(st),new ke(We)));case b:case w:case j:return cr(+st,+We);case x:return st.name==We.name&&st.message==We.message;case E:case C:return st==We+"";case N:var vr=te;case A:var $=ir&d;if(vr||(vr=_e),st.size!=We.size&&!$)return!1;var re=dr.get(st);if(re)return re==We;ir|=f,dr.set(st,We);var he=ft(vr(st),vr(We),ir,Fr,vt,dr);return dr.delete(st),he;case T:if(I)return I.call(st)==I.call(We)}return!1})(Ye,yt,It,Ot,Jt,At,mt);if(!(Ot&d)){var ur=xr&&ue.call(Ye,"__wrapped__"),nr=br&&ue.call(yt,"__wrapped__");if(ur||nr){var yr=ur?Ye.value():Ye,Ir=nr?yt.value():yt;return mt||(mt=new Ue),At(yr,Ir,Ot,Jt,mt)}}return lr?(mt||(mt=new Ue),(function(st,We,Xt,ir,Fr,vt){var dr=Xt&d,vr=ge(st),$=vr.length,re=ge(We).length;if($!=re&&!dr)return!1;for(var he=$;he--;){var se=vr[he];if(!(dr?se in We:ue.call(We,se)))return!1}var ye=vt.get(st);if(ye&&vt.get(We))return ye==We;var De=!0;vt.set(st,We),vt.set(We,st);for(var lt=dr;++he<$;){se=vr[he];var Xe=st[se],Qe=We[se];if(ir)var ct=dr?ir(Qe,Xe,se,We,st,vt):ir(Xe,Qe,se,st,We,vt);if(!(ct===void 0?Xe===Qe||Fr(Xe,Qe,Xt,ir,vt):ct)){De=!1;break}lt||(lt=se=="constructor")}if(De&&!lt){var et=st.constructor,Pt=We.constructor;et!=Pt&&"constructor"in st&&"constructor"in We&&!(typeof et=="function"&&et instanceof et&&typeof Pt=="function"&&Pt instanceof Pt)&&(De=!1)}return vt.delete(st),vt.delete(We),De})(Ye,yt,Ot,Jt,At,mt)):!1})(W,Q,we,Ae,$t,ht))}function Zt(W){return!(!$e(W)||(Q=W,Re&&Re in Q))&&(Ht(W)?de:U).test(Je(W));var Q}function Et(W){if(we=(Q=W)&&Q.constructor,Ae=typeof we=="function"&&we.prototype||Ce,Q!==Ae)return gt(W);var Q,we,Ae,ht=[];for(var Ye in Object(W))ue.call(W,Ye)&&Ye!="constructor"&&ht.push(Ye);return ht}function ft(W,Q,we,Ae,ht,Ye){var yt=we&d,Ot=W.length,Jt=Q.length;if(Ot!=Jt&&!(yt&&Jt>Ot))return!1;var At=Ye.get(W);if(At&&Ye.get(Q))return At==Q;var mt=-1,Rt=!0,qt=we&f?new Ze:void 0;for(Ye.set(W,Q),Ye.set(Q,W);++mt<Ot;){var It=W[mt],sr=Q[mt];if(Ae)var xr=yt?Ae(sr,It,mt,Q,W,Ye):Ae(It,sr,mt,W,Q,Ye);if(xr!==void 0){if(xr)continue;Rt=!1;break}if(qt){if(!ee(Q,function(br,lr){if(ur=lr,!qt.has(ur)&&(It===br||ht(It,br,we,Ae,Ye)))return qt.push(lr);var ur})){Rt=!1;break}}else if(It!==sr&&!ht(It,sr,we,Ae,Ye)){Rt=!1;break}}return Ye.delete(W),Ye.delete(Q),Rt}function ge(W){return(function(Q,we,Ae){var ht=we(Q);return rr(Q)?ht:(function(Ye,yt){for(var Ot=-1,Jt=yt.length,At=Ye.length;++Ot<Jt;)Ye[At+Ot]=yt[Ot];return Ye})(ht,Ae(Q))})(W,ut,ze)}function Te(W,Q){var we,Ae,ht=W.__data__;return((Ae=typeof(we=Q))=="string"||Ae=="number"||Ae=="symbol"||Ae=="boolean"?we!=="__proto__":we===null)?ht[typeof Q=="string"?"string":"hash"]:ht.map}function Pe(W,Q){var we=(function(Ae,ht){return Ae?.[ht]})(W,Q);return Zt(we)?we:void 0}Z.prototype.clear=function(){this.__data__=at?at(null):{},this.size=0},Z.prototype.delete=function(W){var Q=this.has(W)&&delete this.__data__[W];return this.size-=Q?1:0,Q},Z.prototype.get=function(W){var Q=this.__data__;if(at){var we=Q[W];return we===c?void 0:we}return ue.call(Q,W)?Q[W]:void 0},Z.prototype.has=function(W){var Q=this.__data__;return at?Q[W]!==void 0:ue.call(Q,W)},Z.prototype.set=function(W,Q){var we=this.__data__;return this.size+=this.has(W)?0:1,we[W]=at&&Q===void 0?c:Q,this},be.prototype.clear=function(){this.__data__=[],this.size=0},be.prototype.delete=function(W){var Q=this.__data__,we=bt(Q,W);return!(we<0||(we==Q.length-1?Q.pop():Be.call(Q,we,1),--this.size,0))},be.prototype.get=function(W){var Q=this.__data__,we=bt(Q,W);return we<0?void 0:Q[we][1]},be.prototype.has=function(W){return bt(this.__data__,W)>-1},be.prototype.set=function(W,Q){var we=this.__data__,Ae=bt(we,W);return Ae<0?(++this.size,we.push([W,Q])):we[Ae][1]=Q,this},Oe.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(Ct||be),string:new Z}},Oe.prototype.delete=function(W){var Q=Te(this,W).delete(W);return this.size-=Q?1:0,Q},Oe.prototype.get=function(W){return Te(this,W).get(W)},Oe.prototype.has=function(W){return Te(this,W).has(W)},Oe.prototype.set=function(W,Q){var we=Te(this,W),Ae=we.size;return we.set(W,Q),this.size+=we.size==Ae?0:1,this},Ze.prototype.add=Ze.prototype.push=function(W){return this.__data__.set(W,c),this},Ze.prototype.has=function(W){return this.__data__.has(W)},Ue.prototype.clear=function(){this.__data__=new be,this.size=0},Ue.prototype.delete=function(W){var Q=this.__data__,we=Q.delete(W);return this.size=Q.size,we},Ue.prototype.get=function(W){return this.__data__.get(W)},Ue.prototype.has=function(W){return this.__data__.has(W)},Ue.prototype.set=function(W,Q){var we=this.__data__;if(we instanceof be){var Ae=we.__data__;if(!Ct||Ae.length<o-1)return Ae.push([W,Q]),this.size=++we.size,this;we=this.__data__=new Oe(Ae)}return we.set(W,Q),this.size=we.size,this};var ze=pt?function(W){return W==null?[]:(W=Object(W),(function(Q,we){for(var Ae=-1,ht=Q==null?0:Q.length,Ye=0,yt=[];++Ae<ht;){var Ot=Q[Ae];we(Ot,Ae,Q)&&(yt[Ye++]=Ot)}return yt})(pt(W),function(Q){return Se.call(W,Q)}))}:function(){return[]},Ve=Dt;function xt(W,Q){return!!(Q=Q??l)&&(typeof W=="number"||H.test(W))&&W>-1&&W%1==0&&W<Q}function Je(W){if(W!=null){try{return Fe.call(W)}catch{}try{return W+""}catch{}}return""}function cr(W,Q){return W===Q||W!=W&&Q!=Q}(St&&Ve(new St(new ArrayBuffer(1)))!=z||Ct&&Ve(new Ct)!=N||Tt&&Ve(Tt.resolve())!="[object Promise]"||Bt&&Ve(new Bt)!=A||Ke&&Ve(new Ke)!="[object WeakMap]")&&(Ve=function(W){var Q=Dt(W),we=Q==m?W.constructor:void 0,Ae=we?Je(we):"";if(Ae)switch(Ae){case _t:return z;case Ut:return N;case kt:return"[object Promise]";case Vt:return A;case S:return"[object WeakMap]"}return Q});var Or=Mt((function(){return arguments})())?Mt:function(W){return ar(W)&&ue.call(W,"callee")&&!Se.call(W,"callee")},rr=Array.isArray,Lr=jt||function(){return!1};function Ht(W){if(!$e(W))return!1;var Q=Dt(W);return Q==g||Q==v||Q==p||Q==_}function Mr(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=l}function $e(W){var Q=typeof W;return W!=null&&(Q=="object"||Q=="function")}function ar(W){return W!=null&&typeof W=="object"}var kr=pe?(function(W){return function(Q){return W(Q)}})(pe):function(W){return ar(W)&&Mr(W.length)&&!!F[Dt(W)]};function ut(W){return(Q=W)!=null&&Mr(Q.length)&&!Ht(Q)?He(W):Et(W);var Q}i.exports=function(W,Q){return $t(W,Q)}}).call(this,a(23)(n))},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(18);s.StringPredicate=i.StringPredicate;const o=a(20);s.NumberPredicate=o.NumberPredicate;const c=a(21);s.BooleanPredicate=c.BooleanPredicate;const d=a(0),f=a(22);s.ArrayPredicate=f.ArrayPredicate;const l=a(24);s.ObjectPredicate=l.ObjectPredicate;const h=a(29);s.DatePredicate=h.DatePredicate;const u=a(30);s.ErrorPredicate=u.ErrorPredicate;const p=a(31);s.MapPredicate=p.MapPredicate;const b=a(32);s.WeakMapPredicate=b.WeakMapPredicate;const w=a(33);s.SetPredicate=w.SetPredicate;const x=a(34);s.WeakSetPredicate=x.WeakSetPredicate;const g=a(35);s.AnyPredicate=g.AnyPredicate,s.default=((v,N)=>(Object.defineProperties(v,{string:{get:()=>new i.StringPredicate(N)},number:{get:()=>new o.NumberPredicate(N)},boolean:{get:()=>new c.BooleanPredicate(N)},undefined:{get:()=>new d.Predicate("undefined",N)},null:{get:()=>new d.Predicate("null",N)},nullOrUndefined:{get:()=>new d.Predicate("nullOrUndefined",N)},nan:{get:()=>new d.Predicate("nan",N)},symbol:{get:()=>new d.Predicate("symbol",N)},array:{get:()=>new f.ArrayPredicate(N)},object:{get:()=>new l.ObjectPredicate(N)},date:{get:()=>new h.DatePredicate(N)},error:{get:()=>new u.ErrorPredicate(N)},map:{get:()=>new p.MapPredicate(N)},weakMap:{get:()=>new b.WeakMapPredicate(N)},set:{get:()=>new w.SetPredicate(N)},weakSet:{get:()=>new x.WeakSetPredicate(N)},function:{get:()=>new d.Predicate("Function",N)},buffer:{get:()=>new d.Predicate("Buffer",N)},regExp:{get:()=>new d.Predicate("RegExp",N)},promise:{get:()=>new d.Predicate("Promise",N)},typedArray:{get:()=>new d.Predicate("TypedArray",N)},int8Array:{get:()=>new d.Predicate("Int8Array",N)},uint8Array:{get:()=>new d.Predicate("Uint8Array",N)},uint8ClampedArray:{get:()=>new d.Predicate("Uint8ClampedArray",N)},int16Array:{get:()=>new d.Predicate("Int16Array",N)},uint16Array:{get:()=>new d.Predicate("Uint16Array",N)},int32Array:{get:()=>new d.Predicate("Int32Array",N)},uint32Array:{get:()=>new d.Predicate("Uint32Array",N)},float32Array:{get:()=>new d.Predicate("Float32Array",N)},float64Array:{get:()=>new d.Predicate("Float64Array",N)},arrayBuffer:{get:()=>new d.Predicate("ArrayBuffer",N)},dataView:{get:()=>new d.Predicate("DataView",N)},iterable:{get:()=>new d.Predicate("Iterable",N)},any:{value:(...j)=>new g.AnyPredicate(j,N)}}),v))},function(n,s,a){var i=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(4));s.default=((c,d)=>{try{for(const f of c)o.default(f,d);return!0}catch(f){return f.message}})},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.ArgumentError=class extends Error{constructor(i,o){super(i),"captureStackTrace"in Error&&Error.captureStackTrace(this,o),this.name="ArgumentError"}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(2);s.default=function o(c,d,f){f[i.testSymbol](c,o,d)}},function(n,s,a){const i=()=>{const o=Error.prepareStackTrace;Error.prepareStackTrace=((d,f)=>f);const c=new Error().stack.slice(1);return Error.prepareStackTrace=o,c};n.exports=i,n.exports.default=i},function(n,s,a){var i=this&&this.__importStar||function(h){if(h&&h.__esModule)return h;var u={};if(h!=null)for(var p in h)Object.hasOwnProperty.call(h,p)&&(u[p]=h[p]);return u.default=h,u},o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(s,"__esModule",{value:!0});const c=i(a(12)),d=o(a(13)),f=o(a(14)),l=/^.*?\((.*?)[,)]/;s.inferLabel=(h=>{if(!f.default)return;const u=h[1],p=u.getFileName(),b=u.getLineNumber(),w=u.getColumnNumber();if(!p||b===null||w===null)return;let x=[];try{x=c.readFileSync(p,"utf8").split(`
108
108
  `)}catch{return}let g=x[b-1];if(!g)return;g=g.slice(w-1);const v=l.exec(g);if(!v||!v[1])return;const N=v[1];return d.default(N)||d.default(N.split(".").pop())?N:void 0})},function(n,s){n.exports=jr},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=/^[a-z$_][a-z$_0-9]*$/i,o=new Set(["undefined","null","true","false","super","this","Infinity","NaN"]);s.default=(c=>c&&!o.has(c)&&i.test(c))},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0}),s.default=!!(typeof process<"u"&&process.versions&&process.versions.node)},function(n,s){n.exports=jr},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(0);s.not=(o=>{const c=o.addValidator;return o.addValidator=(d=>{const f=d.validator,l=d.message;return d.message=((h,u)=>`[NOT] ${l(h,u)}`),d.validator=(h=>!f(h)),o[i.validatorSymbol].push(d),o.addValidator=c,o}),o})},function(n,s,a){var i=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(6));s.default=(c=>(Object.defineProperties(c,{optional:{get:()=>o.default({},{optional:!0})}}),c))},function(n,s,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=i(a(19)),d=a(0);s.StringPredicate=class extends d.Predicate{constructor(f){super("string",f)}length(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have length \`${f}\`, got \`${l}\``,validator:l=>l.length===f})}minLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a minimum length of \`${f}\`, got \`${l}\``,validator:l=>l.length>=f})}maxLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a maximum length of \`${f}\`, got \`${l}\``,validator:l=>l.length<=f})}matches(f){return this.addValidator({message:(l,h)=>`Expected ${h} to match \`${f}\`, got \`${l}\``,validator:l=>f.test(l)})}startsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to start with \`${f}\`, got \`${l}\``,validator:l=>l.startsWith(f)})}endsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to end with \`${f}\`, got \`${l}\``,validator:l=>l.endsWith(f)})}includes(f){return this.addValidator({message:(l,h)=>`Expected ${h} to include \`${f}\`, got \`${l}\``,validator:l=>l.includes(f)})}oneOf(f){return this.addValidator({message:(l,h)=>{let u=JSON.stringify(f);if(f.length>10){const p=f.length-10;u=JSON.stringify(f.slice(0,10)).replace(/]$/,`,…+${p} more]`)}return`Expected ${h} to be one of \`${u}\`, got \`${l}\``},validator:l=>f.includes(l)})}get empty(){return this.addValidator({message:(f,l)=>`Expected ${l} to be empty, got \`${f}\``,validator:f=>f===""})}get nonEmpty(){return this.addValidator({message:(f,l)=>`Expected ${l} to not be empty`,validator:f=>f!==""})}equals(f){return this.addValidator({message:(l,h)=>`Expected ${h} to be equal to \`${f}\`, got \`${l}\``,validator:l=>l===f})}get alphanumeric(){return this.addValidator({message:(f,l)=>`Expected ${l} to be alphanumeric, got \`${f}\``,validator:f=>/^[a-z\d]+$/i.test(f)})}get alphabetical(){return this.addValidator({message:(f,l)=>`Expected ${l} to be alphabetical, got \`${f}\``,validator:f=>/^[a-z]+$/gi.test(f)})}get numeric(){return this.addValidator({message:(f,l)=>`Expected ${l} to be numeric, got \`${f}\``,validator:f=>/^(\+|-)?\d+$/i.test(f)})}get date(){return this.addValidator({message:(f,l)=>`Expected ${l} to be a date, got \`${f}\``,validator:c.default})}get lowercase(){return this.addValidator({message:(f,l)=>`Expected ${l} to be lowercase, got \`${f}\``,validator:f=>f.trim()!==""&&f===f.toLowerCase()})}get uppercase(){return this.addValidator({message:(f,l)=>`Expected ${l} to be uppercase, got \`${f}\``,validator:f=>f.trim()!==""&&f===f.toUpperCase()})}get url(){return this.addValidator({message:(f,l)=>`Expected ${l} to be a URL, got \`${f}\``,validator:o.default.urlString})}}},function(n,s,a){n.exports=function(i){return!isNaN(Date.parse(i))}},function(n,s,a){var i=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=a(0);s.NumberPredicate=class extends c.Predicate{constructor(d){super("number",d)}inRange(d,f){return this.addValidator({message:(l,h)=>`Expected ${h} to be in range [${d}..${f}], got ${l}`,validator:l=>o.default.inRange(l,[d,f])})}greaterThan(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be greater than ${d}, got ${f}`,validator:f=>f>d})}greaterThanOrEqual(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be greater than or equal to ${d}, got ${f}`,validator:f=>f>=d})}lessThan(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be less than ${d}, got ${f}`,validator:f=>f<d})}lessThanOrEqual(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be less than or equal to ${d}, got ${f}`,validator:f=>f<=d})}equal(d){return this.addValidator({message:(f,l)=>`Expected ${l} to be equal to ${d}, got ${f}`,validator:f=>f===d})}oneOf(d){return this.addValidator({message:(f,l)=>{let h=JSON.stringify(d);if(d.length>10){const u=d.length-10;h=JSON.stringify(d.slice(0,10)).replace(/]$/,`,…+${u} more]`)}return`Expected ${l} to be one of \`${h}\`, got ${f}`},validator:f=>d.includes(f)})}get integer(){return this.addValidator({message:(d,f)=>`Expected ${f} to be an integer, got ${d}`,validator:d=>o.default.integer(d)})}get finite(){return this.addValidator({message:(d,f)=>`Expected ${f} to be finite, got ${d}`,validator:d=>!o.default.infinite(d)})}get infinite(){return this.addValidator({message:(d,f)=>`Expected ${f} to be infinite, got ${d}`,validator:d=>o.default.infinite(d)})}get positive(){return this.addValidator({message:(d,f)=>`Expected ${f} to be positive, got ${d}`,validator:d=>d>0})}get negative(){return this.addValidator({message:(d,f)=>`Expected ${f} to be negative, got ${d}`,validator:d=>d<0})}get integerOrInfinite(){return this.addValidator({message:(d,f)=>`Expected ${f} to be an integer or infinite, got ${d}`,validator:d=>o.default.integer(d)||o.default.infinite(d)})}get uint8(){return this.integer.inRange(0,255)}get uint16(){return this.integer.inRange(0,65535)}get uint32(){return this.integer.inRange(0,4294967295)}get int8(){return this.integer.inRange(-128,127)}get int16(){return this.integer.inRange(-32768,32767)}get int32(){return this.integer.inRange(-2147483648,2147483647)}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(0);s.BooleanPredicate=class extends i.Predicate{constructor(o){super("boolean",o)}get true(){return this.addValidator({message:(o,c)=>`Expected ${c} to be true, got ${o}`,validator:o=>o===!0})}get false(){return this.addValidator({message:(o,c)=>`Expected ${c} to be false, got ${o}`,validator:o=>o===!1})}}},function(n,s,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(5)),c=i(a(4)),d=a(0);s.ArrayPredicate=class extends d.Predicate{constructor(f){super("array",f)}length(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have length \`${f}\`, got \`${l.length}\``,validator:l=>l.length===f})}minLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a minimum length of \`${f}\`, got \`${l.length}\``,validator:l=>l.length>=f})}maxLength(f){return this.addValidator({message:(l,h)=>`Expected ${h} to have a maximum length of \`${f}\`, got \`${l.length}\``,validator:l=>l.length<=f})}startsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to start with \`${f}\`, got \`${l[0]}\``,validator:l=>l[0]===f})}endsWith(f){return this.addValidator({message:(l,h)=>`Expected ${h} to end with \`${f}\`, got \`${l[l.length-1]}\``,validator:l=>l[l.length-1]===f})}includes(...f){return this.addValidator({message:(l,h)=>`Expected ${h} to include all elements of \`${JSON.stringify(f)}\`, got \`${JSON.stringify(l)}\``,validator:l=>f.every(h=>l.indexOf(h)!==-1)})}includesAny(...f){return this.addValidator({message:(l,h)=>`Expected ${h} to include any element of \`${JSON.stringify(f)}\`, got \`${JSON.stringify(l)}\``,validator:l=>f.some(h=>l.indexOf(h)!==-1)})}get empty(){return this.addValidator({message:(f,l)=>`Expected ${l} to be empty, got \`${JSON.stringify(f)}\``,validator:f=>f.length===0})}get nonEmpty(){return this.addValidator({message:(f,l)=>`Expected ${l} to not be empty`,validator:f=>f.length>0})}deepEqual(f){return this.addValidator({message:(l,h)=>`Expected ${h} to be deeply equal to \`${JSON.stringify(f)}\`, got \`${JSON.stringify(l)}\``,validator:l=>o.default(l,f)})}ofType(f){let l;return this.addValidator({message:(h,u)=>`(${u}) ${l}`,validator:h=>{try{for(const u of h)c.default(u,f);return!0}catch(u){return l=u.message,!1}}})}}},function(n,s){n.exports=function(a){return a.webpackPolyfill||(a.deprecate=function(){},a.paths=[],a.children||(a.children=[]),Object.defineProperty(a,"loaded",{enumerable:!0,get:function(){return a.l}}),Object.defineProperty(a,"id",{enumerable:!0,get:function(){return a.i}}),a.webpackPolyfill=1),a}},function(n,s,a){var i=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=i(a(25)),d=i(a(5)),f=a(0),l=i(a(3)),h=i(a(7)),u=i(a(27)),p=a(28);s.ObjectPredicate=class extends f.Predicate{constructor(b){super("object",b)}get plain(){return this.addValidator({message:(b,w)=>`Expected ${w} to be a plain object`,validator:b=>o.default.plainObject(b)})}get empty(){return this.addValidator({message:(b,w)=>`Expected ${w} to be empty, got \`${JSON.stringify(b)}\``,validator:b=>Object.keys(b).length===0})}get nonEmpty(){return this.addValidator({message:(b,w)=>`Expected ${w} to not be empty`,validator:b=>Object.keys(b).length>0})}valuesOfType(b){return this.addValidator({message:(w,x,g)=>`(${x}) ${g}`,validator:w=>{const x=Object.keys(w).map(g=>w[g]);return h.default(x,b)}})}deepValuesOfType(b){return this.addValidator({message:(w,x,g)=>`(${x}) ${g}`,validator:w=>u.default(w,b)})}deepEqual(b){return this.addValidator({message:(w,x)=>`Expected ${x} to be deeply equal to \`${JSON.stringify(b)}\`, got \`${JSON.stringify(w)}\``,validator:w=>d.default(w,b)})}instanceOf(b){return this.addValidator({message:(w,x)=>{let g=w.constructor.name;return g&&g!=="Object"||(g=JSON.stringify(w)),`Expected ${x} \`${g}\` to be of type \`${b.name}\``},validator:w=>w instanceof b})}hasKeys(...b){return this.addValidator({message:(w,x,g)=>`Expected ${x} to have keys \`${JSON.stringify(g)}\``,validator:w=>l.default({has:x=>c.default.has(w,x)},b)})}hasAnyKeys(...b){return this.addValidator({message:(w,x)=>`Expected ${x} to have any key of \`${JSON.stringify(b)}\``,validator:w=>b.some(x=>c.default.has(w,x))})}partialShape(b){return this.addValidator({message:(w,x,g)=>`${g.replace("Expected","Expected property")} in ${x}`,validator:w=>p.partial(w,b)})}exactShape(b){return this.addValidator({message:(w,x,g)=>`${g.replace("Expected","Expected property")} in ${x}`,validator:w=>p.exact(w,b)})}}},function(n,s,a){const i=a(26);function o(c){const d=c.split("."),f=[];for(let l=0;l<d.length;l++){let h=d[l];for(;h[h.length-1]==="\\"&&d[l+1]!==void 0;)h=h.slice(0,-1)+".",h+=d[++l];f.push(h)}return f}n.exports={get(c,d,f){if(!i(c)||typeof d!="string")return f===void 0?c:f;const l=o(d);for(let h=0;h<l.length;h++){if(!Object.prototype.propertyIsEnumerable.call(c,l[h]))return f;if((c=c[l[h]])==null){if(h!==l.length-1)return f;break}}return c},set(c,d,f){if(!i(c)||typeof d!="string")return c;const l=c,h=o(d);for(let u=0;u<h.length;u++){const p=h[u];i(c[p])||(c[p]={}),u===h.length-1&&(c[p]=f),c=c[p]}return l},delete(c,d){if(!i(c)||typeof d!="string")return;const f=o(d);for(let l=0;l<f.length;l++){const h=f[l];if(l===f.length-1)return void delete c[h];if(c=c[h],!i(c))return}},has(c,d){if(!i(c)||typeof d!="string")return!1;const f=o(d);for(let l=0;l<f.length;l++){if(!i(c)||!(f[l]in c))return!1;c=c[f[l]]}return!0}}},function(n,s,a){n.exports=function(i){var o=typeof i;return i!==null&&(o==="object"||o==="function")}},function(n,s,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=i(a(4)),d=(f,l)=>o.default.plainObject(f)?Object.keys(f).every(h=>d(f[h],l)):(c.default(f,l),!0);s.default=((f,l)=>{try{return d(f,l)}catch(h){return h.message}})},function(n,s,a){var i=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(1)),c=i(a(9)),d=a(2);s.partial=function f(l,h,u){try{for(const p of Object.keys(h)){const b=u?`${u}.${p}`:p;if(d.isPredicate(h[p]))c.default(l[p],b,h[p]);else if(o.default.plainObject(h[p])){const w=f(l[p],h[p],b);if(w!==!0)return w}}return!0}catch(p){return p.message}},s.exact=function f(l,h,u){try{const p=new Set(Object.keys(l));for(const b of Object.keys(h)){p.delete(b);const w=u?`${u}.${b}`:b;if(d.isPredicate(h[b]))c.default(l[b],w,h[b]);else if(o.default.plainObject(h[b])){if(!Object.prototype.hasOwnProperty.call(l,b))return`Expected \`${w}\` to exist`;const x=f(l[b],h[b],w);if(x!==!0)return x}}if(p.size>0){const b=Array.from(p.keys())[0];return`Did not expect property \`${u?`${u}.${b}`:b}\` to exist, got \`${l[b]}\``}return!0}catch(p){return p.message}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(0);s.DatePredicate=class extends i.Predicate{constructor(o){super("date",o)}before(o){return this.addValidator({message:(c,d)=>`Expected ${d} ${c.toISOString()} to be before ${o.toISOString()}`,validator:c=>c.getTime()<o.getTime()})}after(o){return this.addValidator({message:(c,d)=>`Expected ${d} ${c.toISOString()} to be after ${o.toISOString()}`,validator:c=>c.getTime()>o.getTime()})}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(0);s.ErrorPredicate=class extends i.Predicate{constructor(o){super("error",o)}name(o){return this.addValidator({message:(c,d)=>`Expected ${d} to have name \`${o}\`, got \`${c.name}\``,validator:c=>c.name===o})}message(o){return this.addValidator({message:(c,d)=>`Expected ${d} message to be \`${o}\`, got \`${c.message}\``,validator:c=>c.message===o})}messageIncludes(o){return this.addValidator({message:(c,d)=>`Expected ${d} message to include \`${o}\`, got \`${c.message}\``,validator:c=>c.message.includes(o)})}hasKeys(...o){return this.addValidator({message:(c,d)=>`Expected ${d} message to have keys \`${o.join("`, `")}\``,validator:c=>o.every(d=>c.hasOwnProperty(d))})}instanceOf(o){return this.addValidator({message:(c,d)=>`Expected ${d} \`${c.name}\` to be of type \`${o.name}\``,validator:c=>c instanceof o})}get typeError(){return this.instanceOf(TypeError)}get evalError(){return this.instanceOf(EvalError)}get rangeError(){return this.instanceOf(RangeError)}get referenceError(){return this.instanceOf(ReferenceError)}get syntaxError(){return this.instanceOf(SyntaxError)}get uriError(){return this.instanceOf(URIError)}}},function(n,s,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(5)),c=a(0),d=i(a(3)),f=i(a(7));s.MapPredicate=class extends c.Predicate{constructor(l){super("Map",l)}size(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have size \`${l}\`, got \`${h.size}\``,validator:h=>h.size===l})}minSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a minimum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size>=l})}maxSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a maximum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size<=l})}hasKeys(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have keys \`${JSON.stringify(p)}\``,validator:h=>d.default(h,l)})}hasAnyKeys(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any key of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>h.has(u))})}hasValues(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have values \`${JSON.stringify(p)}\``,validator:h=>d.default(new Set(h.values()),l)})}hasAnyValues(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any value of \`${JSON.stringify(l)}\``,validator:h=>{const u=new Set(h.values());return l.some(p=>u.has(p))}})}keysOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>f.default(h.keys(),l)})}valuesOfType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>f.default(h.values(),l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(Array.from(l))}\``,validator:l=>l.size===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>l.size>0})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(Array.from(l))}\`, got \`${JSON.stringify(Array.from(h))}\``,validator:h=>o.default(h,l)})}}},function(n,s,a){var i=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(s,"__esModule",{value:!0});const o=a(0),c=i(a(3));s.WeakMapPredicate=class extends o.Predicate{constructor(d){super("WeakMap",d)}hasKeys(...d){return this.addValidator({message:(f,l,h)=>`Expected ${l} to have keys \`${JSON.stringify(h)}\``,validator:f=>c.default(f,d)})}hasAnyKeys(...d){return this.addValidator({message:(f,l)=>`Expected ${l} to have any key of \`${JSON.stringify(d)}\``,validator:f=>d.some(l=>f.has(l))})}}},function(n,s,a){var i=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(s,"__esModule",{value:!0});const o=i(a(5)),c=a(0),d=i(a(3)),f=i(a(7));s.SetPredicate=class extends c.Predicate{constructor(l){super("Set",l)}size(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have size \`${l}\`, got \`${h.size}\``,validator:h=>h.size===l})}minSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a minimum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size>=l})}maxSize(l){return this.addValidator({message:(h,u)=>`Expected ${u} to have a maximum size of \`${l}\`, got \`${h.size}\``,validator:h=>h.size<=l})}has(...l){return this.addValidator({message:(h,u,p)=>`Expected ${u} to have items \`${JSON.stringify(p)}\``,validator:h=>d.default(h,l)})}hasAny(...l){return this.addValidator({message:(h,u)=>`Expected ${u} to have any item of \`${JSON.stringify(l)}\``,validator:h=>l.some(u=>h.has(u))})}ofType(l){return this.addValidator({message:(h,u,p)=>`(${u}) ${p}`,validator:h=>f.default(h,l)})}get empty(){return this.addValidator({message:(l,h)=>`Expected ${h} to be empty, got \`${JSON.stringify(Array.from(l))}\``,validator:l=>l.size===0})}get nonEmpty(){return this.addValidator({message:(l,h)=>`Expected ${h} to not be empty`,validator:l=>l.size>0})}deepEqual(l){return this.addValidator({message:(h,u)=>`Expected ${u} to be deeply equal to \`${JSON.stringify(Array.from(l))}\`, got \`${JSON.stringify(Array.from(h))}\``,validator:h=>o.default(h,l)})}}},function(n,s,a){var i=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(s,"__esModule",{value:!0});const o=a(0),c=i(a(3));s.WeakSetPredicate=class extends o.Predicate{constructor(d){super("WeakSet",d)}has(...d){return this.addValidator({message:(f,l,h)=>`Expected ${l} to have items \`${JSON.stringify(h)}\``,validator:f=>c.default(f,d)})}hasAny(...d){return this.addValidator({message:(f,l)=>`Expected ${l} to have any item of \`${JSON.stringify(d)}\``,validator:f=>d.some(l=>f.has(l))})}}},function(n,s,a){Object.defineProperty(s,"__esModule",{value:!0});const i=a(8),o=a(2);s.AnyPredicate=class{constructor(c,d={}){this.predicates=c,this.options=d}[o.testSymbol](c,d,f){const l=["Any predicate failed with the following errors:"];for(const h of this.predicates)try{return void d(c,f,h)}catch(u){if(c===void 0&&this.options.optional===!0)return;l.push(`- ${u.message}`)}throw new i.ArgumentError(l.join(`
109
109
  `),d)}}}]);const r=t.exports;t.exports=r.default,Object.assign(t.exports,r)})(li)),li.exports}var ui={},qs={},Xl;function dm(){if(Xl)return qs;Xl=1,Object.defineProperty(qs,"__esModule",{value:!0});let t=class uo{constructor(n){this.pretty=!1,this.pretty=n}format(n,s){const a=Object.assign({},s,n);return this.pretty?JSON.stringify(a,void 0,2)+`
110
110
  `:JSON.stringify(a)}getName(){return this.pretty?uo.FORMAT_NAME_PRETTY:uo.FORMAT_NAME}};return t.FORMAT_NAME="json",t.FORMAT_NAME_PRETTY="json_pretty",qs.JsonLogFormat=t,qs}var Hs={},ci={},Kl;function Mn(){return Kl||(Kl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),(function(r){r.EMPTY_METADATA={};function n(s){let a=s.service?`${s.service}.`:s.project?`${s.project}.`:"";return a+=s.module?`${s.module}.`:"",a+=s.library?`[${s.library}].`:"",a+=s.tag||"",a||(a="universe-log-empty-id"),a}r.getBestIdentifier=n})(t.LogMetadata||(t.LogMetadata={}))})(ci)),ci}var zs={},Ql;function kd(){if(Ql)return zs;Ql=1,Object.defineProperty(zs,"__esModule",{value:!0});let t=class{static getTimestamp(){return Date.now()}static getUTCISOTime(){return new Date().toISOString()}};return zs.TimeUtils=t,zs}var eu;function fm(){if(eu)return Hs;eu=1,Object.defineProperty(Hs,"__esModule",{value:!0});const t=Mn(),r=kd();let n=class Ed{format(a,i){const o=a.time_iso||new Date(a.timestamp).toISOString()||r.TimeUtils.getUTCISOTime();return`${t.LogMetadata.getBestIdentifier(i)} | ${o} [${a.level}]: ${a.message}`+this.includeStackIfPresent(a)}getName(){return Ed.FORMAT_NAME}includeStackIfPresent(a){return a.error&&a.error.stack?`
@@ -1068,7 +1068,7 @@ and ensure you are accounting for this risk.
1068
1068
  text-sm sm:text-base px-3 py-2 sm:px-4 sm:py-3 shadow
1069
1069
  ${i===0||c?"bg-blue-300 text-white cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 text-white"}`,children:c?e.jsxs(e.Fragment,{children:[e.jsx(O.Loader2,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1 animate-spin"}),"Voting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(O.ThumbsUp,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1"}),"Vote"]})}),e.jsxs("button",{onClick:a,disabled:c,className:`flex-1 flex items-center justify-center rounded-full font-semibold text-sm sm:text-base px-3 py-2 sm:px-4 sm:py-3 shadow
1070
1070
  bg-gray-700 hover:bg-gray-600 text-white
1071
- disabled:opacity-50 disabled:cursor-not-allowed`,children:[e.jsx(O.X,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1"}),"Cancel"]})]})]})})}const Po=({comment:t,allComments:r,onReply:n,currentUser:s,token:a,searchQuery:i,depth:o=0,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l})=>{const[h,u]=k.useState(!1),[p,b]=k.useState(!0),[w,x]=k.useState(!1),g=k.useMemo(()=>{const ee=t.active_votes||[];if(!s)return!1;const te=s.toLowerCase();return ee.some(_e=>(_e.voter||"").toLowerCase()===te)},[t.active_votes,s]),[v,N]=k.useState(!1),[j,y]=k.useState(""),[m,_]=k.useState(!1),E=ee=>{y(ee),N(!0),setTimeout(()=>N(!1),2500)},A=t.depth||0;let T=r.filter(ee=>ee.parent_author===t.author&&ee.parent_permlink===t.permlink&&(typeof ee.depth!="number"||ee.depth===A+1));if((!T||T.length===0)&&Array.isArray(t.replies)&&t.replies.length>0){const ee=new Set(t.replies);T=r.filter(te=>ee.has(`${te.author}/${te.permlink}`))}const D=T.length>0,L=o>=4,z=(ee,te)=>{if(!te)return ee;const _e=new RegExp(`(${te})`,"gi");return ee.replace(_e,'<mark class="bg-yellow-800">$1</mark>')},U=()=>{x(!0)},H=async ee=>{if(d){try{await Promise.resolve(d(t.author,t.permlink,ee)),u(!0),x(!1),setTimeout(()=>{c?.(),E("Vote submitted successfully!")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}return}if(!a){E("Please login or provide an upvote handler to vote");return}try{const te=Math.round(ee*100);await Nt.handleUpvote({author:t.author,permlink:t.permlink,weight:te,authToken:a}),u(!0),x(!1),_(!0),setTimeout(()=>{c?.(),_(!1),E("Vote submitted successfully ✅")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}},F=()=>{s?n(t.author,t.permlink):E("Please login to upvote")},Y=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),G=t.body||"",ie=(ee=>{const te=/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu;return ee.replace(te,"").trim()})(G),xe=i?z(ie,i):ie,V=/!\[[^\]]*\]\([^)]+\)/.test(ie)||/<img\s/i.test(ie),q=Array.isArray(Y?.image)?Y.image:[],B=new Vn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:ee=>ee,usertagUrlFn:ee=>`/@${ee}`,hashtagUrlFn:ee=>`/trending/${ee}`,isLinkSafeFn:ee=>!0,addExternalCssClassToMatchingLinksFn:ee=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),pe=t.stats?.total_votes||t.net_votes||0;return e.jsxs("div",{className:`${o>0?"ml-4 md:ml-8 border-l-2 border-gray-700 pl-4 md:pl-6":""}`,children:[e.jsx("div",{className:"group hover:bg-gray-800/50 transition-colors duration-200 p-4 md:p-6",children:e.jsxs("div",{className:"flex items-start space-x-3 md:space-x-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-8 h-8 md:w-10 md:h-10 rounded-full object-cover ring-2 ring-gray-700",onError:ee=>{ee.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-2",children:[e.jsxs("button",{className:"font-semibold text-white hover:text-blue-400 transition-colors duration-200 text-sm md:text-base",onClick:()=>{},children:["@",t.author]}),e.jsxs("div",{className:"flex items-center text-xs md:text-sm text-gray-400 space-x-1",children:[e.jsx(O.Clock,{className:"w-3 h-3 md:w-4 md:h-4"}),e.jsx("span",{children:bs.formatDistanceToNow(new Date(t.created+"Z"),{addSuffix:!0})})]}),t.author===s&&e.jsx("span",{className:"px-2 py-1 text-xs bg-blue-900 text-blue-200 rounded-full",children:"You"})]}),e.jsx("div",{className:"prose prose-sm md:prose-base prose-invert max-w-none mb-3 comment-content text-left text-gray-100 prose-a:text-blue-400 [&>*]:text-left",children:i?e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:xe}}):e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:B.render(ie)}})}),!V&&q.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:q.map((ee,te)=>e.jsx("img",{src:ee,alt:`image-${te}`,className:"max-w-full h-auto rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>window.open(ee,"_blank")},ee+te))}),e.jsxs("div",{className:"flex items-center space-x-4 md:space-x-6",children:[e.jsxs("button",{onClick:()=>{if(d){if(!s){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}U()}else if(l){if(!s){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}U()}else{if(!s){E("Please login to upvote");return}a?g?E("You have already upvoted this comment"):U():(c?.(),E("Vote submitted successfully ✅"))}},className:`flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium transition-colors duration-200 ${h?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,children:[e.jsx(O.ThumbsUp,{className:`w-4 h-4 ${g||h?"fill-current text-blue-400":""}`}),e.jsx("span",{children:pe})]}),e.jsxs("button",{onClick:()=>{f?f(t):F()},className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:[e.jsx(O.MessageSquare,{className:"w-4 h-4"}),e.jsx("span",{children:"Reply"})]}),D&&e.jsx("button",{onClick:()=>b(!p),className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:e.jsxs("span",{children:[p?"Hide":"Show"," ",T.length," ",T.length===1?"reply":"replies"]})}),e.jsx("button",{onClick:()=>f?.(t),className:"opacity-0 group-hover:opacity-100 p-1 rounded-full hover:bg-gray-700 transition-all duration-200",children:e.jsx(O.MoreHorizontal,{className:"w-4 h-4 text-gray-400"})})]}),w&&!g&&e.jsx("div",{className:"mt-3",children:e.jsx(qn,{author:t.author,permlink:t.permlink,onUpvote:H,onCancel:()=>x(!1)})}),m&&e.jsxs("div",{className:"mt-3 inline-flex items-center text-xs text-gray-400",children:[e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mr-2"}),"Updating votes..."]}),v&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:j})})]})]})}),D&&p&&!L&&e.jsx("div",{className:"space-y-0",children:T.map(ee=>e.jsx(Po,{comment:ee,allComments:r,onReply:n,currentUser:s,searchQuery:i,depth:o+1,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l},ee.permlink))}),D&&L&&e.jsx("div",{className:"ml-4 md:ml-8 p-3 text-sm text-gray-400 border-l-2 border-gray-700 pl-4",children:e.jsxs("button",{onClick:()=>{console.log("Show more replies for:",t.author,t.permlink)},className:"text-blue-400 hover:underline",children:["View ",T.length," more ",T.length===1?"reply":"replies"]})})]})},e0=({onImageUploaded:t,ecencyToken:r,disabled:n=!1})=>{const s=k.useRef(null),[a,i]=k.useState(!1),[o,c]=k.useState(null),[d,f]=k.useState(null),l=p=>{const b=p.target.files?.[0];if(b){if(!b.type.startsWith("image/")){c("Please select an image file");return}if(b.size>10*1024*1024){c("File size must be less than 10MB");return}c(null),f(URL.createObjectURL(b)),h(b)}},h=async p=>{i(!0),c(null);try{if(!r)throw new Error("Upload token not provided. Please pass ecencyToken prop.");const b=new FormData;b.append("file",p);const w=await fetch("https://images.ecency.com/hs/"+r,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:b});if(!w.ok)throw new Error(`Upload failed: ${w.statusText}`);const x=await w.json();if(x.url)t(x.url),f(null),s.current&&(s.current.value="");else throw new Error("No URL returned from upload")}catch(b){c(b instanceof Error?b.message:"Failed to upload image")}finally{i(!1)}},u=()=>{f(null),c(null),s.current&&(s.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:s,type:"file",accept:"image/*",onChange:l,className:"hidden",disabled:n||a}),e.jsx("button",{type:"button",onClick:()=>!n&&!a&&s.current?.click(),disabled:n||a,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Image",children:a?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Upload,{className:"h-4 w-4"})}),(d||o)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:o?"Upload Error":"Image Preview"}),e.jsx("button",{type:"button",onClick:u,className:"p-1 hover:bg-gray-800 rounded",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-300"})})]}),e.jsx("div",{className:"p-4",children:o?e.jsx("div",{className:"text-red-400 text-sm",children:o}):d?e.jsxs("div",{className:"space-y-4",children:[e.jsx("img",{src:d,alt:"Preview",className:"w-full max-h-64 object-contain rounded"}),a&&e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"h-6 w-6 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Uploading image..."})]})]}):null})]})})]})},mo="https://audio.3speak.tv",rp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",ap=".mp3,.wav,.ogg,.m4a,.aac,.flac,.weba,.opus,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/webm,audio/opus",sp=50*1024*1024,Ji=300;function Uc(t){const r=Math.floor(t/60),n=t%60;return`${r}:${String(n).padStart(2,"0")}`}function np(t){return new Promise(r=>{const n=URL.createObjectURL(t),s=new Audio;s.addEventListener("loadedmetadata",()=>{const a=s.duration;URL.revokeObjectURL(n),r(Number.isFinite(a)?Math.round(a):0)}),s.addEventListener("error",()=>{URL.revokeObjectURL(n),r(0)}),s.src=n})}const ip=/\.(mp3|wav|ogg|m4a|aac|flac|weba|opus)$/i;function op(t){return ip.test(t)}function lp(t){return t.split(".").pop()?.toLowerCase()??"m4a"}function up(t){return`${mo}/play?a=${t}&mode=minimal&iframe=1`}function cp(){const t=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];for(const r of t)if(typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(r))return r;return""}const t0=({onAudioUploaded:t,username:r,threeSpeakApiKey:n,disabled:s=!1})=>{const a=n||rp,i=k.useRef(null),o=k.useRef(null),c=k.useRef([]),d=k.useRef(null),f=k.useRef(null),[l,h]=k.useState(null),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(null),[D,L]=k.useState(null),[z,U]=k.useState(null);k.useEffect(()=>()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null)},[]),k.useEffect(()=>{x&&v>=Ji&&Y()},[x,v]);const H=k.useCallback(()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null),o.current&&o.current.state!=="inactive"&&o.current.stop(),o.current=null,c.current=[],h(null),p(!1),w(null),g(!1),N(0),y(null),_(null),A(!1),T(null),L(null),U(null),i.current&&(i.current.value="")},[m,D]),F=async()=>{w(null),y(null),m&&URL.revokeObjectURL(m),_(null),N(0);try{const ee=await navigator.mediaDevices.getUserMedia({audio:!0}),te=new MediaRecorder(ee,{mimeType:cp()});o.current=te,c.current=[],te.ondataavailable=_e=>{_e.data.size>0&&c.current.push(_e.data)},te.onstop=()=>{ee.getTracks().forEach(K=>K.stop());const _e=new Blob(c.current,{type:te.mimeType}),Ie=URL.createObjectURL(_e);y(_e),_(Ie),g(!1),d.current&&clearInterval(d.current)},te.start(100),g(!0),d.current=setInterval(()=>{N(_e=>_e+1)},1e3)}catch{w("Microphone access denied. Please allow microphone permission.")}},Y=()=>{o.current&&o.current.state!=="inactive"&&o.current.stop()},G=()=>{m&&URL.revokeObjectURL(m),f.current&&(f.current.pause(),f.current=null),y(null),_(null),N(0),A(!1),w(null)},ne=()=>{if(!m)return;if(E&&f.current){f.current.pause(),A(!1);return}const ee=new Audio(m);f.current=ee,ee.onended=()=>A(!1),ee.play(),A(!0)},ie=async()=>{if(!j)return;const ee=new File([j],`recording-${Date.now()}.webm`,{type:j.type});await B(ee,v)},xe=ee=>{const te=ee.target.files?.[0];if(te){if(te.type.startsWith("video/")){w("Video files are not allowed. Please select an audio file.");return}if(!te.type.startsWith("audio/")&&!op(te.name)){w("Please select an audio file (MP3, WAV, OGG, M4A, etc.)");return}if(te.size>sp){w("File size must be less than 50MB");return}w(null),T(te),U(te.name),L(URL.createObjectURL(te)),h("gallery-preview")}},V=async()=>{if(!C)return;const ee=await np(C);await B(C,ee)},q=()=>{D&&URL.revokeObjectURL(D),T(null),L(null),U(null),w(null),h("pick"),i.current&&(i.current.value="")},B=async(ee,te)=>{p(!0),w(null);try{if(!r)throw new Error("Please log in to upload audio.");const _e=ee instanceof File?lp(ee.name):"webm",Ie=new FormData;Ie.append("audio",ee),Ie.append("duration",String(te)),Ie.append("format",_e),Ie.append("title",`Audio by ${r}`);const K=await fetch(`${mo}/api/audio/upload`,{method:"POST",headers:{"X-API-Key":a,"X-User":r},body:Ie});if(!K.ok){const Ne=await K.json().catch(()=>null);throw new Error(Ne?.message??Ne?.error??`Upload failed: ${K.statusText}`)}const le=await K.json();if(le.error)throw new Error(le.error);let oe;if(le.permlink)oe=up(le.permlink);else if(le.playUrl)oe=le.playUrl;else if(le.cid)oe=`${mo}/play?cid=${le.cid}&mode=minimal&iframe=1`;else throw new Error("No audio URL returned from upload");t(oe,te),H()}catch(_e){w(_e instanceof Error?_e.message:"Failed to upload audio")}finally{p(!1)}},pe=v/Ji*100;return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:i,type:"file",accept:ap,onChange:xe,className:"hidden",disabled:s||u}),e.jsx("button",{type:"button",onClick:()=>!s&&!u&&h("pick"),disabled:s||u,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Add Audio",children:u?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Music,{className:"h-4 w-4"})}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsxs("h3",{className:"text-base font-semibold text-white",children:[l==="pick"&&"Add Audio",l==="record"&&"Record Audio",l==="gallery-preview"&&"Upload Audio"]}),e.jsx("button",{type:"button",onClick:H,disabled:u,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[b&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:b}),l==="pick"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>{w(null),h("record")},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-500/15",children:e.jsx(O.Mic,{className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Record Audio"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Record up to 5 minutes from your microphone"})]})]}),e.jsxs("button",{type:"button",onClick:()=>{w(null),i.current?.click()},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-emerald-500/15",children:e.jsx(O.Upload,{className:"h-5 w-5 text-emerald-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Upload from Gallery"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Select an audio file (MP3, WAV, OGG, etc.)"})]})]}),e.jsx("p",{className:"text-center text-xs text-gray-500",children:"Max 50 MB per audio file"})]}),l==="record"&&e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:`text-3xl font-mono font-semibold tabular-nums ${x?"text-red-400":"text-white"}`,children:Uc(v)}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:x?"Recording...":j?"Recording complete":"Tap to start recording"})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-red-500 transition-all duration-1000",style:{width:`${Math.min(pe,100)}%`}})}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Max ",Uc(Ji)]}),j?e.jsxs("div",{className:"flex flex-col items-center gap-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:ne,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-white transition-colors hover:bg-gray-700",children:E?e.jsx(O.Pause,{className:"h-5 w-5"}):e.jsx(O.Play,{className:"h-5 w-5 ml-0.5"})}),e.jsx("button",{type:"button",onClick:G,disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-red-400 disabled:opacity-50",children:e.jsx(O.Trash2,{className:"h-5 w-5"})}),e.jsx("button",{type:"button",onClick:()=>{G(),F()},disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-white disabled:opacity-50",children:e.jsx(O.RotateCcw,{className:"h-5 w-5"})})]}),e.jsx("button",{type:"button",onClick:()=>{ie()},disabled:u,className:"w-full rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload Recording"})]}):e.jsx("div",{className:"flex items-center gap-4",children:e.jsx("button",{type:"button",onClick:x?Y:F,className:"flex h-16 w-16 items-center justify-center rounded-full bg-red-500 text-white shadow-lg transition-transform hover:scale-105 active:scale-95",children:x?e.jsx(O.Square,{className:"h-6 w-6 fill-current"}):e.jsx(O.Mic,{className:"h-6 w-6"})})}),!x&&!u&&e.jsx("button",{type:"button",onClick:()=>{G(),h("pick")},className:"text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]}),l==="gallery-preview"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[z&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsx(O.Music,{className:"h-4 w-4 shrink-0 text-blue-400"}),e.jsx("span",{className:"truncate",children:z})]}),D&&e.jsx("audio",{src:D,controls:!0,className:"w-full rounded-lg",preload:"metadata"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:q,disabled:u,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700 disabled:opacity-50",children:"Remove"}),e.jsx("button",{type:"button",onClick:()=>{V()},disabled:u,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload"})]}),!u&&e.jsx("button",{type:"button",onClick:q,className:"text-center text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]})]})]})})]})},dp="https://embed.3speak.tv/uploads",fp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",hp=100*1024*1024,mp=5*1024*1024,pp="video/mp4,video/quicktime,video/webm,video/3gpp,.mp4,.mov,.webm,.3gp",Vc=90;function nn(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Yi(t){const r=Math.floor(t/60),n=t%60;return`${r}:${String(n).padStart(2,"0")}`}function gp(t){return new Promise((r,n)=>{const s=document.createElement("video"),a=URL.createObjectURL(t);s.preload="metadata",s.muted=!0,s.playsInline=!0,s.onloadeddata=()=>{s.currentTime=Math.min(.75,s.duration*.25)},s.onseeked=()=>{const i=document.createElement("canvas");i.width=s.videoWidth,i.height=s.videoHeight;const o=i.getContext("2d");if(!o){URL.revokeObjectURL(a),n(new Error("Cannot create canvas context"));return}o.drawImage(s,0,0,i.width,i.height),i.toBlob(c=>{if(URL.revokeObjectURL(a),!c){n(new Error("Failed to generate thumbnail"));return}r({blob:c,dataUrl:i.toDataURL("image/jpeg",.7)})},"image/jpeg",.7)},s.onerror=()=>{URL.revokeObjectURL(a),n(new Error("Failed to load video"))},s.src=a})}function xp(t){return new Promise(r=>{const n=document.createElement("video"),s=URL.createObjectURL(t);n.preload="metadata",n.onloadedmetadata=()=>{URL.revokeObjectURL(s),r({duration:Number.isFinite(n.duration)?Math.round(n.duration):0,width:n.videoWidth||0,height:n.videoHeight||0})},n.onerror=()=>{URL.revokeObjectURL(s),r({duration:0,width:0,height:0})},n.src=s})}async function bp(t,r){const n=new FormData;n.append("file",t,`video-thumbnail-${Date.now()}.jpg`);const s=await fetch(`https://images.ecency.com/hs/${r}`,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:n});if(!s.ok)throw new Error(`Thumbnail upload failed: ${s.statusText}`);const a=await s.json();if(!a.url)throw new Error("No URL returned from thumbnail upload");return a.url}async function yp(t,r,n){await fetch(`https://embed.3speak.tv/video/${t}/thumbnail`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":n},body:JSON.stringify({thumbnail_url:r})}).catch(()=>{})}function vp(t){try{const r=new URL(t).searchParams.get("v");if(!r)return null;const n=r.split("/");return n[n.length-1]||null}catch{return null}}async function wp(t,r,n,s,a,i){const{Upload:o}=await import("tus-js-client");return new Promise((c,d)=>{let f=null;const l=new o(t,{endpoint:dp,metadata:{filename:t.name,filetype:t.type||"video/mp4",frontend_app:"hive-react-kit",owner:r,short:"true",duration:String(n)},chunkSize:mp,retryDelays:[0,2e3,5e3,1e4],headers:{"X-API-Key":s},onProgress:(u,p)=>{p&&a({bytesUploaded:u,bytesTotal:p,percentage:Number((u/p*100).toFixed(1))})},onAfterResponse:(u,p)=>{const b=p.getHeader("X-Embed-URL");b&&(f=b)},onError:u=>d(i.aborted?new Error("Upload aborted"):u),onSuccess:()=>{if(!l.url||!f){d(new Error("3Speak upload completed without required URLs."));return}c({embedUrl:f,uploadUrl:l.url})}}),h=()=>{l.abort(!0).catch(()=>{}),d(new Error("Upload aborted"))};if(i.aborted){h();return}i.addEventListener("abort",h),l.findPreviousUploads().then(u=>{u.length>0&&l.resumeFromPreviousUpload(u[0]),l.start()}).catch(d)})}const r0=({onVideoUploaded:t,username:r,ecencyToken:n,threeSpeakApiKey:s,disabled:a=!1})=>{const i=s||fp,o=k.useRef(null),c=k.useRef(null),[d,f]=k.useState(!1),[l,h]=k.useState(null),[u,p]=k.useState(null),[b,w]=k.useState(null),[x,g]=k.useState(0),[v,N]=k.useState("16/9"),[j,y]=k.useState(null),[m,_]=k.useState(!1),[E,A]=k.useState(null),[C,T]=k.useState(null);k.useEffect(()=>()=>{c.current&&c.current.abort(),j&&URL.revokeObjectURL(j)},[]);const D=k.useCallback(()=>{c.current&&(c.current.abort(),c.current=null),j&&URL.revokeObjectURL(j),f(!1),h(null),p(null),w(null),g(0),N("16/9"),y(null),_(!1),A(null),T(null),o.current&&(o.current.value="")},[j]),L=async F=>{const Y=F.target.files?.[0];if(Y){if(!Y.type.startsWith("video/")){T("Please select a video file (MP4, MOV, WebM, etc.)");return}if(Y.size>hp){T(`Video file is too large (${nn(Y.size)}). Maximum is 100 MB.`);return}T(null),h(Y),y(URL.createObjectURL(Y));try{const G=await xp(Y);if(g(G.duration),N(G.width&&G.height?`${G.width}/${G.height}`:"9/16"),G.width&&G.height&&G.width>G.height){T(`Only portrait (vertical) videos are allowed. Your video is ${G.width}×${G.height} (landscape). Please record or crop in portrait mode.`);return}if(G.duration>Vc){T(`Video is too long (${Yi(G.duration)}). Maximum is ${Yi(Vc)}.`);return}const ne=await gp(Y);p(ne.dataUrl),w(ne.blob)}catch{console.warn("Failed to generate thumbnail")}}},z=async()=>{if(!l||!r){T(r?"No video selected.":"Please log in to upload videos.");return}_(!0),T(null),A({bytesUploaded:0,bytesTotal:l.size,percentage:0});const F=new AbortController;c.current=F;try{let Y=Promise.resolve(null);b&&n&&(Y=bp(b,n).catch(()=>null));const G=await wp(l,r,x,i,xe=>A(xe),F.signal),ne=await Y;if(ne&&G.embedUrl){const xe=vp(G.embedUrl);xe&&await yp(xe,ne,i)}const ie=l;t(G.embedUrl,G.uploadUrl,v,ie),D()}catch(Y){F.signal.aborted||T(Y instanceof Error?Y.message:"Failed to upload video.")}finally{_(!1),c.current=null}},U=()=>{c.current&&(c.current.abort(),c.current=null),_(!1),A(null)},H=()=>{j&&URL.revokeObjectURL(j),h(null),p(null),w(null),g(0),y(null),T(null),A(null),o.current&&(o.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:o,type:"file",accept:pp,onChange:L,className:"hidden",disabled:a||m}),e.jsx("button",{type:"button",onClick:()=>{!a&&!m&&(T(null),f(!0),o.current?.click())},disabled:a||m,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Video",children:m?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Video,{className:"h-4 w-4"})}),d&&l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"Upload Video"}),e.jsx("button",{type:"button",onClick:D,disabled:m,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[C&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:C}),e.jsxs("div",{className:"flex gap-3 mb-4",children:[e.jsxs("div",{className:"relative h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-gray-800 border border-gray-700",children:[u?e.jsx("img",{src:u,alt:"Thumbnail",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(O.Video,{className:"h-8 w-8 text-gray-500"})}),!m&&!C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(O.Play,{className:"h-5 w-5 text-white ml-0.5"})})]}),e.jsxs("div",{className:"flex flex-col justify-center min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:l.name}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[nn(l.size),x>0&&` · ${Yi(x)}`]})]})]}),j&&!m&&e.jsx("div",{className:"mb-4 overflow-hidden rounded-lg bg-black",style:{maxHeight:"280px"},children:e.jsx("video",{src:j,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"280px"}})}),m&&E&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Uploading..."}),e.jsxs("span",{className:"text-xs font-medium text-white",children:[E.percentage.toFixed(0),"%"]})]}),e.jsx("div",{className:"h-2 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-300",style:{width:`${E.percentage}%`}})}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:[nn(E.bytesUploaded)," / ",nn(E.bytesTotal)]})]}),e.jsx("div",{className:"flex gap-2",children:m?e.jsx("button",{type:"button",onClick:U,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:H,className:"flex items-center justify-center gap-1.5 flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:[e.jsx(O.Trash2,{className:"h-3.5 w-3.5"}),"Remove"]}),e.jsx("button",{type:"button",onClick:()=>{z()},disabled:!!C,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:"Upload Video"})]})})]})]})})]})},a0=({isOpen:t,onClose:r,onSelectGif:n,giphyApiKey:s})=>{const[a,i]=k.useState(""),[o,c]=k.useState([]),[d,f]=k.useState(!1),[l,h]=k.useState(null),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{t&&setTimeout(()=>u.current?.focus(),100)},[t]);const b=async g=>{if(!g.trim())return;p.current?.abort();const v=new AbortController;p.current=v,f(!0),h(null);try{if(!s)throw new Error("GIPHY API key not provided. Pass giphyApiKey prop.");const N=await fetch(`https://api.giphy.com/v1/gifs/search?api_key=${s}&q=${encodeURIComponent(g)}&limit=20&rating=g`,{signal:v.signal});if(!N.ok)throw new Error(`Failed to fetch GIFs: ${N.statusText}`);const j=await N.json();c(j.data||[])}catch(N){if(v.signal.aborted)return;h(N instanceof Error?N.message:"Failed to search GIFs")}finally{v.signal.aborted||f(!1)}},w=g=>{g.preventDefault(),b(a)},x=g=>{const v=g.images.original?.url||g.images.downsized?.url||g.images.fixed_height?.url;v&&(n(v),r())};return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col",onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a GIF"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded transition-colors text-gray-400",children:e.jsx(O.X,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("form",{onSubmit:w,className:"mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:u,type:"text",value:a,onChange:g=>i(g.target.value),placeholder:"Search for GIFs...",className:"flex-1 px-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-400"}),e.jsxs("button",{type:"submit",disabled:d||!a.trim(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 flex items-center gap-2",children:[e.jsx(O.Search,{className:"h-4 w-4"}),"Search"]})]})}),l&&e.jsx("div",{className:"text-red-400 text-sm mb-4",children:l}),d&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-500 border-t-transparent mx-auto"}),e.jsx("p",{className:"mt-2 text-gray-400",children:"Searching for GIFs..."})]}),o.length>0&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-96 overflow-y-auto",children:o.map(g=>e.jsxs("button",{type:"button",onClick:()=>x(g),className:"relative group rounded-lg overflow-hidden hover:ring-2 hover:ring-blue-500 transition-all",children:[e.jsx("img",{src:g.images.fixed_height?.url||g.images.downsized?.url||g.images.original?.url,alt:g.title,className:"w-full h-32 object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"bg-black/90 rounded-full p-2",children:e.jsx(O.Image,{className:"h-4 w-4 text-blue-400"})})})]},g.id))}),!d&&o.length===0&&a&&e.jsxs("div",{className:"text-center py-8 text-gray-400",children:['No GIFs found for "',a,'"']})]})]})}):null},po={Smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🫡","🤐","🤨","😐","😑","😶","🫥","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🥵","🥶","🥴","😵","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","🫤","😟","🙁","☹️","😮","😯","😲","😳","🥺","🥹","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿"],Gestures:["👋","🤚","🖐️","✋","🖖","🫱","🫲","🫳","🫴","👌","🤌","🤏","✌️","🤞","🫰","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","🫵","👍","👎","✊","👊","🤛","🤜","👏","🙌","🫶","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻"],People:["👶","🧒","👦","👧","🧑","👱","👨","🧔","👩","🧓","👴","👵","🙍","🙎","🙅","🙆","💁","🙋","🧏","🙇","🤦","🤷","👮","🕵️","💂","🥷","👷","🫅","🤴","👸","👳","👲","🧕","🤵","👰","🤰","🫃","🤱","👼","🎅","🤶","🦸","🦹","🧙","🧚","🧛","🧜","🧝"],Animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐻‍❄️","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐒","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🪱","🐛","🦋","🐌","🐞","🐜","🪰","🪲","🪳","🦟","🦗","🕷️","🐢","🐍","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈"],Food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🫐","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🫑","🌽","🥕","🫒","🧄","🧅","🥔","🍠","🥐","🥯","🍞","🥖","🥨","🧀","🥚","🍳","🧈","🥞","🧇","🥓","🥩","🍗","🍖","🌭","🍔","🍟","🍕","🫓","🥪","🥙","🧆","🌮","🌯","🫔","🥗","🥘","🫕","🥫","🍝","🍜","🍲","🍛","🍣","🍱","🥟","🦪","🍤","🍙","🍚","🍘","🍥","🥠","🥮","🍢","🍡","🍧","🍨","🍦","🥧","🧁","🍰","🎂","🍮","🍭","🍬","🍫","🍿","🍩","🍪","🌰","🥜","🍯"],Travel:["🚗","🚕","🚙","🚌","🚎","🏎️","🚓","🚑","🚒","🚐","🛻","🚚","🚛","🚜","🏍️","🛵","🚲","🛴","🛹","🛼","🚁","🛸","🚀","🛩️","✈️","🚢","⛵","🚤","🛥️","🛳️","⛴️","🚂","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","🕋","⛲","⛺","🌁","🌃","🏙️","🌄","🌅","🌆"],Objects:["⌚","📱","📲","💻","⌨️","🖥️","🖨️","🖱️","🖲️","🕹️","🗜️","💾","💿","📀","📼","📷","📸","📹","🎥","📽️","🎞️","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","💡","🔦","🕯️","🪔","🧯","🛢️","💸","💵","💴","💶","💷","🪙","💰","💳","💎","⚖️","🪜","🧰","🪛","🔧","🔨","⚒️","🛠️","⛏️","🪚","🔩","⚙️","🪤","🧲","🔫","💣","🧨","🪓","🔪","🗡️","⚔️","🛡️","🚬","⚰️","🪦","⚱️","🏺","🔮","📿","🧿","🪬","💈","⚗️"],Symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❤️‍🔥","❤️‍🩹","❣️","💕","💞","💓","💗","💖","💘","💝","💟","☮️","✝️","☪️","🕉️","☸️","✡️","🔯","🕎","☯️","☦️","🛐","⛎","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","🆔","⚛️","🉑","☢️","☣️","📴","📳","🈶","🈚","🈸","🈺","🈷️","✴️","🆚","💮","🉐","㊙️","㊗️","🈴","🈵","🈹","🈲","🅰️","🅱️","🆎","🅾️","🆑","🆘","❌","⭕","🛑","⛔","📛","🚫","💯","💢","♨️","🚷","🚯","🚳","🚱","🔞","📵","🚭","❗","❕","❓","❔","‼️","⁉️","🔅","🔆","〽️","⚠️","🚸","🔱","⚜️","🔰","♻️","✅","🈯","💹","❇️","✳️","❎","🌐","💠","🔘","🔳","🔲","⬛","⬜","◼️","◻️","◾","◽","▪️","▫️","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪"],Flags:["🏁","🚩","🎌","🏴","🏳️","🏳️‍🌈","🏳️‍⚧️","🏴‍☠️","🇦🇫","🇦🇱","🇩🇿","🇦🇸","🇦🇩","🇦🇴","🇦🇮","🇦🇬","🇦🇷","🇦🇲","🇦🇺","🇦🇹","🇧🇸","🇧🇭","🇧🇩","🇧🇧","🇧🇾","🇧🇪","🇧🇿","🇧🇯","🇧🇹","🇧🇴","🇧🇦","🇧🇼","🇧🇷","🇧🇳","🇧🇬","🇧🇫","🇧🇮","🇨🇦","🇨🇳","🇨🇴","🇨🇷","🇭🇷","🇨🇺","🇨🇿","🇩🇰","🇩🇴","🇪🇨","🇪🇬","🇸🇻","🇪🇹","🇫🇮","🇫🇷","🇩🇪","🇬🇭","🇬🇷","🇬🇹","🇭🇹","🇭🇳","🇭🇰","🇭🇺","🇮🇸","🇮🇳","🇮🇩","🇮🇷","🇮🇶","🇮🇪","🇮🇱","🇮🇹","🇯🇲","🇯🇵","🇯🇴","🇰🇿","🇰🇪","🇰🇼","🇱🇧","🇱🇾","🇱🇹","🇱🇺","🇲🇾","🇲🇽","🇲🇦","🇲🇿","🇳🇵","🇳🇱","🇳🇿","🇳🇬","🇳🇴","🇴🇲","🇵🇰","🇵🇦","🇵🇪","🇵🇭","🇵🇱","🇵🇹","🇶🇦","🇷🇴","🇷🇺","🇸🇦","🇷🇸","🇸🇬","🇸🇰","🇸🇮","🇿🇦","🇰🇷","🇪🇸","🇱🇰","🇸🇪","🇨🇭","🇹🇼","🇹🇭","🇹🇷","🇺🇦","🇦🇪","🇬🇧","🇺🇸","🇻🇪","🇻🇳"]},Np={Smileys:"😀",Gestures:"👋",People:"👤",Animals:"🐶",Food:"🍔",Travel:"✈️",Objects:"💡",Symbols:"❤️",Flags:"🏁"},Zi=Object.keys(po),s0=({isOpen:t,onClose:r,onSelectEmoji:n})=>{const[s,a]=k.useState(""),[i,o]=k.useState(Zi[0]),c=k.useRef(null),d=k.useRef(null);if(k.useEffect(()=>{t&&(a(""),o(Zi[0]),setTimeout(()=>c.current?.focus(),100))},[t]),!t)return null;const f=Object.values(po).flat(),l=s?f.filter(h=>h.includes(s)):null;return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("style",{children:".emoji-no-scrollbar::-webkit-scrollbar { display: none; }"}),e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md h-[400px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Emoji Picker"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-3 pt-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-500"}),e.jsx("input",{ref:c,type:"text",value:s,onChange:h=>a(h.target.value),placeholder:"Search emoji...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),!s&&e.jsx("div",{className:"emoji-no-scrollbar flex gap-1 px-3 pt-2 pb-1 overflow-x-auto",style:{scrollbarWidth:"none"},children:Zi.map(h=>e.jsx("button",{type:"button",onClick:()=>{o(h),d.current?.scrollTo({top:0,behavior:"smooth"})},className:`p-1.5 text-lg rounded-md transition-colors ${i===h?"bg-blue-600/20 ring-1 ring-blue-500":"hover:bg-gray-800"}`,title:h,children:Np[h]||h.charAt(0)},h))}),e.jsx("div",{ref:d,className:"emoji-no-scrollbar flex-1 overflow-y-auto p-3 min-h-0",style:{scrollbarWidth:"none"},children:s?l&&l.length>0?e.jsx("div",{className:"grid grid-cols-8 gap-1",children:l.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>n(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))}):e.jsx("p",{className:"text-center text-gray-500 text-sm py-8",children:"No emoji found"}):e.jsx("div",{className:"grid grid-cols-8 gap-1",children:po[i]?.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>n(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))})})]})]})},n0=({isOpen:t,onClose:r,onSelectTemplate:n,templates:s,authorFromUrl:a})=>{const[i,o]=k.useState(""),c=k.useRef(null);k.useEffect(()=>{t&&(o(""),setTimeout(()=>c.current?.focus(),100))},[t]);const d=l=>{const h=a?l.replace(/\{\{author\}\}/g,a):l;n(h),r()},f=s.filter(l=>l.templateName.toLowerCase().includes(i.toLowerCase())||l.template.toLowerCase().includes(i.toLowerCase()));return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full max-h-[80vh] flex flex-col",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a Template"}),e.jsx("button",{onClick:r,className:"p-1.5 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("div",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{ref:c,type:"text",value:i,onChange:l=>o(l.target.value),placeholder:"Search templates...",className:"w-full pl-10 pr-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-500 text-sm"})]}),f.length>0?e.jsx("div",{className:"space-y-2 overflow-y-auto flex-1",children:f.map(l=>e.jsx("button",{onClick:()=>d(l.template),className:"w-full text-left p-3 border border-gray-700 rounded-lg hover:bg-gray-800 hover:border-blue-500 transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(O.FileText,{className:"h-4 w-4 text-gray-500 group-hover:text-blue-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-medium text-white text-sm group-hover:text-blue-400",children:l.templateName}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 line-clamp-2",children:l.template})]})]})},l._id))}):e.jsx("div",{className:"text-center py-8 text-gray-400",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-white",children:["No templates found for “",i,"”"]}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Try a different search term"})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.FileText,{className:"h-12 w-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-white",children:"No templates available"}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Create templates via the API to use them here"})]})})]})]})}):null},on=2,Xi=10;function jp(){const t=new Date;return t.setDate(t.getDate()+7),t.toISOString().slice(0,16)}const i0=({isOpen:t,onClose:r,onSave:n,initialData:s})=>{const[a,i]=k.useState(s?.question??""),[o,c]=k.useState(s?.choices?.length?s.choices:["",""]),[d,f]=k.useState(s?.end_time?new Date(s.end_time*1e3).toISOString().slice(0,16):jp()),[l,h]=k.useState(s?.max_choices_voted??1),[u,p]=k.useState(s?.allow_vote_changes??!0),[b,w]=k.useState(s?.filters?.account_age??0),[x,g]=k.useState(s?.ui_hide_res_until_voted??!1);if(!t)return null;const v=()=>{o.length<Xi&&c([...o,""])},N=C=>{o.length>on&&c(o.filter((T,D)=>D!==C))},j=(C,T)=>{c(o.map((D,L)=>L===C?T:D))},y=o.filter(C=>C.trim()),m=a.trim().length>0&&y.length>=on&&new Date(d).getTime()>Date.now(),_=()=>{m&&(n({question:a.trim(),choices:y,end_time:Math.floor(new Date(d).getTime()/1e3),max_choices_voted:Math.min(l,y.length),allow_vote_changes:u,filters:{account_age:b},ui_hide_res_until_voted:x}),r())},E="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-blue-500 focus:outline-none",A="block text-xs font-medium text-gray-400 mb-1";return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Create Poll"}),e.jsx("button",{type:"button",onClick:r,className:"p-1.5 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Question"}),e.jsx("input",{type:"text",value:a,onChange:C=>i(C.target.value),placeholder:"Ask a question...",className:E,maxLength:256})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Choices (min ",on,", max ",Xi,")"]}),e.jsx("div",{className:"space-y-2",children:o.map((C,T)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:D=>j(T,D.target.value),placeholder:`Option ${T+1}`,className:E,maxLength:128}),o.length>on&&e.jsx("button",{type:"button",onClick:()=>N(T),className:"shrink-0 rounded p-1.5 text-gray-400 hover:bg-gray-800 hover:text-red-400",title:"Remove option",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]},T))}),o.length<Xi&&e.jsx("button",{type:"button",onClick:v,className:"mt-2 text-xs text-blue-400 hover:text-blue-300 font-medium",children:"+ Add option"})]}),e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Poll ends at"}),e.jsx("input",{type:"datetime-local",value:d,onChange:C=>f(C.target.value),className:E,min:new Date().toISOString().slice(0,16)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Max choices a voter can select (",l,")"]}),e.jsx("input",{type:"range",min:1,max:Math.max(y.length,1),value:l,onChange:C=>h(Number(C.target.value)),className:"w-full accent-blue-500"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:C=>p(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Allow voters to change their vote"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Minimum account age to vote (days): ",b]}),e.jsx("input",{type:"number",min:0,max:365,value:b,onChange:C=>w(Math.max(0,Number(C.target.value))),className:E})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:C=>g(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Hide results until user has voted"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-gray-700",children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-lg px-4 py-2 text-sm text-gray-400 hover:bg-gray-800",children:"Cancel"}),e.jsx("button",{type:"button",onClick:_,disabled:!m,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white disabled:opacity-50 hover:bg-blue-700",children:"Attach Poll"})]})]})]})},ln="https://hreplier-api.sagarkothari88.one/data/templates",un=t=>({Authorization:t,"Content-Type":"application/json"}),o0={async getTemplates(t,r){const s=await fetch(r||ln,{method:"GET",headers:un(t)});if(!s.ok)throw(await s.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to fetch templates: ${s.status} ${s.statusText}`);return(await s.json()).map(i=>({_id:i._id,name:i.name,templateName:i.templateName,template:i.template}))},async createTemplate(t,r,n,s){const i=await fetch(s||ln,{method:"POST",headers:un(t),body:JSON.stringify({templateName:r,template:n})});if(!i.ok)throw(await i.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to create template: ${i.status}`);const o=await i.json();return{_id:o._id,name:o.name,templateName:o.templateName,template:o.template}},async updateTemplate(t,r,n,s,a){const o=await fetch(a||ln,{method:"PUT",headers:un(t),body:JSON.stringify({id:r,templateName:n,template:s})});if(!o.ok)throw(await o.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to update template: ${o.status}`);const c=await o.json();return{_id:c._id,name:c.name,templateName:c.templateName,template:c.template}},async deleteTemplate(t,r,n){const a=await fetch(`${n||ln}/${r}`,{method:"DELETE",headers:un(t)});if(!a.ok)throw(await a.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to delete template: ${a.status}`)}};var Ki,qc;function Hc(){if(qc)return Ki;qc=1;const{entries:t,setPrototypeOf:r,isFrozen:n,getPrototypeOf:s,getOwnPropertyDescriptor:a}=Object;let{freeze:i,seal:o,create:c}=Object,{apply:d,construct:f}=typeof Reflect<"u"&&Reflect;i||(i=function(fe){return fe}),o||(o=function(fe){return fe}),d||(d=function(fe,ke){for(var Se=arguments.length,Be=new Array(Se>2?Se-2:0),Ge=2;Ge<Se;Ge++)Be[Ge-2]=arguments[Ge];return fe.apply(ke,Be)}),f||(f=function(fe){for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return new fe(...Se)});const l=E(Array.prototype.forEach),h=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),b=E(Array.prototype.splice),w=E(String.prototype.toLowerCase),x=E(String.prototype.toString),g=E(String.prototype.match),v=E(String.prototype.replace),N=E(String.prototype.indexOf),j=E(String.prototype.trim),y=E(Object.prototype.hasOwnProperty),m=E(RegExp.prototype.test),_=A(TypeError);function E(ve){return function(fe){fe instanceof RegExp&&(fe.lastIndex=0);for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return d(ve,fe,Se)}}function A(ve){return function(){for(var fe=arguments.length,ke=new Array(fe),Se=0;Se<fe;Se++)ke[Se]=arguments[Se];return f(ve,ke)}}function C(ve,fe){let ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w;r&&r(ve,null);let Se=fe.length;for(;Se--;){let Be=fe[Se];if(typeof Be=="string"){const Ge=ke(Be);Ge!==Be&&(n(fe)||(fe[Se]=Ge),Be=Ge)}ve[Be]=!0}return ve}function T(ve){for(let fe=0;fe<ve.length;fe++)y(ve,fe)||(ve[fe]=null);return ve}function D(ve){const fe=c(null);for(const[ke,Se]of t(ve))y(ve,ke)&&(Array.isArray(Se)?fe[ke]=T(Se):Se&&typeof Se=="object"&&Se.constructor===Object?fe[ke]=D(Se):fe[ke]=Se);return fe}function L(ve,fe){for(;ve!==null;){const Se=a(ve,fe);if(Se){if(Se.get)return E(Se.get);if(typeof Se.value=="function")return E(Se.value)}ve=s(ve)}function ke(){return null}return ke}const z=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),U=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),H=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=i(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Y=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ne=i(["#text"]),ie=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xe=i(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),V=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),pe=o(/<%[\w\W]*|[\w\W]*%>/gm),ee=o(/\$\{[\w\W]*/gm),te=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),_e=o(/^aria-[\-\w]+$/),Ie=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),K=o(/^(?:\w+script|data):/i),le=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oe=o(/^html$/i),Ne=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ce=Object.freeze({__proto__:null,ARIA_ATTR:_e,ATTR_WHITESPACE:le,CUSTOM_ELEMENT:Ne,DATA_ATTR:te,DOCTYPE_NAME:oe,ERB_EXPR:pe,IS_ALLOWED_URI:Ie,IS_SCRIPT_OR_DATA:K,MUSTACHE_EXPR:B,TMPLIT_EXPR:ee});const Me={element:1,text:3,progressingInstruction:7,comment:8,document:9},Fe=function(){return typeof window>"u"?null:window},ue=function(fe,ke){if(typeof fe!="object"||typeof fe.createPolicy!="function")return null;let Se=null;const Be="data-tt-policy-suffix";ke&&ke.hasAttribute(Be)&&(Se=ke.getAttribute(Be));const Ge="dompurify"+(Se?"#"+Se:"");try{return fe.createPolicy(Ge,{createHTML(pt){return pt},createScriptURL(pt){return pt}})}catch{return console.warn("TrustedTypes policy "+Ge+" could not be created."),null}},Re=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ae(){let ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fe();const fe=X=>ae(X);if(fe.version="3.3.3",fe.removed=[],!ve||!ve.document||ve.document.nodeType!==Me.document||!ve.Element)return fe.isSupported=!1,fe;let{document:ke}=ve;const Se=ke,Be=Se.currentScript,{DocumentFragment:Ge,HTMLTemplateElement:pt,Node:jt,Element:gt,NodeFilter:St,NamedNodeMap:Ct=ve.NamedNodeMap||ve.MozNamedAttrMap,HTMLFormElement:Tt,DOMParser:Bt,trustedTypes:Ke}=ve,at=gt.prototype,_t=L(at,"cloneNode"),Ut=L(at,"remove"),kt=L(at,"nextSibling"),Vt=L(at,"childNodes"),S=L(at,"parentNode");if(typeof pt=="function"){const X=ke.createElement("template");X.content&&X.content.ownerDocument&&(ke=X.content.ownerDocument)}let P,I="";const{implementation:Z,createNodeIterator:be,createDocumentFragment:Oe,getElementsByTagName:Ze}=ke,{importNode:Ue}=Se;let He=Re();fe.isSupported=typeof t=="function"&&typeof S=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:bt,ERB_EXPR:Dt,TMPLIT_EXPR:Mt,DATA_ATTR:$t,ARIA_ATTR:Yt,IS_SCRIPT_OR_DATA:Et,ATTR_WHITESPACE:ft,CUSTOM_ELEMENT:ge}=Ce;let{IS_ALLOWED_URI:Te}=Ce,Pe=null;const ze=C({},[...z,...U,...H,...Y,...ne]);let Ve=null;const xt=C({},[...ie,...xe,...V,...q]);let Je=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),cr=null,Or=null;const rr=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Lr=!0,Ht=!0,Mr=!1,$e=!0,ar=!1,kr=!0,ut=!1,W=!1,Q=!1,we=!1,Ae=!1,ht=!1,Ye=!0,yt=!1;const Ot="user-content-";let Jt=!0,At=!1,mt={},Rt=null;const qt=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let It=null;const sr=C({},["audio","video","img","source","image","track"]);let xr=null;const br=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",nr="http://www.w3.org/1999/xhtml";let yr=nr,Ir=!1,st=null;const We=C({},[lr,ur,nr],x);let Zt=C({},["mi","mo","mn","ms","mtext"]),ir=C({},["annotation-xml"]);const Fr=C({},["title","style","font","a","script"]);let vt=null;const dr=["application/xhtml+xml","text/html"],vr="text/html";let $=null,re=null;const he=ke.createElement("form"),se=function(M){return M instanceof RegExp||M instanceof Function},ye=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(re&&re===M)){if((!M||typeof M!="object")&&(M={}),M=D(M),vt=dr.indexOf(M.PARSER_MEDIA_TYPE)===-1?vr:M.PARSER_MEDIA_TYPE,$=vt==="application/xhtml+xml"?x:w,Pe=y(M,"ALLOWED_TAGS")?C({},M.ALLOWED_TAGS,$):ze,Ve=y(M,"ALLOWED_ATTR")?C({},M.ALLOWED_ATTR,$):xt,st=y(M,"ALLOWED_NAMESPACES")?C({},M.ALLOWED_NAMESPACES,x):We,xr=y(M,"ADD_URI_SAFE_ATTR")?C(D(br),M.ADD_URI_SAFE_ATTR,$):br,It=y(M,"ADD_DATA_URI_TAGS")?C(D(sr),M.ADD_DATA_URI_TAGS,$):sr,Rt=y(M,"FORBID_CONTENTS")?C({},M.FORBID_CONTENTS,$):qt,cr=y(M,"FORBID_TAGS")?C({},M.FORBID_TAGS,$):D({}),Or=y(M,"FORBID_ATTR")?C({},M.FORBID_ATTR,$):D({}),mt=y(M,"USE_PROFILES")?M.USE_PROFILES:!1,Lr=M.ALLOW_ARIA_ATTR!==!1,Ht=M.ALLOW_DATA_ATTR!==!1,Mr=M.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ar=M.SAFE_FOR_TEMPLATES||!1,kr=M.SAFE_FOR_XML!==!1,ut=M.WHOLE_DOCUMENT||!1,we=M.RETURN_DOM||!1,Ae=M.RETURN_DOM_FRAGMENT||!1,ht=M.RETURN_TRUSTED_TYPE||!1,Q=M.FORCE_BODY||!1,Ye=M.SANITIZE_DOM!==!1,yt=M.SANITIZE_NAMED_PROPS||!1,Jt=M.KEEP_CONTENT!==!1,At=M.IN_PLACE||!1,Te=M.ALLOWED_URI_REGEXP||Ie,yr=M.NAMESPACE||nr,Zt=M.MATHML_TEXT_INTEGRATION_POINTS||Zt,ir=M.HTML_INTEGRATION_POINTS||ir,Je=M.CUSTOM_ELEMENT_HANDLING||{},M.CUSTOM_ELEMENT_HANDLING&&se(M.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Je.tagNameCheck=M.CUSTOM_ELEMENT_HANDLING.tagNameCheck),M.CUSTOM_ELEMENT_HANDLING&&se(M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Je.attributeNameCheck=M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),M.CUSTOM_ELEMENT_HANDLING&&typeof M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Je.allowCustomizedBuiltInElements=M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ar&&(Ht=!1),Ae&&(we=!0),mt&&(Pe=C({},ne),Ve=c(null),mt.html===!0&&(C(Pe,z),C(Ve,ie)),mt.svg===!0&&(C(Pe,U),C(Ve,xe),C(Ve,q)),mt.svgFilters===!0&&(C(Pe,H),C(Ve,xe),C(Ve,q)),mt.mathMl===!0&&(C(Pe,Y),C(Ve,V),C(Ve,q))),y(M,"ADD_TAGS")||(rr.tagCheck=null),y(M,"ADD_ATTR")||(rr.attributeCheck=null),M.ADD_TAGS&&(typeof M.ADD_TAGS=="function"?rr.tagCheck=M.ADD_TAGS:(Pe===ze&&(Pe=D(Pe)),C(Pe,M.ADD_TAGS,$))),M.ADD_ATTR&&(typeof M.ADD_ATTR=="function"?rr.attributeCheck=M.ADD_ATTR:(Ve===xt&&(Ve=D(Ve)),C(Ve,M.ADD_ATTR,$))),M.ADD_URI_SAFE_ATTR&&C(xr,M.ADD_URI_SAFE_ATTR,$),M.FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.FORBID_CONTENTS,$)),M.ADD_FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.ADD_FORBID_CONTENTS,$)),Jt&&(Pe["#text"]=!0),ut&&C(Pe,["html","head","body"]),Pe.table&&(C(Pe,["tbody"]),delete cr.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=M.TRUSTED_TYPES_POLICY,I=P.createHTML("")}else P===void 0&&(P=ue(Ke,Be)),P!==null&&typeof I=="string"&&(I=P.createHTML(""));i&&i(M),re=M}},De=C({},[...U,...H,...F]),lt=C({},[...Y,...G]),Xe=function(M){let ce=S(M);(!ce||!ce.tagName)&&(ce={namespaceURI:yr,tagName:"template"});const me=w(M.tagName),qe=w(ce.tagName);return st[M.namespaceURI]?M.namespaceURI===ur?ce.namespaceURI===nr?me==="svg":ce.namespaceURI===lr?me==="svg"&&(qe==="annotation-xml"||Zt[qe]):!!De[me]:M.namespaceURI===lr?ce.namespaceURI===nr?me==="math":ce.namespaceURI===ur?me==="math"&&ir[qe]:!!lt[me]:M.namespaceURI===nr?ce.namespaceURI===ur&&!ir[qe]||ce.namespaceURI===lr&&!Zt[qe]?!1:!lt[me]&&(Fr[me]||!De[me]):!!(vt==="application/xhtml+xml"&&st[M.namespaceURI]):!1},Qe=function(M){p(fe.removed,{element:M});try{S(M).removeChild(M)}catch{Ut(M)}},ct=function(M,ce){try{p(fe.removed,{attribute:ce.getAttributeNode(M),from:ce})}catch{p(fe.removed,{attribute:null,from:ce})}if(ce.removeAttribute(M),M==="is")if(we||Ae)try{Qe(ce)}catch{}else try{ce.setAttribute(M,"")}catch{}},et=function(M){let ce=null,me=null;if(Q)M="<remove></remove>"+M;else{const it=g(M,/^[\r\n\t ]+/);me=it&&it[0]}vt==="application/xhtml+xml"&&yr===nr&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const qe=P?P.createHTML(M):M;if(yr===nr)try{ce=new Bt().parseFromString(qe,vt)}catch{}if(!ce||!ce.documentElement){ce=Z.createDocument(yr,"template",null);try{ce.documentElement.innerHTML=Ir?I:qe}catch{}}const nt=ce.body||ce.documentElement;return M&&me&&nt.insertBefore(ke.createTextNode(me),nt.childNodes[0]||null),yr===nr?Ze.call(ce,ut?"html":"body")[0]:ut?ce.documentElement:nt},Pt=function(M){return be.call(M.ownerDocument||M,M,St.SHOW_ELEMENT|St.SHOW_COMMENT|St.SHOW_TEXT|St.SHOW_PROCESSING_INSTRUCTION|St.SHOW_CDATA_SECTION,null)},Xt=function(M){return M instanceof Tt&&(typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||!(M.attributes instanceof Ct)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function")},Lt=function(M){return typeof jt=="function"&&M instanceof jt};function dt(X,M,ce){l(X,me=>{me.call(fe,M,ce,re)})}const or=function(M){let ce=null;if(dt(He.beforeSanitizeElements,M,null),Xt(M))return Qe(M),!0;const me=$(M.nodeName);if(dt(He.uponSanitizeElement,M,{tagName:me,allowedTags:Pe}),kr&&M.hasChildNodes()&&!Lt(M.firstElementChild)&&m(/<[/\w!]/g,M.innerHTML)&&m(/<[/\w!]/g,M.textContent)||M.nodeType===Me.progressingInstruction||kr&&M.nodeType===Me.comment&&m(/<[/\w]/g,M.data))return Qe(M),!0;if(!(rr.tagCheck instanceof Function&&rr.tagCheck(me))&&(!Pe[me]||cr[me])){if(!cr[me]&&ra(me)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me)))return!1;if(Jt&&!Rt[me]){const qe=S(M)||M.parentNode,nt=Vt(M)||M.childNodes;if(nt&&qe){const it=nt.length;for(let ot=it-1;ot>=0;--ot){const Ft=_t(nt[ot],!0);Ft.__removalCount=(M.__removalCount||0)+1,qe.insertBefore(Ft,kt(M))}}}return Qe(M),!0}return M instanceof gt&&!Xe(M)||(me==="noscript"||me==="noembed"||me==="noframes")&&m(/<\/no(script|embed|frames)/i,M.innerHTML)?(Qe(M),!0):(ar&&M.nodeType===Me.text&&(ce=M.textContent,l([bt,Dt,Mt],qe=>{ce=v(ce,qe," ")}),M.textContent!==ce&&(p(fe.removed,{element:M.cloneNode()}),M.textContent=ce)),dt(He.afterSanitizeElements,M,null),!1)},Yr=function(M,ce,me){if(Or[ce]||Ye&&(ce==="id"||ce==="name")&&(me in ke||me in he))return!1;if(!(Ht&&!Or[ce]&&m($t,ce))){if(!(Lr&&m(Yt,ce))){if(!(rr.attributeCheck instanceof Function&&rr.attributeCheck(ce,M))){if(!Ve[ce]||Or[ce]){if(!(ra(M)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,M)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(M))&&(Je.attributeNameCheck instanceof RegExp&&m(Je.attributeNameCheck,ce)||Je.attributeNameCheck instanceof Function&&Je.attributeNameCheck(ce,M))||ce==="is"&&Je.allowCustomizedBuiltInElements&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me))))return!1}else if(!xr[ce]){if(!m(Te,v(me,ft,""))){if(!((ce==="src"||ce==="xlink:href"||ce==="href")&&M!=="script"&&N(me,"data:")===0&&It[M])){if(!(Mr&&!m(Et,v(me,ft,"")))){if(me)return!1}}}}}}}return!0},ra=function(M){return M!=="annotation-xml"&&g(M,ge)},R=function(M){dt(He.beforeSanitizeAttributes,M,null);const{attributes:ce}=M;if(!ce||Xt(M))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let qe=ce.length;for(;qe--;){const nt=ce[qe],{name:it,namespaceURI:ot,value:Ft}=nt,Kt=$(it),zt=Ft;let wt=it==="value"?zt:j(zt);if(me.attrName=Kt,me.attrValue=wt,me.keepAttr=!0,me.forceKeepAttr=void 0,dt(He.uponSanitizeAttribute,M,me),wt=me.attrValue,yt&&(Kt==="id"||Kt==="name")&&(ct(it,M),wt=Ot+wt),kr&&m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,wt)){ct(it,M);continue}if(Kt==="attributename"&&g(wt,"href")){ct(it,M);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){ct(it,M);continue}if(!$e&&m(/\/>/i,wt)){ct(it,M);continue}ar&&l([bt,Dt,Mt],Sr=>{wt=v(wt,Sr," ")});const fr=$(M.nodeName);if(!Yr(fr,Kt,wt)){ct(it,M);continue}if(P&&typeof Ke=="object"&&typeof Ke.getAttributeType=="function"&&!ot)switch(Ke.getAttributeType(fr,Kt)){case"TrustedHTML":{wt=P.createHTML(wt);break}case"TrustedScriptURL":{wt=P.createScriptURL(wt);break}}if(wt!==zt)try{ot?M.setAttributeNS(ot,it,wt):M.setAttribute(it,wt),Xt(M)?Qe(M):u(fe.removed)}catch{ct(it,M)}}dt(He.afterSanitizeAttributes,M,null)},J=function X(M){let ce=null;const me=Pt(M);for(dt(He.beforeSanitizeShadowDOM,M,null);ce=me.nextNode();)dt(He.uponSanitizeShadowNode,ce,null),or(ce),R(ce),ce.content instanceof Ge&&X(ce.content);dt(He.afterSanitizeShadowDOM,M,null)};return fe.sanitize=function(X){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,me=null,qe=null,nt=null;if(Ir=!X,Ir&&(X="<!-->"),typeof X!="string"&&!Lt(X))if(typeof X.toString=="function"){if(X=X.toString(),typeof X!="string")throw _("dirty is not a string, aborting")}else throw _("toString is not a function");if(!fe.isSupported)return X;if(W||ye(M),fe.removed=[],typeof X=="string"&&(At=!1),At){if(X.nodeName){const Ft=$(X.nodeName);if(!Pe[Ft]||cr[Ft])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(X instanceof jt)ce=et("<!---->"),me=ce.ownerDocument.importNode(X,!0),me.nodeType===Me.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?ce=me:ce.appendChild(me);else{if(!we&&!ar&&!ut&&X.indexOf("<")===-1)return P&&ht?P.createHTML(X):X;if(ce=et(X),!ce)return we?null:ht?I:""}ce&&Q&&Qe(ce.firstChild);const it=Pt(At?X:ce);for(;qe=it.nextNode();)or(qe),R(qe),qe.content instanceof Ge&&J(qe.content);if(At)return X;if(we){if(Ae)for(nt=Oe.call(ce.ownerDocument);ce.firstChild;)nt.appendChild(ce.firstChild);else nt=ce;return(Ve.shadowroot||Ve.shadowrootmode)&&(nt=Ue.call(Se,nt,!0)),nt}let ot=ut?ce.outerHTML:ce.innerHTML;return ut&&Pe["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&m(oe,ce.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
1071
+ disabled:opacity-50 disabled:cursor-not-allowed`,children:[e.jsx(O.X,{className:"w-4 h-4 sm:w-5 sm:h-5 mr-1"}),"Cancel"]})]})]})})}const Po=({comment:t,allComments:r,onReply:n,currentUser:s,token:a,searchQuery:i,depth:o=0,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l})=>{const[h,u]=k.useState(!1),[p,b]=k.useState(!0),[w,x]=k.useState(!1),g=k.useMemo(()=>{const ee=t.active_votes||[];if(!s)return!1;const te=s.toLowerCase();return ee.some(_e=>(_e.voter||"").toLowerCase()===te)},[t.active_votes,s]),[v,N]=k.useState(!1),[j,y]=k.useState(""),[m,_]=k.useState(!1),E=ee=>{y(ee),N(!0),setTimeout(()=>N(!1),2500)},A=t.depth||0;let T=r.filter(ee=>ee.parent_author===t.author&&ee.parent_permlink===t.permlink&&(typeof ee.depth!="number"||ee.depth===A+1));if((!T||T.length===0)&&Array.isArray(t.replies)&&t.replies.length>0){const ee=new Set(t.replies);T=r.filter(te=>ee.has(`${te.author}/${te.permlink}`))}const D=T.length>0,L=o>=4,z=(ee,te)=>{if(!te)return ee;const _e=new RegExp(`(${te})`,"gi");return ee.replace(_e,'<mark class="bg-yellow-800">$1</mark>')},U=()=>{x(!0)},H=async ee=>{if(d){try{await Promise.resolve(d(t.author,t.permlink,ee)),u(!0),x(!1),setTimeout(()=>{c?.(),E("Vote submitted successfully!")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}return}if(!a){E("Please login or provide an upvote handler to vote");return}try{const te=Math.round(ee*100);await Nt.handleUpvote({author:t.author,permlink:t.permlink,weight:te,authToken:a}),u(!0),x(!1),_(!0),setTimeout(()=>{c?.(),_(!1),E("Vote submitted successfully ✅")},3e3)}catch(te){const _e=te instanceof Error?te.message:"Failed to upvote";alert(_e)}},F=()=>{s?n(t.author,t.permlink):E("Please login to upvote")},Y=t.json_metadata_parsed||(()=>{try{return t.json_metadata?JSON.parse(t.json_metadata):void 0}catch{return}})(),G=t.body||"",ie=(ee=>{const te=/^(\s*(?:#[\p{L}\p{N}_-]+\s*(?:,\s*)?)+\s*)$/gimu;return ee.replace(te,"").trim()})(G),xe=i?z(ie,i):ie,V=/!\[[^\]]*\]\([^)]+\)/.test(ie)||/<img\s/i.test(ie),q=Array.isArray(Y?.image)?Y.image:[],B=new Vn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:ee=>ee,usertagUrlFn:ee=>`/@${ee}`,hashtagUrlFn:ee=>`/trending/${ee}`,isLinkSafeFn:ee=>!0,addExternalCssClassToMatchingLinksFn:ee=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),pe=t.stats?.total_votes||t.net_votes||0;return e.jsxs("div",{className:`${o>0?"ml-4 md:ml-8 border-l-2 border-gray-700 pl-4 md:pl-6":""}`,children:[e.jsx("div",{className:"group hover:bg-gray-800/50 transition-colors duration-200 p-4 md:p-6",children:e.jsxs("div",{className:"flex items-start space-x-3 md:space-x-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("img",{src:`https://images.hive.blog/u/${t.author}/avatar`,alt:t.author,className:"w-8 h-8 md:w-10 md:h-10 rounded-full object-cover ring-2 ring-gray-700",onError:ee=>{ee.target.src=`https://ui-avatars.com/api/?name=${t.author}&background=random`}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-2",children:[e.jsxs("button",{className:"font-semibold text-white hover:text-blue-400 transition-colors duration-200 text-sm md:text-base",onClick:()=>{},children:["@",t.author]}),e.jsxs("div",{className:"flex items-center text-xs md:text-sm text-gray-400 space-x-1",children:[e.jsx(O.Clock,{className:"w-3 h-3 md:w-4 md:h-4"}),e.jsx("span",{children:bs.formatDistanceToNow(new Date(t.created+"Z"),{addSuffix:!0})})]}),t.author===s&&e.jsx("span",{className:"px-2 py-1 text-xs bg-blue-900 text-blue-200 rounded-full",children:"You"})]}),e.jsx("div",{className:"prose prose-sm md:prose-base prose-invert max-w-none mb-3 comment-content text-left text-gray-100 prose-a:text-blue-400 [&>*]:text-left",children:i?e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:xe}}):e.jsx("div",{className:"text-left",dangerouslySetInnerHTML:{__html:B.render(ie)}})}),!V&&q.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:q.map((ee,te)=>e.jsx("img",{src:ee,alt:`image-${te}`,className:"max-w-full h-auto rounded-lg shadow-sm cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>window.open(ee,"_blank")},ee+te))}),e.jsxs("div",{className:"flex items-center space-x-4 md:space-x-6",children:[e.jsxs("button",{onClick:()=>{if(d){if(!s){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}U()}else if(l){if(!s){E("Please login to upvote");return}if(g||h){E("You have already upvoted this comment");return}U()}else{if(!s){E("Please login to upvote");return}a?g?E("You have already upvoted this comment"):U():(c?.(),E("Vote submitted successfully ✅"))}},className:`flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium transition-colors duration-200 ${h?"text-blue-400":"text-gray-400 hover:text-blue-400"}`,children:[e.jsx(O.ThumbsUp,{className:`w-4 h-4 ${g||h?"fill-current text-blue-400":""}`}),e.jsx("span",{children:pe})]}),e.jsxs("button",{onClick:()=>{f?f(t):F()},className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:[e.jsx(O.MessageSquare,{className:"w-4 h-4"}),e.jsx("span",{children:"Reply"})]}),D&&e.jsx("button",{onClick:()=>b(!p),className:"flex items-center space-x-1 md:space-x-2 text-xs md:text-sm font-medium text-gray-400 hover:text-blue-400 transition-colors duration-200",children:e.jsxs("span",{children:[p?"Hide":"Show"," ",T.length," ",T.length===1?"reply":"replies"]})}),e.jsx("button",{onClick:()=>f?.(t),className:"opacity-0 group-hover:opacity-100 p-1 rounded-full hover:bg-gray-700 transition-all duration-200",children:e.jsx(O.MoreHorizontal,{className:"w-4 h-4 text-gray-400"})})]}),w&&!g&&e.jsx("div",{className:"mt-3",children:e.jsx(qn,{author:t.author,permlink:t.permlink,onUpvote:H,onCancel:()=>x(!1)})}),m&&e.jsxs("div",{className:"mt-3 inline-flex items-center text-xs text-gray-400",children:[e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mr-2"}),"Updating votes..."]}),v&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:j})})]})]})}),D&&p&&!L&&e.jsx("div",{className:"space-y-0",children:T.map(ee=>e.jsx(Po,{comment:ee,allComments:r,onReply:n,currentUser:s,searchQuery:i,depth:o+1,onVotedRefresh:c,onClickCommentUpvote:d,onClickCommentReply:f,onClickUpvoteButton:l},ee.permlink))}),D&&L&&e.jsx("div",{className:"ml-4 md:ml-8 p-3 text-sm text-gray-400 border-l-2 border-gray-700 pl-4",children:e.jsxs("button",{onClick:()=>{console.log("Show more replies for:",t.author,t.permlink)},className:"text-blue-400 hover:underline",children:["View ",T.length," more ",T.length===1?"reply":"replies"]})})]})},e0=({onImageUploaded:t,ecencyToken:r,disabled:n=!1})=>{const s=k.useRef(null),[a,i]=k.useState(!1),[o,c]=k.useState(null),[d,f]=k.useState(null),l=p=>{const b=p.target.files?.[0];if(b){if(!b.type.startsWith("image/")){c("Please select an image file");return}if(b.size>10*1024*1024){c("File size must be less than 10MB");return}c(null),f(URL.createObjectURL(b)),h(b)}},h=async p=>{i(!0),c(null);try{if(!r)throw new Error("Upload token not provided. Please pass ecencyToken prop.");const b=new FormData;b.append("file",p);const w=await fetch("https://images.ecency.com/hs/"+r,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:b});if(!w.ok)throw new Error(`Upload failed: ${w.statusText}`);const x=await w.json();if(x.url)t(x.url),f(null),s.current&&(s.current.value="");else throw new Error("No URL returned from upload")}catch(b){c(b instanceof Error?b.message:"Failed to upload image")}finally{i(!1)}},u=()=>{f(null),c(null),s.current&&(s.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:s,type:"file",accept:"image/*",onChange:l,className:"hidden",disabled:n||a}),e.jsx("button",{type:"button",onClick:()=>!n&&!a&&s.current?.click(),disabled:n||a,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Image",children:a?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Upload,{className:"h-4 w-4"})}),(d||o)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:o?"Upload Error":"Image Preview"}),e.jsx("button",{type:"button",onClick:u,className:"p-1 hover:bg-gray-800 rounded",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-300"})})]}),e.jsx("div",{className:"p-4",children:o?e.jsx("div",{className:"text-red-400 text-sm",children:o}):d?e.jsxs("div",{className:"space-y-4",children:[e.jsx("img",{src:d,alt:"Preview",className:"w-full max-h-64 object-contain rounded"}),a&&e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"h-6 w-6 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Uploading image..."})]})]}):null})]})})]})},mo="https://audio.3speak.tv",rp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",ap=".mp3,.wav,.ogg,.m4a,.aac,.flac,.weba,.opus,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/webm,audio/opus",sp=50*1024*1024,Ji=300;function Uc(t){const r=Math.floor(t/60),n=t%60;return`${r}:${String(n).padStart(2,"0")}`}function np(t){return new Promise(r=>{const n=URL.createObjectURL(t),s=new Audio;s.addEventListener("loadedmetadata",()=>{const a=s.duration;URL.revokeObjectURL(n),r(Number.isFinite(a)?Math.round(a):0)}),s.addEventListener("error",()=>{URL.revokeObjectURL(n),r(0)}),s.src=n})}const ip=/\.(mp3|wav|ogg|m4a|aac|flac|weba|opus)$/i;function op(t){return ip.test(t)}function lp(t){return t.split(".").pop()?.toLowerCase()??"m4a"}function up(t){return`${mo}/play?a=${t}&mode=minimal&iframe=1`}function cp(){const t=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];for(const r of t)if(typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(r))return r;return""}const t0=({onAudioUploaded:t,username:r,threeSpeakApiKey:n,disabled:s=!1})=>{const a=n||rp,i=k.useRef(null),o=k.useRef(null),c=k.useRef([]),d=k.useRef(null),f=k.useRef(null),[l,h]=k.useState(null),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(null),[D,L]=k.useState(null),[z,U]=k.useState(null);k.useEffect(()=>()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null)},[]),k.useEffect(()=>{x&&v>=Ji&&Y()},[x,v]);const H=k.useCallback(()=>{d.current&&clearInterval(d.current),m&&URL.revokeObjectURL(m),D&&URL.revokeObjectURL(D),f.current&&(f.current.pause(),f.current=null),o.current&&o.current.state!=="inactive"&&o.current.stop(),o.current=null,c.current=[],h(null),p(!1),w(null),g(!1),N(0),y(null),_(null),A(!1),T(null),L(null),U(null),i.current&&(i.current.value="")},[m,D]),F=async()=>{w(null),y(null),m&&URL.revokeObjectURL(m),_(null),N(0);try{const ee=await navigator.mediaDevices.getUserMedia({audio:!0}),te=new MediaRecorder(ee,{mimeType:cp()});o.current=te,c.current=[],te.ondataavailable=_e=>{_e.data.size>0&&c.current.push(_e.data)},te.onstop=()=>{ee.getTracks().forEach(K=>K.stop());const _e=new Blob(c.current,{type:te.mimeType}),Ie=URL.createObjectURL(_e);y(_e),_(Ie),g(!1),d.current&&clearInterval(d.current)},te.start(100),g(!0),d.current=setInterval(()=>{N(_e=>_e+1)},1e3)}catch{w("Microphone access denied. Please allow microphone permission.")}},Y=()=>{o.current&&o.current.state!=="inactive"&&o.current.stop()},G=()=>{m&&URL.revokeObjectURL(m),f.current&&(f.current.pause(),f.current=null),y(null),_(null),N(0),A(!1),w(null)},ne=()=>{if(!m)return;if(E&&f.current){f.current.pause(),A(!1);return}const ee=new Audio(m);f.current=ee,ee.onended=()=>A(!1),ee.play(),A(!0)},ie=async()=>{if(!j)return;const ee=new File([j],`recording-${Date.now()}.webm`,{type:j.type});await B(ee,v)},xe=ee=>{const te=ee.target.files?.[0];if(te){if(te.type.startsWith("video/")){w("Video files are not allowed. Please select an audio file.");return}if(!te.type.startsWith("audio/")&&!op(te.name)){w("Please select an audio file (MP3, WAV, OGG, M4A, etc.)");return}if(te.size>sp){w("File size must be less than 50MB");return}w(null),T(te),U(te.name),L(URL.createObjectURL(te)),h("gallery-preview")}},V=async()=>{if(!C)return;const ee=await np(C);await B(C,ee)},q=()=>{D&&URL.revokeObjectURL(D),T(null),L(null),U(null),w(null),h("pick"),i.current&&(i.current.value="")},B=async(ee,te)=>{p(!0),w(null);try{if(!r)throw new Error("Please log in to upload audio.");const _e=ee instanceof File?lp(ee.name):"webm",Ie=new FormData;Ie.append("audio",ee),Ie.append("duration",String(te)),Ie.append("format",_e),Ie.append("title",`Audio by ${r}`);const K=await fetch(`${mo}/api/audio/upload`,{method:"POST",headers:{"X-API-Key":a,"X-User":r},body:Ie});if(!K.ok){const Ne=await K.json().catch(()=>null);throw new Error(Ne?.message??Ne?.error??`Upload failed: ${K.statusText}`)}const le=await K.json();if(le.error)throw new Error(le.error);let oe;if(le.permlink)oe=up(le.permlink);else if(le.playUrl)oe=le.playUrl;else if(le.cid)oe=`${mo}/play?cid=${le.cid}&mode=minimal&iframe=1`;else throw new Error("No audio URL returned from upload");t(oe,te),H()}catch(_e){w(_e instanceof Error?_e.message:"Failed to upload audio")}finally{p(!1)}},pe=v/Ji*100;return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:i,type:"file",accept:ap,onChange:xe,className:"hidden",disabled:s||u}),e.jsx("button",{type:"button",onClick:()=>!s&&!u&&h("pick"),disabled:s||u,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Add Audio",children:u?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Music,{className:"h-4 w-4"})}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsxs("h3",{className:"text-base font-semibold text-white",children:[l==="pick"&&"Add Audio",l==="record"&&"Record Audio",l==="gallery-preview"&&"Upload Audio"]}),e.jsx("button",{type:"button",onClick:H,disabled:u,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[b&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:b}),l==="pick"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>{w(null),h("record")},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-500/15",children:e.jsx(O.Mic,{className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Record Audio"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Record up to 5 minutes from your microphone"})]})]}),e.jsxs("button",{type:"button",onClick:()=>{w(null),i.current?.click()},className:"flex items-center gap-3 rounded-xl border border-gray-700 bg-gray-800 px-4 py-4 text-left transition-colors hover:border-blue-500/40 hover:bg-gray-800/80",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-emerald-500/15",children:e.jsx(O.Upload,{className:"h-5 w-5 text-emerald-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Upload from Gallery"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Select an audio file (MP3, WAV, OGG, etc.)"})]})]}),e.jsx("p",{className:"text-center text-xs text-gray-500",children:"Max 50 MB per audio file"})]}),l==="record"&&e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:`text-3xl font-mono font-semibold tabular-nums ${x?"text-red-400":"text-white"}`,children:Uc(v)}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:x?"Recording...":j?"Recording complete":"Tap to start recording"})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-red-500 transition-all duration-1000",style:{width:`${Math.min(pe,100)}%`}})}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Max ",Uc(Ji)]}),j?e.jsxs("div",{className:"flex flex-col items-center gap-4 w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:ne,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-white transition-colors hover:bg-gray-700",children:E?e.jsx(O.Pause,{className:"h-5 w-5"}):e.jsx(O.Play,{className:"h-5 w-5 ml-0.5"})}),e.jsx("button",{type:"button",onClick:G,disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-red-400 disabled:opacity-50",children:e.jsx(O.Trash2,{className:"h-5 w-5"})}),e.jsx("button",{type:"button",onClick:()=>{G(),F()},disabled:u,className:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-800 border border-gray-700 text-gray-400 transition-colors hover:bg-gray-700 hover:text-white disabled:opacity-50",children:e.jsx(O.RotateCcw,{className:"h-5 w-5"})})]}),e.jsx("button",{type:"button",onClick:()=>{ie()},disabled:u,className:"w-full rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload Recording"})]}):e.jsx("div",{className:"flex items-center gap-4",children:e.jsx("button",{type:"button",onClick:x?Y:F,className:"flex h-16 w-16 items-center justify-center rounded-full bg-red-500 text-white shadow-lg transition-transform hover:scale-105 active:scale-95",children:x?e.jsx(O.Square,{className:"h-6 w-6 fill-current"}):e.jsx(O.Mic,{className:"h-6 w-6"})})}),!x&&!u&&e.jsx("button",{type:"button",onClick:()=>{G(),h("pick")},className:"text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]}),l==="gallery-preview"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[z&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsx(O.Music,{className:"h-4 w-4 shrink-0 text-blue-400"}),e.jsx("span",{className:"truncate",children:z})]}),D&&e.jsx("audio",{src:D,controls:!0,className:"w-full rounded-lg",preload:"metadata"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:q,disabled:u,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700 disabled:opacity-50",children:"Remove"}),e.jsx("button",{type:"button",onClick:()=>{V()},disabled:u,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:u?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):"Upload"})]}),!u&&e.jsx("button",{type:"button",onClick:q,className:"text-center text-xs text-gray-400 hover:text-white transition-colors",children:"Back to options"})]})]})]})})]})},dp="https://embed.3speak.tv/uploads",fp="sk_demo_b0d3f4b972c5065b701394df3de2f44fd59aa3244c58c478",hp=100*1024*1024,mp=5*1024*1024,pp="video/mp4,video/quicktime,video/webm,video/3gpp,.mp4,.mov,.webm,.3gp",Vc=90;function nn(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Yi(t){const r=Math.floor(t/60),n=t%60;return`${r}:${String(n).padStart(2,"0")}`}function gp(t){return new Promise((r,n)=>{const s=document.createElement("video"),a=URL.createObjectURL(t);s.preload="metadata",s.muted=!0,s.playsInline=!0,s.onloadeddata=()=>{s.currentTime=Math.min(.75,s.duration*.25)},s.onseeked=()=>{const i=document.createElement("canvas");i.width=s.videoWidth,i.height=s.videoHeight;const o=i.getContext("2d");if(!o){URL.revokeObjectURL(a),n(new Error("Cannot create canvas context"));return}o.drawImage(s,0,0,i.width,i.height),i.toBlob(c=>{if(URL.revokeObjectURL(a),!c){n(new Error("Failed to generate thumbnail"));return}r({blob:c,dataUrl:i.toDataURL("image/jpeg",.7)})},"image/jpeg",.7)},s.onerror=()=>{URL.revokeObjectURL(a),n(new Error("Failed to load video"))},s.src=a})}function xp(t){return new Promise(r=>{const n=document.createElement("video"),s=URL.createObjectURL(t);n.preload="metadata",n.onloadedmetadata=()=>{URL.revokeObjectURL(s),r({duration:Number.isFinite(n.duration)?Math.round(n.duration):0,width:n.videoWidth||0,height:n.videoHeight||0})},n.onerror=()=>{URL.revokeObjectURL(s),r({duration:0,width:0,height:0})},n.src=s})}async function bp(t,r){const n=new FormData;n.append("file",t,`video-thumbnail-${Date.now()}.jpg`);const s=await fetch(`https://images.ecency.com/hs/${r}`,{method:"POST",headers:{accept:"application/json, text/plain, */*",origin:"https://ecency.com",referer:"https://ecency.com/"},body:n});if(!s.ok)throw new Error(`Thumbnail upload failed: ${s.statusText}`);const a=await s.json();if(!a.url)throw new Error("No URL returned from thumbnail upload");return a.url}async function yp(t,r,n){await fetch(`https://embed.3speak.tv/video/${t}/thumbnail`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":n},body:JSON.stringify({thumbnail_url:r})}).catch(()=>{})}function vp(t){try{const r=new URL(t).searchParams.get("v");if(!r)return null;const n=r.split("/");return n[n.length-1]||null}catch{return null}}async function wp(t,r,n,s,a,i){const{Upload:o}=await import("tus-js-client");return new Promise((c,d)=>{let f=null;const l=new o(t,{endpoint:dp,metadata:{filename:t.name,filetype:t.type||"video/mp4",frontend_app:"hive-react-kit",owner:r,short:"true",duration:String(n)},chunkSize:mp,retryDelays:[0,2e3,5e3,1e4],headers:{"X-API-Key":s},onProgress:(u,p)=>{p&&a({bytesUploaded:u,bytesTotal:p,percentage:Number((u/p*100).toFixed(1))})},onAfterResponse:(u,p)=>{const b=p.getHeader("X-Embed-URL");b&&(f=b)},onError:u=>d(i.aborted?new Error("Upload aborted"):u),onSuccess:()=>{if(!l.url||!f){d(new Error("3Speak upload completed without required URLs."));return}c({embedUrl:f,uploadUrl:l.url})}}),h=()=>{l.abort(!0).catch(()=>{}),d(new Error("Upload aborted"))};if(i.aborted){h();return}i.addEventListener("abort",h),l.findPreviousUploads().then(u=>{u.length>0&&l.resumeFromPreviousUpload(u[0]),l.start()}).catch(d)})}const r0=({onVideoUploaded:t,username:r,ecencyToken:n,threeSpeakApiKey:s,disabled:a=!1})=>{const i=s||fp,o=k.useRef(null),c=k.useRef(null),[d,f]=k.useState(!1),[l,h]=k.useState(null),[u,p]=k.useState(null),[b,w]=k.useState(null),[x,g]=k.useState(0),[v,N]=k.useState("16/9"),[j,y]=k.useState(null),[m,_]=k.useState(!1),[E,A]=k.useState(null),[C,T]=k.useState(null);k.useEffect(()=>()=>{c.current&&c.current.abort(),j&&URL.revokeObjectURL(j)},[]);const D=k.useCallback(()=>{c.current&&(c.current.abort(),c.current=null),j&&URL.revokeObjectURL(j),f(!1),h(null),p(null),w(null),g(0),N("16/9"),y(null),_(!1),A(null),T(null),o.current&&(o.current.value="")},[j]),L=async F=>{const Y=F.target.files?.[0];if(Y){if(!Y.type.startsWith("video/")){T("Please select a video file (MP4, MOV, WebM, etc.)");return}if(Y.size>hp){T(`Video file is too large (${nn(Y.size)}). Maximum is 100 MB.`);return}T(null),h(Y),y(URL.createObjectURL(Y));try{const G=await xp(Y);if(g(G.duration),N(G.width&&G.height?`${G.width}/${G.height}`:"9/16"),G.width&&G.height&&G.width>G.height){T(`Only portrait (vertical) videos are allowed. Your video is ${G.width}×${G.height} (landscape). Please record or crop in portrait mode.`);return}if(G.duration>Vc){T(`Video is too long (${Yi(G.duration)}). Maximum is ${Yi(Vc)}.`);return}const ne=await gp(Y);p(ne.dataUrl),w(ne.blob)}catch{console.warn("Failed to generate thumbnail")}}},z=async()=>{if(!l||!r){T(r?"No video selected.":"Please log in to upload videos.");return}_(!0),T(null),A({bytesUploaded:0,bytesTotal:l.size,percentage:0});const F=new AbortController;c.current=F;try{let Y=Promise.resolve(null);b&&n&&(Y=bp(b,n).catch(()=>null));const G=await wp(l,r,x,i,xe=>A(xe),F.signal),ne=await Y;if(ne&&G.embedUrl){const xe=vp(G.embedUrl);xe&&await yp(xe,ne,i)}const ie=l;t(G.embedUrl,G.uploadUrl,v,ie),D()}catch(Y){F.signal.aborted||T(Y instanceof Error?Y.message:"Failed to upload video.")}finally{_(!1),c.current=null}},U=()=>{c.current&&(c.current.abort(),c.current=null),_(!1),A(null)},H=()=>{j&&URL.revokeObjectURL(j),h(null),p(null),w(null),g(0),y(null),T(null),A(null),o.current&&(o.current.value="")};return e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:o,type:"file",accept:pp,onChange:L,className:"hidden",disabled:a||m}),e.jsx("button",{type:"button",onClick:()=>{!a&&!m&&(T(null),f(!0),o.current?.click())},disabled:a||m,className:"p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50",title:"Upload Video",children:m?e.jsx(O.Loader2,{className:"h-4 w-4 animate-spin"}):e.jsx(O.Video,{className:"h-4 w-4"})}),d&&l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm px-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-gray-700 bg-gray-900 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"Upload Video"}),e.jsx("button",{type:"button",onClick:D,disabled:m,className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-400 hover:bg-gray-800 hover:text-white disabled:opacity-50",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4",children:[C&&e.jsx("div",{className:"mb-3 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:C}),e.jsxs("div",{className:"flex gap-3 mb-4",children:[e.jsxs("div",{className:"relative h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-gray-800 border border-gray-700",children:[u?e.jsx("img",{src:u,alt:"Thumbnail",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(O.Video,{className:"h-8 w-8 text-gray-500"})}),!m&&!C&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(O.Play,{className:"h-5 w-5 text-white ml-0.5"})})]}),e.jsxs("div",{className:"flex flex-col justify-center min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:l.name}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[nn(l.size),x>0&&` · ${Yi(x)}`]})]})]}),j&&!m&&e.jsx("div",{className:"mb-4 overflow-hidden rounded-lg bg-black",style:{maxHeight:"280px"},children:e.jsx("video",{src:j,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"280px"}})}),m&&E&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Uploading..."}),e.jsxs("span",{className:"text-xs font-medium text-white",children:[E.percentage.toFixed(0),"%"]})]}),e.jsx("div",{className:"h-2 w-full rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-300",style:{width:`${E.percentage}%`}})}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:[nn(E.bytesUploaded)," / ",nn(E.bytesTotal)]})]}),e.jsx("div",{className:"flex gap-2",children:m?e.jsx("button",{type:"button",onClick:U,className:"flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:H,className:"flex items-center justify-center gap-1.5 flex-1 rounded-lg border border-gray-700 bg-gray-800 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-gray-700",children:[e.jsx(O.Trash2,{className:"h-3.5 w-3.5"}),"Remove"]}),e.jsx("button",{type:"button",onClick:()=>{z()},disabled:!!C,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50",children:"Upload Video"})]})})]})]})})]})},a0=({isOpen:t,onClose:r,onSelectGif:n,giphyApiKey:s})=>{const[a,i]=k.useState(""),[o,c]=k.useState([]),[d,f]=k.useState(!1),[l,h]=k.useState(null),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{t&&setTimeout(()=>u.current?.focus(),100)},[t]);const b=async g=>{if(!g.trim())return;p.current?.abort();const v=new AbortController;p.current=v,f(!0),h(null);try{if(!s)throw new Error("GIPHY API key not provided. Pass giphyApiKey prop.");const N=await fetch(`https://api.giphy.com/v1/gifs/search?api_key=${s}&q=${encodeURIComponent(g)}&limit=20&rating=g`,{signal:v.signal});if(!N.ok)throw new Error(`Failed to fetch GIFs: ${N.statusText}`);const j=await N.json();c(j.data||[])}catch(N){if(v.signal.aborted)return;h(N instanceof Error?N.message:"Failed to search GIFs")}finally{v.signal.aborted||f(!1)}},w=g=>{g.preventDefault(),b(a)},x=g=>{const v=g.images.original?.url||g.images.downsized?.url||g.images.fixed_height?.url;v&&(n(v),r())};return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col",onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a GIF"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded transition-colors text-gray-400",children:e.jsx(O.X,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("form",{onSubmit:w,className:"mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:u,type:"text",value:a,onChange:g=>i(g.target.value),placeholder:"Search for GIFs...",className:"flex-1 px-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-400"}),e.jsxs("button",{type:"submit",disabled:d||!a.trim(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 flex items-center gap-2",children:[e.jsx(O.Search,{className:"h-4 w-4"}),"Search"]})]})}),l&&e.jsx("div",{className:"text-red-400 text-sm mb-4",children:l}),d&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-500 border-t-transparent mx-auto"}),e.jsx("p",{className:"mt-2 text-gray-400",children:"Searching for GIFs..."})]}),o.length>0&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-96 overflow-y-auto",children:o.map(g=>e.jsxs("button",{type:"button",onClick:()=>x(g),className:"relative group rounded-lg overflow-hidden hover:ring-2 hover:ring-blue-500 transition-all",children:[e.jsx("img",{src:g.images.fixed_height?.url||g.images.downsized?.url||g.images.original?.url,alt:g.title,className:"w-full h-32 object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"bg-black/90 rounded-full p-2",children:e.jsx(O.Image,{className:"h-4 w-4 text-blue-400"})})})]},g.id))}),!d&&o.length===0&&a&&e.jsxs("div",{className:"text-center py-8 text-gray-400",children:['No GIFs found for "',a,'"']})]})]})}):null},po={Smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🫡","🤐","🤨","😐","😑","😶","🫥","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🥵","🥶","🥴","😵","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","🫤","😟","🙁","☹️","😮","😯","😲","😳","🥺","🥹","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿"],Gestures:["👋","🤚","🖐️","✋","🖖","🫱","🫲","🫳","🫴","👌","🤌","🤏","✌️","🤞","🫰","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝️","🫵","👍","👎","✊","👊","🤛","🤜","👏","🙌","🫶","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻"],People:["👶","🧒","👦","👧","🧑","👱","👨","🧔","👩","🧓","👴","👵","🙍","🙎","🙅","🙆","💁","🙋","🧏","🙇","🤦","🤷","👮","🕵️","💂","🥷","👷","🫅","🤴","👸","👳","👲","🧕","🤵","👰","🤰","🫃","🤱","👼","🎅","🤶","🦸","🦹","🧙","🧚","🧛","🧜","🧝"],Animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐻‍❄️","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐒","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🪱","🐛","🦋","🐌","🐞","🐜","🪰","🪲","🪳","🦟","🦗","🕷️","🐢","🐍","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈"],Food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🫐","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🫑","🌽","🥕","🫒","🧄","🧅","🥔","🍠","🥐","🥯","🍞","🥖","🥨","🧀","🥚","🍳","🧈","🥞","🧇","🥓","🥩","🍗","🍖","🌭","🍔","🍟","🍕","🫓","🥪","🥙","🧆","🌮","🌯","🫔","🥗","🥘","🫕","🥫","🍝","🍜","🍲","🍛","🍣","🍱","🥟","🦪","🍤","🍙","🍚","🍘","🍥","🥠","🥮","🍢","🍡","🍧","🍨","🍦","🥧","🧁","🍰","🎂","🍮","🍭","🍬","🍫","🍿","🍩","🍪","🌰","🥜","🍯"],Travel:["🚗","🚕","🚙","🚌","🚎","🏎️","🚓","🚑","🚒","🚐","🛻","🚚","🚛","🚜","🏍️","🛵","🚲","🛴","🛹","🛼","🚁","🛸","🚀","🛩️","✈️","🚢","⛵","🚤","🛥️","🛳️","⛴️","🚂","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🛕","🕍","⛩️","🕋","⛲","⛺","🌁","🌃","🏙️","🌄","🌅","🌆"],Objects:["⌚","📱","📲","💻","⌨️","🖥️","🖨️","🖱️","🖲️","🕹️","🗜️","💾","💿","📀","📼","📷","📸","📹","🎥","📽️","🎞️","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","💡","🔦","🕯️","🪔","🧯","🛢️","💸","💵","💴","💶","💷","🪙","💰","💳","💎","⚖️","🪜","🧰","🪛","🔧","🔨","⚒️","🛠️","⛏️","🪚","🔩","⚙️","🪤","🧲","🔫","💣","🧨","🪓","🔪","🗡️","⚔️","🛡️","🚬","⚰️","🪦","⚱️","🏺","🔮","📿","🧿","🪬","💈","⚗️"],Symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❤️‍🔥","❤️‍🩹","❣️","💕","💞","💓","💗","💖","💘","💝","💟","☮️","✝️","☪️","🕉️","☸️","✡️","🔯","🕎","☯️","☦️","🛐","⛎","♈","♉","♊","♋","♌","♍","♎","♏","♐","♑","♒","♓","🆔","⚛️","🉑","☢️","☣️","📴","📳","🈶","🈚","🈸","🈺","🈷️","✴️","🆚","💮","🉐","㊙️","㊗️","🈴","🈵","🈹","🈲","🅰️","🅱️","🆎","🅾️","🆑","🆘","❌","⭕","🛑","⛔","📛","🚫","💯","💢","♨️","🚷","🚯","🚳","🚱","🔞","📵","🚭","❗","❕","❓","❔","‼️","⁉️","🔅","🔆","〽️","⚠️","🚸","🔱","⚜️","🔰","♻️","✅","🈯","💹","❇️","✳️","❎","🌐","💠","🔘","🔳","🔲","⬛","⬜","◼️","◻️","◾","◽","▪️","▫️","🔴","🟠","🟡","🟢","🔵","🟣","🟤","⚫","⚪"],Flags:["🏁","🚩","🎌","🏴","🏳️","🏳️‍🌈","🏳️‍⚧️","🏴‍☠️","🇦🇫","🇦🇱","🇩🇿","🇦🇸","🇦🇩","🇦🇴","🇦🇮","🇦🇬","🇦🇷","🇦🇲","🇦🇺","🇦🇹","🇧🇸","🇧🇭","🇧🇩","🇧🇧","🇧🇾","🇧🇪","🇧🇿","🇧🇯","🇧🇹","🇧🇴","🇧🇦","🇧🇼","🇧🇷","🇧🇳","🇧🇬","🇧🇫","🇧🇮","🇨🇦","🇨🇳","🇨🇴","🇨🇷","🇭🇷","🇨🇺","🇨🇿","🇩🇰","🇩🇴","🇪🇨","🇪🇬","🇸🇻","🇪🇹","🇫🇮","🇫🇷","🇩🇪","🇬🇭","🇬🇷","🇬🇹","🇭🇹","🇭🇳","🇭🇰","🇭🇺","🇮🇸","🇮🇳","🇮🇩","🇮🇷","🇮🇶","🇮🇪","🇮🇱","🇮🇹","🇯🇲","🇯🇵","🇯🇴","🇰🇿","🇰🇪","🇰🇼","🇱🇧","🇱🇾","🇱🇹","🇱🇺","🇲🇾","🇲🇽","🇲🇦","🇲🇿","🇳🇵","🇳🇱","🇳🇿","🇳🇬","🇳🇴","🇴🇲","🇵🇰","🇵🇦","🇵🇪","🇵🇭","🇵🇱","🇵🇹","🇶🇦","🇷🇴","🇷🇺","🇸🇦","🇷🇸","🇸🇬","🇸🇰","🇸🇮","🇿🇦","🇰🇷","🇪🇸","🇱🇰","🇸🇪","🇨🇭","🇹🇼","🇹🇭","🇹🇷","🇺🇦","🇦🇪","🇬🇧","🇺🇸","🇻🇪","🇻🇳"]},Np={Smileys:"😀",Gestures:"👋",People:"👤",Animals:"🐶",Food:"🍔",Travel:"✈️",Objects:"💡",Symbols:"❤️",Flags:"🏁"},Zi=Object.keys(po),s0=({isOpen:t,onClose:r,onSelectEmoji:n})=>{const[s,a]=k.useState(""),[i,o]=k.useState(Zi[0]),c=k.useRef(null),d=k.useRef(null);if(k.useEffect(()=>{t&&(a(""),o(Zi[0]),setTimeout(()=>c.current?.focus(),100))},[t]),!t)return null;const f=Object.values(po).flat(),l=s?f.filter(h=>h.includes(s)):null;return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("style",{children:".emoji-no-scrollbar::-webkit-scrollbar { display: none; }"}),e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md h-[400px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Emoji Picker"}),e.jsx("button",{type:"button",onClick:r,className:"p-1 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-3 pt-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-500"}),e.jsx("input",{ref:c,type:"text",value:s,onChange:h=>a(h.target.value),placeholder:"Search emoji...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),!s&&e.jsx("div",{className:"emoji-no-scrollbar flex gap-1 px-3 pt-2 pb-1 overflow-x-auto",style:{scrollbarWidth:"none"},children:Zi.map(h=>e.jsx("button",{type:"button",onClick:()=>{o(h),d.current?.scrollTo({top:0,behavior:"smooth"})},className:`p-1.5 text-lg rounded-md transition-colors ${i===h?"bg-blue-600/20 ring-1 ring-blue-500":"hover:bg-gray-800"}`,title:h,children:Np[h]||h.charAt(0)},h))}),e.jsx("div",{ref:d,className:"emoji-no-scrollbar flex-1 overflow-y-auto p-3 min-h-0",style:{scrollbarWidth:"none"},children:s?l&&l.length>0?e.jsx("div",{className:"grid grid-cols-8 gap-1",children:l.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>n(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))}):e.jsx("p",{className:"text-center text-gray-500 text-sm py-8",children:"No emoji found"}):e.jsx("div",{className:"grid grid-cols-8 gap-1",children:po[i]?.map((h,u)=>e.jsx("button",{type:"button",onClick:()=>n(h),className:"p-1.5 hover:bg-gray-800 rounded text-xl transition-colors text-center",children:h},`${h}-${u}`))})})]})]})},n0=({isOpen:t,onClose:r,onSelectTemplate:n,templates:s,authorFromUrl:a})=>{const[i,o]=k.useState(""),c=k.useRef(null);k.useEffect(()=>{t&&(o(""),setTimeout(()=>c.current?.focus(),100))},[t]);const d=l=>{const h=a?l.replace(/\{\{author\}\}/g,a):l;n(h),r()},f=s.filter(l=>l.templateName.toLowerCase().includes(i.toLowerCase())||l.template.toLowerCase().includes(i.toLowerCase()));return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:r,children:e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl shadow-xl max-w-2xl w-full max-h-[80vh] flex flex-col",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Choose a Template"}),e.jsx("button",{onClick:r,className:"p-1.5 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("div",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{ref:c,type:"text",value:i,onChange:l=>o(l.target.value),placeholder:"Search templates...",className:"w-full pl-10 pr-3 py-2 border border-gray-700 bg-gray-800 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-white placeholder-gray-500 text-sm"})]}),f.length>0?e.jsx("div",{className:"space-y-2 overflow-y-auto flex-1",children:f.map(l=>e.jsx("button",{onClick:()=>d(l.template),className:"w-full text-left p-3 border border-gray-700 rounded-lg hover:bg-gray-800 hover:border-blue-500 transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(O.FileText,{className:"h-4 w-4 text-gray-500 group-hover:text-blue-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-medium text-white text-sm group-hover:text-blue-400",children:l.templateName}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 line-clamp-2",children:l.template})]})]})},l._id))}):e.jsx("div",{className:"text-center py-8 text-gray-400",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-white",children:["No templates found for “",i,"”"]}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Try a different search term"})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.FileText,{className:"h-12 w-12 text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-white",children:"No templates available"}),e.jsx("p",{className:"text-xs mt-1 text-gray-500",children:"Create templates via the API to use them here"})]})})]})]})}):null},on=2,Xi=10;function jp(){const t=new Date;return t.setDate(t.getDate()+7),t.toISOString().slice(0,16)}const i0=({isOpen:t,onClose:r,onSave:n,initialData:s})=>{const[a,i]=k.useState(s?.question??""),[o,c]=k.useState(s?.choices?.length?s.choices:["",""]),[d,f]=k.useState(s?.end_time?new Date(s.end_time*1e3).toISOString().slice(0,16):jp()),[l,h]=k.useState(s?.max_choices_voted??1),[u,p]=k.useState(s?.allow_vote_changes??!0),[b,w]=k.useState(s?.filters?.account_age??0),[x,g]=k.useState(s?.ui_hide_res_until_voted??!1);if(!t)return null;const v=()=>{o.length<Xi&&c([...o,""])},N=C=>{o.length>on&&c(o.filter((T,D)=>D!==C))},j=(C,T)=>{c(o.map((D,L)=>L===C?T:D))},y=o.filter(C=>C.trim()),m=a.trim().length>0&&y.length>=on&&new Date(d).getTime()>Date.now(),_=()=>{m&&(n({question:a.trim(),choices:y,end_time:Math.floor(new Date(d).getTime()/1e3),max_choices_voted:Math.min(l,y.length),allow_vote_changes:u,filters:{account_age:b},ui_hide_res_until_voted:x}),r())},E="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-blue-500 focus:outline-none",A="block text-xs font-medium text-gray-400 mb-1";return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:r,"aria-hidden":!0}),e.jsxs("div",{className:"relative bg-gray-900 border border-gray-700 rounded-xl shadow-xl w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Create Poll"}),e.jsx("button",{type:"button",onClick:r,className:"p-1.5 hover:bg-gray-800 rounded text-gray-400",children:e.jsx(O.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Question"}),e.jsx("input",{type:"text",value:a,onChange:C=>i(C.target.value),placeholder:"Ask a question...",className:E,maxLength:256})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Choices (min ",on,", max ",Xi,")"]}),e.jsx("div",{className:"space-y-2",children:o.map((C,T)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:D=>j(T,D.target.value),placeholder:`Option ${T+1}`,className:E,maxLength:128}),o.length>on&&e.jsx("button",{type:"button",onClick:()=>N(T),className:"shrink-0 rounded p-1.5 text-gray-400 hover:bg-gray-800 hover:text-red-400",title:"Remove option",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]},T))}),o.length<Xi&&e.jsx("button",{type:"button",onClick:v,className:"mt-2 text-xs text-blue-400 hover:text-blue-300 font-medium",children:"+ Add option"})]}),e.jsxs("div",{children:[e.jsx("label",{className:A,children:"Poll ends at"}),e.jsx("input",{type:"datetime-local",value:d,onChange:C=>f(C.target.value),className:E,min:new Date().toISOString().slice(0,16)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Max choices a voter can select (",l,")"]}),e.jsx("input",{type:"range",min:1,max:Math.max(y.length,1),value:l,onChange:C=>h(Number(C.target.value)),className:"w-full accent-blue-500"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:C=>p(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Allow voters to change their vote"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:A,children:["Minimum account age to vote (days): ",b]}),e.jsx("input",{type:"number",min:0,max:365,value:b,onChange:C=>w(Math.max(0,Number(C.target.value))),className:E})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:C=>g(C.target.checked),className:"accent-blue-500"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Hide results until user has voted"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-gray-700",children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-lg px-4 py-2 text-sm text-gray-400 hover:bg-gray-800",children:"Cancel"}),e.jsx("button",{type:"button",onClick:_,disabled:!m,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white disabled:opacity-50 hover:bg-blue-700",children:"Attach Poll"})]})]})]})},ln="https://hreplier-api.sagarkothari88.one/data/templates",un=t=>({Authorization:t,"Content-Type":"application/json"}),o0={async getTemplates(t,r){const s=await fetch(r||ln,{method:"GET",headers:un(t)});if(!s.ok)throw(await s.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to fetch templates: ${s.status} ${s.statusText}`);return(await s.json()).map(i=>({_id:i._id,name:i.name,templateName:i.templateName,template:i.template}))},async createTemplate(t,r,n,s){const i=await fetch(s||ln,{method:"POST",headers:un(t),body:JSON.stringify({templateName:r,template:n})});if(!i.ok)throw(await i.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to create template: ${i.status}`);const o=await i.json();return{_id:o._id,name:o.name,templateName:o.templateName,template:o.template}},async updateTemplate(t,r,n,s,a){const o=await fetch(a||ln,{method:"PUT",headers:un(t),body:JSON.stringify({id:r,templateName:n,template:s})});if(!o.ok)throw(await o.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to update template: ${o.status}`);const c=await o.json();return{_id:c._id,name:c.name,templateName:c.templateName,template:c.template}},async deleteTemplate(t,r,n){const a=await fetch(`${n||ln}/${r}`,{method:"DELETE",headers:un(t)});if(!a.ok)throw(await a.json().catch(()=>({}))).error==="TokenExpiredError: jwt expired"?new Error("JWT_EXPIRED"):new Error(`Failed to delete template: ${a.status}`)}};var Ki,qc;function Hc(){if(qc)return Ki;qc=1;const{entries:t,setPrototypeOf:r,isFrozen:n,getPrototypeOf:s,getOwnPropertyDescriptor:a}=Object;let{freeze:i,seal:o,create:c}=Object,{apply:d,construct:f}=typeof Reflect<"u"&&Reflect;i||(i=function(fe){return fe}),o||(o=function(fe){return fe}),d||(d=function(fe,ke){for(var Se=arguments.length,Be=new Array(Se>2?Se-2:0),Ge=2;Ge<Se;Ge++)Be[Ge-2]=arguments[Ge];return fe.apply(ke,Be)}),f||(f=function(fe){for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return new fe(...Se)});const l=E(Array.prototype.forEach),h=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),b=E(Array.prototype.splice),w=E(String.prototype.toLowerCase),x=E(String.prototype.toString),g=E(String.prototype.match),v=E(String.prototype.replace),N=E(String.prototype.indexOf),j=E(String.prototype.trim),y=E(Object.prototype.hasOwnProperty),m=E(RegExp.prototype.test),_=A(TypeError);function E(ve){return function(fe){fe instanceof RegExp&&(fe.lastIndex=0);for(var ke=arguments.length,Se=new Array(ke>1?ke-1:0),Be=1;Be<ke;Be++)Se[Be-1]=arguments[Be];return d(ve,fe,Se)}}function A(ve){return function(){for(var fe=arguments.length,ke=new Array(fe),Se=0;Se<fe;Se++)ke[Se]=arguments[Se];return f(ve,ke)}}function C(ve,fe){let ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w;r&&r(ve,null);let Se=fe.length;for(;Se--;){let Be=fe[Se];if(typeof Be=="string"){const Ge=ke(Be);Ge!==Be&&(n(fe)||(fe[Se]=Ge),Be=Ge)}ve[Be]=!0}return ve}function T(ve){for(let fe=0;fe<ve.length;fe++)y(ve,fe)||(ve[fe]=null);return ve}function D(ve){const fe=c(null);for(const[ke,Se]of t(ve))y(ve,ke)&&(Array.isArray(Se)?fe[ke]=T(Se):Se&&typeof Se=="object"&&Se.constructor===Object?fe[ke]=D(Se):fe[ke]=Se);return fe}function L(ve,fe){for(;ve!==null;){const Se=a(ve,fe);if(Se){if(Se.get)return E(Se.get);if(typeof Se.value=="function")return E(Se.value)}ve=s(ve)}function ke(){return null}return ke}const z=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),U=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),H=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=i(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Y=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ne=i(["#text"]),ie=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xe=i(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),V=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),pe=o(/<%[\w\W]*|[\w\W]*%>/gm),ee=o(/\$\{[\w\W]*/gm),te=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),_e=o(/^aria-[\-\w]+$/),Ie=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),K=o(/^(?:\w+script|data):/i),le=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oe=o(/^html$/i),Ne=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ce=Object.freeze({__proto__:null,ARIA_ATTR:_e,ATTR_WHITESPACE:le,CUSTOM_ELEMENT:Ne,DATA_ATTR:te,DOCTYPE_NAME:oe,ERB_EXPR:pe,IS_ALLOWED_URI:Ie,IS_SCRIPT_OR_DATA:K,MUSTACHE_EXPR:B,TMPLIT_EXPR:ee});const Me={element:1,text:3,progressingInstruction:7,comment:8,document:9},Fe=function(){return typeof window>"u"?null:window},ue=function(fe,ke){if(typeof fe!="object"||typeof fe.createPolicy!="function")return null;let Se=null;const Be="data-tt-policy-suffix";ke&&ke.hasAttribute(Be)&&(Se=ke.getAttribute(Be));const Ge="dompurify"+(Se?"#"+Se:"");try{return fe.createPolicy(Ge,{createHTML(pt){return pt},createScriptURL(pt){return pt}})}catch{return console.warn("TrustedTypes policy "+Ge+" could not be created."),null}},Re=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ae(){let ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fe();const fe=X=>ae(X);if(fe.version="3.3.3",fe.removed=[],!ve||!ve.document||ve.document.nodeType!==Me.document||!ve.Element)return fe.isSupported=!1,fe;let{document:ke}=ve;const Se=ke,Be=Se.currentScript,{DocumentFragment:Ge,HTMLTemplateElement:pt,Node:jt,Element:gt,NodeFilter:St,NamedNodeMap:Ct=ve.NamedNodeMap||ve.MozNamedAttrMap,HTMLFormElement:Tt,DOMParser:Bt,trustedTypes:Ke}=ve,at=gt.prototype,_t=L(at,"cloneNode"),Ut=L(at,"remove"),kt=L(at,"nextSibling"),Vt=L(at,"childNodes"),S=L(at,"parentNode");if(typeof pt=="function"){const X=ke.createElement("template");X.content&&X.content.ownerDocument&&(ke=X.content.ownerDocument)}let P,I="";const{implementation:Z,createNodeIterator:be,createDocumentFragment:Oe,getElementsByTagName:Ze}=ke,{importNode:Ue}=Se;let He=Re();fe.isSupported=typeof t=="function"&&typeof S=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:bt,ERB_EXPR:Dt,TMPLIT_EXPR:Mt,DATA_ATTR:$t,ARIA_ATTR:Zt,IS_SCRIPT_OR_DATA:Et,ATTR_WHITESPACE:ft,CUSTOM_ELEMENT:ge}=Ce;let{IS_ALLOWED_URI:Te}=Ce,Pe=null;const ze=C({},[...z,...U,...H,...Y,...ne]);let Ve=null;const xt=C({},[...ie,...xe,...V,...q]);let Je=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),cr=null,Or=null;const rr=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Lr=!0,Ht=!0,Mr=!1,$e=!0,ar=!1,kr=!0,ut=!1,W=!1,Q=!1,we=!1,Ae=!1,ht=!1,Ye=!0,yt=!1;const Ot="user-content-";let Jt=!0,At=!1,mt={},Rt=null;const qt=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let It=null;const sr=C({},["audio","video","img","source","image","track"]);let xr=null;const br=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",nr="http://www.w3.org/1999/xhtml";let yr=nr,Ir=!1,st=null;const We=C({},[lr,ur,nr],x);let Xt=C({},["mi","mo","mn","ms","mtext"]),ir=C({},["annotation-xml"]);const Fr=C({},["title","style","font","a","script"]);let vt=null;const dr=["application/xhtml+xml","text/html"],vr="text/html";let $=null,re=null;const he=ke.createElement("form"),se=function(M){return M instanceof RegExp||M instanceof Function},ye=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(re&&re===M)){if((!M||typeof M!="object")&&(M={}),M=D(M),vt=dr.indexOf(M.PARSER_MEDIA_TYPE)===-1?vr:M.PARSER_MEDIA_TYPE,$=vt==="application/xhtml+xml"?x:w,Pe=y(M,"ALLOWED_TAGS")?C({},M.ALLOWED_TAGS,$):ze,Ve=y(M,"ALLOWED_ATTR")?C({},M.ALLOWED_ATTR,$):xt,st=y(M,"ALLOWED_NAMESPACES")?C({},M.ALLOWED_NAMESPACES,x):We,xr=y(M,"ADD_URI_SAFE_ATTR")?C(D(br),M.ADD_URI_SAFE_ATTR,$):br,It=y(M,"ADD_DATA_URI_TAGS")?C(D(sr),M.ADD_DATA_URI_TAGS,$):sr,Rt=y(M,"FORBID_CONTENTS")?C({},M.FORBID_CONTENTS,$):qt,cr=y(M,"FORBID_TAGS")?C({},M.FORBID_TAGS,$):D({}),Or=y(M,"FORBID_ATTR")?C({},M.FORBID_ATTR,$):D({}),mt=y(M,"USE_PROFILES")?M.USE_PROFILES:!1,Lr=M.ALLOW_ARIA_ATTR!==!1,Ht=M.ALLOW_DATA_ATTR!==!1,Mr=M.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ar=M.SAFE_FOR_TEMPLATES||!1,kr=M.SAFE_FOR_XML!==!1,ut=M.WHOLE_DOCUMENT||!1,we=M.RETURN_DOM||!1,Ae=M.RETURN_DOM_FRAGMENT||!1,ht=M.RETURN_TRUSTED_TYPE||!1,Q=M.FORCE_BODY||!1,Ye=M.SANITIZE_DOM!==!1,yt=M.SANITIZE_NAMED_PROPS||!1,Jt=M.KEEP_CONTENT!==!1,At=M.IN_PLACE||!1,Te=M.ALLOWED_URI_REGEXP||Ie,yr=M.NAMESPACE||nr,Xt=M.MATHML_TEXT_INTEGRATION_POINTS||Xt,ir=M.HTML_INTEGRATION_POINTS||ir,Je=M.CUSTOM_ELEMENT_HANDLING||{},M.CUSTOM_ELEMENT_HANDLING&&se(M.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Je.tagNameCheck=M.CUSTOM_ELEMENT_HANDLING.tagNameCheck),M.CUSTOM_ELEMENT_HANDLING&&se(M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Je.attributeNameCheck=M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),M.CUSTOM_ELEMENT_HANDLING&&typeof M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Je.allowCustomizedBuiltInElements=M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ar&&(Ht=!1),Ae&&(we=!0),mt&&(Pe=C({},ne),Ve=c(null),mt.html===!0&&(C(Pe,z),C(Ve,ie)),mt.svg===!0&&(C(Pe,U),C(Ve,xe),C(Ve,q)),mt.svgFilters===!0&&(C(Pe,H),C(Ve,xe),C(Ve,q)),mt.mathMl===!0&&(C(Pe,Y),C(Ve,V),C(Ve,q))),y(M,"ADD_TAGS")||(rr.tagCheck=null),y(M,"ADD_ATTR")||(rr.attributeCheck=null),M.ADD_TAGS&&(typeof M.ADD_TAGS=="function"?rr.tagCheck=M.ADD_TAGS:(Pe===ze&&(Pe=D(Pe)),C(Pe,M.ADD_TAGS,$))),M.ADD_ATTR&&(typeof M.ADD_ATTR=="function"?rr.attributeCheck=M.ADD_ATTR:(Ve===xt&&(Ve=D(Ve)),C(Ve,M.ADD_ATTR,$))),M.ADD_URI_SAFE_ATTR&&C(xr,M.ADD_URI_SAFE_ATTR,$),M.FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.FORBID_CONTENTS,$)),M.ADD_FORBID_CONTENTS&&(Rt===qt&&(Rt=D(Rt)),C(Rt,M.ADD_FORBID_CONTENTS,$)),Jt&&(Pe["#text"]=!0),ut&&C(Pe,["html","head","body"]),Pe.table&&(C(Pe,["tbody"]),delete cr.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=M.TRUSTED_TYPES_POLICY,I=P.createHTML("")}else P===void 0&&(P=ue(Ke,Be)),P!==null&&typeof I=="string"&&(I=P.createHTML(""));i&&i(M),re=M}},De=C({},[...U,...H,...F]),lt=C({},[...Y,...G]),Xe=function(M){let ce=S(M);(!ce||!ce.tagName)&&(ce={namespaceURI:yr,tagName:"template"});const me=w(M.tagName),qe=w(ce.tagName);return st[M.namespaceURI]?M.namespaceURI===ur?ce.namespaceURI===nr?me==="svg":ce.namespaceURI===lr?me==="svg"&&(qe==="annotation-xml"||Xt[qe]):!!De[me]:M.namespaceURI===lr?ce.namespaceURI===nr?me==="math":ce.namespaceURI===ur?me==="math"&&ir[qe]:!!lt[me]:M.namespaceURI===nr?ce.namespaceURI===ur&&!ir[qe]||ce.namespaceURI===lr&&!Xt[qe]?!1:!lt[me]&&(Fr[me]||!De[me]):!!(vt==="application/xhtml+xml"&&st[M.namespaceURI]):!1},Qe=function(M){p(fe.removed,{element:M});try{S(M).removeChild(M)}catch{Ut(M)}},ct=function(M,ce){try{p(fe.removed,{attribute:ce.getAttributeNode(M),from:ce})}catch{p(fe.removed,{attribute:null,from:ce})}if(ce.removeAttribute(M),M==="is")if(we||Ae)try{Qe(ce)}catch{}else try{ce.setAttribute(M,"")}catch{}},et=function(M){let ce=null,me=null;if(Q)M="<remove></remove>"+M;else{const it=g(M,/^[\r\n\t ]+/);me=it&&it[0]}vt==="application/xhtml+xml"&&yr===nr&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const qe=P?P.createHTML(M):M;if(yr===nr)try{ce=new Bt().parseFromString(qe,vt)}catch{}if(!ce||!ce.documentElement){ce=Z.createDocument(yr,"template",null);try{ce.documentElement.innerHTML=Ir?I:qe}catch{}}const nt=ce.body||ce.documentElement;return M&&me&&nt.insertBefore(ke.createTextNode(me),nt.childNodes[0]||null),yr===nr?Ze.call(ce,ut?"html":"body")[0]:ut?ce.documentElement:nt},Pt=function(M){return be.call(M.ownerDocument||M,M,St.SHOW_ELEMENT|St.SHOW_COMMENT|St.SHOW_TEXT|St.SHOW_PROCESSING_INSTRUCTION|St.SHOW_CDATA_SECTION,null)},Kt=function(M){return M instanceof Tt&&(typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||!(M.attributes instanceof Ct)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function")},Lt=function(M){return typeof jt=="function"&&M instanceof jt};function dt(X,M,ce){l(X,me=>{me.call(fe,M,ce,re)})}const or=function(M){let ce=null;if(dt(He.beforeSanitizeElements,M,null),Kt(M))return Qe(M),!0;const me=$(M.nodeName);if(dt(He.uponSanitizeElement,M,{tagName:me,allowedTags:Pe}),kr&&M.hasChildNodes()&&!Lt(M.firstElementChild)&&m(/<[/\w!]/g,M.innerHTML)&&m(/<[/\w!]/g,M.textContent)||M.nodeType===Me.progressingInstruction||kr&&M.nodeType===Me.comment&&m(/<[/\w]/g,M.data))return Qe(M),!0;if(!(rr.tagCheck instanceof Function&&rr.tagCheck(me))&&(!Pe[me]||cr[me])){if(!cr[me]&&ra(me)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me)))return!1;if(Jt&&!Rt[me]){const qe=S(M)||M.parentNode,nt=Vt(M)||M.childNodes;if(nt&&qe){const it=nt.length;for(let ot=it-1;ot>=0;--ot){const Ft=_t(nt[ot],!0);Ft.__removalCount=(M.__removalCount||0)+1,qe.insertBefore(Ft,kt(M))}}}return Qe(M),!0}return M instanceof gt&&!Xe(M)||(me==="noscript"||me==="noembed"||me==="noframes")&&m(/<\/no(script|embed|frames)/i,M.innerHTML)?(Qe(M),!0):(ar&&M.nodeType===Me.text&&(ce=M.textContent,l([bt,Dt,Mt],qe=>{ce=v(ce,qe," ")}),M.textContent!==ce&&(p(fe.removed,{element:M.cloneNode()}),M.textContent=ce)),dt(He.afterSanitizeElements,M,null),!1)},Yr=function(M,ce,me){if(Or[ce]||Ye&&(ce==="id"||ce==="name")&&(me in ke||me in he))return!1;if(!(Ht&&!Or[ce]&&m($t,ce))){if(!(Lr&&m(Zt,ce))){if(!(rr.attributeCheck instanceof Function&&rr.attributeCheck(ce,M))){if(!Ve[ce]||Or[ce]){if(!(ra(M)&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,M)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(M))&&(Je.attributeNameCheck instanceof RegExp&&m(Je.attributeNameCheck,ce)||Je.attributeNameCheck instanceof Function&&Je.attributeNameCheck(ce,M))||ce==="is"&&Je.allowCustomizedBuiltInElements&&(Je.tagNameCheck instanceof RegExp&&m(Je.tagNameCheck,me)||Je.tagNameCheck instanceof Function&&Je.tagNameCheck(me))))return!1}else if(!xr[ce]){if(!m(Te,v(me,ft,""))){if(!((ce==="src"||ce==="xlink:href"||ce==="href")&&M!=="script"&&N(me,"data:")===0&&It[M])){if(!(Mr&&!m(Et,v(me,ft,"")))){if(me)return!1}}}}}}}return!0},ra=function(M){return M!=="annotation-xml"&&g(M,ge)},R=function(M){dt(He.beforeSanitizeAttributes,M,null);const{attributes:ce}=M;if(!ce||Kt(M))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let qe=ce.length;for(;qe--;){const nt=ce[qe],{name:it,namespaceURI:ot,value:Ft}=nt,Qt=$(it),zt=Ft;let wt=it==="value"?zt:j(zt);if(me.attrName=Qt,me.attrValue=wt,me.keepAttr=!0,me.forceKeepAttr=void 0,dt(He.uponSanitizeAttribute,M,me),wt=me.attrValue,yt&&(Qt==="id"||Qt==="name")&&(ct(it,M),wt=Ot+wt),kr&&m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,wt)){ct(it,M);continue}if(Qt==="attributename"&&g(wt,"href")){ct(it,M);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){ct(it,M);continue}if(!$e&&m(/\/>/i,wt)){ct(it,M);continue}ar&&l([bt,Dt,Mt],Sr=>{wt=v(wt,Sr," ")});const fr=$(M.nodeName);if(!Yr(fr,Qt,wt)){ct(it,M);continue}if(P&&typeof Ke=="object"&&typeof Ke.getAttributeType=="function"&&!ot)switch(Ke.getAttributeType(fr,Qt)){case"TrustedHTML":{wt=P.createHTML(wt);break}case"TrustedScriptURL":{wt=P.createScriptURL(wt);break}}if(wt!==zt)try{ot?M.setAttributeNS(ot,it,wt):M.setAttribute(it,wt),Kt(M)?Qe(M):u(fe.removed)}catch{ct(it,M)}}dt(He.afterSanitizeAttributes,M,null)},J=function X(M){let ce=null;const me=Pt(M);for(dt(He.beforeSanitizeShadowDOM,M,null);ce=me.nextNode();)dt(He.uponSanitizeShadowNode,ce,null),or(ce),R(ce),ce.content instanceof Ge&&X(ce.content);dt(He.afterSanitizeShadowDOM,M,null)};return fe.sanitize=function(X){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,me=null,qe=null,nt=null;if(Ir=!X,Ir&&(X="<!-->"),typeof X!="string"&&!Lt(X))if(typeof X.toString=="function"){if(X=X.toString(),typeof X!="string")throw _("dirty is not a string, aborting")}else throw _("toString is not a function");if(!fe.isSupported)return X;if(W||ye(M),fe.removed=[],typeof X=="string"&&(At=!1),At){if(X.nodeName){const Ft=$(X.nodeName);if(!Pe[Ft]||cr[Ft])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(X instanceof jt)ce=et("<!---->"),me=ce.ownerDocument.importNode(X,!0),me.nodeType===Me.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?ce=me:ce.appendChild(me);else{if(!we&&!ar&&!ut&&X.indexOf("<")===-1)return P&&ht?P.createHTML(X):X;if(ce=et(X),!ce)return we?null:ht?I:""}ce&&Q&&Qe(ce.firstChild);const it=Pt(At?X:ce);for(;qe=it.nextNode();)or(qe),R(qe),qe.content instanceof Ge&&J(qe.content);if(At)return X;if(we){if(Ae)for(nt=Oe.call(ce.ownerDocument);ce.firstChild;)nt.appendChild(ce.firstChild);else nt=ce;return(Ve.shadowroot||Ve.shadowrootmode)&&(nt=Ue.call(Se,nt,!0)),nt}let ot=ut?ce.outerHTML:ce.innerHTML;return ut&&Pe["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&m(oe,ce.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
1072
1072
  `+ot),ar&&l([bt,Dt,Mt],Ft=>{ot=v(ot,Ft," ")}),P&&ht?P.createHTML(ot):ot},fe.setConfig=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ye(X),W=!0},fe.clearConfig=function(){re=null,W=!1},fe.isValidAttribute=function(X,M,ce){re||ye({});const me=$(X),qe=$(M);return Yr(me,qe,ce)},fe.addHook=function(X,M){typeof M=="function"&&p(He[X],M)},fe.removeHook=function(X,M){if(M!==void 0){const ce=h(He[X],M);return ce===-1?void 0:b(He[X],ce,1)[0]}return u(He[X])},fe.removeHooks=function(X){He[X]=[]},fe.removeAllHooks=function(){He=Re()},fe}var de=ae();return Ki=de,Ki}var Qi,zc;function _p(){return zc||(zc=1,Qi=self.DOMPurify||(self.DOMPurify=Hc().default||Hc())),Qi}var kp=_p();const Ep=$0(kp);var Ap="https://ipfs.3speak.tv",Sp=["https://ipfs.skatehive.app","https://cloudflare-ipfs.com","https://ipfs.io"],Cp=["peakd.com","ecency.com","hive.blog","hiveblog.io","leofinance.io","3speak.tv","d.tube","esteem.app","busy.org"],Tp={ALLOWED_TAGS:["p","br","span","div","blockquote","pre","code","strong","em","b","i","u","ins","del","s","strike","mark","sub","sup","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","col","colgroup","a","img","video","source","audio","iframe","hr","center","details","summary"],ALLOWED_ATTR:["href","src","alt","title","width","height","class","id","style","target","rel","controls","muted","preload","loading","autoplay","loop","type","allowfullscreen","frameborder","allow","scrolling","colspan","rowspan","align","valign","start","reversed","data-dnt","data-theme","allowtransparency"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|ipfs):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1,FORBID_TAGS:["script","form","input","button","textarea","select","dialog","object","embed","applet","base","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"],KEEP_CONTENT:!0,RETURN_TRUSTED_TYPE:!1};function Dp(t){return t.replace(/<p><center>([\s\S]*?)<hr \/>([\s\S]*?)<\/center><\/p>/gi,(r,n,s)=>`<center>${n.trim()}</center><hr />${s.trim()}`)}function Pp(t){const r=new Set,n=new Set;return t=Dp(t),t=t.replace(/<a[^>]*href="(https?:\/\/3speak\.tv\/watch\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(s,a,i)=>r.has(i)?s:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/watch?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/play\.3speak\.tv\/watch\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(s,a,i)=>r.has(i)?s:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/watch?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/play\.3speak\.tv\/embed\?v=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(s,a,i)=>r.has(i)?s:(r.add(i),`<div class="video-container"><iframe src="${`https://play.3speak.tv/embed?v=${i}&mode=iframe`}" allowfullscreen loading="lazy"></iframe></div>`)),t=t.replace(/<a[^>]*href="(https?:\/\/audio\.3speak\.tv\/play\?a=([^"&]+)[^"]*)"[^>]*>.*?<\/a>/g,(s,a,i)=>n.has(i)?s:(n.add(i),`<div class="audio-container"><iframe src="${`https://audio.3speak.tv/play?a=${i}`}" loading="lazy"></iframe></div>`)),t}function Op(t){const r=new Set,n=/<a[^>]*href="(https?:\/\/(?:twitter\.com|x\.com)\/([^/]+)\/status\/(\d+)[^"]*)"[^>]*>.*?<\/a>/gi;t=t.replace(n,(a,i,o,c)=>r.has(c)?a:(r.add(c),`<div class="twitter-embed-container" style="max-width: 550px;">
1073
1073
  <iframe
1074
1074
  src="https://platform.twitter.com/embed/Tweet.html?id=${c}&dnt=true"
@@ -1121,8 +1121,8 @@ and ensure you are accounting for this risk.
1121
1121
  ${Fe}`),de&&(ge+=`
1122
1122
  ${de}`),await t(ge),B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}catch(ge){console.error("Failed to submit:",ge)}finally{ee(!1)}}};k.useEffect(()=>(F&&(F.current={submit:Dt,getFinalBody:()=>{let ge=q.trim();return Fe&&(ge+=`
1123
1123
  ${Fe}`),de&&(ge+=`
1124
- ${de}`),ge},clear:()=>{B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}}),()=>{F&&(F.current=null)}));const Mt=ge=>{ge.key==="Enter"&&(ge.metaKey||ge.ctrlKey)&&(ge.preventDefault(),Dt()),ge.key==="Escape"&&r&&r()},$t=()=>{ue(null),ae(0)},Yt=()=>{fe&&URL.revokeObjectURL(fe),ve(null),ke(null)},Et=k.useCallback(()=>{if(!q.trim())return null;const ge=q.split(/(```[\s\S]*?```)/g);let Te=0;return e.jsx("div",{className:"space-y-2",children:ge.map((Pe,ze)=>{if(Pe.startsWith("```")&&Pe.endsWith("```")){const xt=Pe.slice(3,-3).replace(/^\w*\n?/,""),Je=Te++;return e.jsxs("div",{className:"relative group rounded-lg overflow-hidden",children:[e.jsx("pre",{className:"bg-gray-950 text-green-400 p-3 rounded-lg text-xs overflow-x-auto font-mono",children:e.jsx("code",{children:xt.trim()||" "})}),e.jsx("button",{type:"button",onClick:()=>Z(xt.trim(),Je),className:"absolute top-2 right-2 p-1.5 rounded-md bg-gray-800 hover:bg-gray-700 text-gray-400 hover:text-white transition-colors opacity-0 group-hover:opacity-100",title:"Copy code",children:Se===Je?e.jsx(O.Check,{className:"h-3.5 w-3.5 text-green-400"}):e.jsx(O.Copy,{className:"h-3.5 w-3.5"})})]},ze)}const Ve=Pe.split(/(`[^`]+`)/g);return e.jsx("span",{children:Ve.map((xt,Je)=>{if(xt.startsWith("`")&&xt.endsWith("`")){const cr=xt.slice(1,-1);return e.jsx("code",{className:"bg-gray-800 text-amber-400 px-1.5 py-0.5 rounded text-xs font-mono cursor-pointer hover:bg-gray-700 transition-colors",title:"Click to copy",onClick:()=>navigator.clipboard.writeText(cr),children:cr},Je)}return xt.trim()?e.jsx("span",{className:"text-gray-300 text-sm",children:xt},Je):null})},ze)})})},[q,Se,Z]),ft="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50";return e.jsxs("div",{className:`p-4 md:p-6 space-y-3 rounded-xl border transition-colors ${jt?"border-blue-500 bg-blue-900/10":""}`,style:{backgroundColor:jt?void 0:G||"#111827",borderColor:jt?void 0:ne||"#374151"},onDragEnter:Ze,onDragLeave:Ue,onDragOver:He,onDrop:bt,children:[T&&e.jsx("h3",{className:"text-white font-semibold text-base",children:T}),!Y&&e.jsxs("div",{className:"flex items-center justify-start space-x-3 text-left",children:[e.jsx("div",{className:"flex-shrink-0",children:n?e.jsx("img",{src:`https://images.hive.blog/u/${n}/avatar`,alt:n,className:"w-10 h-10 rounded-full object-cover border-2 border-gray-600",onError:ge=>{ge.target.src=`https://ui-avatars.com/api/?name=${n}&background=random`}}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center",children:e.jsx(O.User,{className:"w-6 h-6 text-gray-400"})})}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("div",{className:"text-sm text-white font-medium",children:n?`@${n}`:"Anonymous"}),a&&e.jsxs("div",{className:"text-xs text-gray-400",children:["Replying to @",a]})]})]}),Ce&&q.trim()&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800/50 overflow-hidden max-h-[300px] flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 text-xs uppercase tracking-wide text-gray-400 bg-gray-800 border-b border-gray-700 flex items-center justify-between shrink-0",children:[e.jsx("span",{children:"Preview"}),(q.includes("```")||/`[^`]+`/.test(q))&&e.jsx("span",{className:"text-[10px] text-gray-500 normal-case",children:"Hover code blocks to copy"})]}),e.jsx("div",{className:"p-3 overflow-y-auto",style:{scrollbarWidth:"thin"},children:kt?e.jsx("div",{className:"rendered-body text-white text-sm overflow-x-auto prose prose-invert prose-sm max-w-none",dangerouslySetInnerHTML:{__html:kt(q)}}):Et()})]}),Fe&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[e.jsx("div",{className:"relative",style:{height:"60px",overflow:"hidden"},children:e.jsx("iframe",{src:Fe,title:"Audio preview",className:"w-full border-0 absolute top-0 left-0",style:{height:"200px"},allow:"autoplay; encrypted-media",loading:"lazy"})}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsxs("span",{className:"flex-1 truncate text-xs text-gray-400",children:["Audio attached",Re>0?` (${Math.floor(Re/60)}:${String(Re%60).padStart(2,"0")})`:""]}),e.jsx("button",{type:"button",onClick:$t,className:"shrink-0 rounded p-1.5 text-gray-400 hover:text-red-400 hover:bg-gray-700 transition-colors",title:"Remove audio",children:e.jsx(O.X,{className:"h-4 w-4"})})]})]}),de&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[fe?e.jsx("video",{src:fe,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"200px"}}):e.jsx("div",{className:"h-20 flex items-center justify-center text-gray-400 text-xs",children:"Video attached"}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsx("span",{className:"flex-1 truncate text-xs text-gray-400",children:"Video attached"}),e.jsx("button",{type:"button",onClick:Yt,className:"shrink-0 rounded p-0.5 text-gray-400 hover:text-red-400",title:"Remove video",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]})]}),Tt&&e.jsx("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(O.BarChart3,{className:"h-3.5 w-3.5 shrink-0 text-blue-400"}),e.jsx("span",{className:"flex-1 truncate text-xs font-medium text-white",children:Tt.question}),e.jsx("button",{type:"button",onClick:()=>at(!0),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-white",title:"Edit poll",children:e.jsx(O.Code,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{Bt(null),E?.(null)},className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-red-400",title:"Remove poll",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Tt.choices.map((ge,Te)=>e.jsx("span",{className:"rounded-full bg-gray-700 px-2 py-0.5 text-xs text-gray-300",children:ge},Te))}),e.jsxs("div",{className:"mt-1.5 text-[10px] text-gray-500",children:["Ends ",new Date(Tt.end_time*1e3).toLocaleDateString()," · Max ",Tt.max_choices_voted," choice",Tt.max_choices_voted>1?"s":""]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-gray-700 pb-2",children:[!m&&e.jsx("button",{type:"button",onClick:()=>Me(ge=>!ge),className:`${ft} ${Ce?"bg-gray-700 text-blue-400":""}`,title:Ce?"Hide preview":"Show preview",disabled:te,children:Ce?e.jsx(O.EyeOff,{className:"h-4 w-4"}):e.jsx(O.Eye,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!h&&e.jsx("button",{type:"button",onClick:()=>Vt("**","**"),className:ft,title:"Bold",disabled:te,children:e.jsx(O.Bold,{className:"h-4 w-4"})}),!u&&e.jsx("button",{type:"button",onClick:()=>Vt("*","*"),className:ft,title:"Italic",disabled:te,children:e.jsx(O.Italic,{className:"h-4 w-4"})}),!p&&e.jsx("button",{type:"button",onClick:()=>Vt("[","](url)"),className:ft,title:"Link",disabled:te,children:e.jsx(O.Link,{className:"h-4 w-4"})}),!N&&e.jsx("button",{type:"button",onClick:P,className:ft,title:"Code block",disabled:te,children:e.jsx(O.Code,{className:"h-4 w-4"})}),!j&&e.jsx("button",{type:"button",onClick:I,className:ft,title:a?`Mention @${a}`:"Mention",disabled:te,children:e.jsx(O.AtSign,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!b&&o&&e.jsx(e0,{onImageUploaded:ge=>S(`![Image](${ge})`),ecencyToken:o,disabled:te}),!w&&c&&e.jsx(t0,{onAudioUploaded:(ge,Te)=>{ue(ge),ae(Te)},username:n,threeSpeakApiKey:c,disabled:pe||!!Fe}),!x&&c&&e.jsx(r0,{onVideoUploaded:(ge,Te,Pe,ze)=>{ve(ge),ze&&ke(URL.createObjectURL(ze))},username:n,ecencyToken:o,threeSpeakApiKey:c,disabled:pe||!!de}),!g&&e.jsx("button",{type:"button",onClick:()=>le(!0),className:ft,title:"Emoji",disabled:te,children:e.jsx(O.Smile,{className:"h-4 w-4"})}),!v&&d&&e.jsx("button",{type:"button",onClick:()=>Ie(!0),className:`${ft} text-xs font-bold px-2`,title:"GIF",disabled:te,children:"GIF"}),!y&&f&&Ge.length>0&&e.jsx("button",{type:"button",onClick:()=>Ne(!0),className:ft,title:"Insert template",disabled:te,children:e.jsx(O.FileText,{className:"h-4 w-4"})}),!_&&e.jsx("button",{type:"button",onClick:()=>at(!0),className:`${ft} ${Tt?"text-blue-400":""}`,title:Tt?"Edit poll":"Create poll",disabled:te,children:e.jsx(O.BarChart3,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative",children:[jt&&e.jsx("div",{className:"absolute inset-0 z-10 bg-blue-900/30 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-blue-300 font-medium text-sm",children:"Drop image to upload"})}),St&&e.jsx("div",{className:"absolute inset-0 z-10 bg-gray-900/80 rounded-lg flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-400 border-t-transparent rounded-full animate-spin"}),"Uploading image..."]})}),e.jsx("textarea",{ref:_t,value:q,onChange:ge=>B(ge.target.value),onKeyDown:Mt,onPaste:Oe,placeholder:o?`${s}
1125
- (Paste or drag & drop images here)`:s,disabled:te,rows:4,className:"w-full min-h-[100px] max-h-[300px] p-3 border border-gray-700 rounded-lg resize-y focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-gray-800 text-white placeholder-gray-500 transition-colors duration-200 disabled:opacity-50 text-sm font-mono",onInput:ge=>{const Te=ge.target;Te.style.height="auto",Te.style.height=Te.scrollHeight+"px"}})]}),!H&&e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"text-xs text-gray-500",children:[navigator.platform?.includes("Mac")?"Cmd":"Ctrl","+Enter to post",o&&e.jsx("span",{className:"ml-2",children:"| Paste/drop images"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[A&&r&&e.jsx("button",{onClick:r,disabled:te,className:"px-4 py-2 text-gray-400 hover:text-white transition-colors disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Dt,disabled:te||!q.trim(),className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white rounded-lg font-medium transition-all disabled:opacity-50 flex items-center space-x-2",children:pe?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),e.jsx("span",{children:"Posting..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.Send,{className:"w-4 h-4"}),e.jsx("span",{children:C})]})})]})]}),e.jsx(a0,{isOpen:_e,onClose:()=>Ie(!1),onSelectGif:ge=>{S(`![GIF](${ge})`),Ie(!1)},giphyApiKey:d}),e.jsx(s0,{isOpen:K,onClose:()=>le(!1),onSelectEmoji:ge=>{S(ge),le(!1)}}),e.jsx(n0,{isOpen:oe,onClose:()=>Ne(!1),onSelectTemplate:S,templates:Ge,authorFromUrl:a}),e.jsx(i0,{isOpen:Ke,onClose:()=>at(!1),onSave:ge=>{Bt(ge),E?.(ge)},initialData:Tt})]})},xs=gs,Ip=({parentAuthor:t,parentPermlink:r,onClose:n,onCommentSubmitted:s,currentUser:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})=>{const[l,h]=k.useState(!1),u=async p=>{if(!(!p.trim()||l)){h(!0);try{await s(t,r,p),n()}catch(b){console.error("Failed to submit reply:",b)}finally{h(!1)}}};return k.useEffect(()=>{const p=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[n]),e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-900 rounded-lg",children:e.jsx(O.Send,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white",children:"Reply to Comment"}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]})]}),e.jsx("button",{onClick:n,disabled:l,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",children:e.jsx(O.X,{className:"w-6 h-6 text-gray-400"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(xs,{onSubmit:u,onCancel:n,currentUser:a,parentAuthor:t,parentPermlink:r,placeholder:`Reply to @${t}...`,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})}),e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs md:text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{children:"• Markdown supported"}),e.jsx("span",{children:"• Be respectful"})]}),e.jsx("div",{className:"hidden md:block",children:"Press Esc to close"})]})})]})})},Fp=({isVisible:t,searchQuery:r,onSearchChange:n,onClose:s})=>{const a=k.useRef(null);k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const i=()=>{n(""),s()};return e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${t?"max-h-20 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"p-4 border-b border-gray-700 bg-gray-900/30",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{ref:a,type:"text",value:r,onChange:o=>n(o.target.value),placeholder:"Search comments and authors...",className:"w-full pl-10 pr-10 py-2 bg-gray-800 border border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-white placeholder-gray-400 transition-colors duration-200"}),r&&e.jsx("button",{onClick:()=>n(""),className:"absolute right-8 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:i,className:"absolute right-3 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400"})})]})})})},Oo=({author:t,permlink:r,onClose:n,currentUser:s,token:a,onClickCommentUpvote:i,onClickCommentReply:o,onClickUpvoteButton:c,onSubmitComment:d,ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})=>{const[b,w]=k.useState([]),[x,g]=k.useState([]),[v,N]=k.useState(!0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(""),[D,L]=k.useState(!1),[z,U]=k.useState(!1),H=k.useCallback(async(xe=!1)=>{xe?U(!0):N(!0),y(null);try{const V=await Nt.getCommentsList(t,r,s??"");w(V),g(V)}catch(V){y(V instanceof Error?V.message:"Failed to load comments")}finally{N(!1),U(!1)}},[t,r]);k.useEffect(()=>{H()},[H]),k.useEffect(()=>{if(!C.trim())g(b);else{const xe=b.filter(V=>V.body?.toLowerCase().includes(C.toLowerCase())||V.author.toLowerCase().includes(C.toLowerCase()));g(xe)}},[C,b]);const F=(xe,V)=>{_({author:xe,permlink:V})},Y=xe=>{xe.target===xe.currentTarget&&n()},G=async(xe,V,q)=>{if(d){try{await Promise.resolve(d(xe,V,q)),L(!1),U(!0),setTimeout(async()=>{await H(!0),U(!1)},3e3)}catch(B){const pe=B instanceof Error?B.message:"Failed to post comment";alert(pe)}return}if(!a){alert("Please login to comment");return}try{await Nt.handleComment({author:xe,permlink:V,body:q,authToken:a}),L(!1),U(!0),setTimeout(async()=>{await H(!0),U(!1)},3e3)}catch(B){const pe=B instanceof Error?B.message:"Failed to post comment";alert(pe)}},ne=k.useMemo(()=>{if(!s?.trim())return x;const xe=s.toLowerCase();return[...x].sort((V,q)=>{const B=V.author?.toLowerCase()===xe,pe=q.author?.toLowerCase()===xe;return B&&!pe?-1:!B&&pe?1:0})},[x,s]),ie=ne.filter(xe=>xe.parent_author===t&&xe.parent_permlink===r);return v?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4 h-screen",children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl h-[90vh] flex flex-col",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"w-12 h-12 animate-spin text-blue-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-300",children:"Loading comments..."})]})})})}):j?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:Y,children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(O.AlertCircle,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Failed to load comments"}),e.jsx("p",{className:"text-gray-300 mb-6",children:j}),e.jsx("button",{onClick:()=>H(),className:"px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors duration-200",children:"Try Again"})]})})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:Y,children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("h2",{className:"text-lg md:text-xl font-bold text-white",children:["Comments (",b.length,")"]}),z&&e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>H(!0),disabled:z,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",title:"Refresh comments",children:e.jsx(O.RefreshCw,{className:`w-5 h-5 text-gray-400 ${z?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>A(!E),className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",title:"Search comments",children:e.jsx(O.Search,{className:"w-5 h-5 text-gray-400"})}),e.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-6 h-6 text-gray-400"})})]})]}),e.jsx(Fp,{isVisible:E,searchQuery:C,onSearchChange:T,onClose:()=>A(!1)}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[D&&e.jsx("div",{className:"border-b border-gray-700",children:e.jsx(xs,{onSubmit:xe=>G(t,r,xe),onCancel:()=>L(!1),currentUser:s,placeholder:"Add a comment...",ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})}),ie.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center",children:[e.jsx(O.MessageCirclePlus,{className:"w-16 h-16 text-gray-600 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:C?"No comments found":"No comments yet"}),e.jsx("p",{className:"text-gray-400 mb-6",children:C?"Try adjusting your search terms":"Be the first to share your thoughts!"}),!C&&s&&e.jsx("button",{onClick:()=>L(!0),className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-colors duration-200",children:"Add Comment"})]}):e.jsx("div",{className:"divide-y divide-gray-700",children:ie.map(xe=>e.jsx(Po,{comment:xe,allComments:ne,onReply:F,currentUser:s,token:a,searchQuery:C,depth:0,onVotedRefresh:()=>H(!0),onClickCommentUpvote:i,onClickCommentReply:o,onClickUpvoteButton:c},xe.permlink))})]}),!D&&s&&ie.length>0&&e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("button",{onClick:()=>L(!0),className:"w-full md:w-auto px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-all duration-200 transform hover:scale-[1.02] flex items-center justify-center space-x-2",children:[e.jsx(O.MessageCirclePlus,{className:"w-5 h-5"}),e.jsx("span",{children:"Add Comment"})]})})]})}),m&&e.jsx(Ip,{parentAuthor:m.author,parentPermlink:m.permlink,onClose:()=>_(null),onCommentSubmitted:G,currentUser:s,ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})]})};function Bp(t){const r=typeof t=="string"?new Date(t):t,n=Math.floor((Date.now()-r.getTime())/1e3),s={year:31536e3,month:2628e3,day:86400,hour:3600,minute:60};for(const[a,i]of Object.entries(s)){const o=Math.floor(n/i);if(o>1)return`${o} ${a}s ago`;if(o===1)return`${o} ${a} ago`}return"just now"}const Lo=({author:t,permlink:r,onClose:n,currentUser:s,token:a,onClickUpvoteButton:i})=>{const[o,c]=k.useState([]),[d,f]=k.useState(!0),[l,h]=k.useState(!1),u=!!s&&o.some(_=>_.voter===s),[p,b]=k.useState(!1),[w,x]=k.useState(""),[g,v]=k.useState(!1),N=_=>{x(_),b(!0),setTimeout(()=>b(!1),2500)},j=async()=>{f(!0);const _=await Nt.getActiveVotes(t,r);_.sort((E,A)=>!E.time||!A.time?0:new Date(A.time).getTime()-new Date(E.time).getTime()),c(_),f(!1)};k.useEffect(()=>{j()},[t,r]);const y=_=>{_.target===_.currentTarget&&n()},m=async _=>{if(!a||!s){alert("Please login to upvote");return}try{const E=Math.round(_*100);await Nt.handleUpvote({author:t,permlink:r,weight:E,authToken:a}),h(!1),v(!0),setTimeout(async()=>{await j(),v(!1),N("Vote submitted successfully ✅"),n()},3e3)}catch(E){const A=E instanceof Error?E.message:"Failed to upvote";alert(A)}};return e.jsxs("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 px-4 h-screen",onClick:y,children:[e.jsxs("div",{className:"relative bg-gray-800 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 md:p-6 border-b border-gray-700 bg-gray-900/50 flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-bold text-white flex items-center space-x-2",children:[e.jsxs("span",{children:["Voters (",o.length,")"]}),g&&e.jsx("span",{className:"inline-flex items-center ml-2",children:e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})})]}),!l&&e.jsx("button",{onClick:()=>{if(i){i(s,a);return}if(!s||!a){N("Please login to upvote");return}u?N("You have already upvoted this post"):h(!0)},"aria-label":"Open Vote Slider",className:"p-1 hover:bg-gray-700 rounded",type:"button",children:e.jsx(O.ThumbsUp,{className:`w-5 h-5 ${u?"text-blue-400 fill-current":"text-gray-300"}`})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500"})}):l&&!u?e.jsx(qn,{author:t,permlink:r,onUpvote:m,onCancel:()=>h(!1)}):e.jsx("ul",{children:o.map(_=>e.jsxs("li",{className:"flex items-center p-4 border-b border-gray-700",children:[e.jsx("img",{src:`https://images.hive.blog/u/${_.voter}/avatar`,alt:_.voter,className:"w-10 h-10 rounded-full mr-4",onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${_.voter}&background=random`}}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:_.voter}),e.jsxs("div",{className:"text-sm text-gray-400",children:[((_.percent||0)/100).toFixed(0),"%",_.time&&` · ${Bp(_.time+"Z")}`]})]})]},_.voter))})})]}),p&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:w})})]})},l0=({isOpen:t,onClose:r,title:n,children:s,maxWidth:a="max-w-2xl"})=>t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:`relative bg-card border border-border rounded-xl shadow-xl w-full mx-4 ${a} max-h-[90vh] overflow-hidden animate-scale-in`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-card-foreground",children:n}),e.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(O.X,{className:"w-5 h-5 text-muted-foreground"})})]}),e.jsx("div",{className:"overflow-y-auto max-h-[calc(90vh-80px)] custom-scrollbar",children:s})]})]}):null,Up=({author:t,permlink:r,content:n,onClose:s})=>e.jsx(l0,{isOpen:!0,onClose:s,title:"Video Description",maxWidth:"max-w-2xl",children:e.jsxs("div",{className:"p-6",children:[n?e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-card-foreground font-sans leading-relaxed",children:n})})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No description available"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video doesn't have a description yet."})]}),e.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["By @",t]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["/",r]})]})})]})}),Vp=({username:t,permlink:r,onAuthorClick:n,onVideoClick:s,onTagClick:a,onBack:i,onCommentsModal:o,onUpvotesModal:c,onDescriptionModal:d,onVideoInfo:f,onShare:l,onBookmark:h}={})=>{const u=t,p=r,[b,w]=k.useState(null),[x,g]=k.useState(!0),[v,N]=k.useState(null),[j,y]=k.useState(!1),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(!1),[D,L]=k.useState(!1),[z,U]=k.useState(!1),H=k.useRef(null),F=k.useRef(null),Y=k.useRef(null);k.useEffect(()=>{(async()=>{if(!(!u||!p))try{g(!0),N(null);const B=await Nt.getVideoDetails(u,p);w(B),y(!1),_(null)}catch(B){N(B instanceof Error?B.message:"Failed to load video")}finally{g(!1)}})()},[u,p]);const G=q=>q?q.startsWith("ipfs://")?`https://ipfs-3speak.b-cdn.net/ipfs/${q.replace("ipfs://","").split("/")[0]}/manifest.m3u8`:q:"";k.useEffect(()=>((async()=>{const B=b?.video_v2;if(!j||!B||!H.current)return;const pe=H.current,ee=G(B);F.current&&(F.current.destroy(),F.current=null),pe.src="",pe.load();try{let te=!1;const _e=()=>{te||(te=!0,pe.play().then(()=>_(null)).catch(Ce=>_(`Playback failed: ${Ce.message}`)))};if(ja.isSupported()){const Ce=new ja({debug:!1,enableWorker:!1,lowLatencyMode:!1,backBufferLength:90,maxLoadingDelay:4,maxBufferLength:30,maxMaxBufferLength:600,startLevel:-1});F.current=Ce,Ce.on(ja.Events.MANIFEST_PARSED,()=>{}),Ce.on(ja.Events.ERROR,(Me,Fe)=>{if(Fe.fatal)switch(Fe.type){case ja.ErrorTypes.NETWORK_ERROR:_("Network error, retrying..."),setTimeout(()=>Ce.startLoad(),1e3);break;case ja.ErrorTypes.MEDIA_ERROR:_("Media error, retrying..."),setTimeout(()=>Ce.recoverMediaError(),1e3);break;default:_(`Fatal error: ${Fe.details}`),Ce.destroy(),F.current=null;break}}),Ce.attachMedia(pe),Ce.loadSource(ee)}else if(pe.canPlayType("application/vnd.apple.mpegurl"))pe.src=ee;else{const Ce=ee.replace("/manifest.m3u8","/480p/index.m3u8");pe.src=Ce}const Ie=()=>A(!0),K=()=>{A(!1),_e()},le=Ce=>{const Me=Ce.target;_(`Video error: ${Me.error?.message||"Unknown error"}`),A(!1)},oe=()=>A(!1);pe.addEventListener("loadstart",Ie),pe.addEventListener("canplay",K),pe.addEventListener("error",le),pe.addEventListener("loadeddata",oe);const Ne=async()=>{const Ce=!!document.fullscreenElement;try{Ce?"orientation"in screen&&await(screen.orientation?.lock?.("landscape")??Promise.resolve()):"orientation"in screen&&screen.orientation?.unlock?.()}catch{}};return document.addEventListener("fullscreenchange",Ne),Y.current=()=>{document.removeEventListener("fullscreenchange",Ne)},()=>{pe.removeEventListener("loadstart",Ie),pe.removeEventListener("canplay",K),pe.removeEventListener("error",le),pe.removeEventListener("loadeddata",oe),Y.current&&Y.current()}}catch(te){_(`Setup error: ${te instanceof Error?te.message:"Unknown"}`)}})(),()=>{F.current&&(F.current.destroy(),F.current=null)}),[j,b?.video_v2]);const ne=()=>{if(!b?.video_v2){_("No video source available");return}y(!0),_(null),A(!0)},ie=q=>{s&&s(q)},xe=q=>{n&&n(q)},V=q=>{if(!q)return"00:00";const B=Math.floor(q),pe=Math.floor(B/3600),ee=Math.floor(B%3600/60),te=B%60,_e=Ie=>Ie.toString().padStart(2,"0");return B<60?`00:${_e(te)}`:pe===0?`${_e(ee)}:${_e(te)}`:`${_e(pe)}:${_e(ee)}:${_e(te)}`};return x?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsx("div",{className:"h-8 w-24 bg-muted rounded-full animate-pulse"})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"animate-pulse space-y-6",children:[e.jsx("div",{className:"aspect-video bg-muted rounded-xl"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]})]})})]}):v||!b?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md mx-auto px-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-card-foreground mb-2",children:"Failed to Load Video"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:v||"Video not found"}),e.jsxs("button",{onClick:()=>{i&&i()},className:"inline-flex items-center gap-2 px-4 py-2 bg-card border border-border text-card-foreground rounded-lg hover:bg-card-hover transition-colors",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4"}),"Go Back"]})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background/95 backdrop-blur-sm border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("button",{onClick:()=>{i&&i()},className:"inline-flex items-center gap-2 text-muted-foreground hover:text-card-foreground transition-colors",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4"}),"Back"]})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx("div",{className:"w-full aspect-video bg-black rounded-xl overflow-hidden relative shadow-card",children:j?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("video",{ref:H,controls:!0,poster:xa(b.thumbnail),className:"w-full h-full object-contain bg-black",onDoubleClick:async q=>{const B=q.currentTarget;try{document.fullscreenElement?await document.exitFullscreen():await B.requestFullscreen()}catch{}}}),E&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}),m&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("p",{className:"mb-4",children:m}),e.jsx("button",{onClick:()=>{y(!1),_(null)},className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover transition-colors",children:"Try Again"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:xa(b.thumbnail)||`https://images.hive.blog/u/${b.owner}/avatar`,alt:b.title,className:"w-full h-full object-cover",onError:q=>{q.target.src=`https://images.hive.blog/u/${b.owner}/avatar`}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-overlay opacity-30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("button",{onClick:ne,className:"bg-primary hover:bg-primary-hover rounded-full p-6 transform hover:scale-110 transition-all duration-300 shadow-lg",children:e.jsx(O.Play,{className:"w-8 h-8 text-primary-foreground ml-1",fill:"currentColor"})})}),b.duration&&e.jsxs("div",{className:"absolute bottom-4 right-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),V(b.duration)]}),b.views&&e.jsxs("div",{className:"absolute bottom-4 left-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(O.Eye,{className:"w-3 h-3"}),b.views.toLocaleString()," views"]})]})}),e.jsx(ud,{title:b.title||"",author:b.owner||"",permlink:b.permlink||"",createdAt:b.created,description:b.description||"",video:{title:b.title||"",author:b.owner||"",permlink:b.permlink||"",created:b.created||new Date,category:b.category||"",numOfUpvotes:void 0,numOfComments:void 0,hiveValue:void 0,duration:b.duration,thumbnail:b.thumbnail,views:b.views},onTapComment:()=>{o?o(u,p):T(!0)},onTapUpvote:()=>{c?c(u,p):L(!0)},onTapInfo:()=>{d?d(u,p,b.description||""):U(!0)},onTapAuthor:()=>{n&&n(b.owner)},onTapShare:()=>{l&&l(u,p)},onTapBookmark:()=>{h&&h(u,p)}}),b.tags&&e.jsx("div",{className:"flex flex-wrap gap-2",children:b.tags.split(",").map((q,B)=>e.jsxs("span",{className:"bg-primary/10 text-primary px-3 py-1 rounded-full text-sm font-medium hover:bg-primary/20 transition-colors cursor-pointer",onClick:()=>{a&&a(q.trim())},children:["#",q.trim()]},B))})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 sticky top-24",children:[e.jsx("h3",{className:"font-semibold text-card-foreground mb-4 text-lg",children:"Related Videos"}),e.jsx("div",{className:"space-y-4",children:e.jsx(En,{feedType:er.RELATED,username:b.owner,onVideoClick:ie,onAuthorClick:xe})})]})]})}),C&&u&&p&&e.jsx(Oo,{author:u,permlink:p,onClose:()=>T(!1)}),D&&u&&p&&e.jsx(Lo,{author:u,permlink:p,onClose:()=>L(!1)}),z&&u&&p&&e.jsx(Up,{author:u,permlink:p,content:b.description||"",onClose:()=>U(!1)})]})};var u0={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Wc=k.createContext&&k.createContext(u0),qp=["attr","size","title"];function Hp(t,r){if(t==null)return{};var n,s,a=zp(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],r.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function zp(t,r){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(r.indexOf(s)!==-1)continue;n[s]=t[s]}return n}function jn(){return jn=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},jn.apply(null,arguments)}function Gc(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function _n(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Gc(Object(n),!0).forEach(function(s){Wp(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gc(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function Wp(t,r,n){return(r=Gp(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function Gp(t){var r=Jp(t,"string");return typeof r=="symbol"?r:r+""}function Jp(t,r){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,r);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function c0(t){return t&&t.map((r,n)=>k.createElement(r.tag,_n({key:n},r.attr),c0(r.child)))}function Gt(t){return r=>k.createElement(Yp,jn({attr:_n({},t.attr)},r),c0(t.child))}function Yp(t){var r=n=>{var{attr:s,size:a,title:i}=t,o=Hp(t,qp),c=a||n.size||"1em",d;return n.className&&(d=n.className),t.className&&(d=(d?d+" ":"")+t.className),k.createElement("svg",jn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,s,o,{className:d,style:_n(_n({color:t.color||n.color},n.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),i&&k.createElement("title",null,i),t.children)};return Wc!==void 0?k.createElement(Wc.Consumer,null,n=>r(n)):r(u0)}function Zp(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"},child:[]}]})(t)}function Xp(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"},child:[]}]})(t)}function Kp(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"},child:[]}]})(t)}function Qp(t){return Gt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M560 224h-29.5c-8.8-20-21.6-37.7-37.4-52.5L512 96h-32c-29.4 0-55.4 13.5-73 34.3-7.6-1.1-15.1-2.3-23-2.3H256c-77.4 0-141.9 55-156.8 128H56c-14.8 0-26.5-13.5-23.5-28.8C34.7 215.8 45.4 208 57 208h1c3.3 0 6-2.7 6-6v-20c0-3.3-2.7-6-6-6-28.5 0-53.9 20.4-57.5 48.6C-3.9 258.8 22.7 288 56 288h40c0 52.2 25.4 98.1 64 127.3V496c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-48h128v48c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-80.7c11.8-8.9 22.3-19.4 31.3-31.3H560c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16zm-128 64c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zM256 96h128c5.4 0 10.7.4 15.9.8 0-.3.1-.5.1-.8 0-53-43-96-96-96s-96 43-96 96c0 2.1.5 4.1.6 6.2 15.2-3.9 31-6.2 47.4-6.2z"},child:[]}]})(t)}function eg(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M608 64H32C14.33 64 0 78.33 0 96v320c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V96c0-17.67-14.33-32-32-32zM48 400v-64c35.35 0 64 28.65 64 64H48zm0-224v-64h64c0 35.35-28.65 64-64 64zm272 176c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 48h-64c0-35.35 28.65-64 64-64v64zm0-224c-35.35 0-64-28.65-64-64h64v64z"},child:[]}]})(t)}function tg(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M621.16 54.46C582.37 38.19 543.55 32 504.75 32c-123.17-.01-246.33 62.34-369.5 62.34-30.89 0-61.76-3.92-92.65-13.72-3.47-1.1-6.95-1.62-10.35-1.62C15.04 79 0 92.32 0 110.81v317.26c0 12.63 7.23 24.6 18.84 29.46C57.63 473.81 96.45 480 135.25 480c123.17 0 246.34-62.35 369.51-62.35 30.89 0 61.76 3.92 92.65 13.72 3.47 1.1 6.95 1.62 10.35 1.62 17.21 0 32.25-13.32 32.25-31.81V83.93c-.01-12.64-7.24-24.6-18.85-29.47zM48 132.22c20.12 5.04 41.12 7.57 62.72 8.93C104.84 170.54 79 192.69 48 192.69v-60.47zm0 285v-47.78c34.37 0 62.18 27.27 63.71 61.4-22.53-1.81-43.59-6.31-63.71-13.62zM320 352c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 27.78c-17.52-4.39-35.71-6.85-54.32-8.44 5.87-26.08 27.5-45.88 54.32-49.28v57.72zm0-236.11c-30.89-3.91-54.86-29.7-55.81-61.55 19.54 2.17 38.09 6.23 55.81 12.66v48.89z"},child:[]}]})(t)}function eo(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M624 416H381.54c-.74 19.81-14.71 32-32.74 32H288c-18.69 0-33.02-17.47-32.77-32H16c-8.8 0-16 7.2-16 16v16c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-16c0-8.8-7.2-16-16-16zM576 48c0-26.4-21.6-48-48-48H112C85.6 0 64 21.6 64 48v336h512V48zm-64 272H128V64h384v256z"},child:[]}]})(t)}function rg(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M473.7 73.8l-2.4-2.5c-46-47-118-51.7-169.6-14.8L336 159.9l-96 64 48 128-144-144 96-64-28.6-86.5C159.7 19.6 87 24 40.7 71.4l-2.4 2.4C-10.4 123.6-12.5 202.9 31 256l212.1 218.6c7.1 7.3 18.6 7.3 25.7 0L481 255.9c43.5-53 41.4-132.3-7.3-182.1z"},child:[]}]})(t)}function Jc(t){return Gt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M275.3 250.5c7 7.4 18.4 7.4 25.5 0l108.9-114.2c31.6-33.2 29.8-88.2-5.6-118.8-30.8-26.7-76.7-21.9-104.9 7.7L288 36.9l-11.1-11.6C248.7-4.4 202.8-9.2 172 17.5c-35.3 30.6-37.2 85.6-5.6 118.8l108.9 114.2zm290 77.6c-11.8-10.7-30.2-10-42.6 0L430.3 402c-11.3 9.1-25.4 14-40 14H272c-8.8 0-16-7.2-16-16s7.2-16 16-16h78.3c15.9 0 30.7-10.9 33.3-26.6 3.3-20-12.1-37.4-31.6-37.4H192c-27 0-53.1 9.3-74.1 26.3L71.4 384H16c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16h356.8c14.5 0 28.6-4.9 40-14L564 377c15.2-12.1 16.4-35.3 1.3-48.9z"},child:[]}]})(t)}function ag(t){return Gt({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(t)}function go(t){return Gt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(t)}function sg(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M160 224v64h320v-64c0-35.3 28.7-64 64-64h32c0-53-43-96-96-96H160c-53 0-96 43-96 96h32c35.3 0 64 28.7 64 64zm416-32h-32c-17.7 0-32 14.3-32 32v96H128v-96c0-17.7-14.3-32-32-32H64c-35.3 0-64 28.7-64 64 0 23.6 13 44 32 55.1V432c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-16h384v16c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16V311.1c19-11.1 32-31.5 32-55.1 0-35.3-28.7-64-64-64z"},child:[]}]})(t)}function ng(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z"},child:[]}]})(t)}function ig(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(t)}function og(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(t)}function lg(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(t)}function d0(t){return Gt({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"},child:[]}]})(t)}function ug(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(t)}function cg(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function dg(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(t)}const Mo=new M0.Client(["https://api.hive.blog"]),fg=async t=>{try{const r=await Mo.database.getAccounts([t]);if(!r||r.length===0)throw new Error("Account not found");return r[0]}catch(r){return console.error("Error in getWalletDataDetail:",r),{error:r instanceof Error?r.message:"Unknown error"}}},hg=async t=>{try{const r=await Mo.database.getDynamicGlobalProperties(),n=parseFloat(t.split(" ")[0]),s=parseFloat(String(r.total_vesting_shares).split(" ")[0]),a=parseFloat(String(r.total_vesting_fund_hive).split(" ")[0]);return(n*a/s).toFixed(3)}catch(r){return console.error("Error in convertVestingSharesToHiveData:",r),"0"}},mg=async t=>{try{const n=(await Mo.database.call("get_feed_history",[])).current_median_history,s=parseFloat(n.base.split(" ")[0]),a=typeof t=="string"?parseFloat(t):t;return(s*a).toFixed(2)}catch(r){return console.error("Error in convertHivetoUSDData:",r),"0"}},f0=()=>{try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"",r={"Asia/Kolkata":"INR","Asia/Calcutta":"INR","Asia/Chennai":"INR","Asia/Mumbai":"INR","Asia/Karachi":"PKR","Asia/Dhaka":"BDT","Asia/Colombo":"LKR","Asia/Kathmandu":"NPR","Asia/Rangoon":"MMK","Asia/Yangon":"MMK","Asia/Bangkok":"THB","Asia/Ho_Chi_Minh":"VND","Asia/Saigon":"VND","Asia/Jakarta":"IDR","Asia/Kuala_Lumpur":"MYR","Asia/Singapore":"SGD","Asia/Manila":"PHP","Asia/Hong_Kong":"HKD","Asia/Taipei":"TWD","Asia/Shanghai":"CNY","Asia/Chongqing":"CNY","Asia/Beijing":"CNY","Asia/Tokyo":"JPY","Asia/Seoul":"KRW","Asia/Dubai":"AED","Asia/Riyadh":"SAR","Asia/Jerusalem":"ILS","Asia/Tel_Aviv":"ILS","Asia/Phnom_Penh":"KHR","Asia/Vientiane":"LAK","America/New_York":"USD","America/Chicago":"USD","America/Denver":"USD","America/Los_Angeles":"USD","America/Phoenix":"USD","America/Anchorage":"USD","Pacific/Honolulu":"USD","America/Toronto":"CAD","America/Vancouver":"CAD","America/Montreal":"CAD","America/Edmonton":"CAD","America/Sao_Paulo":"BRL","America/Rio_Branco":"BRL","America/Mexico_City":"MXN","America/Cancun":"MXN","America/Argentina/Buenos_Aires":"ARS","America/Bogota":"COP","America/Lima":"PEN","America/Santiago":"CLP","Europe/London":"GBP","Europe/Dublin":"EUR","Europe/Berlin":"EUR","Europe/Paris":"EUR","Europe/Rome":"EUR","Europe/Madrid":"EUR","Europe/Lisbon":"EUR","Europe/Amsterdam":"EUR","Europe/Brussels":"EUR","Europe/Vienna":"EUR","Europe/Helsinki":"EUR","Europe/Athens":"EUR","Europe/Bratislava":"EUR","Europe/Ljubljana":"EUR","Europe/Vilnius":"EUR","Europe/Riga":"EUR","Europe/Tallinn":"EUR","Europe/Malta":"EUR","Europe/Nicosia":"EUR","Europe/Luxembourg":"EUR","Europe/Zagreb":"EUR","Europe/Zurich":"CHF","Europe/Stockholm":"SEK","Europe/Oslo":"NOK","Europe/Copenhagen":"DKK","Europe/Warsaw":"PLN","Europe/Prague":"CZK","Europe/Budapest":"HUF","Europe/Bucharest":"RON","Europe/Moscow":"RUB","Europe/Kiev":"UAH","Europe/Kyiv":"UAH","Europe/Istanbul":"TRY","Africa/Lagos":"NGN","Africa/Johannesburg":"ZAR","Africa/Nairobi":"KES","Africa/Accra":"GHS","Africa/Cairo":"EGP","Australia/Sydney":"AUD","Australia/Melbourne":"AUD","Australia/Brisbane":"AUD","Australia/Perth":"AUD","Pacific/Auckland":"NZD"};if(r[t])return r[t];const n=navigator.language||"en-US",s={US:"USD",GB:"GBP",IN:"INR",JP:"JPY",CN:"CNY",KR:"KRW",AU:"AUD",CA:"CAD",BR:"BRL",MX:"MXN",DE:"EUR",FR:"EUR",IT:"EUR",ES:"EUR",NL:"EUR"},a=n.split("-")[1]?.toUpperCase();return a&&s[a]||"USD"}catch{return"USD"}},pg=async()=>{try{const r=await(await fetch("https://open.er-api.com/v6/latest/USD")).json();return r?.rates?r.rates:{USD:1}}catch{return{USD:1}}},gn=[{code:"USD",name:"US Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"INR",name:"Indian Rupee"},{code:"JPY",name:"Japanese Yen"},{code:"CNY",name:"Chinese Yuan"},{code:"KRW",name:"South Korean Won"},{code:"AUD",name:"Australian Dollar"},{code:"CAD",name:"Canadian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"MXN",name:"Mexican Peso"},{code:"CHF",name:"Swiss Franc"},{code:"SGD",name:"Singapore Dollar"},{code:"HKD",name:"Hong Kong Dollar"},{code:"SEK",name:"Swedish Krona"},{code:"NOK",name:"Norwegian Krone"},{code:"DKK",name:"Danish Krone"},{code:"PLN",name:"Polish Zloty"},{code:"TRY",name:"Turkish Lira"},{code:"RUB",name:"Russian Ruble"},{code:"ZAR",name:"South African Rand"},{code:"AED",name:"UAE Dirham"},{code:"SAR",name:"Saudi Riyal"},{code:"THB",name:"Thai Baht"},{code:"IDR",name:"Indonesian Rupiah"},{code:"MYR",name:"Malaysian Ringgit"},{code:"PHP",name:"Philippine Peso"},{code:"VND",name:"Vietnamese Dong"},{code:"PKR",name:"Pakistani Rupee"},{code:"BDT",name:"Bangladeshi Taka"},{code:"NGN",name:"Nigerian Naira"},{code:"EGP",name:"Egyptian Pound"},{code:"KES",name:"Kenyan Shilling"},{code:"NZD",name:"New Zealand Dollar"},{code:"TWD",name:"Taiwan Dollar"},{code:"CZK",name:"Czech Koruna"},{code:"HUF",name:"Hungarian Forint"},{code:"ILS",name:"Israeli Shekel"},{code:"CLP",name:"Chilean Peso"},{code:"ARS",name:"Argentine Peso"},{code:"COP",name:"Colombian Peso"},{code:"LKR",name:"Sri Lankan Rupee"},{code:"NPR",name:"Nepalese Rupee"},{code:"UAH",name:"Ukrainian Hryvnia"},{code:"RON",name:"Romanian Leu"},{code:"GHS",name:"Ghanaian Cedi"}],cn=(t,r)=>{try{const n=navigator.language||"en-US";return new Intl.NumberFormat(n,{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2,currencyDisplay:"narrowSymbol"}).formatToParts(t).map(a=>a.value).join("")}catch{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch{return`$${t.toFixed(2)}`}}},gg=async(t,r=100)=>{const s=await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_account_history",params:[t,-1,r,"4",null]})})).json();if(s.error)throw new Error(s.error.message||"Failed to fetch transactions");return(s.result||[]).filter(i=>i[1]?.op?.[0]==="transfer").map(i=>{const[o,c]=i,d=c.op[1];return{id:o,timestamp:c.timestamp,type:d.from===t?"sent":"received",amount:d.amount,from:d.from,to:d.to,memo:d.memo||"",trx_id:c.trx_id}}).reverse()},Yc=f0(),Ro=nd.create((t,r)=>({walletData:null,isLoading:!1,error:null,transactions:[],isLoadingTransactions:!1,transactionError:null,selectedCurrency:Yc,localCurrency:Yc,exchangeRates:{USD:1},setWalletData:n=>t({walletData:n}),clearWalletData:()=>t({walletData:null,error:null,transactions:[],transactionError:null}),setSelectedCurrency:n=>{const{walletData:s,exchangeRates:a}=r();if(!s){t({selectedCurrency:n});return}const i=a[n]||1,o=s.estimated_value_usd*i,c=cn(o,n);t({selectedCurrency:n,walletData:{...s,estimated_value:c}})},getFormattedEstimatedValue:()=>{const{walletData:n,selectedCurrency:s,exchangeRates:a}=r();if(!n)return"-";const i=a[s]||1,o=n.estimated_value_usd*i;return cn(o,s)},fetchWalletData:async n=>{t({isLoading:!0,error:null});try{const s=await fg(n),a=m=>"error"in m;if(!s||a(s))throw new Error(a(s)?s.error:"Account not found");const i=typeof s.vesting_shares=="string"?s.vesting_shares:"0.000000 VESTS",o=typeof s.balance=="string"?s.balance:s.balance.toString(),c=typeof s.hbd_balance=="string"?s.hbd_balance:s.hbd_balance.toString(),d=typeof s.savings_balance=="string"?s.savings_balance:s.savings_balance.toString(),f=typeof s.savings_hbd_balance=="string"?s.savings_hbd_balance:s.savings_hbd_balance.toString(),l=await hg(i),h=parseFloat(o.split(" ")[0]||"0"),u=parseFloat(l),p=(h+u).toFixed(3),b=await mg(p),w=parseFloat(b),x=await pg(),{selectedCurrency:g}=r(),v=x[g]||1,N=w*v,j=cn(N,g),y={balance:o,hbd_balance:c,savings_balance:d,savings_hbd_balance:f,hive_power:`${l} HP`,estimated_value:j,estimated_value_usd:w};return t({walletData:y,exchangeRates:x}),y}catch(s){const a=s instanceof Error?s.message:"Failed to fetch wallet data";console.error("Wallet fetch error:",a);const i={balance:"0.000 HIVE",hbd_balance:"0.000 HBD",savings_balance:"0.000 HIVE",savings_hbd_balance:"0.000 HBD",hive_power:"0 HP",estimated_value:cn(0,"USD"),estimated_value_usd:0,error:a};return t({walletData:i,error:a}),i}finally{t({isLoading:!1})}},fetchTransactions:async(n,s=100)=>{t({isLoadingTransactions:!0,transactionError:null});try{const a=await gg(n,s);return t({transactions:a}),a}catch(a){const i=a instanceof Error?a.message:"Failed to fetch transactions";return console.error("Transaction fetch error:",i),t({transactionError:i}),[]}finally{t({isLoadingTransactions:!1})}}}));function xg(t){const r=new Date,n=new Date(t+"Z"),s=r.getTime()-n.getTime(),a=Math.floor(s/1e3),i=Math.floor(a/60),o=Math.floor(i/60),c=Math.floor(o/24);return c>30?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c>0?`${c}d ago`:o>0?`${o}h ago`:i>0?`${i}m ago`:"just now"}const bg=({tx:t})=>{const r=t.type==="sent",n=r?t.to:t.from;return e.jsxs("div",{className:"flex items-center gap-3 p-3.5 rounded-lg bg-gray-800 border border-gray-700 mb-2 transition-all duration-200 hover:bg-gray-750 hover:border-gray-600",children:[e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${r?"bg-red-500/15 text-red-400":"bg-emerald-500/15 text-emerald-400"}`,children:r?e.jsx(ug,{size:12}):e.jsx(dg,{size:12})}),e.jsx("img",{src:`https://images.hive.blog/u/${n}/avatar`,alt:n,className:"w-9 h-9 rounded-full flex-shrink-0 border-2 border-gray-600",onError:s=>{s.target.src=`https://ui-avatars.com/api/?name=${n}&background=random&size=36`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("span",{className:"text-sm font-semibold text-gray-200 truncate",children:n})}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[r?"Sent":"Received"," · ",xg(t.timestamp)]})]}),e.jsx("div",{className:"text-right flex-shrink-0",children:e.jsxs("div",{className:`text-sm font-bold ${r?"text-red-400":"text-emerald-400"}`,children:[r?"-":"+",t.amount]})})]})},yg=()=>{const{selectedCurrency:t,localCurrency:r,setSelectedCurrency:n,exchangeRates:s}=Ro(),[a,i]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>{const f=l=>{o.current&&!o.current.contains(l.target)&&i(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const c=k.useMemo(()=>{const f=gn.find(u=>u.code==="USD"),l=r!=="USD"?gn.find(u=>u.code===r):null,h=gn.filter(u=>u.code!=="USD"&&u.code!==r&&s[u.code]);return[f,...l?[l]:[],...h]},[r,s]),d=f=>{try{return new Intl.NumberFormat("en",{style:"currency",currency:f}).formatToParts(0).find(h=>h.type==="currency")?.value||f}catch{return f}};return e.jsxs("div",{ref:o,className:"relative inline-block",children:[e.jsxs("button",{onClick:()=>i(!a),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/15 hover:bg-white/25 transition-colors text-white text-xs font-medium border border-white/20",children:[e.jsx("span",{children:d(t)}),e.jsx("span",{children:t}),e.jsx(ig,{size:8,className:`transition-transform ${a?"rotate-180":""}`})]}),a&&e.jsx("div",{className:"absolute top-full mt-1 right-0 w-56 max-h-64 overflow-y-auto rounded-lg bg-gray-800 border border-gray-600 shadow-xl z-50 scrollbar-hide",children:c.map((f,l)=>e.jsxs(k.Fragment,{children:[l===(r!=="USD"?2:1)&&e.jsx("div",{className:"border-t border-gray-600 my-1"}),e.jsxs("button",{onClick:()=>{n(f.code),i(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors hover:bg-gray-700 ${t===f.code?"bg-blue-500/20 text-blue-300":"text-gray-300"}`,children:[e.jsx("span",{className:"w-6 text-center font-medium text-gray-400",children:d(f.code)}),e.jsx("span",{className:"font-medium",children:f.code}),e.jsx("span",{className:"text-xs text-gray-500 truncate",children:f.name})]})]},f.code))})]})},h0=({username:t,className:r=""})=>{const{walletData:n,fetchWalletData:s,isLoading:a,error:i,transactions:o,fetchTransactions:c,isLoadingTransactions:d,transactionError:f}=Ro();k.useEffect(()=>{t&&(s(t),c(t))},[t,s,c]);const l=({label:h,value:u,icon:p,iconBgClass:b="bg-blue-500/15",iconTextClass:w="text-blue-400",valueClass:x="text-gray-200"})=>e.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-lg bg-gray-800 border border-gray-700 mb-2.5 transition-all duration-200 hover:bg-gray-750 hover:border-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[p&&e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center ${b} ${w}`,children:p}),e.jsx("span",{className:"font-semibold text-sm text-gray-300",children:h})]}),e.jsx("span",{className:`font-medium text-sm ${x}`,children:u??"-"})]});return e.jsx("div",{className:`p-4 transition-all duration-300 ${r}`,children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("div",{className:"flex flex-col items-center p-5 mb-5 rounded-xl bg-gray-800 border border-gray-700",children:[t&&e.jsx("img",{src:`https://images.hive.blog/u/${t}/avatar`,alt:`${t} avatar`,className:"w-16 h-16 rounded-full border-3 border-blue-500/30 mb-2.5 transition-transform hover:scale-105",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${t}&background=random`}}),e.jsx("div",{className:"text-base font-bold text-white",children:t}),e.jsx("div",{className:"text-xs text-gray-400",children:"Hive Wallet Overview"})]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 p-5 mb-5 transition-all duration-300 hover:from-blue-500 hover:to-purple-500 shadow-lg shadow-blue-500/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("div",{className:"text-xs font-semibold text-blue-100/80",children:"Estimated Value"}),e.jsx(yg,{})]}),e.jsx("div",{className:"text-2xl font-bold text-white text-center",children:a?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{className:"text-lg",children:"Loading..."})]}):n?.estimated_value??"-"})]}),i&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(go,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:i})]}),e.jsx(l,{label:"Balance",value:n?.balance,icon:e.jsx(Zp,{}),iconBgClass:"bg-blue-500/15",iconTextClass:"text-blue-400",valueClass:"text-blue-300"}),e.jsx(l,{label:"HBD Balance",value:n?.hbd_balance,icon:e.jsx(eg,{}),iconBgClass:"bg-emerald-500/15",iconTextClass:"text-emerald-400",valueClass:"text-emerald-300"}),e.jsx(l,{label:"Savings Balance",value:n?.savings_balance,icon:e.jsx(Qp,{}),iconBgClass:"bg-amber-500/15",iconTextClass:"text-amber-400",valueClass:"text-amber-300"}),e.jsx(l,{label:"Savings HBD",value:n?.savings_hbd_balance,icon:e.jsx(ng,{}),iconBgClass:"bg-purple-500/15",iconTextClass:"text-purple-400",valueClass:"text-purple-300"}),e.jsx(l,{label:"Hive Power",value:n?.hive_power,icon:e.jsx(d0,{}),iconBgClass:"bg-orange-500/15",iconTextClass:"text-orange-400",valueClass:"text-orange-300"}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-300 tracking-wide uppercase",children:"Transaction History"}),o.length>0&&e.jsxs("span",{className:"text-xs text-gray-500",children:[o.length," transactions"]})]}),d&&e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-gray-600 border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Loading transactions..."})]})}),f&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(go,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:f})]}),!d&&!f&&o.length===0&&e.jsx("div",{className:"text-center p-8 rounded-lg bg-gray-800 border border-gray-700",children:e.jsx("p",{className:"text-sm text-gray-500",children:"No transactions found"})}),!d&&t&&o.map(h=>e.jsx(bg,{tx:h},h.trx_id+h.id))]})]})})};function m0({sort:t="trending",tag:r="",observer:n="hive.blog",limit:s=20,showSortDropdown:a=!0,theme:i="dark",onAuthorClick:o,onPostClick:c,onCommunityClick:d,onPayoutClick:f,onUpvoteClick:l,onCommentClick:h,onReblogClick:u}){const[p,b]=k.useState([]),[w,x]=k.useState(!0),[g,v]=k.useState(null),[N,j]=k.useState(t),[y,m]=k.useState(!0),[_,E]=k.useState(!1),A=k.useRef(null);new Vn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:H=>H,usertagUrlFn:H=>`/@${H}`,hashtagUrlFn:H=>`/trending/${H}`,isLinkSafeFn:H=>!0,addExternalCssClassToMatchingLinksFn:H=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"});const C=k.useCallback(async(H,F=!1)=>{F?E(!0):(x(!0),m(!0)),v(null);try{const Y=F&&p.length>0?p[p.length-1]:null,G=await Nt.getRankedPosts(H,r,n,s,Y?.author,Y?.permlink);F?(b(ne=>{const ie=new Set(ne.map(V=>V.post_id)),xe=G.filter(V=>!ie.has(V.post_id));return[...ne,...xe]}),m(G.length===s)):(b(G),m(G.length===s))}catch(Y){v(Y instanceof Error?Y.message:"Failed to load posts"),m(!1)}finally{x(!1),E(!1)}},[r,n,s,p]),T=k.useCallback(()=>{!_&&y&&!w&&C(N,!0)},[_,y,w,N,C]);k.useEffect(()=>{C(N)},[N,r,n,s]),k.useEffect(()=>{const H=new IntersectionObserver(F=>{F[0].isIntersecting&&T()},{threshold:1});return A.current&&H.observe(A.current),()=>{A.current&&H.unobserve(A.current)}},[T]);const D=H=>{j(H),b([]),m(!0)},L=H=>H>=1e6?`${(H/1e6).toFixed(1)}M`:H>=1e3?`${(H/1e3).toFixed(1)}K`:H.toString(),z=H=>{const F=H.payout*.5,Y=H.payout*.5,ne=(H.beneficiaries.find(ie=>ie.account==="commentrewarder")?.weight||0)/1e4*100;return{pending:`$${H.payout.toFixed(2)}`,breakdown:`${F.toFixed(2)} HBD, ${Y.toFixed(2)} HP`,commentRewarder:`${ne.toFixed(2)}%`,payoutInDays:Math.ceil((new Date(H.payout_at).getTime()-Date.now())/(1e3*60*60*24))}},U=H=>{const Y=(H.body||"").replace(/!\[[^\]]*\]\([^)]+\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#+\s*/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/<[^>]*>/g,"").replace(/\n+/g," ").trim();return Y.length>200?Y.substring(0,200)+"...":Y};return w?e.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:e.jsx(O.Loader2,{className:"w-8 h-8 animate-spin"})}):g?e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground",children:"Failed to load posts"}),e.jsx("p",{className:"text-muted-foreground",children:g}),e.jsx("button",{onClick:()=>C(N),className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90",children:"Retry"})]}):e.jsx("div",{className:i==="dark"?"dark":"",children:e.jsxs("div",{className:`space-y-6 p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[a&&e.jsx("div",{className:"flex justify-center",children:e.jsxs("select",{value:N,onChange:H=>D(H.target.value),className:`px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary ${i==="dark"?"bg-slate-950 text-white":"bg-card text-card-foreground"}`,children:[e.jsx("option",{value:"trending",children:"Trending"}),e.jsx("option",{value:"hot",children:"Hot"}),e.jsx("option",{value:"created",children:"New"})]})}),e.jsxs("div",{className:"space-y-4",children:[p.map(H=>{const F=H.json_metadata?.image?.[0],Y=z(H);return e.jsxs("div",{className:`border border-border rounded-xl p-4 shadow-card hover:shadow-card-hover transition-shadow ${i==="dark"?"bg-slate-900 text-white":"bg-slate-50 text-black"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[e.jsx("img",{src:`https://images.hive.blog/u/${H.author}/avatar`,alt:H.author,className:"w-8 h-8 rounded-full cursor-pointer flex-shrink-0",onClick:()=>o?.(H.author,`https://images.hive.blog/u/${H.author}/avatar`),onError:G=>{G.target.src=`https://ui-avatars.com/api/?name=${H.author}&background=random`}}),e.jsx("span",{className:"font-medium cursor-pointer hover:text-primary",onClick:()=>o?.(H.author,`https://images.hive.blog/u/${H.author}/avatar`),children:H.author}),e.jsxs("span",{className:i==="dark"?"text-gray-400":"text-muted-foreground",children:["(",H.author_reputation.toFixed(2),")"]}),e.jsx("span",{className:`cursor-pointer hover:text-primary ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,onClick:()=>d?.(H.community_title),children:H.community_title}),e.jsx("span",{className:`hidden sm:inline ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:"•"}),e.jsx("span",{className:`text-sm ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:bs.formatDistanceToNow(new Date(H.created+"Z"),{addSuffix:!0})})]}),e.jsxs("div",{className:"flex gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:F?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:F.startsWith("http")?F:`https://images.hive.blog/u/320x0/${F}`,alt:H.title,className:"w-20 h-20 sm:w-32 sm:h-32 object-cover rounded-lg cursor-pointer",onClick:()=>c?.(H),onError:G=>{G.target.src!==`https://images.hive.blog/u/${H.author}/avatar`?G.target.src=`https://images.hive.blog/u/${H.author}/avatar`:G.target.src="https://images.hive.blog/u/null/avatar"}}),(()=>{const G=H.body?.match(/!\[[^\]]*\]\(([^)]+)\)/g)?.map(ne=>{const ie=ne.match(/\(([^)]+)\)/);return ie?ie[1]:null}).filter(Boolean)||[];return G.length>0?e.jsx("div",{className:"absolute -bottom-1 -right-1 sm:-bottom-2 sm:-right-2 flex space-x-1",children:G.slice(0,3).map((ne,ie)=>e.jsx("img",{src:ne,alt:`body-image-${ie}`,className:"w-6 h-6 sm:w-8 sm:h-8 object-cover rounded border-2 border-white shadow-sm cursor-pointer",onClick:xe=>{xe.stopPropagation();const V=xe.currentTarget.parentElement?.parentElement?.querySelector("img:not(.w-6):not(.w-8)");V&&(V.src=ne)}},ie))}):null})()]}):e.jsx("img",{src:`https://images.hive.blog/u/${H.author}/avatar`,alt:H.author,className:"w-20 h-20 sm:w-32 sm:h-32 rounded-lg cursor-pointer",onClick:()=>c?.(H)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-base sm:text-lg mb-1 sm:mb-2 cursor-pointer hover:text-primary line-clamp-2",onClick:()=>c?.(H),children:H.title}),e.jsx("p",{className:`mb-2 sm:mb-3 line-clamp-2 sm:line-clamp-3 cursor-pointer hover:text-primary text-sm sm:text-base ${i==="dark"?"text-gray-300":"text-gray-600"}`,onClick:()=>c?.(H),children:H.json_metadata?.description||U(H)||"No description available"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"relative group",children:[e.jsxs("span",{className:"font-semibold text-green-600 cursor-pointer hover:text-green-700 text-sm sm:text-base",onClick:()=>f?.(H.payout),children:["$",H.payout.toFixed(2)]}),e.jsxs("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block bg-black text-white text-xs p-2 rounded shadow-lg whitespace-nowrap z-10",children:[e.jsxs("div",{children:["Pending payout amount: ",Y.pending]}),e.jsxs("div",{children:["Breakdown: ",Y.breakdown]}),e.jsxs("div",{children:["commentrewarder: ",Y.commentRewarder]}),e.jsxs("div",{children:["Payout in ",Y.payoutInDays," days"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsxs("div",{className:`flex items-center gap-1 hover:text-primary transition-colors cursor-pointer ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,onClick:()=>l?.(H),children:[e.jsx(O.ThumbsUp,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(H.stats.total_votes)})]}),e.jsxs("div",{className:`flex items-center gap-1 hover:text-blue-400 transition-colors cursor-pointer ${i==="dark"?"text-blue-400":"text-blue-600"}`,onClick:()=>h?.(H),children:[e.jsx(O.MessageCircle,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(H.children)})]}),e.jsxs("div",{className:`flex items-center gap-1 hover:text-gray-400 transition-colors cursor-pointer ${i==="dark"?"text-gray-400":"text-gray-600"}`,onClick:()=>u?.(H),children:[e.jsx(O.Repeat2,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(H.reblogs)})]})]})]})]})]})]},H.post_id)}),_&&e.jsxs("div",{className:"flex justify-center items-center py-4",children:[e.jsx(O.Loader2,{className:"w-6 h-6 animate-spin"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:"Loading more posts..."})]}),y&&!_&&e.jsx("div",{ref:A,className:"h-10"})]})]})})}class Ca{static instance;static getInstance(){return Ca.instance||(Ca.instance=new Ca),Ca.instance}async getProposals(r){return r==="expired"?this.getExpiredProposals():this.getActiveProposals()}async getActiveProposals(){try{const s=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:72,jsonrpc:"2.0",method:"database_api.list_proposals",params:{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"votable"}})})).json()).result.proposals,i=await(await fetch("https://stats.hivehub.dev/dhf_proposals")).json(),o={};i.forEach(h=>{o[h.proposal_id]=h});const f=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:73,jsonrpc:"2.0",method:"database_api.list_proposal_votes",params:{start:["shaktimaaan"],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"votable"}})})).json()).result.proposal_votes||[],l={};return f.forEach(h=>{l[h.proposal.proposal_id]||(l[h.proposal.proposal_id]=[]),l[h.proposal.proposal_id].push(h)}),s.map(h=>{const u=h.id,p=o[u],b=l[u]||[],w=b.reduce((x,g)=>x+parseFloat(g.total_hbd||"0"),0);return{proposal_id:u,subject:h.subject,permlink:h.permlink,creator:h.creator,receiver:h.receiver,start_date:h.start_date,end_date:h.end_date,total_hbd_received:p?p.total_hbd_received:"0",max_hbd_remaining:p?p.max_hbd_remaining:"0",all_votes_num:h.total_votes||"0",all_votes_hp:p?p.all_votes_hp:w.toString(),votes:p?p.votes:b,status:h.status,daily_pay:h.daily_pay,total_votes:h.total_votes,daily_pay_hbd:h.daily_pay?Number(h.daily_pay.amount)/Math.pow(10,h.daily_pay.precision):0,remaining_days:Math.max(0,Math.ceil((new Date(h.end_date).getTime()-new Date().getTime())/(1e3*60*60*24))),vote_value_total:p?parseFloat(p.all_votes_hp):w}})}catch(r){return console.error("Error fetching active proposals:",r),[]}}async getExpiredProposals(){try{const s=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:65,jsonrpc:"2.0",method:"database_api.list_proposals",params:{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"expired"}})})).json()).result.proposals,i=await(await fetch("https://stats.hivehub.dev/dhf_proposals")).json(),o={};i.forEach(h=>{o[h.proposal_id]=h});const f=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:76,jsonrpc:"2.0",method:"database_api.list_proposal_votes",params:{start:["shaktimaaan"],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"expired"}})})).json()).result.proposal_votes||[],l={};return f.forEach(h=>{l[h.proposal_id]||(l[h.proposal_id]=[]),l[h.proposal_id].push(h)}),s.map(h=>{const u=h.id,p=o[u],b=l[u]||[],w=b.reduce((x,g)=>x+parseFloat(g.total_hbd||"0"),0);return{proposal_id:u,subject:h.subject,permlink:h.permlink,creator:h.creator,receiver:h.receiver,start_date:h.start_date,end_date:h.end_date,total_hbd_received:p?p.total_hbd_received:"0",max_hbd_remaining:p?p.max_hbd_remaining:"0",all_votes_num:h.total_votes||"0",all_votes_hp:p?p.all_votes_hp:w.toString(),votes:p?p.votes:b,status:h.status,daily_pay:h.daily_pay,total_votes:h.total_votes,daily_pay_hbd:h.daily_pay?Number(h.daily_pay.amount)/Math.pow(10,h.daily_pay.precision):0,remaining_days:0,vote_value_total:p?parseFloat(p.all_votes_hp):w}})}catch(r){return console.error("Error fetching expired proposals:",r),[]}}}const Zc=Ca.getInstance(),vg=["All","Active","Upcoming","Expired","By Peak Projects"],p0=["Votes","Start Date","End Date","Creator"],Xc=t=>t==="By Peak Projects"?["Creator"]:p0,mr=t=>{const r=typeof t=="string"?parseFloat(t):t;return isNaN(r)?t.toString():r.toLocaleString()},to=t=>{const r=new Date(t.start_date),n=new Date(t.end_date);return`(${Math.ceil((n.getTime()-r.getTime())/(1e3*60*60*24))} days)`},wg=({onClickSupport:t,onClickVoteValue:r,onClickSelect:n,onClickUser:s,onClickAvatar:a,theme:i="dark"})=>{const[o,c]=k.useState([]),[d,f]=k.useState("All"),[l,h]=k.useState("Votes");k.useEffect(()=>{d==="By Peak Projects"&&!Xc(d).includes(l)?h("Creator"):d!=="By Peak Projects"&&l==="Creator"&&!p0.includes(l)&&h("Votes")},[d,l]);const[u,p]=k.useState(!0);k.useEffect(()=>{(async()=>{p(!0);try{const[g,v]=await Promise.all([Zc.getProposals("active"),Zc.getProposals("expired")]);c([...g,...v])}catch(g){console.error("Error fetching proposals:",g),c([])}p(!1)})()},[]);const b=o.filter(x=>d==="All"?x.status==="active"||new Date(x.start_date+"Z")>new Date:d==="Active"?x.status==="active":d==="Upcoming"?new Date(x.start_date+"Z")>new Date:d==="Expired"?new Date(x.end_date+"Z")<new Date:d==="By Peak Projects"?x.creator==="peakd":!0).sort((x,g)=>d==="By Peak Projects"?g.creator.localeCompare(x.creator):0),w=d==="All"?(()=>{const x=b.filter(N=>N.status==="active"),g=b.filter(N=>new Date(N.start_date+"Z")>new Date),v=(N,j)=>l==="Votes"?Number(j.all_votes_num)-Number(N.all_votes_num):l==="Start Date"?new Date(j.start_date+"Z").getTime()-new Date(N.start_date+"Z").getTime():l==="End Date"?new Date(N.end_date+"Z").getTime()-new Date(j.end_date+"Z").getTime():l==="Creator"?N.creator.localeCompare(j.creator):0;return[...x.sort(v),...g.sort(v)]})():b.sort((x,g)=>l==="Votes"?Number(g.all_votes_num)-Number(x.all_votes_num):l==="Start Date"?new Date(g.start_date+"Z").getTime()-new Date(x.start_date+"Z").getTime():l==="End Date"?new Date(x.end_date+"Z").getTime()-new Date(g.end_date+"Z").getTime():l==="Creator"?x.creator.localeCompare(g.creator):0);return u?e.jsx("div",{className:"flex justify-center items-center py-8",children:e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading proposals..."})}):e.jsx("div",{className:i==="dark"?"dark":"",children:e.jsxs("div",{className:`space-y-6 p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsx("div",{className:"flex gap-2 mb-4 flex-wrap",children:vg.map(x=>e.jsx("button",{className:`px-3 py-1 rounded text-sm ${d===x?"bg-blue-500 text-white":`${i==="dark"?"bg-slate-900 text-gray-300":"bg-gray-200 text-gray-700"}`}`,onClick:()=>f(x),children:x},x))}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:`${i==="dark"?"text-gray-300":"text-gray-700"} mr-2`,children:"Sort by:"}),e.jsx("select",{value:l,onChange:x=>h(x.target.value),className:`px-3 py-1 border rounded ${i==="dark"?"border-gray-600 bg-slate-900 text-gray-100":"border-gray-300 bg-white text-gray-900"}`,children:Xc(d).map(x=>e.jsx("option",{value:x,children:x},x))})]}),e.jsxs("div",{children:[d==="All"&&(()=>{const x=w.filter(v=>v.status==="active"),g=w.filter(v=>new Date(v.start_date+"Z")>new Date);return e.jsxs(e.Fragment,{children:[x.map(v=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-900":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(v),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${v.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${v.creator} avatar`})}),e.jsxs("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(v),children:["by ",v.creator]}),v.receiver&&e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:v.receiver})]})]}),e.jsxs("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(v),children:[v.subject," ",e.jsxs("span",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-500":"text-gray-600"}`,children:["#",v.proposal_id]})]}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(v.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(v.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":v.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(v.start_date+"Z")>new Date?"upcoming":new Date(v.end_date+"Z")<new Date?"expired":v.status})," - "+new Date(v.start_date+"Z").toLocaleDateString()+" - "+new Date(v.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:to(v)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/${v.creator}/${v.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${v.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(v),children:["Vote value: ",v.vote_value_total?mr(v.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Daily Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[v.daily_pay_hbd?mr(v.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Remaining:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.remaining_days||0)," Days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Paid:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"To Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(v),children:"Support"})})]})]})},v.proposal_id)),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"my-6 text-center",children:[e.jsx("h3",{className:`text-xl font-bold mb-2 ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:"Upcoming proposals"}),e.jsx("p",{className:`${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"The proposals listed below will start in the future. You can already support them."})]}),g.map(v=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-950":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(v),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${v.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${v.creator} avatar`})}),e.jsx("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(v),children:v.creator}),e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:v.receiver})]})]}),e.jsx("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(v),children:v.subject}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(v.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(v.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":v.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(v.start_date+"Z")>new Date?"upcoming":new Date(v.end_date+"Z")<new Date?"expired":v.status})," - "+new Date(v.start_date+"Z").toLocaleDateString()+" - "+new Date(v.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:to(v)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/${v.creator}/${v.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${v.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(v),children:["Vote value: ",v.vote_value_total?mr(v.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Daily Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[v.daily_pay_hbd?mr(v.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Remaining:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.remaining_days||0)," Days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Paid:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"To Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(v),children:"Support"})})]})]})},v.proposal_id))]})]})})(),d!=="All"&&w.map(x=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-950":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(x),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${x.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${x.creator} avatar`})}),e.jsx("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(x),children:x.creator}),e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:x.receiver})]})]}),e.jsxs("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(x),children:[x.subject," #",x.proposal_id]}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(x.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(x.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":x.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(x.start_date+"Z")>new Date?"upcoming":new Date(x.end_date+"Z")<new Date?"expired":x.status})," - "+new Date(x.start_date+"Z").toLocaleDateString()+" - "+new Date(x.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:to(x)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/@${x.creator}/${x.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${x.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(x),children:["Vote value: ",x.vote_value_total?mr(x.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Daily Pay:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[x.daily_pay_hbd?mr(x.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Remaining:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.remaining_days||0)," Days"]})]}),d!=="Expired"&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Paid:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"To Pay:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(x),children:"Support"})})]})]})},x.proposal_id))]})]})})};class Ng{HIVE_API_URL="https://api.hive.blog";async _fetch(r,n,s){return fetch(r,s?{...n,signal:s}:n)}async getProfile(r,n){const s={jsonrpc:"2.0",method:"bridge.get_profile",params:{account:r},id:1},a=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},n);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}async getFollowers(r,n=null,s=100,a){const i={jsonrpc:"2.0",method:"condenser_api.get_followers",params:[r,n||"","blog",s],id:1},o=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result}async getFollowing(r,n=null,s=100,a){const i={jsonrpc:"2.0",method:"condenser_api.get_following",params:[r,n||"","blog",s],id:1},o=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result}async getAccounts(r,n){const s={jsonrpc:"2.0",method:"condenser_api.get_accounts",params:[r],id:1},a=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},n);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return(await a.json()).result}async getDynamicGlobalProperties(r){const n={jsonrpc:"2.0",method:"condenser_api.get_dynamic_global_properties",params:[],id:1},s=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},r);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return(await s.json()).result}async convertVestingSharesToHive(r){try{const n=await this.getDynamicGlobalProperties(),s=parseFloat(r.split(" ")[0]),a=parseFloat(n.total_vesting_shares.split(" ")[0]),i=parseFloat(n.total_vesting_fund_hive.split(" ")[0]);return(s*i/a).toFixed(3)}catch(n){return console.error("Error converting vesting shares:",n),"0"}}async getFeedHistory(r){const n={jsonrpc:"2.0",method:"condenser_api.get_feed_history",params:[],id:1},s=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},r);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return(await s.json()).result}async getVoteValue(r,n=1e4){try{const s=await this.getAccounts([r]);if(s.length===0)throw new Error("Account not found!");const a=s[0],i=await this.getDynamicGlobalProperties(),o=await this.getFeedHistory(),c=parseFloat(a.vesting_shares)+parseFloat(a.received_vesting_shares)-parseFloat(a.delegated_vesting_shares)-parseFloat(a.vesting_withdraw_rate),d=Math.floor(Date.now()/1e3)-a.voting_manabar.last_update_time,f=c*1e6/4;let l=parseFloat(a.voting_manabar.current_mana.toString())+d*f/(300*60*24);l>f&&(l=f);const h=l*100/f,u=a.vesting_shares||"0 VESTS",p=parseFloat(u.toString().split(" ")[0]),b=i.total_vesting_shares||"0 VESTS",w=parseFloat(b.toString().split(" ")[0]),x=n/1e4,g=h*x/100,v=i.vote_power_reserve_rate*(300*60*24)/(3600*24),N=g*f/100,j=parseFloat(i.recent_claims||"0"),y=i.reward_balance||"0 HIVE",m=parseFloat(y.toString().split(" ")[0]),_=i.current_supply||"0 HIVE",E=parseFloat(_.toString().split(" ")[0]),A=i.current_sbd_supply||"0 HBD",C=parseFloat(A.toString().split(" ")[0]),T=m/j*(p/w)*(N/f)*E,D=o?.current_median_history;if(!D||!D.base)return"0.00";const L=parseFloat(D.base.toString().split(" ")[0]);return(T*L).toFixed(2)}catch(s){return console.error("Error calculating vote value:",s),"0.00"}}async getUserBlogs(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"blog",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserPosts(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"posts",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserComments(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"comments",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserReplies(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"replies",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getSnapReferences(r,n,s){let a=`https://peakd.com/api/public/snaps/account?container=peak.snaps&username=${r}`;n!==void 0&&(a+=`&startId=${n}`);const i=await this._fetch(a,{method:"GET",headers:{Accept:"application/json"}},s);if(!i.ok)throw new Error(`PeakD API error: ${i.status}`);const o=await i.json();return Array.isArray(o)?o:[]}async batchGetPosts(r,n="",s){const i=[];for(let o=0;o<r.length;o+=5){const d=r.slice(o,o+5).map((u,p)=>({jsonrpc:"2.0",method:"bridge.get_post",params:{author:u.author,permlink:u.permlink,observer:n},id:p+1})),f=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)},s);if(!f.ok)continue;const l=await f.json(),h=Array.isArray(l)?l:[l];for(const u of h)u?.result&&i.push(u.result)}return i}async getUserSnaps(r,n,s,a){const i=await this.getSnapReferences(r,n,a);if(i.length===0)return{snaps:[],nextStartId:null};const o=await this.batchGetPosts(i,s||r,a),c=i[i.length-1],d=i.length>=15?c.id:null;return{snaps:o,nextStartId:d}}async getUserPolls(r,n){const s=`https://polls.hivehub.dev/rpc/polls?author=eq.${encodeURIComponent(r)}&order=created.desc`,a=await this._fetch(s,{method:"GET",headers:{Accept:"application/json"}},n);if(!a.ok)throw new Error(`Polls API error: ${a.status}`);const i=await a.json();return Array.isArray(i)?i:[]}async getPollDetail(r,n,s){const a=`https://polls.hivehub.dev/rpc/poll?author=eq.${encodeURIComponent(r)}&permlink=eq.${encodeURIComponent(n)}`,i=await this._fetch(a,{method:"GET",headers:{Accept:"application/json"}},s);if(!i.ok)throw new Error(`Polls API error: ${i.status}`);const o=await i.json();return Array.isArray(o)&&o.length>0?o[0]:null}delay(r){return new Promise(n=>setTimeout(n,r))}API_THROTTLE_MS=150;parseAssetFloat(r){return r&&parseFloat(r.split(" ")[0])||0}parseHiveTime(r){if(!r)return null;const n=r.endsWith("Z")?r:`${r}Z`,s=Date.parse(n);return isNaN(s)?null:s}async getPendingAuthorRewards(r,n,s){const a=Date.now()-6048e5,i=[],o=new Set;let c=0;const d=h=>{if(!h||!h.author||!h.permlink)return;const u=`${h.author}/${h.permlink}`;if(o.has(u))return;const p=this.parseHiveTime(h.created||h.posted);if(p&&p<a)return;const b=h.cashout_time||h.payout_at||"",w=this.parseHiveTime(b);if(!w||isNaN(w)||w<=Date.now()||this.parseAssetFloat(h.max_accepted_payout||"0")===0)return;const g=this.parseAssetFloat(h.pending_payout_value||"0");if(h.is_paidout===!0)return;const N=(Array.isArray(h.beneficiaries)?h.beneficiaries:[]).reduce((m,_)=>m+(Number(_.weight)||0),0)/1e4,y=g*.5*Math.max(0,Math.min(1,1-N));o.add(u),c+=y,i.push({author:h.author,permlink:h.permlink,title:h.title||"",isComment:!!h.parent_author,payoutMs:w-Date.now(),hbd:y,hpEq:null,beneficiaryCut:N})},f=async h=>{let b=null,w=null;for(let x=0;x<30;x++){const g={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:h,account:r,observer:r,limit:20,start_author:b,start_permlink:w},id:1},v=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)},s);if(!v.ok)break;const j=(await v.json()).result;if(!Array.isArray(j)||!j.length)break;j.forEach(d);const y=j[j.length-1],m=this.parseHiveTime(y?.created);if(b=y?.author||null,w=y?.permlink||null,j.length<20||!b||!w||m&&m<a)break;await this.delay(this.API_THROTTLE_MS)}};if(await f("posts"),n&&i.length>0){const h=[...i].sort((u,p)=>(u.payoutMs||0)-(p.payoutMs||0));n(h,c,0)}await f("comments"),i.sort((h,u)=>(h.payoutMs||0)-(u.payoutMs||0));let l=0;try{const h=await this.rpcCall("condenser_api.get_current_median_history_price",[],s),u=this.parseAssetFloat(h?.base)/this.parseAssetFloat(h?.quote||"1.000 HIVE");u>0&&(l=c/u,i.forEach(p=>{p.hpEq=(p.hbd||0)/u}))}catch{}return{rows:i,totalHbd:c,totalHpEq:l}}async getPendingCurationRewards(r,n,s){const i=Date.now()-864e6,o=[],c=(1n<<0n).toString();let d=-1;const f=1e3,l=new Set;for(let m=0;m<20;m++){const _=[r,d,f,c,"0"];let E;try{E=await this.rpcCall("condenser_api.get_account_history",_,s)}catch{try{E=await this.rpcCall("condenser_api.get_account_history",[r,d,f],s)}catch{break}}if(!Array.isArray(E)||!E.length)break;let A=1/0;for(const[C,T]of E){if(l.has(C))continue;l.add(C);const[D,L]=T?.op||[];D==="vote"&&L?.voter===r&&o.push({voter:L.voter,author:L.author,permlink:L.permlink,weight:L.weight,timestamp:T.timestamp});const z=this.parseHiveTime(T?.timestamp);z&&z<A&&(A=z)}if(A<=i||(d=E[0][0]-1,d<0))break;await this.delay(this.API_THROTTLE_MS)}const h=new Map;for(const m of o){const _=this.parseHiveTime(m.timestamp);if(!_||_<i)continue;const E=`${m.author}/${m.permlink}`,A=h.get(E);(!A||_>(this.parseHiveTime(A.timestamp)||0))&&h.set(E,m)}const u=Array.from(h.values()).filter(m=>(m.weight||0)>0);if(!u.length)return{rows:[],totalHp:0,totalHbd:0};const[p,b,w]=await Promise.all([this.rpcCall("condenser_api.get_reward_fund",["post"],s),this.rpcCall("condenser_api.get_current_median_history_price",[],s),this.getDynamicGlobalProperties(s)]),x=this.parseAssetFloat(b?.base)/this.parseAssetFloat(b?.quote||"1.000 HIVE"),g=Number(p?.percent_curation_rewards||5e3),v=[],N=6;for(let m=0;m<u.length;m+=N){const _=u.slice(m,m+N),E=await Promise.all(_.map(async A=>{try{const C=await this.rpcCall("condenser_api.get_content",[A.author,A.permlink],s);if(!C||C.allow_curation_rewards===!1)return null;const T=this.parseHiveTime(C.cashout_time);if(!T||T<=Date.now()||this.parseAssetFloat(C.max_accepted_payout)<=0)return null;const L=this.parseAssetFloat(C.pending_payout_value||"0");if(L<=0)return null;let z=Array.isArray(C.active_votes)&&C.active_votes.length?C.active_votes:await this.rpcCall("condenser_api.get_active_votes",[A.author,A.permlink],s);if(!Array.isArray(z)||!z.length)return null;const U=z.find(Ie=>Ie.voter===r);if(!U)return null;const H=Number(U.rshares||0);if(H<=0)return null;const F=L*(g/1e4);let Y;const G=Number(U.weight||0),ne=Number(C.total_vote_weight||0);if(G>0&&ne>0)Y=G/ne;else{const Ie=z.reduce((K,le)=>{const oe=Number(le.rshares||0);return oe>0?K+oe:K},0);Y=Ie>0?H/Ie:0}const ie=F*Y,xe=x>0?ie/x:0;if(xe<=0)return null;const V=z.reduce((Ie,K)=>{const le=Number(K.rshares||0);return le>0?Ie+le:Ie},0),q=V>0?H/V:0,B=q>0?Y/q*100:null,pe=this.parseHiveTime(C.created),ee=U.time?this.parseHiveTime(U.time):this.parseHiveTime(A.timestamp),te=pe&&ee?Math.max(0,ee-pe):null;let _e=Number(A.weight||0);return U.percent!==void 0&&(_e=Number(U.percent)),{hp:xe,hbd:ie,author:A.author,permlink:A.permlink,title:C.title||`${A.author}/${A.permlink}`,payoutMs:T-Date.now(),votedAfterMs:te,weightPct:(_e||0)/100,efficiency:B,isComment:!!C.parent_author}}catch{return null}}));for(const A of E)A&&A.hp>0&&v.push(A);if(n&&v.length>0){const A=[...v].sort((D,L)=>(D.payoutMs||0)-(L.payoutMs||0)),C=A.reduce((D,L)=>D+(L.hp||0),0),T=A.reduce((D,L)=>D+(L.hbd||0),0);n(A,C,T)}m+N<u.length&&await this.delay(this.API_THROTTLE_MS)}v.sort((m,_)=>(m.payoutMs||0)-(_.payoutMs||0));const j=v.reduce((m,_)=>m+(_.hp||0),0),y=v.reduce((m,_)=>m+(_.hbd||0),0);return{rows:v,totalHp:j,totalHbd:y}}async rpcCall(r,n,s){const a={jsonrpc:"2.0",method:r,params:n,id:1},i=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)},s);if(!i.ok)throw new Error(`RPC error: ${i.status}`);const o=await i.json();if(o.error)throw new Error(o.error.message||"RPC error");return o.result}userAvatar(r){return`https://images.hive.blog/u/${r}/avatar`}}const Ee=new Ng,Kc=({vestingShares:t})=>{const[r,n]=k.useState("...");return k.useEffect(()=>{(async()=>{try{const a=await Ee.convertVestingSharesToHive(t);n(a)}catch(a){console.error("Error calculating HP:",a);const i=parseFloat(t.split(" ")[0]);n((i/1e6).toFixed(3))}})()},[t]),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r," HP"]})},jg=({username:t,onClickAuthor:r,onClickAddRemoveFromLists:n,onClickFollow:s})=>{const[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState({}),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=k.useRef(null),g=async()=>{try{h(!0),p(null);const j=await Ee.getFollowers(t);if(i(j),j.length>0){const y=j.map(A=>A.follower),m=await Ee.getAccounts(y);c(m);const _={},E={};for(const A of j)try{const C=await Ee.getVoteValue(A.follower);E[A.follower]=C}catch(C){console.warn(`Failed to get voting data for ${A.follower}:`,C),_[A.follower]={upvotepower:"0",downvote:"0"},E[A.follower]="0.00"}f(E)}}catch(j){p(j instanceof Error?j.message:"Failed to load followers data")}finally{h(!1)}};k.useEffect(()=>{g()},[t]),k.useEffect(()=>{const j=y=>{x.current&&!x.current.contains(y.target)&&w(null)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const v=j=>{const y=o.find(m=>m.name===j);if(!y)return null;try{return JSON.parse(y.posting_json_metadata)?.profile||{}}catch{return{}}},N=j=>{const y=new Date,m=new Date(j),_=y.getTime()-m.getTime(),E=Math.floor(_/(1e3*60*60*24));if(Math.floor(E/30)>=1)return m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});const C=Math.floor(_/1e3),T=Math.floor(C/60),D=Math.floor(T/60),L=Math.floor(E/7),z=Math.floor(E/365);return z>0?`${z} year${z>1?"s":""} ago`:L>0?`${L} week${L>1?"s":""} ago`:E>0?`${E} day${E>1?"s":""} ago`:D>0?`${D} hour${D>1?"s":""} ago`:T>0?`${T} minute${T>1?"s":""} ago`:"Just now"};return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading followers..."]})}):u?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load followers"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),e.jsxs("button",{onClick:g,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):a.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user has no followers."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Avatar"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Username"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Last Post"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"HP"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Vote Value"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Manage"})]})}),e.jsx("tbody",{children:a.map((j,y)=>{const m=o.find(E=>E.name===j.follower),_=v(j.follower);return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.follower),alt:j.follower,className:"w-12 h-12 rounded-full object-cover cursor-pointer",onClick:()=>r&&r(j.follower),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.follower}&background=random`}})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>r&&r(j.follower),children:["@",j.follower]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),_?.about&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:_.about})]}),e.jsx("td",{className:"py-4 px-4",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:N(m.last_root_post)}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Never"})}),e.jsx("td",{className:"py-4 px-4",children:m?e.jsx(Kc,{vestingShares:m.vesting_shares}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:d[j.follower]?e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["$",d[j.follower]]}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"relative",ref:b===j.follower?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.follower?null:j.follower),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),b===j.follower&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.follower),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-4 h-4"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.follower),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-4 h-4"}),"Follow"]})]})]})})]},`${j.follower}-${y}`)})})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:a.map((j,y)=>{const m=o.find(E=>E.name===j.follower),_=v(j.follower);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.follower),alt:j.follower,className:"w-10 h-10 rounded-full object-cover cursor-pointer flex-shrink-0",onClick:()=>r&&r(j.follower),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.follower}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 text-sm",onClick:()=>r&&r(j.follower),children:["@",j.follower]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?N(m.last_root_post):e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"Never"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx("div",{className:"flex items-center gap-4",children:m&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:e.jsx(Kc,{vestingShares:m.vesting_shares})})}),e.jsxs("div",{className:"relative",ref:b===j.follower?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.follower?null:j.follower),className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),b===j.follower&&e.jsxs("div",{className:"absolute right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.follower),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-3 h-3"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.follower),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-3 h-3"}),"Follow"]})]})]})]})]})]})},`${j.follower}-${y}`)})})]})},Qc=({vestingShares:t})=>{const[r,n]=k.useState("...");return k.useEffect(()=>{(async()=>{try{const a=await Ee.convertVestingSharesToHive(t);n(a)}catch(a){console.error("Error calculating HP:",a);const i=parseFloat(t.split(" ")[0]);n((i/1e6).toFixed(3))}})()},[t]),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r," HP"]})},_g=({username:t,onClickAuthor:r,onClickAddRemoveFromLists:n,onClickUnfollow:s})=>{const[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState({}),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=k.useRef(null),g=async()=>{try{h(!0),p(null);const j=await Ee.getFollowing(t);if(i(j),j.length>0){const y=j.map(E=>E.following),m=await Ee.getAccounts(y);c(m);const _={};for(const E of j)try{const A=await Ee.getVoteValue(E.following);_[E.following]=A}catch(A){console.warn(`Failed to get voting data for ${E.following}:`,A),_[E.following]="0.00"}f(_)}}catch(j){p(j instanceof Error?j.message:"Failed to load following data")}finally{h(!1)}};k.useEffect(()=>{g()},[t]),k.useEffect(()=>{const j=y=>{x.current&&!x.current.contains(y.target)&&w(null)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const v=j=>{const y=o.find(m=>m.name===j);if(!y)return null;try{return JSON.parse(y.posting_json_metadata)?.profile||{}}catch{return{}}},N=j=>{const y=new Date,m=new Date(j),_=y.getTime()-m.getTime(),E=Math.floor(_/(1e3*60*60*24));if(Math.floor(E/30)>=1)return m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});const C=Math.floor(_/1e3),T=Math.floor(C/60),D=Math.floor(T/60),L=Math.floor(E/7),z=Math.floor(E/365);return z>0?`${z} year${z>1?"s":""} ago`:L>0?`${L} week${L>1?"s":""} ago`:E>0?`${E} day${E>1?"s":""} ago`:D>0?`${D} hour${D>1?"s":""} ago`:T>0?`${T} minute${T>1?"s":""} ago`:"Just now"};return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following..."]})}):u?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),e.jsxs("button",{onClick:g,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):a.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Avatar"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Username"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Last Post"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"HP"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Vote Value"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Manage"})]})}),e.jsx("tbody",{children:a.map((j,y)=>{const m=o.find(E=>E.name===j.following),_=v(j.following);return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.following),alt:j.following,className:"w-12 h-12 rounded-full object-cover cursor-pointer",onClick:()=>r&&r(j.following),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.following}&background=random`}})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>r&&r(j.following),children:["@",j.following]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),_?.about&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:_.about})]}),e.jsx("td",{className:"py-4 px-4",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:N(m.last_root_post)}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Never"})}),e.jsx("td",{className:"py-4 px-4",children:m?e.jsx(Qc,{vestingShares:m.vesting_shares}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:d[j.following]?e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["$",d[j.following]]}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"relative",ref:b===j.following?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.following?null:j.following),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),b===j.following&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.following),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-4 h-4"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.following),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-4 h-4"}),"Unfollow"]})]})]})})]},`${j.following}-${y}`)})})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:a.map((j,y)=>{const m=o.find(E=>E.name===j.following),_=v(j.following);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.following),alt:j.following,className:"w-10 h-10 rounded-full object-cover cursor-pointer flex-shrink-0",onClick:()=>r&&r(j.following),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.following}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 text-sm",onClick:()=>r&&r(j.following),children:["@",j.following]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?N(m.last_root_post):e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"Never"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx("div",{className:"flex items-center gap-4",children:m&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:e.jsx(Qc,{vestingShares:m.vesting_shares})})}),e.jsxs("div",{className:"relative",ref:b===j.following?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.following?null:j.following),className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),b===j.following&&e.jsxs("div",{className:"absolute right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.following),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-3 h-3"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.following),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-3 h-3"}),"Unfollow"]})]})]})]})]})]})},`${j.following}-${y}`)})})]})},ed=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class kg{async getAccountHistory(r,n=-1,s=1e3,a,i){try{const o=[r,n,s];return a!==void 0&&i!==void 0&&o.push(a,i),(await ed.call("condenser_api","get_account_history",o)).map(([d,f])=>({index:d,block:f.block,op:{type:f.op[0],value:f.op[1]},op_in_trx:f.op_in_trx,timestamp:f.timestamp,trx_id:f.trx_id,trx_in_block:f.trx_in_block,virtual_op:f.virtual_op}))}catch(o){return console.error("Error fetching account history:",o),[]}}async getNextAccountHistoryPage(r,n,s=1e3){try{const a=n-1;return(await ed.call("condenser_api","get_account_history",[r,a,s])).map(([c,d])=>({index:c,block:d.block,op:{type:d.op[0],value:d.op[1]},op_in_trx:d.op_in_trx,timestamp:d.timestamp,trx_id:d.trx_id,trx_in_block:d.trx_in_block,virtual_op:d.virtual_op})).filter(c=>c.index<n)}catch(a){return console.error("Error fetching next page of account history:",a),[]}}convertToActivityListItems(r,n){return r.filter(s=>{const a=s.op.type;return a!=="effective_comment_vote"&&a!=="witness_set_properties"&&a!=="producer_reward"&&a!=="comment_reward"&&a!=="comment_payout_update"&&a!=="claim_reward_balance"&&a!=="transfer"&&a!=="claim_account"&&a!=="transfer_to_vesting"&&a!=="transfer_to_vesting_completed"}).map(s=>{const a=this.parseOperation(s,n);return{id:`${s.index}-${s.trx_id}`,type:a.type,direction:a.direction,timestamp:s.timestamp,block:s.block,description:a.description,details:s.op.value,index:s.index,...a.extraFields}}).filter(s=>s!==null)}parseOperation(r,n){const{op:s}=r,a=s.type,i=s.value;switch(a){case"vote":return this.parseVoteOperation(i,n);case"comment":return this.parseCommentOperation(i,n);case"custom_json":return this.parseCustomJsonOperation(i,n);case"comment_options":return this.parseCommentOptionsOperation(i,n);case"effective_comment_vote":return this.parseEffectiveCommentVoteOperation(i,n);case"curation_reward":return this.parseCurationRewardOperation(i,n);case"author_reward":return this.parseAuthorRewardOperation(i,n);case"comment_benefactor_reward":return this.parseCommentBenefactorRewardOperation(i,n);default:return{type:"other",direction:"out",description:`${a} operation`,extraFields:{}}}}parseVoteOperation(r,n){const{voter:s,author:a,permlink:i,weight:o}=r,c=a===n,d=c?"in":"out",f=(o/100).toFixed(0);let l="";return c?l=`${s} voted ${a}/${i} with ${f}%`:l=`Voted ${a}/${i} with ${f}%`,{type:"vote",direction:d,description:l,extraFields:{voter:s,author:a,permlink:i,weight:parseInt(f)}}}parseCommentOperation(r,n){const{author:s,parent_author:a,parent_permlink:i,permlink:o}=r,d=a===n?"in":"out",l=`Commented on ${i} by ${a||s}.`;return{type:"comment",direction:d,description:l,extraFields:{author:s,permlink:o,parent_author:a,parent_permlink:i}}}parseCustomJsonOperation(r,n){const{id:s,json:a,required_auths:i,required_posting_auths:o}=r;let c={};try{c=JSON.parse(a)}catch{}let d="Custom Json";if(s==="follow"){const[f,l]=c;f==="follow"&&(d="Custom Json")}return{type:"custom_json",direction:"out",description:d,extraFields:{}}}parseCommentOptionsOperation(r,n){const{author:s,permlink:a,max_accepted_payout:i}=r;return{type:"comment_options",direction:"out",description:"Comment Payout Update",extraFields:{author:s,permlink:a,payout:i}}}parseEffectiveCommentVoteOperation(r,n){const{voter:s,author:a,permlink:i,pending_payout:o}=r,c=a===n,d=c?"in":"out",f=c?`${s} voted on ${a}/${i} (effective vote)`:`Effective vote on ${a}/${i}`;return{type:"effective_comment_vote",direction:d,description:f,extraFields:{voter:s,author:a,permlink:i,payout:o}}}parseCurationRewardOperation(r,n){const{author:s,curator:a,permlink:i,reward:o}=r,d=a===n?"in":"out",h=`${(parseFloat(o.split(" ")[0])*1e-6).toFixed(3)} HP`,u=`Curation reward for ${a}/${i} by ${s}`;return{type:"curation_reward",direction:d,description:u,extraFields:{author:s,curator:a,permlink:i,reward:h}}}parseAuthorRewardOperation(r,n){const{author:s,permlink:a,hbd_payout:i,hive_payout:o,vesting_payout:c}=r,f=s===n?"in":"out",h=(parseFloat(c.split(" ")[0])*1e-6).toFixed(3),u=i.split(" ")[0],p=o.split(" ")[0],b=`Author reward: ${u} HBD, ${p} HIVE, ${h} HP for ${a}`;return{type:"author_reward",direction:f,description:b,extraFields:{author:s,permlink:a,hbd_payout:i,hive_payout:o,vesting_payout:c}}}parseCommentBenefactorRewardOperation(r,n){const{author:s,benefactor:a,permlink:i,hbd_payout:o,hive_payout:c,vesting_payout:d}=r,l=a===n?"in":"out",u=(parseFloat(d.split(" ")[0])*1e-6).toFixed(3),p=o.split(" ")[0],b=c.split(" ")[0],w=`Benefactor reward on ${i} by ${s}: ${p} HBD, ${b} HIVE, ${u} HP`;return{type:"comment_benefactor_reward",direction:l,description:w,extraFields:{author:s,benefactor:a,permlink:i,hbd_payout:o,hive_payout:c,vesting_payout:d}}}filterByDirection(r,n){return n==="all"?r:r.filter(s=>s.direction===n)}filterByGeneralType(r,n){if(n==="all")return r;switch(n){case"votes":return r.filter(s=>s.type==="vote"||s.type==="effective_comment_vote");case"comments":return r.filter(s=>s.type==="comment");case"replies":return r.filter(s=>s.type==="comment"&&s.direction==="in");case"others":return r.filter(s=>s.type==="custom_json"||s.type==="comment_options"||s.type==="other");default:return r}}filterByRewardType(r,n){if(n==="all")return r;switch(n){case"author":return r.filter(s=>s.type==="effective_comment_vote"&&s.direction==="in");case"curation":return r.filter(s=>s.type==="effective_comment_vote"&&s.direction==="out");case"benefactor":return r.filter(s=>s.type==="comment_options"&&s.details?.beneficiaries);default:return r}}searchActivities(r,n){if(!n.trim())return r;const s=n.toLowerCase();return r.filter(a=>a.description.toLowerCase().includes(s)||a.author?.toLowerCase().includes(s)||a.permlink?.toLowerCase().includes(s)||a.voter?.toLowerCase().includes(s))}getRelativeTime(r){try{const n=new Date(r),a=new Date().getTime()-n.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),c=Math.floor(o/60),d=Math.floor(c/24);return i<60?`${i} seconds ago`:o<60?`${o} minutes ago`:c<24?`${c} hours ago`:d<7?`${d} days ago`:n.toLocaleDateString()}catch(n){return console.error("Error calculating relative time:",n),r}}}const Ea=new kg,g0=({username:t,directionFilter:r="all",generalFilter:n="all",rewardFilter:s="all",searchTerm:a="",limit:i=1e3,className:o,onClickPermlink:c,onSelectActivity:d})=>{const[f,l]=k.useState(a),[h,u]=k.useState(r),[p,b]=k.useState(n),[w,x]=k.useState(s),[g,v]=k.useState([]),[N,j]=k.useState([]),[y,m]=k.useState(!1),[_,E]=k.useState(null),[A,C]=k.useState(new Set),[T,D]=k.useState(null),[L,z]=k.useState(!0),[U,H]=k.useState(!1),[F,Y]=k.useState(-1),G=k.useRef(null),ne=async(q=!1)=>{if(t){q?H(!0):(m(!0),z(!0),Y(-1)),E(null);try{let B;q?B=await Ea.getNextAccountHistoryPage(t,F,i):B=await Ea.getAccountHistory(t,-1,i);const pe=Ea.convertToActivityListItems(B,t);if(pe.sort((ee,te)=>new Date(te.timestamp).getTime()-new Date(ee.timestamp).getTime()),v(q?ee=>[...ee,...pe]:pe),B.length>0){const ee=Math.min(...B.map(te=>te.index));Y(ee)}pe.length===0&&z(!1)}catch(B){E("Failed to load activity history"),console.error("Error loading activities:",B),z(!1)}finally{m(!1),H(!1)}}};k.useEffect(()=>{ne()},[t,i]);const ie=k.useCallback(()=>{L&&!y&&!U&&ne(!0)},[L,y,U]);k.useEffect(()=>{let q=g;h!=="all"?q=q.filter(B=>B.direction===h):q=q.filter(B=>B.type!=="custom_json"&&B.type!=="comment_options"),p!=="all"&&(p==="votes"?q=q.filter(B=>B.type==="vote"||B.type==="effective_comment_vote"):p==="comments"?q=q.filter(B=>B.type==="comment"):p==="replies"?q=q.filter(B=>B.type==="comment"&&B.direction==="in"):p==="curation"?q=q.filter(B=>B.type==="curation_reward"):p==="others"&&(q=g.filter(B=>B.type==="custom_json"||B.type==="comment_options"))),w!=="all"&&(w==="author"?q=q.filter(B=>B.type==="effective_comment_vote"&&B.direction==="in"):w==="curation"?q=q.filter(B=>B.type==="effective_comment_vote"&&B.direction==="out"):w==="benefactor"&&(q=q.filter(B=>B.type==="comment_options"))),f&&(q=q.filter(B=>B.description.toLowerCase().includes(f.toLowerCase())||B.author?.toLowerCase().includes(f.toLowerCase())||B.permlink?.toLowerCase().includes(f.toLowerCase()))),j(q)},[g,h,p,w,f]),k.useEffect(()=>{const q=B=>{G.current&&!G.current.contains(B.target)&&D(null)};return document.addEventListener("mousedown",q),()=>{document.removeEventListener("mousedown",q)}},[]);const xe=q=>{switch(q.type){case"vote":case"effective_comment_vote":return e.jsx(O.Wallet,{className:"h-4 w-4"});case"comment":return e.jsx(O.MessageCircle,{className:"h-4 w-4"});case"custom_json":return e.jsx(O.FileText,{className:"h-4 w-4"});case"curation_reward":return e.jsx(O.Wallet,{className:"h-4 w-4"});case"author_reward":return e.jsx(O.DollarSign,{className:"h-4 w-4"});case"comment_benefactor_reward":return e.jsx(O.User,{className:"h-4 w-4"});default:return e.jsx(O.Eye,{className:"h-4 w-4"})}},V=(q,B)=>q.split(/(\s+)/).map((ee,te)=>{if(ee.includes("/")){const[_e,Ie]=ee.split("/");if(_e&&Ie)return e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:K=>{K.stopPropagation(),console.log("Clicked permlink:",_e,Ie),c?.(_e,Ie)},children:ee},te)}return e.jsx("span",{children:ee},te)});return y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"}),e.jsx("div",{className:"w-full h-10 bg-gray-200 dark:bg-gray-700 rounded-md animate-pulse"})]})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from({length:5}).map((q,B)=>e.jsx("div",{className:"w-24 h-10 bg-gray-200 dark:bg-gray-700 rounded-md animate-pulse"},B))})]}),e.jsx("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Array.from({length:4}).map((q,B)=>e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-20"},B))})]}),e.jsx("div",{className:"space-y-4",children:Array.from({length:5}).map((q,B)=>e.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0 space-y-2",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-3/4"})})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("div",{className:"w-3 h-3 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-16"})]})]},B))})]}):_?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load activities"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:_}),e.jsxs("button",{onClick:()=>ne(),className:"inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search activities...",value:f,onChange:q=>l(q.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("select",{value:h,onChange:q=>u(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Directions"}),e.jsx("option",{value:"in",children:"Incoming"}),e.jsx("option",{value:"out",children:"Outgoing"})]}),e.jsxs("select",{value:p,onChange:q=>b(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"votes",children:"Votes"}),e.jsx("option",{value:"comments",children:"Comments"}),e.jsx("option",{value:"replies",children:"Replies"}),e.jsx("option",{value:"curation",children:"Curation"}),e.jsx("option",{value:"others",children:"Others"})]}),e.jsxs("select",{value:w,onChange:q=>x(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Rewards"}),e.jsx("option",{value:"author",children:"Author"}),e.jsx("option",{value:"curation",children:"Curation"}),e.jsx("option",{value:"benefactor",children:"Benefactor"})]}),e.jsx("button",{onClick:()=>ne(),disabled:y||U,className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Total: ",e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:g.length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Filtered: ",e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:N.length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Incoming: ",e.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:g.filter(q=>q.direction==="in").length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Outgoing: ",e.jsx("span",{className:"font-semibold text-blue-600 dark:text-blue-400",children:g.filter(q=>q.direction==="out").length})]})]})]}),e.jsx("div",{className:"space-y-4",children:N.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:g.length===0?"No activities found for this user.":"No activities match the current filters."})}):e.jsxs(e.Fragment,{children:[N.map((q,B)=>e.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors cursor-pointer",onClick:pe=>{d?.(q)},children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[q.type==="vote"&&q.voter?e.jsx("img",{src:`https://images.hive.blog/u/${q.voter}/avatar`,alt:q.voter,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):q.type==="comment_benefactor_reward"&&q.author?e.jsx("img",{src:`https://images.hive.blog/u/${q.author}/avatar`,alt:q.author,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):q.type==="comment"&&q.author?e.jsx("img",{src:`https://images.hive.blog/u/${q.author}/avatar`,alt:q.author,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):null,e.jsx("div",{className:`w-8 h-8 bg-purple-100 dark:bg-purple-900/20 rounded-full flex items-center justify-center flex-shrink-0 ${q.type==="vote"&&q.voter||q.type==="comment_benefactor_reward"&&q.author||q.type==="comment"&&q.author?"hidden":""}`,children:xe(q)}),e.jsx("div",{className:"flex-1 min-w-0",children:q.type==="custom_json"||q.type==="comment_options"?e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-900 dark:text-white break-words font-medium",children:V(q.description)}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:Ea.getRelativeTime(q.timestamp+"Z")}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-600 rounded p-2 bg-gray-50 dark:bg-gray-700/50 mt-1",children:e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 space-y-1 font-mono break-words",children:[q.type==="custom_json"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"id:"})," ",q.details.id]}),e.jsxs("div",{className:"break-all",children:[e.jsx("span",{className:"font-medium",children:"json:"})," ",JSON.stringify(q.details.json).replace(/\\\"/g,'"').replace(/^"|"$/g,"")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"required_auths:"})," ",JSON.stringify(q.details.required_auths)]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"required_posting_auths:"})," ",JSON.stringify(q.details.required_posting_auths)]})]}),q.type==="comment_options"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"author:"}),e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",children:q.details.author})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"permlink:"}),e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:pe=>{pe.stopPropagation(),console.log("Clicked permlink:",q.details.author,q.details.permlink),c?.(q.details.author,q.details.permlink)},children:q.details.permlink})]})]})]})})]}):e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-900 dark:text-white break-words",children:V(q.description)}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 sm:hidden",children:Ea.getRelativeTime(q.timestamp+"Z")})]})})]}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 flex-shrink-0 ml-4 hidden sm:flex",children:q.type!=="custom_json"&&q.type!=="comment_options"&&e.jsxs(e.Fragment,{children:[e.jsx(O.Clock,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Ea.getRelativeTime(q.timestamp+"Z")})]})})]},`${q.id}-${B}`)),L&&g.length>0&&e.jsx("div",{className:"flex justify-center py-6",children:e.jsx("button",{onClick:ie,disabled:y||U,className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white rounded-lg font-medium transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:U?e.jsxs(e.Fragment,{children:[e.jsx(O.RefreshCw,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):"Load More Activities"})}),!L&&g.length>0&&e.jsx("div",{className:"text-center text-sm text-gray-400 py-4",children:"No more activities to load"})]})})]})},dn=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Eg{async getWitnessesByVote(r="",n=60){try{return await dn.call("condenser_api","get_witnesses_by_vote",[r,n])}catch(s){throw console.error("Error fetching witnesses by vote:",s),s}}async getAccount(r){try{const n=await dn.call("condenser_api","get_accounts",[[r]]);return n&&n.length>0?n[0]:null}catch(n){return console.error("Error fetching account:",n),null}}async getAccounts(r){try{return await dn.call("condenser_api","get_accounts",[r])}catch(n){return console.error("Error fetching accounts:",n),[]}}async getWitnessVotes(r,n="",s=250){try{return await dn.call("database_api","list_witness_votes",{start:[r,n],limit:s,order:"by_witness_account"})}catch(a){throw console.error("Error fetching witness votes:",a),a}}async getAllWitnessVotes(r){const n=[];let s="";try{for(;;){const i=await this.getWitnessVotes(r,s,250);if(n.push(...i.votes),i.votes.length<250)break;s=i.votes[i.votes.length-1].account}return n}catch(i){return console.error("Error fetching all witness votes:",i),[]}}async hasUserVotedForWitness(r,n){try{const s=await this.getAccount(r);return!s||!s.witness_votes?!1:s.witness_votes.includes(n)}catch(s){return console.error("Error checking witness vote:",s),!1}}async getUserWitnessVotes(r){try{return(await this.getAccount(r))?.witness_votes||[]}catch(n){return console.error("Error fetching user witness votes:",n),[]}}formatVotesToMHP(r){return`${(parseFloat(r)/1e6).toFixed(1)}m`}calculateAPR(r){return r/100}getVersionStatus(r,n){const s=this.parseVersion(r),a=this.parseVersion(n);return this.compareVersions(s,a)>=0?"green":this.compareVersions(s,a)<0?"red":"grey"}parseVersion(r){return r.split(".").map(n=>parseInt(n,10))}compareVersions(r,n){const s=Math.max(r.length,n.length);for(let a=0;a<s;a++){const i=r[a]||0,o=n[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}getWitnessDescription(r){try{let n;if(r.json_metadata&&r.json_metadata!=="{}"){n=JSON.parse(r.json_metadata);const s=n.profile?.witness_description;if(s)return s}return r.posting_json_metadata&&r.posting_json_metadata!=="{}"?(n=JSON.parse(r.posting_json_metadata),n.profile?.about||""):""}catch(n){return console.error("Error parsing witness description:",n),""}}formatTimeAgo(r){const n=new Date(r),a=Math.floor((new Date().getTime()-n.getTime())/1e3);if(a<60)return`${a} second${a>1?"s":""} ago`;if(a<3600){const i=Math.floor(a/60);return`${i} minute${i>1?"s":""} ago`}else if(a<86400){const i=Math.floor(a/3600);return`${i} hour${i>1?"s":""} ago`}else if(a<604800){const i=Math.floor(a/86400);return`${i} day${i>1?"s":""} ago`}else if(a<2592e3){const i=Math.floor(a/604800);return`${i} week${i>1?"s":""} ago`}else if(a<31536e3){const i=Math.floor(a/2592e3);return`${i} month${i>1?"s":""} ago`}else{const i=Math.floor(a/31536e3);return`${i} year${i>1?"s":""} ago`}}}const Nr=new Eg,Wt=nd.create((t,r)=>({witnesses:[],witnessVotes:[],userWitnessVotes:[],witnessDetails:new Map,witnessAccounts:new Map,loadingWitnesses:!1,loadingMoreWitnesses:!1,loadingVotes:!1,loadingMoreVotes:!1,loadingUserVotes:!1,error:null,nextWitnessStart:"",nextVotesStart:"",hasMoreWitnesses:!0,hasMoreVotes:!1,selectedWitness:null,filters:{status:"all",name:"",version:""},loadWitnesses:async(n="",s=50)=>{const{witnesses:a}=r();if(a.length>=500){t({hasMoreWitnesses:!1});return}t(n!==""?{loadingMoreWitnesses:!0}:{loadingWitnesses:!0,error:null});try{const o=await Nr.getWitnessesByVote(n,s);t(d=>{const f=new Set(d.witnesses.map(h=>h.owner)),l=o.filter(h=>!f.has(h.owner));return{witnesses:[...d.witnesses,...l],nextWitnessStart:o.length>0?o[o.length-1].owner:"",hasMoreWitnesses:o.length===s}});const c=o.filter(d=>!r().witnessDetails.has(d.owner)).map(d=>d.owner);c.length>0&&r().loadWitnessDetails(c)}catch(o){console.error("Error loading witnesses:",o),t({error:"Failed to load witnesses data"})}finally{t({loadingWitnesses:!1,loadingMoreWitnesses:!1})}},loadMoreWitnesses:async()=>{const{nextWitnessStart:n,hasMoreWitnesses:s,loadingMoreWitnesses:a}=r();!s||a||!n||await r().loadWitnesses(n,50)},loadWitnessVotes:async n=>{t({loadingVotes:!0,witnessVotes:[],nextVotesStart:"",hasMoreVotes:!1,selectedWitness:n});try{const s=await Nr.getWitnessVotes(n,"",250);t({witnessVotes:s.votes,nextVotesStart:s.votes.length>0?s.votes[s.votes.length-1].account:"",hasMoreVotes:s.votes.length===250,loadingVotes:!1})}catch(s){console.error("Error loading witness votes:",s),t({error:"Failed to load witness votes",loadingVotes:!1})}},loadMoreVotes:async()=>{const{hasMoreVotes:n,loadingMoreVotes:s,nextVotesStart:a,selectedWitness:i,witnessVotes:o}=r();if(!n||s||!a||o.length>=1e3){o.length>=1e3&&t({hasMoreVotes:!1});return}t({loadingMoreVotes:!0});try{const c=await Nr.getWitnessVotes(i||"",a,250);t(d=>{const l=[...d.witnessVotes,...c.votes].filter((u,p,b)=>b.findIndex(w=>w.account===u.account)===p),h=c.votes.filter((u,p,b)=>b.findIndex(w=>w.account===u.account)===p);return{witnessVotes:l,nextVotesStart:h.length>0?h[h.length-1].account:"",hasMoreVotes:c.votes.length===250}})}catch(c){console.error("Error loading more witness votes:",c)}finally{t({loadingMoreVotes:!1})}},loadUserWitnessVotes:async n=>{if(n){t({loadingUserVotes:!0});try{const s=await Nr.getUserWitnessVotes(n);t({userWitnessVotes:s})}catch(s){console.error("Error loading user witness votes:",s)}finally{t({loadingUserVotes:!1})}}},loadWitnessDetails:async n=>{try{const s=await Nr.getAccounts(n);t(a=>{const i=new Map(a.witnessDetails),o=new Map(a.witnessAccounts);return s.forEach(c=>{const d=Nr.getWitnessDescription(c);d&&i.set(c.name,d),o.set(c.name,c)}),{witnessDetails:i,witnessAccounts:o}})}catch(s){console.error("Error loading witness details:",s)}},setFilters:n=>t({filters:n}),setSelectedWitness:n=>t({selectedWitness:n}),clearVotes:()=>t({witnessVotes:[],nextVotesStart:"",hasMoreVotes:!1,selectedWitness:null})})),td=({filters:t,onFiltersChange:r,theme:n="dark"})=>{const s=n==="dark"?"text-blue-400 hover:text-blue-300":"text-blue-600 hover:text-blue-800",a=c=>{const d=t.status===c?"all":c;r({...t,status:d})},i=c=>{r({...t,name:c})},o=c=>{r({...t,version:c})};return e.jsxs("div",{className:`rounded-lg p-4 mb-6 border ${n==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsx("h3",{className:`text-lg font-semibold mb-4 ${n==="dark"?"text-white":"text-gray-900"}`,children:"FILTERS"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${n==="dark"?"text-gray-300":"text-gray-700"}`,children:"WITNESS"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="active",onChange:()=>a("active"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${n==="dark"?"text-white":"text-gray-900"}`,children:"Active"})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="disabled",onChange:()=>a("disabled"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${n==="dark"?"text-white":"text-gray-900"}`,children:"Disabled/Stale"})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="approved",onChange:()=>a("approved"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${n==="dark"?"text-white":"text-gray-900"}`,children:"Approved"})]}),t.status!=="all"&&e.jsx("button",{onClick:()=>r({...t,status:"all"}),className:`text-sm underline ${s}`,children:"Clear Status Filter"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${n==="dark"?"text-gray-300":"text-gray-700"}`,children:"NAME"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:`w-4 h-4 ${n==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),e.jsx("input",{type:"text",placeholder:"Search",value:t.name,onChange:c=>i(c.target.value),className:`w-full pl-10 pr-4 py-2 border-b focus:outline-none focus:border-blue-500 ${n==="dark"?"bg-slate-900 border-gray-700 text-white placeholder-gray-400":"bg-gray-50 border-gray-300 text-gray-900 placeholder-gray-500"}`})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${n==="dark"?"text-gray-300":"text-gray-700"}`,children:"VERSION"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:`w-4 h-4 ${n==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),e.jsx("input",{type:"text",placeholder:"Version",value:t.version,onChange:c=>o(c.target.value),className:`w-full pl-10 pr-4 py-2 border-b focus:outline-none focus:border-blue-500 ${n==="dark"?"bg-slate-900 border-gray-700 text-white placeholder-gray-400":"bg-gray-50 border-gray-300 text-gray-900 placeholder-gray-500"}`})]})]})]})},ro=768;function $o(){const[t,r]=vn.useState(void 0);return vn.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ro-1}px)`),s=()=>{r(window.innerWidth<ro)};return n.addEventListener("change",s),r(window.innerWidth<ro),()=>n.removeEventListener("change",s)},[]),!!t}const Ag=({isOpen:t,onClose:r,witness:n,votes:s,loadingMore:a,hasMore:i,loadingInitial:o,scrollContainerRef:c,sentinelRef:d,loadMoreVotes:f,theme:l="dark"})=>{const h=k.useCallback(u=>{u[0].isIntersecting&&i&&!a&&f()},[i,a,f]);return k.useEffect(()=>{const u=new IntersectionObserver(h,{threshold:.1,root:c.current});return d.current&&u.observe(d.current),()=>{d.current&&u.unobserve(d.current)}},[h,c,d]),t?e.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`rounded-lg max-w-2xl w-full max-h-[80vh] overflow-hidden border ${l==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${l==="dark"?"border-gray-800":"border-gray-200"}`,children:[e.jsxs("h3",{className:`text-lg font-semibold ${l==="dark"?"text-white":"text-gray-900"}`,children:["Votes for @",n," (showing ",s.length,")"]}),e.jsx("button",{onClick:r,className:`text-xl font-bold ${l==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,children:"×"})]}),e.jsxs("div",{ref:c,className:"p-4 overflow-y-auto max-h-[60vh]",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map((u,p)=>e.jsxs("div",{className:`flex items-center space-x-3 p-3 rounded-lg border ${l==="dark"?"bg-gray-800 border-gray-800":"bg-gray-50 border-gray-200"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium ${l==="dark"?"bg-gray-600 text-white":"bg-gray-200 text-gray-900"}`,children:e.jsx("img",{className:"w-8 h-8 rounded-full",src:`https://images.hive.blog/u/${u.account}/avatar`,alt:u.account,onError:b=>{b.target.src="https://images.hive.blog/u/null/avatar"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`font-medium ${l==="dark"?"text-white":"text-gray-900"}`,children:u.account}),e.jsxs("div",{className:`text-sm ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:["Vote #",p+1]})]}),e.jsx("div",{className:`text-sm ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"25"})]},u.account))}),s.length===0&&!o&&e.jsx("div",{className:`text-center py-8 ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"No votes found for this witness."}),a&&e.jsx("div",{className:`text-center py-4 ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more votes..."}),i&&!a&&e.jsx("div",{className:"text-center py-4",children:e.jsx("button",{onClick:f,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",children:"Load More Votes"})}),i&&e.jsx("div",{ref:d,className:"h-4"})]})]})}):null},Sg=({username:t,filters:r={status:"all",name:"",version:""},onWitnessVoteClick:n,onWitnessStatsClick:s,onWitnessUrlClick:a,theme:i="dark"})=>{const o=$o(),c=Wt(V=>V.witnesses),d=Wt(V=>V.userWitnessVotes),f=Wt(V=>V.loadingWitnesses),l=Wt(V=>V.error),h=Wt(V=>V.selectedWitness),u=Wt(V=>V.witnessVotes),p=Wt(V=>V.hasMoreVotes),b=Wt(V=>V.loadingMoreVotes),w=Wt(V=>V.loadingVotes),x=Wt(V=>V.filters),g=Wt(V=>V.hasMoreWitnesses),v=Wt(V=>V.loadingWitnesses),N=Wt(V=>V.witnessDetails);Wt(V=>V.witnessAccounts);const j=Wt(V=>V.loadWitnesses),y=Wt(V=>V.loadMoreWitnesses),m=Wt(V=>V.loadWitnessVotes),_=Wt(V=>V.loadMoreVotes),E=Wt(V=>V.loadUserWitnessVotes),A=Wt(V=>V.setFilters),[C,T]=k.useState(!1),[D,L]=k.useState(!1),z=k.useRef(null),U=k.useRef(null),H=k.useRef(null),F=k.useCallback(V=>{V[0].isIntersecting&&g&&!v&&y()},[g,v,y]);k.useEffect(()=>{const V=new IntersectionObserver(F,{threshold:.1});return H.current&&V.observe(H.current),()=>{H.current&&V.unobserve(H.current)}},[F]),k.useEffect(()=>{j()},[j]),k.useEffect(()=>{t&&E(t)},[t,E]),k.useEffect(()=>{A(r)},[]);const Y=k.useMemo(()=>c.filter(V=>{if(x.status!=="all"){if(x.status==="active"){const q=new Date;if(q.setFullYear(q.getFullYear()-1),new Date(V.last_hbd_exchange_update+"Z")<=q)return!1}else if(x.status==="disabled"){const q=new Date;if(q.setFullYear(q.getFullYear()-1),new Date(V.last_hbd_exchange_update+"Z")>q)return!1}else if(x.status==="approved"&&!d.includes(V.owner))return!1}return!(x.name&&!V.owner.toLowerCase().includes(x.name.toLowerCase())||x.version&&!V.running_version.includes(x.version))}),[c,x,d]),G=async V=>{n?n(V):(await m(V),T(!0))},ne=V=>{s?s(V):window.open(`https://hivehub.dev/witnesses/@${V}`,"_blank")},ie=V=>{a?a(V):window.open(V,"_blank")},xe=V=>t?d.includes(V):!1;return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"})}):l?e.jsx("div",{className:"text-center p-8 text-red-400",children:l}):e.jsxs("div",{className:"w-full",children:[e.jsx(Ag,{isOpen:C,onClose:()=>T(!1),witness:h||"",votes:u,loadingMore:b,hasMore:p,loadingInitial:w,scrollContainerRef:U,sentinelRef:z,loadMoreVotes:_,theme:i}),o?e.jsxs("div",{className:`w-full p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:`text-lg font-semibold ${i==="dark"?"text-white":"text-gray-900"}`,children:"Witnesses"}),e.jsxs("button",{onClick:()=>L(!D),className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded flex items-center space-x-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),e.jsx("span",{children:D?"Hide Filters":"Show Filters"})]})]}),D&&e.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`rounded-lg w-full max-w-md max-h-[80vh] overflow-hidden border ${i==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${i==="dark"?"border-gray-800":"border-gray-200"}`,children:[e.jsx("h3",{className:`text-lg font-semibold ${i==="dark"?"text-white":"text-gray-900"}`,children:"Filters"}),e.jsx("button",{onClick:()=>L(!1),className:`text-xl font-bold ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,children:"×"})]}),e.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:e.jsx(td,{filters:x,onFiltersChange:A,theme:i})})]})}),e.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto",children:[Y.map((V,q)=>{const B=Nr.getVersionStatus(V.running_version,V.hardfork_version_vote),pe=xe(V.owner),ee=c.findIndex(te=>te.owner===V.owner)+1;return e.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${i==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("span",{className:`text-lg font-bold ${i==="dark"?"text-white":"text-gray-900"}`,children:["#",ee]}),e.jsx("img",{className:"w-10 h-10 rounded-full",src:`https://images.hive.blog/u/${V.owner}/avatar`,alt:V.owner,onError:te=>{te.target.src="https://images.hive.blog/u/null/avatar"}}),e.jsxs("div",{children:[e.jsx("div",{className:`font-medium ${i==="dark"?"text-white":"text-gray-900"}`,children:V.owner}),e.jsxs("div",{className:`text-xs ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["Since ",new Date(V.created).getFullYear()]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{className:`w-6 h-6 ${pe?"text-green-600":i==="dark"?"text-gray-500":"text-gray-400"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex space-x-1",children:[e.jsx("button",{onClick:()=>ie(V.url),className:`${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"Visit witness URL",children:"🔗"}),e.jsx("button",{onClick:()=>ne(V.owner),className:`${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"View witness stats",children:"📊"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Version"}),e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium mt-1 block ${B==="green"?"bg-green-100 text-green-800":B==="red"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:V.running_version})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Votes (MHP)"}),e.jsx("button",{onClick:()=>G(V.owner),className:"text-blue-600 hover:text-blue-800 cursor-pointer text-sm font-medium mt-1",disabled:w,children:w&&h===V.owner?"Loading...":Nr.formatVotesToMHP(V.votes)})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"APR"}),e.jsxs("div",{className:`font-medium mt-1 ${i==="dark"?"text-white":"text-gray-900"}`,children:[Nr.calculateAPR(V.props.hbd_interest_rate),"%"]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-xs",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Last Block"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.last_confirmed_block_num.toLocaleString()})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Miss"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.total_missed.toLocaleString()})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Price Feed"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.hbd_exchange_rate.base}),e.jsx("div",{className:`${i==="dark"?"text-gray-400":"text-gray-500"}`,children:Nr.formatTimeAgo(V.last_hbd_exchange_update+"Z")})]})]}),N.get(V.owner)&&e.jsx("div",{className:`mt-3 pt-3 border-t ${i==="dark"?"border-gray-800":"border-gray-200"}`,children:e.jsx("div",{className:`text-xs line-clamp-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:N.get(V.owner)})})]},V.owner)}),v&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more witnesses..."})]}),g&&e.jsx("div",{ref:H,className:"h-1"})]})]}):e.jsx("div",{className:`max-w-7xl mx-auto p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:e.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[e.jsx("div",{className:"col-span-1 sticky top-0 h-screen overflow-y-auto",children:e.jsx(td,{filters:x,onFiltersChange:A,theme:i})}),e.jsxs("div",{className:"col-span-4 overflow-auto max-h-screen",children:[e.jsxs("table",{className:`w-full text-xs text-left ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("thead",{className:`text-xs uppercase ${i==="dark"?"text-gray-400 bg-slate-900":"text-gray-700 bg-gray-50"}`,children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Rank"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Witness"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Version"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Votes"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Last Block"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Miss"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Feed"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"APR"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Vote"})]})}),e.jsx("tbody",{children:Y.map((V,q)=>{const B=Nr.getVersionStatus(V.running_version,V.hardfork_version_vote),pe=xe(V.owner);return e.jsxs("tr",{className:`border-b hover:bg-gray-50 ${i==="dark"?"border-gray-800 hover:bg-gray-800":"border-gray-200"}`,children:[e.jsx("td",{className:`px-2 py-2 font-medium text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:c.findIndex(ee=>ee.owner===V.owner)+1}),e.jsx("td",{className:"px-2 py-2",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("img",{className:"w-6 h-6 rounded-full",src:`https://images.hive.blog/u/${V.owner}/avatar`,alt:V.owner,onError:ee=>{ee.target.src="https://images.hive.blog/u/null/avatar"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`font-medium text-xs truncate ${i==="dark"?"text-white":"text-gray-900"}`,children:V.owner}),e.jsxs("div",{className:`text-xs ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["Since ",new Date(V.created).getFullYear()]})]}),e.jsxs("div",{className:"flex space-x-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>ie(V.url),className:`text-xs ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"Visit witness URL",children:"🔗"}),e.jsx("button",{onClick:()=>ne(V.owner),className:`text-xs ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"View witness stats",children:"📊"})]})]})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("span",{className:`px-1 py-0.5 rounded text-xs font-medium ${B==="green"?"bg-green-100 text-green-800":B==="red"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:V.running_version})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("button",{onClick:()=>G(V.owner),className:"text-blue-600 hover:text-blue-800 cursor-pointer text-xs",disabled:w,children:w&&h===V.owner?"...":Nr.formatVotesToMHP(V.votes)})}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx("div",{className:`text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:V.last_confirmed_block_num.toLocaleString()})}),e.jsx("td",{className:"px-2 py-2 text-right text-xs",children:e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.total_missed.toLocaleString()})}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx("div",{className:`text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:V.hbd_exchange_rate.base})}),e.jsx("td",{className:"px-2 py-2 text-right text-xs",children:e.jsxs("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:[Nr.calculateAPR(V.props.hbd_interest_rate),"%"]})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{className:`w-4 h-4 ${pe?"text-green-600":i==="dark"?"text-gray-500":"text-gray-400"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})})]},V.owner)})})]}),v&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more witnesses..."})]}),g&&e.jsx("div",{ref:H,className:"h-1"})]})]})})]})},Cg=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Tg{async getTransactionHistory(r,n=-1,s=1e3,a=null,i=null){try{const o=[r,n,s];a!==null&&i!==null&&o.push(a,i);const c=await Cg.call("condenser_api","get_account_history",o);return Array.isArray(c)?c.map(d=>Array.isArray(d)&&d.length>=2?d[1]:d):[]}catch(o){return console.error("Error in getTransactionHistory:",o),[]}}async getFilteredTransactionHistory(r,n=[],s=100){try{const a=await this.getTransactionHistory(r,-1,1e3);let i=a;return n.length>0&&(i=a.filter(o=>{const c=o.op?.[0];return n.includes(c)})),i.slice(0,s)}catch(a){return console.error("Error in getFilteredTransactionHistory:",a),[]}}async getRecentTransfers(r,n=50){return this.getFilteredTransactionHistory(r,["transfer"],n)}async getRecentVotes(r,n=50){return this.getFilteredTransactionHistory(r,["vote"],n)}async getRecentComments(r,n=50){return this.getFilteredTransactionHistory(r,["comment"],n)}parseOperation(r){try{if(!r.op||!Array.isArray(r.op)||r.op.length<2)return null;const[n,s]=r.op;switch(n){case"transfer":return{type:"transfer",value:{from:s.from||"",to:s.to||"",amount:s.amount||"",memo:s.memo||""}};case"vote":return{type:"vote",value:{voter:s.voter||"",author:s.author||"",permlink:s.permlink||"",weight:s.weight||0}};case"comment":return{type:"comment",value:{parent_author:s.parent_author||"",parent_permlink:s.parent_permlink||"",author:s.author||"",permlink:s.permlink||"",title:s.title||"",body:s.body||"",json_metadata:s.json_metadata||""}};case"custom_json":return{type:"custom_json",value:{required_auths:s.required_auths||[],required_posting_auths:s.required_posting_auths||[],id:s.id||"",json:s.json||""}};case"comment_payout_update":return{type:"comment_payout_update",value:{author:s.author||"",permlink:s.permlink||""}};case"comment_options":return{type:"comment_options",value:{author:s.author||"",permlink:s.permlink||"",max_accepted_payout:s.max_accepted_payout||"",percent_hbd:s.percent_hbd||0,allow_votes:s.allow_votes||!1,allow_curation_rewards:s.allow_curation_rewards||!1,extensions:s.extensions||[]}};case"effective_comment_vote":return{type:"effective_comment_vote",value:{voter:s.voter||"",author:s.author||"",permlink:s.permlink||"",pending_payout:s.pending_payout||"",weight:s.weight||0,rshares:s.rshares||0,total_vote_weight:s.total_vote_weight||0}};default:return console.warn("Unknown operation type:",n,r.op),null}}catch(n){return console.error("Error parsing operation:",n,r.op),null}}formatTimestamp(r){try{return new Date(r).toLocaleString()}catch(n){return console.error("Error formatting timestamp:",n),r}}getTransactionSummary(r){const n={};let s="",a="";return r.forEach(i=>{const o=i.op?.[0]||"unknown";n[o]=(n[o]||0)+1,(!s||i.timestamp<s)&&(s=i.timestamp),(!a||i.timestamp>a)&&(a=i.timestamp)}),{totalTransactions:r.length,operationCounts:n,dateRange:{earliest:s,latest:a}}}}const Aa=new Tg;function Dg({account:t,className:r}){const[n,s]=k.useState([]),[a,i]=k.useState([]),[o,c]=k.useState(!1),[d,f]=k.useState(null),[l,h]=k.useState(""),[u,p]=k.useState("all"),[b,w]=k.useState(50),x=[{value:"all",label:"All Operations",icon:O.Activity},{value:"transfer",label:"Transfers",icon:O.Send},{value:"vote",label:"Votes",icon:O.TrendingUp},{value:"comment",label:"Comments",icon:O.MessageCircle},{value:"custom_json",label:"Custom JSON",icon:O.ArrowUpDown},{value:"comment_payout_update",label:"Payout Updates",icon:O.RefreshCw},{value:"comment_options",label:"Comment Options",icon:O.Filter},{value:"effective_comment_vote",label:"Effective Votes",icon:O.Users}],g=async()=>{if(t){c(!0),f(null);try{const y=await Aa.getTransactionHistory(t,-1,b);s(y),i(y)}catch(y){f("Failed to load transaction history"),console.error("Error loading transactions:",y)}finally{c(!1)}}};k.useEffect(()=>{g()},[t,b]),k.useEffect(()=>{let y=n;if(u!=="all"&&(y=y.filter(m=>m.op?.[0]===u)),l){const m=l.toLowerCase();y=y.filter(_=>{const E=Aa.parseOperation(_);if(!E)return!1;switch(E.type){case"transfer":return E.value.from.toLowerCase().includes(m)||E.value.to.toLowerCase().includes(m)||E.value.memo.toLowerCase().includes(m);case"vote":return E.value.voter.toLowerCase().includes(m)||E.value.author.toLowerCase().includes(m)||E.value.permlink.toLowerCase().includes(m);case"comment":return E.value.author.toLowerCase().includes(m)||E.value.title.toLowerCase().includes(m)||E.value.permlink.toLowerCase().includes(m);default:return!1}})}i(y)},[n,u,l]);const v=y=>{if(!y)return e.jsx(O.Activity,{className:"h-4 w-4"});const m=x.find(_=>_.value===y.type)?.icon||O.Activity;return e.jsx(m,{className:"h-4 w-4"})},N=y=>{const m=Aa.parseOperation(y);if(!m)return e.jsx("span",{className:"text-gray-400",children:"Unknown operation"});switch(m.type){case"transfer":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Transfer"}),e.jsx("span",{className:"text-sm font-medium text-white",children:m.value.amount})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"From:"}),e.jsx("img",{src:Ee.userAvatar(m.value.from),alt:`${m.value.from} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.from)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.from})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"To:"}),e.jsx("img",{src:Ee.userAvatar(m.value.to),alt:`${m.value.to} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.to)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.to})]}),m.value.memo&&e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Memo:"})," ",m.value.memo]})]});case"vote":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Vote"}),e.jsxs("span",{className:"text-sm font-medium text-white",children:[m.value.weight,"%"]})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Voter:"}),e.jsx("img",{src:Ee.userAvatar(m.value.voter),alt:`${m.value.voter} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.voter)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.voter})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"comment":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Comment"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Title:"})," ",m.value.title]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"custom_json":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Custom JSON"})}),e.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",m.value.id]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["JSON: ",m.value.json.substring(0,100),"..."]})]});case"comment_payout_update":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Payout Update"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"comment_options":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Comment Options"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Max Payout:"})," ",m.value.max_accepted_payout]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"HBD Percent:"})," ",m.value.percent_hbd,"%"]})]});case"effective_comment_vote":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Effective Vote"}),e.jsx("span",{className:"text-sm font-medium text-white",children:m.value.weight})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Voter:"," ",e.jsx("span",{className:"font-mono text-gray-300",children:m.value.voter})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Post: @",m.value.author,"/",m.value.permlink]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Pending Payout: ",m.value.pending_payout]})]});default:return e.jsx("span",{className:"text-gray-400",children:"Unknown operation"})}},j=Aa.getTransactionSummary(n);return o?e.jsxs("div",{className:`bg-gray-800 border border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsxs("div",{className:"p-2 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(O.Activity,{className:"h-5 w-5 text-gray-300"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Transaction History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Loading transaction history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:y=>{y.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]})]}),e.jsx("div",{className:"p-2 md:p-6 space-y-2 md:space-y-4",children:Array.from({length:5}).map((y,m)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded animate-pulse w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded animate-pulse w-1/2"})]},m))})]}):e.jsxs("div",{className:`bg-gray-800 border border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsxs("div",{className:"p-4 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(O.Activity,{className:"h-5 w-5 text-gray-300"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Transaction History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Transaction history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:y=>{y.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.totalTransactions}),e.jsx("div",{className:"text-sm text-gray-400",children:"Total"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.transfer||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Transfers"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.vote||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Votes"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.comment||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Comments"})]})]})]}),e.jsxs("div",{className:"p-4 md:p-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search transactions...",value:l,onChange:y=>h(y.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsx("select",{value:u,onChange:y=>p(y.target.value),className:"w-full sm:w-48 px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:x.map(y=>e.jsx("option",{value:y.value,children:y.label},y.value))}),e.jsxs("select",{value:b.toString(),onChange:y=>w(parseInt(y.target.value)),className:"w-full sm:w-32 px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"25",children:"25"}),e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"}),e.jsx("option",{value:"200",children:"200"})]}),e.jsx("button",{onClick:g,className:"px-3 py-2 bg-gray-700 border border-gray-600 rounded-md hover:bg-gray-600 text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]}),d&&e.jsx("div",{className:"p-4 border border-red-700 bg-red-900 rounded-md",children:e.jsx("p",{className:"text-red-300",children:d})}),e.jsx("div",{className:"space-y-4",children:a.length===0?e.jsx("div",{className:"text-center py-8 text-gray-400",children:"No transactions found"}):a.map(y=>{const m=Aa.parseOperation(y);return e.jsxs("div",{className:"border border-gray-600 rounded-lg p-3 md:p-4 space-y-3 hover:bg-gray-700 transition-colors",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[v(m),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:m?.type?m.type.charAt(0).toUpperCase()+m.type.slice(1):"Unknown"}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3"}),Aa.formatTimestamp(y.timestamp)]})]})]})}),e.jsx("div",{className:"ml-6 md:ml-7",children:N(y)})]},`${y.trx_id}-${y.op_in_trx}`)})}),a.length>0&&e.jsxs("div",{className:"text-center text-sm text-gray-400",children:["Showing ",a.length," of ",n.length," ","transactions"]})]})]})}const Pg=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Og{async getUserChannel(r,n="posts",s=20,a=null,i=null,o=null){const c={account:r,sort:n,limit:s};a&&(c.start_author=a),i&&(c.start_permlink=i),o&&(c.observer=o);try{const d=await Pg.call("bridge","get_account_posts",c);return Array.isArray(d)?d:[]}catch(d){return console.error("Error in getUserChannel:",d),[]}}async getUserPosts(r,n=20){return this.getUserChannel(r,"posts",n)}async getUserComments(r,n=20){return this.getUserChannel(r,"comments",n)}async getUserReplies(r,n=20){return this.getUserChannel(r,"replies",n)}async getAllUserActivity(r,n=10){try{const[s,a,i]=await Promise.all([this.getUserPosts(r,n),this.getUserComments(r,n),this.getUserReplies(r,n)]);return[...s,...a,...i].sort((c,d)=>new Date(d.created).getTime()-new Date(c.created).getTime())}catch(s){return console.error("Error in getAllUserActivity:",s),[]}}convertToDisplayItem(r){return{id:r.id,author:r.author,permlink:r.permlink,title:r.title,body:r.body,created:r.created,category:r.category,net_votes:r.net_votes,children:r.children,total_payout_value:r.total_payout_value,pending_payout_value:r.pending_payout_value,url:r.url,type:r.parent_author===""?"post":"comment"}}formatTimestamp(r){try{return new Date(r).toLocaleString()}catch(n){return console.error("Error formatting timestamp:",n),r}}getRelativeTime(r){try{const n=new Date(r),a=new Date().getTime()-n.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),c=Math.floor(o/60),d=Math.floor(c/24);return i<60?`${i} seconds ago`:o<60?`${o} minutes ago`:c<24?`${c} hours ago`:d<7?`${d} days ago`:n.toLocaleDateString()}catch(n){return console.error("Error calculating relative time:",n),r}}truncateText(r,n=150){return r.length<=n?r:r.substring(0,n)+"..."}getActivitySummary(r){let n=0,s=0,a=0,i=0;return r.forEach(o=>{o.parent_author===""?n++:s++,a+=o.net_votes||0;const c=o.total_payout_value?.match(/(\d+\.?\d*)/);c&&(i+=parseFloat(c[1]))}),{totalActivities:r.length,postsCount:n,commentsCount:s,totalVotes:a,totalPayout:`${i.toFixed(3)} HIVE`,averageVotes:r.length>0?Math.round(a/r.length):0}}filterByCategory(r,n){return r.filter(s=>s.category===n)}filterByDateRange(r,n,s){return r.filter(a=>{const i=new Date(a.created);return i>=n&&i<=s})}searchActivities(r,n){const s=n.toLowerCase();return r.filter(a=>a.title.toLowerCase().includes(s)||a.body.toLowerCase().includes(s)||a.category.toLowerCase().includes(s))}}const Sa=new Og,Lg=({username:t,className:r})=>{const[n,s]=k.useState([]),[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState([]),[l,h]=k.useState([]),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(""),[v,N]=k.useState(20),[j,y]=k.useState("all"),[m,_]=k.useState(new Set),[E,A]=k.useState(!1),C=async()=>{if(!(!t||E)){p(!0),w(null);try{const[F,Y,G]=await Promise.all([Sa.getUserPosts(t,v),Sa.getUserComments(t,v),Sa.getUserReplies(t,v)]);s(F),i(Y),c(G),A(!0)}catch(F){w("Failed to load activity history"),console.error("Error loading activities:",F)}finally{p(!1)}}};k.useEffect(()=>{C()},[t]),k.useEffect(()=>{if(!E)return;let F=[];switch(j){case"posts":F=n;break;case"comments":F=a;break;case"replies":F=o;break;default:F=[...n,...a,...o].sort((Y,G)=>new Date(G.created).getTime()-new Date(Y.created).getTime());break}f(F),h(F)},[j,n,a,o,E]),k.useEffect(()=>{let F=d;x&&(F=Sa.searchActivities(d,x)),h(F)},[d,x]);const T=F=>!F||F==="0.000 HIVE"?"0 HIVE":F,D=F=>F.parent_author===""?"Post":F.depth===1?"Comment":"Reply",L=new Vn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:F=>F,usertagUrlFn:F=>`/@${F}`,hashtagUrlFn:F=>`/trending/${F}`,isLinkSafeFn:F=>!0,addExternalCssClassToMatchingLinksFn:F=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),z=F=>{const Y=new Set(m);Y.has(F)?Y.delete(F):Y.add(F),_(Y)},U=F=>{const Y=`${F.author}-${F.permlink}`,G=m.has(Y),ne=F.body.length>100;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-3 sm:p-4 space-y-3 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors relative",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",children:e.jsx("div",{className:"flex items-start gap-3 flex-1",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${F.parent_author===""?"bg-blue-900 text-blue-300":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300"}`,children:D(F)}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:["in #",F.category]})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("img",{src:Ee.userAvatar(F.author),alt:`${F.author} avatar`,className:"w-5 h-5 sm:w-6 sm:h-6 rounded-full flex-shrink-0",onError:ie=>{ie.target.src=Ee.userAvatar(F.author)}}),e.jsx("h3",{className:"font-medium text-base sm:text-lg leading-tight text-gray-900 dark:text-white break-words",children:F.title||"Untitled"})]}),e.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-3 text-gray-500 dark:text-gray-400 comment-content overflow-hidden",children:[e.jsx("div",{className:"break-words overflow-wrap-anywhere",dangerouslySetInnerHTML:{__html:L.render(ne&&!G?F.body.substring(0,50)+".....":F.body)}}),ne&&e.jsxs("button",{onClick:()=>z(Y),className:"mt-2 text-blue-400 hover:text-blue-300 text-sm font-medium flex items-center gap-1",children:[e.jsx(O.ChevronDown,{className:`h-3 w-3 transition-transform ${G?"rotate-180":""}`}),G?"Show less":"Show more"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-4 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Sa.getRelativeTime(F.created)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.ThumbsUp,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{children:[F.net_votes," votes"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.Reply,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{children:[F.children," replies"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"💰"}),e.jsx("span",{children:T(F.total_payout_value)})]})]})]})})}),e.jsx("button",{onClick:()=>window.open(`https://peakd.com/@${F.author}/${F.permlink}`,"_blank"),className:"absolute top-3 right-3 flex-shrink-0 p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:e.jsx(O.ExternalLink,{className:"h-4 w-4"})})]},Y)},H=Sa.getActivitySummary(d);return u?e.jsxs("div",{className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading activity history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:F=>{F.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["@",t]})]})}),e.jsx("div",{className:"p-6 space-y-4",children:Array.from({length:5}).map((F,Y)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-1/2"}),e.jsx("div",{className:"h-20 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-full"})]},Y))})]}):e.jsxs("div",{className:`space-y-6 ${r}`,children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-16 h-16 rounded-full object-cover",onError:F=>{F.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:["@",t]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"Activity History"}),e.jsx("div",{className:"flex flex-wrap gap-6 text-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.FileText,{className:"w-4 h-4"}),e.jsxs("span",{children:[H.totalActivities," Total Activities"]})]})})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex md:grid md:grid-cols-4 overflow-x-auto md:overflow-visible w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsx("button",{onClick:()=>y("all"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="all"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"All"}),e.jsx("button",{onClick:()=>y("posts"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="posts"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Posts"}),e.jsx("button",{onClick:()=>y("comments"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="comments"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Comments"}),e.jsx("button",{onClick:()=>y("replies"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="replies"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Replies"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex flex-row gap-4 mb-6",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500 dark:text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search activities...",value:x,onChange:F=>g(F.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsx("button",{onClick:()=>{A(!1),C()},className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]}),b&&e.jsx("div",{className:"p-4 border border-red-200 dark:border-red-700 bg-red-50 dark:bg-red-900 rounded-md",children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:b})}),e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No activities found"}):l.map(U)}),l.length>0&&e.jsxs("div",{className:"text-center text-sm text-gray-500 dark:text-gray-400",children:["Showing ",l.length," of ",d.length," ","activities"]})]})]})]})},Qt="https://images.ecency.com",rt={actifit_logo:`${Qt}/DQmemUxomzr8RFEZGoT7a8rSvpx1LnzuAzDNyikKuENkSuc/actifit_logo.png`,checkinwithxyz:`${Qt}/DQmUAbGJ1XN461zbaEus7aam1vuVg1cMAtzpuLGgwdAPUEU/checkinwithxyz.png`,developers:`${Qt}/DQmNeGvBgY5r4pay9fhrD8LforDyasa2kstPwBmaLcQBmSW/developers.png`,distriator_logo:`${Qt}/DQmZw6AXZ7wmEChsWXA3onVZXCsRUYGwbp87qP9onaLAvLW/distriator_logo.png`,ecency_logo:`${Qt}/DQmNsuCkexmEKoWB9ywdR5UkzRQ4Xu6CAgHjRTATCB23znc/ecency_logo.png`,happrover_logo:`${Qt}/DQmcy4sHYiMkUJYLhu4jgrvVbvk9vxeSvXHn21ZpVLXK6Jf/happrover_logo.png`,hive_logo:`${Qt}/DQma5YQXrk1WZ7oxgLqdPjbVdShmVGzeL7yZ6BCQGjMF6G3/hive_logo.png`,hive_fest_fact_logo:`${Qt}/DQmTiwJfQSBsdQMAivWfi97P6UwUqsd4wBgFmP2xhQjtA4r/hive_fest_fact_logo.png`,hiveauth_logo:`${Qt}/DQmP9vkxQuQkaCfin2whQfokMF9YJMN3Aujz9B5sGQVNWoE/hiveauth_logo.png`,hpolls_logo:`${Qt}/DQmejtPJC86dhzUKPZxQxaCBaud2ocy6PWPLqjEHNPoWQnX/hpolls_logo.png`,hreplier:`${Qt}/DQmRMrDJvNBeRzDj1W8e99TqkN87Ch7w9SWun6woVaRTAZ3/hreplier.png`,nodes:`${Qt}/DQmbmVKTexP4r4CfzmQKztzBdA26vZBJuJHLZo5GwT88Gxf/nodes.png`,podcast_logo:`${Qt}/DQmd1xwQJvM5pPvWpXoNT1vWqo4XqFvN7RDUVZb3w6ZxHLo/podcast_logo.jpg`,stats_logo:`${Qt}/DQme3DKpB5uVv5ASf9AkFHLY3JdxD2YQMuPa6k2jptULXRY/stats_logo.png`,template:`${Qt}/DQmStuCUgDJmxtLKLUd3fZKmYyPEbvuopdRhwFx3SHiycCq/template.png`,three_shorts_logo:`${Qt}/DQmbNeu2p1GokLH6T8QwekCJBSwSK4qo29ebeVwqD1YbK25/three_shorts_logo.png`,three_speak_logo:`${Qt}/DQmc84A9bXdQ3oRMz3YgV1VNCAFvPbJVSvsf434FApxg2cf/three_speak_logo.png`,vote_logo:`${Qt}/DQmVa8V2FCjJKMaqgoUaRDHPa4TYdqceCmAbCJU7rGj5yBe/vote_logo.png`},Mg=[{key:"vote-witness-sagar",name:"Vote Witness Sagar",url:"https://vote.hive.uno/@sagarkothari88",logo:"",alwaysVisible:!0,isAvatar:!0,avatarUrl:"https://images.hive.blog/u/sagarkothari88/avatar"},{key:"vote-witness-threespeak",name:"Vote Witness 3Speak",url:"https://vote.hive.uno/@threespeak",logo:rt.three_speak_logo,alwaysVisible:!0},{key:"distriator",name:"Distriator",url:"https://distriator.com/",logo:rt.distriator_logo,visibilityKey:"isDistriator"},{key:"checkinwithxyz",name:"CheckinWithXYZ",url:"https://checkinwith.xyz/",logo:rt.checkinwithxyz,visibilityKey:"isCheckinwithxyz"},{key:"hreplier",name:"HReplier",url:"https://hreplier.sagarkothari88.one/",logo:rt.hreplier,visibilityKey:"isHreplier"},{key:"hpolls",name:"HPolls",url:"https://hpolls.sagarkothari88.one/",logo:rt.hpolls_logo,visibilityKey:"isHpolls"},{key:"hstats",name:"HStats",url:"https://hstats.sagarkothari88.one/",logo:rt.stats_logo,visibilityKey:"isHstats"},{key:"hsnaps",name:"HSnaps",url:"https://hsnaps.sagarkothari88.one/",logo:rt.template,visibilityKey:"isHsnaps"},{key:"3speak",name:"3Speak",url:"https://3speak.tv/",logo:rt.three_speak_logo,alwaysVisible:!0},{key:"hivefestfacts",name:"HiveFestFacts",url:"https://hivefestfacts.sagarkothari88.one/",logo:rt.hive_fest_fact_logo,visibilityKey:"isHiveFestFacts"}];function Rg(){const[t,r]=k.useState("desktop");return k.useEffect(()=>{const n=()=>{const s=window.innerWidth;s<480?r("mobile"):s<768?r("tablet"):r("desktop")};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}const $g={mobile:{icon:28,fontSize:8,padding:"4px 6px",gap:2,barPadding:"4px",minWidth:52,maxWidth:68},tablet:{icon:30,fontSize:8,padding:"4px 5px",gap:3,barPadding:"5px 6px",minWidth:56,maxWidth:72},desktop:{icon:32,fontSize:9,padding:"4px 6px",gap:4,barPadding:"6px 8px",minWidth:60,maxWidth:80}},Ig=({isDistriator:t=!0,isCheckinwithxyz:r=!0,isHreplier:n=!0,isHpolls:s=!0,isHstats:a=!0,isHsnaps:i=!0,isHiveFestFacts:o=!0,backgroundColor:c="#ffffff",textColor:d="#4b5563",borderTopColor:f="#e2e8f0"})=>{const l=Rg(),h=$g[l],u={isDistriator:t,isCheckinwithxyz:r,isHreplier:n,isHpolls:s,isHstats:a,isHsnaps:i,isHiveFestFacts:o},p=Mg.filter(b=>b.alwaysVisible||u[b.visibilityKey]!==!1);return p.length===0?null:e.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,backgroundColor:c,borderTop:`1px solid ${f}`,boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.08)"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:l==="desktop"?"center":"flex-start",overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",padding:h.barPadding,gap:`${h.gap}px`,scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},className:"hive-toolbar-scroll",children:p.map(b=>e.jsxs("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textDecoration:"none",color:d,padding:h.padding,borderRadius:"8px",transition:"background-color 0.2s, transform 0.2s",cursor:"pointer",flexShrink:0,minWidth:`${h.minWidth}px`,maxWidth:`${h.maxWidth}px`},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="#f3f4f6",w.currentTarget.style.transform="scale(1.05)"},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="scale(1)"},children:[b.isAvatar?e.jsx("img",{src:b.avatarUrl,alt:b.name,style:{width:`${h.icon}px`,height:`${h.icon}px`,borderRadius:"50%",objectFit:"cover"}}):e.jsx("img",{src:b.logo,alt:b.name,style:{width:`${h.icon}px`,height:`${h.icon}px`,borderRadius:"8px",objectFit:"contain"}}),e.jsx("span",{style:{fontSize:`${h.fontSize}px`,fontWeight:500,marginTop:"2px",textAlign:"center",lineHeight:"1.2",whiteSpace:"normal",wordWrap:"break-word",color:d,maxWidth:`${h.maxWidth}px`,display:"block"},children:b.name})]},b.key))}),e.jsx("style",{children:`
1124
+ ${de}`),ge},clear:()=>{B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe),ke(null),Bt(null),E?.(null)}}),()=>{F&&(F.current=null)}));const Mt=ge=>{ge.key==="Enter"&&(ge.metaKey||ge.ctrlKey)&&(ge.preventDefault(),Dt()),ge.key==="Escape"&&r&&r()},$t=()=>{ue(null),ae(0)},Zt=()=>{fe&&URL.revokeObjectURL(fe),ve(null),ke(null)},Et=k.useCallback(()=>{if(!q.trim())return null;const ge=q.split(/(```[\s\S]*?```)/g);let Te=0;return e.jsx("div",{className:"space-y-2",children:ge.map((Pe,ze)=>{if(Pe.startsWith("```")&&Pe.endsWith("```")){const xt=Pe.slice(3,-3).replace(/^\w*\n?/,""),Je=Te++;return e.jsxs("div",{className:"relative group rounded-lg overflow-hidden",children:[e.jsx("pre",{className:"bg-gray-950 text-green-400 p-3 rounded-lg text-xs overflow-x-auto font-mono",children:e.jsx("code",{children:xt.trim()||" "})}),e.jsx("button",{type:"button",onClick:()=>Z(xt.trim(),Je),className:"absolute top-2 right-2 p-1.5 rounded-md bg-gray-800 hover:bg-gray-700 text-gray-400 hover:text-white transition-colors opacity-0 group-hover:opacity-100",title:"Copy code",children:Se===Je?e.jsx(O.Check,{className:"h-3.5 w-3.5 text-green-400"}):e.jsx(O.Copy,{className:"h-3.5 w-3.5"})})]},ze)}const Ve=Pe.split(/(`[^`]+`)/g);return e.jsx("span",{children:Ve.map((xt,Je)=>{if(xt.startsWith("`")&&xt.endsWith("`")){const cr=xt.slice(1,-1);return e.jsx("code",{className:"bg-gray-800 text-amber-400 px-1.5 py-0.5 rounded text-xs font-mono cursor-pointer hover:bg-gray-700 transition-colors",title:"Click to copy",onClick:()=>navigator.clipboard.writeText(cr),children:cr},Je)}return xt.trim()?e.jsx("span",{className:"text-gray-300 text-sm",children:xt},Je):null})},ze)})})},[q,Se,Z]),ft="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-white transition-colors disabled:opacity-50";return e.jsxs("div",{className:`p-4 md:p-6 space-y-3 rounded-xl border transition-colors ${jt?"border-blue-500 bg-blue-900/10":""}`,style:{backgroundColor:jt?void 0:G||"#111827",borderColor:jt?void 0:ne||"#374151"},onDragEnter:Ze,onDragLeave:Ue,onDragOver:He,onDrop:bt,children:[T&&e.jsx("h3",{className:"text-white font-semibold text-base",children:T}),!Y&&e.jsxs("div",{className:"flex items-center justify-start space-x-3 text-left",children:[e.jsx("div",{className:"flex-shrink-0",children:n?e.jsx("img",{src:`https://images.hive.blog/u/${n}/avatar`,alt:n,className:"w-10 h-10 rounded-full object-cover border-2 border-gray-600",onError:ge=>{ge.target.src=`https://ui-avatars.com/api/?name=${n}&background=random`}}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center",children:e.jsx(O.User,{className:"w-6 h-6 text-gray-400"})})}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("div",{className:"text-sm text-white font-medium",children:n?`@${n}`:"Anonymous"}),a&&e.jsxs("div",{className:"text-xs text-gray-400",children:["Replying to @",a]})]})]}),Ce&&q.trim()&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800/50 overflow-hidden max-h-[300px] flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 text-xs uppercase tracking-wide text-gray-400 bg-gray-800 border-b border-gray-700 flex items-center justify-between shrink-0",children:[e.jsx("span",{children:"Preview"}),(q.includes("```")||/`[^`]+`/.test(q))&&e.jsx("span",{className:"text-[10px] text-gray-500 normal-case",children:"Hover code blocks to copy"})]}),e.jsx("div",{className:"p-3 overflow-y-auto",style:{scrollbarWidth:"thin"},children:kt?e.jsx("div",{className:"rendered-body text-white text-sm overflow-x-auto prose prose-invert prose-sm max-w-none",dangerouslySetInnerHTML:{__html:kt(q)}}):Et()})]}),Fe&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[e.jsx("div",{className:"relative",style:{height:"60px",overflow:"hidden"},children:e.jsx("iframe",{src:Fe,title:"Audio preview",className:"w-full border-0 absolute top-0 left-0",style:{height:"200px"},allow:"autoplay; encrypted-media",loading:"lazy"})}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsxs("span",{className:"flex-1 truncate text-xs text-gray-400",children:["Audio attached",Re>0?` (${Math.floor(Re/60)}:${String(Re%60).padStart(2,"0")})`:""]}),e.jsx("button",{type:"button",onClick:$t,className:"shrink-0 rounded p-1.5 text-gray-400 hover:text-red-400 hover:bg-gray-700 transition-colors",title:"Remove audio",children:e.jsx(O.X,{className:"h-4 w-4"})})]})]}),de&&e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:[fe?e.jsx("video",{src:fe,controls:!0,playsInline:!0,preload:"metadata",className:"w-full",style:{maxHeight:"200px"}}):e.jsx("div",{className:"h-20 flex items-center justify-center text-gray-400 text-xs",children:"Video attached"}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-gray-700 px-3 py-1.5",children:[e.jsx("span",{className:"flex-1 truncate text-xs text-gray-400",children:"Video attached"}),e.jsx("button",{type:"button",onClick:Zt,className:"shrink-0 rounded p-0.5 text-gray-400 hover:text-red-400",title:"Remove video",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]})]}),Tt&&e.jsx("div",{className:"rounded-lg border border-gray-700 bg-gray-800 overflow-hidden",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(O.BarChart3,{className:"h-3.5 w-3.5 shrink-0 text-blue-400"}),e.jsx("span",{className:"flex-1 truncate text-xs font-medium text-white",children:Tt.question}),e.jsx("button",{type:"button",onClick:()=>at(!0),className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-white",title:"Edit poll",children:e.jsx(O.Code,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{Bt(null),E?.(null)},className:"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-700 hover:text-red-400",title:"Remove poll",children:e.jsx(O.X,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Tt.choices.map((ge,Te)=>e.jsx("span",{className:"rounded-full bg-gray-700 px-2 py-0.5 text-xs text-gray-300",children:ge},Te))}),e.jsxs("div",{className:"mt-1.5 text-[10px] text-gray-500",children:["Ends ",new Date(Tt.end_time*1e3).toLocaleDateString()," · Max ",Tt.max_choices_voted," choice",Tt.max_choices_voted>1?"s":""]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-gray-700 pb-2",children:[!m&&e.jsx("button",{type:"button",onClick:()=>Me(ge=>!ge),className:`${ft} ${Ce?"bg-gray-700 text-blue-400":""}`,title:Ce?"Hide preview":"Show preview",disabled:te,children:Ce?e.jsx(O.EyeOff,{className:"h-4 w-4"}):e.jsx(O.Eye,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!h&&e.jsx("button",{type:"button",onClick:()=>Vt("**","**"),className:ft,title:"Bold",disabled:te,children:e.jsx(O.Bold,{className:"h-4 w-4"})}),!u&&e.jsx("button",{type:"button",onClick:()=>Vt("*","*"),className:ft,title:"Italic",disabled:te,children:e.jsx(O.Italic,{className:"h-4 w-4"})}),!p&&e.jsx("button",{type:"button",onClick:()=>Vt("[","](url)"),className:ft,title:"Link",disabled:te,children:e.jsx(O.Link,{className:"h-4 w-4"})}),!N&&e.jsx("button",{type:"button",onClick:P,className:ft,title:"Code block",disabled:te,children:e.jsx(O.Code,{className:"h-4 w-4"})}),!j&&e.jsx("button",{type:"button",onClick:I,className:ft,title:a?`Mention @${a}`:"Mention",disabled:te,children:e.jsx(O.AtSign,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),!b&&o&&e.jsx(e0,{onImageUploaded:ge=>S(`![Image](${ge})`),ecencyToken:o,disabled:te}),!w&&c&&e.jsx(t0,{onAudioUploaded:(ge,Te)=>{ue(ge),ae(Te)},username:n,threeSpeakApiKey:c,disabled:pe||!!Fe}),!x&&c&&e.jsx(r0,{onVideoUploaded:(ge,Te,Pe,ze)=>{ve(ge),ze&&ke(URL.createObjectURL(ze))},username:n,ecencyToken:o,threeSpeakApiKey:c,disabled:pe||!!de}),!g&&e.jsx("button",{type:"button",onClick:()=>le(!0),className:ft,title:"Emoji",disabled:te,children:e.jsx(O.Smile,{className:"h-4 w-4"})}),!v&&d&&e.jsx("button",{type:"button",onClick:()=>Ie(!0),className:`${ft} text-xs font-bold px-2`,title:"GIF",disabled:te,children:"GIF"}),!y&&f&&Ge.length>0&&e.jsx("button",{type:"button",onClick:()=>Ne(!0),className:ft,title:"Insert template",disabled:te,children:e.jsx(O.FileText,{className:"h-4 w-4"})}),!_&&e.jsx("button",{type:"button",onClick:()=>at(!0),className:`${ft} ${Tt?"text-blue-400":""}`,title:Tt?"Edit poll":"Create poll",disabled:te,children:e.jsx(O.BarChart3,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative",children:[jt&&e.jsx("div",{className:"absolute inset-0 z-10 bg-blue-900/30 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-blue-300 font-medium text-sm",children:"Drop image to upload"})}),St&&e.jsx("div",{className:"absolute inset-0 z-10 bg-gray-900/80 rounded-lg flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-400 border-t-transparent rounded-full animate-spin"}),"Uploading image..."]})}),e.jsx("textarea",{ref:_t,value:q,onChange:ge=>B(ge.target.value),onKeyDown:Mt,onPaste:Oe,placeholder:o?`${s}
1125
+ (Paste or drag & drop images here)`:s,disabled:te,rows:4,className:"w-full min-h-[100px] max-h-[300px] p-3 border border-gray-700 rounded-lg resize-y focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-gray-800 text-white placeholder-gray-500 transition-colors duration-200 disabled:opacity-50 text-sm font-mono",onInput:ge=>{const Te=ge.target;Te.style.height="auto",Te.style.height=Te.scrollHeight+"px"}})]}),!H&&e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"text-xs text-gray-500",children:[navigator.platform?.includes("Mac")?"Cmd":"Ctrl","+Enter to post",o&&e.jsx("span",{className:"ml-2",children:"| Paste/drop images"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[A&&r&&e.jsx("button",{onClick:r,disabled:te,className:"px-4 py-2 text-gray-400 hover:text-white transition-colors disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Dt,disabled:te||!q.trim(),className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white rounded-lg font-medium transition-all disabled:opacity-50 flex items-center space-x-2",children:pe?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),e.jsx("span",{children:"Posting..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(O.Send,{className:"w-4 h-4"}),e.jsx("span",{children:C})]})})]})]}),e.jsx(a0,{isOpen:_e,onClose:()=>Ie(!1),onSelectGif:ge=>{S(`![GIF](${ge})`),Ie(!1)},giphyApiKey:d}),e.jsx(s0,{isOpen:K,onClose:()=>le(!1),onSelectEmoji:ge=>{S(ge),le(!1)}}),e.jsx(n0,{isOpen:oe,onClose:()=>Ne(!1),onSelectTemplate:S,templates:Ge,authorFromUrl:a}),e.jsx(i0,{isOpen:Ke,onClose:()=>at(!1),onSave:ge=>{Bt(ge),E?.(ge)},initialData:Tt})]})},xs=gs,Ip=({parentAuthor:t,parentPermlink:r,onClose:n,onCommentSubmitted:s,currentUser:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})=>{const[l,h]=k.useState(!1),u=async p=>{if(!(!p.trim()||l)){h(!0);try{await s(t,r,p),n()}catch(b){console.error("Failed to submit reply:",b)}finally{h(!1)}}};return k.useEffect(()=>{const p=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[n]),e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-900 rounded-lg",children:e.jsx(O.Send,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white",children:"Reply to Comment"}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]})]}),e.jsx("button",{onClick:n,disabled:l,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",children:e.jsx(O.X,{className:"w-6 h-6 text-gray-400"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(xs,{onSubmit:u,onCancel:n,currentUser:a,parentAuthor:t,parentPermlink:r,placeholder:`Reply to @${t}...`,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})}),e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs md:text-sm text-gray-400",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{children:"• Markdown supported"}),e.jsx("span",{children:"• Be respectful"})]}),e.jsx("div",{className:"hidden md:block",children:"Press Esc to close"})]})})]})})},Fp=({isVisible:t,searchQuery:r,onSearchChange:n,onClose:s})=>{const a=k.useRef(null);k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const i=()=>{n(""),s()};return e.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${t?"max-h-20 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"p-4 border-b border-gray-700 bg-gray-900/30",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{ref:a,type:"text",value:r,onChange:o=>n(o.target.value),placeholder:"Search comments and authors...",className:"w-full pl-10 pr-10 py-2 bg-gray-800 border border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-white placeholder-gray-400 transition-colors duration-200"}),r&&e.jsx("button",{onClick:()=>n(""),className:"absolute right-8 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400"})}),e.jsx("button",{onClick:i,className:"absolute right-3 top-1/2 transform -translate-y-1/2 p-1 rounded-full hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-4 h-4 text-gray-400"})})]})})})},Oo=({author:t,permlink:r,onClose:n,currentUser:s,token:a,onClickCommentUpvote:i,onClickCommentReply:o,onClickUpvoteButton:c,onSubmitComment:d,ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})=>{const[b,w]=k.useState([]),[x,g]=k.useState([]),[v,N]=k.useState(!0),[j,y]=k.useState(null),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(""),[D,L]=k.useState(!1),[z,U]=k.useState(!1),H=k.useCallback(async(xe=!1)=>{xe?U(!0):N(!0),y(null);try{const V=await Nt.getCommentsList(t,r,s??"");w(V),g(V)}catch(V){y(V instanceof Error?V.message:"Failed to load comments")}finally{N(!1),U(!1)}},[t,r]);k.useEffect(()=>{H()},[H]),k.useEffect(()=>{if(!C.trim())g(b);else{const xe=b.filter(V=>V.body?.toLowerCase().includes(C.toLowerCase())||V.author.toLowerCase().includes(C.toLowerCase()));g(xe)}},[C,b]);const F=(xe,V)=>{_({author:xe,permlink:V})},Y=xe=>{xe.target===xe.currentTarget&&n()},G=async(xe,V,q)=>{if(d){try{await Promise.resolve(d(xe,V,q)),L(!1),U(!0),setTimeout(async()=>{await H(!0),U(!1)},3e3)}catch(B){const pe=B instanceof Error?B.message:"Failed to post comment";alert(pe)}return}if(!a){alert("Please login to comment");return}try{await Nt.handleComment({author:xe,permlink:V,body:q,authToken:a}),L(!1),U(!0),setTimeout(async()=>{await H(!0),U(!1)},3e3)}catch(B){const pe=B instanceof Error?B.message:"Failed to post comment";alert(pe)}},ne=k.useMemo(()=>{if(!s?.trim())return x;const xe=s.toLowerCase();return[...x].sort((V,q)=>{const B=V.author?.toLowerCase()===xe,pe=q.author?.toLowerCase()===xe;return B&&!pe?-1:!B&&pe?1:0})},[x,s]),ie=ne.filter(xe=>xe.parent_author===t&&xe.parent_permlink===r);return v?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4 h-screen",children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl h-[90vh] flex flex-col",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.Loader2,{className:"w-12 h-12 animate-spin text-blue-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-300",children:"Loading comments..."})]})})})}):j?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:Y,children:e.jsx("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(O.AlertCircle,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Failed to load comments"}),e.jsx("p",{className:"text-gray-300 mb-6",children:j}),e.jsx("button",{onClick:()=>H(),className:"px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors duration-200",children:"Try Again"})]})})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-40 p-4 h-screen",onClick:Y,children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-2xl w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center p-4 md:p-6 border-b border-gray-700 bg-gray-900/50",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("h2",{className:"text-lg md:text-xl font-bold text-white",children:["Comments (",b.length,")"]}),z&&e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin text-blue-500"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>H(!0),disabled:z,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200 disabled:opacity-50",title:"Refresh comments",children:e.jsx(O.RefreshCw,{className:`w-5 h-5 text-gray-400 ${z?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>A(!E),className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",title:"Search comments",children:e.jsx(O.Search,{className:"w-5 h-5 text-gray-400"})}),e.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-gray-700 transition-colors duration-200",children:e.jsx(O.X,{className:"w-6 h-6 text-gray-400"})})]})]}),e.jsx(Fp,{isVisible:E,searchQuery:C,onSearchChange:T,onClose:()=>A(!1)}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[D&&e.jsx("div",{className:"border-b border-gray-700",children:e.jsx(xs,{onSubmit:xe=>G(t,r,xe),onCancel:()=>L(!1),currentUser:s,placeholder:"Add a comment...",ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})}),ie.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8 text-center",children:[e.jsx(O.MessageCirclePlus,{className:"w-16 h-16 text-gray-600 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:C?"No comments found":"No comments yet"}),e.jsx("p",{className:"text-gray-400 mb-6",children:C?"Try adjusting your search terms":"Be the first to share your thoughts!"}),!C&&s&&e.jsx("button",{onClick:()=>L(!0),className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-colors duration-200",children:"Add Comment"})]}):e.jsx("div",{className:"divide-y divide-gray-700",children:ie.map(xe=>e.jsx(Po,{comment:xe,allComments:ne,onReply:F,currentUser:s,token:a,searchQuery:C,depth:0,onVotedRefresh:()=>H(!0),onClickCommentUpvote:i,onClickCommentReply:o,onClickUpvoteButton:c},xe.permlink))})]}),!D&&s&&ie.length>0&&e.jsx("div",{className:"p-4 md:p-6 border-t border-gray-700 bg-gray-900/50",children:e.jsxs("button",{onClick:()=>L(!0),className:"w-full md:w-auto px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-medium transition-all duration-200 transform hover:scale-[1.02] flex items-center justify-center space-x-2",children:[e.jsx(O.MessageCirclePlus,{className:"w-5 h-5"}),e.jsx("span",{children:"Add Comment"})]})})]})}),m&&e.jsx(Ip,{parentAuthor:m.author,parentPermlink:m.permlink,onClose:()=>_(null),onCommentSubmitted:G,currentUser:s,ecencyToken:f,threeSpeakApiKey:l,giphyApiKey:h,templateToken:u,templateApiBaseUrl:p})]})};function Bp(t){const r=typeof t=="string"?new Date(t):t,n=Math.floor((Date.now()-r.getTime())/1e3),s={year:31536e3,month:2628e3,day:86400,hour:3600,minute:60};for(const[a,i]of Object.entries(s)){const o=Math.floor(n/i);if(o>1)return`${o} ${a}s ago`;if(o===1)return`${o} ${a} ago`}return"just now"}const Lo=({author:t,permlink:r,onClose:n,currentUser:s,token:a,onClickUpvoteButton:i})=>{const[o,c]=k.useState([]),[d,f]=k.useState(!0),[l,h]=k.useState(!1),u=!!s&&o.some(_=>_.voter===s),[p,b]=k.useState(!1),[w,x]=k.useState(""),[g,v]=k.useState(!1),N=_=>{x(_),b(!0),setTimeout(()=>b(!1),2500)},j=async()=>{f(!0);const _=await Nt.getActiveVotes(t,r);_.sort((E,A)=>!E.time||!A.time?0:new Date(A.time).getTime()-new Date(E.time).getTime()),c(_),f(!1)};k.useEffect(()=>{j()},[t,r]);const y=_=>{_.target===_.currentTarget&&n()},m=async _=>{if(!a||!s){alert("Please login to upvote");return}try{const E=Math.round(_*100);await Nt.handleUpvote({author:t,permlink:r,weight:E,authToken:a}),h(!1),v(!0),setTimeout(async()=>{await j(),v(!1),N("Vote submitted successfully ✅"),n()},3e3)}catch(E){const A=E instanceof Error?E.message:"Failed to upvote";alert(A)}};return e.jsxs("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 px-4 h-screen",onClick:y,children:[e.jsxs("div",{className:"relative bg-gray-800 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 md:p-6 border-b border-gray-700 bg-gray-900/50 flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-bold text-white flex items-center space-x-2",children:[e.jsxs("span",{children:["Voters (",o.length,")"]}),g&&e.jsx("span",{className:"inline-flex items-center ml-2",children:e.jsx("span",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})})]}),!l&&e.jsx("button",{onClick:()=>{if(i){i(s,a);return}if(!s||!a){N("Please login to upvote");return}u?N("You have already upvoted this post"):h(!0)},"aria-label":"Open Vote Slider",className:"p-1 hover:bg-gray-700 rounded",type:"button",children:e.jsx(O.ThumbsUp,{className:`w-5 h-5 ${u?"text-blue-400 fill-current":"text-gray-300"}`})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d?e.jsx("div",{className:"flex justify-center items-center h-full p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500"})}):l&&!u?e.jsx(qn,{author:t,permlink:r,onUpvote:m,onCancel:()=>h(!1)}):e.jsx("ul",{children:o.map(_=>e.jsxs("li",{className:"flex items-center p-4 border-b border-gray-700",children:[e.jsx("img",{src:`https://images.hive.blog/u/${_.voter}/avatar`,alt:_.voter,className:"w-10 h-10 rounded-full mr-4",onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${_.voter}&background=random`}}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:_.voter}),e.jsxs("div",{className:"text-sm text-gray-400",children:[((_.percent||0)/100).toFixed(0),"%",_.time&&` · ${Bp(_.time+"Z")}`]})]})]},_.voter))})})]}),p&&e.jsx("div",{className:"fixed bottom-4 right-4 w-[280px] z-50",children:e.jsx("div",{className:"bg-gray-800 text-white rounded px-3 py-2 shadow-lg text-sm",children:w})})]})},l0=({isOpen:t,onClose:r,title:n,children:s,maxWidth:a="max-w-2xl"})=>t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:`relative bg-card border border-border rounded-xl shadow-xl w-full mx-4 ${a} max-h-[90vh] overflow-hidden animate-scale-in`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-card-foreground",children:n}),e.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(O.X,{className:"w-5 h-5 text-muted-foreground"})})]}),e.jsx("div",{className:"overflow-y-auto max-h-[calc(90vh-80px)] custom-scrollbar",children:s})]})]}):null,Up=({author:t,permlink:r,content:n,onClose:s})=>e.jsx(l0,{isOpen:!0,onClose:s,title:"Video Description",maxWidth:"max-w-2xl",children:e.jsxs("div",{className:"p-6",children:[n?e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-card-foreground font-sans leading-relaxed",children:n})})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No description available"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video doesn't have a description yet."})]}),e.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["By @",t]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["/",r]})]})})]})}),Vp=({username:t,permlink:r,onAuthorClick:n,onVideoClick:s,onTagClick:a,onBack:i,onCommentsModal:o,onUpvotesModal:c,onDescriptionModal:d,onVideoInfo:f,onShare:l,onBookmark:h}={})=>{const u=t,p=r,[b,w]=k.useState(null),[x,g]=k.useState(!0),[v,N]=k.useState(null),[j,y]=k.useState(!1),[m,_]=k.useState(null),[E,A]=k.useState(!1),[C,T]=k.useState(!1),[D,L]=k.useState(!1),[z,U]=k.useState(!1),H=k.useRef(null),F=k.useRef(null),Y=k.useRef(null);k.useEffect(()=>{(async()=>{if(!(!u||!p))try{g(!0),N(null);const B=await Nt.getVideoDetails(u,p);w(B),y(!1),_(null)}catch(B){N(B instanceof Error?B.message:"Failed to load video")}finally{g(!1)}})()},[u,p]);const G=q=>q?q.startsWith("ipfs://")?`https://ipfs-3speak.b-cdn.net/ipfs/${q.replace("ipfs://","").split("/")[0]}/manifest.m3u8`:q:"";k.useEffect(()=>((async()=>{const B=b?.video_v2;if(!j||!B||!H.current)return;const pe=H.current,ee=G(B);F.current&&(F.current.destroy(),F.current=null),pe.src="",pe.load();try{let te=!1;const _e=()=>{te||(te=!0,pe.play().then(()=>_(null)).catch(Ce=>_(`Playback failed: ${Ce.message}`)))};if(ja.isSupported()){const Ce=new ja({debug:!1,enableWorker:!1,lowLatencyMode:!1,backBufferLength:90,maxLoadingDelay:4,maxBufferLength:30,maxMaxBufferLength:600,startLevel:-1});F.current=Ce,Ce.on(ja.Events.MANIFEST_PARSED,()=>{}),Ce.on(ja.Events.ERROR,(Me,Fe)=>{if(Fe.fatal)switch(Fe.type){case ja.ErrorTypes.NETWORK_ERROR:_("Network error, retrying..."),setTimeout(()=>Ce.startLoad(),1e3);break;case ja.ErrorTypes.MEDIA_ERROR:_("Media error, retrying..."),setTimeout(()=>Ce.recoverMediaError(),1e3);break;default:_(`Fatal error: ${Fe.details}`),Ce.destroy(),F.current=null;break}}),Ce.attachMedia(pe),Ce.loadSource(ee)}else if(pe.canPlayType("application/vnd.apple.mpegurl"))pe.src=ee;else{const Ce=ee.replace("/manifest.m3u8","/480p/index.m3u8");pe.src=Ce}const Ie=()=>A(!0),K=()=>{A(!1),_e()},le=Ce=>{const Me=Ce.target;_(`Video error: ${Me.error?.message||"Unknown error"}`),A(!1)},oe=()=>A(!1);pe.addEventListener("loadstart",Ie),pe.addEventListener("canplay",K),pe.addEventListener("error",le),pe.addEventListener("loadeddata",oe);const Ne=async()=>{const Ce=!!document.fullscreenElement;try{Ce?"orientation"in screen&&await(screen.orientation?.lock?.("landscape")??Promise.resolve()):"orientation"in screen&&screen.orientation?.unlock?.()}catch{}};return document.addEventListener("fullscreenchange",Ne),Y.current=()=>{document.removeEventListener("fullscreenchange",Ne)},()=>{pe.removeEventListener("loadstart",Ie),pe.removeEventListener("canplay",K),pe.removeEventListener("error",le),pe.removeEventListener("loadeddata",oe),Y.current&&Y.current()}}catch(te){_(`Setup error: ${te instanceof Error?te.message:"Unknown"}`)}})(),()=>{F.current&&(F.current.destroy(),F.current=null)}),[j,b?.video_v2]);const ne=()=>{if(!b?.video_v2){_("No video source available");return}y(!0),_(null),A(!0)},ie=q=>{s&&s(q)},xe=q=>{n&&n(q)},V=q=>{if(!q)return"00:00";const B=Math.floor(q),pe=Math.floor(B/3600),ee=Math.floor(B%3600/60),te=B%60,_e=Ie=>Ie.toString().padStart(2,"0");return B<60?`00:${_e(te)}`:pe===0?`${_e(ee)}:${_e(te)}`:`${_e(pe)}:${_e(ee)}:${_e(te)}`};return x?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsx("div",{className:"h-8 w-24 bg-muted rounded-full animate-pulse"})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"animate-pulse space-y-6",children:[e.jsx("div",{className:"aspect-video bg-muted rounded-xl"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]})]})})]}):v||!b?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md mx-auto px-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-card-foreground mb-2",children:"Failed to Load Video"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:v||"Video not found"}),e.jsxs("button",{onClick:()=>{i&&i()},className:"inline-flex items-center gap-2 px-4 py-2 bg-card border border-border text-card-foreground rounded-lg hover:bg-card-hover transition-colors",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4"}),"Go Back"]})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"sticky top-0 z-50 w-full bg-background/95 backdrop-blur-sm border-b border-border",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("button",{onClick:()=>{i&&i()},className:"inline-flex items-center gap-2 text-muted-foreground hover:text-card-foreground transition-colors",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4"}),"Back"]})})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx("div",{className:"w-full aspect-video bg-black rounded-xl overflow-hidden relative shadow-card",children:j?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("video",{ref:H,controls:!0,poster:xa(b.thumbnail),className:"w-full h-full object-contain bg-black",onDoubleClick:async q=>{const B=q.currentTarget;try{document.fullscreenElement?await document.exitFullscreen():await B.requestFullscreen()}catch{}}}),E&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}),m&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("p",{className:"mb-4",children:m}),e.jsx("button",{onClick:()=>{y(!1),_(null)},className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover transition-colors",children:"Try Again"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:xa(b.thumbnail)||`https://images.hive.blog/u/${b.owner}/avatar`,alt:b.title,className:"w-full h-full object-cover",onError:q=>{q.target.src=`https://images.hive.blog/u/${b.owner}/avatar`}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-overlay opacity-30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("button",{onClick:ne,className:"bg-primary hover:bg-primary-hover rounded-full p-6 transform hover:scale-110 transition-all duration-300 shadow-lg",children:e.jsx(O.Play,{className:"w-8 h-8 text-primary-foreground ml-1",fill:"currentColor"})})}),b.duration&&e.jsxs("div",{className:"absolute bottom-4 right-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),V(b.duration)]}),b.views&&e.jsxs("div",{className:"absolute bottom-4 left-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(O.Eye,{className:"w-3 h-3"}),b.views.toLocaleString()," views"]})]})}),e.jsx(ud,{title:b.title||"",author:b.owner||"",permlink:b.permlink||"",createdAt:b.created,description:b.description||"",video:{title:b.title||"",author:b.owner||"",permlink:b.permlink||"",created:b.created||new Date,category:b.category||"",numOfUpvotes:void 0,numOfComments:void 0,hiveValue:void 0,duration:b.duration,thumbnail:b.thumbnail,views:b.views},onTapComment:()=>{o?o(u,p):T(!0)},onTapUpvote:()=>{c?c(u,p):L(!0)},onTapInfo:()=>{d?d(u,p,b.description||""):U(!0)},onTapAuthor:()=>{n&&n(b.owner)},onTapShare:()=>{l&&l(u,p)},onTapBookmark:()=>{h&&h(u,p)}}),b.tags&&e.jsx("div",{className:"flex flex-wrap gap-2",children:b.tags.split(",").map((q,B)=>e.jsxs("span",{className:"bg-primary/10 text-primary px-3 py-1 rounded-full text-sm font-medium hover:bg-primary/20 transition-colors cursor-pointer",onClick:()=>{a&&a(q.trim())},children:["#",q.trim()]},B))})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 sticky top-24",children:[e.jsx("h3",{className:"font-semibold text-card-foreground mb-4 text-lg",children:"Related Videos"}),e.jsx("div",{className:"space-y-4",children:e.jsx(En,{feedType:er.RELATED,username:b.owner,onVideoClick:ie,onAuthorClick:xe})})]})]})}),C&&u&&p&&e.jsx(Oo,{author:u,permlink:p,onClose:()=>T(!1)}),D&&u&&p&&e.jsx(Lo,{author:u,permlink:p,onClose:()=>L(!1)}),z&&u&&p&&e.jsx(Up,{author:u,permlink:p,content:b.description||"",onClose:()=>U(!1)})]})};var u0={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Wc=k.createContext&&k.createContext(u0),qp=["attr","size","title"];function Hp(t,r){if(t==null)return{};var n,s,a=zp(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],r.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function zp(t,r){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(r.indexOf(s)!==-1)continue;n[s]=t[s]}return n}function jn(){return jn=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},jn.apply(null,arguments)}function Gc(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function _n(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Gc(Object(n),!0).forEach(function(s){Wp(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gc(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function Wp(t,r,n){return(r=Gp(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function Gp(t){var r=Jp(t,"string");return typeof r=="symbol"?r:r+""}function Jp(t,r){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,r);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function c0(t){return t&&t.map((r,n)=>k.createElement(r.tag,_n({key:n},r.attr),c0(r.child)))}function Gt(t){return r=>k.createElement(Yp,jn({attr:_n({},t.attr)},r),c0(t.child))}function Yp(t){var r=n=>{var{attr:s,size:a,title:i}=t,o=Hp(t,qp),c=a||n.size||"1em",d;return n.className&&(d=n.className),t.className&&(d=(d?d+" ":"")+t.className),k.createElement("svg",jn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,s,o,{className:d,style:_n(_n({color:t.color||n.color},n.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),i&&k.createElement("title",null,i),t.children)};return Wc!==void 0?k.createElement(Wc.Consumer,null,n=>r(n)):r(u0)}function Zp(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"},child:[]}]})(t)}function Xp(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"},child:[]}]})(t)}function Kp(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"},child:[]}]})(t)}function Qp(t){return Gt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M560 224h-29.5c-8.8-20-21.6-37.7-37.4-52.5L512 96h-32c-29.4 0-55.4 13.5-73 34.3-7.6-1.1-15.1-2.3-23-2.3H256c-77.4 0-141.9 55-156.8 128H56c-14.8 0-26.5-13.5-23.5-28.8C34.7 215.8 45.4 208 57 208h1c3.3 0 6-2.7 6-6v-20c0-3.3-2.7-6-6-6-28.5 0-53.9 20.4-57.5 48.6C-3.9 258.8 22.7 288 56 288h40c0 52.2 25.4 98.1 64 127.3V496c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-48h128v48c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-80.7c11.8-8.9 22.3-19.4 31.3-31.3H560c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16zm-128 64c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zM256 96h128c5.4 0 10.7.4 15.9.8 0-.3.1-.5.1-.8 0-53-43-96-96-96s-96 43-96 96c0 2.1.5 4.1.6 6.2 15.2-3.9 31-6.2 47.4-6.2z"},child:[]}]})(t)}function eg(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M608 64H32C14.33 64 0 78.33 0 96v320c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V96c0-17.67-14.33-32-32-32zM48 400v-64c35.35 0 64 28.65 64 64H48zm0-224v-64h64c0 35.35-28.65 64-64 64zm272 176c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 48h-64c0-35.35 28.65-64 64-64v64zm0-224c-35.35 0-64-28.65-64-64h64v64z"},child:[]}]})(t)}function tg(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M621.16 54.46C582.37 38.19 543.55 32 504.75 32c-123.17-.01-246.33 62.34-369.5 62.34-30.89 0-61.76-3.92-92.65-13.72-3.47-1.1-6.95-1.62-10.35-1.62C15.04 79 0 92.32 0 110.81v317.26c0 12.63 7.23 24.6 18.84 29.46C57.63 473.81 96.45 480 135.25 480c123.17 0 246.34-62.35 369.51-62.35 30.89 0 61.76 3.92 92.65 13.72 3.47 1.1 6.95 1.62 10.35 1.62 17.21 0 32.25-13.32 32.25-31.81V83.93c-.01-12.64-7.24-24.6-18.85-29.47zM48 132.22c20.12 5.04 41.12 7.57 62.72 8.93C104.84 170.54 79 192.69 48 192.69v-60.47zm0 285v-47.78c34.37 0 62.18 27.27 63.71 61.4-22.53-1.81-43.59-6.31-63.71-13.62zM320 352c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 27.78c-17.52-4.39-35.71-6.85-54.32-8.44 5.87-26.08 27.5-45.88 54.32-49.28v57.72zm0-236.11c-30.89-3.91-54.86-29.7-55.81-61.55 19.54 2.17 38.09 6.23 55.81 12.66v48.89z"},child:[]}]})(t)}function eo(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M624 416H381.54c-.74 19.81-14.71 32-32.74 32H288c-18.69 0-33.02-17.47-32.77-32H16c-8.8 0-16 7.2-16 16v16c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-16c0-8.8-7.2-16-16-16zM576 48c0-26.4-21.6-48-48-48H112C85.6 0 64 21.6 64 48v336h512V48zm-64 272H128V64h384v256z"},child:[]}]})(t)}function rg(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M473.7 73.8l-2.4-2.5c-46-47-118-51.7-169.6-14.8L336 159.9l-96 64 48 128-144-144 96-64-28.6-86.5C159.7 19.6 87 24 40.7 71.4l-2.4 2.4C-10.4 123.6-12.5 202.9 31 256l212.1 218.6c7.1 7.3 18.6 7.3 25.7 0L481 255.9c43.5-53 41.4-132.3-7.3-182.1z"},child:[]}]})(t)}function Jc(t){return Gt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M275.3 250.5c7 7.4 18.4 7.4 25.5 0l108.9-114.2c31.6-33.2 29.8-88.2-5.6-118.8-30.8-26.7-76.7-21.9-104.9 7.7L288 36.9l-11.1-11.6C248.7-4.4 202.8-9.2 172 17.5c-35.3 30.6-37.2 85.6-5.6 118.8l108.9 114.2zm290 77.6c-11.8-10.7-30.2-10-42.6 0L430.3 402c-11.3 9.1-25.4 14-40 14H272c-8.8 0-16-7.2-16-16s7.2-16 16-16h78.3c15.9 0 30.7-10.9 33.3-26.6 3.3-20-12.1-37.4-31.6-37.4H192c-27 0-53.1 9.3-74.1 26.3L71.4 384H16c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16h356.8c14.5 0 28.6-4.9 40-14L564 377c15.2-12.1 16.4-35.3 1.3-48.9z"},child:[]}]})(t)}function ag(t){return Gt({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(t)}function go(t){return Gt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(t)}function sg(t){return Gt({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M160 224v64h320v-64c0-35.3 28.7-64 64-64h32c0-53-43-96-96-96H160c-53 0-96 43-96 96h32c35.3 0 64 28.7 64 64zm416-32h-32c-17.7 0-32 14.3-32 32v96H128v-96c0-17.7-14.3-32-32-32H64c-35.3 0-64 28.7-64 64 0 23.6 13 44 32 55.1V432c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-16h384v16c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16V311.1c19-11.1 32-31.5 32-55.1 0-35.3-28.7-64-64-64z"},child:[]}]})(t)}function ng(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z"},child:[]}]})(t)}function ig(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(t)}function og(t){return Gt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16zM464 96H345.94c-21.38 0-32.09 25.85-16.97 40.97l32.4 32.4L288 242.75l-73.37-73.37c-12.5-12.5-32.76-12.5-45.25 0l-68.69 68.69c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L192 237.25l73.37 73.37c12.5 12.5 32.76 12.5 45.25 0l96-96 32.4 32.4c15.12 15.12 40.97 4.41 40.97-16.97V112c.01-8.84-7.15-16-15.99-16z"},child:[]}]})(t)}function lg(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 480h-20V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v456H12c-6.627 0-12 5.373-12 12v20h448v-20c0-6.627-5.373-12-12-12zM128 76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76zm0 96c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40zm52 148h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12zm76 160h-64v-84c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v84zm64-172c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40zm0-96c0 6.627-5.373 12-12 12h-40c-6.627 0-12-5.373-12-12V76c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v40z"},child:[]}]})(t)}function d0(t){return Gt({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"},child:[]}]})(t)}function ug(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(t)}function cg(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function dg(t){return Gt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(t)}const Mo=new M0.Client(["https://api.hive.blog"]),fg=async t=>{try{const r=await Mo.database.getAccounts([t]);if(!r||r.length===0)throw new Error("Account not found");return r[0]}catch(r){return console.error("Error in getWalletDataDetail:",r),{error:r instanceof Error?r.message:"Unknown error"}}},hg=async t=>{try{const r=await Mo.database.getDynamicGlobalProperties(),n=parseFloat(t.split(" ")[0]),s=parseFloat(String(r.total_vesting_shares).split(" ")[0]),a=parseFloat(String(r.total_vesting_fund_hive).split(" ")[0]);return(n*a/s).toFixed(3)}catch(r){return console.error("Error in convertVestingSharesToHiveData:",r),"0"}},mg=async t=>{try{const n=(await Mo.database.call("get_feed_history",[])).current_median_history,s=parseFloat(n.base.split(" ")[0]),a=typeof t=="string"?parseFloat(t):t;return(s*a).toFixed(2)}catch(r){return console.error("Error in convertHivetoUSDData:",r),"0"}},f0=()=>{try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"",r={"Asia/Kolkata":"INR","Asia/Calcutta":"INR","Asia/Chennai":"INR","Asia/Mumbai":"INR","Asia/Karachi":"PKR","Asia/Dhaka":"BDT","Asia/Colombo":"LKR","Asia/Kathmandu":"NPR","Asia/Rangoon":"MMK","Asia/Yangon":"MMK","Asia/Bangkok":"THB","Asia/Ho_Chi_Minh":"VND","Asia/Saigon":"VND","Asia/Jakarta":"IDR","Asia/Kuala_Lumpur":"MYR","Asia/Singapore":"SGD","Asia/Manila":"PHP","Asia/Hong_Kong":"HKD","Asia/Taipei":"TWD","Asia/Shanghai":"CNY","Asia/Chongqing":"CNY","Asia/Beijing":"CNY","Asia/Tokyo":"JPY","Asia/Seoul":"KRW","Asia/Dubai":"AED","Asia/Riyadh":"SAR","Asia/Jerusalem":"ILS","Asia/Tel_Aviv":"ILS","Asia/Phnom_Penh":"KHR","Asia/Vientiane":"LAK","America/New_York":"USD","America/Chicago":"USD","America/Denver":"USD","America/Los_Angeles":"USD","America/Phoenix":"USD","America/Anchorage":"USD","Pacific/Honolulu":"USD","America/Toronto":"CAD","America/Vancouver":"CAD","America/Montreal":"CAD","America/Edmonton":"CAD","America/Sao_Paulo":"BRL","America/Rio_Branco":"BRL","America/Mexico_City":"MXN","America/Cancun":"MXN","America/Argentina/Buenos_Aires":"ARS","America/Bogota":"COP","America/Lima":"PEN","America/Santiago":"CLP","Europe/London":"GBP","Europe/Dublin":"EUR","Europe/Berlin":"EUR","Europe/Paris":"EUR","Europe/Rome":"EUR","Europe/Madrid":"EUR","Europe/Lisbon":"EUR","Europe/Amsterdam":"EUR","Europe/Brussels":"EUR","Europe/Vienna":"EUR","Europe/Helsinki":"EUR","Europe/Athens":"EUR","Europe/Bratislava":"EUR","Europe/Ljubljana":"EUR","Europe/Vilnius":"EUR","Europe/Riga":"EUR","Europe/Tallinn":"EUR","Europe/Malta":"EUR","Europe/Nicosia":"EUR","Europe/Luxembourg":"EUR","Europe/Zagreb":"EUR","Europe/Zurich":"CHF","Europe/Stockholm":"SEK","Europe/Oslo":"NOK","Europe/Copenhagen":"DKK","Europe/Warsaw":"PLN","Europe/Prague":"CZK","Europe/Budapest":"HUF","Europe/Bucharest":"RON","Europe/Moscow":"RUB","Europe/Kiev":"UAH","Europe/Kyiv":"UAH","Europe/Istanbul":"TRY","Africa/Lagos":"NGN","Africa/Johannesburg":"ZAR","Africa/Nairobi":"KES","Africa/Accra":"GHS","Africa/Cairo":"EGP","Australia/Sydney":"AUD","Australia/Melbourne":"AUD","Australia/Brisbane":"AUD","Australia/Perth":"AUD","Pacific/Auckland":"NZD"};if(r[t])return r[t];const n=navigator.language||"en-US",s={US:"USD",GB:"GBP",IN:"INR",JP:"JPY",CN:"CNY",KR:"KRW",AU:"AUD",CA:"CAD",BR:"BRL",MX:"MXN",DE:"EUR",FR:"EUR",IT:"EUR",ES:"EUR",NL:"EUR"},a=n.split("-")[1]?.toUpperCase();return a&&s[a]||"USD"}catch{return"USD"}},pg=async()=>{try{const r=await(await fetch("https://open.er-api.com/v6/latest/USD")).json();return r?.rates?r.rates:{USD:1}}catch{return{USD:1}}},gn=[{code:"USD",name:"US Dollar"},{code:"EUR",name:"Euro"},{code:"GBP",name:"British Pound"},{code:"INR",name:"Indian Rupee"},{code:"JPY",name:"Japanese Yen"},{code:"CNY",name:"Chinese Yuan"},{code:"KRW",name:"South Korean Won"},{code:"AUD",name:"Australian Dollar"},{code:"CAD",name:"Canadian Dollar"},{code:"BRL",name:"Brazilian Real"},{code:"MXN",name:"Mexican Peso"},{code:"CHF",name:"Swiss Franc"},{code:"SGD",name:"Singapore Dollar"},{code:"HKD",name:"Hong Kong Dollar"},{code:"SEK",name:"Swedish Krona"},{code:"NOK",name:"Norwegian Krone"},{code:"DKK",name:"Danish Krone"},{code:"PLN",name:"Polish Zloty"},{code:"TRY",name:"Turkish Lira"},{code:"RUB",name:"Russian Ruble"},{code:"ZAR",name:"South African Rand"},{code:"AED",name:"UAE Dirham"},{code:"SAR",name:"Saudi Riyal"},{code:"THB",name:"Thai Baht"},{code:"IDR",name:"Indonesian Rupiah"},{code:"MYR",name:"Malaysian Ringgit"},{code:"PHP",name:"Philippine Peso"},{code:"VND",name:"Vietnamese Dong"},{code:"PKR",name:"Pakistani Rupee"},{code:"BDT",name:"Bangladeshi Taka"},{code:"NGN",name:"Nigerian Naira"},{code:"EGP",name:"Egyptian Pound"},{code:"KES",name:"Kenyan Shilling"},{code:"NZD",name:"New Zealand Dollar"},{code:"TWD",name:"Taiwan Dollar"},{code:"CZK",name:"Czech Koruna"},{code:"HUF",name:"Hungarian Forint"},{code:"ILS",name:"Israeli Shekel"},{code:"CLP",name:"Chilean Peso"},{code:"ARS",name:"Argentine Peso"},{code:"COP",name:"Colombian Peso"},{code:"LKR",name:"Sri Lankan Rupee"},{code:"NPR",name:"Nepalese Rupee"},{code:"UAH",name:"Ukrainian Hryvnia"},{code:"RON",name:"Romanian Leu"},{code:"GHS",name:"Ghanaian Cedi"}],cn=(t,r)=>{try{const n=navigator.language||"en-US";return new Intl.NumberFormat(n,{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2,currencyDisplay:"narrowSymbol"}).formatToParts(t).map(a=>a.value).join("")}catch{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch{return`$${t.toFixed(2)}`}}},gg=async(t,r=100)=>{const s=await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:0,jsonrpc:"2.0",method:"condenser_api.get_account_history",params:[t,-1,r,"4",null]})})).json();if(s.error)throw new Error(s.error.message||"Failed to fetch transactions");return(s.result||[]).filter(i=>i[1]?.op?.[0]==="transfer").map(i=>{const[o,c]=i,d=c.op[1];return{id:o,timestamp:c.timestamp,type:d.from===t?"sent":"received",amount:d.amount,from:d.from,to:d.to,memo:d.memo||"",trx_id:c.trx_id}}).reverse()},Yc=f0(),Ro=nd.create((t,r)=>({walletData:null,isLoading:!1,error:null,transactions:[],isLoadingTransactions:!1,transactionError:null,selectedCurrency:Yc,localCurrency:Yc,exchangeRates:{USD:1},setWalletData:n=>t({walletData:n}),clearWalletData:()=>t({walletData:null,error:null,transactions:[],transactionError:null}),setSelectedCurrency:n=>{const{walletData:s,exchangeRates:a}=r();if(!s){t({selectedCurrency:n});return}const i=a[n]||1,o=s.estimated_value_usd*i,c=cn(o,n);t({selectedCurrency:n,walletData:{...s,estimated_value:c}})},getFormattedEstimatedValue:()=>{const{walletData:n,selectedCurrency:s,exchangeRates:a}=r();if(!n)return"-";const i=a[s]||1,o=n.estimated_value_usd*i;return cn(o,s)},fetchWalletData:async n=>{t({isLoading:!0,error:null});try{const s=await fg(n),a=m=>"error"in m;if(!s||a(s))throw new Error(a(s)?s.error:"Account not found");const i=typeof s.vesting_shares=="string"?s.vesting_shares:"0.000000 VESTS",o=typeof s.balance=="string"?s.balance:s.balance.toString(),c=typeof s.hbd_balance=="string"?s.hbd_balance:s.hbd_balance.toString(),d=typeof s.savings_balance=="string"?s.savings_balance:s.savings_balance.toString(),f=typeof s.savings_hbd_balance=="string"?s.savings_hbd_balance:s.savings_hbd_balance.toString(),l=await hg(i),h=parseFloat(o.split(" ")[0]||"0"),u=parseFloat(l),p=(h+u).toFixed(3),b=await mg(p),w=parseFloat(b),x=await pg(),{selectedCurrency:g}=r(),v=x[g]||1,N=w*v,j=cn(N,g),y={balance:o,hbd_balance:c,savings_balance:d,savings_hbd_balance:f,hive_power:`${l} HP`,estimated_value:j,estimated_value_usd:w};return t({walletData:y,exchangeRates:x}),y}catch(s){const a=s instanceof Error?s.message:"Failed to fetch wallet data";console.error("Wallet fetch error:",a);const i={balance:"0.000 HIVE",hbd_balance:"0.000 HBD",savings_balance:"0.000 HIVE",savings_hbd_balance:"0.000 HBD",hive_power:"0 HP",estimated_value:cn(0,"USD"),estimated_value_usd:0,error:a};return t({walletData:i,error:a}),i}finally{t({isLoading:!1})}},fetchTransactions:async(n,s=100)=>{t({isLoadingTransactions:!0,transactionError:null});try{const a=await gg(n,s);return t({transactions:a}),a}catch(a){const i=a instanceof Error?a.message:"Failed to fetch transactions";return console.error("Transaction fetch error:",i),t({transactionError:i}),[]}finally{t({isLoadingTransactions:!1})}}}));function xg(t){const r=new Date,n=new Date(t+"Z"),s=r.getTime()-n.getTime(),a=Math.floor(s/1e3),i=Math.floor(a/60),o=Math.floor(i/60),c=Math.floor(o/24);return c>30?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c>0?`${c}d ago`:o>0?`${o}h ago`:i>0?`${i}m ago`:"just now"}const bg=({tx:t})=>{const r=t.type==="sent",n=r?t.to:t.from;return e.jsxs("div",{className:"flex items-center gap-3 p-3.5 rounded-lg bg-gray-800 border border-gray-700 mb-2 transition-all duration-200 hover:bg-gray-750 hover:border-gray-600",children:[e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center flex-shrink-0 ${r?"bg-red-500/15 text-red-400":"bg-emerald-500/15 text-emerald-400"}`,children:r?e.jsx(ug,{size:12}):e.jsx(dg,{size:12})}),e.jsx("img",{src:`https://images.hive.blog/u/${n}/avatar`,alt:n,className:"w-9 h-9 rounded-full flex-shrink-0 border-2 border-gray-600",onError:s=>{s.target.src=`https://ui-avatars.com/api/?name=${n}&background=random&size=36`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("span",{className:"text-sm font-semibold text-gray-200 truncate",children:n})}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[r?"Sent":"Received"," · ",xg(t.timestamp)]})]}),e.jsx("div",{className:"text-right flex-shrink-0",children:e.jsxs("div",{className:`text-sm font-bold ${r?"text-red-400":"text-emerald-400"}`,children:[r?"-":"+",t.amount]})})]})},yg=()=>{const{selectedCurrency:t,localCurrency:r,setSelectedCurrency:n,exchangeRates:s}=Ro(),[a,i]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>{const f=l=>{o.current&&!o.current.contains(l.target)&&i(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const c=k.useMemo(()=>{const f=gn.find(u=>u.code==="USD"),l=r!=="USD"?gn.find(u=>u.code===r):null,h=gn.filter(u=>u.code!=="USD"&&u.code!==r&&s[u.code]);return[f,...l?[l]:[],...h]},[r,s]),d=f=>{try{return new Intl.NumberFormat("en",{style:"currency",currency:f}).formatToParts(0).find(h=>h.type==="currency")?.value||f}catch{return f}};return e.jsxs("div",{ref:o,className:"relative inline-block",children:[e.jsxs("button",{onClick:()=>i(!a),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/15 hover:bg-white/25 transition-colors text-white text-xs font-medium border border-white/20",children:[e.jsx("span",{children:d(t)}),e.jsx("span",{children:t}),e.jsx(ig,{size:8,className:`transition-transform ${a?"rotate-180":""}`})]}),a&&e.jsx("div",{className:"absolute top-full mt-1 right-0 w-56 max-h-64 overflow-y-auto rounded-lg bg-gray-800 border border-gray-600 shadow-xl z-50 scrollbar-hide",children:c.map((f,l)=>e.jsxs(k.Fragment,{children:[l===(r!=="USD"?2:1)&&e.jsx("div",{className:"border-t border-gray-600 my-1"}),e.jsxs("button",{onClick:()=>{n(f.code),i(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors hover:bg-gray-700 ${t===f.code?"bg-blue-500/20 text-blue-300":"text-gray-300"}`,children:[e.jsx("span",{className:"w-6 text-center font-medium text-gray-400",children:d(f.code)}),e.jsx("span",{className:"font-medium",children:f.code}),e.jsx("span",{className:"text-xs text-gray-500 truncate",children:f.name})]})]},f.code))})]})},h0=({username:t,className:r=""})=>{const{walletData:n,fetchWalletData:s,isLoading:a,error:i,transactions:o,fetchTransactions:c,isLoadingTransactions:d,transactionError:f}=Ro();k.useEffect(()=>{t&&(s(t),c(t))},[t,s,c]);const l=({label:h,value:u,icon:p,iconBgClass:b="bg-blue-500/15",iconTextClass:w="text-blue-400",valueClass:x="text-gray-200"})=>e.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-lg bg-gray-800 border border-gray-700 mb-2.5 transition-all duration-200 hover:bg-gray-750 hover:border-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[p&&e.jsx("div",{className:`p-2 rounded-full flex items-center justify-center ${b} ${w}`,children:p}),e.jsx("span",{className:"font-semibold text-sm text-gray-300",children:h})]}),e.jsx("span",{className:`font-medium text-sm ${x}`,children:u??"-"})]});return e.jsx("div",{className:`p-4 transition-all duration-300 ${r}`,children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("div",{className:"flex flex-col items-center p-5 mb-5 rounded-xl bg-gray-800 border border-gray-700",children:[t&&e.jsx("img",{src:`https://images.hive.blog/u/${t}/avatar`,alt:`${t} avatar`,className:"w-16 h-16 rounded-full border-3 border-blue-500/30 mb-2.5 transition-transform hover:scale-105",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${t}&background=random`}}),e.jsx("div",{className:"text-base font-bold text-white",children:t}),e.jsx("div",{className:"text-xs text-gray-400",children:"Hive Wallet Overview"})]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 p-5 mb-5 transition-all duration-300 hover:from-blue-500 hover:to-purple-500 shadow-lg shadow-blue-500/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("div",{className:"text-xs font-semibold text-blue-100/80",children:"Estimated Value"}),e.jsx(yg,{})]}),e.jsx("div",{className:"text-2xl font-bold text-white text-center",children:a?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{className:"text-lg",children:"Loading..."})]}):n?.estimated_value??"-"})]}),i&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(go,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:i})]}),e.jsx(l,{label:"Balance",value:n?.balance,icon:e.jsx(Zp,{}),iconBgClass:"bg-blue-500/15",iconTextClass:"text-blue-400",valueClass:"text-blue-300"}),e.jsx(l,{label:"HBD Balance",value:n?.hbd_balance,icon:e.jsx(eg,{}),iconBgClass:"bg-emerald-500/15",iconTextClass:"text-emerald-400",valueClass:"text-emerald-300"}),e.jsx(l,{label:"Savings Balance",value:n?.savings_balance,icon:e.jsx(Qp,{}),iconBgClass:"bg-amber-500/15",iconTextClass:"text-amber-400",valueClass:"text-amber-300"}),e.jsx(l,{label:"Savings HBD",value:n?.savings_hbd_balance,icon:e.jsx(ng,{}),iconBgClass:"bg-purple-500/15",iconTextClass:"text-purple-400",valueClass:"text-purple-300"}),e.jsx(l,{label:"Hive Power",value:n?.hive_power,icon:e.jsx(d0,{}),iconBgClass:"bg-orange-500/15",iconTextClass:"text-orange-400",valueClass:"text-orange-300"}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-300 tracking-wide uppercase",children:"Transaction History"}),o.length>0&&e.jsxs("span",{className:"text-xs text-gray-500",children:[o.length," transactions"]})]}),d&&e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-gray-600 border-t-blue-400 rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Loading transactions..."})]})}),f&&e.jsxs("div",{className:"flex items-center p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 mb-4 text-sm",children:[e.jsx(go,{className:"mr-2 flex-shrink-0"}),e.jsx("span",{children:f})]}),!d&&!f&&o.length===0&&e.jsx("div",{className:"text-center p-8 rounded-lg bg-gray-800 border border-gray-700",children:e.jsx("p",{className:"text-sm text-gray-500",children:"No transactions found"})}),!d&&t&&o.map(h=>e.jsx(bg,{tx:h},h.trx_id+h.id))]})]})})};function m0({sort:t="trending",tag:r="",observer:n="hive.blog",limit:s=20,showSortDropdown:a=!0,theme:i="dark",onAuthorClick:o,onPostClick:c,onCommunityClick:d,onPayoutClick:f,onUpvoteClick:l,onCommentClick:h,onReblogClick:u}){const[p,b]=k.useState([]),[w,x]=k.useState(!0),[g,v]=k.useState(null),[N,j]=k.useState(t),[y,m]=k.useState(!0),[_,E]=k.useState(!1),A=k.useRef(null);new Vn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:H=>H,usertagUrlFn:H=>`/@${H}`,hashtagUrlFn:H=>`/trending/${H}`,isLinkSafeFn:H=>!0,addExternalCssClassToMatchingLinksFn:H=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"});const C=k.useCallback(async(H,F=!1)=>{F?E(!0):(x(!0),m(!0)),v(null);try{const Y=F&&p.length>0?p[p.length-1]:null,G=await Nt.getRankedPosts(H,r,n,s,Y?.author,Y?.permlink);F?(b(ne=>{const ie=new Set(ne.map(V=>V.post_id)),xe=G.filter(V=>!ie.has(V.post_id));return[...ne,...xe]}),m(G.length===s)):(b(G),m(G.length===s))}catch(Y){v(Y instanceof Error?Y.message:"Failed to load posts"),m(!1)}finally{x(!1),E(!1)}},[r,n,s,p]),T=k.useCallback(()=>{!_&&y&&!w&&C(N,!0)},[_,y,w,N,C]);k.useEffect(()=>{C(N)},[N,r,n,s]),k.useEffect(()=>{const H=new IntersectionObserver(F=>{F[0].isIntersecting&&T()},{threshold:1});return A.current&&H.observe(A.current),()=>{A.current&&H.unobserve(A.current)}},[T]);const D=H=>{j(H),b([]),m(!0)},L=H=>H>=1e6?`${(H/1e6).toFixed(1)}M`:H>=1e3?`${(H/1e3).toFixed(1)}K`:H.toString(),z=H=>{const F=H.payout*.5,Y=H.payout*.5,ne=(H.beneficiaries.find(ie=>ie.account==="commentrewarder")?.weight||0)/1e4*100;return{pending:`$${H.payout.toFixed(2)}`,breakdown:`${F.toFixed(2)} HBD, ${Y.toFixed(2)} HP`,commentRewarder:`${ne.toFixed(2)}%`,payoutInDays:Math.ceil((new Date(H.payout_at).getTime()-Date.now())/(1e3*60*60*24))}},U=H=>{const Y=(H.body||"").replace(/!\[[^\]]*\]\([^)]+\)/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#+\s*/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/<[^>]*>/g,"").replace(/\n+/g," ").trim();return Y.length>200?Y.substring(0,200)+"...":Y};return w?e.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:e.jsx(O.Loader2,{className:"w-8 h-8 animate-spin"})}):g?e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-card-foreground",children:"Failed to load posts"}),e.jsx("p",{className:"text-muted-foreground",children:g}),e.jsx("button",{onClick:()=>C(N),className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90",children:"Retry"})]}):e.jsx("div",{className:i==="dark"?"dark":"",children:e.jsxs("div",{className:`space-y-6 p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[a&&e.jsx("div",{className:"flex justify-center",children:e.jsxs("select",{value:N,onChange:H=>D(H.target.value),className:`px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary ${i==="dark"?"bg-slate-950 text-white":"bg-card text-card-foreground"}`,children:[e.jsx("option",{value:"trending",children:"Trending"}),e.jsx("option",{value:"hot",children:"Hot"}),e.jsx("option",{value:"created",children:"New"})]})}),e.jsxs("div",{className:"space-y-4",children:[p.map(H=>{const F=H.json_metadata?.image?.[0],Y=z(H);return e.jsxs("div",{className:`border border-border rounded-xl p-4 shadow-card hover:shadow-card-hover transition-shadow ${i==="dark"?"bg-slate-900 text-white":"bg-slate-50 text-black"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[e.jsx("img",{src:`https://images.hive.blog/u/${H.author}/avatar`,alt:H.author,className:"w-8 h-8 rounded-full cursor-pointer flex-shrink-0",onClick:()=>o?.(H.author,`https://images.hive.blog/u/${H.author}/avatar`),onError:G=>{G.target.src=`https://ui-avatars.com/api/?name=${H.author}&background=random`}}),e.jsx("span",{className:"font-medium cursor-pointer hover:text-primary",onClick:()=>o?.(H.author,`https://images.hive.blog/u/${H.author}/avatar`),children:H.author}),e.jsxs("span",{className:i==="dark"?"text-gray-400":"text-muted-foreground",children:["(",H.author_reputation.toFixed(2),")"]}),e.jsx("span",{className:`cursor-pointer hover:text-primary ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,onClick:()=>d?.(H.community_title),children:H.community_title}),e.jsx("span",{className:`hidden sm:inline ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:"•"}),e.jsx("span",{className:`text-sm ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:bs.formatDistanceToNow(new Date(H.created+"Z"),{addSuffix:!0})})]}),e.jsxs("div",{className:"flex gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:F?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:F.startsWith("http")?F:`https://images.hive.blog/u/320x0/${F}`,alt:H.title,className:"w-20 h-20 sm:w-32 sm:h-32 object-cover rounded-lg cursor-pointer",onClick:()=>c?.(H),onError:G=>{G.target.src!==`https://images.hive.blog/u/${H.author}/avatar`?G.target.src=`https://images.hive.blog/u/${H.author}/avatar`:G.target.src="https://images.hive.blog/u/null/avatar"}}),(()=>{const G=H.body?.match(/!\[[^\]]*\]\(([^)]+)\)/g)?.map(ne=>{const ie=ne.match(/\(([^)]+)\)/);return ie?ie[1]:null}).filter(Boolean)||[];return G.length>0?e.jsx("div",{className:"absolute -bottom-1 -right-1 sm:-bottom-2 sm:-right-2 flex space-x-1",children:G.slice(0,3).map((ne,ie)=>e.jsx("img",{src:ne,alt:`body-image-${ie}`,className:"w-6 h-6 sm:w-8 sm:h-8 object-cover rounded border-2 border-white shadow-sm cursor-pointer",onClick:xe=>{xe.stopPropagation();const V=xe.currentTarget.parentElement?.parentElement?.querySelector("img:not(.w-6):not(.w-8)");V&&(V.src=ne)}},ie))}):null})()]}):e.jsx("img",{src:`https://images.hive.blog/u/${H.author}/avatar`,alt:H.author,className:"w-20 h-20 sm:w-32 sm:h-32 rounded-lg cursor-pointer",onClick:()=>c?.(H)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-base sm:text-lg mb-1 sm:mb-2 cursor-pointer hover:text-primary line-clamp-2",onClick:()=>c?.(H),children:H.title}),e.jsx("p",{className:`mb-2 sm:mb-3 line-clamp-2 sm:line-clamp-3 cursor-pointer hover:text-primary text-sm sm:text-base ${i==="dark"?"text-gray-300":"text-gray-600"}`,onClick:()=>c?.(H),children:H.json_metadata?.description||U(H)||"No description available"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"relative group",children:[e.jsxs("span",{className:"font-semibold text-green-600 cursor-pointer hover:text-green-700 text-sm sm:text-base",onClick:()=>f?.(H.payout),children:["$",H.payout.toFixed(2)]}),e.jsxs("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover:block bg-black text-white text-xs p-2 rounded shadow-lg whitespace-nowrap z-10",children:[e.jsxs("div",{children:["Pending payout amount: ",Y.pending]}),e.jsxs("div",{children:["Breakdown: ",Y.breakdown]}),e.jsxs("div",{children:["commentrewarder: ",Y.commentRewarder]}),e.jsxs("div",{children:["Payout in ",Y.payoutInDays," days"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsxs("div",{className:`flex items-center gap-1 hover:text-primary transition-colors cursor-pointer ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,onClick:()=>l?.(H),children:[e.jsx(O.ThumbsUp,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(H.stats.total_votes)})]}),e.jsxs("div",{className:`flex items-center gap-1 hover:text-blue-400 transition-colors cursor-pointer ${i==="dark"?"text-blue-400":"text-blue-600"}`,onClick:()=>h?.(H),children:[e.jsx(O.MessageCircle,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(H.children)})]}),e.jsxs("div",{className:`flex items-center gap-1 hover:text-gray-400 transition-colors cursor-pointer ${i==="dark"?"text-gray-400":"text-gray-600"}`,onClick:()=>u?.(H),children:[e.jsx(O.Repeat2,{className:"w-3 h-3 sm:w-4 sm:h-4"}),e.jsx("span",{className:"text-xs sm:text-sm",children:L(H.reblogs)})]})]})]})]})]})]},H.post_id)}),_&&e.jsxs("div",{className:"flex justify-center items-center py-4",children:[e.jsx(O.Loader2,{className:"w-6 h-6 animate-spin"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-muted-foreground"}`,children:"Loading more posts..."})]}),y&&!_&&e.jsx("div",{ref:A,className:"h-10"})]})]})})}class Ca{static instance;static getInstance(){return Ca.instance||(Ca.instance=new Ca),Ca.instance}async getProposals(r){return r==="expired"?this.getExpiredProposals():this.getActiveProposals()}async getActiveProposals(){try{const s=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:72,jsonrpc:"2.0",method:"database_api.list_proposals",params:{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"votable"}})})).json()).result.proposals,i=await(await fetch("https://stats.hivehub.dev/dhf_proposals")).json(),o={};i.forEach(h=>{o[h.proposal_id]=h});const f=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:73,jsonrpc:"2.0",method:"database_api.list_proposal_votes",params:{start:["shaktimaaan"],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"votable"}})})).json()).result.proposal_votes||[],l={};return f.forEach(h=>{l[h.proposal.proposal_id]||(l[h.proposal.proposal_id]=[]),l[h.proposal.proposal_id].push(h)}),s.map(h=>{const u=h.id,p=o[u],b=l[u]||[],w=b.reduce((x,g)=>x+parseFloat(g.total_hbd||"0"),0);return{proposal_id:u,subject:h.subject,permlink:h.permlink,creator:h.creator,receiver:h.receiver,start_date:h.start_date,end_date:h.end_date,total_hbd_received:p?p.total_hbd_received:"0",max_hbd_remaining:p?p.max_hbd_remaining:"0",all_votes_num:h.total_votes||"0",all_votes_hp:p?p.all_votes_hp:w.toString(),votes:p?p.votes:b,status:h.status,daily_pay:h.daily_pay,total_votes:h.total_votes,daily_pay_hbd:h.daily_pay?Number(h.daily_pay.amount)/Math.pow(10,h.daily_pay.precision):0,remaining_days:Math.max(0,Math.ceil((new Date(h.end_date).getTime()-new Date().getTime())/(1e3*60*60*24))),vote_value_total:p?parseFloat(p.all_votes_hp):w}})}catch(r){return console.error("Error fetching active proposals:",r),[]}}async getExpiredProposals(){try{const s=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:65,jsonrpc:"2.0",method:"database_api.list_proposals",params:{start:[-1],limit:500,order:"by_total_votes",order_direction:"descending",status:"expired"}})})).json()).result.proposals,i=await(await fetch("https://stats.hivehub.dev/dhf_proposals")).json(),o={};i.forEach(h=>{o[h.proposal_id]=h});const f=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7","content-type":"application/json",origin:"https://peakd.com","sec-ch-ua":'"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"},body:JSON.stringify({id:76,jsonrpc:"2.0",method:"database_api.list_proposal_votes",params:{start:["shaktimaaan"],limit:1e3,order:"by_voter_proposal",order_direction:"ascending",status:"expired"}})})).json()).result.proposal_votes||[],l={};return f.forEach(h=>{l[h.proposal_id]||(l[h.proposal_id]=[]),l[h.proposal_id].push(h)}),s.map(h=>{const u=h.id,p=o[u],b=l[u]||[],w=b.reduce((x,g)=>x+parseFloat(g.total_hbd||"0"),0);return{proposal_id:u,subject:h.subject,permlink:h.permlink,creator:h.creator,receiver:h.receiver,start_date:h.start_date,end_date:h.end_date,total_hbd_received:p?p.total_hbd_received:"0",max_hbd_remaining:p?p.max_hbd_remaining:"0",all_votes_num:h.total_votes||"0",all_votes_hp:p?p.all_votes_hp:w.toString(),votes:p?p.votes:b,status:h.status,daily_pay:h.daily_pay,total_votes:h.total_votes,daily_pay_hbd:h.daily_pay?Number(h.daily_pay.amount)/Math.pow(10,h.daily_pay.precision):0,remaining_days:0,vote_value_total:p?parseFloat(p.all_votes_hp):w}})}catch(r){return console.error("Error fetching expired proposals:",r),[]}}}const Zc=Ca.getInstance(),vg=["All","Active","Upcoming","Expired","By Peak Projects"],p0=["Votes","Start Date","End Date","Creator"],Xc=t=>t==="By Peak Projects"?["Creator"]:p0,mr=t=>{const r=typeof t=="string"?parseFloat(t):t;return isNaN(r)?t.toString():r.toLocaleString()},to=t=>{const r=new Date(t.start_date),n=new Date(t.end_date);return`(${Math.ceil((n.getTime()-r.getTime())/(1e3*60*60*24))} days)`},wg=({onClickSupport:t,onClickVoteValue:r,onClickSelect:n,onClickUser:s,onClickAvatar:a,theme:i="dark"})=>{const[o,c]=k.useState([]),[d,f]=k.useState("All"),[l,h]=k.useState("Votes");k.useEffect(()=>{d==="By Peak Projects"&&!Xc(d).includes(l)?h("Creator"):d!=="By Peak Projects"&&l==="Creator"&&!p0.includes(l)&&h("Votes")},[d,l]);const[u,p]=k.useState(!0);k.useEffect(()=>{(async()=>{p(!0);try{const[g,v]=await Promise.all([Zc.getProposals("active"),Zc.getProposals("expired")]);c([...g,...v])}catch(g){console.error("Error fetching proposals:",g),c([])}p(!1)})()},[]);const b=o.filter(x=>d==="All"?x.status==="active"||new Date(x.start_date+"Z")>new Date:d==="Active"?x.status==="active":d==="Upcoming"?new Date(x.start_date+"Z")>new Date:d==="Expired"?new Date(x.end_date+"Z")<new Date:d==="By Peak Projects"?x.creator==="peakd":!0).sort((x,g)=>d==="By Peak Projects"?g.creator.localeCompare(x.creator):0),w=d==="All"?(()=>{const x=b.filter(N=>N.status==="active"),g=b.filter(N=>new Date(N.start_date+"Z")>new Date),v=(N,j)=>l==="Votes"?Number(j.all_votes_num)-Number(N.all_votes_num):l==="Start Date"?new Date(j.start_date+"Z").getTime()-new Date(N.start_date+"Z").getTime():l==="End Date"?new Date(N.end_date+"Z").getTime()-new Date(j.end_date+"Z").getTime():l==="Creator"?N.creator.localeCompare(j.creator):0;return[...x.sort(v),...g.sort(v)]})():b.sort((x,g)=>l==="Votes"?Number(g.all_votes_num)-Number(x.all_votes_num):l==="Start Date"?new Date(g.start_date+"Z").getTime()-new Date(x.start_date+"Z").getTime():l==="End Date"?new Date(x.end_date+"Z").getTime()-new Date(g.end_date+"Z").getTime():l==="Creator"?x.creator.localeCompare(g.creator):0);return u?e.jsx("div",{className:"flex justify-center items-center py-8",children:e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading proposals..."})}):e.jsx("div",{className:i==="dark"?"dark":"",children:e.jsxs("div",{className:`space-y-6 p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsx("div",{className:"flex gap-2 mb-4 flex-wrap",children:vg.map(x=>e.jsx("button",{className:`px-3 py-1 rounded text-sm ${d===x?"bg-blue-500 text-white":`${i==="dark"?"bg-slate-900 text-gray-300":"bg-gray-200 text-gray-700"}`}`,onClick:()=>f(x),children:x},x))}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:`${i==="dark"?"text-gray-300":"text-gray-700"} mr-2`,children:"Sort by:"}),e.jsx("select",{value:l,onChange:x=>h(x.target.value),className:`px-3 py-1 border rounded ${i==="dark"?"border-gray-600 bg-slate-900 text-gray-100":"border-gray-300 bg-white text-gray-900"}`,children:Xc(d).map(x=>e.jsx("option",{value:x,children:x},x))})]}),e.jsxs("div",{children:[d==="All"&&(()=>{const x=w.filter(v=>v.status==="active"),g=w.filter(v=>new Date(v.start_date+"Z")>new Date);return e.jsxs(e.Fragment,{children:[x.map(v=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-900":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(v),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${v.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${v.creator} avatar`})}),e.jsxs("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(v),children:["by ",v.creator]}),v.receiver&&e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:v.receiver})]})]}),e.jsxs("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(v),children:[v.subject," ",e.jsxs("span",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-500":"text-gray-600"}`,children:["#",v.proposal_id]})]}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(v.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(v.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":v.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(v.start_date+"Z")>new Date?"upcoming":new Date(v.end_date+"Z")<new Date?"expired":v.status})," - "+new Date(v.start_date+"Z").toLocaleDateString()+" - "+new Date(v.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:to(v)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/${v.creator}/${v.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${v.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(v),children:["Vote value: ",v.vote_value_total?mr(v.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Daily Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[v.daily_pay_hbd?mr(v.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Remaining:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.remaining_days||0)," Days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Paid:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"To Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(v),children:"Support"})})]})]})},v.proposal_id)),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"my-6 text-center",children:[e.jsx("h3",{className:`text-xl font-bold mb-2 ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:"Upcoming proposals"}),e.jsx("p",{className:`${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"The proposals listed below will start in the future. You can already support them."})]}),g.map(v=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-950":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(v),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${v.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${v.creator} avatar`})}),e.jsx("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(v),children:v.creator}),e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:v.receiver})]})]}),e.jsx("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(v),children:v.subject}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(v.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(v.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":v.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(v.start_date+"Z")>new Date?"upcoming":new Date(v.end_date+"Z")<new Date?"expired":v.status})," - "+new Date(v.start_date+"Z").toLocaleDateString()+" - "+new Date(v.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:to(v)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/${v.creator}/${v.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${v.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(v),children:["Vote value: ",v.vote_value_total?mr(v.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Daily Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[v.daily_pay_hbd?mr(v.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Remaining:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.remaining_days||0)," Days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"Paid:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:`font-mono text-xs sm:text-sm ${i==="dark"?"text-gray-400":"text-gray-600"}`,children:"To Pay:"}),e.jsxs("strong",{className:`text-xs sm:text-sm ${i==="dark"?"text-gray-100":"text-gray-900"}`,children:[mr(v.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(v),children:"Support"})})]})]})},v.proposal_id))]})]})})(),d!=="All"&&w.map(x=>e.jsx("div",{className:`border rounded-lg mb-4 p-2 sm:p-4 shadow ${i==="dark"?"border-gray-800 bg-slate-950":"border-gray-200 bg-white"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{onClick:()=>a(x),className:"inline-block mr-2 cursor-pointer",children:e.jsx("img",{src:`https://images.hive.blog/u/${x.creator}/avatar`,className:"w-8 h-8 rounded-full inline",alt:`${x.creator} avatar`})}),e.jsx("span",{className:`font-bold cursor-pointer ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>s(x),children:x.creator}),e.jsxs("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["with receiver ",e.jsx("strong",{className:`${i==="dark"?"text-gray-100":"text-gray-900"}`,children:x.receiver})]})]}),e.jsxs("div",{className:`cursor-pointer text-lg font-semibold mb-1 ${i==="dark"?"text-gray-100":"text-gray-900"}`,onClick:()=>n(x),children:[x.subject," #",x.proposal_id]}),e.jsxs("div",{className:`text-sm mb-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("span",{className:`inline-block px-2 py-1 rounded text-xs font-medium ${new Date(x.start_date+"Z")>new Date?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":new Date(x.end_date+"Z")<new Date?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":x.status==="active"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"}`,children:new Date(x.start_date+"Z")>new Date?"upcoming":new Date(x.end_date+"Z")<new Date?"expired":x.status})," - "+new Date(x.start_date+"Z").toLocaleDateString()+" - "+new Date(x.end_date+"Z").toLocaleDateString()," ",e.jsx("span",{className:`text-xs ${i==="dark"?"text-gray-500":"text-gray-400"}`,children:to(x)})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>window.open(`https://peakd.com/@${x.creator}/${x.permlink}`,"_blank"),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",title:"View on Peakd",children:e.jsx(O.ExternalLink,{size:16})}),e.jsxs("button",{onClick:()=>window.open(`https://hivehub.dev/proposals/${x.proposal_id}`,"_blank"),className:"flex text-green-500 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",title:"View Stats",children:[e.jsx(O.PieChart,{size:16})," Stats"]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:`inline-block cursor-pointer px-2 py-1 rounded ${i==="dark"?"bg-gray-800 text-gray-300":"bg-gray-100 text-gray-700"}`,onClick:()=>r(x),children:["Vote value: ",x.vote_value_total?mr(x.vote_value_total):0," HP"]})})]}),e.jsxs("div",{className:"mt-4 sm:mt-0 sm:ml-4 w-full sm:w-48 flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Daily Pay:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[x.daily_pay_hbd?mr(x.daily_pay_hbd):0," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Remaining:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.remaining_days||0)," Days"]})]}),d!=="Expired"&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"Paid:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.total_hbd_received||0)," HBD"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"font-mono text-gray-600 dark:text-gray-400 text-xs sm:text-sm",children:"To Pay:"}),e.jsxs("strong",{className:"text-gray-900 dark:text-gray-100 text-xs sm:text-sm",children:[mr(x.max_hbd_remaining||0)," HBD"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx("button",{className:"px-3 sm:px-5 py-2 bg-green-600 hover:bg-green-700 text-white rounded cursor-pointer w-full text-xs sm:text-sm",onClick:()=>t(x),children:"Support"})})]})]})},x.proposal_id))]})]})})};class Ng{HIVE_API_URL="https://api.hive.blog";async _fetch(r,n,s){return fetch(r,s?{...n,signal:s}:n)}async getProfile(r,n){const s={jsonrpc:"2.0",method:"bridge.get_profile",params:{account:r},id:1},a=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},n);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}async getFollowers(r,n=null,s=100,a){const i={jsonrpc:"2.0",method:"condenser_api.get_followers",params:[r,n||"","blog",s],id:1},o=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result}async getFollowing(r,n=null,s=100,a){const i={jsonrpc:"2.0",method:"condenser_api.get_following",params:[r,n||"","blog",s],id:1},o=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return(await o.json()).result}async getAccounts(r,n){const s={jsonrpc:"2.0",method:"condenser_api.get_accounts",params:[r],id:1},a=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},n);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return(await a.json()).result}async getDynamicGlobalProperties(r){const n={jsonrpc:"2.0",method:"condenser_api.get_dynamic_global_properties",params:[],id:1},s=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},r);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return(await s.json()).result}async convertVestingSharesToHive(r){try{const n=await this.getDynamicGlobalProperties(),s=parseFloat(r.split(" ")[0]),a=parseFloat(n.total_vesting_shares.split(" ")[0]),i=parseFloat(n.total_vesting_fund_hive.split(" ")[0]);return(s*i/a).toFixed(3)}catch(n){return console.error("Error converting vesting shares:",n),"0"}}async getFeedHistory(r){const n={jsonrpc:"2.0",method:"condenser_api.get_feed_history",params:[],id:1},s=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},r);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return(await s.json()).result}async getVoteValue(r,n=1e4){try{const s=await this.getAccounts([r]);if(s.length===0)throw new Error("Account not found!");const a=s[0],i=await this.getDynamicGlobalProperties(),o=await this.getFeedHistory(),c=parseFloat(a.vesting_shares)+parseFloat(a.received_vesting_shares)-parseFloat(a.delegated_vesting_shares)-parseFloat(a.vesting_withdraw_rate),d=Math.floor(Date.now()/1e3)-a.voting_manabar.last_update_time,f=c*1e6/4;let l=parseFloat(a.voting_manabar.current_mana.toString())+d*f/(300*60*24);l>f&&(l=f);const h=l*100/f,u=a.vesting_shares||"0 VESTS",p=parseFloat(u.toString().split(" ")[0]),b=i.total_vesting_shares||"0 VESTS",w=parseFloat(b.toString().split(" ")[0]),x=n/1e4,g=h*x/100,v=i.vote_power_reserve_rate*(300*60*24)/(3600*24),N=g*f/100,j=parseFloat(i.recent_claims||"0"),y=i.reward_balance||"0 HIVE",m=parseFloat(y.toString().split(" ")[0]),_=i.current_supply||"0 HIVE",E=parseFloat(_.toString().split(" ")[0]),A=i.current_sbd_supply||"0 HBD",C=parseFloat(A.toString().split(" ")[0]),T=m/j*(p/w)*(N/f)*E,D=o?.current_median_history;if(!D||!D.base)return"0.00";const L=parseFloat(D.base.toString().split(" ")[0]);return(T*L).toFixed(2)}catch(s){return console.error("Error calculating vote value:",s),"0.00"}}async getUserBlogs(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"blog",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserPosts(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"posts",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserComments(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"comments",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getUserReplies(r,n=20,s,a,i){const o={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:"replies",account:r,observer:r,limit:n,start_author:s||null,start_permlink:a||null},id:1},c=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},i);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return(await c.json()).result||[]}async getSnapReferences(r,n,s){let a=`https://peakd.com/api/public/snaps/account?container=peak.snaps&username=${r}`;n!==void 0&&(a+=`&startId=${n}`);const i=await this._fetch(a,{method:"GET",headers:{Accept:"application/json"}},s);if(!i.ok)throw new Error(`PeakD API error: ${i.status}`);const o=await i.json();return Array.isArray(o)?o:[]}async batchGetPosts(r,n="",s){const i=[];for(let o=0;o<r.length;o+=5){const d=r.slice(o,o+5).map((u,p)=>({jsonrpc:"2.0",method:"bridge.get_post",params:{author:u.author,permlink:u.permlink,observer:n},id:p+1})),f=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)},s);if(!f.ok)continue;const l=await f.json(),h=Array.isArray(l)?l:[l];for(const u of h)u?.result&&i.push(u.result)}return i}async getUserSnaps(r,n,s,a){const i=await this.getSnapReferences(r,n,a);if(i.length===0)return{snaps:[],nextStartId:null};const o=await this.batchGetPosts(i,s||r,a),c=i[i.length-1],d=i.length>=15?c.id:null;return{snaps:o,nextStartId:d}}async getUserPolls(r,n){const s=`https://polls.hivehub.dev/rpc/polls?author=eq.${encodeURIComponent(r)}&order=created.desc`,a=await this._fetch(s,{method:"GET",headers:{Accept:"application/json"}},n);if(!a.ok)throw new Error(`Polls API error: ${a.status}`);const i=await a.json();return Array.isArray(i)?i:[]}async getPollDetail(r,n,s){const a=`https://polls.hivehub.dev/rpc/poll?author=eq.${encodeURIComponent(r)}&permlink=eq.${encodeURIComponent(n)}`,i=await this._fetch(a,{method:"GET",headers:{Accept:"application/json"}},s);if(!i.ok)throw new Error(`Polls API error: ${i.status}`);const o=await i.json();return Array.isArray(o)&&o.length>0?o[0]:null}delay(r){return new Promise(n=>setTimeout(n,r))}API_THROTTLE_MS=150;parseAssetFloat(r){return r&&parseFloat(r.split(" ")[0])||0}parseHiveTime(r){if(!r)return null;const n=r.endsWith("Z")?r:`${r}Z`,s=Date.parse(n);return isNaN(s)?null:s}async getPendingAuthorRewards(r,n,s){const a=Date.now()-6048e5,i=[],o=new Set;let c=0;const d=h=>{if(!h||!h.author||!h.permlink)return;const u=`${h.author}/${h.permlink}`;if(o.has(u))return;const p=this.parseHiveTime(h.created||h.posted);if(p&&p<a)return;const b=h.cashout_time||h.payout_at||"",w=this.parseHiveTime(b);if(!w||isNaN(w)||w<=Date.now()||this.parseAssetFloat(h.max_accepted_payout||"0")===0)return;const g=this.parseAssetFloat(h.pending_payout_value||"0");if(h.is_paidout===!0)return;const N=(Array.isArray(h.beneficiaries)?h.beneficiaries:[]).reduce((m,_)=>m+(Number(_.weight)||0),0)/1e4,y=g*.5*Math.max(0,Math.min(1,1-N));o.add(u),c+=y,i.push({author:h.author,permlink:h.permlink,title:h.title||"",isComment:!!h.parent_author,payoutMs:w-Date.now(),hbd:y,hpEq:null,beneficiaryCut:N})},f=async h=>{let b=null,w=null;for(let x=0;x<30;x++){const g={jsonrpc:"2.0",method:"bridge.get_account_posts",params:{sort:h,account:r,observer:r,limit:20,start_author:b,start_permlink:w},id:1},v=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)},s);if(!v.ok)break;const j=(await v.json()).result;if(!Array.isArray(j)||!j.length)break;j.forEach(d);const y=j[j.length-1],m=this.parseHiveTime(y?.created);if(b=y?.author||null,w=y?.permlink||null,j.length<20||!b||!w||m&&m<a)break;await this.delay(this.API_THROTTLE_MS)}};if(await f("posts"),n&&i.length>0){const h=[...i].sort((u,p)=>(u.payoutMs||0)-(p.payoutMs||0));n(h,c,0)}await f("comments"),i.sort((h,u)=>(h.payoutMs||0)-(u.payoutMs||0));let l=0;try{const h=await this.rpcCall("condenser_api.get_current_median_history_price",[],s),u=this.parseAssetFloat(h?.base)/this.parseAssetFloat(h?.quote||"1.000 HIVE");u>0&&(l=c/u,i.forEach(p=>{p.hpEq=(p.hbd||0)/u}))}catch{}return{rows:i,totalHbd:c,totalHpEq:l}}async getPendingCurationRewards(r,n,s){const i=Date.now()-864e6,o=[],c=(1n<<0n).toString();let d=-1;const f=1e3,l=new Set;for(let m=0;m<20;m++){const _=[r,d,f,c,"0"];let E;try{E=await this.rpcCall("condenser_api.get_account_history",_,s)}catch{try{E=await this.rpcCall("condenser_api.get_account_history",[r,d,f],s)}catch{break}}if(!Array.isArray(E)||!E.length)break;let A=1/0;for(const[C,T]of E){if(l.has(C))continue;l.add(C);const[D,L]=T?.op||[];D==="vote"&&L?.voter===r&&o.push({voter:L.voter,author:L.author,permlink:L.permlink,weight:L.weight,timestamp:T.timestamp});const z=this.parseHiveTime(T?.timestamp);z&&z<A&&(A=z)}if(A<=i||(d=E[0][0]-1,d<0))break;await this.delay(this.API_THROTTLE_MS)}const h=new Map;for(const m of o){const _=this.parseHiveTime(m.timestamp);if(!_||_<i)continue;const E=`${m.author}/${m.permlink}`,A=h.get(E);(!A||_>(this.parseHiveTime(A.timestamp)||0))&&h.set(E,m)}const u=Array.from(h.values()).filter(m=>(m.weight||0)>0);if(!u.length)return{rows:[],totalHp:0,totalHbd:0};const[p,b,w]=await Promise.all([this.rpcCall("condenser_api.get_reward_fund",["post"],s),this.rpcCall("condenser_api.get_current_median_history_price",[],s),this.getDynamicGlobalProperties(s)]),x=this.parseAssetFloat(b?.base)/this.parseAssetFloat(b?.quote||"1.000 HIVE"),g=Number(p?.percent_curation_rewards||5e3),v=[],N=6;for(let m=0;m<u.length;m+=N){const _=u.slice(m,m+N),E=await Promise.all(_.map(async A=>{try{const C=await this.rpcCall("condenser_api.get_content",[A.author,A.permlink],s);if(!C||C.allow_curation_rewards===!1)return null;const T=this.parseHiveTime(C.cashout_time);if(!T||T<=Date.now()||this.parseAssetFloat(C.max_accepted_payout)<=0)return null;const L=this.parseAssetFloat(C.pending_payout_value||"0");if(L<=0)return null;let z=Array.isArray(C.active_votes)&&C.active_votes.length?C.active_votes:await this.rpcCall("condenser_api.get_active_votes",[A.author,A.permlink],s);if(!Array.isArray(z)||!z.length)return null;const U=z.find(Ie=>Ie.voter===r);if(!U)return null;const H=Number(U.rshares||0);if(H<=0)return null;const F=L*(g/1e4);let Y;const G=Number(U.weight||0),ne=Number(C.total_vote_weight||0);if(G>0&&ne>0)Y=G/ne;else{const Ie=z.reduce((K,le)=>{const oe=Number(le.rshares||0);return oe>0?K+oe:K},0);Y=Ie>0?H/Ie:0}const ie=F*Y,xe=x>0?ie/x:0;if(xe<=0)return null;const V=z.reduce((Ie,K)=>{const le=Number(K.rshares||0);return le>0?Ie+le:Ie},0),q=V>0?H/V:0,B=q>0?Y/q*100:null,pe=this.parseHiveTime(C.created),ee=U.time?this.parseHiveTime(U.time):this.parseHiveTime(A.timestamp),te=pe&&ee?Math.max(0,ee-pe):null;let _e=Number(A.weight||0);return U.percent!==void 0&&(_e=Number(U.percent)),{hp:xe,hbd:ie,author:A.author,permlink:A.permlink,title:C.title||`${A.author}/${A.permlink}`,payoutMs:T-Date.now(),votedAfterMs:te,weightPct:(_e||0)/100,efficiency:B,isComment:!!C.parent_author}}catch{return null}}));for(const A of E)A&&A.hp>0&&v.push(A);if(n&&v.length>0){const A=[...v].sort((D,L)=>(D.payoutMs||0)-(L.payoutMs||0)),C=A.reduce((D,L)=>D+(L.hp||0),0),T=A.reduce((D,L)=>D+(L.hbd||0),0);n(A,C,T)}m+N<u.length&&await this.delay(this.API_THROTTLE_MS)}v.sort((m,_)=>(m.payoutMs||0)-(_.payoutMs||0));const j=v.reduce((m,_)=>m+(_.hp||0),0),y=v.reduce((m,_)=>m+(_.hbd||0),0);return{rows:v,totalHp:j,totalHbd:y}}async rpcCall(r,n,s){const a={jsonrpc:"2.0",method:r,params:n,id:1},i=await this._fetch(this.HIVE_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)},s);if(!i.ok)throw new Error(`RPC error: ${i.status}`);const o=await i.json();if(o.error)throw new Error(o.error.message||"RPC error");return o.result}userAvatar(r){return`https://images.hive.blog/u/${r}/avatar`}}const Ee=new Ng,Kc=({vestingShares:t})=>{const[r,n]=k.useState("...");return k.useEffect(()=>{(async()=>{try{const a=await Ee.convertVestingSharesToHive(t);n(a)}catch(a){console.error("Error calculating HP:",a);const i=parseFloat(t.split(" ")[0]);n((i/1e6).toFixed(3))}})()},[t]),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r," HP"]})},jg=({username:t,onClickAuthor:r,onClickAddRemoveFromLists:n,onClickFollow:s})=>{const[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState({}),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=k.useRef(null),g=async()=>{try{h(!0),p(null);const j=await Ee.getFollowers(t);if(i(j),j.length>0){const y=j.map(A=>A.follower),m=await Ee.getAccounts(y);c(m);const _={},E={};for(const A of j)try{const C=await Ee.getVoteValue(A.follower);E[A.follower]=C}catch(C){console.warn(`Failed to get voting data for ${A.follower}:`,C),_[A.follower]={upvotepower:"0",downvote:"0"},E[A.follower]="0.00"}f(E)}}catch(j){p(j instanceof Error?j.message:"Failed to load followers data")}finally{h(!1)}};k.useEffect(()=>{g()},[t]),k.useEffect(()=>{const j=y=>{x.current&&!x.current.contains(y.target)&&w(null)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const v=j=>{const y=o.find(m=>m.name===j);if(!y)return null;try{return JSON.parse(y.posting_json_metadata)?.profile||{}}catch{return{}}},N=j=>{const y=new Date,m=new Date(j),_=y.getTime()-m.getTime(),E=Math.floor(_/(1e3*60*60*24));if(Math.floor(E/30)>=1)return m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});const C=Math.floor(_/1e3),T=Math.floor(C/60),D=Math.floor(T/60),L=Math.floor(E/7),z=Math.floor(E/365);return z>0?`${z} year${z>1?"s":""} ago`:L>0?`${L} week${L>1?"s":""} ago`:E>0?`${E} day${E>1?"s":""} ago`:D>0?`${D} hour${D>1?"s":""} ago`:T>0?`${T} minute${T>1?"s":""} ago`:"Just now"};return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading followers..."]})}):u?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load followers"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),e.jsxs("button",{onClick:g,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):a.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user has no followers."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Avatar"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Username"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Last Post"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"HP"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Vote Value"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Manage"})]})}),e.jsx("tbody",{children:a.map((j,y)=>{const m=o.find(E=>E.name===j.follower),_=v(j.follower);return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.follower),alt:j.follower,className:"w-12 h-12 rounded-full object-cover cursor-pointer",onClick:()=>r&&r(j.follower),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.follower}&background=random`}})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>r&&r(j.follower),children:["@",j.follower]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),_?.about&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:_.about})]}),e.jsx("td",{className:"py-4 px-4",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:N(m.last_root_post)}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Never"})}),e.jsx("td",{className:"py-4 px-4",children:m?e.jsx(Kc,{vestingShares:m.vesting_shares}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:d[j.follower]?e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["$",d[j.follower]]}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"relative",ref:b===j.follower?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.follower?null:j.follower),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),b===j.follower&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.follower),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-4 h-4"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.follower),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-4 h-4"}),"Follow"]})]})]})})]},`${j.follower}-${y}`)})})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:a.map((j,y)=>{const m=o.find(E=>E.name===j.follower),_=v(j.follower);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.follower),alt:j.follower,className:"w-10 h-10 rounded-full object-cover cursor-pointer flex-shrink-0",onClick:()=>r&&r(j.follower),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.follower}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 text-sm",onClick:()=>r&&r(j.follower),children:["@",j.follower]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?N(m.last_root_post):e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"Never"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx("div",{className:"flex items-center gap-4",children:m&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:e.jsx(Kc,{vestingShares:m.vesting_shares})})}),e.jsxs("div",{className:"relative",ref:b===j.follower?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.follower?null:j.follower),className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),b===j.follower&&e.jsxs("div",{className:"absolute right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.follower),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-3 h-3"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.follower),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-3 h-3"}),"Follow"]})]})]})]})]})]})},`${j.follower}-${y}`)})})]})},Qc=({vestingShares:t})=>{const[r,n]=k.useState("...");return k.useEffect(()=>{(async()=>{try{const a=await Ee.convertVestingSharesToHive(t);n(a)}catch(a){console.error("Error calculating HP:",a);const i=parseFloat(t.split(" ")[0]);n((i/1e6).toFixed(3))}})()},[t]),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[r," HP"]})},_g=({username:t,onClickAuthor:r,onClickAddRemoveFromLists:n,onClickUnfollow:s})=>{const[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState({}),[l,h]=k.useState(!0),[u,p]=k.useState(null),[b,w]=k.useState(null),x=k.useRef(null),g=async()=>{try{h(!0),p(null);const j=await Ee.getFollowing(t);if(i(j),j.length>0){const y=j.map(E=>E.following),m=await Ee.getAccounts(y);c(m);const _={};for(const E of j)try{const A=await Ee.getVoteValue(E.following);_[E.following]=A}catch(A){console.warn(`Failed to get voting data for ${E.following}:`,A),_[E.following]="0.00"}f(_)}}catch(j){p(j instanceof Error?j.message:"Failed to load following data")}finally{h(!1)}};k.useEffect(()=>{g()},[t]),k.useEffect(()=>{const j=y=>{x.current&&!x.current.contains(y.target)&&w(null)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const v=j=>{const y=o.find(m=>m.name===j);if(!y)return null;try{return JSON.parse(y.posting_json_metadata)?.profile||{}}catch{return{}}},N=j=>{const y=new Date,m=new Date(j),_=y.getTime()-m.getTime(),E=Math.floor(_/(1e3*60*60*24));if(Math.floor(E/30)>=1)return m.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});const C=Math.floor(_/1e3),T=Math.floor(C/60),D=Math.floor(T/60),L=Math.floor(E/7),z=Math.floor(E/365);return z>0?`${z} year${z>1?"s":""} ago`:L>0?`${L} week${L>1?"s":""} ago`:E>0?`${E} day${E>1?"s":""} ago`:D>0?`${D} hour${D>1?"s":""} ago`:T>0?`${T} minute${T>1?"s":""} ago`:"Just now"};return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following..."]})}):u?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),e.jsxs("button",{onClick:g,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):a.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Avatar"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Username"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Last Post"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"HP"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Vote Value"}),e.jsx("th",{className:"text-left py-3 px-4 font-semibold text-gray-900 dark:text-white",children:"Manage"})]})}),e.jsx("tbody",{children:a.map((j,y)=>{const m=o.find(E=>E.name===j.following),_=v(j.following);return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.following),alt:j.following,className:"w-12 h-12 rounded-full object-cover cursor-pointer",onClick:()=>r&&r(j.following),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.following}&background=random`}})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>r&&r(j.following),children:["@",j.following]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),_?.about&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:_.about})]}),e.jsx("td",{className:"py-4 px-4",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:N(m.last_root_post)}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Never"})}),e.jsx("td",{className:"py-4 px-4",children:m?e.jsx(Qc,{vestingShares:m.vesting_shares}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:d[j.following]?e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["$",d[j.following]]}):e.jsx("span",{className:"text-sm text-gray-400 dark:text-gray-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"relative",ref:b===j.following?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.following?null:j.following),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),b===j.following&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.following),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-4 h-4"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.following),w(null)},className:"w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-4 h-4"}),"Unfollow"]})]})]})})]},`${j.following}-${y}`)})})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:a.map((j,y)=>{const m=o.find(E=>E.name===j.following),_=v(j.following);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:_?.profile_image||Ee.userAvatar(j.following),alt:j.following,className:"w-10 h-10 rounded-full object-cover cursor-pointer flex-shrink-0",onClick:()=>r&&r(j.following),onError:E=>{E.target.src=`https://ui-avatars.com/api/?name=${j.following}&background=random`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 text-sm",onClick:()=>r&&r(j.following),children:["@",j.following]}),_?.location&&e.jsxs("div",{className:"relative group",children:[e.jsx(O.MapPin,{className:"w-3 h-3 text-gray-500 dark:text-gray-400"}),e.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10",children:_.location})]})]}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:m?.last_post&&m.last_post!=="1970-01-01T00:00:00"?N(m.last_root_post):e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"Never"})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsx("div",{className:"flex items-center gap-4",children:m&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:e.jsx(Qc,{vestingShares:m.vesting_shares})})}),e.jsxs("div",{className:"relative",ref:b===j.following?x:null,children:[e.jsx("button",{onClick:()=>w(b===j.following?null:j.following),className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(O.MoreVertical,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),b===j.following&&e.jsxs("div",{className:"absolute right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10",children:[e.jsxs("button",{onClick:()=>{n&&n(j.following),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserPlus,{className:"w-3 h-3"}),"Add/remove from lists"]}),e.jsxs("button",{onClick:()=>{s&&s(j.following),w(null)},className:"w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center gap-2",children:[e.jsx(O.UserMinus,{className:"w-3 h-3"}),"Unfollow"]})]})]})]})]})]})},`${j.following}-${y}`)})})]})},ed=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class kg{async getAccountHistory(r,n=-1,s=1e3,a,i){try{const o=[r,n,s];return a!==void 0&&i!==void 0&&o.push(a,i),(await ed.call("condenser_api","get_account_history",o)).map(([d,f])=>({index:d,block:f.block,op:{type:f.op[0],value:f.op[1]},op_in_trx:f.op_in_trx,timestamp:f.timestamp,trx_id:f.trx_id,trx_in_block:f.trx_in_block,virtual_op:f.virtual_op}))}catch(o){return console.error("Error fetching account history:",o),[]}}async getNextAccountHistoryPage(r,n,s=1e3){try{const a=n-1;return(await ed.call("condenser_api","get_account_history",[r,a,s])).map(([c,d])=>({index:c,block:d.block,op:{type:d.op[0],value:d.op[1]},op_in_trx:d.op_in_trx,timestamp:d.timestamp,trx_id:d.trx_id,trx_in_block:d.trx_in_block,virtual_op:d.virtual_op})).filter(c=>c.index<n)}catch(a){return console.error("Error fetching next page of account history:",a),[]}}convertToActivityListItems(r,n){return r.filter(s=>{const a=s.op.type;return a!=="effective_comment_vote"&&a!=="witness_set_properties"&&a!=="producer_reward"&&a!=="comment_reward"&&a!=="comment_payout_update"&&a!=="claim_reward_balance"&&a!=="transfer"&&a!=="claim_account"&&a!=="transfer_to_vesting"&&a!=="transfer_to_vesting_completed"}).map(s=>{const a=this.parseOperation(s,n);return{id:`${s.index}-${s.trx_id}`,type:a.type,direction:a.direction,timestamp:s.timestamp,block:s.block,description:a.description,details:s.op.value,index:s.index,...a.extraFields}}).filter(s=>s!==null)}parseOperation(r,n){const{op:s}=r,a=s.type,i=s.value;switch(a){case"vote":return this.parseVoteOperation(i,n);case"comment":return this.parseCommentOperation(i,n);case"custom_json":return this.parseCustomJsonOperation(i,n);case"comment_options":return this.parseCommentOptionsOperation(i,n);case"effective_comment_vote":return this.parseEffectiveCommentVoteOperation(i,n);case"curation_reward":return this.parseCurationRewardOperation(i,n);case"author_reward":return this.parseAuthorRewardOperation(i,n);case"comment_benefactor_reward":return this.parseCommentBenefactorRewardOperation(i,n);default:return{type:"other",direction:"out",description:`${a} operation`,extraFields:{}}}}parseVoteOperation(r,n){const{voter:s,author:a,permlink:i,weight:o}=r,c=a===n,d=c?"in":"out",f=(o/100).toFixed(0);let l="";return c?l=`${s} voted ${a}/${i} with ${f}%`:l=`Voted ${a}/${i} with ${f}%`,{type:"vote",direction:d,description:l,extraFields:{voter:s,author:a,permlink:i,weight:parseInt(f)}}}parseCommentOperation(r,n){const{author:s,parent_author:a,parent_permlink:i,permlink:o}=r,d=a===n?"in":"out",l=`Commented on ${i} by ${a||s}.`;return{type:"comment",direction:d,description:l,extraFields:{author:s,permlink:o,parent_author:a,parent_permlink:i}}}parseCustomJsonOperation(r,n){const{id:s,json:a,required_auths:i,required_posting_auths:o}=r;let c={};try{c=JSON.parse(a)}catch{}let d="Custom Json";if(s==="follow"){const[f,l]=c;f==="follow"&&(d="Custom Json")}return{type:"custom_json",direction:"out",description:d,extraFields:{}}}parseCommentOptionsOperation(r,n){const{author:s,permlink:a,max_accepted_payout:i}=r;return{type:"comment_options",direction:"out",description:"Comment Payout Update",extraFields:{author:s,permlink:a,payout:i}}}parseEffectiveCommentVoteOperation(r,n){const{voter:s,author:a,permlink:i,pending_payout:o}=r,c=a===n,d=c?"in":"out",f=c?`${s} voted on ${a}/${i} (effective vote)`:`Effective vote on ${a}/${i}`;return{type:"effective_comment_vote",direction:d,description:f,extraFields:{voter:s,author:a,permlink:i,payout:o}}}parseCurationRewardOperation(r,n){const{author:s,curator:a,permlink:i,reward:o}=r,d=a===n?"in":"out",h=`${(parseFloat(o.split(" ")[0])*1e-6).toFixed(3)} HP`,u=`Curation reward for ${a}/${i} by ${s}`;return{type:"curation_reward",direction:d,description:u,extraFields:{author:s,curator:a,permlink:i,reward:h}}}parseAuthorRewardOperation(r,n){const{author:s,permlink:a,hbd_payout:i,hive_payout:o,vesting_payout:c}=r,f=s===n?"in":"out",h=(parseFloat(c.split(" ")[0])*1e-6).toFixed(3),u=i.split(" ")[0],p=o.split(" ")[0],b=`Author reward: ${u} HBD, ${p} HIVE, ${h} HP for ${a}`;return{type:"author_reward",direction:f,description:b,extraFields:{author:s,permlink:a,hbd_payout:i,hive_payout:o,vesting_payout:c}}}parseCommentBenefactorRewardOperation(r,n){const{author:s,benefactor:a,permlink:i,hbd_payout:o,hive_payout:c,vesting_payout:d}=r,l=a===n?"in":"out",u=(parseFloat(d.split(" ")[0])*1e-6).toFixed(3),p=o.split(" ")[0],b=c.split(" ")[0],w=`Benefactor reward on ${i} by ${s}: ${p} HBD, ${b} HIVE, ${u} HP`;return{type:"comment_benefactor_reward",direction:l,description:w,extraFields:{author:s,benefactor:a,permlink:i,hbd_payout:o,hive_payout:c,vesting_payout:d}}}filterByDirection(r,n){return n==="all"?r:r.filter(s=>s.direction===n)}filterByGeneralType(r,n){if(n==="all")return r;switch(n){case"votes":return r.filter(s=>s.type==="vote"||s.type==="effective_comment_vote");case"comments":return r.filter(s=>s.type==="comment");case"replies":return r.filter(s=>s.type==="comment"&&s.direction==="in");case"others":return r.filter(s=>s.type==="custom_json"||s.type==="comment_options"||s.type==="other");default:return r}}filterByRewardType(r,n){if(n==="all")return r;switch(n){case"author":return r.filter(s=>s.type==="effective_comment_vote"&&s.direction==="in");case"curation":return r.filter(s=>s.type==="effective_comment_vote"&&s.direction==="out");case"benefactor":return r.filter(s=>s.type==="comment_options"&&s.details?.beneficiaries);default:return r}}searchActivities(r,n){if(!n.trim())return r;const s=n.toLowerCase();return r.filter(a=>a.description.toLowerCase().includes(s)||a.author?.toLowerCase().includes(s)||a.permlink?.toLowerCase().includes(s)||a.voter?.toLowerCase().includes(s))}getRelativeTime(r){try{const n=new Date(r),a=new Date().getTime()-n.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),c=Math.floor(o/60),d=Math.floor(c/24);return i<60?`${i} seconds ago`:o<60?`${o} minutes ago`:c<24?`${c} hours ago`:d<7?`${d} days ago`:n.toLocaleDateString()}catch(n){return console.error("Error calculating relative time:",n),r}}}const Ea=new kg,g0=({username:t,directionFilter:r="all",generalFilter:n="all",rewardFilter:s="all",searchTerm:a="",limit:i=1e3,className:o,onClickPermlink:c,onSelectActivity:d})=>{const[f,l]=k.useState(a),[h,u]=k.useState(r),[p,b]=k.useState(n),[w,x]=k.useState(s),[g,v]=k.useState([]),[N,j]=k.useState([]),[y,m]=k.useState(!1),[_,E]=k.useState(null),[A,C]=k.useState(new Set),[T,D]=k.useState(null),[L,z]=k.useState(!0),[U,H]=k.useState(!1),[F,Y]=k.useState(-1),G=k.useRef(null),ne=async(q=!1)=>{if(t){q?H(!0):(m(!0),z(!0),Y(-1)),E(null);try{let B;q?B=await Ea.getNextAccountHistoryPage(t,F,i):B=await Ea.getAccountHistory(t,-1,i);const pe=Ea.convertToActivityListItems(B,t);if(pe.sort((ee,te)=>new Date(te.timestamp).getTime()-new Date(ee.timestamp).getTime()),v(q?ee=>[...ee,...pe]:pe),B.length>0){const ee=Math.min(...B.map(te=>te.index));Y(ee)}pe.length===0&&z(!1)}catch(B){E("Failed to load activity history"),console.error("Error loading activities:",B),z(!1)}finally{m(!1),H(!1)}}};k.useEffect(()=>{ne()},[t,i]);const ie=k.useCallback(()=>{L&&!y&&!U&&ne(!0)},[L,y,U]);k.useEffect(()=>{let q=g;h!=="all"?q=q.filter(B=>B.direction===h):q=q.filter(B=>B.type!=="custom_json"&&B.type!=="comment_options"),p!=="all"&&(p==="votes"?q=q.filter(B=>B.type==="vote"||B.type==="effective_comment_vote"):p==="comments"?q=q.filter(B=>B.type==="comment"):p==="replies"?q=q.filter(B=>B.type==="comment"&&B.direction==="in"):p==="curation"?q=q.filter(B=>B.type==="curation_reward"):p==="others"&&(q=g.filter(B=>B.type==="custom_json"||B.type==="comment_options"))),w!=="all"&&(w==="author"?q=q.filter(B=>B.type==="effective_comment_vote"&&B.direction==="in"):w==="curation"?q=q.filter(B=>B.type==="effective_comment_vote"&&B.direction==="out"):w==="benefactor"&&(q=q.filter(B=>B.type==="comment_options"))),f&&(q=q.filter(B=>B.description.toLowerCase().includes(f.toLowerCase())||B.author?.toLowerCase().includes(f.toLowerCase())||B.permlink?.toLowerCase().includes(f.toLowerCase()))),j(q)},[g,h,p,w,f]),k.useEffect(()=>{const q=B=>{G.current&&!G.current.contains(B.target)&&D(null)};return document.addEventListener("mousedown",q),()=>{document.removeEventListener("mousedown",q)}},[]);const xe=q=>{switch(q.type){case"vote":case"effective_comment_vote":return e.jsx(O.Wallet,{className:"h-4 w-4"});case"comment":return e.jsx(O.MessageCircle,{className:"h-4 w-4"});case"custom_json":return e.jsx(O.FileText,{className:"h-4 w-4"});case"curation_reward":return e.jsx(O.Wallet,{className:"h-4 w-4"});case"author_reward":return e.jsx(O.DollarSign,{className:"h-4 w-4"});case"comment_benefactor_reward":return e.jsx(O.User,{className:"h-4 w-4"});default:return e.jsx(O.Eye,{className:"h-4 w-4"})}},V=(q,B)=>q.split(/(\s+)/).map((ee,te)=>{if(ee.includes("/")){const[_e,Ie]=ee.split("/");if(_e&&Ie)return e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:K=>{K.stopPropagation(),console.log("Clicked permlink:",_e,Ie),c?.(_e,Ie)},children:ee},te)}return e.jsx("span",{children:ee},te)});return y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"}),e.jsx("div",{className:"w-full h-10 bg-gray-200 dark:bg-gray-700 rounded-md animate-pulse"})]})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from({length:5}).map((q,B)=>e.jsx("div",{className:"w-24 h-10 bg-gray-200 dark:bg-gray-700 rounded-md animate-pulse"},B))})]}),e.jsx("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Array.from({length:4}).map((q,B)=>e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-20"},B))})]}),e.jsx("div",{className:"space-y-4",children:Array.from({length:5}).map((q,B)=>e.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0 space-y-2",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-3/4"})})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("div",{className:"w-3 h-3 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-16"})]})]},B))})]}):_?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load activities"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:_}),e.jsxs("button",{onClick:()=>ne(),className:"inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search activities...",value:f,onChange:q=>l(q.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("select",{value:h,onChange:q=>u(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Directions"}),e.jsx("option",{value:"in",children:"Incoming"}),e.jsx("option",{value:"out",children:"Outgoing"})]}),e.jsxs("select",{value:p,onChange:q=>b(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"votes",children:"Votes"}),e.jsx("option",{value:"comments",children:"Comments"}),e.jsx("option",{value:"replies",children:"Replies"}),e.jsx("option",{value:"curation",children:"Curation"}),e.jsx("option",{value:"others",children:"Others"})]}),e.jsxs("select",{value:w,onChange:q=>x(q.target.value),className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm",children:[e.jsx("option",{value:"all",children:"All Rewards"}),e.jsx("option",{value:"author",children:"Author"}),e.jsx("option",{value:"curation",children:"Curation"}),e.jsx("option",{value:"benefactor",children:"Benefactor"})]}),e.jsx("button",{onClick:()=>ne(),disabled:y||U,className:"px-3 py-2 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Total: ",e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:g.length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Filtered: ",e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:N.length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Incoming: ",e.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:g.filter(q=>q.direction==="in").length})]}),e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Outgoing: ",e.jsx("span",{className:"font-semibold text-blue-600 dark:text-blue-400",children:g.filter(q=>q.direction==="out").length})]})]})]}),e.jsx("div",{className:"space-y-4",children:N.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:g.length===0?"No activities found for this user.":"No activities match the current filters."})}):e.jsxs(e.Fragment,{children:[N.map((q,B)=>e.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors cursor-pointer",onClick:pe=>{d?.(q)},children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[q.type==="vote"&&q.voter?e.jsx("img",{src:`https://images.hive.blog/u/${q.voter}/avatar`,alt:q.voter,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):q.type==="comment_benefactor_reward"&&q.author?e.jsx("img",{src:`https://images.hive.blog/u/${q.author}/avatar`,alt:q.author,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):q.type==="comment"&&q.author?e.jsx("img",{src:`https://images.hive.blog/u/${q.author}/avatar`,alt:q.author,className:"w-8 h-8 rounded-full flex-shrink-0",onError:pe=>{const ee=pe.target;ee.style.display="none";const te=ee.nextElementSibling;te&&(te.style.display="flex")}}):null,e.jsx("div",{className:`w-8 h-8 bg-purple-100 dark:bg-purple-900/20 rounded-full flex items-center justify-center flex-shrink-0 ${q.type==="vote"&&q.voter||q.type==="comment_benefactor_reward"&&q.author||q.type==="comment"&&q.author?"hidden":""}`,children:xe(q)}),e.jsx("div",{className:"flex-1 min-w-0",children:q.type==="custom_json"||q.type==="comment_options"?e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-900 dark:text-white break-words font-medium",children:V(q.description)}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:Ea.getRelativeTime(q.timestamp+"Z")}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-600 rounded p-2 bg-gray-50 dark:bg-gray-700/50 mt-1",children:e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 space-y-1 font-mono break-words",children:[q.type==="custom_json"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"id:"})," ",q.details.id]}),e.jsxs("div",{className:"break-all",children:[e.jsx("span",{className:"font-medium",children:"json:"})," ",JSON.stringify(q.details.json).replace(/\\\"/g,'"').replace(/^"|"$/g,"")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"required_auths:"})," ",JSON.stringify(q.details.required_auths)]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"required_posting_auths:"})," ",JSON.stringify(q.details.required_posting_auths)]})]}),q.type==="comment_options"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"author:"}),e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",children:q.details.author})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"permlink:"}),e.jsx("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:pe=>{pe.stopPropagation(),console.log("Clicked permlink:",q.details.author,q.details.permlink),c?.(q.details.author,q.details.permlink)},children:q.details.permlink})]})]})]})})]}):e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-900 dark:text-white break-words",children:V(q.description)}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 sm:hidden",children:Ea.getRelativeTime(q.timestamp+"Z")})]})})]}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 flex-shrink-0 ml-4 hidden sm:flex",children:q.type!=="custom_json"&&q.type!=="comment_options"&&e.jsxs(e.Fragment,{children:[e.jsx(O.Clock,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Ea.getRelativeTime(q.timestamp+"Z")})]})})]},`${q.id}-${B}`)),L&&g.length>0&&e.jsx("div",{className:"flex justify-center py-6",children:e.jsx("button",{onClick:ie,disabled:y||U,className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white rounded-lg font-medium transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:U?e.jsxs(e.Fragment,{children:[e.jsx(O.RefreshCw,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):"Load More Activities"})}),!L&&g.length>0&&e.jsx("div",{className:"text-center text-sm text-gray-400 py-4",children:"No more activities to load"})]})})]})},dn=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Eg{async getWitnessesByVote(r="",n=60){try{return await dn.call("condenser_api","get_witnesses_by_vote",[r,n])}catch(s){throw console.error("Error fetching witnesses by vote:",s),s}}async getAccount(r){try{const n=await dn.call("condenser_api","get_accounts",[[r]]);return n&&n.length>0?n[0]:null}catch(n){return console.error("Error fetching account:",n),null}}async getAccounts(r){try{return await dn.call("condenser_api","get_accounts",[r])}catch(n){return console.error("Error fetching accounts:",n),[]}}async getWitnessVotes(r,n="",s=250){try{return await dn.call("database_api","list_witness_votes",{start:[r,n],limit:s,order:"by_witness_account"})}catch(a){throw console.error("Error fetching witness votes:",a),a}}async getAllWitnessVotes(r){const n=[];let s="";try{for(;;){const i=await this.getWitnessVotes(r,s,250);if(n.push(...i.votes),i.votes.length<250)break;s=i.votes[i.votes.length-1].account}return n}catch(i){return console.error("Error fetching all witness votes:",i),[]}}async hasUserVotedForWitness(r,n){try{const s=await this.getAccount(r);return!s||!s.witness_votes?!1:s.witness_votes.includes(n)}catch(s){return console.error("Error checking witness vote:",s),!1}}async getUserWitnessVotes(r){try{return(await this.getAccount(r))?.witness_votes||[]}catch(n){return console.error("Error fetching user witness votes:",n),[]}}formatVotesToMHP(r){return`${(parseFloat(r)/1e6).toFixed(1)}m`}calculateAPR(r){return r/100}getVersionStatus(r,n){const s=this.parseVersion(r),a=this.parseVersion(n);return this.compareVersions(s,a)>=0?"green":this.compareVersions(s,a)<0?"red":"grey"}parseVersion(r){return r.split(".").map(n=>parseInt(n,10))}compareVersions(r,n){const s=Math.max(r.length,n.length);for(let a=0;a<s;a++){const i=r[a]||0,o=n[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}getWitnessDescription(r){try{let n;if(r.json_metadata&&r.json_metadata!=="{}"){n=JSON.parse(r.json_metadata);const s=n.profile?.witness_description;if(s)return s}return r.posting_json_metadata&&r.posting_json_metadata!=="{}"?(n=JSON.parse(r.posting_json_metadata),n.profile?.about||""):""}catch(n){return console.error("Error parsing witness description:",n),""}}formatTimeAgo(r){const n=new Date(r),a=Math.floor((new Date().getTime()-n.getTime())/1e3);if(a<60)return`${a} second${a>1?"s":""} ago`;if(a<3600){const i=Math.floor(a/60);return`${i} minute${i>1?"s":""} ago`}else if(a<86400){const i=Math.floor(a/3600);return`${i} hour${i>1?"s":""} ago`}else if(a<604800){const i=Math.floor(a/86400);return`${i} day${i>1?"s":""} ago`}else if(a<2592e3){const i=Math.floor(a/604800);return`${i} week${i>1?"s":""} ago`}else if(a<31536e3){const i=Math.floor(a/2592e3);return`${i} month${i>1?"s":""} ago`}else{const i=Math.floor(a/31536e3);return`${i} year${i>1?"s":""} ago`}}}const Nr=new Eg,Wt=nd.create((t,r)=>({witnesses:[],witnessVotes:[],userWitnessVotes:[],witnessDetails:new Map,witnessAccounts:new Map,loadingWitnesses:!1,loadingMoreWitnesses:!1,loadingVotes:!1,loadingMoreVotes:!1,loadingUserVotes:!1,error:null,nextWitnessStart:"",nextVotesStart:"",hasMoreWitnesses:!0,hasMoreVotes:!1,selectedWitness:null,filters:{status:"all",name:"",version:""},loadWitnesses:async(n="",s=50)=>{const{witnesses:a}=r();if(a.length>=500){t({hasMoreWitnesses:!1});return}t(n!==""?{loadingMoreWitnesses:!0}:{loadingWitnesses:!0,error:null});try{const o=await Nr.getWitnessesByVote(n,s);t(d=>{const f=new Set(d.witnesses.map(h=>h.owner)),l=o.filter(h=>!f.has(h.owner));return{witnesses:[...d.witnesses,...l],nextWitnessStart:o.length>0?o[o.length-1].owner:"",hasMoreWitnesses:o.length===s}});const c=o.filter(d=>!r().witnessDetails.has(d.owner)).map(d=>d.owner);c.length>0&&r().loadWitnessDetails(c)}catch(o){console.error("Error loading witnesses:",o),t({error:"Failed to load witnesses data"})}finally{t({loadingWitnesses:!1,loadingMoreWitnesses:!1})}},loadMoreWitnesses:async()=>{const{nextWitnessStart:n,hasMoreWitnesses:s,loadingMoreWitnesses:a}=r();!s||a||!n||await r().loadWitnesses(n,50)},loadWitnessVotes:async n=>{t({loadingVotes:!0,witnessVotes:[],nextVotesStart:"",hasMoreVotes:!1,selectedWitness:n});try{const s=await Nr.getWitnessVotes(n,"",250);t({witnessVotes:s.votes,nextVotesStart:s.votes.length>0?s.votes[s.votes.length-1].account:"",hasMoreVotes:s.votes.length===250,loadingVotes:!1})}catch(s){console.error("Error loading witness votes:",s),t({error:"Failed to load witness votes",loadingVotes:!1})}},loadMoreVotes:async()=>{const{hasMoreVotes:n,loadingMoreVotes:s,nextVotesStart:a,selectedWitness:i,witnessVotes:o}=r();if(!n||s||!a||o.length>=1e3){o.length>=1e3&&t({hasMoreVotes:!1});return}t({loadingMoreVotes:!0});try{const c=await Nr.getWitnessVotes(i||"",a,250);t(d=>{const l=[...d.witnessVotes,...c.votes].filter((u,p,b)=>b.findIndex(w=>w.account===u.account)===p),h=c.votes.filter((u,p,b)=>b.findIndex(w=>w.account===u.account)===p);return{witnessVotes:l,nextVotesStart:h.length>0?h[h.length-1].account:"",hasMoreVotes:c.votes.length===250}})}catch(c){console.error("Error loading more witness votes:",c)}finally{t({loadingMoreVotes:!1})}},loadUserWitnessVotes:async n=>{if(n){t({loadingUserVotes:!0});try{const s=await Nr.getUserWitnessVotes(n);t({userWitnessVotes:s})}catch(s){console.error("Error loading user witness votes:",s)}finally{t({loadingUserVotes:!1})}}},loadWitnessDetails:async n=>{try{const s=await Nr.getAccounts(n);t(a=>{const i=new Map(a.witnessDetails),o=new Map(a.witnessAccounts);return s.forEach(c=>{const d=Nr.getWitnessDescription(c);d&&i.set(c.name,d),o.set(c.name,c)}),{witnessDetails:i,witnessAccounts:o}})}catch(s){console.error("Error loading witness details:",s)}},setFilters:n=>t({filters:n}),setSelectedWitness:n=>t({selectedWitness:n}),clearVotes:()=>t({witnessVotes:[],nextVotesStart:"",hasMoreVotes:!1,selectedWitness:null})})),td=({filters:t,onFiltersChange:r,theme:n="dark"})=>{const s=n==="dark"?"text-blue-400 hover:text-blue-300":"text-blue-600 hover:text-blue-800",a=c=>{const d=t.status===c?"all":c;r({...t,status:d})},i=c=>{r({...t,name:c})},o=c=>{r({...t,version:c})};return e.jsxs("div",{className:`rounded-lg p-4 mb-6 border ${n==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsx("h3",{className:`text-lg font-semibold mb-4 ${n==="dark"?"text-white":"text-gray-900"}`,children:"FILTERS"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${n==="dark"?"text-gray-300":"text-gray-700"}`,children:"WITNESS"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="active",onChange:()=>a("active"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${n==="dark"?"text-white":"text-gray-900"}`,children:"Active"})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="disabled",onChange:()=>a("disabled"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${n==="dark"?"text-white":"text-gray-900"}`,children:"Disabled/Stale"})]}),e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.status==="approved",onChange:()=>a("approved"),className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsx("span",{className:`${n==="dark"?"text-white":"text-gray-900"}`,children:"Approved"})]}),t.status!=="all"&&e.jsx("button",{onClick:()=>r({...t,status:"all"}),className:`text-sm underline ${s}`,children:"Clear Status Filter"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${n==="dark"?"text-gray-300":"text-gray-700"}`,children:"NAME"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:`w-4 h-4 ${n==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),e.jsx("input",{type:"text",placeholder:"Search",value:t.name,onChange:c=>i(c.target.value),className:`w-full pl-10 pr-4 py-2 border-b focus:outline-none focus:border-blue-500 ${n==="dark"?"bg-slate-900 border-gray-700 text-white placeholder-gray-400":"bg-gray-50 border-gray-300 text-gray-900 placeholder-gray-500"}`})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:`text-sm font-medium mb-3 ${n==="dark"?"text-gray-300":"text-gray-700"}`,children:"VERSION"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:`w-4 h-4 ${n==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),e.jsx("input",{type:"text",placeholder:"Version",value:t.version,onChange:c=>o(c.target.value),className:`w-full pl-10 pr-4 py-2 border-b focus:outline-none focus:border-blue-500 ${n==="dark"?"bg-slate-900 border-gray-700 text-white placeholder-gray-400":"bg-gray-50 border-gray-300 text-gray-900 placeholder-gray-500"}`})]})]})]})},ro=768;function $o(){const[t,r]=vn.useState(void 0);return vn.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ro-1}px)`),s=()=>{r(window.innerWidth<ro)};return n.addEventListener("change",s),r(window.innerWidth<ro),()=>n.removeEventListener("change",s)},[]),!!t}const Ag=({isOpen:t,onClose:r,witness:n,votes:s,loadingMore:a,hasMore:i,loadingInitial:o,scrollContainerRef:c,sentinelRef:d,loadMoreVotes:f,theme:l="dark"})=>{const h=k.useCallback(u=>{u[0].isIntersecting&&i&&!a&&f()},[i,a,f]);return k.useEffect(()=>{const u=new IntersectionObserver(h,{threshold:.1,root:c.current});return d.current&&u.observe(d.current),()=>{d.current&&u.unobserve(d.current)}},[h,c,d]),t?e.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`rounded-lg max-w-2xl w-full max-h-[80vh] overflow-hidden border ${l==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${l==="dark"?"border-gray-800":"border-gray-200"}`,children:[e.jsxs("h3",{className:`text-lg font-semibold ${l==="dark"?"text-white":"text-gray-900"}`,children:["Votes for @",n," (showing ",s.length,")"]}),e.jsx("button",{onClick:r,className:`text-xl font-bold ${l==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,children:"×"})]}),e.jsxs("div",{ref:c,className:"p-4 overflow-y-auto max-h-[60vh]",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map((u,p)=>e.jsxs("div",{className:`flex items-center space-x-3 p-3 rounded-lg border ${l==="dark"?"bg-gray-800 border-gray-800":"bg-gray-50 border-gray-200"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium ${l==="dark"?"bg-gray-600 text-white":"bg-gray-200 text-gray-900"}`,children:e.jsx("img",{className:"w-8 h-8 rounded-full",src:`https://images.hive.blog/u/${u.account}/avatar`,alt:u.account,onError:b=>{b.target.src="https://images.hive.blog/u/null/avatar"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`font-medium ${l==="dark"?"text-white":"text-gray-900"}`,children:u.account}),e.jsxs("div",{className:`text-sm ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:["Vote #",p+1]})]}),e.jsx("div",{className:`text-sm ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"25"})]},u.account))}),s.length===0&&!o&&e.jsx("div",{className:`text-center py-8 ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"No votes found for this witness."}),a&&e.jsx("div",{className:`text-center py-4 ${l==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more votes..."}),i&&!a&&e.jsx("div",{className:"text-center py-4",children:e.jsx("button",{onClick:f,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",children:"Load More Votes"})}),i&&e.jsx("div",{ref:d,className:"h-4"})]})]})}):null},Sg=({username:t,filters:r={status:"all",name:"",version:""},onWitnessVoteClick:n,onWitnessStatsClick:s,onWitnessUrlClick:a,theme:i="dark"})=>{const o=$o(),c=Wt(V=>V.witnesses),d=Wt(V=>V.userWitnessVotes),f=Wt(V=>V.loadingWitnesses),l=Wt(V=>V.error),h=Wt(V=>V.selectedWitness),u=Wt(V=>V.witnessVotes),p=Wt(V=>V.hasMoreVotes),b=Wt(V=>V.loadingMoreVotes),w=Wt(V=>V.loadingVotes),x=Wt(V=>V.filters),g=Wt(V=>V.hasMoreWitnesses),v=Wt(V=>V.loadingWitnesses),N=Wt(V=>V.witnessDetails);Wt(V=>V.witnessAccounts);const j=Wt(V=>V.loadWitnesses),y=Wt(V=>V.loadMoreWitnesses),m=Wt(V=>V.loadWitnessVotes),_=Wt(V=>V.loadMoreVotes),E=Wt(V=>V.loadUserWitnessVotes),A=Wt(V=>V.setFilters),[C,T]=k.useState(!1),[D,L]=k.useState(!1),z=k.useRef(null),U=k.useRef(null),H=k.useRef(null),F=k.useCallback(V=>{V[0].isIntersecting&&g&&!v&&y()},[g,v,y]);k.useEffect(()=>{const V=new IntersectionObserver(F,{threshold:.1});return H.current&&V.observe(H.current),()=>{H.current&&V.unobserve(H.current)}},[F]),k.useEffect(()=>{j()},[j]),k.useEffect(()=>{t&&E(t)},[t,E]),k.useEffect(()=>{A(r)},[]);const Y=k.useMemo(()=>c.filter(V=>{if(x.status!=="all"){if(x.status==="active"){const q=new Date;if(q.setFullYear(q.getFullYear()-1),new Date(V.last_hbd_exchange_update+"Z")<=q)return!1}else if(x.status==="disabled"){const q=new Date;if(q.setFullYear(q.getFullYear()-1),new Date(V.last_hbd_exchange_update+"Z")>q)return!1}else if(x.status==="approved"&&!d.includes(V.owner))return!1}return!(x.name&&!V.owner.toLowerCase().includes(x.name.toLowerCase())||x.version&&!V.running_version.includes(x.version))}),[c,x,d]),G=async V=>{n?n(V):(await m(V),T(!0))},ne=V=>{s?s(V):window.open(`https://hivehub.dev/witnesses/@${V}`,"_blank")},ie=V=>{a?a(V):window.open(V,"_blank")},xe=V=>t?d.includes(V):!1;return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"})}):l?e.jsx("div",{className:"text-center p-8 text-red-400",children:l}):e.jsxs("div",{className:"w-full",children:[e.jsx(Ag,{isOpen:C,onClose:()=>T(!1),witness:h||"",votes:u,loadingMore:b,hasMore:p,loadingInitial:w,scrollContainerRef:U,sentinelRef:z,loadMoreVotes:_,theme:i}),o?e.jsxs("div",{className:`w-full p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:`text-lg font-semibold ${i==="dark"?"text-white":"text-gray-900"}`,children:"Witnesses"}),e.jsxs("button",{onClick:()=>L(!D),className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded flex items-center space-x-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),e.jsx("span",{children:D?"Hide Filters":"Show Filters"})]})]}),D&&e.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`rounded-lg w-full max-w-md max-h-[80vh] overflow-hidden border ${i==="dark"?"bg-slate-950 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:`flex items-center justify-between p-4 border-b ${i==="dark"?"border-gray-800":"border-gray-200"}`,children:[e.jsx("h3",{className:`text-lg font-semibold ${i==="dark"?"text-white":"text-gray-900"}`,children:"Filters"}),e.jsx("button",{onClick:()=>L(!1),className:`text-xl font-bold ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,children:"×"})]}),e.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:e.jsx(td,{filters:x,onFiltersChange:A,theme:i})})]})}),e.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto",children:[Y.map((V,q)=>{const B=Nr.getVersionStatus(V.running_version,V.hardfork_version_vote),pe=xe(V.owner),ee=c.findIndex(te=>te.owner===V.owner)+1;return e.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${i==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("span",{className:`text-lg font-bold ${i==="dark"?"text-white":"text-gray-900"}`,children:["#",ee]}),e.jsx("img",{className:"w-10 h-10 rounded-full",src:`https://images.hive.blog/u/${V.owner}/avatar`,alt:V.owner,onError:te=>{te.target.src="https://images.hive.blog/u/null/avatar"}}),e.jsxs("div",{children:[e.jsx("div",{className:`font-medium ${i==="dark"?"text-white":"text-gray-900"}`,children:V.owner}),e.jsxs("div",{className:`text-xs ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["Since ",new Date(V.created).getFullYear()]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{className:`w-6 h-6 ${pe?"text-green-600":i==="dark"?"text-gray-500":"text-gray-400"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex space-x-1",children:[e.jsx("button",{onClick:()=>ie(V.url),className:`${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"Visit witness URL",children:"🔗"}),e.jsx("button",{onClick:()=>ne(V.owner),className:`${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"View witness stats",children:"📊"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Version"}),e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium mt-1 block ${B==="green"?"bg-green-100 text-green-800":B==="red"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:V.running_version})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Votes (MHP)"}),e.jsx("button",{onClick:()=>G(V.owner),className:"text-blue-600 hover:text-blue-800 cursor-pointer text-sm font-medium mt-1",disabled:w,children:w&&h===V.owner?"Loading...":Nr.formatVotesToMHP(V.votes)})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`text-xs uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"APR"}),e.jsxs("div",{className:`font-medium mt-1 ${i==="dark"?"text-white":"text-gray-900"}`,children:[Nr.calculateAPR(V.props.hbd_interest_rate),"%"]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-xs",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Last Block"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.last_confirmed_block_num.toLocaleString()})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Miss"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.total_missed.toLocaleString()})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`uppercase ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Price Feed"}),e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.hbd_exchange_rate.base}),e.jsx("div",{className:`${i==="dark"?"text-gray-400":"text-gray-500"}`,children:Nr.formatTimeAgo(V.last_hbd_exchange_update+"Z")})]})]}),N.get(V.owner)&&e.jsx("div",{className:`mt-3 pt-3 border-t ${i==="dark"?"border-gray-800":"border-gray-200"}`,children:e.jsx("div",{className:`text-xs line-clamp-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:N.get(V.owner)})})]},V.owner)}),v&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more witnesses..."})]}),g&&e.jsx("div",{ref:H,className:"h-1"})]})]}):e.jsx("div",{className:`max-w-7xl mx-auto p-2 ${i==="dark"?"bg-slate-950":"bg-white"}`,children:e.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[e.jsx("div",{className:"col-span-1 sticky top-0 h-screen overflow-y-auto",children:e.jsx(td,{filters:x,onFiltersChange:A,theme:i})}),e.jsxs("div",{className:"col-span-4 overflow-auto max-h-screen",children:[e.jsxs("table",{className:`w-full text-xs text-left ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:[e.jsx("thead",{className:`text-xs uppercase ${i==="dark"?"text-gray-400 bg-slate-900":"text-gray-700 bg-gray-50"}`,children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Rank"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Witness"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Version"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Votes"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Last Block"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Miss"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Feed"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"APR"}),e.jsx("th",{scope:"col",className:"px-2 py-2",children:"Vote"})]})}),e.jsx("tbody",{children:Y.map((V,q)=>{const B=Nr.getVersionStatus(V.running_version,V.hardfork_version_vote),pe=xe(V.owner);return e.jsxs("tr",{className:`border-b hover:bg-gray-50 ${i==="dark"?"border-gray-800 hover:bg-gray-800":"border-gray-200"}`,children:[e.jsx("td",{className:`px-2 py-2 font-medium text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:c.findIndex(ee=>ee.owner===V.owner)+1}),e.jsx("td",{className:"px-2 py-2",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("img",{className:"w-6 h-6 rounded-full",src:`https://images.hive.blog/u/${V.owner}/avatar`,alt:V.owner,onError:ee=>{ee.target.src="https://images.hive.blog/u/null/avatar"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`font-medium text-xs truncate ${i==="dark"?"text-white":"text-gray-900"}`,children:V.owner}),e.jsxs("div",{className:`text-xs ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:["Since ",new Date(V.created).getFullYear()]})]}),e.jsxs("div",{className:"flex space-x-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>ie(V.url),className:`text-xs ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"Visit witness URL",children:"🔗"}),e.jsx("button",{onClick:()=>ne(V.owner),className:`text-xs ${i==="dark"?"text-gray-400 hover:text-white":"text-gray-500 hover:text-gray-900"}`,title:"View witness stats",children:"📊"})]})]})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("span",{className:`px-1 py-0.5 rounded text-xs font-medium ${B==="green"?"bg-green-100 text-green-800":B==="red"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:V.running_version})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("button",{onClick:()=>G(V.owner),className:"text-blue-600 hover:text-blue-800 cursor-pointer text-xs",disabled:w,children:w&&h===V.owner?"...":Nr.formatVotesToMHP(V.votes)})}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx("div",{className:`text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:V.last_confirmed_block_num.toLocaleString()})}),e.jsx("td",{className:"px-2 py-2 text-right text-xs",children:e.jsx("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:V.total_missed.toLocaleString()})}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx("div",{className:`text-xs ${i==="dark"?"text-white":"text-gray-900"}`,children:V.hbd_exchange_rate.base})}),e.jsx("td",{className:"px-2 py-2 text-right text-xs",children:e.jsxs("div",{className:`${i==="dark"?"text-white":"text-gray-900"}`,children:[Nr.calculateAPR(V.props.hbd_interest_rate),"%"]})}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("svg",{className:`w-4 h-4 ${pe?"text-green-600":i==="dark"?"text-gray-500":"text-gray-400"}`,fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})})]},V.owner)})})]}),v&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:`ml-2 ${i==="dark"?"text-gray-400":"text-gray-500"}`,children:"Loading more witnesses..."})]}),g&&e.jsx("div",{ref:H,className:"h-1"})]})]})})]})},Cg=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Tg{async getTransactionHistory(r,n=-1,s=1e3,a=null,i=null){try{const o=[r,n,s];a!==null&&i!==null&&o.push(a,i);const c=await Cg.call("condenser_api","get_account_history",o);return Array.isArray(c)?c.map(d=>Array.isArray(d)&&d.length>=2?d[1]:d):[]}catch(o){return console.error("Error in getTransactionHistory:",o),[]}}async getFilteredTransactionHistory(r,n=[],s=100){try{const a=await this.getTransactionHistory(r,-1,1e3);let i=a;return n.length>0&&(i=a.filter(o=>{const c=o.op?.[0];return n.includes(c)})),i.slice(0,s)}catch(a){return console.error("Error in getFilteredTransactionHistory:",a),[]}}async getRecentTransfers(r,n=50){return this.getFilteredTransactionHistory(r,["transfer"],n)}async getRecentVotes(r,n=50){return this.getFilteredTransactionHistory(r,["vote"],n)}async getRecentComments(r,n=50){return this.getFilteredTransactionHistory(r,["comment"],n)}parseOperation(r){try{if(!r.op||!Array.isArray(r.op)||r.op.length<2)return null;const[n,s]=r.op;switch(n){case"transfer":return{type:"transfer",value:{from:s.from||"",to:s.to||"",amount:s.amount||"",memo:s.memo||""}};case"vote":return{type:"vote",value:{voter:s.voter||"",author:s.author||"",permlink:s.permlink||"",weight:s.weight||0}};case"comment":return{type:"comment",value:{parent_author:s.parent_author||"",parent_permlink:s.parent_permlink||"",author:s.author||"",permlink:s.permlink||"",title:s.title||"",body:s.body||"",json_metadata:s.json_metadata||""}};case"custom_json":return{type:"custom_json",value:{required_auths:s.required_auths||[],required_posting_auths:s.required_posting_auths||[],id:s.id||"",json:s.json||""}};case"comment_payout_update":return{type:"comment_payout_update",value:{author:s.author||"",permlink:s.permlink||""}};case"comment_options":return{type:"comment_options",value:{author:s.author||"",permlink:s.permlink||"",max_accepted_payout:s.max_accepted_payout||"",percent_hbd:s.percent_hbd||0,allow_votes:s.allow_votes||!1,allow_curation_rewards:s.allow_curation_rewards||!1,extensions:s.extensions||[]}};case"effective_comment_vote":return{type:"effective_comment_vote",value:{voter:s.voter||"",author:s.author||"",permlink:s.permlink||"",pending_payout:s.pending_payout||"",weight:s.weight||0,rshares:s.rshares||0,total_vote_weight:s.total_vote_weight||0}};default:return console.warn("Unknown operation type:",n,r.op),null}}catch(n){return console.error("Error parsing operation:",n,r.op),null}}formatTimestamp(r){try{return new Date(r).toLocaleString()}catch(n){return console.error("Error formatting timestamp:",n),r}}getTransactionSummary(r){const n={};let s="",a="";return r.forEach(i=>{const o=i.op?.[0]||"unknown";n[o]=(n[o]||0)+1,(!s||i.timestamp<s)&&(s=i.timestamp),(!a||i.timestamp>a)&&(a=i.timestamp)}),{totalTransactions:r.length,operationCounts:n,dateRange:{earliest:s,latest:a}}}}const Aa=new Tg;function Dg({account:t,className:r}){const[n,s]=k.useState([]),[a,i]=k.useState([]),[o,c]=k.useState(!1),[d,f]=k.useState(null),[l,h]=k.useState(""),[u,p]=k.useState("all"),[b,w]=k.useState(50),x=[{value:"all",label:"All Operations",icon:O.Activity},{value:"transfer",label:"Transfers",icon:O.Send},{value:"vote",label:"Votes",icon:O.TrendingUp},{value:"comment",label:"Comments",icon:O.MessageCircle},{value:"custom_json",label:"Custom JSON",icon:O.ArrowUpDown},{value:"comment_payout_update",label:"Payout Updates",icon:O.RefreshCw},{value:"comment_options",label:"Comment Options",icon:O.Filter},{value:"effective_comment_vote",label:"Effective Votes",icon:O.Users}],g=async()=>{if(t){c(!0),f(null);try{const y=await Aa.getTransactionHistory(t,-1,b);s(y),i(y)}catch(y){f("Failed to load transaction history"),console.error("Error loading transactions:",y)}finally{c(!1)}}};k.useEffect(()=>{g()},[t,b]),k.useEffect(()=>{let y=n;if(u!=="all"&&(y=y.filter(m=>m.op?.[0]===u)),l){const m=l.toLowerCase();y=y.filter(_=>{const E=Aa.parseOperation(_);if(!E)return!1;switch(E.type){case"transfer":return E.value.from.toLowerCase().includes(m)||E.value.to.toLowerCase().includes(m)||E.value.memo.toLowerCase().includes(m);case"vote":return E.value.voter.toLowerCase().includes(m)||E.value.author.toLowerCase().includes(m)||E.value.permlink.toLowerCase().includes(m);case"comment":return E.value.author.toLowerCase().includes(m)||E.value.title.toLowerCase().includes(m)||E.value.permlink.toLowerCase().includes(m);default:return!1}})}i(y)},[n,u,l]);const v=y=>{if(!y)return e.jsx(O.Activity,{className:"h-4 w-4"});const m=x.find(_=>_.value===y.type)?.icon||O.Activity;return e.jsx(m,{className:"h-4 w-4"})},N=y=>{const m=Aa.parseOperation(y);if(!m)return e.jsx("span",{className:"text-gray-400",children:"Unknown operation"});switch(m.type){case"transfer":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Transfer"}),e.jsx("span",{className:"text-sm font-medium text-white",children:m.value.amount})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"From:"}),e.jsx("img",{src:Ee.userAvatar(m.value.from),alt:`${m.value.from} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.from)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.from})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"To:"}),e.jsx("img",{src:Ee.userAvatar(m.value.to),alt:`${m.value.to} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.to)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.to})]}),m.value.memo&&e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Memo:"})," ",m.value.memo]})]});case"vote":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Vote"}),e.jsxs("span",{className:"text-sm font-medium text-white",children:[m.value.weight,"%"]})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Voter:"}),e.jsx("img",{src:Ee.userAvatar(m.value.voter),alt:`${m.value.voter} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.voter)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.voter})]}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"comment":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Comment"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Title:"})," ",m.value.title]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"custom_json":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Custom JSON"})}),e.jsxs("div",{className:"text-sm text-gray-400",children:["ID: ",m.value.id]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["JSON: ",m.value.json.substring(0,100),"..."]})]});case"comment_payout_update":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Payout Update"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Permlink:"})," ",m.value.permlink]})]});case"comment_options":return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Comment Options"})}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0",children:"Author:"}),e.jsx("img",{src:Ee.userAvatar(m.value.author),alt:`${m.value.author} avatar`,className:"w-4 h-4 rounded-full flex-shrink-0",onError:_=>{_.target.src=Ee.userAvatar(m.value.author)}}),e.jsx("span",{className:"font-mono text-gray-300 truncate",children:m.value.author})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"Max Payout:"})," ",m.value.max_accepted_payout]}),e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0",children:"HBD Percent:"})," ",m.value.percent_hbd,"%"]})]});case"effective_comment_vote":return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs font-medium",children:"Effective Vote"}),e.jsx("span",{className:"text-sm font-medium text-white",children:m.value.weight})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Voter:"," ",e.jsx("span",{className:"font-mono text-gray-300",children:m.value.voter})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Post: @",m.value.author,"/",m.value.permlink]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Pending Payout: ",m.value.pending_payout]})]});default:return e.jsx("span",{className:"text-gray-400",children:"Unknown operation"})}},j=Aa.getTransactionSummary(n);return o?e.jsxs("div",{className:`bg-gray-800 border border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsxs("div",{className:"p-2 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(O.Activity,{className:"h-5 w-5 text-gray-300"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Transaction History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Loading transaction history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:y=>{y.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]})]}),e.jsx("div",{className:"p-2 md:p-6 space-y-2 md:space-y-4",children:Array.from({length:5}).map((y,m)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded animate-pulse w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded animate-pulse w-1/2"})]},m))})]}):e.jsxs("div",{className:`bg-gray-800 border border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsxs("div",{className:"p-4 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(O.Activity,{className:"h-5 w-5 text-gray-300"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Transaction History"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Transaction history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:y=>{y.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-400",children:["@",t]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.totalTransactions}),e.jsx("div",{className:"text-sm text-gray-400",children:"Total"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.transfer||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Transfers"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.vote||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Votes"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:j.operationCounts.comment||0}),e.jsx("div",{className:"text-sm text-gray-400",children:"Comments"})]})]})]}),e.jsxs("div",{className:"p-4 md:p-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search transactions...",value:l,onChange:y=>h(y.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsx("select",{value:u,onChange:y=>p(y.target.value),className:"w-full sm:w-48 px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:x.map(y=>e.jsx("option",{value:y.value,children:y.label},y.value))}),e.jsxs("select",{value:b.toString(),onChange:y=>w(parseInt(y.target.value)),className:"w-full sm:w-32 px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"25",children:"25"}),e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"}),e.jsx("option",{value:"200",children:"200"})]}),e.jsx("button",{onClick:g,className:"px-3 py-2 bg-gray-700 border border-gray-600 rounded-md hover:bg-gray-600 text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]}),d&&e.jsx("div",{className:"p-4 border border-red-700 bg-red-900 rounded-md",children:e.jsx("p",{className:"text-red-300",children:d})}),e.jsx("div",{className:"space-y-4",children:a.length===0?e.jsx("div",{className:"text-center py-8 text-gray-400",children:"No transactions found"}):a.map(y=>{const m=Aa.parseOperation(y);return e.jsxs("div",{className:"border border-gray-600 rounded-lg p-3 md:p-4 space-y-3 hover:bg-gray-700 transition-colors",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[v(m),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:m?.type?m.type.charAt(0).toUpperCase()+m.type.slice(1):"Unknown"}),e.jsxs("div",{className:"text-sm text-gray-400 flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3"}),Aa.formatTimestamp(y.timestamp)]})]})]})}),e.jsx("div",{className:"ml-6 md:ml-7",children:N(y)})]},`${y.trx_id}-${y.op_in_trx}`)})}),a.length>0&&e.jsxs("div",{className:"text-center text-sm text-gray-400",children:["Showing ",a.length," of ",n.length," ","transactions"]})]})]})}const Pg=new Da.Client(["https://api.hive.blog","https://api.syncad.com","https://api.deathwing.me"]);class Og{async getUserChannel(r,n="posts",s=20,a=null,i=null,o=null){const c={account:r,sort:n,limit:s};a&&(c.start_author=a),i&&(c.start_permlink=i),o&&(c.observer=o);try{const d=await Pg.call("bridge","get_account_posts",c);return Array.isArray(d)?d:[]}catch(d){return console.error("Error in getUserChannel:",d),[]}}async getUserPosts(r,n=20){return this.getUserChannel(r,"posts",n)}async getUserComments(r,n=20){return this.getUserChannel(r,"comments",n)}async getUserReplies(r,n=20){return this.getUserChannel(r,"replies",n)}async getAllUserActivity(r,n=10){try{const[s,a,i]=await Promise.all([this.getUserPosts(r,n),this.getUserComments(r,n),this.getUserReplies(r,n)]);return[...s,...a,...i].sort((c,d)=>new Date(d.created).getTime()-new Date(c.created).getTime())}catch(s){return console.error("Error in getAllUserActivity:",s),[]}}convertToDisplayItem(r){return{id:r.id,author:r.author,permlink:r.permlink,title:r.title,body:r.body,created:r.created,category:r.category,net_votes:r.net_votes,children:r.children,total_payout_value:r.total_payout_value,pending_payout_value:r.pending_payout_value,url:r.url,type:r.parent_author===""?"post":"comment"}}formatTimestamp(r){try{return new Date(r).toLocaleString()}catch(n){return console.error("Error formatting timestamp:",n),r}}getRelativeTime(r){try{const n=new Date(r),a=new Date().getTime()-n.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),c=Math.floor(o/60),d=Math.floor(c/24);return i<60?`${i} seconds ago`:o<60?`${o} minutes ago`:c<24?`${c} hours ago`:d<7?`${d} days ago`:n.toLocaleDateString()}catch(n){return console.error("Error calculating relative time:",n),r}}truncateText(r,n=150){return r.length<=n?r:r.substring(0,n)+"..."}getActivitySummary(r){let n=0,s=0,a=0,i=0;return r.forEach(o=>{o.parent_author===""?n++:s++,a+=o.net_votes||0;const c=o.total_payout_value?.match(/(\d+\.?\d*)/);c&&(i+=parseFloat(c[1]))}),{totalActivities:r.length,postsCount:n,commentsCount:s,totalVotes:a,totalPayout:`${i.toFixed(3)} HIVE`,averageVotes:r.length>0?Math.round(a/r.length):0}}filterByCategory(r,n){return r.filter(s=>s.category===n)}filterByDateRange(r,n,s){return r.filter(a=>{const i=new Date(a.created);return i>=n&&i<=s})}searchActivities(r,n){const s=n.toLowerCase();return r.filter(a=>a.title.toLowerCase().includes(s)||a.body.toLowerCase().includes(s)||a.category.toLowerCase().includes(s))}}const Sa=new Og,Lg=({username:t,className:r})=>{const[n,s]=k.useState([]),[a,i]=k.useState([]),[o,c]=k.useState([]),[d,f]=k.useState([]),[l,h]=k.useState([]),[u,p]=k.useState(!1),[b,w]=k.useState(null),[x,g]=k.useState(""),[v,N]=k.useState(20),[j,y]=k.useState("all"),[m,_]=k.useState(new Set),[E,A]=k.useState(!1),C=async()=>{if(!(!t||E)){p(!0),w(null);try{const[F,Y,G]=await Promise.all([Sa.getUserPosts(t,v),Sa.getUserComments(t,v),Sa.getUserReplies(t,v)]);s(F),i(Y),c(G),A(!0)}catch(F){w("Failed to load activity history"),console.error("Error loading activities:",F)}finally{p(!1)}}};k.useEffect(()=>{C()},[t]),k.useEffect(()=>{if(!E)return;let F=[];switch(j){case"posts":F=n;break;case"comments":F=a;break;case"replies":F=o;break;default:F=[...n,...a,...o].sort((Y,G)=>new Date(G.created).getTime()-new Date(Y.created).getTime());break}f(F),h(F)},[j,n,a,o,E]),k.useEffect(()=>{let F=d;x&&(F=Sa.searchActivities(d,x)),h(F)},[d,x]);const T=F=>!F||F==="0.000 HIVE"?"0 HIVE":F,D=F=>F.parent_author===""?"Post":F.depth===1?"Comment":"Reply",L=new Vn.DefaultRenderer({baseUrl:"https://hive.blog/",breaks:!0,skipSanitization:!1,allowInsecureScriptTags:!1,addNofollowToLinks:!0,doNotShowImages:!1,assetsWidth:640,assetsHeight:480,imageProxyFn:F=>F,usertagUrlFn:F=>`/@${F}`,hashtagUrlFn:F=>`/trending/${F}`,isLinkSafeFn:F=>!0,addExternalCssClassToMatchingLinksFn:F=>!0,ipfsPrefix:"https://ipfs.io/ipfs/"}),z=F=>{const Y=new Set(m);Y.has(F)?Y.delete(F):Y.add(F),_(Y)},U=F=>{const Y=`${F.author}-${F.permlink}`,G=m.has(Y),ne=F.body.length>100;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-3 sm:p-4 space-y-3 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors relative",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",children:e.jsx("div",{className:"flex items-start gap-3 flex-1",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${F.parent_author===""?"bg-blue-900 text-blue-300":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300"}`,children:D(F)}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:["in #",F.category]})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("img",{src:Ee.userAvatar(F.author),alt:`${F.author} avatar`,className:"w-5 h-5 sm:w-6 sm:h-6 rounded-full flex-shrink-0",onError:ie=>{ie.target.src=Ee.userAvatar(F.author)}}),e.jsx("h3",{className:"font-medium text-base sm:text-lg leading-tight text-gray-900 dark:text-white break-words",children:F.title||"Untitled"})]}),e.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-3 text-gray-500 dark:text-gray-400 comment-content overflow-hidden",children:[e.jsx("div",{className:"break-words overflow-wrap-anywhere",dangerouslySetInnerHTML:{__html:L.render(ne&&!G?F.body.substring(0,50)+".....":F.body)}}),ne&&e.jsxs("button",{onClick:()=>z(Y),className:"mt-2 text-blue-400 hover:text-blue-300 text-sm font-medium flex items-center gap-1",children:[e.jsx(O.ChevronDown,{className:`h-3 w-3 transition-transform ${G?"rotate-180":""}`}),G?"Show less":"Show more"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-4 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:Sa.getRelativeTime(F.created)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.ThumbsUp,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{children:[F.net_votes," votes"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O.Reply,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{children:[F.children," replies"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"💰"}),e.jsx("span",{children:T(F.total_payout_value)})]})]})]})})}),e.jsx("button",{onClick:()=>window.open(`https://peakd.com/@${F.author}/${F.permlink}`,"_blank"),className:"absolute top-3 right-3 flex-shrink-0 p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:e.jsx(O.ExternalLink,{className:"h-4 w-4"})})]},Y)},H=Sa.getActivitySummary(d);return u?e.jsxs("div",{className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm ${r}`,children:[e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading activity history for"}),e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-6 h-6 rounded-full",onError:F=>{F.target.src=Ee.userAvatar(t)}}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["@",t]})]})}),e.jsx("div",{className:"p-6 space-y-4",children:Array.from({length:5}).map((F,Y)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-1/2"}),e.jsx("div",{className:"h-20 bg-gray-200 dark:bg-gray-700 rounded animate-pulse w-full"})]},Y))})]}):e.jsxs("div",{className:`space-y-6 ${r}`,children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:Ee.userAvatar(t),alt:`${t} avatar`,className:"w-16 h-16 rounded-full object-cover",onError:F=>{F.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:["@",t]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"Activity History"}),e.jsx("div",{className:"flex flex-wrap gap-6 text-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.FileText,{className:"w-4 h-4"}),e.jsxs("span",{children:[H.totalActivities," Total Activities"]})]})})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex md:grid md:grid-cols-4 overflow-x-auto md:overflow-visible w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsx("button",{onClick:()=>y("all"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="all"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"All"}),e.jsx("button",{onClick:()=>y("posts"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="posts"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Posts"}),e.jsx("button",{onClick:()=>y("comments"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="comments"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Comments"}),e.jsx("button",{onClick:()=>y("replies"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${j==="replies"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Replies"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex flex-row gap-4 mb-6",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(O.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500 dark:text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search activities...",value:x,onChange:F=>g(F.target.value),className:"w-full pl-10 pr-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})}),e.jsx("button",{onClick:()=>{A(!1),C()},className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:e.jsx(O.RefreshCw,{className:"h-4 w-4"})})]}),b&&e.jsx("div",{className:"p-4 border border-red-200 dark:border-red-700 bg-red-50 dark:bg-red-900 rounded-md",children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:b})}),e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No activities found"}):l.map(U)}),l.length>0&&e.jsxs("div",{className:"text-center text-sm text-gray-500 dark:text-gray-400",children:["Showing ",l.length," of ",d.length," ","activities"]})]})]})]})},Yt="https://images.ecency.com",rt={actifit_logo:`${Yt}/DQmemUxomzr8RFEZGoT7a8rSvpx1LnzuAzDNyikKuENkSuc/actifit_logo.png`,checkinwithxyz:`${Yt}/DQmUAbGJ1XN461zbaEus7aam1vuVg1cMAtzpuLGgwdAPUEU/checkinwithxyz.png`,developers:`${Yt}/DQmNeGvBgY5r4pay9fhrD8LforDyasa2kstPwBmaLcQBmSW/developers.png`,distriator_logo:`${Yt}/DQmZw6AXZ7wmEChsWXA3onVZXCsRUYGwbp87qP9onaLAvLW/distriator_logo.png`,ecency_logo:`${Yt}/DQmNsuCkexmEKoWB9ywdR5UkzRQ4Xu6CAgHjRTATCB23znc/ecency_logo.png`,happrover_logo:`${Yt}/DQmcy4sHYiMkUJYLhu4jgrvVbvk9vxeSvXHn21ZpVLXK6Jf/happrover_logo.png`,hsurvey_logo:`${Yt}/DQmPNP9TDXFFG9ckvUWiD4qbFxmyTSDN3fM4tbmEVvG7U7h/hsurvey.png`,hive_logo:`${Yt}/DQma5YQXrk1WZ7oxgLqdPjbVdShmVGzeL7yZ6BCQGjMF6G3/hive_logo.png`,hive_fest_fact_logo:`${Yt}/DQmTiwJfQSBsdQMAivWfi97P6UwUqsd4wBgFmP2xhQjtA4r/hive_fest_fact_logo.png`,hiveauth_logo:`${Yt}/DQmP9vkxQuQkaCfin2whQfokMF9YJMN3Aujz9B5sGQVNWoE/hiveauth_logo.png`,hpolls_logo:`${Yt}/DQmejtPJC86dhzUKPZxQxaCBaud2ocy6PWPLqjEHNPoWQnX/hpolls_logo.png`,hreplier:`${Yt}/DQmRMrDJvNBeRzDj1W8e99TqkN87Ch7w9SWun6woVaRTAZ3/hreplier.png`,nodes:`${Yt}/DQmbmVKTexP4r4CfzmQKztzBdA26vZBJuJHLZo5GwT88Gxf/nodes.png`,podcast_logo:`${Yt}/DQmd1xwQJvM5pPvWpXoNT1vWqo4XqFvN7RDUVZb3w6ZxHLo/podcast_logo.jpg`,stats_logo:`${Yt}/DQme3DKpB5uVv5ASf9AkFHLY3JdxD2YQMuPa6k2jptULXRY/stats_logo.png`,template:`${Yt}/DQmStuCUgDJmxtLKLUd3fZKmYyPEbvuopdRhwFx3SHiycCq/template.png`,three_shorts_logo:`${Yt}/DQmbNeu2p1GokLH6T8QwekCJBSwSK4qo29ebeVwqD1YbK25/three_shorts_logo.png`,three_speak_logo:`${Yt}/DQmc84A9bXdQ3oRMz3YgV1VNCAFvPbJVSvsf434FApxg2cf/three_speak_logo.png`,vote_logo:`${Yt}/DQmVa8V2FCjJKMaqgoUaRDHPa4TYdqceCmAbCJU7rGj5yBe/vote_logo.png`},Mg=[{key:"vote-witness-sagar",name:"Vote Witness Sagar",url:"https://vote.hive.uno/@sagarkothari88",logo:"",alwaysVisible:!0,isAvatar:!0,avatarUrl:"https://images.hive.blog/u/sagarkothari88/avatar"},{key:"vote-witness-threespeak",name:"Vote Witness 3Speak",url:"https://vote.hive.uno/@threespeak",logo:rt.three_speak_logo,alwaysVisible:!0},{key:"distriator",name:"Distriator",url:"https://distriator.com/",logo:rt.distriator_logo,visibilityKey:"isDistriator"},{key:"checkinwithxyz",name:"CheckinWithXYZ",url:"https://checkinwith.xyz/",logo:rt.checkinwithxyz,visibilityKey:"isCheckinwithxyz"},{key:"hreplier",name:"HReplier",url:"https://hreplier.sagarkothari88.one/",logo:rt.hreplier,visibilityKey:"isHreplier"},{key:"hpolls",name:"HPolls",url:"https://hpolls.sagarkothari88.one/",logo:rt.hpolls_logo,visibilityKey:"isHpolls"},{key:"hstats",name:"HStats",url:"https://hstats.sagarkothari88.one/",logo:rt.stats_logo,visibilityKey:"isHstats"},{key:"hsnaps",name:"HSnaps",url:"https://hsnaps.sagarkothari88.one/",logo:rt.template,visibilityKey:"isHsnaps"},{key:"3speak",name:"3Speak",url:"https://3speak.tv/",logo:rt.three_speak_logo,alwaysVisible:!0},{key:"hivefestfacts",name:"HiveFestFacts",url:"https://hivefestfacts.sagarkothari88.one/",logo:rt.hive_fest_fact_logo,visibilityKey:"isHiveFestFacts"}];function Rg(){const[t,r]=k.useState("desktop");return k.useEffect(()=>{const n=()=>{const s=window.innerWidth;s<480?r("mobile"):s<768?r("tablet"):r("desktop")};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}const $g={mobile:{icon:28,fontSize:8,padding:"4px 6px",gap:2,barPadding:"4px",minWidth:52,maxWidth:68},tablet:{icon:30,fontSize:8,padding:"4px 5px",gap:3,barPadding:"5px 6px",minWidth:56,maxWidth:72},desktop:{icon:32,fontSize:9,padding:"4px 6px",gap:4,barPadding:"6px 8px",minWidth:60,maxWidth:80}},Ig=({isDistriator:t=!0,isCheckinwithxyz:r=!0,isHreplier:n=!0,isHpolls:s=!0,isHstats:a=!0,isHsnaps:i=!0,isHiveFestFacts:o=!0,backgroundColor:c="#ffffff",textColor:d="#4b5563",borderTopColor:f="#e2e8f0"})=>{const l=Rg(),h=$g[l],u={isDistriator:t,isCheckinwithxyz:r,isHreplier:n,isHpolls:s,isHstats:a,isHsnaps:i,isHiveFestFacts:o},p=Mg.filter(b=>b.alwaysVisible||u[b.visibilityKey]!==!1);return p.length===0?null:e.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,backgroundColor:c,borderTop:`1px solid ${f}`,boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.08)"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:l==="desktop"?"center":"flex-start",overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",padding:h.barPadding,gap:`${h.gap}px`,scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},className:"hive-toolbar-scroll",children:p.map(b=>e.jsxs("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textDecoration:"none",color:d,padding:h.padding,borderRadius:"8px",transition:"background-color 0.2s, transform 0.2s",cursor:"pointer",flexShrink:0,minWidth:`${h.minWidth}px`,maxWidth:`${h.maxWidth}px`},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="#f3f4f6",w.currentTarget.style.transform="scale(1.05)"},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="scale(1)"},children:[b.isAvatar?e.jsx("img",{src:b.avatarUrl,alt:b.name,style:{width:`${h.icon}px`,height:`${h.icon}px`,borderRadius:"50%",objectFit:"cover"}}):e.jsx("img",{src:b.logo,alt:b.name,style:{width:`${h.icon}px`,height:`${h.icon}px`,borderRadius:"8px",objectFit:"contain"}}),e.jsx("span",{style:{fontSize:`${h.fontSize}px`,fontWeight:500,marginTop:"2px",textAlign:"center",lineHeight:"1.2",whiteSpace:"normal",wordWrap:"break-word",color:d,maxWidth:`${h.maxWidth}px`,display:"block"},children:b.name})]},b.key))}),e.jsx("style",{children:`
1126
1126
  .hive-toolbar-scroll::-webkit-scrollbar {
1127
1127
  display: none;
1128
1128
  }
@@ -1136,8 +1136,8 @@ ${de}`),ge},clear:()=>{B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe)
1136
1136
  rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
1137
1137
  transition-colors cursor-pointer`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:Ee.userAvatar(f.follower),alt:f.follower,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.follower}&background=random`}}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.follower]})})]})},`${f.follower}-${l}`))})})},N0=({username:t,onSelectUser:r})=>{const[n,s]=k.useState([]),[a,i]=k.useState(!0),[o,c]=k.useState(null),d=async()=>{try{i(!0),c(null);const f=await Ee.getFollowing(t);s(f)}catch(f){c(f instanceof Error?f.message:"Failed to load following list")}finally{i(!1)}};return k.useEffect(()=>{d()},[t]),a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following list..."]})}):o?e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following list"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:o}),e.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):n.length===0?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):e.jsx("div",{className:"space-y-6",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.map((f,l)=>e.jsx("div",{onClick:()=>r&&r(f.following),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
1138
1138
  rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
1139
- transition-colors cursor-pointer`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:Ee.userAvatar(f.following),alt:f.following,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.following}&background=random`}}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.following]})})]})},`${f.following}-${l}`))})})},j0=({username:t})=>{const[r,n]=k.useState(null),[s,a]=k.useState(!0),[i,o]=k.useState(null),c=async()=>{try{a(!0),o(null);const u=await Ee.getProfile(t);n(u)}catch(u){o(u instanceof Error?u.message:"Failed to load user details")}finally{a(!1)}};k.useEffect(()=>{c()},[t]);const d=u=>{try{return new Date(u).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return u}},f=u=>u.replace(/<[^>]*>/g,"");if(s)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading user details..."]})});if(i)return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load user details"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:i}),e.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!r?.result)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No user details available"})});const l=r.result,h=l.metadata?.profile;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[h?.about&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(h.about)})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Location"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:h?.location||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Website"}),e.jsx("a",{href:h?.website,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-500 hover:underline",children:h?.website||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Joined"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.created?d(l.created):"Unknown"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Followers"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.followers?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Following"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.following?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Post Count"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.post_count?.toLocaleString()||"0"})]})]})]})})},Kg=({username:t,onVideoClick:r,onAuthorClick:n,onBack:s,onClickUserInfoTab:a,onClickFollowersTab:i,onClickFollowingTab:o,onBookmarkToggle:c,onRss:d,onShare:f,onMoreMenu:l,showMoreMenu:h=!1})=>{const[u,p]=k.useState("videos"),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(!0);k.useEffect(()=>{(async()=>{try{N(!0);const C=await Ee.getProfile(t);w(C)}catch(C){console.error("Failed to fetch user details:",C)}finally{N(!1)}})()},[t]);const j=()=>{if(f)f(t);else{const A=`https://3speak.tv/user/${t}`;navigator.share?navigator.share({title:b?.result?.name||t,url:A}):navigator.clipboard.writeText(A)}},y=()=>{d?d(t):window.open(`https://3speak.tv/rss/${t}.xml`,"_blank")},m=A=>{n(A)};if(v)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),e.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((A,C)=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},C))})]})]})});const _=b?.result,E=_?.metadata?.profile;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("button",{onClick:s,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden",children:[e.jsx("img",{src:E.cover_image||Ee.userAvatar(t),alt:"Cover",className:"w-full h-48 object-cover",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:E?.profile_image,alt:E?.name,className:"w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:E?.name||t}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:E?.about||"No description available"}),e.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.followers||0).toLocaleString()," Followers"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.following||0).toLocaleString()," Following"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Calendar,{className:"w-4 h-4"}),e.jsxs("span",{children:["Joined"," ",_?.created?new Date(_.created).getFullYear():"Unknown"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Io,{id:t,toastType:"user",onAdd:(A,C)=>{c?c(A,!0):console.log("Added:",A,C)},onRemove:(A,C)=>{c?c(A,!1):console.log("Removed:",A,C)}}),e.jsx("button",{onClick:y,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Rss,{className:"w-4 h-4"})}),e.jsx("button",{onClick:j,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Share2,{className:"w-4 h-4"})}),h&&e.jsx("button",{onClick:()=>{l&&l(t)},className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.MoreVertical,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[{key:"videos",label:"Videos"},{key:"about",label:"User Info",callback:a},{key:"followers",label:"Followers",callback:i},{key:"following",label:"Following",callback:o}].map((A,C)=>e.jsx("button",{onClick:()=>{A.callback?A.callback():p(A.key)},className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${u===A.key?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:A.label},A.key))}),e.jsxs("div",{className:"mt-6",children:[u==="videos"&&e.jsx(En,{feedType:er.USER,username:t,onVideoClick:r,onAuthorClick:n}),u==="about"&&e.jsx(j0,{username:t}),u==="followers"&&e.jsx(w0,{username:t,onSelectUser:m}),u==="following"&&e.jsx(N0,{username:t,onSelectUser:m})]})]})]})},Qg=["Spam","Harassment or bullying","Hate speech","Violence or dangerous organizations","Intellectual property violation","Self-harm","Non-consensual intimate images","Doxxing","Minor safety","Other"],rd=({isOpen:t,onClose:r,onReport:n,reportType:s,targetUsername:a,targetPermlink:i})=>{const[o,c]=k.useState("select"),[d,f]=k.useState(""),[l,h]=k.useState(!1),u=x=>{f(x),c("confirm")},p=async()=>{if(d){h(!0);try{await n(d),r(),c("select"),f("")}catch(x){console.error("Report failed:",x)}finally{h(!1)}}},b=()=>{r(),c("select"),f("")},w=()=>{c("select"),f("")};return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:b,children:e.jsxs("div",{className:"bg-gray-900 rounded-xl shadow-xl max-w-md w-full max-h-[80vh] flex flex-col border border-gray-700",onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(O.Flag,{className:"h-5 w-5 text-red-500"}),e.jsxs("h3",{className:"text-lg font-semibold text-white",children:["Report ",s==="user"?"User":"Post"]})]}),e.jsx("button",{onClick:b,className:"p-1 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:["@",a]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o==="select"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-gray-400 mb-4",children:["Why are you reporting this ",s,"?"]}),e.jsx("div",{className:"space-y-2",children:Qg.map(x=>e.jsx("button",{onClick:()=>u(x),className:"w-full text-left px-4 py-3 border border-gray-700 rounded-lg text-gray-300 hover:bg-gray-800 hover:border-gray-600 transition-colors",children:x},x))})]}),o==="confirm"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(O.AlertTriangle,{className:"h-6 w-6 text-red-500"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white mb-2",children:"Report Summary"}),e.jsxs("div",{className:"space-y-2 text-sm text-gray-400",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Type:"})," ",s==="user"?"User":"Post"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Target:"})," @",a]}),s==="post"&&i&&e.jsxs("p",{children:[e.jsx("strong",{children:"Post:"})," ",i]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Reason:"})," ",d]})]})]})]}),e.jsx("div",{className:"bg-yellow-900/20 border border-yellow-800 rounded-lg p-3",children:e.jsx("p",{className:"text-xs text-yellow-200",children:"Reports are reviewed by our moderation team. False reports may result in action against your account."})})]})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-700 flex items-center justify-end space-x-3",children:[o==="select"&&e.jsx("button",{onClick:b,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Cancel"}),o==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:w,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Back"}),e.jsx("button",{onClick:p,disabled:l,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?"Reporting...":"Submit Report"})]})]})]})}):null},fn=t=>{const r=new Date,n=new Date(t),s=Math.floor((r.getTime()-n.getTime())/1e3);return s<60?"just now":s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:s<2592e3?`${Math.floor(s/86400)}d ago`:n.toLocaleDateString()},ex=t=>{if(t===0)return"25";const r=t<0;let n=r?-t:t,s=Math.log10(n);return s=Math.max(s-9,0),s=(r?-1:1)*s,s=s*9+25,Math.round(s).toString()},tx=t=>{try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return t}},ad=t=>{let r=t;return r=r.replace(/<[^>]*>/g,""),r=r.replace(/!\[.*?\]\([^\s)]+\)/g,""),r=r.replace(/\[([^\]]*)\]\([^\s)]+\)/g,"$1"),r=r.replace(/https?:\/\/[^\s)>\]]+/g,""),r=r.replace(/\[.*?\]/g,""),r=r.replace(/\(https?:\/\/[^\s)]*\)/g,""),r=r.replace(/[*_~`#>|]/g,""),r=r.replace(/^[-_*]{3,}\s*$/gm,""),r=r.replace(/\s+/g," ").trim(),r},rx=({username:t,currentUsername:r,onBack:n,showBackButton:s=!1,tabShown:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f,reportedPosts:l=[],reportedAuthors:h=[],onFollow:u,onUnfollow:p,onIgnoreAuthor:b,onReportUser:w,onUpvote:x,onSubmitComment:g,onClickCommentUpvote:v,onReblog:N,onTip:j,onReportPost:y,onUserClick:m,onPostClick:_,onSnapClick:E,onPollClick:A,onActivityPermlink:C,onActivitySelect:T,onShare:D,onSharePost:L,onCommentClick:z,onFavouriteList:U,onAddToFavourite:H,isFavourited:F=!1,favouriteCount:Y=0})=>{const[G,ne]=k.useState(null),[ie,xe]=k.useState(!0),[V,q]=k.useState(null),[B,pe]=k.useState("blogs"),[ee,te]=k.useState([]),[_e,Ie]=k.useState([]),[K,le]=k.useState([]),[oe,Ne]=k.useState([]),[Ce,Me]=k.useState([]),[Fe,ue]=k.useState(null),[Re,ae]=k.useState([]),[de,ve]=k.useState([]),[fe,ke]=k.useState({totalHbd:0,totalHpEq:0}),[Se,Be]=k.useState([]),[Ge,pt]=k.useState({totalHp:0,totalHbd:0}),[jt,gt]=k.useState(!1),[St,Ct]=k.useState([]),[Tt,Bt]=k.useState([]),[Ke,at]=k.useState([]),[_t,Ut]=k.useState([]),[kt,Vt]=k.useState(null),[S,P]=k.useState(100),[I,Z]=k.useState(!1),[be,Oe]=k.useState(!1),[Ze,Ue]=k.useState({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),He=20,bt=100,Dt=k.useRef(null),[Mt,$t]=k.useState(!1),[Yt,Et]=k.useState(!1),[ft,ge]=k.useState(!1),[Te,Pe]=k.useState(!1),[ze,Ve]=k.useState(null),xt=k.useRef(null),Je=k.useRef(null),[cr,Or]=k.useState(!1),[rr,Lr]=k.useState(!1),Ht=k.useCallback(()=>{const $=Je.current;$&&(Or($.scrollLeft>0),Lr($.scrollLeft+$.clientWidth<$.scrollWidth-1))},[]);k.useEffect(()=>{const $=Je.current;if(!$)return;Ht(),$.addEventListener("scroll",Ht);const re=new ResizeObserver(Ht);return re.observe($),()=>{$.removeEventListener("scroll",Ht),re.disconnect()}},[Ht]);const Mr=k.useCallback($=>{const re=Je.current;re&&re.scrollBy({left:$==="left"?-150:150,behavior:"smooth"})},[]);$o();const $e=t.replace(/^@/,"").trim(),ar=k.useMemo(()=>new Set(l.map($=>`${$.author}/${$.permlink}`)),[l]),kr=k.useMemo(()=>new Set(h),[h]),ut=k.useCallback($=>$.filter(re=>!kr.has(re.author)&&!ar.has(`${re.author}/${re.permlink}`)),[ar,kr]);k.useEffect(()=>{const $=re=>{xt.current&&!xt.current.contains(re.target)&&Et(!1)};return document.addEventListener("click",$),()=>document.removeEventListener("click",$)},[]),k.useEffect(()=>{(async()=>{if($e){xe(!0),q(null);try{const[re,he,se]=await Promise.all([Ee.getProfile($e),Ee.getAccounts([$e]),Ee.getDynamicGlobalProperties()]),ye=re?.result,De=he?.[0];if(!ye){q("User not found");return}let lt;if(se&&De?.vesting_shares){const Lt=parseFloat(De.vesting_shares.split(" ")[0]),dt=parseFloat(se.total_vesting_shares.split(" ")[0]),or=parseFloat(se.total_vesting_fund_hive.split(" ")[0]);lt=Lt/dt*or}let Xe;De?.voting_power&&(Xe=De.voting_power/1e4*100);let Qe=!1;if(r&&r!==$e)try{Qe=(await Ee.getFollowing(r)).some(dt=>dt.following===$e)}catch{}let ct=null;if(De?.posting_json_metadata)try{ct=JSON.parse(De.posting_json_metadata)?.profile}catch{}let et=null;if(De?.json_metadata)try{et=JSON.parse(De.json_metadata)?.profile}catch{}const Pt=ye.metadata?.profile,Xt={username:ye.name,name:ct?.name||et?.name||Pt?.name,about:ct?.about||et?.about||Pt?.about,location:ct?.location||et?.location||Pt?.location,website:ct?.website||et?.website||Pt?.website,profileImage:ct?.profile_image||et?.profile_image||Pt?.profile_image,coverImage:ct?.cover_image||et?.cover_image||Pt?.cover_image,followersCount:ye.stats?.followers||0,followingCount:ye.stats?.following||0,postsCount:ye.post_count||0,reputation:ye.reputation||0,isFollowing:Qe,created:ye.created,lastActivity:De?.last_post,hivePower:lt,votingPower:Xe};ne(Xt)}catch(re){console.error("Error fetching user profile:",re),q("Failed to load user profile")}finally{xe(!1)}}})()},[$e,r]),k.useEffect(()=>{te([]),Ie([]),Me([]),ue(null),ae([]),ve([]),ke({totalHbd:0,totalHpEq:0}),Be([]),pt({totalHp:0,totalHbd:0}),le([]),Ne([]),Ct([]),Bt([]);const $=a&&a.length>0?a[0]:"blogs";pe($),Ue({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),at([]),Ut([]),Vt(null),P(100)},[$e]),k.useEffect(()=>{const $=new AbortController,{signal:re}=$;return(async()=>{if($e){Z(!0),gt(!1),B==="authorRewards"&&(ve([]),ke({totalHbd:0,totalHpEq:0})),B==="curationRewards"&&(Be([]),pt({totalHp:0,totalHbd:0}));try{switch(B){case"blogs":{const se=ut(await Ee.getUserBlogs($e,He,void 0,void 0,re));te(se),Ue(ye=>({...ye,blogs:se.length>=He}));break}case"posts":{const se=ut(await Ee.getUserPosts($e,He,void 0,void 0,re));Ie(se),Ue(ye=>({...ye,posts:se.length>=He}));break}case"snaps":{const{snaps:se,nextStartId:ye}=await Ee.getUserSnaps($e,void 0,r,re);Me(ut(se)),ue(ye),Ue(De=>({...De,snaps:ye!==null}));break}case"polls":{const se=ut(await Ee.getUserPolls($e,re));ae(se),Ue(ye=>({...ye,polls:!1}));break}case"comments":{const se=ut(await Ee.getUserComments($e,He,void 0,void 0,re));le(se),Ue(ye=>({...ye,comments:se.length>=He}));break}case"replies":{const se=ut(await Ee.getUserReplies($e,He,void 0,void 0,re));Ne(se),Ue(ye=>({...ye,replies:se.length>=He}));break}case"followers":{const se=await Ee.getFollowers($e,null,bt,re);Ct(se),Ue(ye=>({...ye,followers:se.length>=bt}));break}case"following":{const se=await Ee.getFollowing($e,null,bt,re);Bt(se),Ue(ye=>({...ye,following:se.length>=bt}));break}case"authorRewards":{gt(!0);const se=await Ee.getPendingAuthorRewards($e,(ye,De,lt)=>{re.aborted||(ve([...ye]),ke({totalHbd:De,totalHpEq:lt}),Z(!1))},re);ve(se.rows),ke({totalHbd:se.totalHbd,totalHpEq:se.totalHpEq}),gt(!1);break}case"curationRewards":{gt(!0);const se=await Ee.getPendingCurationRewards($e,(ye,De,lt)=>{re.aborted||(Be([...ye]),pt({totalHp:De,totalHbd:lt}),Z(!1))},re);Be(se.rows),pt({totalHp:se.totalHp,totalHbd:se.totalHbd}),gt(!1);break}case"votingPower":{const[se,,ye]=await Promise.all([Ee.getAccounts([$e],re),Ee.getDynamicGlobalProperties(re),Ee.getFeedHistory(re)]),De=se?.[0];if(De){const Xe=M=>parseFloat(String(M).split(" ")[0])||0,ct=(Xe(De.vesting_shares)+Xe(De.received_vesting_shares)-Xe(De.delegated_vesting_shares))*1e6,et=Math.floor(Date.now()/1e3)-De.voting_manabar.last_update_time;let Pt=parseFloat(String(De.voting_manabar.current_mana))+et*ct/432e3;Pt>ct&&(Pt=ct);const Xt=ct>0?Pt/ct*100:0,Lt=ct/4,dt=Math.floor(Date.now()/1e3)-De.downvote_manabar.last_update_time;let or=parseFloat(String(De.downvote_manabar.current_mana))+dt*Lt/432e3;or>Lt&&(or=Lt);const Yr=Lt>0?or/Lt*100:0;let ra=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"rc_api.find_rc_accounts",params:{accounts:[$e]},id:1}),signal:re})).json())?.result?.rc_accounts?.[0];if(me){const qe=parseFloat(me.rc_manabar.current_mana),nt=parseFloat(me.max_rc);nt>0&&(ra=qe/nt*100)}}catch{}let R=0,J=0,X=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_reward_fund",params:["post"],id:1}),signal:re})).json())?.result;me&&(R=Xe(me.reward_balance),J=parseFloat(me.recent_claims)||0)}catch{}if(ye?.current_median_history){const M=Xe(ye.current_median_history.base),ce=Xe(ye.current_median_history.quote)||1;X=M/ce}Vt({upvotePower:Math.min(Xt,100),downvotePower:Math.min(Yr,100),resourceCredits:Math.min(ra,100),maxMana:ct,rewardBalance:R,recentClaims:J,feedPrice:X})}break}case"badges":{let se=[],ye=null,De=!0;for(;De;){const Xe=await Ee.getFollowers($e,ye,1e3,re);se=[...se,...Xe],Xe.length<1e3?De=!1:ye=Xe[Xe.length-1].follower}const lt=se.map(Xe=>Xe.follower).filter(Xe=>Xe.startsWith("badge-"));at(lt);break}case"witnessVotes":{const ye=(await Ee.getAccounts([$e],re))?.[0];ye?.witness_votes&&Ut(ye.witness_votes);break}}}catch(se){if(se?.name==="AbortError")return;console.error(`Error fetching ${B}:`,se)}finally{re.aborted||Z(!1)}}})(),()=>{$.abort()}},[$e,B]);const W=k.useMemo(()=>ut(ee),[ee,ut]),Q=k.useMemo(()=>ut(_e),[_e,ut]),we=k.useMemo(()=>ut(Ce),[Ce,ut]),Ae=k.useMemo(()=>ut(K),[K,ut]),ht=k.useMemo(()=>ut(oe),[oe,ut]),Ye=k.useMemo(()=>ut(Re),[Re,ut]),yt=k.useCallback(async()=>{if(!(be||!Ze[B]||!$e)){Oe(!0);try{switch(B){case"blogs":{const $=ee[ee.length-1];if(!$)break;const re=await Ee.getUserBlogs($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);te(se=>[...se,...he]),Ue(se=>({...se,blogs:he.length>=He-1}));break}case"posts":{const $=_e[_e.length-1];if(!$)break;const re=await Ee.getUserPosts($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ie(se=>[...se,...he]),Ue(se=>({...se,posts:he.length>=He-1}));break}case"snaps":{if(!Fe)break;const{snaps:$,nextStartId:re}=await Ee.getUserSnaps($e,Fe,r);Me(he=>[...he,...ut($)]),ue(re),Ue(he=>({...he,snaps:re!==null}));break}case"comments":{const $=K[K.length-1];if(!$)break;const re=await Ee.getUserComments($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);le(se=>[...se,...he]),Ue(se=>({...se,comments:he.length>=He-1}));break}case"replies":{const $=oe[oe.length-1];if(!$)break;const re=await Ee.getUserReplies($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ne(se=>[...se,...he]),Ue(se=>({...se,replies:he.length>=He-1}));break}case"followers":{const $=St[St.length-1];if(!$)break;const re=await Ee.getFollowers($e,$.follower,bt),he=re.length>0&&re[0].follower===$.follower?re.slice(1):re;Ct(se=>[...se,...he]),Ue(se=>({...se,followers:he.length>=bt-1}));break}case"following":{const $=Tt[Tt.length-1];if(!$)break;const re=await Ee.getFollowing($e,$.following,bt),he=re.length>0&&re[0].following===$.following?re.slice(1):re;Bt(se=>[...se,...he]),Ue(se=>({...se,following:he.length>=bt-1}));break}}}catch($){console.error(`Error loading more ${B}:`,$)}finally{Oe(!1)}}},[B,$e,r,be,Ze,ee,_e,Ce,Fe,K,oe,St,Tt]);k.useEffect(()=>{const $=Dt.current;if(!$)return;const re=new IntersectionObserver(he=>{he[0].isIntersecting&&yt()},{rootMargin:"200px"});return re.observe($),()=>re.disconnect()},[yt]);const Ot=k.useCallback(async()=>{if(G){$t(!0),Et(!1);try{const $=G.isFollowing;$&&p?await p($e):!$&&u&&await u($e),ne(re=>re&&{...re,isFollowing:!$,followersCount:$?Math.max(0,re.followersCount-1):re.followersCount+1}),setTimeout(async()=>{try{const re=await Ee.getProfile($e);re?.result?.stats&&ne(he=>he&&{...he,followersCount:re.result.stats.followers??he.followersCount,followingCount:re.result.stats.following??he.followingCount})}catch{}},3e3)}catch($){console.error("Follow/Unfollow error:",$)}finally{$t(!1)}}},[G,$e,u,p]),Jt=k.useCallback(async()=>{$t(!0);try{b&&await b($e),ge(!1),Et(!1)}catch($){console.error("Error ignoring user:",$)}finally{$t(!1)}},[$e,b]),At=k.useCallback(async $=>{$t(!0);try{w&&await w($e,$),Pe(!1),Et(!1)}catch(re){console.error("Error reporting user:",re)}finally{$t(!1)}},[$e,w]),mt=k.useCallback(()=>{D?.($e)},[$e,D]),Rt=k.useCallback(async()=>{U&&await U()},[U]),qt=k.useCallback(async()=>{H&&await H($e)},[$e,H]);if(ie)return e.jsxs("div",{className:"dark h-full overflow-y-auto animate-pulse bg-gray-900",children:[e.jsxs("div",{className:"sticky top-0 z-30 bg-gray-900 border-b border-gray-700 px-4 py-3 flex items-center gap-3",children:[s&&e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"}),e.jsx("div",{className:"w-9 h-9 bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28 mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-36"})]}),e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"h-36 sm:h-44 bg-gray-800 w-full"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-48 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-64 mb-3"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-28"})]})]})]}),e.jsx("div",{className:"border-b border-gray-700 px-2 py-2 flex gap-1 overflow-x-auto",children:[80,64,72,96,80,64,72].map(($,re)=>e.jsx("div",{className:"h-8 bg-gray-800 rounded-lg flex-shrink-0",style:{width:$}},re))}),e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3,4].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))})]});if(V||!G)return e.jsx("div",{className:"dark flex items-center justify-center min-h-[400px] bg-gray-900",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.User,{className:"h-14 w-14 text-gray-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-1",children:"User Not Found"}),e.jsx("p",{className:"text-gray-400",children:V||"This user does not exist"}),s&&n&&e.jsxs("button",{onClick:n,className:"mt-4 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700",children:[e.jsx(O.ArrowLeft,{className:"h-4 w-4 mr-2"}),"Go Back"]})]})});const It=({images:$})=>{const[re,he]=k.useState(0),[se,ye]=k.useState(!1);return $.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative w-16 flex-shrink-0 mt-1.5",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),ye(!0)},className:"block w-16 h-16 rounded-lg overflow-hidden border border-gray-600 hover:border-blue-500 transition-colors cursor-pointer",children:e.jsx("img",{src:$[re],alt:"",className:"w-full h-full object-cover bg-gray-700",onError:De=>{De.target.style.display="none"}})}),$.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Previous",children:e.jsx(O.ChevronLeft,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[re+1,"/",$.length]}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Next",children:e.jsx(O.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 z-[2000] bg-black/80 flex items-center justify-center p-4",onClick:()=>ye(!1),children:e.jsxs("div",{className:"relative max-w-3xl max-h-[85vh] w-full flex items-center justify-center",onClick:De=>De.stopPropagation(),children:[e.jsx("img",{src:$[re],alt:"",className:"max-w-full max-h-[80vh] rounded-lg object-contain"}),e.jsx("button",{onClick:()=>ye(!1),className:"absolute top-2 right-2 text-white/70 hover:text-white bg-black/50 rounded-full p-1.5 transition-colors",title:"Close",children:e.jsx("span",{className:"text-lg leading-none",children:"×"})}),$.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-5 w-5"})}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronRight,{className:"h-5 w-5"})}),e.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-black/50 text-white text-xs px-3 py-1 rounded-full",children:[re+1," / ",$.length]})]})]})})]})},sr=($,re,he)=>{const se=$.json_metadata?.image?.length?$.json_metadata.image:[],ye=$.json_metadata?.description||($.body?ad($.body):""),De=$.payout?$.payout.toFixed(3):$.pending_payout_value?$.pending_payout_value.replace(/[^\d.]/g,""):"0.000",lt=De,Xe=[],Qe=$.percent_hbd??1e4;if(Qe===0?Xe.push("Hive Rewards Payout 100% Powered Up"):Xe.push(`Hive Rewards Payout (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`),$.is_paidout){const et=$.author_payout_value?$.author_payout_value.replace(/[^\d.]/g,""):"";Xe.push("Past payouts:"),Xe.push(`${De} Hive Rewards${et?` (Author ${et})`:""}`)}else{if($.payout_at){const et=new Date($.payout_at),Pt=new Date,Xt=et.getTime()-Pt.getTime();if(Xt>0){const Lt=Math.floor(Xt/36e5),dt=Math.floor(Lt/24),or=Lt%24,Yr=dt>0?`in ${dt} day${dt>1?"s":""}${or>0?` ${or} hour${or>1?"s":""}`:""}`:`in ${Lt} hour${Lt>1?"s":""}`;Xe.push(`Payout will occur: ${Yr}`)}}Qe===0?Xe.push(`${De} Hive Rewards (100% Powered Up)`):Xe.push(`${De} Hive Rewards (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`)}$.beneficiaries?.length>0&&(Xe.push("Beneficiaries:"),$.beneficiaries.forEach(et=>{Xe.push(`${et.account}: ${(et.weight/100).toFixed(0)}%`)}));const ct=Xe.join(`
1140
- `);return e.jsxs("div",{className:`border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors ${he?"cursor-pointer":""}`,onClick:he,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5 flex-shrink-0 w-16",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-10 h-10 rounded-full bg-gray-700 flex-shrink-0",onError:et=>{et.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=40`}}),e.jsx(It,{images:se})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("button",{onClick:et=>{et.stopPropagation(),m?.($.author)},className:"font-medium text-white hover:text-blue-400 text-sm",children:["@",$.author]}),e.jsx("span",{className:"text-xs text-gray-500",children:fn($.created)})]}),$.title&&e.jsx("button",{onClick:()=>_?.($.author,$.permlink,$.title),className:"text-left text-base font-semibold text-white mb-1 line-clamp-2 hover:text-blue-400",children:$.title}),ye&&e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2",children:ye.substring(0,200)}),$.community_title&&e.jsxs("span",{className:"inline-block mt-1 text-xs text-blue-400 font-medium",children:["#",$.community_title]})]})]}),e.jsx("div",{className:"mt-3 pt-2 border-t border-gray-700/50",onClick:et=>et.stopPropagation(),children:e.jsx(kn,{author:$.author,permlink:$.permlink,currentUser:r,hiveValue:lt,hiveIconUrl:"/images/hive_logo.png",payoutTooltip:ct,initialVotes:$.active_votes||[],initialCommentsCount:$.children||0,onUpvote:x?et=>x($.author,$.permlink,et):void 0,onSubmitComment:g?(et,Pt,Xt)=>g(et,Pt,Xt):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ve({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!z,onComments:z?()=>z($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},xr=$=>{const re=$.poll_stats?.total_voting_accounts_num||0,he=$.status==="Active",De=new Date($.end_time)<new Date,lt=$.post_body?ad($.post_body):"",Xe=$.poll_choices?.length||0;return e.jsxs("div",{className:"border border-gray-700 rounded-lg bg-gray-800 hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>A?.($.author,$.permlink,$.question),children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-8 h-8 rounded-full bg-gray-700",onError:Qe=>{Qe.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=32`}}),e.jsxs("div",{children:[e.jsxs("button",{onClick:Qe=>{Qe.stopPropagation(),m?.($.author)},className:"text-sm font-medium text-white hover:text-blue-400",children:["@",$.author]}),e.jsx("p",{className:"text-[10px] text-gray-500",children:fn($.created)})]})]}),e.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${he&&!De?"bg-green-500/20 text-green-400":"bg-gray-600/30 text-gray-400"}`,children:he&&!De?"Active":"Ended"})]}),e.jsx("h3",{className:"text-sm font-semibold text-white mb-1",children:$.question}),lt&&e.jsx("p",{className:"text-gray-400 text-xs line-clamp-2 mb-2",children:lt.substring(0,150)}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500",children:[e.jsxs("span",{children:[re," voter",re!==1?"s":""]}),e.jsxs("span",{children:[Xe," option",Xe!==1?"s":""]}),$.poll_stats?.total_hive_hp!=null&&$.poll_stats.total_hive_hp>0&&e.jsxs("span",{children:[($.poll_stats.total_hive_hp/1e3).toFixed(1),"k HP"]}),$.end_time&&e.jsx("span",{children:he&&!De?`Ends ${fn($.end_time)}`:"Ended"})]})]}),e.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-gray-700/50",onClick:Qe=>Qe.stopPropagation(),children:e.jsx(kn,{author:$.author,permlink:$.permlink,currentUser:r,hiveIconUrl:"/images/hive_logo.png",initialVotes:[],initialCommentsCount:0,onUpvote:x?Qe=>x($.author,$.permlink,Qe):void 0,onSubmitComment:g?(Qe,ct,et)=>g(Qe,ct,et):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ve({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!z,onComments:z?()=>z($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},br=($,re)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$}/avatar`,alt:$,className:"w-10 h-10 rounded-full flex-shrink-0 bg-gray-700",onError:he=>{he.target.src=`https://ui-avatars.com/api/?name=${$}&background=random&size=40`}}),e.jsxs("button",{onClick:()=>m?.($),className:"font-medium text-white hover:text-blue-400",children:["@",$]})]})},`${$}-${re}`),lr=($=5)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),he%2===0&&e.jsx("div",{className:"h-32 bg-gray-700 rounded-lg w-20 mb-3"}),e.jsxs("div",{className:"flex gap-4 mt-2",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))}),ur=($=8)=>e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},he))}),nr=($=3)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-14"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-3"}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-3/4"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"})]})]})]})},he))}),yr=()=>e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsxs("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-5 h-5 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-44"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[1,2,3,4].map($=>e.jsxs("div",{className:"bg-gray-900/50 rounded-lg p-2.5",children:[e.jsx("div",{className:"h-2.5 bg-gray-700 rounded w-12 mb-2"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded w-16"})]},$))})]}),[1,2,3,4,5].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))]}),Ir=()=>{switch(B){case"blogs":case"posts":case"snaps":case"comments":case"replies":return lr();case"followers":case"following":case"badges":case"witnessVotes":return ur();case"polls":return nr();case"authorRewards":case"curationRewards":return yr();default:return lr()}},st=$=>{if(!$||!isFinite($)||$<=0)return"—";const re=Math.floor($/1e3),he=Math.floor(re/60),se=Math.floor(he/60),ye=Math.floor(se/24);return ye>=1?`${ye}d ${se%24}h`:se>=1?`${se}h ${he%60}m`:`${Math.max(1,he)}m`},We=($,re=3)=>$==null||isNaN($)?"—":Number($).toLocaleString(void 0,{maximumFractionDigits:re,minimumFractionDigits:re}),Zt=()=>{if(I&&de.length===0)return yr();if(de.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending author rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts/comments with pending payouts"})]});const $=de.filter(he=>!he.isComment).length,re=de.length-$;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-amber-900/30 to-orange-900/30 rounded-xl p-4 border border-amber-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.Award,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-sm font-semibold text-amber-300",children:"Pending Author Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-amber-400",children:["$",We(fe.totalHbd)]})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-orange-400",children:We(fe.totalHpEq)})]})]})]}),de.map((he,se)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(he.author,he.permlink,he.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:he.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:he.title||`${he.author}/${he.permlink}`}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:he.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(he.payoutMs)]}),e.jsxs("span",{className:"text-amber-400 font-medium",children:["$",We(he.hbd)," HBD"]}),he.hpEq!==null&&e.jsxs("span",{className:"text-orange-400 font-medium",children:[We(he.hpEq)," HP"]}),he.beneficiaryCut>0&&e.jsxs("span",{className:"text-gray-500",children:["Beneficiary: ",(he.beneficiaryCut*100).toFixed(0),"%"]})]})]})]})},`${he.author}-${he.permlink}-${se}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(he=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))})]})},ir=()=>{if(I&&Se.length===0)return yr();if(Se.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.TrendingUp,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending curation rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts you voted on with pending payouts"})]});const $=Se.filter(ye=>!ye.isComment).length,re=Se.length-$,he=Se.filter(ye=>ye.efficiency!==null),se=he.length>0?he.reduce((ye,De)=>ye+(De.efficiency||0),0)/he.length:null;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-blue-900/30 to-purple-900/30 rounded-xl p-4 border border-blue-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.TrendingUp,{className:"w-5 h-5 text-blue-400"}),e.jsx("h3",{className:"text-sm font-semibold text-blue-300",children:"Pending Curation Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-blue-400",children:We(Ge.totalHp)})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-purple-400",children:["$",We(Ge.totalHbd)]})]}),se!==null&&e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Avg Efficiency"}),e.jsxs("p",{className:`text-lg font-bold ${se>=100?"text-emerald-400":"text-amber-400"}`,children:[se.toFixed(1),"%"]})]})]})]}),Se.map((ye,De)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(ye.author,ye.permlink,ye.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:ye.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:ye.title||`${ye.author}/${ye.permlink}`}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["by @",ye.author]})]}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:ye.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(ye.payoutMs)]}),e.jsxs("span",{className:"text-blue-400 font-medium",children:[We(ye.hp)," HP"]}),e.jsxs("span",{className:"text-purple-400 font-medium",children:["$",We(ye.hbd)," HBD"]}),e.jsxs("span",{className:"text-gray-500",children:["Vote: ",ye.weightPct.toFixed(0),"%"]}),ye.efficiency!==null&&e.jsxs("span",{className:`font-medium ${ye.efficiency>=100?"text-emerald-400":"text-amber-400"}`,children:["Eff: ",ye.efficiency.toFixed(1),"%"]}),ye.votedAfterMs!==null&&e.jsxs("span",{className:"text-gray-500",children:["Voted after ",st(ye.votedAfterMs)]})]})]})]})},`${ye.author}-${ye.permlink}-${De}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(ye=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-14"})]})]})]})},ye))})]})},Fr=()=>{if(B==="wallet")return e.jsx("div",{className:"max-w-lg mx-auto",children:e.jsx(h0,{username:$e})});if(B==="activities")return e.jsx(g0,{username:$e,onClickPermlink:C,onSelectActivity:T});if(B==="authorRewards")return Zt();if(B==="curationRewards")return ir();if(B==="votingPower"){if(I)return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6 animate-pulse",children:[[1,2,3].map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-32"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded-full w-full"})]},dt)),e.jsxs("div",{className:"mt-4 p-4 bg-gray-800 rounded-xl border border-gray-700",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-40 mb-3"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-full w-full"})]})]});if(!kt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Gauge,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Voting power data unavailable"})]});const{maxMana:se,rewardBalance:ye,recentClaims:De,feedPrice:lt}=kt,Xe=S*100,Qe=se*.02*(Xe/1e4),ct=De>0?Qe/De*ye:0,et=ct*lt,Pt=kt.upvotePower<S*2/100,Xt=(dt,or=3)=>isNaN(dt)?"—":dt.toLocaleString(void 0,{minimumFractionDigits:or,maximumFractionDigits:or}),Lt=[{label:"Voting Power",value:kt.upvotePower,color:"#10b981"},{label:"Downvote Power",value:kt.downvotePower,color:"#f59e0b"},{label:"Resource Credits",value:kt.resourceCredits,color:"#3b82f6"}];return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-gray-800 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-200",children:"Vote Value"}),e.jsxs("span",{className:"text-xs font-bold text-blue-400",children:[S,"%"]})]}),e.jsx("div",{className:"text-[13px] text-gray-400 mb-3",children:De>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-white font-medium",children:[Xt(et)," HBD"]}),e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsxs("span",{className:"text-gray-300",children:["~",Xt(ct)," HIVE"]}),Pt&&e.jsx("span",{className:"ml-2 text-amber-400 text-xs",children:"⚠ low mana"})]}):e.jsxs("span",{children:["Vote @",S,"% · —"]})}),e.jsx("input",{type:"range",min:0,max:100,step:5,value:S,onChange:dt=>P(Number(dt.target.value)),className:"w-full h-2 rounded-full appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #3b82f6 0%, #3b82f6 ${S}%, #374151 ${S}%, #374151 100%)`,accentColor:"#3b82f6"}}),e.jsxs("div",{className:"flex justify-between text-[11px] text-gray-500 mt-1",children:[e.jsx("span",{children:"0%"}),e.jsx("span",{children:"25%"}),e.jsx("span",{children:"50%"}),e.jsx("span",{children:"75%"}),e.jsx("span",{children:"100%"})]})]}),Lt.map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium text-gray-300",children:dt.label}),e.jsxs("span",{className:"text-sm font-bold text-white",children:[dt.value.toFixed(2),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-700 rounded-full h-3",children:e.jsx("div",{className:"h-3 rounded-full transition-all duration-500 ease-out",style:{width:`${Math.min(dt.value,100)}%`,backgroundColor:dt.color}})})]},dt.label))]})}if(B==="badges")return I?ur():Ke.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No badges found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Ke.map((se,ye)=>br(se,ye))});if(B==="witnessVotes")return I?ur():_t.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Shield,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No witness votes found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:_t.map((se,ye)=>br(se,ye))});if(I)return Ir();if(B==="followers")return St.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No followers found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:St.map((se,ye)=>br(se.follower,ye))});if(B==="following")return Tt.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Not following anyone"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Tt.map((se,ye)=>br(se.following,ye))});if(B==="polls")return Ye.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.BarChart3,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No polls found"})]}):e.jsx("div",{className:"space-y-3",children:Ye.map(se=>xr(se))});const re={blogs:{data:W,type:"blog",icon:O.FileText},posts:{data:Q,type:"post",icon:O.FileText},snaps:{data:we,type:"post",icon:O.Camera},comments:{data:Ae,type:"comment",icon:O.MessageCircle},replies:{data:ht,type:"reply",icon:O.Reply}}[B];if(!re)return null;if(re.data.length===0){const se=re.icon;return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(se,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsxs("p",{className:"text-gray-400",children:["No ",B," found"]})]})}const he=se=>{if(B==="snaps"&&E)return()=>E(se.author,se.permlink);if((B==="blogs"||B==="posts")&&_)return()=>_(se.author,se.permlink,se.title)};return e.jsx("div",{className:"space-y-3",children:re.data.map(se=>sr(se,re.type,he(se)))})},vt=[{id:"blogs",label:"Blogs",icon:O.FileText},{id:"posts",label:"Posts",icon:O.FileText},{id:"snaps",label:"Snaps",icon:O.Camera},{id:"polls",label:"Polls",icon:O.BarChart3},{id:"comments",label:"Comments",icon:O.MessageCircle},{id:"replies",label:"Replies",icon:O.Reply},{id:"activities",label:"Activities",icon:O.Activity},{id:"authorRewards",label:"Author Rewards",icon:O.Award},{id:"curationRewards",label:"Curation Rewards",icon:O.TrendingUp},{id:"followers",label:"Followers",icon:O.Users},{id:"following",label:"Following",icon:O.Users},{id:"wallet",label:"Wallet",icon:O.Wallet},{id:"votingPower",label:"Voting Power",icon:O.Gauge},{id:"badges",label:"Badges",icon:O.Award},{id:"witnessVotes",label:"Witness Votes",icon:O.Shield}],dr=a&&a.length>0?a.map($=>vt.find(re=>re.id===$)).filter($=>$!==void 0):vt,vr=r&&r!==$e;return e.jsx("div",{className:"dark flex flex-col h-full bg-gray-900",children:e.jsxs("div",{className:"flex flex-col overflow-y-auto h-full scrollbar-hide",children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 flex items-center",children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[s&&n&&e.jsx("button",{onClick:n,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors flex-shrink-0",children:e.jsx(O.ArrowLeft,{className:"h-5 w-5 text-gray-300"})}),e.jsx("img",{src:G.profileImage||`https://images.hive.blog/u/${$e}/avatar`,alt:$e,className:"w-8 h-8 rounded-full flex-shrink-0 bg-gray-700",onError:$=>{$.target.src=`https://images.hive.blog/u/${$e}/avatar`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-sm font-semibold text-white truncate",children:`@${$e}`}),G.reputation>0&&e.jsx("span",{className:"text-[10px] bg-gray-700 text-gray-300 px-1.5 py-0.5 rounded-full flex-shrink-0",children:ex(G.reputation)})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("button",{onClick:()=>pe("followers"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followersCount.toLocaleString()})," Followers"]}),e.jsxs("button",{onClick:()=>pe("following"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followingCount.toLocaleString()})," Following"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.postsCount.toLocaleString()})," Posts"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[U&&e.jsxs("button",{onClick:Rt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors relative",title:"Favourite list",children:[e.jsx(O.Heart,{className:`h-4 w-4 ${F?"text-red-500":"text-gray-400"}`,fill:F?"currentColor":"none"}),Y>0&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:Y>99?"99+":Y})]}),e.jsx("button",{onClick:mt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"Share profile",children:e.jsx(O.Share2,{className:"h-4 w-4 text-gray-400"})}),vr&&e.jsxs("div",{className:"relative",ref:xt,children:[e.jsx("button",{onClick:()=>Et($=>!$),className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"More actions",children:e.jsx(O.MoreVertical,{className:"h-4 w-4 text-gray-400"})}),Yt&&e.jsxs("div",{className:"absolute right-0 mt-1 w-48 rounded-lg border border-gray-700 bg-gray-800 shadow-xl z-[100]",onClick:$=>$.stopPropagation(),children:[(u||p)&&e.jsx("button",{onClick:()=>{Et(!1),Ot()},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-gray-200 hover:bg-gray-700 disabled:opacity-50 first:rounded-t-lg",children:G.isFollowing?"Unfollow":"Follow"}),b&&e.jsx("button",{onClick:()=>{Et(!1),ge(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-red-400 hover:bg-red-900/20 disabled:opacity-50",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Ban,{className:"h-4 w-4"})," Ignore Author"]})}),w&&e.jsx("button",{onClick:()=>{Et(!1),Pe(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-orange-400 hover:bg-orange-900/20 disabled:opacity-50 last:rounded-b-lg",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Flag,{className:"h-4 w-4"})," Report User"]})})]})]})]})]})}),e.jsxs("div",{className:"relative",children:[G.coverImage?e.jsx("div",{className:"w-full h-24 sm:h-32 bg-cover bg-center",style:{backgroundImage:`url(${G.coverImage})`}}):e.jsx("div",{className:"w-full h-24 sm:h-32 bg-gradient-to-r from-blue-600 to-purple-700"}),e.jsx("div",{className:"absolute inset-0 bg-gray-900/80"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-4 pb-3 pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-white truncate",children:G.name||`@${$e}`}),G.about&&e.jsx("p",{className:"text-gray-300 text-xs leading-relaxed mt-1 line-clamp-2",children:G.about})]}),H&&e.jsx("button",{onClick:qt,className:"p-2 hover:bg-white/10 rounded-lg transition-colors ml-2 flex-shrink-0",title:F?"Remove from favourites":"Add to favourites",children:e.jsx(O.Heart,{className:`h-5 w-5 ${F?"text-red-500":"text-white"}`,fill:F?"currentColor":"none"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1.5 text-[11px] text-gray-300",children:[G.location&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.MapPin,{className:"h-3 w-3 text-rose-400"})," ",G.location]}),G.website&&e.jsxs("a",{href:G.website.startsWith("http")?G.website:`https://${G.website}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-400 hover:underline",children:[e.jsx(O.Globe,{className:"h-3 w-3 text-blue-400"})," ",G.website]}),G.created&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Calendar,{className:"h-3 w-3 text-green-400"})," ",tx(G.created)]}),G.lastActivity&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 text-amber-400"})," ",fn(G.lastActivity)]}),G.votingPower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-yellow-400"})," VP ",G.votingPower.toFixed(1),"%"]}),G.hivePower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-orange-400"})," HP ",G.hivePower.toFixed(0)]})]})]})]}),e.jsxs("div",{className:"sticky top-[56px] z-20 bg-gray-800 border-b border-gray-700 relative flex items-center",children:[cr&&e.jsx("button",{onClick:()=>Mr("left"),className:"absolute left-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-4 w-4 text-white"})}),e.jsx("div",{ref:Je,className:"flex overflow-x-auto scrollbar-hide",children:dr.map($=>{const re=$.icon;return e.jsxs("button",{onClick:()=>pe($.id),className:`flex items-center gap-1 px-3 sm:px-4 py-2.5 text-xs sm:text-sm font-medium whitespace-nowrap transition-colors border-b-2 ${B===$.id?"text-blue-400 border-blue-400":"text-gray-400 border-transparent hover:text-gray-300 hover:border-gray-600"}`,children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:$.label})]},$.id)})}),rr&&e.jsx("button",{onClick:()=>Mr("right"),className:"absolute right-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronRight,{className:"h-4 w-4 text-white"})})]}),e.jsxs("div",{className:"p-4 flex-1",children:[Fr(),B!=="wallet"&&Ze[B]&&e.jsx("div",{ref:Dt,className:"min-h-[60px] py-2",children:be?e.jsx("div",{className:"animate-pulse space-y-3",children:B==="followers"||B==="following"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:[1,2].map($=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},$))}):e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/2"})]})]})})}):e.jsx("div",{className:"h-1"})}),B!=="wallet"&&!Ze[B]&&!I&&e.jsxs("div",{className:"text-center py-4 text-xs text-gray-600",children:["No more ",B," to load"]})]}),ft&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:()=>ge(!1),children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-xl max-w-sm w-full border border-gray-700 p-6",onClick:$=>$.stopPropagation(),children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Ignore Author"}),e.jsxs("p",{className:"text-sm text-gray-300 mb-6",children:["Are you sure you want to ignore"," ",e.jsxs("span",{className:"text-red-400 font-medium",children:["@",$e]}),"? Their content will be hidden from your feed."]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>ge(!1),disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700 disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Jt,disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg text-white bg-red-600 hover:bg-red-700 disabled:opacity-50",children:Mt?"Processing...":"Confirm Ignore"})]})]})}),e.jsx(rd,{isOpen:Te,onClose:()=>Pe(!1),onReport:At,reportType:"user",targetUsername:$e}),e.jsx(rd,{isOpen:!!ze,onClose:()=>Ve(null),onReport:async $=>{if(ze&&y){await y(ze.author,ze.permlink,$);const re=he=>he.author===ze.author&&he.permlink===ze.permlink;te(he=>he.filter(se=>!re(se))),Ie(he=>he.filter(se=>!re(se))),Me(he=>he.filter(se=>!re(se))),le(he=>he.filter(se=>!re(se))),Ne(he=>he.filter(se=>!re(se))),ae(he=>he.filter(se=>!re(se)))}Ve(null)},reportType:"post",targetUsername:ze?.author||"",targetPermlink:ze?.permlink})]})})},ax=t=>{window.open(t,"_blank")},sx=({app:t,backgroundColor:r,boxShadow:n})=>{const s=()=>{ax(t.url)};return e.jsx("div",{className:"card hover-lift cursor-pointer transition-all duration-300 h-full",onClick:s,style:{backgroundColor:r??"rgba(15,23,42,0.9)",boxShadow:n??"0 18px 45px rgba(0,0,0,0.6)",border:"1px solid rgba(148,163,184,0.25)"},children:e.jsx("div",{className:"card-body p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:t.useCircleBackground!==!1?e.jsx("div",{className:"avatar",children:e.jsx("div",{className:"w-16 h-16 rounded-full",children:e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-full h-full object-cover",onError:a=>{a.currentTarget.src="/placeholder.svg"}})})}):e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-16 h-16 object-contain",onError:a=>{a.currentTarget.src="/placeholder.svg"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("h3",{className:"card-title text-lg font-bold text-base-content mb-2 line-clamp-2",children:t.name}),t.isComingSoon&&e.jsx("div",{className:"badge badge-warning badge-sm",children:"Coming Soon"})]}),e.jsx("div",{className:"text-base-content/70 text-sm leading-relaxed",children:t.description.split(`
1139
+ transition-colors cursor-pointer`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:Ee.userAvatar(f.following),alt:f.following,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.following}&background=random`}}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.following]})})]})},`${f.following}-${l}`))})})},j0=({username:t})=>{const[r,n]=k.useState(null),[s,a]=k.useState(!0),[i,o]=k.useState(null),c=async()=>{try{a(!0),o(null);const u=await Ee.getProfile(t);n(u)}catch(u){o(u instanceof Error?u.message:"Failed to load user details")}finally{a(!1)}};k.useEffect(()=>{c()},[t]);const d=u=>{try{return new Date(u).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return u}},f=u=>u.replace(/<[^>]*>/g,"");if(s)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading user details..."]})});if(i)return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load user details"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:i}),e.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[e.jsx(O.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!r?.result)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No user details available"})});const l=r.result,h=l.metadata?.profile;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[h?.about&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(h.about)})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Location"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:h?.location||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Website"}),e.jsx("a",{href:h?.website,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-500 hover:underline",children:h?.website||"Not specified"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Joined"}),e.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l.created?d(l.created):"Unknown"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Followers"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.followers?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Following"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.stats?.following?.toLocaleString()||"0"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Post Count"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:l.post_count?.toLocaleString()||"0"})]})]})]})})},Kg=({username:t,onVideoClick:r,onAuthorClick:n,onBack:s,onClickUserInfoTab:a,onClickFollowersTab:i,onClickFollowingTab:o,onBookmarkToggle:c,onRss:d,onShare:f,onMoreMenu:l,showMoreMenu:h=!1})=>{const[u,p]=k.useState("videos"),[b,w]=k.useState(null),[x,g]=k.useState(!1),[v,N]=k.useState(!0);k.useEffect(()=>{(async()=>{try{N(!0);const C=await Ee.getProfile(t);w(C)}catch(C){console.error("Failed to fetch user details:",C)}finally{N(!1)}})()},[t]);const j=()=>{if(f)f(t);else{const A=`https://3speak.tv/user/${t}`;navigator.share?navigator.share({title:b?.result?.name||t,url:A}):navigator.clipboard.writeText(A)}},y=()=>{d?d(t):window.open(`https://3speak.tv/rss/${t}.xml`,"_blank")},m=A=>{n(A)};if(v)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),e.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((A,C)=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},C))})]})]})});const _=b?.result,E=_?.metadata?.profile;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("button",{onClick:s,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[e.jsx(O.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden",children:[e.jsx("img",{src:E.cover_image||Ee.userAvatar(t),alt:"Cover",className:"w-full h-48 object-cover",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[e.jsx("img",{src:E?.profile_image,alt:E?.name,className:"w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",onError:A=>{A.target.src=Ee.userAvatar(t)}}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:E?.name||t}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:E?.about||"No description available"}),e.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.followers||0).toLocaleString()," Followers"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Users,{className:"w-4 h-4"}),e.jsxs("span",{children:[(_?.stats?.following||0).toLocaleString()," Following"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(O.Calendar,{className:"w-4 h-4"}),e.jsxs("span",{children:["Joined"," ",_?.created?new Date(_.created).getFullYear():"Unknown"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Io,{id:t,toastType:"user",onAdd:(A,C)=>{c?c(A,!0):console.log("Added:",A,C)},onRemove:(A,C)=>{c?c(A,!1):console.log("Removed:",A,C)}}),e.jsx("button",{onClick:y,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Rss,{className:"w-4 h-4"})}),e.jsx("button",{onClick:j,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.Share2,{className:"w-4 h-4"})}),h&&e.jsx("button",{onClick:()=>{l&&l(t)},className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:e.jsx(O.MoreVertical,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[{key:"videos",label:"Videos"},{key:"about",label:"User Info",callback:a},{key:"followers",label:"Followers",callback:i},{key:"following",label:"Following",callback:o}].map((A,C)=>e.jsx("button",{onClick:()=>{A.callback?A.callback():p(A.key)},className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${u===A.key?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:A.label},A.key))}),e.jsxs("div",{className:"mt-6",children:[u==="videos"&&e.jsx(En,{feedType:er.USER,username:t,onVideoClick:r,onAuthorClick:n}),u==="about"&&e.jsx(j0,{username:t}),u==="followers"&&e.jsx(w0,{username:t,onSelectUser:m}),u==="following"&&e.jsx(N0,{username:t,onSelectUser:m})]})]})]})},Qg=["Spam","Harassment or bullying","Hate speech","Violence or dangerous organizations","Intellectual property violation","Self-harm","Non-consensual intimate images","Doxxing","Minor safety","Other"],rd=({isOpen:t,onClose:r,onReport:n,reportType:s,targetUsername:a,targetPermlink:i})=>{const[o,c]=k.useState("select"),[d,f]=k.useState(""),[l,h]=k.useState(!1),u=x=>{f(x),c("confirm")},p=async()=>{if(d){h(!0);try{await n(d),r(),c("select"),f("")}catch(x){console.error("Report failed:",x)}finally{h(!1)}}},b=()=>{r(),c("select"),f("")},w=()=>{c("select"),f("")};return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:b,children:e.jsxs("div",{className:"bg-gray-900 rounded-xl shadow-xl max-w-md w-full max-h-[80vh] flex flex-col border border-gray-700",onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(O.Flag,{className:"h-5 w-5 text-red-500"}),e.jsxs("h3",{className:"text-lg font-semibold text-white",children:["Report ",s==="user"?"User":"Post"]})]}),e.jsx("button",{onClick:b,className:"p-1 hover:bg-gray-800 rounded transition-colors",children:e.jsx(O.X,{className:"h-5 w-5 text-gray-400"})})]}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:["@",a]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o==="select"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-gray-400 mb-4",children:["Why are you reporting this ",s,"?"]}),e.jsx("div",{className:"space-y-2",children:Qg.map(x=>e.jsx("button",{onClick:()=>u(x),className:"w-full text-left px-4 py-3 border border-gray-700 rounded-lg text-gray-300 hover:bg-gray-800 hover:border-gray-600 transition-colors",children:x},x))})]}),o==="confirm"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(O.AlertTriangle,{className:"h-6 w-6 text-red-500"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white mb-2",children:"Report Summary"}),e.jsxs("div",{className:"space-y-2 text-sm text-gray-400",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Type:"})," ",s==="user"?"User":"Post"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Target:"})," @",a]}),s==="post"&&i&&e.jsxs("p",{children:[e.jsx("strong",{children:"Post:"})," ",i]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Reason:"})," ",d]})]})]})]}),e.jsx("div",{className:"bg-yellow-900/20 border border-yellow-800 rounded-lg p-3",children:e.jsx("p",{className:"text-xs text-yellow-200",children:"Reports are reviewed by our moderation team. False reports may result in action against your account."})})]})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-700 flex items-center justify-end space-x-3",children:[o==="select"&&e.jsx("button",{onClick:b,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Cancel"}),o==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:w,className:"px-4 py-2 border border-gray-600 text-gray-300 rounded-lg hover:bg-gray-800 transition-colors",children:"Back"}),e.jsx("button",{onClick:p,disabled:l,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l?"Reporting...":"Submit Report"})]})]})]})}):null},fn=t=>{const r=new Date,n=new Date(t),s=Math.floor((r.getTime()-n.getTime())/1e3);return s<60?"just now":s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:s<2592e3?`${Math.floor(s/86400)}d ago`:n.toLocaleDateString()},ex=t=>{if(t===0)return"25";const r=t<0;let n=r?-t:t,s=Math.log10(n);return s=Math.max(s-9,0),s=(r?-1:1)*s,s=s*9+25,Math.round(s).toString()},tx=t=>{try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return t}},ad=t=>{let r=t;return r=r.replace(/<[^>]*>/g,""),r=r.replace(/!\[.*?\]\([^\s)]+\)/g,""),r=r.replace(/\[([^\]]*)\]\([^\s)]+\)/g,"$1"),r=r.replace(/https?:\/\/[^\s)>\]]+/g,""),r=r.replace(/\[.*?\]/g,""),r=r.replace(/\(https?:\/\/[^\s)]*\)/g,""),r=r.replace(/[*_~`#>|]/g,""),r=r.replace(/^[-_*]{3,}\s*$/gm,""),r=r.replace(/\s+/g," ").trim(),r},rx=({username:t,currentUsername:r,onBack:n,showBackButton:s=!1,tabShown:a,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f,reportedPosts:l=[],reportedAuthors:h=[],onFollow:u,onUnfollow:p,onIgnoreAuthor:b,onReportUser:w,onUpvote:x,onSubmitComment:g,onClickCommentUpvote:v,onReblog:N,onTip:j,onReportPost:y,onUserClick:m,onPostClick:_,onSnapClick:E,onPollClick:A,onActivityPermlink:C,onActivitySelect:T,onShare:D,onSharePost:L,onCommentClick:z,onFavouriteList:U,onAddToFavourite:H,isFavourited:F=!1,favouriteCount:Y=0})=>{const[G,ne]=k.useState(null),[ie,xe]=k.useState(!0),[V,q]=k.useState(null),[B,pe]=k.useState("blogs"),[ee,te]=k.useState([]),[_e,Ie]=k.useState([]),[K,le]=k.useState([]),[oe,Ne]=k.useState([]),[Ce,Me]=k.useState([]),[Fe,ue]=k.useState(null),[Re,ae]=k.useState([]),[de,ve]=k.useState([]),[fe,ke]=k.useState({totalHbd:0,totalHpEq:0}),[Se,Be]=k.useState([]),[Ge,pt]=k.useState({totalHp:0,totalHbd:0}),[jt,gt]=k.useState(!1),[St,Ct]=k.useState([]),[Tt,Bt]=k.useState([]),[Ke,at]=k.useState([]),[_t,Ut]=k.useState([]),[kt,Vt]=k.useState(null),[S,P]=k.useState(100),[I,Z]=k.useState(!1),[be,Oe]=k.useState(!1),[Ze,Ue]=k.useState({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),He=20,bt=100,Dt=k.useRef(null),[Mt,$t]=k.useState(!1),[Zt,Et]=k.useState(!1),[ft,ge]=k.useState(!1),[Te,Pe]=k.useState(!1),[ze,Ve]=k.useState(null),xt=k.useRef(null),Je=k.useRef(null),[cr,Or]=k.useState(!1),[rr,Lr]=k.useState(!1),Ht=k.useCallback(()=>{const $=Je.current;$&&(Or($.scrollLeft>0),Lr($.scrollLeft+$.clientWidth<$.scrollWidth-1))},[]);k.useEffect(()=>{const $=Je.current;if(!$)return;Ht(),$.addEventListener("scroll",Ht);const re=new ResizeObserver(Ht);return re.observe($),()=>{$.removeEventListener("scroll",Ht),re.disconnect()}},[Ht]);const Mr=k.useCallback($=>{const re=Je.current;re&&re.scrollBy({left:$==="left"?-150:150,behavior:"smooth"})},[]);$o();const $e=t.replace(/^@/,"").trim(),ar=k.useMemo(()=>new Set(l.map($=>`${$.author}/${$.permlink}`)),[l]),kr=k.useMemo(()=>new Set(h),[h]),ut=k.useCallback($=>$.filter(re=>!kr.has(re.author)&&!ar.has(`${re.author}/${re.permlink}`)),[ar,kr]);k.useEffect(()=>{const $=re=>{xt.current&&!xt.current.contains(re.target)&&Et(!1)};return document.addEventListener("click",$),()=>document.removeEventListener("click",$)},[]),k.useEffect(()=>{(async()=>{if($e){xe(!0),q(null);try{const[re,he,se]=await Promise.all([Ee.getProfile($e),Ee.getAccounts([$e]),Ee.getDynamicGlobalProperties()]),ye=re?.result,De=he?.[0];if(!ye){q("User not found");return}let lt;if(se&&De?.vesting_shares){const Lt=parseFloat(De.vesting_shares.split(" ")[0]),dt=parseFloat(se.total_vesting_shares.split(" ")[0]),or=parseFloat(se.total_vesting_fund_hive.split(" ")[0]);lt=Lt/dt*or}let Xe;De?.voting_power&&(Xe=De.voting_power/1e4*100);let Qe=!1;if(r&&r!==$e)try{Qe=(await Ee.getFollowing(r)).some(dt=>dt.following===$e)}catch{}let ct=null;if(De?.posting_json_metadata)try{ct=JSON.parse(De.posting_json_metadata)?.profile}catch{}let et=null;if(De?.json_metadata)try{et=JSON.parse(De.json_metadata)?.profile}catch{}const Pt=ye.metadata?.profile,Kt={username:ye.name,name:ct?.name||et?.name||Pt?.name,about:ct?.about||et?.about||Pt?.about,location:ct?.location||et?.location||Pt?.location,website:ct?.website||et?.website||Pt?.website,profileImage:ct?.profile_image||et?.profile_image||Pt?.profile_image,coverImage:ct?.cover_image||et?.cover_image||Pt?.cover_image,followersCount:ye.stats?.followers||0,followingCount:ye.stats?.following||0,postsCount:ye.post_count||0,reputation:ye.reputation||0,isFollowing:Qe,created:ye.created,lastActivity:De?.last_post,hivePower:lt,votingPower:Xe};ne(Kt)}catch(re){console.error("Error fetching user profile:",re),q("Failed to load user profile")}finally{xe(!1)}}})()},[$e,r]),k.useEffect(()=>{te([]),Ie([]),Me([]),ue(null),ae([]),ve([]),ke({totalHbd:0,totalHpEq:0}),Be([]),pt({totalHp:0,totalHbd:0}),le([]),Ne([]),Ct([]),Bt([]);const $=a&&a.length>0?a[0]:"blogs";pe($),Ue({blogs:!0,posts:!0,snaps:!0,polls:!1,comments:!0,replies:!0,activities:!1,authorRewards:!1,curationRewards:!1,followers:!0,following:!0,wallet:!1,votingPower:!1,badges:!1,witnessVotes:!1}),at([]),Ut([]),Vt(null),P(100)},[$e]),k.useEffect(()=>{const $=new AbortController,{signal:re}=$;return(async()=>{if($e){Z(!0),gt(!1),B==="authorRewards"&&(ve([]),ke({totalHbd:0,totalHpEq:0})),B==="curationRewards"&&(Be([]),pt({totalHp:0,totalHbd:0}));try{switch(B){case"blogs":{const se=ut(await Ee.getUserBlogs($e,He,void 0,void 0,re));te(se),Ue(ye=>({...ye,blogs:se.length>=He}));break}case"posts":{const se=ut(await Ee.getUserPosts($e,He,void 0,void 0,re));Ie(se),Ue(ye=>({...ye,posts:se.length>=He}));break}case"snaps":{const{snaps:se,nextStartId:ye}=await Ee.getUserSnaps($e,void 0,r,re);Me(ut(se)),ue(ye),Ue(De=>({...De,snaps:ye!==null}));break}case"polls":{const se=ut(await Ee.getUserPolls($e,re));ae(se),Ue(ye=>({...ye,polls:!1}));break}case"comments":{const se=ut(await Ee.getUserComments($e,He,void 0,void 0,re));le(se),Ue(ye=>({...ye,comments:se.length>=He}));break}case"replies":{const se=ut(await Ee.getUserReplies($e,He,void 0,void 0,re));Ne(se),Ue(ye=>({...ye,replies:se.length>=He}));break}case"followers":{const se=await Ee.getFollowers($e,null,bt,re);Ct(se),Ue(ye=>({...ye,followers:se.length>=bt}));break}case"following":{const se=await Ee.getFollowing($e,null,bt,re);Bt(se),Ue(ye=>({...ye,following:se.length>=bt}));break}case"authorRewards":{gt(!0);const se=await Ee.getPendingAuthorRewards($e,(ye,De,lt)=>{re.aborted||(ve([...ye]),ke({totalHbd:De,totalHpEq:lt}),Z(!1))},re);ve(se.rows),ke({totalHbd:se.totalHbd,totalHpEq:se.totalHpEq}),gt(!1);break}case"curationRewards":{gt(!0);const se=await Ee.getPendingCurationRewards($e,(ye,De,lt)=>{re.aborted||(Be([...ye]),pt({totalHp:De,totalHbd:lt}),Z(!1))},re);Be(se.rows),pt({totalHp:se.totalHp,totalHbd:se.totalHbd}),gt(!1);break}case"votingPower":{const[se,,ye]=await Promise.all([Ee.getAccounts([$e],re),Ee.getDynamicGlobalProperties(re),Ee.getFeedHistory(re)]),De=se?.[0];if(De){const Xe=M=>parseFloat(String(M).split(" ")[0])||0,ct=(Xe(De.vesting_shares)+Xe(De.received_vesting_shares)-Xe(De.delegated_vesting_shares))*1e6,et=Math.floor(Date.now()/1e3)-De.voting_manabar.last_update_time;let Pt=parseFloat(String(De.voting_manabar.current_mana))+et*ct/432e3;Pt>ct&&(Pt=ct);const Kt=ct>0?Pt/ct*100:0,Lt=ct/4,dt=Math.floor(Date.now()/1e3)-De.downvote_manabar.last_update_time;let or=parseFloat(String(De.downvote_manabar.current_mana))+dt*Lt/432e3;or>Lt&&(or=Lt);const Yr=Lt>0?or/Lt*100:0;let ra=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"rc_api.find_rc_accounts",params:{accounts:[$e]},id:1}),signal:re})).json())?.result?.rc_accounts?.[0];if(me){const qe=parseFloat(me.rc_manabar.current_mana),nt=parseFloat(me.max_rc);nt>0&&(ra=qe/nt*100)}}catch{}let R=0,J=0,X=0;try{const me=(await(await fetch("https://api.hive.blog/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_reward_fund",params:["post"],id:1}),signal:re})).json())?.result;me&&(R=Xe(me.reward_balance),J=parseFloat(me.recent_claims)||0)}catch{}if(ye?.current_median_history){const M=Xe(ye.current_median_history.base),ce=Xe(ye.current_median_history.quote)||1;X=M/ce}Vt({upvotePower:Math.min(Kt,100),downvotePower:Math.min(Yr,100),resourceCredits:Math.min(ra,100),maxMana:ct,rewardBalance:R,recentClaims:J,feedPrice:X})}break}case"badges":{let se=[],ye=null,De=!0;for(;De;){const Xe=await Ee.getFollowers($e,ye,1e3,re);se=[...se,...Xe],Xe.length<1e3?De=!1:ye=Xe[Xe.length-1].follower}const lt=se.map(Xe=>Xe.follower).filter(Xe=>Xe.startsWith("badge-"));at(lt);break}case"witnessVotes":{const ye=(await Ee.getAccounts([$e],re))?.[0];ye?.witness_votes&&Ut(ye.witness_votes);break}}}catch(se){if(se?.name==="AbortError")return;console.error(`Error fetching ${B}:`,se)}finally{re.aborted||Z(!1)}}})(),()=>{$.abort()}},[$e,B]);const W=k.useMemo(()=>ut(ee),[ee,ut]),Q=k.useMemo(()=>ut(_e),[_e,ut]),we=k.useMemo(()=>ut(Ce),[Ce,ut]),Ae=k.useMemo(()=>ut(K),[K,ut]),ht=k.useMemo(()=>ut(oe),[oe,ut]),Ye=k.useMemo(()=>ut(Re),[Re,ut]),yt=k.useCallback(async()=>{if(!(be||!Ze[B]||!$e)){Oe(!0);try{switch(B){case"blogs":{const $=ee[ee.length-1];if(!$)break;const re=await Ee.getUserBlogs($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);te(se=>[...se,...he]),Ue(se=>({...se,blogs:he.length>=He-1}));break}case"posts":{const $=_e[_e.length-1];if(!$)break;const re=await Ee.getUserPosts($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ie(se=>[...se,...he]),Ue(se=>({...se,posts:he.length>=He-1}));break}case"snaps":{if(!Fe)break;const{snaps:$,nextStartId:re}=await Ee.getUserSnaps($e,Fe,r);Me(he=>[...he,...ut($)]),ue(re),Ue(he=>({...he,snaps:re!==null}));break}case"comments":{const $=K[K.length-1];if(!$)break;const re=await Ee.getUserComments($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);le(se=>[...se,...he]),Ue(se=>({...se,comments:he.length>=He-1}));break}case"replies":{const $=oe[oe.length-1];if(!$)break;const re=await Ee.getUserReplies($e,He,$.author,$.permlink),he=ut(re.length>0&&re[0].permlink===$.permlink?re.slice(1):re);Ne(se=>[...se,...he]),Ue(se=>({...se,replies:he.length>=He-1}));break}case"followers":{const $=St[St.length-1];if(!$)break;const re=await Ee.getFollowers($e,$.follower,bt),he=re.length>0&&re[0].follower===$.follower?re.slice(1):re;Ct(se=>[...se,...he]),Ue(se=>({...se,followers:he.length>=bt-1}));break}case"following":{const $=Tt[Tt.length-1];if(!$)break;const re=await Ee.getFollowing($e,$.following,bt),he=re.length>0&&re[0].following===$.following?re.slice(1):re;Bt(se=>[...se,...he]),Ue(se=>({...se,following:he.length>=bt-1}));break}}}catch($){console.error(`Error loading more ${B}:`,$)}finally{Oe(!1)}}},[B,$e,r,be,Ze,ee,_e,Ce,Fe,K,oe,St,Tt]);k.useEffect(()=>{const $=Dt.current;if(!$)return;const re=new IntersectionObserver(he=>{he[0].isIntersecting&&yt()},{rootMargin:"200px"});return re.observe($),()=>re.disconnect()},[yt]);const Ot=k.useCallback(async()=>{if(G){$t(!0),Et(!1);try{const $=G.isFollowing;$&&p?await p($e):!$&&u&&await u($e),ne(re=>re&&{...re,isFollowing:!$,followersCount:$?Math.max(0,re.followersCount-1):re.followersCount+1}),setTimeout(async()=>{try{const re=await Ee.getProfile($e);re?.result?.stats&&ne(he=>he&&{...he,followersCount:re.result.stats.followers??he.followersCount,followingCount:re.result.stats.following??he.followingCount})}catch{}},3e3)}catch($){console.error("Follow/Unfollow error:",$)}finally{$t(!1)}}},[G,$e,u,p]),Jt=k.useCallback(async()=>{$t(!0);try{b&&await b($e),ge(!1),Et(!1)}catch($){console.error("Error ignoring user:",$)}finally{$t(!1)}},[$e,b]),At=k.useCallback(async $=>{$t(!0);try{w&&await w($e,$),Pe(!1),Et(!1)}catch(re){console.error("Error reporting user:",re)}finally{$t(!1)}},[$e,w]),mt=k.useCallback(()=>{D?.($e)},[$e,D]),Rt=k.useCallback(async()=>{U&&await U()},[U]),qt=k.useCallback(async()=>{H&&await H($e)},[$e,H]);if(ie)return e.jsxs("div",{className:"dark h-full overflow-y-auto animate-pulse bg-gray-900",children:[e.jsxs("div",{className:"sticky top-0 z-30 bg-gray-900 border-b border-gray-700 px-4 py-3 flex items-center gap-3",children:[s&&e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"}),e.jsx("div",{className:"w-9 h-9 bg-gray-700 rounded-full"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28 mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-36"})]}),e.jsx("div",{className:"w-8 h-8 bg-gray-700 rounded-full"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"h-36 sm:h-44 bg-gray-800 w-full"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-48 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-64 mb-3"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-28"})]})]})]}),e.jsx("div",{className:"border-b border-gray-700 px-2 py-2 flex gap-1 overflow-x-auto",children:[80,64,72,96,80,64,72].map(($,re)=>e.jsx("div",{className:"h-8 bg-gray-800 rounded-lg flex-shrink-0",style:{width:$}},re))}),e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3,4].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))})]});if(V||!G)return e.jsx("div",{className:"dark flex items-center justify-center min-h-[400px] bg-gray-900",children:e.jsxs("div",{className:"text-center",children:[e.jsx(O.User,{className:"h-14 w-14 text-gray-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-1",children:"User Not Found"}),e.jsx("p",{className:"text-gray-400",children:V||"This user does not exist"}),s&&n&&e.jsxs("button",{onClick:n,className:"mt-4 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700",children:[e.jsx(O.ArrowLeft,{className:"h-4 w-4 mr-2"}),"Go Back"]})]})});const It=({images:$})=>{const[re,he]=k.useState(0),[se,ye]=k.useState(!1);return $.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative w-16 flex-shrink-0 mt-1.5",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),ye(!0)},className:"block w-16 h-16 rounded-lg overflow-hidden border border-gray-600 hover:border-blue-500 transition-colors cursor-pointer",children:e.jsx("img",{src:$[re],alt:"",className:"w-full h-full object-cover bg-gray-700",onError:De=>{De.target.style.display="none"}})}),$.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Previous",children:e.jsx(O.ChevronLeft,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[re+1,"/",$.length]}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"p-0.5 text-gray-400 hover:text-white transition-colors",title:"Next",children:e.jsx(O.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 z-[2000] bg-black/80 flex items-center justify-center p-4",onClick:()=>ye(!1),children:e.jsxs("div",{className:"relative max-w-3xl max-h-[85vh] w-full flex items-center justify-center",onClick:De=>De.stopPropagation(),children:[e.jsx("img",{src:$[re],alt:"",className:"max-w-full max-h-[80vh] rounded-lg object-contain"}),e.jsx("button",{onClick:()=>ye(!1),className:"absolute top-2 right-2 text-white/70 hover:text-white bg-black/50 rounded-full p-1.5 transition-colors",title:"Close",children:e.jsx("span",{className:"text-lg leading-none",children:"×"})}),$.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt-1+$.length)%$.length)},className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-5 w-5"})}),e.jsx("button",{onClick:De=>{De.stopPropagation(),he(lt=>(lt+1)%$.length)},className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full p-2 transition-colors",children:e.jsx(O.ChevronRight,{className:"h-5 w-5"})}),e.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-black/50 text-white text-xs px-3 py-1 rounded-full",children:[re+1," / ",$.length]})]})]})})]})},sr=($,re,he)=>{const se=$.json_metadata?.image?.length?$.json_metadata.image:[],ye=$.json_metadata?.description||($.body?ad($.body):""),De=$.payout?$.payout.toFixed(3):$.pending_payout_value?$.pending_payout_value.replace(/[^\d.]/g,""):"0.000",lt=De,Xe=[],Qe=$.percent_hbd??1e4;if(Qe===0?Xe.push("Hive Rewards Payout 100% Powered Up"):Xe.push(`Hive Rewards Payout (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`),$.is_paidout){const et=$.author_payout_value?$.author_payout_value.replace(/[^\d.]/g,""):"";Xe.push("Past payouts:"),Xe.push(`${De} Hive Rewards${et?` (Author ${et})`:""}`)}else{if($.payout_at){const et=new Date($.payout_at),Pt=new Date,Kt=et.getTime()-Pt.getTime();if(Kt>0){const Lt=Math.floor(Kt/36e5),dt=Math.floor(Lt/24),or=Lt%24,Yr=dt>0?`in ${dt} day${dt>1?"s":""}${or>0?` ${or} hour${or>1?"s":""}`:""}`:`in ${Lt} hour${Lt>1?"s":""}`;Xe.push(`Payout will occur: ${Yr}`)}}Qe===0?Xe.push(`${De} Hive Rewards (100% Powered Up)`):Xe.push(`${De} Hive Rewards (${(Qe/200).toFixed(0)}%/${100-Qe/200}%)`)}$.beneficiaries?.length>0&&(Xe.push("Beneficiaries:"),$.beneficiaries.forEach(et=>{Xe.push(`${et.account}: ${(et.weight/100).toFixed(0)}%`)}));const ct=Xe.join(`
1140
+ `);return e.jsxs("div",{className:`border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors ${he?"cursor-pointer":""}`,onClick:he,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5 flex-shrink-0 w-16",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-10 h-10 rounded-full bg-gray-700 flex-shrink-0",onError:et=>{et.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=40`}}),e.jsx(It,{images:se})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("button",{onClick:et=>{et.stopPropagation(),m?.($.author)},className:"font-medium text-white hover:text-blue-400 text-sm",children:["@",$.author]}),e.jsx("span",{className:"text-xs text-gray-500",children:fn($.created)})]}),$.title&&e.jsx("button",{onClick:()=>_?.($.author,$.permlink,$.title),className:"text-left text-base font-semibold text-white mb-1 line-clamp-2 hover:text-blue-400",children:$.title}),ye&&e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2",children:ye.substring(0,200)}),$.community_title&&e.jsxs("span",{className:"inline-block mt-1 text-xs text-blue-400 font-medium",children:["#",$.community_title]})]})]}),e.jsx("div",{className:"mt-3 pt-2 border-t border-gray-700/50",onClick:et=>et.stopPropagation(),children:e.jsx(kn,{author:$.author,permlink:$.permlink,currentUser:r,hiveValue:lt,hiveIconUrl:"/images/hive_logo.png",payoutTooltip:ct,initialVotes:$.active_votes||[],initialCommentsCount:$.children||0,onUpvote:x?et=>x($.author,$.permlink,et):void 0,onSubmitComment:g?(et,Pt,Kt)=>g(et,Pt,Kt):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ve({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!z,onComments:z?()=>z($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},xr=$=>{const re=$.poll_stats?.total_voting_accounts_num||0,he=$.status==="Active",De=new Date($.end_time)<new Date,lt=$.post_body?ad($.post_body):"",Xe=$.poll_choices?.length||0;return e.jsxs("div",{className:"border border-gray-700 rounded-lg bg-gray-800 hover:bg-gray-700/50 transition-colors cursor-pointer",onClick:()=>A?.($.author,$.permlink,$.question),children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$.author}/avatar`,alt:$.author,className:"w-8 h-8 rounded-full bg-gray-700",onError:Qe=>{Qe.target.src=`https://ui-avatars.com/api/?name=${$.author}&background=random&size=32`}}),e.jsxs("div",{children:[e.jsxs("button",{onClick:Qe=>{Qe.stopPropagation(),m?.($.author)},className:"text-sm font-medium text-white hover:text-blue-400",children:["@",$.author]}),e.jsx("p",{className:"text-[10px] text-gray-500",children:fn($.created)})]})]}),e.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${he&&!De?"bg-green-500/20 text-green-400":"bg-gray-600/30 text-gray-400"}`,children:he&&!De?"Active":"Ended"})]}),e.jsx("h3",{className:"text-sm font-semibold text-white mb-1",children:$.question}),lt&&e.jsx("p",{className:"text-gray-400 text-xs line-clamp-2 mb-2",children:lt.substring(0,150)}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500",children:[e.jsxs("span",{children:[re," voter",re!==1?"s":""]}),e.jsxs("span",{children:[Xe," option",Xe!==1?"s":""]}),$.poll_stats?.total_hive_hp!=null&&$.poll_stats.total_hive_hp>0&&e.jsxs("span",{children:[($.poll_stats.total_hive_hp/1e3).toFixed(1),"k HP"]}),$.end_time&&e.jsx("span",{children:he&&!De?`Ends ${fn($.end_time)}`:"Ended"})]})]}),e.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-gray-700/50",onClick:Qe=>Qe.stopPropagation(),children:e.jsx(kn,{author:$.author,permlink:$.permlink,currentUser:r,hiveIconUrl:"/images/hive_logo.png",initialVotes:[],initialCommentsCount:0,onUpvote:x?Qe=>x($.author,$.permlink,Qe):void 0,onSubmitComment:g?(Qe,ct,et)=>g(Qe,ct,et):void 0,onClickCommentUpvote:v,onReblog:$.author!==r&&N?()=>N($.author,$.permlink):void 0,onShare:L?()=>L($.author,$.permlink):void 0,onTip:$.author!==r&&j?()=>j($.author,$.permlink):void 0,onReport:$.author!==r&&y?()=>Ve({author:$.author,permlink:$.permlink}):void 0,disableCommentsModal:!!z,onComments:z?()=>z($.author,$.permlink):void 0,ecencyToken:i,threeSpeakApiKey:o,giphyApiKey:c,templateToken:d,templateApiBaseUrl:f})})]},`${$.author}/${$.permlink}`)},br=($,re)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800 hover:bg-gray-700 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:`https://images.hive.blog/u/${$}/avatar`,alt:$,className:"w-10 h-10 rounded-full flex-shrink-0 bg-gray-700",onError:he=>{he.target.src=`https://ui-avatars.com/api/?name=${$}&background=random&size=40`}}),e.jsxs("button",{onClick:()=>m?.($),className:"font-medium text-white hover:text-blue-400",children:["@",$]})]})},`${$}-${re}`),lr=($=5)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-full mb-1.5"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-3/5 mb-3"}),he%2===0&&e.jsx("div",{className:"h-32 bg-gray-700 rounded-lg w-20 mb-3"}),e.jsxs("div",{className:"flex gap-4 mt-2",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-12"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))}),ur=($=8)=>e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},he))}),nr=($=3)=>e.jsx("div",{className:"space-y-3 animate-pulse",children:Array.from({length:$},(re,he)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-full w-14"})]}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-4/5 mb-3"}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-full"}),e.jsx("div",{className:"h-8 bg-gray-700 rounded-lg w-3/4"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-24"})]})]})]})},he))}),yr=()=>e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsxs("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-5 h-5 bg-gray-700 rounded"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-44"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[1,2,3,4].map($=>e.jsxs("div",{className:"bg-gray-900/50 rounded-lg p-2.5",children:[e.jsx("div",{className:"h-2.5 bg-gray-700 rounded w-12 mb-2"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded w-16"})]},$))})]}),[1,2,3,4,5].map($=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},$))]}),Ir=()=>{switch(B){case"blogs":case"posts":case"snaps":case"comments":case"replies":return lr();case"followers":case"following":case"badges":case"witnessVotes":return ur();case"polls":return nr();case"authorRewards":case"curationRewards":return yr();default:return lr()}},st=$=>{if(!$||!isFinite($)||$<=0)return"—";const re=Math.floor($/1e3),he=Math.floor(re/60),se=Math.floor(he/60),ye=Math.floor(se/24);return ye>=1?`${ye}d ${se%24}h`:se>=1?`${se}h ${he%60}m`:`${Math.max(1,he)}m`},We=($,re=3)=>$==null||isNaN($)?"—":Number($).toLocaleString(void 0,{maximumFractionDigits:re,minimumFractionDigits:re}),Xt=()=>{if(I&&de.length===0)return yr();if(de.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending author rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts/comments with pending payouts"})]});const $=de.filter(he=>!he.isComment).length,re=de.length-$;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-amber-900/30 to-orange-900/30 rounded-xl p-4 border border-amber-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.Award,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-sm font-semibold text-amber-300",children:"Pending Author Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-amber-400",children:["$",We(fe.totalHbd)]})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-orange-400",children:We(fe.totalHpEq)})]})]})]}),de.map((he,se)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(he.author,he.permlink,he.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:he.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:he.title||`${he.author}/${he.permlink}`}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${he.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:he.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(he.payoutMs)]}),e.jsxs("span",{className:"text-amber-400 font-medium",children:["$",We(he.hbd)," HBD"]}),he.hpEq!==null&&e.jsxs("span",{className:"text-orange-400 font-medium",children:[We(he.hpEq)," HP"]}),he.beneficiaryCut>0&&e.jsxs("span",{className:"text-gray-500",children:["Beneficiary: ",(he.beneficiaryCut*100).toFixed(0),"%"]})]})]})]})},`${he.author}-${he.permlink}-${se}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(he=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"})]})]})]})},he))})]})},ir=()=>{if(I&&Se.length===0)return yr();if(Se.length===0&&!jt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.TrendingUp,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No pending curation rewards"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Rewards appear for posts you voted on with pending payouts"})]});const $=Se.filter(ye=>!ye.isComment).length,re=Se.length-$,he=Se.filter(ye=>ye.efficiency!==null),se=he.length>0?he.reduce((ye,De)=>ye+(De.efficiency||0),0)/he.length:null;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-blue-900/30 to-purple-900/30 rounded-xl p-4 border border-blue-700/40",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(O.TrendingUp,{className:"w-5 h-5 text-blue-400"}),e.jsx("h3",{className:"text-sm font-semibold text-blue-300",children:"Pending Curation Rewards"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Posts"}),e.jsx("p",{className:"text-lg font-bold text-white",children:$})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Comments"}),e.jsx("p",{className:"text-lg font-bold text-white",children:re})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HP"}),e.jsx("p",{className:"text-lg font-bold text-blue-400",children:We(Ge.totalHp)})]}),e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Total HBD"}),e.jsxs("p",{className:"text-lg font-bold text-purple-400",children:["$",We(Ge.totalHbd)]})]}),se!==null&&e.jsxs("div",{className:"bg-black/30 rounded-lg p-2.5",children:[e.jsx("p",{className:"text-[10px] text-gray-400 uppercase tracking-wider",children:"Avg Efficiency"}),e.jsxs("p",{className:`text-lg font-bold ${se>=100?"text-emerald-400":"text-amber-400"}`,children:[se.toFixed(1),"%"]})]})]})]}),Se.map((ye,De)=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700 hover:border-gray-600 transition-colors cursor-pointer",onClick:()=>_?.(ye.author,ye.permlink,ye.title),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-400":"bg-emerald-900/40 text-emerald-400"}`,children:ye.isComment?e.jsx(O.MessageCircle,{className:"w-3.5 h-3.5"}):e.jsx(O.FileText,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-sm font-medium text-white truncate",children:ye.title||`${ye.author}/${ye.permlink}`}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["by @",ye.author]})]}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0 ${ye.isComment?"bg-blue-900/40 text-blue-300":"bg-emerald-900/40 text-emerald-300"}`,children:ye.isComment?"Comment":"Post"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"w-3 h-3"}),"Payout in ",st(ye.payoutMs)]}),e.jsxs("span",{className:"text-blue-400 font-medium",children:[We(ye.hp)," HP"]}),e.jsxs("span",{className:"text-purple-400 font-medium",children:["$",We(ye.hbd)," HBD"]}),e.jsxs("span",{className:"text-gray-500",children:["Vote: ",ye.weightPct.toFixed(0),"%"]}),ye.efficiency!==null&&e.jsxs("span",{className:`font-medium ${ye.efficiency>=100?"text-emerald-400":"text-amber-400"}`,children:["Eff: ",ye.efficiency.toFixed(1),"%"]}),ye.votedAfterMs!==null&&e.jsxs("span",{className:"text-gray-500",children:["Voted after ",st(ye.votedAfterMs)]})]})]})]})},`${ye.author}-${ye.permlink}-${De}`)),jt&&e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(ye=>e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-gray-700 rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3 mb-3"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded w-20"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-16"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-14"})]})]})]})},ye))})]})},Fr=()=>{if(B==="wallet")return e.jsx("div",{className:"max-w-lg mx-auto",children:e.jsx(h0,{username:$e})});if(B==="activities")return e.jsx(g0,{username:$e,onClickPermlink:C,onSelectActivity:T});if(B==="authorRewards")return Xt();if(B==="curationRewards")return ir();if(B==="votingPower"){if(I)return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6 animate-pulse",children:[[1,2,3].map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-32"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded-full w-full"})]},dt)),e.jsxs("div",{className:"mt-4 p-4 bg-gray-800 rounded-xl border border-gray-700",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded w-40 mb-3"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-full w-full"})]})]});if(!kt)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Gauge,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Voting power data unavailable"})]});const{maxMana:se,rewardBalance:ye,recentClaims:De,feedPrice:lt}=kt,Xe=S*100,Qe=se*.02*(Xe/1e4),ct=De>0?Qe/De*ye:0,et=ct*lt,Pt=kt.upvotePower<S*2/100,Kt=(dt,or=3)=>isNaN(dt)?"—":dt.toLocaleString(void 0,{minimumFractionDigits:or,maximumFractionDigits:or}),Lt=[{label:"Voting Power",value:kt.upvotePower,color:"#10b981"},{label:"Downvote Power",value:kt.downvotePower,color:"#f59e0b"},{label:"Resource Credits",value:kt.resourceCredits,color:"#3b82f6"}];return e.jsxs("div",{className:"max-w-lg mx-auto space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-gray-800 border border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-200",children:"Vote Value"}),e.jsxs("span",{className:"text-xs font-bold text-blue-400",children:[S,"%"]})]}),e.jsx("div",{className:"text-[13px] text-gray-400 mb-3",children:De>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-white font-medium",children:[Kt(et)," HBD"]}),e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsxs("span",{className:"text-gray-300",children:["~",Kt(ct)," HIVE"]}),Pt&&e.jsx("span",{className:"ml-2 text-amber-400 text-xs",children:"⚠ low mana"})]}):e.jsxs("span",{children:["Vote @",S,"% · —"]})}),e.jsx("input",{type:"range",min:0,max:100,step:5,value:S,onChange:dt=>P(Number(dt.target.value)),className:"w-full h-2 rounded-full appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #3b82f6 0%, #3b82f6 ${S}%, #374151 ${S}%, #374151 100%)`,accentColor:"#3b82f6"}}),e.jsxs("div",{className:"flex justify-between text-[11px] text-gray-500 mt-1",children:[e.jsx("span",{children:"0%"}),e.jsx("span",{children:"25%"}),e.jsx("span",{children:"50%"}),e.jsx("span",{children:"75%"}),e.jsx("span",{children:"100%"})]})]}),Lt.map(dt=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium text-gray-300",children:dt.label}),e.jsxs("span",{className:"text-sm font-bold text-white",children:[dt.value.toFixed(2),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-700 rounded-full h-3",children:e.jsx("div",{className:"h-3 rounded-full transition-all duration-500 ease-out",style:{width:`${Math.min(dt.value,100)}%`,backgroundColor:dt.color}})})]},dt.label))]})}if(B==="badges")return I?ur():Ke.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Award,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No badges found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Ke.map((se,ye)=>br(se,ye))});if(B==="witnessVotes")return I?ur():_t.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Shield,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No witness votes found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:_t.map((se,ye)=>br(se,ye))});if(I)return Ir();if(B==="followers")return St.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No followers found"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:St.map((se,ye)=>br(se.follower,ye))});if(B==="following")return Tt.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.Users,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"Not following anyone"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Tt.map((se,ye)=>br(se.following,ye))});if(B==="polls")return Ye.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(O.BarChart3,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No polls found"})]}):e.jsx("div",{className:"space-y-3",children:Ye.map(se=>xr(se))});const re={blogs:{data:W,type:"blog",icon:O.FileText},posts:{data:Q,type:"post",icon:O.FileText},snaps:{data:we,type:"post",icon:O.Camera},comments:{data:Ae,type:"comment",icon:O.MessageCircle},replies:{data:ht,type:"reply",icon:O.Reply}}[B];if(!re)return null;if(re.data.length===0){const se=re.icon;return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(se,{className:"h-12 w-12 text-gray-500 mx-auto mb-3"}),e.jsxs("p",{className:"text-gray-400",children:["No ",B," found"]})]})}const he=se=>{if(B==="snaps"&&E)return()=>E(se.author,se.permlink);if((B==="blogs"||B==="posts")&&_)return()=>_(se.author,se.permlink,se.title)};return e.jsx("div",{className:"space-y-3",children:re.data.map(se=>sr(se,re.type,he(se)))})},vt=[{id:"blogs",label:"Blogs",icon:O.FileText},{id:"posts",label:"Posts",icon:O.FileText},{id:"snaps",label:"Snaps",icon:O.Camera},{id:"polls",label:"Polls",icon:O.BarChart3},{id:"comments",label:"Comments",icon:O.MessageCircle},{id:"replies",label:"Replies",icon:O.Reply},{id:"activities",label:"Activities",icon:O.Activity},{id:"authorRewards",label:"Author Rewards",icon:O.Award},{id:"curationRewards",label:"Curation Rewards",icon:O.TrendingUp},{id:"followers",label:"Followers",icon:O.Users},{id:"following",label:"Following",icon:O.Users},{id:"wallet",label:"Wallet",icon:O.Wallet},{id:"votingPower",label:"Voting Power",icon:O.Gauge},{id:"badges",label:"Badges",icon:O.Award},{id:"witnessVotes",label:"Witness Votes",icon:O.Shield}],dr=a&&a.length>0?a.map($=>vt.find(re=>re.id===$)).filter($=>$!==void 0):vt,vr=r&&r!==$e;return e.jsx("div",{className:"dark flex flex-col h-full bg-gray-900",children:e.jsxs("div",{className:"flex flex-col overflow-y-auto h-full scrollbar-hide",children:[e.jsx("div",{className:"sticky top-0 z-30 h-[56px] bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 flex items-center",children:e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2 w-full",children:[s&&n&&e.jsx("button",{onClick:n,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors flex-shrink-0",children:e.jsx(O.ArrowLeft,{className:"h-5 w-5 text-gray-300"})}),e.jsx("img",{src:G.profileImage||`https://images.hive.blog/u/${$e}/avatar`,alt:$e,className:"w-8 h-8 rounded-full flex-shrink-0 bg-gray-700",onError:$=>{$.target.src=`https://images.hive.blog/u/${$e}/avatar`}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-sm font-semibold text-white truncate",children:`@${$e}`}),G.reputation>0&&e.jsx("span",{className:"text-[10px] bg-gray-700 text-gray-300 px-1.5 py-0.5 rounded-full flex-shrink-0",children:ex(G.reputation)})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("button",{onClick:()=>pe("followers"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followersCount.toLocaleString()})," Followers"]}),e.jsxs("button",{onClick:()=>pe("following"),className:"hover:text-white transition-colors",children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.followingCount.toLocaleString()})," Following"]}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-200",children:G.postsCount.toLocaleString()})," Posts"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[U&&e.jsxs("button",{onClick:Rt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors relative",title:"Favourite list",children:[e.jsx(O.Heart,{className:`h-4 w-4 ${F?"text-red-500":"text-gray-400"}`,fill:F?"currentColor":"none"}),Y>0&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:Y>99?"99+":Y})]}),e.jsx("button",{onClick:mt,className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"Share profile",children:e.jsx(O.Share2,{className:"h-4 w-4 text-gray-400"})}),vr&&e.jsxs("div",{className:"relative",ref:xt,children:[e.jsx("button",{onClick:()=>Et($=>!$),className:"p-1.5 hover:bg-gray-700 rounded-lg transition-colors",title:"More actions",children:e.jsx(O.MoreVertical,{className:"h-4 w-4 text-gray-400"})}),Zt&&e.jsxs("div",{className:"absolute right-0 mt-1 w-48 rounded-lg border border-gray-700 bg-gray-800 shadow-xl z-[100]",onClick:$=>$.stopPropagation(),children:[(u||p)&&e.jsx("button",{onClick:()=>{Et(!1),Ot()},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-gray-200 hover:bg-gray-700 disabled:opacity-50 first:rounded-t-lg",children:G.isFollowing?"Unfollow":"Follow"}),b&&e.jsx("button",{onClick:()=>{Et(!1),ge(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-red-400 hover:bg-red-900/20 disabled:opacity-50",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Ban,{className:"h-4 w-4"})," Ignore Author"]})}),w&&e.jsx("button",{onClick:()=>{Et(!1),Pe(!0)},disabled:Mt,className:"w-full px-4 py-2.5 text-left text-sm text-orange-400 hover:bg-orange-900/20 disabled:opacity-50 last:rounded-b-lg",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O.Flag,{className:"h-4 w-4"})," Report User"]})})]})]})]})]})}),e.jsxs("div",{className:"relative",children:[G.coverImage?e.jsx("div",{className:"w-full h-24 sm:h-32 bg-cover bg-center",style:{backgroundImage:`url(${G.coverImage})`}}):e.jsx("div",{className:"w-full h-24 sm:h-32 bg-gradient-to-r from-blue-600 to-purple-700"}),e.jsx("div",{className:"absolute inset-0 bg-gray-900/80"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-4 pb-3 pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-white truncate",children:G.name||`@${$e}`}),G.about&&e.jsx("p",{className:"text-gray-300 text-xs leading-relaxed mt-1 line-clamp-2",children:G.about})]}),H&&e.jsx("button",{onClick:qt,className:"p-2 hover:bg-white/10 rounded-lg transition-colors ml-2 flex-shrink-0",title:F?"Remove from favourites":"Add to favourites",children:e.jsx(O.Heart,{className:`h-5 w-5 ${F?"text-red-500":"text-white"}`,fill:F?"currentColor":"none"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1.5 text-[11px] text-gray-300",children:[G.location&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.MapPin,{className:"h-3 w-3 text-rose-400"})," ",G.location]}),G.website&&e.jsxs("a",{href:G.website.startsWith("http")?G.website:`https://${G.website}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-400 hover:underline",children:[e.jsx(O.Globe,{className:"h-3 w-3 text-blue-400"})," ",G.website]}),G.created&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Calendar,{className:"h-3 w-3 text-green-400"})," ",tx(G.created)]}),G.lastActivity&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Clock,{className:"h-3 w-3 text-amber-400"})," ",fn(G.lastActivity)]}),G.votingPower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-yellow-400"})," VP ",G.votingPower.toFixed(1),"%"]}),G.hivePower!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(O.Zap,{className:"h-3 w-3 text-orange-400"})," HP ",G.hivePower.toFixed(0)]})]})]})]}),e.jsxs("div",{className:"sticky top-[56px] z-20 bg-gray-800 border-b border-gray-700 relative flex items-center",children:[cr&&e.jsx("button",{onClick:()=>Mr("left"),className:"absolute left-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronLeft,{className:"h-4 w-4 text-white"})}),e.jsx("div",{ref:Je,className:"flex overflow-x-auto scrollbar-hide",children:dr.map($=>{const re=$.icon;return e.jsxs("button",{onClick:()=>pe($.id),className:`flex items-center gap-1 px-3 sm:px-4 py-2.5 text-xs sm:text-sm font-medium whitespace-nowrap transition-colors border-b-2 ${B===$.id?"text-blue-400 border-blue-400":"text-gray-400 border-transparent hover:text-gray-300 hover:border-gray-600"}`,children:[e.jsx(re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:$.label})]},$.id)})}),rr&&e.jsx("button",{onClick:()=>Mr("right"),className:"absolute right-0 z-10 h-full px-2 bg-gray-700 hover:bg-gray-600 flex items-center shadow-md transition-colors",children:e.jsx(O.ChevronRight,{className:"h-4 w-4 text-white"})})]}),e.jsxs("div",{className:"p-4 flex-1",children:[Fr(),B!=="wallet"&&Ze[B]&&e.jsx("div",{ref:Dt,className:"min-h-[60px] py-2",children:be?e.jsx("div",{className:"animate-pulse space-y-3",children:B==="followers"||B==="following"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-3",children:[1,2].map($=>e.jsx("div",{className:"border border-gray-700 rounded-lg p-4 bg-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-28"})]})},$))}):e.jsx("div",{className:"bg-gray-800 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-700 rounded-full flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 bg-gray-700 rounded w-24 mb-2"}),e.jsx("div",{className:"h-4 bg-gray-700 rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/2"})]})]})})}):e.jsx("div",{className:"h-1"})}),B!=="wallet"&&!Ze[B]&&!I&&e.jsxs("div",{className:"text-center py-4 text-xs text-gray-600",children:["No more ",B," to load"]})]}),ft&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000] p-4",onClick:()=>ge(!1),children:e.jsxs("div",{className:"bg-gray-800 rounded-xl shadow-xl max-w-sm w-full border border-gray-700 p-6",onClick:$=>$.stopPropagation(),children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Ignore Author"}),e.jsxs("p",{className:"text-sm text-gray-300 mb-6",children:["Are you sure you want to ignore"," ",e.jsxs("span",{className:"text-red-400 font-medium",children:["@",$e]}),"? Their content will be hidden from your feed."]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>ge(!1),disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700 disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:Jt,disabled:Mt,className:"px-4 py-2 text-sm font-medium rounded-lg text-white bg-red-600 hover:bg-red-700 disabled:opacity-50",children:Mt?"Processing...":"Confirm Ignore"})]})]})}),e.jsx(rd,{isOpen:Te,onClose:()=>Pe(!1),onReport:At,reportType:"user",targetUsername:$e}),e.jsx(rd,{isOpen:!!ze,onClose:()=>Ve(null),onReport:async $=>{if(ze&&y){await y(ze.author,ze.permlink,$);const re=he=>he.author===ze.author&&he.permlink===ze.permlink;te(he=>he.filter(se=>!re(se))),Ie(he=>he.filter(se=>!re(se))),Me(he=>he.filter(se=>!re(se))),le(he=>he.filter(se=>!re(se))),Ne(he=>he.filter(se=>!re(se))),ae(he=>he.filter(se=>!re(se)))}Ve(null)},reportType:"post",targetUsername:ze?.author||"",targetPermlink:ze?.permlink})]})})},ax=t=>{window.open(t,"_blank")},sx=({app:t,backgroundColor:r,boxShadow:n})=>{const s=()=>{ax(t.url)};return e.jsx("div",{className:"card hover-lift cursor-pointer transition-all duration-300 h-full",onClick:s,style:{backgroundColor:r??"rgba(15,23,42,0.9)",boxShadow:n??"0 18px 45px rgba(0,0,0,0.6)",border:"1px solid rgba(148,163,184,0.25)"},children:e.jsx("div",{className:"card-body p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:t.useCircleBackground!==!1?e.jsx("div",{className:"avatar",children:e.jsx("div",{className:"w-16 h-16 rounded-full",children:e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-full h-full object-cover",onError:a=>{a.currentTarget.src="/placeholder.svg"}})})}):e.jsx("img",{src:t.imagePath,alt:`${t.name} logo`,className:"w-16 h-16 object-contain",onError:a=>{a.currentTarget.src="/placeholder.svg"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("h3",{className:"card-title text-lg font-bold text-base-content mb-2 line-clamp-2",children:t.name}),t.isComingSoon&&e.jsx("div",{className:"badge badge-warning badge-sm",children:"Coming Soon"})]}),e.jsx("div",{className:"text-base-content/70 text-sm leading-relaxed",children:t.description.split(`
1141
1141
  `).map((a,i)=>e.jsx("div",{className:"mb-1",children:a},i))})]})]})})})},nx=()=>{const[t,r]=k.useState({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0});k.useEffect(()=>{const i=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const n=t.width<850,s=t.width<=1050&&t.width>=850,a=t.width>1050;return{isMobileView:n,isTabletView:s,isWebView:a,screenSize:t}},ix=({apps:t,cardBackgroundColor:r,cardShadow:n})=>{const{isMobileView:s,isTabletView:a}=nx(),i=()=>s?"grid-cols-1":a?"grid-cols-2":"grid-cols-3";return e.jsx("div",{className:"container mx-auto px-4 lg:px-16",children:e.jsx("div",{className:`grid ${i()} gap-6 lg:gap-8`,children:t.map((o,c)=>e.jsx(sx,{app:o,backgroundColor:r,boxShadow:n},c))})})},ox=[{imagePath:rt.hreplier,name:"hReplier",url:"https://hreplier.sagarkothari88.one/",description:`- Easily Manage your Hive Blog's replies
1142
1142
  - We are working on Hive Inbox as Key contributors`},{imagePath:rt.template,name:"hSnaps",url:"https://hsnaps.sagarkothari88.one/",description:`- A Snaps App for Hive Blockchain
1143
1143
  - We are working on Hive Snaps as Key contributors`},{imagePath:rt.hive_fest_fact_logo,name:"Hive Fest Fact",url:"https://hivefestfacts.sagarkothari88.one/",description:"- Hive Fest Facts is a platform dedicated to sharing interesting and informative facts about Hive Fest, the annual gathering of the Hive blockchain community."},{imagePath:rt.hpolls_logo,name:"hPolls",url:"https://hpolls.sagarkothari88.one/",description:`- Create and manage polls on the Hive blockchain
@@ -1163,8 +1163,7 @@ ${de}`),ge},clear:()=>{B(""),ue(null),ae(0),ve(null),fe&&URL.revokeObjectURL(fe)
1163
1163
  - costs $10 per month`,url:"https://vote.hive.uno/@sagarkothari88",useCircleBackground:!1},{imagePath:rt.nodes,name:"Hive Union Indexer Node",description:`- Running A Union Inddexer Node
1164
1164
  - costs $10 per month`,url:"https://vote.hive.uno/@sagarkothari88",useCircleBackground:!1},{imagePath:rt.developers,name:"Additional Developers",description:`- In order to manage on going development, we've a team of developers, community managers
1165
1165
  - As a team, we are able to make an impact
1166
- - Cost of developers is on us as a Contribution for Hive Community members`,url:"https://vote.hive.uno/@sagarkothari88",useCircleBackground:!1},{imagePath:rt.template,name:"uptime with kuma",description:"- We provide transperancy to all the services which we provide for hive blockchain. With uptime, we show status of all the services we provide",url:"https://uptime.sagarkothari88.one/status/sagar",useCircleBackground:!1}],lx=[{title:"Powered by Hive.io",description:"Explore the Hive blockchain",avatar:"https://images.hive.blog/u/hiveio/avatar",link:"https://hive.io/",buttonText:"Visit"},{title:"Cheered by @starkerz",description:"Community supporter",avatar:"https://images.ecency.com/webp/u/starkerz/avatar/medium",link:"https://peakd.com/@starkerz",buttonText:"View"},{title:"Encouraged by @theycallmedan",description:"Hive advocate & supporter",avatar:"https://images.ecency.com/webp/u/theycallmedan/avatar/medium",link:"https://peakd.com/@theycallmedan",buttonText:"View"},{title:"Github",description:"It's all open source",avatar:"https://avatars.githubusercontent.com/u/259840578?s=200&v=4",link:"https://github.com/orgs/TechCoderLabz/repositories",buttonText:"View"}],ux=[{icon:O.Zap,title:"Simplicity Wins",desc:"Blockchain technology should feel as easy as using any modern mobile app."},{icon:O.Code2,title:"Open Ecosystem",desc:"All our apps are open source so developers can learn, extend, and build."},{icon:O.Rocket,title:"Build First, Talk Later",desc:"We prefer shipping real products and improving with community feedback."},{icon:O.Users,title:"Community Over Ownership",desc:"These are tools built for the entire Hive ecosystem, not closed platforms."}],cx=[{name:"Distriator",logo:rt.distriator_logo},{name:"CheckInWithXYZ",logo:rt.checkinwithxyz},{name:"hReplier",logo:rt.hreplier},{name:"hStats",logo:rt.stats_logo},{name:"hPolls",logo:rt.hpolls_logo},{name:"hFestFacts",logo:rt.hive_fest_fact_logo},{name:"hSnaps",logo:rt.template}],dx=[{name:"hApprover",desc:"Approve Hive transactions from your phone",logo:rt.happrover_logo},{name:"hCurators",desc:`- Request to curate content on behalf of them for their communities.
1167
- - We have staked Hive Power to curate & reward Hive content creators`,logo:rt.vote_logo}],fx=["hSurvey","hChat","hShorts","hVideos","hGovernance","hFind","hMarketPlace"],hn="#f87171",hx=({backgroundColor:t="#020617",textColor:r="#e5e7eb",cardBackgroundColor:n="rgba(15,23,42,0.85)",isDividerShow:s=!0,dividerColor:a="rgba(148,163,184,0.4)",isExpensesCTA:i=!1,onViewExpenses:o,extraSupporters:c=[]})=>{const d=[...lx,...c],f="0 18px 45px rgba(0,0,0,0.6)";return e.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[e.jsx("div",{className:"fixed inset-0 z-0",style:{backgroundColor:t}}),e.jsx("div",{className:"fixed inset-0 z-10 backdrop-blur-md",style:{backgroundColor:"rgba(15,23,42,0.6)"}}),e.jsx("div",{className:"fixed inset-0 z-20 bg-gradient-to-br from-base-100 via-transparent to-base-100/10"}),e.jsx("div",{className:"fixed inset-0 z-20 bg-gradient-to-b from-base-100 via-transparent to-base-100/10"}),e.jsx("div",{className:"relative z-30",style:{color:r},children:e.jsx("main",{className:"min-h-screen",children:e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"py-8",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-12",children:"Our Vision & Mission"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/20 flex items-center justify-center text-primary",children:e.jsx(O.Eye,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-xl font-bold text-base-content",children:"Vision"})]}),e.jsx("p",{className:"text-base-content font-semibold mb-2",children:"Make Hive accessible to the world through simple, powerful applications."}),e.jsx("p",{className:"text-base-content/70",children:"We aim to bridge the gap between traditional social apps and decentralized technologies by creating familiar, easy-to-use products."})]}),e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/20 flex items-center justify-center text-primary",children:e.jsx(O.Crosshair,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-xl font-bold text-base-content",children:"Mission"})]}),e.jsx("p",{className:"text-base-content font-semibold mb-2",children:"Build open, user-friendly applications that help Hive reach Web2 audiences."}),e.jsx("p",{className:"text-base-content/70",children:"Everything we build is open source and community driven."})]})]}),e.jsx("div",{className:"max-w-4xl mx-auto mt-6",children:e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/20 flex items-center justify-center text-primary",children:e.jsx(O.Star,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-xl font-bold text-base-content",children:"Goal"})]}),e.jsx("p",{className:"text-base-content font-semibold mb-2",children:"Help Hive grow by making it easier for Web2 users to discover and use."}),e.jsx("p",{className:"text-base-content/70",children:"Built without external funding, with passion for Hive, for the entire community, and completely open source."})]})}),i&&e.jsx("div",{className:"max-w-4xl mx-auto mt-6",children:e.jsx("button",{type:"button",onClick:o,className:"w-full text-left",children:e.jsx("div",{className:"card glass-effect hover-lift p-6 rounded-xl border-2 transition-colors",style:{backgroundColor:n,borderColor:a,boxShadow:f},children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:a},children:e.jsx("span",{className:"text-xl font-bold",style:{color:hn},children:"₹"})}),e.jsxs("div",{className:"text-center sm:text-left flex-1",children:[e.jsx("h3",{className:"text-xl font-bold",style:{color:hn},children:"Running in Heavy Debt — See Our Expenses"}),e.jsx("p",{className:"text-sm mt-1",style:{color:r},children:"We have spent our own money with zero revenue. No funding, no ads, no monetization. Open this transparent breakdown to understand how much it really costs."})]}),e.jsx("span",{className:"btn btn-outline btn-sm shrink-0",style:{color:hn,borderColor:hn,backgroundColor:"rgba(233, 57, 57, 0.26)"},children:"View Expenses →"})]})})})})]})}),s&&e.jsx("div",{className:"py-4",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-12",children:"What We Believe"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 max-w-5xl mx-auto",children:ux.map(({icon:l,title:h,desc:u})=>e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl text-center",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("div",{className:"w-16 h-16 rounded-lg bg-primary/20 flex items-center justify-center mx-auto mb-4 text-primary",children:e.jsx(l,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-lg font-bold text-base-content mb-2",children:h}),e.jsx("p",{className:"text-base-content/70 text-sm",children:u})]},h))})]})}),s&&e.jsx("div",{className:"py-4",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-4",children:"Apps We've Built & What's Coming"}),e.jsx("p",{className:"text-base-content/70 text-center mb-12 max-w-xl mx-auto",children:"We focus on building multiple specialized apps, each solving a specific problem."}),e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:cx.map(l=>e.jsxs("div",{className:"flex items-center gap-3 glass-effect hover-lift px-5 py-4 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("span",{className:"shrink-0 inline-flex text-green-500",children:e.jsx(O.CheckCircle,{className:"w-5 h-5"})}),e.jsx("img",{src:l.logo,alt:l.name,className:"w-8 h-8 shrink-0 rounded-lg object-contain"}),e.jsx("span",{className:"font-medium text-base-content",children:l.name}),e.jsx("span",{className:"ml-auto shrink-0 badge badge-success badge-outline text-xs",children:"Delivered"})]},l.name))}),e.jsx("p",{className:"mt-8 mb-4 text-center text-sm font-medium uppercase tracking-wide text-base-content/60",children:"In Development"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-2xl mx-auto",children:dx.map(l=>e.jsxs("div",{className:"glass-effect hover-lift px-5 py-4 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center bg-amber-500/20 p-1.5 rounded-full text-amber-400",children:e.jsx(O.Clock,{className:"w-5 h-5 shrink-0"})}),e.jsx("img",{src:l.logo,alt:l.name,className:"w-8 h-8 shrink-0 rounded-lg object-contain"}),e.jsx("span",{className:"font-medium text-base-content",children:l.name})]}),e.jsx("span",{className:"shrink-0 badge badge-warning badge-outline text-xs",children:"In Dev"})]}),e.jsx("p",{className:"mt-2 text-sm text-base-content/70 ml-8",children:l.desc.split(`
1166
+ - Cost of developers is on us as a Contribution for Hive Community members`,url:"https://vote.hive.uno/@sagarkothari88",useCircleBackground:!1},{imagePath:rt.template,name:"uptime with kuma",description:"- We provide transperancy to all the services which we provide for hive blockchain. With uptime, we show status of all the services we provide",url:"https://uptime.sagarkothari88.one/status/sagar",useCircleBackground:!1}],lx=[{title:"Powered by Hive.io",description:"Explore the Hive blockchain",avatar:"https://images.hive.blog/u/hiveio/avatar",link:"https://hive.io/",buttonText:"Visit"},{title:"Cheered by @starkerz",description:"Community supporter",avatar:"https://images.ecency.com/webp/u/starkerz/avatar/medium",link:"https://peakd.com/@starkerz",buttonText:"View"},{title:"Encouraged by @theycallmedan",description:"Hive advocate & supporter",avatar:"https://images.ecency.com/webp/u/theycallmedan/avatar/medium",link:"https://peakd.com/@theycallmedan",buttonText:"View"},{title:"Github",description:"It's all open source",avatar:"https://avatars.githubusercontent.com/u/259840578?s=200&v=4",link:"https://github.com/orgs/TechCoderLabz/repositories",buttonText:"View"}],ux=[{icon:O.Zap,title:"Simplicity Wins",desc:"Blockchain technology should feel as easy as using any modern mobile app."},{icon:O.Code2,title:"Open Ecosystem",desc:"All our apps are open source so developers can learn, extend, and build."},{icon:O.Rocket,title:"Build First, Talk Later",desc:"We prefer shipping real products and improving with community feedback."},{icon:O.Users,title:"Community Over Ownership",desc:"These are tools built for the entire Hive ecosystem, not closed platforms."}],cx=[{name:"Distriator",logo:rt.distriator_logo},{name:"CheckInWithXYZ",logo:rt.checkinwithxyz},{name:"hReplier",logo:rt.hreplier},{name:"hStats",logo:rt.stats_logo},{name:"hPolls",logo:rt.hpolls_logo},{name:"hFestFacts",logo:rt.hive_fest_fact_logo},{name:"hSnaps",logo:rt.template},{name:"hCurators",logo:rt.vote_logo}],dx=[{name:"hApprover",desc:"Approve Hive transactions from your phone",logo:rt.happrover_logo},{name:"hSurvey",desc:"Create and participate in surveys on Hive",logo:rt.hsurvey_logo}],fx=["hChat","hShorts","hVideos","hGovernance","hFind","hMarketPlace"],hn="#f87171",hx=({backgroundColor:t="#020617",textColor:r="#e5e7eb",cardBackgroundColor:n="rgba(15,23,42,0.85)",isDividerShow:s=!0,dividerColor:a="rgba(148,163,184,0.4)",isExpensesCTA:i=!1,onViewExpenses:o,extraSupporters:c=[]})=>{const d=[...lx,...c],f="0 18px 45px rgba(0,0,0,0.6)";return e.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[e.jsx("div",{className:"fixed inset-0 z-0",style:{backgroundColor:t}}),e.jsx("div",{className:"fixed inset-0 z-10 backdrop-blur-md",style:{backgroundColor:"rgba(15,23,42,0.6)"}}),e.jsx("div",{className:"fixed inset-0 z-20 bg-gradient-to-br from-base-100 via-transparent to-base-100/10"}),e.jsx("div",{className:"fixed inset-0 z-20 bg-gradient-to-b from-base-100 via-transparent to-base-100/10"}),e.jsx("div",{className:"relative z-30",style:{color:r},children:e.jsx("main",{className:"min-h-screen",children:e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"py-8",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-12",children:"Our Vision & Mission"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/20 flex items-center justify-center text-primary",children:e.jsx(O.Eye,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-xl font-bold text-base-content",children:"Vision"})]}),e.jsx("p",{className:"text-base-content font-semibold mb-2",children:"Make Hive accessible to the world through simple, powerful applications."}),e.jsx("p",{className:"text-base-content/70",children:"We aim to bridge the gap between traditional social apps and decentralized technologies by creating familiar, easy-to-use products."})]}),e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/20 flex items-center justify-center text-primary",children:e.jsx(O.Crosshair,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-xl font-bold text-base-content",children:"Mission"})]}),e.jsx("p",{className:"text-base-content font-semibold mb-2",children:"Build open, user-friendly applications that help Hive reach Web2 audiences."}),e.jsx("p",{className:"text-base-content/70",children:"Everything we build is open source and community driven."})]})]}),e.jsx("div",{className:"max-w-4xl mx-auto mt-6",children:e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/20 flex items-center justify-center text-primary",children:e.jsx(O.Star,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-xl font-bold text-base-content",children:"Goal"})]}),e.jsx("p",{className:"text-base-content font-semibold mb-2",children:"Help Hive grow by making it easier for Web2 users to discover and use."}),e.jsx("p",{className:"text-base-content/70",children:"Built without external funding, with passion for Hive, for the entire community, and completely open source."})]})}),i&&e.jsx("div",{className:"max-w-4xl mx-auto mt-6",children:e.jsx("button",{type:"button",onClick:o,className:"w-full text-left",children:e.jsx("div",{className:"card glass-effect hover-lift p-6 rounded-xl border-2 transition-colors",style:{backgroundColor:n,borderColor:a,boxShadow:f},children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:a},children:e.jsx("span",{className:"text-xl font-bold",style:{color:hn},children:"₹"})}),e.jsxs("div",{className:"text-center sm:text-left flex-1",children:[e.jsx("h3",{className:"text-xl font-bold",style:{color:hn},children:"Running in Heavy Debt — See Our Expenses"}),e.jsx("p",{className:"text-sm mt-1",style:{color:r},children:"We have spent our own money with zero revenue. No funding, no ads, no monetization. Open this transparent breakdown to understand how much it really costs."})]}),e.jsx("span",{className:"btn btn-outline btn-sm shrink-0",style:{color:hn,borderColor:hn,backgroundColor:"rgba(233, 57, 57, 0.26)"},children:"View Expenses →"})]})})})})]})}),s&&e.jsx("div",{className:"py-4",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-12",children:"What We Believe"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 max-w-5xl mx-auto",children:ux.map(({icon:l,title:h,desc:u})=>e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl text-center",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("div",{className:"w-16 h-16 rounded-lg bg-primary/20 flex items-center justify-center mx-auto mb-4 text-primary",children:e.jsx(l,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-lg font-bold text-base-content mb-2",children:h}),e.jsx("p",{className:"text-base-content/70 text-sm",children:u})]},h))})]})}),s&&e.jsx("div",{className:"py-4",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-4",children:"Apps We've Built & What's Coming"}),e.jsx("p",{className:"text-base-content/70 text-center mb-12 max-w-xl mx-auto",children:"We focus on building multiple specialized apps, each solving a specific problem."}),e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:cx.map(l=>e.jsxs("div",{className:"flex items-center gap-3 glass-effect hover-lift px-5 py-4 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("span",{className:"shrink-0 inline-flex text-green-500",children:e.jsx(O.CheckCircle,{className:"w-5 h-5"})}),e.jsx("img",{src:l.logo,alt:l.name,className:"w-8 h-8 shrink-0 rounded-lg object-contain"}),e.jsx("span",{className:"font-medium text-base-content",children:l.name}),e.jsx("span",{className:"ml-auto shrink-0 badge badge-success badge-outline text-xs",children:"Delivered"})]},l.name))}),e.jsx("p",{className:"mt-8 mb-4 text-center text-sm font-medium uppercase tracking-wide text-base-content/60",children:"In Development"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-2xl mx-auto",children:dx.map(l=>e.jsxs("div",{className:"glass-effect hover-lift px-5 py-4 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center bg-amber-500/20 p-1.5 rounded-full text-amber-400",children:e.jsx(O.Clock,{className:"w-5 h-5 shrink-0"})}),e.jsx("img",{src:l.logo,alt:l.name,className:"w-8 h-8 shrink-0 rounded-lg object-contain"}),e.jsx("span",{className:"font-medium text-base-content",children:l.name})]}),e.jsx("span",{className:"shrink-0 badge badge-warning badge-outline text-xs",children:"In Dev"})]}),e.jsx("p",{className:"mt-2 text-sm text-base-content/70 ml-8",children:l.desc.split(`
1168
1167
  `).map((h,u)=>e.jsxs("span",{children:[u>0&&e.jsx("br",{}),h]},u))})]},l.name))}),e.jsx("p",{className:"mt-8 mb-4 text-center text-sm font-medium uppercase tracking-wide text-base-content/60",children:"Planned"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:fx.map(l=>e.jsxs("div",{className:"flex items-center gap-3 glass-effect hover-lift px-5 py-4 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center bg-sky-500/20 p-1.5 rounded-full text-sky-400",children:e.jsx(O.Calendar,{className:"w-5 h-5 shrink-0"})}),e.jsx("span",{className:"font-medium text-base-content",children:l}),e.jsx("span",{className:"ml-auto shrink-0 badge badge-info badge-outline text-xs",children:"Planned"})]},l))})]})]})}),s&&e.jsx("div",{className:"py-4",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsxs("section",{className:"py-12",children:[e.jsx("div",{className:"container mx-auto px-4 text-center mb-12",children:e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Contributions by @sagarkothari88 & team"})}),e.jsx(ix,{apps:ox,cardBackgroundColor:n,cardShadow:f})]}),s&&e.jsx("div",{className:"py-4",children:e.jsx("div",{style:{height:1,width:"100%",maxWidth:"72rem",margin:"0 auto",backgroundColor:a,opacity:.8}})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-center mb-12",children:"Powered by"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 max-w-5xl mx-auto",children:[d.map((l,h)=>e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-xl",style:{backgroundColor:a},children:e.jsx("img",{src:l.avatar,alt:l.title,className:"h-full w-full object-cover"})}),e.jsx("h3",{className:"mt-3 text-lg font-semibold",style:{color:r},children:l.title}),e.jsx("p",{className:"mt-1 text-sm",style:{color:r,opacity:.6},children:l.description}),e.jsx("div",{className:"mt-4",children:e.jsxs("a",{href:l.link,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors",style:{backgroundColor:"#e31337"},children:[l.buttonText,e.jsx(O.ExternalLink,{className:"w-4 h-4"})]})})]},h)),e.jsxs("a",{href:"https://discord.gg/WEKa8JKg7W",target:"_blank",rel:"noopener noreferrer",className:"card glass-effect hover-lift flex flex-col p-6 rounded-xl",style:{backgroundColor:n,boxShadow:f},children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-xl",style:{backgroundColor:a},children:e.jsx("img",{src:"https://cdn.simpleicons.org/discord/5865F2",alt:"Discord",className:"h-6 w-6",width:24,height:24})}),e.jsx("h3",{className:"mt-3 text-lg font-semibold",style:{color:r},children:"Contact Support"}),e.jsx("p",{className:"mt-1 text-sm",style:{color:r,opacity:.6},children:"Get help on Discord"}),e.jsx("div",{className:"mt-4",children:e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors",style:{backgroundColor:"#e31337"},children:["Join",e.jsx(O.ExternalLink,{className:"w-4 h-4"})]})})]})]})]})}),e.jsx("div",{className:"py-20"})]})})})]})},mx=.07,px=85,gx=()=>{const[t,r]=k.useState({hiveUsd:mx,usdInr:px}),[n,s]=k.useState(!0);return k.useEffect(()=>{(async()=>{try{const o=await(await fetch("https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd,inr")).json();o?.hive?.usd&&o?.hive?.inr&&r({hiveUsd:o.hive.usd,usdInr:o.hive.inr/o.hive.usd})}catch{}finally{s(!1)}})()},[]),{rates:t,loading:n}},xx={USD:{symbol:"$",suffix:"",locale:"en-US"},HIVE:{symbol:"",suffix:" HIVE",locale:"en-US"},INR:{symbol:"₹",suffix:"",locale:"en-IN"}},Ar={salary3:1250,salary2:900,rent:300,utilities:50,vps:175,devPrograms:15,domains:15,infraDepMonth:50,infraMaintMonth:20,furnDepMonth:30,infraCost:6e3,furnitureCost:2400},je={accent:"#818cf8",error:"#f87171",errorBg:"rgba(248,113,113,0.12)",errorBorder:"rgba(248,113,113,0.3)",warning:"#fbbf24",warningBg:"rgba(251,191,36,0.15)",success:"#34d399",successBg:"rgba(52,211,153,0.15)",info:"#38bdf8",infoBg:"rgba(56,189,248,0.15)",primary:"#6366f1",primaryBg:"rgba(99,102,241,0.15)",progressTrack:"rgba(30,41,59,0.72)"},bx=(t,r)=>t==="USD"?1:t==="INR"?r.usdInr:1/r.hiveUsd,_0=(t,r)=>{const n=bx(t,r);return{salary3:Math.round(Ar.salary3*n),salary2:Math.round(Ar.salary2*n),rent:Math.round(Ar.rent*n),utilities:Math.round(Ar.utilities*n),vps:Math.round(Ar.vps*n),devPrograms:Math.round(Ar.devPrograms*n),domains:Math.round(Ar.domains*n),infraDepMonth:Math.round(Ar.infraDepMonth*n),infraMaintMonth:Math.round(Ar.infraMaintMonth*n),furnDepMonth:Math.round(Ar.furnDepMonth*n),infraCost:Math.round(Ar.infraCost*n),furnitureCost:Math.round(Ar.furnitureCost*n)}},yx=(t,r)=>{const{symbol:n,suffix:s,locale:a}=xx[r],i=Math.round(t).toLocaleString(a);return`${n}${i}${s}`},vx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function wx(t,r){const n=_0(t,r),s=[];let a=1,i=1,o=1;const c=new Date(2022,0),d=new Date(2026,2),f=new Date(c);for(;f<=d;){const l=f.getFullYear(),h=f.getMonth(),u=f>=new Date(2022,6);u&&h===6&&!(l===2022&&h===6)&&(a*=.9,i*=.9,o*=.85);let p=n.salary3;l===2026&&h>=1&&(p=n.salary2),l>2026&&(p=n.salary2);const b=u?n.rent:0,w=u?n.utilities:0,x=u?n.vps:0,g=u?n.devPrograms:0,v=u?n.domains:0,N=u?Math.round(n.infraDepMonth*a):0,j=u?Math.round(n.infraMaintMonth*i):0,y=u?Math.round(n.furnDepMonth*o):0,m=p+b+w+x+g+v+N+j+y;s.push({year:l,month:h,label:`${vx[h]} ${l}`,salaries:p,rent:b,utilities:w,vps:x,devPrograms:g,domains:v,infraDepreciation:N,infraMaintenance:j,furnitureDepreciation:y,total:m}),f.setMonth(f.getMonth()+1)}return s}const Nx=({row:t,fmt:r,textColor:n,cardBackgroundColor:s,dividerColor:a})=>{const[i,o]=k.useState(!1),c=[];return c.push({label:"Salaries",value:t.salaries}),t.rent&&c.push({label:"Rent",value:t.rent}),t.utilities&&c.push({label:"Utilities",value:t.utilities}),t.vps&&c.push({label:"VPS & Hosting",value:t.vps}),t.devPrograms&&c.push({label:"Dev Programs",value:t.devPrograms}),t.domains&&c.push({label:"Domains",value:t.domains}),t.infraDepreciation&&c.push({label:"Infra Depreciation",value:t.infraDepreciation}),t.infraMaintenance&&c.push({label:"Infra Maintenance",value:t.infraMaintenance}),t.furnitureDepreciation&&c.push({label:"Furniture Depreciation",value:t.furnitureDepreciation}),e.jsxs("div",{style:{borderBottom:`1px solid ${a}`},children:[e.jsxs("button",{type:"button",onClick:()=>o(d=>!d),className:"w-full flex justify-between items-center py-3 px-2 transition-colors",style:{color:n},children:[e.jsx("span",{className:"font-medium text-sm",children:t.label}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold text-sm",style:{color:je.error},children:r(t.total)}),e.jsx("span",{className:`text-xs transition-transform duration-200 ${i?"rotate-180":""}`,style:{color:je.accent},children:"▼"})]})]}),i&&e.jsxs("div",{className:"px-4 pb-4 pt-1 rounded-b-lg mx-2 mb-1",style:{backgroundColor:s},children:[c.map((d,f)=>e.jsxs("div",{className:"flex justify-between py-1.5",style:{borderTop:f>0?`1px solid ${a}`:"none"},children:[e.jsx("span",{className:"text-sm",style:{color:je.accent},children:d.label}),e.jsx("span",{className:"font-medium text-sm",style:{color:n},children:r(d.value)})]},d.label)),e.jsxs("div",{className:"flex justify-between py-2 mt-1",style:{borderTop:`2px solid ${a}`},children:[e.jsx("span",{className:"font-bold text-sm",style:{color:n},children:"Total"}),e.jsx("span",{className:"font-bold text-sm",style:{color:je.error},children:r(t.total)})]})]})]})},jx=({onBack:t,backgroundColor:r="#111827",textColor:n="#e5e7eb",cardBackgroundColor:s="rgba(15,23,42,0.85)",dividerColor:a="rgba(148,163,184,0.4)"})=>{const[i,o]=k.useState("USD"),{rates:c,loading:d}=gx(),f=k.useMemo(()=>wx(i,c),[i,c]),l=k.useMemo(()=>_0(i,c),[i,c]),h=N=>yx(N,i),u=[...new Set(f.map(N=>N.year))],p={};u.forEach(N=>{p[N]=f.filter(j=>j.year===N).reduce((j,y)=>j+y.total,0)});const b=f.reduce((N,j)=>N+j.total,0),w=l.infraCost+l.furnitureCost,x=b+w,g=["USD","HIVE","INR"],v="0 18px 45px rgba(0,0,0,0.6)";return e.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[e.jsx("div",{className:"fixed inset-0 z-0",style:{backgroundColor:r}}),e.jsx("div",{className:"fixed inset-0 z-10 backdrop-blur-md",style:{backgroundColor:r,opacity:.6}}),e.jsx("div",{className:"fixed inset-0 z-20 bg-gradient-to-br from-base-100 via-transparent to-base-100/10"}),e.jsx("div",{className:"fixed inset-0 z-20 bg-gradient-to-b from-base-100 via-transparent to-base-100/10"}),e.jsx("div",{className:"relative z-30",style:{color:n},children:e.jsxs("main",{className:"min-h-screen",children:[e.jsx("div",{className:"pt-8 pb-4",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-2 hover:underline font-medium",style:{color:je.accent},children:[e.jsx(cg,{className:"w-4 h-4"})," Back to Contributions View"]})})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full font-semibold text-sm mb-6",style:{backgroundColor:je.errorBg,color:je.error},children:[e.jsx(go,{className:"w-4 h-4"}),"Transparency Report — Running in Heavy Debt"]}),e.jsxs("h1",{className:"text-4xl md:text-5xl font-extrabold mb-4",style:{color:n},children:["Our Expenses — Every Single"," ",i==="USD"?"Dollar":i==="HIVE"?"Hive":"Rupee"]}),e.jsxs("p",{className:"max-w-2xl mx-auto text-lg",style:{color:n,opacity:.85},children:["We have never asked for funding. Every rupee has come out of our own pockets. All we ask in return is"," ",e.jsx("span",{className:"font-bold",style:{color:je.accent},children:"your Hive witness vote"}),"."]})]})}),e.jsx("section",{className:"pb-8",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"inline-flex rounded-xl p-1 gap-1",style:{backgroundColor:s,boxShadow:v},children:g.map(N=>e.jsxs("button",{onClick:()=>o(N),className:"px-6 py-2.5 rounded-lg font-semibold text-sm transition-all duration-200",style:i===N?{backgroundColor:je.primary,color:"#ffffff",boxShadow:"0 4px 14px rgba(99,102,241,0.4)"}:{color:n,opacity:.7},children:[N==="INR"&&"₹ INR",N==="USD"&&"$ USD",N==="HIVE"&&"HIVE"]},N))})}),e.jsx("p",{className:"text-center text-xs mt-2",style:{color:n,opacity:.5},children:d?"Fetching live rates…":e.jsxs(e.Fragment,{children:["Live rates via CoinGecko: 1 HIVE ≈ $",c.hiveUsd.toFixed(4)," • 1 USD ≈ ₹",c.usdInr.toFixed(2)]})})]})}),e.jsx("section",{className:"py-8",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-center mb-8",style:{color:n},children:"Month-by-Month Expense Breakdown"}),e.jsx("div",{className:"max-w-6xl mx-auto hidden md:block rounded-2xl",style:{backgroundColor:s,boxShadow:v},children:e.jsxs("table",{className:"w-full border-collapse text-xs",children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:`2px solid ${a}`},children:[{label:"Month",align:"left",cls:"pl-6"},{label:"Salaries",align:"right",cls:""},{label:"Rent",align:"right",cls:""},{label:"Utilities",align:"right",cls:""},{label:"VPS",align:"right",cls:"hidden lg:table-cell"},{label:"Dev Prog",align:"right",cls:"hidden lg:table-cell"},{label:"Domains",align:"right",cls:"hidden lg:table-cell"},{label:"Infra Dep.",align:"right",cls:"hidden xl:table-cell"},{label:"Infra Maint.",align:"right",cls:"hidden xl:table-cell"},{label:"Furn. Dep.",align:"right",cls:"hidden xl:table-cell"},{label:"Total",align:"right",cls:"pr-6"}].map(({label:N,align:j,cls:y})=>e.jsx("th",{className:`px-3 py-4 font-semibold uppercase tracking-wider whitespace-nowrap ${y}`,style:{textAlign:j,color:n,opacity:.5},children:N},N))})}),e.jsxs("tbody",{children:[u.map(N=>{const j=f.filter(y=>y.year===N);return e.jsxs(k.Fragment,{children:[e.jsx("tr",{children:e.jsx("td",{colSpan:11,className:"px-3 py-3 font-bold text-center tracking-widest uppercase",style:{backgroundColor:je.primaryBg,color:je.primary},children:N})}),j.map(y=>e.jsxs("tr",{className:"transition-colors",style:{borderBottom:`1px solid ${a}`},onMouseEnter:m=>m.currentTarget.style.backgroundColor="rgba(255,255,255,0.03)",onMouseLeave:m=>m.currentTarget.style.backgroundColor="transparent",children:[e.jsx("td",{className:"pl-6 pr-3 py-3 font-medium whitespace-nowrap",style:{color:n},children:y.label}),e.jsx("td",{className:"px-3 py-3 text-right tabular-nums whitespace-nowrap",style:{color:n,opacity:.85},children:h(y.salaries)}),e.jsx("td",{className:"px-3 py-3 text-right tabular-nums whitespace-nowrap",style:{color:n,opacity:.85},children:y.rent?h(y.rent):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-3 py-3 text-right tabular-nums whitespace-nowrap",style:{color:n,opacity:.85},children:y.utilities?h(y.utilities):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-5 py-3 text-right tabular-nums whitespace-nowrap hidden lg:table-cell",style:{color:n,opacity:.85},children:y.vps?h(y.vps):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-5 py-3 text-right tabular-nums whitespace-nowrap hidden lg:table-cell",style:{color:n,opacity:.85},children:y.devPrograms?h(y.devPrograms):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-5 py-3 text-right tabular-nums whitespace-nowrap hidden lg:table-cell",style:{color:n,opacity:.85},children:y.domains?h(y.domains):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-5 py-3 text-right tabular-nums whitespace-nowrap hidden xl:table-cell",style:{color:n,opacity:.85},children:y.infraDepreciation?h(y.infraDepreciation):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-5 py-3 text-right tabular-nums whitespace-nowrap hidden xl:table-cell",style:{color:n,opacity:.85},children:y.infraMaintenance?h(y.infraMaintenance):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"px-5 py-3 text-right tabular-nums whitespace-nowrap hidden xl:table-cell",style:{color:n,opacity:.85},children:y.furnitureDepreciation?h(y.furnitureDepreciation):e.jsx("span",{style:{opacity:.3},children:"—"})}),e.jsx("td",{className:"pl-3 pr-6 py-3 text-right font-bold tabular-nums whitespace-nowrap",style:{color:je.error},children:h(y.total)})]},y.label)),e.jsxs("tr",{style:{borderTop:`2px solid ${je.errorBorder}`,backgroundColor:"rgba(248,113,113,0.06)"},children:[e.jsxs("td",{colSpan:10,className:"pl-6 pr-3 py-3.5 font-bold",style:{color:je.error},children:[N," Total"]}),e.jsx("td",{className:"pl-3 pr-6 py-3.5 text-right font-bold tabular-nums whitespace-nowrap",style:{color:je.error},children:h(p[N])})]})]},N)}),e.jsxs("tr",{style:{borderTop:`3px solid ${je.error}`,backgroundColor:je.errorBg},children:[e.jsx("td",{colSpan:10,className:"pl-6 pr-3 py-4 text-2xl font-extrabold",style:{color:je.error},children:"GRAND TOTAL (Recurring)"}),e.jsx("td",{className:"pl-3 pr-6 py-4 text-right text-2xl font-extrabold tabular-nums whitespace-nowrap",style:{color:je.error},children:h(b)})]}),e.jsxs("tr",{style:{backgroundColor:je.errorBg,borderTop:`1px solid ${a}`},children:[e.jsx("td",{colSpan:10,className:"pl-6 pr-3 py-3 text-2xl font-extrabold",style:{color:je.warning},children:"+ Capital Investments"}),e.jsx("td",{className:"pl-3 pr-6 py-3 text-right text-2xl font-extrabold tabular-nums whitespace-nowrap",style:{color:je.warning},children:h(w)})]}),e.jsxs("tr",{style:{backgroundColor:"rgba(248,113,113,0.16)",borderTop:`2px solid ${je.error}`},children:[e.jsx("td",{colSpan:10,className:"pl-6 pr-3 py-4 text-2xl font-extrabold",style:{color:je.error},children:"TOTAL EXPENSES"}),e.jsx("td",{className:"pl-3 pr-6 py-4 text-right text-2xl font-extrabold tabular-nums whitespace-nowrap",style:{color:je.error},children:h(x)})]})]})]})}),e.jsxs("div",{className:"md:hidden max-w-lg mx-auto",children:[u.map(N=>{const j=f.filter(y=>y.year===N);return e.jsxs(k.Fragment,{children:[e.jsx("div",{className:"font-extrabold text-center py-3 text-lg rounded-lg mt-4 first:mt-0",style:{backgroundColor:je.primaryBg,color:je.primary},children:N}),j.map(y=>e.jsx(Nx,{row:y,fmt:h,textColor:n,cardBackgroundColor:s,dividerColor:a},y.label)),e.jsxs("div",{className:"flex justify-between items-center py-4 mb-2",style:{borderTop:`2px solid ${je.errorBorder}`},children:[e.jsxs("span",{className:"font-extrabold text-lg",style:{color:je.error},children:[N," Total"]}),e.jsx("span",{className:"font-extrabold text-lg",style:{color:je.error},children:h(p[N])})]})]},N)}),e.jsxs("div",{className:"mt-2 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center px-4 py-4",style:{backgroundColor:je.errorBg,borderTop:`4px solid ${je.error}`},children:[e.jsx("span",{className:"font-extrabold text-base",style:{color:je.error},children:"GRAND TOTAL (Recurring)"}),e.jsx("span",{className:"font-extrabold text-base",style:{color:je.error},children:h(b)})]}),e.jsxs("div",{className:"flex justify-between items-center px-4 py-3",style:{backgroundColor:je.errorBg},children:[e.jsx("span",{className:"font-extrabold text-base",style:{color:je.warning},children:"+ Capital Investments"}),e.jsx("span",{className:"font-extrabold text-base",style:{color:je.warning},children:h(w)})]}),e.jsxs("div",{className:"flex justify-between items-center px-4 py-4",style:{backgroundColor:"rgba(248,113,113,0.18)",borderTop:`2px solid ${je.error}`},children:[e.jsx("span",{className:"font-extrabold text-lg",style:{color:je.error},children:"TOTAL EXPENSES"}),e.jsx("span",{className:"font-extrabold text-lg",style:{color:je.error},children:h(x)})]})]})]})]})}),e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"max-w-5xl mx-auto",style:{height:1,backgroundColor:a}})}),e.jsx("section",{className:"py-8",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 max-w-5xl mx-auto",children:[{icon:tg,iconColor:je.error,borderColor:je.error,label:"Total Recurring Expenses",value:h(b),valueColor:je.error,sub:null},{icon:eo,iconColor:je.warning,borderColor:je.warning,label:"Capital Investments",value:h(w),valueColor:je.warning,sub:null},{icon:og,iconColor:je.error,borderColor:je.error,label:"Grand Total Spent",value:h(x),valueColor:je.error,sub:null},{icon:Jc,iconColor:je.success,borderColor:je.success,label:"Revenue / Funding",value:h(0),valueColor:je.success,sub:"Zero. Nothing. Nada."}].map(({icon:N,iconColor:j,borderColor:y,label:m,value:_,valueColor:E,sub:A})=>e.jsxs("div",{className:"card glass-effect p-6 rounded-xl text-center border-l-4",style:{backgroundColor:s,boxShadow:v,borderColor:y},children:[e.jsx(N,{className:"w-8 h-8 mx-auto mb-2",style:{color:j}}),e.jsx("p",{className:"text-sm uppercase tracking-wide mb-1",style:{color:n,opacity:.6},children:m}),e.jsx("p",{className:"text-2xl font-extrabold",style:{color:E},children:_}),A&&e.jsx("p",{className:"text-xs mt-1 font-semibold",style:{color:je.error},children:A})]},m))})})}),e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"max-w-5xl mx-auto",style:{height:1,backgroundColor:a}})}),e.jsx("section",{className:"py-8",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-center mb-8",style:{color:n},children:"Capital Investments (One-Time)"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 max-w-3xl mx-auto",children:[e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:s,boxShadow:v},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:je.warningBg},children:e.jsx(eo,{className:"w-5 h-5",style:{color:je.warning}})}),e.jsx("h3",{className:"text-lg font-bold",style:{color:n},children:"IT Infrastructure"})]}),e.jsx("p",{className:"text-sm mb-2",style:{color:n,opacity:.75},children:"Laptops, computers, networking equipment — purchased since July 2022"}),e.jsx("p",{className:"text-2xl font-extrabold",style:{color:je.warning},children:h(l.infraCost)}),e.jsx("p",{className:"text-xs mt-1",style:{color:n,opacity:.45},children:"Depreciating at 10%/year • 5%/year maintenance"})]}),e.jsxs("div",{className:"card glass-effect hover-lift p-6 rounded-xl",style:{backgroundColor:s,boxShadow:v},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:je.infoBg},children:e.jsx(sg,{className:"w-5 h-5",style:{color:je.info}})}),e.jsx("h3",{className:"text-lg font-bold",style:{color:n},children:"Fixtures & Furniture"})]}),e.jsx("p",{className:"text-sm mb-2",style:{color:n,opacity:.75},children:"Office furniture, fixtures, and setup — since July 2022"}),e.jsx("p",{className:"text-2xl font-extrabold",style:{color:je.info},children:h(l.furnitureCost)}),e.jsx("p",{className:"text-xs mt-1",style:{color:n,opacity:.45},children:"Depreciating at 15%/year"})]})]})]})}),e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"max-w-5xl mx-auto",style:{height:1,backgroundColor:a}})}),e.jsx("section",{className:"py-8",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-center mb-8",style:{color:n},children:"Monthly Recurring Expense Categories"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-5xl mx-auto",children:[{icon:Xp,iconBg:je.primaryBg,iconColor:je.primary,label:"Developer Salaries",desc:`3 devs (Jan 2022 – Jan 2026): ${h(l.salary3)}/mo
1169
1168
  2 devs (Feb 2026 – present): ${h(l.salary2)}/mo`},{icon:lg,iconBg:je.errorBg,iconColor:je.error,label:"Office Rent",desc:`${h(l.rent)}/month since July 2022`},{icon:d0,iconBg:je.warningBg,iconColor:je.warning,label:"Utilities",desc:`Internet, Electricity & Backup = ${h(l.utilities)}/mo`},{icon:Kp,iconBg:je.infoBg,iconColor:je.info,label:"VPS & Hosting",desc:`Hive witness, VSC witness, app backends — ${h(l.vps)}/mo`},{icon:ag,iconBg:je.successBg,iconColor:je.success,label:"Dev Programs & Domains",desc:`Apple/Google dev programs ${h(l.devPrograms)} + Domains ${h(l.domains)} = ${h(l.devPrograms+l.domains)}/mo`},{icon:eo,iconBg:je.warningBg,iconColor:je.warning,label:"Depreciation & Maintenance",desc:`IT infra: 10% depreciation + 5% maintenance/yr
1170
1169
  Furniture: 15% depreciation/yr`}].map(({icon:N,iconBg:j,iconColor:y,label:m,desc:_})=>e.jsxs("div",{className:"card glass-effect hover-lift p-5 rounded-xl",style:{backgroundColor:s,boxShadow:v},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center",style:{backgroundColor:j},children:e.jsx(N,{className:"w-5 h-5",style:{color:y}})}),e.jsx("h3",{className:"font-bold text-sm",style:{color:n},children:m})]}),e.jsx("p",{className:"text-xs whitespace-pre-line",style:{color:n,opacity:.7},children:_})]},m))})]})}),e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"max-w-5xl mx-auto",style:{height:1,backgroundColor:a}})}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx("div",{className:"max-w-3xl mx-auto",children:e.jsxs("div",{className:"card glass-effect rounded-2xl p-8",style:{backgroundColor:s,boxShadow:v,border:`2px solid ${a}`},children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(rg,{className:"w-12 h-12 mx-auto mb-4",style:{color:je.error}}),e.jsx("h2",{className:"text-3xl font-extrabold mb-2",style:{color:je.error},children:"The Hard Truth"})]}),e.jsxs("div",{className:"space-y-4 text-base",style:{color:n,opacity:.9},children:[e.jsxs("p",{children:["We have spent"," ",e.jsx("span",{className:"font-extrabold",style:{color:je.error},children:h(x)})," ","of our own money building apps, running infrastructure, and supporting the Hive ecosystem."]}),e.jsxs("p",{children:["Except for 3Speak-funded projects —"," ",e.jsx("span",{className:"font-semibold",style:{color:n},children:"Distriator"}),","," ",e.jsx("span",{className:"font-semibold",style:{color:n},children:"CheckInWithXYZ"})," ","&"," ",e.jsx("span",{className:"font-semibold",style:{color:n},children:"3Speak"})," ","— we have"," ",e.jsx("span",{className:"font-extrabold",style:{color:je.error},children:"never received any funding"})," ","for any of our other projects. Everything else has been entirely self-funded."]}),e.jsxs("p",{children:["We have"," ",e.jsx("span",{className:"font-bold",style:{color:je.error},children:"never asked for DHF funding or any grants"}),". We have not monetized any of our apps. We have not put ads in our apps. Everything is free, open-source, and built for the Hive community."]}),e.jsxs("p",{children:["On top of all this, we are holding"," ",e.jsx("span",{className:"font-extrabold",style:{color:je.accent},children:"Hive Power (staked HIVE) worth $11,000"})," ","— locked for 3 months — and we are continuously investing and increasing our stake in Hive. We don't just build on Hive, we put our money where our mouth is."]}),e.jsxs("p",{children:["Since July 2023, we also send approximately"," ",e.jsx("span",{className:"font-bold",style:{color:n},children:"$10 to $20 worth of support every month"})," ","to community initiatives like"," ",e.jsx("span",{className:"font-semibold",children:"Ladies of Hive"}),","," ",e.jsx("span",{className:"font-semibold",children:"Shadow Hunters"}),","," ",e.jsx("span",{className:"font-semibold",children:"Reflection Hunters"}),","," ",e.jsx("span",{className:"font-semibold",children:"Bird Watchers"}),","," ",e.jsx("span",{className:"font-semibold",children:"Power Plant Vegan"}),","," ",e.jsx("span",{className:"font-semibold",children:"India United"}),", and"," ",e.jsx("span",{className:"font-semibold",children:"Amazing Drinks"}),". On top of that, we actively support many Hive users by upvoting their content and rewarding them with Hive inflation through our curation efforts."]}),e.jsxs("p",{children:["This is not sustainable. We are running in"," ",e.jsx("span",{className:"font-extrabold",style:{color:je.error},children:"heavy debt"}),". Every month, the expenses pile up — salaries, rent, hosting, infrastructure — and nothing comes back."]}),e.jsx("p",{className:"font-semibold",style:{color:n},children:"This is taking a heavy toll — financially, mentally, and emotionally. Building for years without any return is exhausting. But we keep going because we believe in Hive and its community."})]}),e.jsx("div",{className:"my-6",style:{height:1,backgroundColor:a}}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-extrabold mb-3",style:{color:je.accent},children:"All We Ask Is Your Witness Vote"}),e.jsxs("p",{className:"mb-6 max-w-lg mx-auto",style:{color:n,opacity:.85},children:["We have never asked for money. We are not asking for money now. Just your"," ",e.jsx("span",{className:"font-bold",style:{color:je.accent},children:"Hive witness vote for @sagarkothari88"})," ","— that's it. That small gesture of support means the world to us and helps us keep building for the ecosystem."]}),e.jsxs("a",{href:"https://vote.hive.uno/@sagarkothari88",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-lg gap-2",children:[e.jsx(Jc,{className:"w-5 h-5"}),"Vote @sagarkothari88 as Witness"]})]})]})})})}),e.jsx("section",{className:"py-8",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[e.jsx("h3",{className:"text-xl font-bold mb-4",style:{color:n},children:"Debt vs Revenue"}),e.jsx("div",{className:"w-full rounded-full h-8 overflow-hidden mb-2",style:{backgroundColor:je.progressTrack},children:e.jsx("div",{className:"h-full rounded-full flex items-center justify-end pr-3",style:{width:"100%",background:`linear-gradient(90deg, ${je.error}, rgba(248,113,113,0.7))`},children:e.jsxs("span",{className:"text-xs font-bold text-white",children:["DEBT: ",h(x)]})})}),e.jsx("div",{className:"w-full rounded-full h-8 overflow-hidden",style:{backgroundColor:je.progressTrack},children:e.jsx("div",{className:"h-full rounded-full flex items-center pl-3",style:{width:"2%",minWidth:"80px",backgroundColor:je.success},children:e.jsx("span",{className:"text-xs font-bold text-white",children:h(0)})})}),e.jsxs("p",{className:"text-xs mt-2",style:{color:n,opacity:.45},children:["Revenue bar is at minimum width because the actual value is ",h(0)]})]})})}),e.jsx("div",{className:"py-20"})]})})]})},_x=1,kx=1e6;let so=0;function Ex(){return so=(so+1)%Number.MAX_SAFE_INTEGER,so.toString()}const no=new Map,sd=t=>{if(no.has(t))return;const r=setTimeout(()=>{no.delete(t),ms({type:"REMOVE_TOAST",toastId:t})},kx);no.set(t,r)},k0=(t,r)=>{switch(r.type){case"ADD_TOAST":return{...t,toasts:[r.toast,...t.toasts].slice(0,_x)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===r.toast.id?{...n,...r.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=r;return n?sd(n):t.toasts.forEach(s=>{sd(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return r.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==r.toastId)}}},bn=[];let yn={toasts:[]};function ms(t){yn=k0(yn,t),bn.forEach(r=>{r(yn)})}function E0({...t}){const r=Ex(),n=a=>ms({type:"UPDATE_TOAST",toast:{...a,id:r}}),s=()=>ms({type:"DISMISS_TOAST",toastId:r});return ms({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:a=>{a||s()}}}),{id:r,dismiss:s,update:n}}function Ax(){const[t,r]=vn.useState(yn);return vn.useEffect(()=>(bn.push(r),()=>{const n=bn.indexOf(r);n>-1&&bn.splice(n,1)}),[t]),{...t,toast:E0,dismiss:n=>ms({type:"DISMISS_TOAST",toastId:n})}}exports.ActivityList=g0;exports.AddCommentInput=xs;exports.ApiVideoFeedType=er;exports.AudioUploader=t0;exports.CommentsList=Zg;exports.CommentsModal=Oo;exports.CommunitiesList=zg;exports.CommunityAbout=b0;exports.CommunityDetail=Wg;exports.CommunityMembers=v0;exports.CommunityPostDetails=Gg;exports.CommunityTeam=y0;exports.EmojiPicker=s0;exports.ExpensesView=jx;exports.FavouriteWidget=Io;exports.FollowersList=jg;exports.FollowingList=_g;exports.GiphyPicker=a0;exports.HiveContributionsLanding=hx;exports.HiveDetailPost=qg;exports.HiveToolbar=Ig;exports.ImageUploader=e0;exports.ListOfWitnesses=Sg;exports.Modal=l0;exports.PollCreator=i0;exports.PostActionButton=kn;exports.PostComposer=gs;exports.PostFeedList=m0;exports.ProposalsList=wg;exports.SUPPORTED_CURRENCIES=gn;exports.TemplatePicker=n0;exports.TransactionHistory=Dg;exports.UpvoteList=Yg;exports.UpvoteListModal=Lo;exports.UserAccount=Xg;exports.UserChannel=Lg;exports.UserDetailProfile=rx;exports.UserFollowers=w0;exports.UserFollowing=N0;exports.UserInfo=j0;exports.UserProfilePage=Kg;exports.VideoCard=ld;exports.VideoDetail=Vp;exports.VideoFeed=En;exports.VideoInfo=ud;exports.VideoUploader=r0;exports.Wallet=h0;exports.apiService=Nt;exports.getLocalCurrency=f0;exports.reducer=k0;exports.server=Gr;exports.templateService=o0;exports.toast=E0;exports.useIsMobile=$o;exports.useToast=Ax;exports.useWalletStore=Ro;exports.userService=Ee;exports.witnessService=Nr;