livelocale 0.8.0 → 0.8.1
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/client/index.cjs +56 -12
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +55 -12
- package/dist/client/index.js.map +1 -1
- package/dist/codemod/index.cjs +0 -0
- package/dist/codemod/index.js +0 -0
- package/dist/react/index.cjs +57 -14
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +57 -14
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +8 -2
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +7 -2
- package/dist/server/index.js.map +1 -1
- package/dist/studio/assets/{index-D7ifnqy5.js → index-D6D5nPQI.js} +1 -1
- package/dist/studio/assets/{index-Zh0KtFUH.css → index-z0sbyt6N.css} +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/{wrap-CsOtHp8r.d.cts → wrap-2qVxLN9Q.d.cts} +10 -18
- package/dist/{wrap-CsOtHp8r.d.ts → wrap-2qVxLN9Q.d.ts} +10 -18
- package/package.json +1 -1
|
@@ -6,5 +6,5 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
6
6
|
`).replace(Di,``)}function ki(e,t,n){if(t=Oi(t),Oi(e)!==t&&n)throw Error(r(425))}function Ai(){}var ji=null,Mi=null;function Ni(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Pi=typeof setTimeout==`function`?setTimeout:void 0,Fi=typeof clearTimeout==`function`?clearTimeout:void 0,Ii=typeof Promise==`function`?Promise:void 0,Li=typeof queueMicrotask==`function`?queueMicrotask:Ii===void 0?Pi:function(e){return Ii.resolve(null).then(e).catch(Ri)};function Ri(e){setTimeout(function(){throw e})}function zi(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),xn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);xn(t)}function Bi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Vi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Hi=Math.random().toString(36).slice(2),Ui=`__reactFiber$`+Hi,Wi=`__reactProps$`+Hi,Gi=`__reactContainer$`+Hi,Ki=`__reactEvents$`+Hi,qi=`__reactListeners$`+Hi,Ji=`__reactHandles$`+Hi;function Yi(e){var t=e[Ui];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gi]||n[Ui]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Vi(e);e!==null;){if(n=e[Ui])return n;e=Vi(e)}return t}e=n,n=e.parentNode}return null}function Xi(e){return e=e[Ui]||e[Gi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Zi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Qi(e){return e[Wi]||null}var $i=[],ea=-1;function ta(e){return{current:e}}function N(e){0>ea||(e.current=$i[ea],$i[ea]=null,ea--)}function P(e,t){ea++,$i[ea]=e.current,e.current=t}var na={},F=ta(na),ra=ta(!1),ia=na;function aa(e,t){var n=e.type.contextTypes;if(!n)return na;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function oa(e){return e=e.childContextTypes,e!=null}function sa(){N(ra),N(F)}function ca(e,t,n){if(F.current!==na)throw Error(r(168));P(F,t),P(ra,n)}function la(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ge(e)||`Unknown`,a));return k({},n,i)}function ua(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||na,ia=F.current,P(F,e),P(ra,ra.current),!0}function da(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=la(e,t,ia),i.__reactInternalMemoizedMergedChildContext=e,N(ra),N(F),P(F,e)):N(ra),P(ra,n)}var fa=null,pa=!1,ma=!1;function ha(e){fa===null?fa=[e]:fa.push(e)}function ga(e){pa=!0,ha(e)}function _a(){if(!ma&&fa!==null){ma=!0;var e=0,t=j;try{var n=fa;for(j=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}fa=null,pa=!1}catch(t){throw fa!==null&&(fa=fa.slice(e+1)),St(Dt,_a),t}finally{j=t,ma=!1}}return null}var va=[],ya=0,ba=null,xa=0,Sa=[],Ca=0,wa=null,Ta=1,Ea=``;function Da(e,t){va[ya++]=xa,va[ya++]=ba,ba=e,xa=t}function Oa(e,t,n){Sa[Ca++]=Ta,Sa[Ca++]=Ea,Sa[Ca++]=wa,wa=e;var r=Ta;e=Ea;var i=32-Ft(r)-1;r&=~(1<<i),n+=1;var a=32-Ft(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ta=1<<32-Ft(t)+i|n<<i|r,Ea=a+e}else Ta=1<<a|n<<i|r,Ea=e}function ka(e){e.return!==null&&(Da(e,1),Oa(e,1,0))}function Aa(e){for(;e===ba;)ba=va[--ya],va[ya]=null,xa=va[--ya],va[ya]=null;for(;e===wa;)wa=Sa[--Ca],Sa[Ca]=null,Ea=Sa[--Ca],Sa[Ca]=null,Ta=Sa[--Ca],Sa[Ca]=null}var ja=null,Ma=null,I=!1,Na=null;function Pa(e,t){var n=Kl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Fa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,ja=e,Ma=Bi(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,ja=e,Ma=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=wa===null?null:{id:Ta,overflow:Ea},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ja=e,Ma=null,!0);default:return!1}}function Ia(e){return(e.mode&1)!=0&&(e.flags&128)==0}function La(e){if(I){var t=Ma;if(t){var n=t;if(!Fa(e,t)){if(Ia(e))throw Error(r(418));t=Bi(n.nextSibling);var i=ja;t&&Fa(e,t)?Pa(i,n):(e.flags=e.flags&-4097|2,I=!1,ja=e)}}else{if(Ia(e))throw Error(r(418));e.flags=e.flags&-4097|2,I=!1,ja=e}}}function Ra(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ja=e}function za(e){if(e!==ja)return!1;if(!I)return Ra(e),I=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Ni(e.type,e.memoizedProps)),t&&=Ma){if(Ia(e))throw Ba(),Error(r(418));for(;t;)Pa(e,t),t=Bi(t.nextSibling)}if(Ra(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Ma=Bi(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Ma=null}}else Ma=ja?Bi(e.stateNode.nextSibling):null;return!0}function Ba(){for(var e=Ma;e;)e=Bi(e.nextSibling)}function Va(){Ma=ja=null,I=!1}function Ha(e){Na===null?Na=[e]:Na.push(e)}var Ua=C.ReactCurrentBatchConfig;function Wa(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ga(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ka(e){var t=e._init;return t(e._payload)}function qa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Yl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=$l(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ee?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Ka(i)===t.type)?(r=a(t,n.props),r.ref=Wa(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=Wa(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=eu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Zl(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=$l(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=Xl(t.type,t.key,t.props,null,e.mode,n),n.ref=Wa(e,null,t),n.return=e,n;case T:return t=eu(t,e.mode,n),t.return=e,t;case O:var r=t._init;return f(e,r(t._payload),n)}if(ke(t)||le(t))return t=Zl(t,e.mode,n,null),t.return=e,t;Ga(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case O:return i=n._init,p(e,t,i(n._payload),r)}if(ke(n)||le(n))return i===null?d(e,t,n,r,null):null;Ga(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:var a=r._init;return m(e,t,n,a(r._payload),i)}if(ke(r)||le(r))return e=e.get(n)||null,d(t,e,r,i,null);Ga(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),I&&Da(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return I&&Da(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),I&&Da(r,h),l}function g(a,s,c,l){var u=le(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),I&&Da(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return I&&Da(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),I&&Da(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ee&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ee){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===O&&Ka(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Wa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===ee?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Wa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case O:return l=i._init,_(e,r,l(i._payload),o)}if(ke(i))return h(e,r,i,o);if(le(i))return g(e,r,i,o);Ga(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ja=qa(!0),Ya=qa(!1),Xa=ta(null),Za=null,Qa=null,$a=null;function eo(){$a=Qa=Za=null}function to(e){var t=Xa.current;N(Xa),e._currentValue=t}function no(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ro(e,t){Za=e,$a=Qa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Hs=!0),e.firstContext=null)}function io(e){var t=e._currentValue;if($a!==e)if(e={context:e,memoizedValue:t,next:null},Qa===null){if(Za===null)throw Error(r(308));Qa=e,Za.dependencies={lanes:0,firstContext:e}}else Qa=Qa.next=e;return t}var ao=null;function oo(e){ao===null?ao=[e]:ao.push(e)}function so(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,oo(t)):(n.next=i.next,i.next=n),t.interleaved=n,co(e,r)}function co(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var lo=!1;function uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function po(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,co(e,n)}return i=r.interleaved,i===null?(t.next=t,oo(r)):(t.next=i.next,i.next=t),r.interleaved=t,co(e,n)}function ho(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}function go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function _o(e,t,n,r){var i=e.updateQueue;lo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=k({},d,f);break a;case 2:lo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xc|=o,e.lanes=o,e.memoizedState=d}}function vo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var yo={},bo=ta(yo),xo=ta(yo),So=ta(yo);function Co(e){if(e===yo)throw Error(r(174));return e}function wo(e,t){switch(P(So,t),P(xo,e),P(bo,yo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ie(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ie(t,e)}N(bo),P(bo,t)}function To(){N(bo),N(xo),N(So)}function Eo(e){Co(So.current);var t=Co(bo.current),n=Ie(t,e.type);t!==n&&(P(xo,e),P(bo,n))}function Do(e){xo.current===e&&(N(bo),N(xo))}var L=ta(0);function Oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ko=[];function Ao(){for(var e=0;e<ko.length;e++)ko[e]._workInProgressVersionPrimary=null;ko.length=0}var jo=C.ReactCurrentDispatcher,Mo=C.ReactCurrentBatchConfig,No=0,R=null,z=null,B=null,Po=!1,Fo=!1,Io=0,Lo=0;function V(){throw Error(r(321))}function Ro(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!zr(e[n],t[n]))return!1;return!0}function zo(e,t,n,i,a,o){if(No=o,R=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,jo.current=e===null||e.memoizedState===null?Ss:Cs,e=n(i,a),Fo){o=0;do{if(Fo=!1,Io=0,25<=o)throw Error(r(301));o+=1,B=z=null,t.updateQueue=null,jo.current=ws,e=n(i,a)}while(Fo)}if(jo.current=xs,t=z!==null&&z.next!==null,No=0,B=z=R=null,Po=!1,t)throw Error(r(300));return e}function Bo(){var e=Io!==0;return Io=0,e}function Vo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return B===null?R.memoizedState=B=e:B=B.next=e,B}function Ho(){if(z===null){var e=R.alternate;e=e===null?null:e.memoizedState}else e=z.next;var t=B===null?R.memoizedState:B.next;if(t!==null)B=t,z=e;else{if(e===null)throw Error(r(310));z=e,e={memoizedState:z.memoizedState,baseState:z.baseState,baseQueue:z.baseQueue,queue:z.queue,next:null},B===null?R.memoizedState=B=e:B=B.next=e}return B}function Uo(e,t){return typeof t==`function`?t(e):t}function Wo(e){var t=Ho(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=z,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((No&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,R.lanes|=d,Xc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,zr(i,t.memoizedState)||(Hs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,R.lanes|=o,Xc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Go(e){var t=Ho(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);zr(o,t.memoizedState)||(Hs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ko(){}function qo(e,t){var n=R,i=Ho(),a=t(),o=!zr(i.memoizedState,a);if(o&&(i.memoizedState=a,Hs=!0),i=i.queue,as(Xo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||B!==null&&B.memoizedState.tag&1){if(n.flags|=2048,es(9,Yo.bind(null,n,i,a,t),void 0,null),J===null)throw Error(r(349));No&30||Jo(n,t,a)}return a}function Jo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=R.updateQueue,t===null?(t={lastEffect:null,stores:null},R.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Yo(e,t,n,r){t.value=n,t.getSnapshot=r,Zo(t)&&Qo(e)}function Xo(e,t,n){return n(function(){Zo(t)&&Qo(e)})}function Zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zr(e,n)}catch{return!0}}function Qo(e){var t=co(e,1);t!==null&&hl(t,e,1,-1)}function $o(e){var t=Vo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Uo,lastRenderedState:e},t.queue=e,e=e.dispatch=_s.bind(null,R,e),[t.memoizedState,e]}function es(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=R.updateQueue,t===null?(t={lastEffect:null,stores:null},R.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function ts(){return Ho().memoizedState}function ns(e,t,n,r){var i=Vo();R.flags|=e,i.memoizedState=es(1|t,n,void 0,r===void 0?null:r)}function rs(e,t,n,r){var i=Ho();r=r===void 0?null:r;var a=void 0;if(z!==null){var o=z.memoizedState;if(a=o.destroy,r!==null&&Ro(r,o.deps)){i.memoizedState=es(t,n,a,r);return}}R.flags|=e,i.memoizedState=es(1|t,n,a,r)}function is(e,t){return ns(8390656,8,e,t)}function as(e,t){return rs(2048,8,e,t)}function os(e,t){return rs(4,2,e,t)}function ss(e,t){return rs(4,4,e,t)}function cs(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ls(e,t,n){return n=n==null?null:n.concat([e]),rs(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Ho();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ro(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Ho();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ro(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ps(e,t,n){return No&21?(zr(n,t)||(n=Kt(),R.lanes|=n,Xc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Hs=!0),e.memoizedState=n)}function ms(e,t){var n=j;j=n!==0&&4>n?n:4,e(!0);var r=Mo.transition;Mo.transition={};try{e(!1),t()}finally{j=n,Mo.transition=r}}function hs(){return Ho().memoizedState}function gs(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vs(e))ys(t,n);else if(n=so(e,t,n,r),n!==null){var i=Q();hl(n,e,r,i),bs(n,t,r)}}function _s(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vs(e))ys(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,zr(s,o)){var c=t.interleaved;c===null?(i.next=i,oo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=so(e,t,i,r),n!==null&&(i=Q(),hl(n,e,r,i),bs(n,t,r))}}function vs(e){var t=e.alternate;return e===R||t!==null&&t===R}function ys(e,t){Fo=Po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}var xs={readContext:io,useCallback:V,useContext:V,useEffect:V,useImperativeHandle:V,useInsertionEffect:V,useLayoutEffect:V,useMemo:V,useReducer:V,useRef:V,useState:V,useDebugValue:V,useDeferredValue:V,useTransition:V,useMutableSource:V,useSyncExternalStore:V,useId:V,unstable_isNewReconciler:!1},Ss={readContext:io,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:io,useEffect:is,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ns(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return ns(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=gs.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:us,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=ms.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=R,a=Vo();if(I){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),J===null)throw Error(r(349));No&30||Jo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Xo.bind(null,i,o,e),[e]),i.flags|=2048,es(9,Yo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=J.identifierPrefix;if(I){var n=Ea,r=Ta;n=(r&~(1<<32-Ft(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Io++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Lo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},Cs={readContext:io,useCallback:ds,useContext:io,useEffect:as,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:Wo,useRef:ts,useState:function(){return Wo(Uo)},useDebugValue:us,useDeferredValue:function(e){return ps(Ho(),z.memoizedState,e)},useTransition:function(){return[Wo(Uo)[0],Ho().memoizedState]},useMutableSource:Ko,useSyncExternalStore:qo,useId:hs,unstable_isNewReconciler:!1},ws={readContext:io,useCallback:ds,useContext:io,useEffect:as,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:Go,useRef:ts,useState:function(){return Go(Uo)},useDebugValue:us,useDeferredValue:function(e){var t=Ho();return z===null?t.memoizedState=e:ps(t,z.memoizedState,e)},useTransition:function(){return[Go(Uo)[0],Ho().memoizedState]},useMutableSource:Ko,useSyncExternalStore:qo,useId:hs,unstable_isNewReconciler:!1};function Ts(e,t){if(e&&e.defaultProps){for(var n in t=k({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Es(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:k({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ds={isMounted:function(e){return(e=e._reactInternals)?gt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Q(),i=ml(e),a=po(r,i);a.payload=t,n!=null&&(a.callback=n),t=mo(e,a,i),t!==null&&(hl(t,e,i,r),ho(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Q(),i=ml(e),a=po(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=mo(e,a,i),t!==null&&(hl(t,e,i,r),ho(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Q(),r=ml(e),i=po(n,r);i.tag=2,t!=null&&(i.callback=t),t=mo(e,i,r),t!==null&&(hl(t,e,r,n),ho(t,e,r))}};function Os(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Br(n,r)||!Br(i,a):!0}function ks(e,t,n){var r=!1,i=na,a=t.contextType;return typeof a==`object`&&a?a=io(a):(i=oa(t)?ia:F.current,r=t.contextTypes,a=(r=r!=null)?aa(e,i):na),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ds,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function As(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ds.enqueueReplaceState(t,t.state,null)}function js(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},uo(e);var a=t.contextType;typeof a==`object`&&a?i.context=io(a):(a=oa(t)?ia:F.current,i.context=aa(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Es(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Ds.enqueueReplaceState(i,i.state,null),_o(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ms(e,t){try{var n=``,r=t;do n+=me(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
7
7
|
Error generating stack: `+e.message+`
|
|
8
8
|
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ns(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ps(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Fs=typeof WeakMap==`function`?WeakMap:Map;function Is(e,t,n){n=po(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){il||(il=!0,al=r),Ps(e,t)},n}function Ls(e,t,n){n=po(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ps(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ps(e,t),typeof r!=`function`&&(ol===null?ol=new Set([this]):ol.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Rs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fs;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function zs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Bs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=po(-1,1),t.tag=2,mo(n,t,1))),n.lanes|=1),e)}var Vs=C.ReactCurrentOwner,Hs=!1;function H(e,t,n,r){t.child=e===null?Ya(t,null,n,r):Ja(t,e.child,n,r)}function Us(e,t,n,r,i){n=n.render;var a=t.ref;return ro(t,i),r=zo(e,t,n,r,a,i),n=Bo(),e!==null&&!Hs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,lc(e,t,i)):(I&&n&&ka(t),t.flags|=1,H(e,t,r,i),t.child)}function Ws(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Gs(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Br:n,n(o,r)&&e.ref===t.ref)return lc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Gs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Br(a,r)&&e.ref===t.ref)if(Hs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Hs=!0);else return t.lanes=e.lanes,lc(e,t,i)}return Js(e,t,n,r,i)}function Ks(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},P(Jc,qc),qc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,P(Jc,qc),qc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,P(Jc,qc),qc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),P(Jc,qc),qc|=r;return H(e,t,i,n),t.child}function qs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Js(e,t,n,r,i){var a=oa(n)?ia:F.current;return a=aa(t,a),ro(t,i),n=zo(e,t,n,r,a,i),r=Bo(),e!==null&&!Hs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,lc(e,t,i)):(I&&r&&ka(t),t.flags|=1,H(e,t,n,i),t.child)}function Ys(e,t,n,r,i){if(oa(n)){var a=!0;ua(t)}else a=!1;if(ro(t,i),t.stateNode===null)cc(e,t),ks(t,n,r),js(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=io(l):(l=oa(n)?ia:F.current,l=aa(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&As(t,o,r,l),lo=!1;var f=t.memoizedState;o.state=f,_o(t,r,o,i),c=t.memoizedState,s!==r||f!==c||ra.current||lo?(typeof u==`function`&&(Es(t,n,u,r),c=t.memoizedState),(s=lo||Os(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,fo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Ts(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=io(c):(c=oa(n)?ia:F.current,c=aa(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&As(t,o,r,c),lo=!1,f=t.memoizedState,o.state=f,_o(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||ra.current||lo?(typeof p==`function`&&(Es(t,n,p,r),m=t.memoizedState),(l=lo||Os(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Xs(e,t,n,r,a,i)}function Xs(e,t,n,r,i,a){qs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&da(t,n,!1),lc(e,t,a);r=t.stateNode,Vs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ja(t,e.child,null,a),t.child=Ja(t,null,s,a)):H(e,t,s,a),t.memoizedState=r.state,i&&da(t,n,!0),t.child}function Zs(e){var t=e.stateNode;t.pendingContext?ca(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ca(e,t.context,!1),wo(e,t.containerInfo)}function Qs(e,t,n,r,i){return Va(),Ha(i),t.flags|=256,H(e,t,n,r),t.child}var $s={dehydrated:null,treeContext:null,retryLane:0};function ec(e){return{baseLanes:e,cachePool:null,transitions:null}}function tc(e,t,n){var r=t.pendingProps,i=L.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),P(L,i&1),e===null)return La(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=ec(n),t.memoizedState=$s,e):nc(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ic(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?ec(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=$s,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function nc(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function rc(e,t,n,r){return r!==null&&Ha(r),Ja(t,e.child,null,n),e=nc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ic(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ns(Error(r(422))),rc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ja(t,e.child,null,s),t.child.memoizedState=ec(s),t.memoizedState=$s,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return rc(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Ns(o,i,void 0),rc(e,t,s,i)}if(c=(s&e.childLanes)!==0,Hs||c){if(i=J,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,co(e,a),hl(i,e,a,-1))}return kl(),i=Ns(Error(r(421))),rc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Ma=Bi(a.nextSibling),ja=t,I=!0,Na=null,e!==null&&(Sa[Ca++]=Ta,Sa[Ca++]=Ea,Sa[Ca++]=wa,Ta=e.id,Ea=e.overflow,wa=t),t=nc(t,i.children),t.flags|=4096,t)}function ac(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),no(e.return,t,n)}function oc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function sc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(H(e,t,r.children,n),r=L.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ac(e,n,t);else if(e.tag===19)ac(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(P(L,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),oc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}oc(t,!0,n,null,a);break;case`together`:oc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function cc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function lc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function uc(e,t,n){switch(t.tag){case 3:Zs(t),Va();break;case 5:Eo(t);break;case 1:oa(t.type)&&ua(t);break;case 4:wo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;P(Xa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(P(L,L.current&1),e=lc(e,t,n),e===null?null:e.sibling):tc(e,t,n):(P(L,L.current&1),t.flags|=128,null);P(L,L.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return sc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(L,L.current),r)break;return null;case 22:case 23:return t.lanes=0,Ks(e,t,n)}return lc(e,t,n)}var dc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},fc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Co(bo.current);var o=null;switch(n){case`input`:i=Ce(e,i),r=Ce(e,r),o=[];break;case`select`:i=k({},i,{value:void 0}),r=k({},r,{value:void 0}),o=[];break;case`textarea`:i=je(e,i),r=je(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=Ai)}Ge(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&M(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},pc=function(e,t,n,r){n!==r&&(t.flags|=4)};function mc(e,t){if(!I)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function U(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function hc(e,t,n){var i=t.pendingProps;switch(Aa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return U(t),null;case 1:return oa(t.type)&&sa(),U(t),null;case 3:return i=t.stateNode,To(),N(ra),N(F),Ao(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(za(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Na!==null&&(yl(Na),Na=null))),U(t),null;case 5:Do(t);var o=Co(So.current);if(n=t.type,e!==null&&t.stateNode!=null)fc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return U(t),null}if(e=Co(bo.current),za(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ui]=t,i[Wi]=s,e=(t.mode&1)!=0,n){case`dialog`:M(`cancel`,i),M(`close`,i);break;case`iframe`:case`object`:case`embed`:M(`load`,i);break;case`video`:case`audio`:for(o=0;o<pi.length;o++)M(pi[o],i);break;case`source`:M(`error`,i);break;case`img`:case`image`:case`link`:M(`error`,i),M(`load`,i);break;case`details`:M(`toggle`,i);break;case`input`:we(i,s),M(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},M(`invalid`,i);break;case`textarea`:Me(i,s),M(`invalid`,i)}for(var c in Ge(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&ki(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&ki(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&M(`scroll`,i)}switch(n){case`input`:be(i),De(i,s,!0);break;case`textarea`:be(i),Pe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=Ai)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Fe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ui]=t,e[Wi]=i,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:M(`cancel`,e),M(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:M(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<pi.length;o++)M(pi[o],e);o=i;break;case`source`:M(`error`,e),o=i;break;case`img`:case`image`:case`link`:M(`error`,e),M(`load`,e),o=i;break;case`details`:M(`toggle`,e),o=i;break;case`input`:we(e,i),o=Ce(e,i),M(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=k({},i,{value:void 0}),M(`invalid`,e);break;case`textarea`:Me(e,i),o=je(e,i),M(`invalid`,e);break;default:o=i}for(s in Ge(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ue(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Re(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&ze(e,u):typeof u==`number`&&ze(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&M(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:be(e),De(e,i,!1);break;case`textarea`:be(e),Pe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+_e(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ae(e,!!i.multiple,i.defaultValue,!0):Ae(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=Ai)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return U(t),null;case 6:if(e&&t.stateNode!=null)pc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=Co(So.current),Co(bo.current),za(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ui]=t,(s=i.nodeValue!==n)&&(e=ja,e!==null))switch(e.tag){case 3:ki(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&ki(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ui]=t,t.stateNode=i}return U(t),null;case 13:if(N(L),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(I&&Ma!==null&&t.mode&1&&!(t.flags&128))Ba(),Va(),t.flags|=98560,s=!1;else if(s=za(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Ui]=t}else Va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),s=!1}else Na!==null&&(yl(Na),Na=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||L.current&1?Z===0&&(Z=3):kl())),t.updateQueue!==null&&(t.flags|=4),U(t),null);case 4:return To(),e===null&&yi(t.stateNode.containerInfo),U(t),null;case 10:return to(t.type._context),U(t),null;case 17:return oa(t.type)&&sa(),U(t),null;case 19:if(N(L),s=t.memoizedState,s===null)return U(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)mc(s,!1);else{if(Z!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=Oo(e),c!==null){for(t.flags|=128,mc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return P(L,L.current&1|2),t.child}e=e.sibling}s.tail!==null&&A()>nl&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304)}else{if(!i)if(e=Oo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!I)return U(t),null}else 2*A()-s.renderingStartTime>nl&&n!==1073741824&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(U(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=A(),t.sibling=null,n=L.current,P(L,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?qc&1073741824&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function gc(e,t){switch(Aa(t),t.tag){case 1:return oa(t.type)&&sa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return To(),N(ra),N(F),Ao(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(N(L),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(L),null;case 4:return To(),null;case 10:return to(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var _c=!1,W=!1,vc=typeof WeakSet==`function`?WeakSet:Set,G=null;function yc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}function bc(e,t,n){try{n()}catch(n){$(e,t,n)}}var xc=!1;function Sc(e,t){if(ji=Cn,e=Wr(),Gr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Mi={focusedElem:e,selectionRange:n},Cn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ts(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=xc,xc=!1,h}function Cc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&bc(t,n,a)}i=i.next}while(i!==r)}}function wc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Tc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Ec(e){var t=e.alternate;t!==null&&(e.alternate=null,Ec(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ui],delete t[Wi],delete t[Ki],delete t[qi],delete t[Ji])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Dc(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ai));else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}function Ac(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var K=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount==`function`)try{Nt.onCommitFiberUnmount(Mt,n)}catch{}switch(n.tag){case 5:W||yc(n,t);case 6:var r=K,i=jc;K=null,Mc(e,t,n),K=r,jc=i,K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):K.removeChild(n.stateNode));break;case 18:K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?zi(e.parentNode,n):e.nodeType===1&&zi(e,n),xn(e)):zi(K,n.stateNode));break;case 4:r=K,i=jc,K=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),K=r,jc=i;break;case 0:case 11:case 14:case 15:if(!W&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&bc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!W&&(yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(W=(r=W)||n.memoizedState!==null,Mc(e,t,n),W=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:K=c.stateNode,jc=!1;break a;case 3:K=c.stateNode.containerInfo,jc=!0;break a;case 4:K=c.stateNode.containerInfo,jc=!0;break a}c=c.return}if(K===null)throw Error(r(160));Nc(o,s,a),K=null,jc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){$(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ic(t,e),t=t.sibling}function Ic(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Fc(t,e),Lc(e),i&4){try{Cc(3,e,e.return),wc(3,e)}catch(t){$(e,e.return,t)}try{Cc(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:Fc(t,e),Lc(e),i&512&&n!==null&&yc(n,n.return);break;case 5:if(Fc(t,e),Lc(e),i&512&&n!==null&&yc(n,n.return),e.flags&32){var a=e.stateNode;try{ze(a,``)}catch(t){$(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&Te(a,o),Ke(c,s);var u=Ke(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ue(a,f):d===`dangerouslySetInnerHTML`?Re(a,f):d===`children`?ze(a,f):S(a,d,f,u)}switch(c){case`input`:Ee(a,o);break;case`textarea`:Ne(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ae(a,!!o.multiple,o.multiple?[]:``,!1):Ae(a,!!o.multiple,o.defaultValue,!0)):Ae(a,!!o.multiple,m,!1)}a[Wi]=o}catch(t){$(e,e.return,t)}}break;case 6:if(Fc(t,e),Lc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){$(e,e.return,t)}}break;case 3:if(Fc(t,e),Lc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{xn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:Fc(t,e),Lc(e);break;case 13:Fc(t,e),Lc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(tl=A())),i&4&&Pc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(W=(u=W)||d,Fc(t,e),W=u):Fc(t,e),Lc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(G=e,d=e.child;d!==null;){for(f=G=d;G!==null;){switch(p=G,m=p.child,p.tag){case 0:case 11:case 14:case 15:Cc(4,p,p.return);break;case 1:yc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){$(i,n,e)}}break;case 5:yc(p,p.return);break;case 22:if(p.memoizedState!==null){Vc(f);continue}}m===null?Vc(f):(m.return=p,G=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=He(`display`,s))}catch(t){$(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){$(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Fc(t,e),Lc(e),i&4&&Pc(e);break;case 21:break;default:Fc(t,e),Lc(e)}}function Lc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Dc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(ze(a,``),i.flags&=-33),Ac(e,Oc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;kc(e,Oc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rc(e,t,n){G=e,zc(e,t,n)}function zc(e,t,n){for(var r=(e.mode&1)!=0;G!==null;){var i=G,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||_c;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||W;s=_c;var l=W;if(_c=o,(W=c)&&!l)for(G=i;G!==null;)o=G,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Hc(i):(c.return=o,G=c);for(;a!==null;)G=a,zc(a,t,n),a=a.sibling;G=i,_c=s,W=l}Bc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,G=a):Bc(e,t,n)}}function Bc(e){for(;G!==null;){var t=G;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:W||wc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!W)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Ts(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&vo(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}vo(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&xn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}W||t.flags&512&&Tc(t)}catch(e){$(t,t.return,e)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function Vc(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function Hc(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wc(4,t)}catch(e){$(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){$(t,i,e)}}var a=t.return;try{Tc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{Tc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){G=null;break}var s=t.sibling;if(s!==null){s.return=t.return,G=s;break}G=t.return}}var Uc=Math.ceil,Wc=C.ReactCurrentDispatcher,Gc=C.ReactCurrentOwner,Kc=C.ReactCurrentBatchConfig,q=0,J=null,Y=null,X=0,qc=0,Jc=ta(0),Z=0,Yc=null,Xc=0,Zc=0,Qc=0,$c=null,el=null,tl=0,nl=1/0,rl=null,il=!1,al=null,ol=null,sl=!1,cl=null,ll=0,ul=0,dl=null,fl=-1,pl=0;function Q(){return q&6?A():fl===-1?fl=A():fl}function ml(e){return e.mode&1?q&2&&X!==0?X&-X:Ua.transition===null?(e=j,e===0?(e=window.event,e=e===void 0?16:kn(e.type),e):e):(pl===0&&(pl=Kt()),pl):1}function hl(e,t,n,i){if(50<ul)throw ul=0,dl=null,Error(r(185));Jt(e,n,i),(!(q&2)||e!==J)&&(e===J&&(!(q&2)&&(Zc|=n),Z===4&&xl(e,X)),gl(e,i),n===1&&q===0&&!(t.mode&1)&&(nl=A()+500,pa&&_a()))}function gl(e,t){var n=e.callbackNode;Wt(e,t);var r=Ht(e,e===J?X:0);if(r===0)n!==null&&Ct(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ct(n),t===1)e.tag===0?ga(Sl.bind(null,e)):ha(Sl.bind(null,e)),Li(function(){!(q&6)&&_a()}),n=null;else{switch(Zt(r)){case 1:n=Dt;break;case 4:n=Ot;break;case 16:n=kt;break;case 536870912:n=jt;break;default:n=kt}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(fl=-1,pl=0,q&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=Ht(e,e===J?X:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=q;q|=2;var o=Ol();(J!==e||X!==t)&&(rl=null,nl=A()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);eo(),Wc.current=o,q=a,Y===null?(J=null,X=0,t=Z):t=0}if(t!==0){if(t===2&&(a=Gt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Yc,El(e,0),xl(e,i),gl(e,A()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Gt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Yc,El(e,0),xl(e,i),gl(e,A()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,el,rl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=tl+500-A(),10<t)){if(Ht(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){Q(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Pi(Fl.bind(null,e,el,rl),t);break}Fl(e,el,rl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ft(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=A()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Uc(i/1960))-i,10<i){e.timeoutHandle=Pi(Fl.bind(null,e,el,rl),i);break}Fl(e,el,rl);break;case 5:Fl(e,el,rl);break;default:throw Error(r(329))}}}return gl(e,A()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=$c;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=el,el=n,t!==null&&yl(t)),e}function yl(e){el===null?el=e:el.push.apply(el,e)}function bl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!zr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xl(e,t){for(t&=~Qc,t&=~Zc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ft(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(q&6)throw Error(r(327));Ll();var t=Ht(e,0);if(!(t&1))return gl(e,A()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Gt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Yc,El(e,0),xl(e,t),gl(e,A()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,el,rl),gl(e,A()),null}function Cl(e,t){var n=q;q|=1;try{return e(t)}finally{q=n,q===0&&(nl=A()+500,pa&&_a())}}function wl(e){cl!==null&&cl.tag===0&&!(q&6)&&Ll();var t=q;q|=1;var n=Kc.transition,r=j;try{if(Kc.transition=null,j=1,e)return e()}finally{j=r,Kc.transition=n,q=t,!(q&6)&&_a()}}function Tl(){qc=Jc.current,N(Jc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Fi(n)),Y!==null)for(n=Y.return;n!==null;){var r=n;switch(Aa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&sa();break;case 3:To(),N(ra),N(F),Ao();break;case 5:Do(r);break;case 4:To();break;case 13:N(L);break;case 19:N(L);break;case 10:to(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(J=e,Y=e=Yl(e.current,null),X=qc=t,Z=0,Yc=null,Qc=Zc=Xc=0,el=$c=null,ao!==null){for(t=0;t<ao.length;t++)if(n=ao[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}ao=null}return e}function Dl(e,t){do{var n=Y;try{if(eo(),jo.current=xs,Po){for(var i=R.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Po=!1}if(No=0,B=z=R=null,Fo=!1,Io=0,Gc.current=null,n===null||n.return===null){Z=1,Yc=t,Y=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=X,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=zs(s);if(m!==null){m.flags&=-257,Bs(m,s,c,o,t),m.mode&1&&Rs(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Rs(o,u,t),kl();break a}l=Error(r(426))}}else if(I&&c.mode&1){var _=zs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Bs(_,s,c,o,t),Ha(Ms(l,c));break a}}o=l=Ms(l,c),Z!==4&&(Z=2),$c===null?$c=[o]:$c.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Is(o,l,t);go(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ol===null||!ol.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ls(o,c,t);go(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,Y===n&&n!==null&&(Y=n=n.return);continue}break}while(1)}function Ol(){var e=Wc.current;return Wc.current=xs,e===null?xs:e}function kl(){(Z===0||Z===3||Z===2)&&(Z=4),J===null||!(Xc&268435455)&&!(Zc&268435455)||xl(J,X)}function Al(e,t){var n=q;q|=2;var i=Ol();(J!==e||X!==t)&&(rl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(eo(),q=n,Wc.current=i,Y!==null)throw Error(r(261));return J=null,X=0,Z}function jl(){for(;Y!==null;)Nl(Y)}function Ml(){for(;Y!==null&&!wt();)Nl(Y)}function Nl(e){var t=Ul(e.alternate,e,qc);e.memoizedProps=e.pendingProps,t===null?Pl(e):Y=t,Gc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=gc(n,t),n!==null){n.flags&=32767,Y=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Z=6,Y=null;return}}else if(n=hc(n,t,qc),n!==null){Y=n;return}if(t=t.sibling,t!==null){Y=t;return}Y=t=e}while(t!==null);Z===0&&(Z=5)}function Fl(e,t,n){var r=j,i=Kc.transition;try{Kc.transition=null,j=1,Il(e,t,n,r)}finally{Kc.transition=i,j=r}return null}function Il(e,t,n,i){do Ll();while(cl!==null);if(q&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Yt(e,o),e===J&&(Y=J=null,X=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||sl||(sl=!0,Wl(kt,function(){return Ll(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Kc.transition,Kc.transition=null;var s=j;j=1;var c=q;q|=4,Gc.current=null,Sc(e,n),Ic(n,e),Kr(Mi),Cn=!!ji,Mi=ji=null,e.current=n,Rc(n,e,a),Tt(),q=c,j=s,Kc.transition=o}else e.current=n;if(sl&&(sl=!1,cl=e,ll=a),o=e.pendingLanes,o===0&&(ol=null),Pt(n.stateNode,i),gl(e,A()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(il)throw il=!1,e=al,al=null,e;return ll&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===dl?ul++:(ul=0,dl=e):ul=0,_a(),null}function Ll(){if(cl!==null){var e=Zt(ll),t=Kc.transition,n=j;try{if(Kc.transition=null,j=16>e?16:e,cl===null)var i=!1;else{if(e=cl,cl=null,ll=0,q&6)throw Error(r(331));var a=q;for(q|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(G=u;G!==null;){var d=G;switch(d.tag){case 0:case 11:case 15:Cc(8,d,o)}var f=d.child;if(f!==null)f.return=d,G=f;else for(;G!==null;){d=G;var p=d.sibling,m=d.return;if(Ec(d),d===u){G=null;break}if(p!==null){p.return=m,G=p;break}G=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}G=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,G=s;else b:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Cc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,G=v;break b}G=o.return}}var y=e.current;for(G=y;G!==null;){s=G;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,G=b;else b:for(s=y;G!==null;){if(c=G,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:wc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){G=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,G=x;break b}G=c.return}}if(q=a,_a(),Nt&&typeof Nt.onPostCommitFiberRoot==`function`)try{Nt.onPostCommitFiberRoot(Mt,e)}catch{}i=!0}return i}finally{j=n,Kc.transition=t}}return!1}function Rl(e,t,n){t=Ms(n,t),t=Is(e,t,1),e=mo(e,t,1),t=Q(),e!==null&&(Jt(e,1,t),gl(e,t))}function $(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ol===null||!ol.has(r))){e=Ms(n,e),e=Ls(t,e,1),t=mo(t,e,1),e=Q(),t!==null&&(Jt(t,1,e),gl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Q(),e.pingedLanes|=e.suspendedLanes&n,J===e&&(X&n)===n&&(Z===4||Z===3&&(X&130023424)===X&&500>A()-tl?El(e,0):Qc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Bt,Bt<<=1,!(Bt&130023424)&&(Bt=4194304)):t=1);var n=Q();e=co(e,t),e!==null&&(Jt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ra.current)Hs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Hs=!1,uc(e,t,n);Hs=!!(e.flags&131072)}else Hs=!1,I&&t.flags&1048576&&Oa(t,xa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;cc(e,t),e=t.pendingProps;var a=aa(t,F.current);ro(t,n),a=zo(null,t,i,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,oa(i)?(o=!0,ua(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,uo(t),a.updater=Ds,t.stateNode=a,a._reactInternals=t,js(t,i,e,n),t=Xs(null,t,i,!0,o,n)):(t.tag=0,I&&o&&ka(t),H(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(cc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=Ts(i,e),a){case 0:t=Js(null,t,i,e,n);break a;case 1:t=Ys(null,t,i,e,n);break a;case 11:t=Us(null,t,i,e,n);break a;case 14:t=Ws(null,t,i,Ts(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Js(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Ys(e,t,i,a,n);case 3:a:{if(Zs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,fo(e,t),_o(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ms(Error(r(423)),t),t=Qs(e,t,i,n,a);break a}else if(i!==a){a=Ms(Error(r(424)),t),t=Qs(e,t,i,n,a);break a}else for(Ma=Bi(t.stateNode.containerInfo.firstChild),ja=t,I=!0,Na=null,n=Ya(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Va(),i===a){t=lc(e,t,n);break a}H(e,t,i,n)}t=t.child}return t;case 5:return Eo(t),e===null&&La(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Ni(i,a)?s=null:o!==null&&Ni(i,o)&&(t.flags|=32),qs(e,t),H(e,t,s,n),t.child;case 6:return e===null&&La(t),null;case 13:return tc(e,t,n);case 4:return wo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ja(t,null,i,n):H(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Us(e,t,i,a,n);case 7:return H(e,t,t.pendingProps,n),t.child;case 8:return H(e,t,t.pendingProps.children,n),t.child;case 12:return H(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,P(Xa,i._currentValue),i._currentValue=s,o!==null)if(zr(o.value,s)){if(o.children===a.children&&!ra.current){t=lc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=po(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),no(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),no(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}H(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,ro(t,n),a=io(a),i=i(a),t.flags|=1,H(e,t,i,n),t.child;case 14:return i=t.type,a=Ts(i,t.pendingProps),a=Ts(i.type,a),Ws(e,t,i,a,n);case 15:return Gs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),cc(e,t),t.tag=1,oa(i)?(e=!0,ua(t)):e=!1,ro(t,n),ks(t,i,a),js(t,i,a,n),Xs(null,t,i,!0,e,n);case 19:return sc(e,t,n);case 22:return Ks(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return St(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ae)return 11;if(e===D)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ee:return Zl(n.children,a,o,t);case te:s=8,a|=8;break;case ne:return e=Kl(12,n,t,a|2),e.elementType=ne,e.lanes=o,e;case E:return e=Kl(13,n,t,a),e.elementType=E,e.lanes=o,e;case oe:return e=Kl(19,n,t,a),e.elementType=oe,e.lanes=o,e;case se:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case re:s=10;break a;case ie:s=9;break a;case ae:s=11;break a;case D:s=14;break a;case O:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=se,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},uo(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return na;e=e._reactInternals;a:{if(gt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(oa(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(oa(n))return la(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=Q(),i=ml(n),a=po(r,i),a.callback=t??null,mo(n,a,i),e.current.lanes=i,Jt(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=Q(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=po(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=mo(i,t,o),e!==null&&(hl(e,i,o,a),ho(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){ou(null,e,null,null)}),t[Gi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=tn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<dn.length&&t!==0&&t<dn[n].priority;n++);dn.splice(n,0,e),n===0&&gn(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[Gi]=o.current,yi(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[Gi]=c.current,yi(e.nodeType===8?e.parentNode:e),wl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Qt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vt(t.pendingLanes);n!==0&&(Xt(t,n|1),gl(t,A()),!(q&6)&&(nl=A()+500,_a()))}break;case 13:wl(function(){var t=co(e,1);t!==null&&hl(t,e,1,Q())}),lu(e,1)}},$t=function(e){if(e.tag===13){var t=co(e,134217728);t!==null&&hl(t,e,134217728,Q()),lu(e,134217728)}},en=function(e){if(e.tag===13){var t=ml(e),n=co(e,t);n!==null&&hl(n,e,t,Q()),lu(e,t)}},tn=function(){return j},nn=function(e,t){var n=j;try{return j=e,t()}finally{j=n}},Ye=function(e,t,n){switch(t){case`input`:if(Ee(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Qi(i);if(!a)throw Error(r(90));xe(i),Ee(i,a)}}}break;case`textarea`:Ne(e,n);break;case`select`:t=n.value,t!=null&&Ae(e,!!n.multiple,t,!1)}},tt=Cl,nt=wl;var yu={usingClientEntryPoint:!1,Events:[Xi,Zi,Qi,$e,et,Cl]},bu={findFiberByHostInstance:Yi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{Mt=Su.inject(xu),Nt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[Gi]=t.current,yi(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=bt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[Gi]=t.current,yi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[Gi]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u(),1),_=c(h(),1),v=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),y=o(((e,t)=>{t.exports=v()}))(),b=8e3,x=({iframeRef:e,appOrigin:t,connectionStatus:n})=>{let[r,i]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{if(i(!1),n!==`connecting`)return;let e=setTimeout(()=>i(!0),b);return()=>clearTimeout(e)},[n]),(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col h-full bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-2xl relative`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 select-none shrink-0`,children:[(0,y.jsx)(`div`,{className:`flex items-center gap-3 w-1/3`,children:(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-rose-500/80`}),(0,y.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-amber-500/80`}),(0,y.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-emerald-500/80`})]})}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4 w-1/3 justify-end`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold tracking-wider text-slate-500 uppercase`,children:`Status`}),(0,y.jsx)(`span`,{className:`px-2 py-0.5 rounded text-[10px] font-bold ${n===`connected`?`bg-emerald-500/10 text-emerald-400 border border-emerald-500/20`:n===`connecting`?`bg-amber-500/10 text-amber-400 border border-amber-500/20 animate-pulse`:`bg-rose-500/10 text-rose-400 border border-rose-500/20`}`,children:n===`connected`?`ACTIVE`:`CONNECTING`})]}),(0,y.jsx)(`button`,{onClick:()=>{e.current&&(e.current.src=e.current.src)},className:`p-1.5 hover:bg-slate-800 text-slate-400 hover:text-slate-200 rounded-lg transition duration-200 border border-transparent hover:border-slate-700`,title:`Reload Frame`,children:(0,y.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,y.jsx)(`path`,{d:`M21 3v5h-5`})]})})]})]}),(0,y.jsxs)(`div`,{className:`flex-1 bg-slate-900 relative`,children:[(0,y.jsx)(`iframe`,{id:`app-preview-iframe`,ref:e,src:`${t}?livelocale-origin=${encodeURIComponent(window.location.origin)}`,className:`w-full h-full border-none bg-white`,sandbox:`allow-same-origin allow-scripts allow-forms allow-popups`}),n===`connecting`&&(0,y.jsxs)(`div`,{className:`absolute inset-0 bg-slate-950/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4 transition duration-300`,children:[(0,y.jsxs)(`div`,{className:`relative w-12 h-12`,children:[(0,y.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-indigo-500/20`}),(0,y.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-t-indigo-500 animate-spin`})]}),(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h3`,{className:`text-slate-200 font-semibold tracking-wide font-outfit`,children:`Connecting to Project`}),(0,y.jsx)(`p`,{className:`text-xs text-slate-500 mt-1 font-mono`,children:`Waiting for client bridge initialization...`})]}),r&&(0,y.jsxs)(`div`,{role:`status`,"data-testid":`slow-connection-help`,className:`max-w-md mx-6 mt-2 rounded-xl border border-slate-800 bg-slate-900/90 p-4 text-left text-xs text-slate-300`,children:[(0,y.jsx)(`p`,{className:`font-semibold text-slate-100`,children:`Still connecting? Usual causes:`}),(0,y.jsxs)(`ul`,{className:`mt-2 space-y-1.5 list-disc pl-4`,children:[(0,y.jsxs)(`li`,{children:[`The app is not running at `,(0,y.jsx)(`span`,{className:`font-mono`,children:t}),`.`]}),(0,y.jsxs)(`li`,{children:[`The app blocks framing: its `,(0,y.jsx)(`span`,{className:`font-mono`,children:`frame-ancestors`}),` `,`or `,(0,y.jsx)(`span`,{className:`font-mono`,children:`X-Frame-Options`}),` header must allow`,` `,(0,y.jsx)(`span`,{className:`font-mono`,children:window.location.origin}),`.`]}),(0,y.jsxs)(`li`,{children:[(0,y.jsx)(`span`,{className:`font-mono`,children:`LiveLocaleProvider`}),` is not mounted, or LiveLocale is off in the app (preview builds need`,` `,(0,y.jsx)(`span`,{className:`font-mono`,children:`NEXT_PUBLIC_LIVELOCALE=preview`}),`).`]})]}),(0,y.jsxs)(`p`,{className:`mt-3 text-slate-400`,children:[`Run`,` `,(0,y.jsxs)(`span`,{className:`font-mono text-slate-200 select-all`,children:[`npx livelocale doctor --app `,t]}),` `,`to check.`]})]})]})]})]})},S=new Set([`plural`,`select`,`selectordinal`]);function C(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r!==`'`){t+=r,n+=1;continue}if(e[n+1]===`'`){t+=`'`,n+=2;continue}let i=e[n+1];if(i===`{`||i===`}`||i===`#`||i===`|`){let t=n+1;for(;t<e.length;){if(e[t]===`'`){if(e[t+1]===`'`){t+=2;continue}break}t+=1}n=t+1;continue}t+=r,n+=1}return t}function w(e){let t=new Set,n=0,r=null,i=e=>{r||=e},a=t=>{for(;n<e.length;){let r=e[n];if(r===`{`)n+=1,s(t+1);else if(r===`}`)if(t===0)i(`Unbalanced braces: unexpected "}"`),n+=1;else return;else n+=1}t>0&&i(`Unbalanced braces: missing "}"`)},o=t=>{let r=``;for(;n<e.length&&!t.includes(e[n]);)r+=e[n],n+=1;return r},s=r=>{let s=o([`,`,`}`]).trim();if(s&&!s.includes(`{`)&&t.add(s),n>=e.length){i(`Unbalanced braces: missing "}"`);return}if(e[n]===`}`){n+=1;return}n+=1;let c=o([`,`,`}`]).trim();if(n>=e.length){i(`Unbalanced braces: missing "}"`);return}if(e[n]===`}`){n+=1;return}if(n+=1,S.has(c)){let t=!1;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n+=1;if(e[n]===`}`){n+=1,t||i(`"${s}" (${c}) has no "other" branch`);return}let l=o([`{`,`}`,` `,` `,`
|
|
9
|
-
`]).trim();for(;n<e.length&&/\s/.test(e[n]);)n+=1;if(e[n]!==`{`){i(`"${s}" (${c}): expected "{" after "${l}"`);return}l===`other`&&(t=!0),n+=1,a(r+1),e[n]===`}`&&(n+=1)}i(`Unbalanced braces: missing "}"`);return}let l=1;for(;n<e.length&&l>0;)e[n]===`{`?l+=1:e[n]===`}`&&--l,n+=1;l>0&&i(`Unbalanced braces: missing "}"`)};return a(0),{args:t,error:r}}var T=/\{\{\s*([^{}]*?)\s*\}\}/g,ee=/\$t\([^)]*\)/g,te=/%(?:\d+\$)?[-+ 0#]*\d*(?:\.\d+)?[sdifgxXoc]/g,ne=/<\/?([A-Za-z][\w-]*|\d+)\b[^<>]*>/g;function re(e){if(typeof e!=`string`||e===``)return[];let t=new Set,n=e.replace(T,(e,n)=>{let r=n.split(`,`)[0].trim();return r&&t.add(`{{${r}}}`),` `});for(let e of n.match(ee)??[])t.add(e);for(let e of n.replace(/%%/g,``).match(te)??[])t.add(e);for(let e of n.matchAll(ne))t.add(`<${e[1]}>`);let r=w(C(n.replace(ne,` `)));for(let e of r.args)t.add(`{${e}}`);return Array.from(t).sort()}var ie=[`zero`,`one`,`two`,`few`,`many`,`other`];function ae(e,t){if(e[t+1]===`'`)return t+2;let n=e[t+1];if(n!==`{`&&n!==`}`&&n!==`#`&&n!==`|`)return t+1;let r=t+1;for(;r<e.length;){if(e[r]===`'`){if(e[r+1]===`'`){r+=2;continue}return r+1}r+=1}return e.length}function E(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`){r=ae(e,r);continue}if(t===`{`)n+=1;else if(t===`}`&&(--n,n===0))return r;r+=1}return-1}function oe(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`'`){n=ae(e,n);continue}if(r===`}`)return null;if(r===`{`){let r=E(e,n);if(r===-1)return null;t.push({start:n,end:r}),n=r+1;continue}n+=1}return t}var D=/^\s*([\w.]+)\s*,\s*(plural|select|selectordinal)\s*,/;function O(e){if(typeof e!=`string`)return null;let t=oe(e);if(!t)return null;let n=t.filter(t=>D.test(e.slice(t.start+1,t.end)));if(n.length!==1)return null;let{start:r,end:i}=n[0],a=e.slice(r+1,i),o=D.exec(a),s=o[1],c=o[2],l=o[0].length,u=null,d=[];for(;l<a.length;){for(;l<a.length&&/\s/.test(a[l]);)l+=1;if(l>=a.length)break;let e=``;for(;l<a.length&&!/[\s{]/.test(a[l]);)e+=a[l],l+=1;if(e.startsWith(`offset:`)){let t=e.slice(7);for(;l<a.length&&/\s/.test(a[l]);)l+=1;if(t===``)for(;l<a.length&&/\d/.test(a[l]);)t+=a[l],l+=1;u=t||null;continue}for(;l<a.length&&/\s/.test(a[l]);)l+=1;if(!e||a[l]!==`{`)return null;let t=E(a,l);if(t===-1)return null;d.push({selector:e,text:a.slice(l+1,t)}),l=t+1}return d.length===0?null:{variable:s,type:c,offset:u,prefix:e.slice(0,r),suffix:e.slice(i+1),branches:d}}function se(e){let t=[];e.offset&&t.push(` offset:${e.offset}`);for(let n of e.branches)n.text===``&&n.selector!==`other`||t.push(` ${n.selector} {${n.text}}`);return`${e.prefix}{${e.variable}, ${e.type},${t.join(``)}}${e.suffix}`}function ce(e,t=`plural`){if(t===`select`)return[];try{let n=new Intl.PluralRules(e,{type:t===`selectordinal`?`ordinal`:`cardinal`}),r=new Set(n.resolvedOptions().pluralCategories);return ie.filter(e=>r.has(e))}catch{return[`one`,`other`]}}var le={zero:`zero (e.g. 0)`,one:`one (singular)`,two:`two (dual)`,few:`few (small numbers)`,many:`many (large numbers)`,other:`other (default, required)`},k=({locale:e,value:t,onChange:n,disabled:r})=>{let i=(0,g.useMemo)(()=>O(t),[t]),a=(0,g.useMemo)(()=>{if(!i)return[];let t=new Map(i.branches.map(e=>[e.selector,e.text])),n=ce(e,i.type);return[...i.branches.map(e=>e.selector).filter(e=>!n.includes(e)),...n].map(e=>({selector:e,text:t.get(e)??``,required:n.includes(e)}))},[i,e]);if(!i)return null;let o=(e,t)=>{n(se({...i,...e,branches:t??i.branches}))},s=(e,t)=>{o({},a.map(n=>({selector:n.selector,text:n.selector===e?t:n.text})))},c=`w-full bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-lg px-3 py-2 text-xs text-slate-100 placeholder-slate-600 transition duration-150 disabled:opacity-60`;return(0,y.jsxs)(`div`,{className:`space-y-3`,"data-testid":`plural-editor`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsxs)(`span`,{className:`text-[10px] text-slate-500 font-mono`,children:[i.type,` on `,(0,y.jsx)(`span`,{className:`text-indigo-400`,children:i.variable}),i.offset?` · offset ${i.offset}`:``]}),(0,y.jsxs)(`span`,{className:`text-[10px] text-slate-600`,children:[(0,y.jsx)(`code`,{className:`font-mono`,children:`#`}),` = the number`]})]}),i.prefix!==``&&(0,y.jsxs)(`label`,{className:`block space-y-1`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold text-slate-500 uppercase tracking-wider`,children:`Before`}),(0,y.jsx)(`input`,{"data-testid":`plural-prefix`,dir:`auto`,value:i.prefix,disabled:r,onChange:e=>o({prefix:e.target.value}),className:c})]}),(0,y.jsx)(`div`,{className:`space-y-2`,children:a.map(t=>(0,y.jsxs)(`label`,{className:`block space-y-1`,children:[(0,y.jsxs)(`span`,{className:`flex items-center gap-2 text-[10px] font-mono`,children:[(0,y.jsx)(`span`,{className:`text-slate-300`,children:t.selector}),(0,y.jsx)(`span`,{className:`text-slate-600`,children:le[t.selector]??`explicit case`}),t.required&&t.text===``&&t.selector!==`other`&&(0,y.jsxs)(`span`,{className:`text-amber-400`,children:[`needed for `,e]})]}),(0,y.jsx)(`input`,{"data-testid":`plural-branch-${t.selector}`,dir:`auto`,value:t.text,disabled:r,onChange:e=>s(t.selector,e.target.value),className:c})]},t.selector))}),i.suffix!==``&&(0,y.jsxs)(`label`,{className:`block space-y-1`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold text-slate-500 uppercase tracking-wider`,children:`After`}),(0,y.jsx)(`input`,{"data-testid":`plural-suffix`,dir:`auto`,value:i.suffix,disabled:r,onChange:e=>o({suffix:e.target.value}),className:c})]})]})},ue={present:`bg-slate-800/80 border-slate-700 text-slate-300`,missing:`bg-rose-500/10 border-rose-500/40 text-rose-300 line-through`,extra:`bg-amber-500/10 border-amber-500/40 text-amber-300`},de={present:`Placeholder from the reference, present in your translation`,missing:`Placeholder from the reference is missing from your translation`,extra:`Placeholder not present in the reference`},fe=({selected:e,inputValue:t,locale:n=`en`,isLoading:r,isSuccess:i,error:a,saveWarning:o,onInputChange:s,onSave:c,onForceSave:l,onDismissWarning:u,onClear:d})=>{let[f,p]=(0,g.useState)(!1),m=(0,g.useMemo)(()=>O(t)!==null,[t]),h=m&&!f,_=(0,g.useMemo)(()=>{let n=new Set(re(e.fallbackValue||``)),r=new Set(re(t)),i=[];for(let e of n)i.push({token:e,state:r.has(e)?`present`:`missing`});for(let e of r)n.has(e)||i.push({token:e,state:`extra`});return i},[e.fallbackValue,t]);return(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col p-6 overflow-y-auto space-y-6`,children:[(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Translation Key`}),(0,y.jsx)(`button`,{onClick:d,className:`text-[10px] font-medium text-slate-500 hover:text-slate-300 transition duration-200`,children:`Clear Selection`})]}),(0,y.jsx)(`div`,{className:`bg-slate-950 border border-slate-800/80 rounded-xl px-4 py-3 font-mono text-xs text-indigo-400 select-all break-all shadow-inner leading-relaxed`,children:e.key})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Reference (Fallback Value)`}),(0,y.jsx)(`div`,{dir:`auto`,className:`bg-slate-950/40 border border-slate-850 rounded-xl px-4 py-3 text-sm text-slate-400 select-all leading-relaxed whitespace-pre-wrap`,children:e.fallbackValue||(0,y.jsx)(`span`,{className:`italic text-slate-600`,children:`None`})})]}),_.length>0&&(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Placeholders`}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(({token:e,state:t})=>(0,y.jsx)(`span`,{"data-testid":`placeholder-${e}`,"data-state":t,title:de[t],className:`px-2 py-0.5 rounded-md border text-[10px] font-mono ${ue[t]}`,children:e},e))})]}),(0,y.jsxs)(`div`,{className:`space-y-2 flex-1 flex flex-col min-h-[180px]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:h?`Plural forms`:`Translation Output`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m&&(0,y.jsx)(`button`,{type:`button`,"data-testid":`plural-raw-toggle`,onClick:()=>p(e=>!e),className:`text-[10px] font-semibold text-slate-500 hover:text-slate-300 transition duration-150`,children:f?`Edit forms`:`Edit raw`}),(0,y.jsxs)(`span`,{className:`text-[10px] text-slate-500 font-mono`,children:[t.length,`/10000`]})]})]}),h?(0,y.jsx)(k,{locale:n,value:t,onChange:s,disabled:r}):(0,y.jsx)(`textarea`,{id:`studio-translation-input`,dir:`auto`,value:t,onChange:e=>s(e.target.value),disabled:r,placeholder:`Type your translation here...`,className:`w-full min-h-32 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-xl px-4 py-3 text-sm text-slate-100 placeholder-slate-600 font-sans resize-none transition duration-205 shadow-inner leading-relaxed`})]}),o&&(0,y.jsxs)(`div`,{"data-testid":`save-warning`,className:`bg-amber-500/10 border border-amber-500/30 rounded-xl p-3 space-y-3`,children:[(0,y.jsx)(`div`,{className:`text-xs text-amber-200 leading-relaxed`,children:o.message}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`button`,{onClick:l,disabled:r,className:`h-8 px-3 rounded-lg text-[11px] font-semibold text-white bg-amber-600 hover:bg-amber-500 active:bg-amber-700 transition duration-150`,children:`Save anyway`}),(0,y.jsx)(`button`,{onClick:u,className:`h-8 px-3 rounded-lg text-[11px] font-semibold text-slate-300 bg-slate-800 border border-slate-700 hover:border-slate-600 transition duration-150`,children:`Keep editing`})]})]}),a&&(0,y.jsxs)(`div`,{className:`bg-rose-500/10 border border-rose-500/20 rounded-xl p-3 flex items-start gap-[0.625rem] shadow-xs`,children:[(0,y.jsx)(`svg`,{className:`w-4 h-4 text-rose-500 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,y.jsx)(`div`,{className:`text-xs text-rose-400 font-mono leading-normal break-all`,children:a})]}),(0,y.jsx)(`div`,{className:`flex items-center gap-3 pt-4 shrink-0`,children:(0,y.jsx)(`button`,{id:`studio-save-button`,onClick:c,disabled:r||t===e.currentValue,className:`flex-1 h-11 rounded-xl text-sm font-semibold tracking-wide flex items-center justify-center gap-2 shadow-sm transition duration-205 ${t===e.currentValue?`bg-slate-800 text-slate-500 cursor-not-allowed shadow-none border border-slate-850`:`bg-indigo-600 hover:bg-indigo-500 text-white active:bg-indigo-700`}`,children:r?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`svg`,{className:`animate-spin h-4 w-4 text-indigo-200`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,y.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}),(0,y.jsx)(`span`,{children:`Saving...`})]}):i?(0,y.jsxs)(`span`,{"data-testid":`save-success`,className:`flex items-center gap-1 text-emerald-400 font-bold`,children:[(0,y.jsx)(`svg`,{className:`w-4 h-4 text-emerald-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}),(0,y.jsx)(`span`,{children:`Saved!`})]}):(0,y.jsx)(`span`,{children:`Save Changes`})})})]})},pe=()=>(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-6 text-center select-none`,children:[(0,y.jsx)(`div`,{className:`w-16 h-16 rounded-2xl bg-indigo-500/5 border border-indigo-500/10 flex items-center justify-center text-indigo-400 shadow-xs mb-6`,children:(0,y.jsx)(`svg`,{className:`w-8 h-8 text-indigo-500`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,d:`M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122`})})}),(0,y.jsx)(`h3`,{className:`text-slate-200 font-semibold tracking-wide font-outfit`,children:`Select an Element`}),(0,y.jsx)(`p`,{className:`text-xs text-slate-500 max-w-xs mt-2 leading-relaxed`,children:`Hover over elements in the live preview iframe and click to load them into the visual editing sidebar.`})]}),me=/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,4})?$/;function he(e){return typeof e==`string`&&e.length>=2&&e.length<=10&&me.test(e)}var ge=({code:e,isActive:t,isLoading:n,allLocales:r,onRename:i,onDelete:a})=>{let[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(e),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(null);return(0,y.jsx)(`div`,{className:`bg-slate-950/40 border border-slate-850 hover:border-slate-800/80 rounded-xl px-4 py-3 flex items-center justify-between gap-4 transition duration-200`,children:o?(0,y.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,y.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),disabled:n,className:`flex-1 bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs font-mono text-slate-100 focus:outline-hidden focus:border-indigo-500`,autoFocus:!0}),(0,y.jsx)(`button`,{onClick:async()=>{p(null);let t=c.trim();if(!t||t===e){s(!1);return}if(!he(t)){p(`Invalid locale format.`);return}if(r.includes(t)&&t!==e){p(`Target locale already exists.`);return}try{await i(e,t),s(!1)}catch(e){p(e.message||`Failed to rename.`)}},disabled:n,className:`p-1 text-emerald-400 hover:text-emerald-300 transition duration-150`,title:`Save rename`,children:(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M5 13l4 4L19 7`})})}),(0,y.jsx)(`button`,{onClick:()=>s(!1),disabled:n,className:`p-1 text-slate-500 hover:text-slate-400 transition duration-150`,title:`Cancel`,children:(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M6 18L18 6M6 6l12 12`})})})]}):u?(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold text-rose-400`,children:`Confirm deletion? This deletes the translation file.`}),f&&(0,y.jsx)(`span`,{className:`text-[10px] text-rose-400 font-mono`,children:f}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[(0,y.jsx)(`button`,{onClick:()=>d(!1),disabled:n,className:`px-2.5 py-1 text-[10px] font-semibold bg-slate-800 hover:bg-slate-750 text-slate-300 rounded-lg transition`,children:`Cancel`}),(0,y.jsx)(`button`,{onClick:async()=>{p(null);try{await a(e),d(!1)}catch(e){p(e.message||`Failed to delete.`)}},disabled:n,className:`px-2.5 py-1 text-[10px] font-semibold bg-rose-600 hover:bg-rose-500 text-white rounded-lg transition shadow-sm shadow-rose-600/10`,children:`Delete`})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,y.jsx)(`span`,{className:`text-xs font-semibold text-slate-200 truncate`,children:e}),t&&(0,y.jsx)(`span`,{className:`text-[9px] text-indigo-400 font-bold tracking-wide mt-0.5`,children:`ACTIVE WORKSPACE`}),f&&(0,y.jsx)(`span`,{className:`text-[10px] text-rose-400 font-mono mt-0.5`,children:f})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,y.jsx)(`button`,{onClick:()=>{l(e),p(null),s(!0)},disabled:n,className:`p-1.5 text-slate-500 hover:text-slate-300 transition duration-150`,title:`Rename locale code`,children:(0,y.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z`})})}),(0,y.jsx)(`button`,{onClick:()=>{p(null),d(!0)},disabled:n,className:`p-1.5 text-slate-500 hover:text-rose-400 transition duration-150`,title:`Delete locale`,children:(0,y.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})})]})]})})},_e=({locale:e,locales:t,isLoading:n,error:r,onAddLocale:i,onRenameLocale:a,onDeleteLocale:o})=>{let[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(null);return(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col p-6 overflow-y-auto space-y-6`,children:[(0,y.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),u(null);let n=s.trim();if(n){if(!he(n)){u(`Locale format must be 2-3 letters, optionally followed by a region (e.g., fr or es-MX).`);return}if(t.includes(n)){u(`Locale already exists.`);return}try{await i(n),c(``)}catch(e){u(e.message||`Failed to add locale.`)}}},className:`space-y-2.5`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Add New Locale`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g. fr, es-MX`,disabled:n,className:`flex-1 min-w-0 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-600 font-mono transition duration-155`}),(0,y.jsx)(`button`,{type:`submit`,disabled:n||!s.trim(),className:`h-10 px-4 bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-800 disabled:text-slate-500 text-white text-xs font-semibold rounded-xl transition duration-155 flex items-center justify-center gap-1.5 shrink-0`,children:`Add`})]})]}),(l||r)&&(0,y.jsxs)(`div`,{className:`bg-rose-500/10 border border-rose-500/20 rounded-xl p-3 flex items-start gap-[0.625rem] shadow-xs`,children:[(0,y.jsx)(`svg`,{className:`w-4 h-4 text-rose-500 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,y.jsx)(`div`,{className:`text-xs text-rose-400 font-mono leading-normal break-all`,children:l||r})]}),(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col space-y-2`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-1`,children:`Active Locales`}),(0,y.jsx)(`div`,{className:`flex-1 overflow-y-auto space-y-2 pr-1 select-none`,children:t.map(r=>(0,y.jsx)(ge,{code:r,isActive:r===e,isLoading:n,allLocales:t,onRename:a,onDelete:o},r))})]})]})},ve={en:`English`,ar:`Arabic`,es:`Spanish`,fr:`French`,de:`German`,zh:`Chinese`,ja:`Japanese`,pt:`Portuguese`,it:`Italian`,ru:`Russian`,hi:`Hindi`,tr:`Turkish`},ye=e=>`${ve[e.split(`-`)[0]?.toLowerCase()||e]||ve[e]||`Custom`} (${e})`,be=({selected:e,inputValue:t,locale:n,isLoading:r,isSuccess:i,error:a,saveWarning:o,onInputChange:s,onLocaleChange:c,onSave:l,onForceSave:u,onDismissWarning:d,onClear:f,locales:p,onAddLocale:m,onRenameLocale:h,onDeleteLocale:_})=>{let[v,b]=(0,g.useState)(!1);return(0,y.jsxs)(`div`,{className:`w-[420px] bg-slate-900 border border-slate-800 rounded-2xl flex flex-col h-full shadow-2xl overflow-hidden shrink-0`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-outfit text-slate-200`,children:v?`Manage Languages`:`Translation Studio`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!v&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`label`,{className:`text-[10px] font-semibold text-slate-500 uppercase tracking-wider`,children:`Locale`}),(0,y.jsx)(`select`,{value:n,onChange:e=>c(e.target.value),className:`bg-slate-900 border border-slate-800 hover:border-slate-700 text-slate-300 text-xs rounded-lg px-2.5 py-1.5 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 cursor-pointer font-mono`,children:p.map(e=>(0,y.jsx)(`option`,{value:e,children:ye(e)},e))})]}),(0,y.jsx)(`button`,{onClick:()=>b(!v),className:`p-1.5 rounded-lg border transition duration-200 ${v?`bg-indigo-600/20 border-indigo-500 text-indigo-400`:`bg-slate-900 border-slate-800 text-slate-400 hover:text-slate-200 hover:border-slate-700`}`,title:v?`Back to Editor`:`Manage Languages`,children:v?(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M10 19l-7-7m0 0l7-7m-7 7h18`})}):(0,y.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z`}),(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]})})]})]}),v?(0,y.jsx)(_e,{locale:n,locales:p,isLoading:r,error:a,onAddLocale:m,onRenameLocale:h,onDeleteLocale:_}):e?(0,y.jsx)(fe,{selected:e,inputValue:t,locale:n,isLoading:r,isSuccess:i,error:a,saveWarning:o,onInputChange:s,onSave:l,onForceSave:u,onDismissWarning:d,onClear:f}):(0,y.jsx)(pe,{})]})},xe=({coveragePercentage:e,mode:t,changesCount:n,isChangesOpen:r,onToggleChanges:i})=>(0,y.jsxs)(`header`,{className:`h-16 bg-[#080b11]/90 backdrop-blur-md border-b border-slate-900/60 px-8 flex items-center justify-between shrink-0 select-none`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`w-8 h-8 rounded-xl bg-linear-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20`,children:(0,y.jsxs)(`svg`,{className:`w-4 h-4 text-white`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z`})]})}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h1`,{className:`text-base font-extrabold tracking-wide font-outfit bg-linear-to-r from-slate-100 to-slate-300 bg-clip-text text-transparent`,children:`LiveLocale`}),(0,y.jsx)(`p`,{className:`text-[10px] text-slate-500 font-medium tracking-wider uppercase mt-0.5`,children:`Live Visual Translation Studio`})]})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2.5`,title:`${e}% of keys translated`,children:[(0,y.jsx)(`span`,{className:`text-[10px] text-slate-500 font-medium select-none whitespace-nowrap`,children:`Coverage`}),(0,y.jsx)(`div`,{className:`w-28 h-1.5 bg-slate-800 rounded-full overflow-hidden`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full transition-all duration-700 ease-out`,style:{width:`${e}%`,background:e>=80?`linear-gradient(90deg, #34d399, #059669)`:e>=40?`linear-gradient(90deg, #fbbf24, #f59e0b)`:`linear-gradient(90deg, #f87171, #ef4444)`}})}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono text-slate-400 select-none tabular-nums`,children:[e,`%`]})]}),t===`preview`&&(0,y.jsx)(`span`,{className:`px-2.5 py-1 rounded-full bg-amber-500/10 border border-amber-500/30 text-[10px] font-extrabold tracking-wider text-amber-300 select-none`,title:`Edits go to a git branch on the server; nothing is written locally.`,children:`PREVIEW`}),(0,y.jsxs)(`button`,{id:`studio-changes-button`,onClick:i,className:`flex items-center gap-2 px-3 py-1.5 rounded-xl border text-[11px] font-semibold transition duration-150 ${r?`bg-indigo-600/20 border-indigo-500 text-indigo-300`:`bg-slate-900 border-slate-800 text-slate-300 hover:text-slate-100 hover:border-slate-700`}`,title:`Review, commit, or undo locale changes`,children:[(0,y.jsxs)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,y.jsx)(`path`,{d:`M12 3v6M12 15v6`})]}),`Changes`,n>0&&(0,y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-md bg-amber-500/15 border border-amber-500/30 text-[10px] font-mono font-bold text-amber-300`,children:n})]}),(0,y.jsxs)(`span`,{className:`px-3 py-1 rounded-full bg-slate-900 border border-slate-800 text-[10px] font-bold text-slate-400 select-none`,children:[`v`,`0.8.0`,` (BETA)`]})]})]}),Se=({showConfirmModal:e,onConfirm:t,onCancel:n})=>e?(0,y.jsx)(`div`,{className:`fixed inset-0 z-50 bg-slate-950/80 backdrop-blur-sm flex items-center justify-center p-4`,children:(0,y.jsxs)(`div`,{className:`bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200`,children:[(0,y.jsx)(`h3`,{className:`text-base font-bold text-slate-200 font-outfit`,children:`Unsaved Changes`}),(0,y.jsx)(`p`,{className:`text-xs text-slate-400 mt-2 leading-relaxed`,children:`You have unsaved edits in your translation. Selecting another element will discard these modifications. Do you want to discard your edits?`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,y.jsx)(`button`,{onClick:n,className:`px-4 py-2 text-xs font-semibold text-slate-400 hover:text-slate-200 bg-slate-800 hover:bg-slate-750 border border-slate-850 hover:border-slate-700 rounded-xl transition duration-150`,children:`Keep Editing`}),(0,y.jsx)(`button`,{onClick:t,className:`px-4 py-2 text-xs font-semibold text-white bg-rose-600 hover:bg-rose-500 rounded-xl shadow-lg shadow-rose-600/10 active:bg-rose-700 transition duration-150`,children:`Discard Edits`})]})]})}):null,Ce=({filteredKeys:e,selected:t,localeData:n,searchTerm:r,setSearchTerm:i,filterPageOnly:a,setFilterPageOnly:o,visibleKeys:s,selectKeyDirectly:c})=>(0,y.jsxs)(`div`,{className:`w-[300px] bg-slate-900 border border-slate-800 rounded-2xl flex flex-col h-full shadow-2xl overflow-hidden shrink-0`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-outfit text-slate-200`,children:`Locale Directory`}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-slate-900 text-indigo-400 border border-slate-850`,children:[e.length,` keys`]})]}),(0,y.jsxs)(`div`,{className:`p-4 border-b border-slate-800/80 shrink-0 bg-slate-900/40 space-y-3`,children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`Search keys or values...`,className:`w-full h-9 pl-9 pr-4 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-lg text-xs text-slate-200 placeholder-slate-600 transition duration-150`}),(0,y.jsx)(`svg`,{className:`w-3.5 h-3.5 text-slate-600 absolute left-3 top-2.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`span`,{className:`text-[10px] text-slate-500 font-semibold uppercase tracking-wider`,children:`Scope`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1 bg-slate-950 border border-slate-850 rounded-lg p-0.5 select-none shrink-0`,children:[(0,y.jsx)(`button`,{onClick:()=>o(!1),className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition duration-150 ${a?`text-slate-500 hover:text-slate-300`:`bg-indigo-600 text-white shadow-sm`}`,children:`All Keys`}),(0,y.jsx)(`button`,{onClick:()=>o(!0),disabled:s===null,className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition duration-150 ${a?`bg-indigo-600 text-white shadow-sm`:`text-slate-500 hover:text-slate-300 disabled:opacity-40 disabled:cursor-not-allowed`}`,title:s===null?`Waiting for preview connection...`:`Only show keys on the current page`,children:`Page Keys`})]})]})]}),(0,y.jsx)(`div`,{className:`flex-1 overflow-y-auto p-3 space-y-1 scrollbar-thin`,children:e.length>0?e.map(e=>{let r=t?.key===e,i=n[e]||``,a=n[e]===void 0;return(0,y.jsxs)(`button`,{onClick:()=>c(e),className:`w-full text-left p-3 rounded-xl border transition duration-150 flex flex-col gap-1.5 ${r?`bg-indigo-600/10 border-indigo-500 text-slate-100 shadow-sm`:`bg-slate-950/20 hover:bg-slate-950/50 border-transparent text-slate-300 hover:text-slate-200`}`,children:[(0,y.jsxs)(`div`,{className:`w-full flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold font-mono break-all line-clamp-2 leading-relaxed text-indigo-400`,children:e}),a&&(0,y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-rose-500/10 text-[8px] font-extrabold text-rose-400 border border-rose-500/20 shrink-0 uppercase tracking-wider`,children:`Missing`})]}),(0,y.jsx)(`span`,{dir:`auto`,className:`text-[10px] text-slate-500 break-all line-clamp-1`,children:i||(0,y.jsx)(`span`,{className:`italic text-slate-750`,children:`Empty`})})]},e)}):(0,y.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center p-6 text-center text-slate-600 select-none`,children:[(0,y.jsx)(`svg`,{className:`w-8 h-8 text-slate-700 mb-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`})}),(0,y.jsx)(`span`,{className:`text-xs`,children:`No keys found`})]})})]}),we={modified:`text-amber-400 border-amber-500/30 bg-amber-500/10`,added:`text-emerald-400 border-emerald-500/30 bg-emerald-500/10`,deleted:`text-rose-400 border-rose-500/30 bg-rose-500/10`,renamed:`text-sky-400 border-sky-500/30 bg-sky-500/10`},Te=e=>e.startsWith(`+++`)||e.startsWith(`---`)?`text-slate-500`:e.startsWith(`@@`)?`text-indigo-400`:e.startsWith(`diff `)||e.startsWith(`new file`)?`text-slate-600`:e.startsWith(`+`)?`text-emerald-300 bg-emerald-500/10`:e.startsWith(`-`)?`text-rose-300 bg-rose-500/10`:`text-slate-400`,Ee=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),De=({isOpen:e,onClose:t,git:n,gitError:r,isGitLoading:i,lastCommit:a,onCommit:o,onDiscard:s,onRefresh:c,history:l,onUndo:u,isUndoing:d})=>{let[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(!1);if(!e)return null;let b=n?.changes??[],x=n?.mode===`github`,S=!!n?.isRepo&&b.length>0&&f.trim().length>0;return(0,y.jsxs)(`div`,{className:`fixed inset-0 top-16 z-40 flex justify-end`,"data-testid":`changes-panel`,children:[(0,y.jsx)(`div`,{className:`absolute inset-0 bg-slate-950/60 backdrop-blur-[2px]`,onClick:t}),(0,y.jsxs)(`aside`,{className:`relative w-[520px] max-w-full h-full bg-slate-900 border-l border-slate-800 shadow-2xl flex flex-col animate-in slide-in-from-right duration-200`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-outfit text-slate-200`,children:`Changes`}),n?.isRepo&&n.branch&&(0,y.jsx)(`span`,{className:`px-2 py-0.5 rounded-md bg-slate-900 border border-slate-800 text-[10px] font-mono text-indigo-400`,children:n.branch})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`button`,{onClick:c,className:`p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 border border-transparent hover:border-slate-700 transition duration-150`,title:`Refresh`,children:(0,y.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,y.jsx)(`path`,{d:`M21 3v5h-5`})]})}),(0,y.jsx)(`button`,{onClick:t,className:`p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 border border-transparent hover:border-slate-700 transition duration-150`,title:`Close`,children:(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})})})]})]}),(0,y.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6`,children:[(0,y.jsxs)(`section`,{className:`space-y-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Locale files`}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-slate-950 text-indigo-400 border border-slate-850`,children:[b.length,` changed`]})]}),n===null?(0,y.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Loading git status…`}):n.available?n.isRepo?b.length===0?(0,y.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Working tree is clean. Edits you save will show up here.`}):(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:b.map(e=>(0,y.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2 rounded-xl bg-slate-950/40 border border-slate-800/80`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-mono text-slate-300 break-all`,children:e.path}),(0,y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[9px] font-extrabold uppercase tracking-wider border shrink-0 ${we[e.status]??we.modified}`,children:e.status})]},e.path))}):(0,y.jsxs)(`p`,{className:`text-xs text-slate-500 leading-relaxed`,children:[`The locales directory is not inside a git repository, or the`,` `,(0,y.jsx)(`code`,{className:`font-mono text-slate-400`,children:`git`}),` command is not on PATH.`]}):(0,y.jsxs)(`p`,{className:`text-xs text-slate-500 leading-relaxed`,children:[`Git integration is disabled for this handler. Enable it by removing`,` `,(0,y.jsx)(`code`,{className:`font-mono text-slate-400`,children:`git: false`}),` from the route configuration.`]}),n?.isRepo&&b.length>0&&(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`button`,{onClick:()=>v(e=>!e),className:`text-[10px] font-semibold text-slate-500 hover:text-slate-300 transition duration-150`,children:_?`Hide diff`:`Show diff`}),_&&(0,y.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-xl bg-slate-950 border border-slate-800 p-3 text-[10px] font-mono leading-relaxed whitespace-pre`,children:n.diff.split(`
|
|
9
|
+
`]).trim();for(;n<e.length&&/\s/.test(e[n]);)n+=1;if(e[n]!==`{`){i(`"${s}" (${c}): expected "{" after "${l}"`);return}l===`other`&&(t=!0),n+=1,a(r+1),e[n]===`}`&&(n+=1)}i(`Unbalanced braces: missing "}"`);return}let l=1;for(;n<e.length&&l>0;)e[n]===`{`?l+=1:e[n]===`}`&&--l,n+=1;l>0&&i(`Unbalanced braces: missing "}"`)};return a(0),{args:t,error:r}}var T=/\{\{\s*([^{}]*?)\s*\}\}/g,ee=/\$t\([^)]*\)/g,te=/%(?:\d+\$)?[-+ 0#]*\d*(?:\.\d+)?[sdifgxXoc]/g,ne=/<\/?([A-Za-z][\w-]*|\d+)\b[^<>]*>/g;function re(e){if(typeof e!=`string`||e===``)return[];let t=new Set,n=e.replace(T,(e,n)=>{let r=n.split(`,`)[0].trim();return r&&t.add(`{{${r}}}`),` `});for(let e of n.match(ee)??[])t.add(e);for(let e of n.replace(/%%/g,``).match(te)??[])t.add(e);for(let e of n.matchAll(ne))t.add(`<${e[1]}>`);let r=w(C(n.replace(ne,` `)));for(let e of r.args)t.add(`{${e}}`);return Array.from(t).sort()}var ie=[`zero`,`one`,`two`,`few`,`many`,`other`];function ae(e,t){if(e[t+1]===`'`)return t+2;let n=e[t+1];if(n!==`{`&&n!==`}`&&n!==`#`&&n!==`|`)return t+1;let r=t+1;for(;r<e.length;){if(e[r]===`'`){if(e[r+1]===`'`){r+=2;continue}return r+1}r+=1}return e.length}function E(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`){r=ae(e,r);continue}if(t===`{`)n+=1;else if(t===`}`&&(--n,n===0))return r;r+=1}return-1}function oe(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`'`){n=ae(e,n);continue}if(r===`}`)return null;if(r===`{`){let r=E(e,n);if(r===-1)return null;t.push({start:n,end:r}),n=r+1;continue}n+=1}return t}var D=/^\s*([\w.]+)\s*,\s*(plural|select|selectordinal)\s*,/;function O(e){if(typeof e!=`string`)return null;let t=oe(e);if(!t)return null;let n=t.filter(t=>D.test(e.slice(t.start+1,t.end)));if(n.length!==1)return null;let{start:r,end:i}=n[0],a=e.slice(r+1,i),o=D.exec(a),s=o[1],c=o[2],l=o[0].length,u=null,d=[];for(;l<a.length;){for(;l<a.length&&/\s/.test(a[l]);)l+=1;if(l>=a.length)break;let e=``;for(;l<a.length&&!/[\s{]/.test(a[l]);)e+=a[l],l+=1;if(e.startsWith(`offset:`)){let t=e.slice(7);for(;l<a.length&&/\s/.test(a[l]);)l+=1;if(t===``)for(;l<a.length&&/\d/.test(a[l]);)t+=a[l],l+=1;u=t||null;continue}for(;l<a.length&&/\s/.test(a[l]);)l+=1;if(!e||a[l]!==`{`)return null;let t=E(a,l);if(t===-1)return null;d.push({selector:e,text:a.slice(l+1,t)}),l=t+1}return d.length===0?null:{variable:s,type:c,offset:u,prefix:e.slice(0,r),suffix:e.slice(i+1),branches:d}}function se(e){let t=[];e.offset&&t.push(` offset:${e.offset}`);for(let n of e.branches)n.text===``&&n.selector!==`other`||t.push(` ${n.selector} {${n.text}}`);return`${e.prefix}{${e.variable}, ${e.type},${t.join(``)}}${e.suffix}`}function ce(e,t=`plural`){if(t===`select`)return[];try{let n=new Intl.PluralRules(e,{type:t===`selectordinal`?`ordinal`:`cardinal`}),r=new Set(n.resolvedOptions().pluralCategories);return ie.filter(e=>r.has(e))}catch{return[`one`,`other`]}}var le={zero:`zero (e.g. 0)`,one:`one (singular)`,two:`two (dual)`,few:`few (small numbers)`,many:`many (large numbers)`,other:`other (default, required)`},k=({locale:e,value:t,onChange:n,disabled:r})=>{let i=(0,g.useMemo)(()=>O(t),[t]),a=(0,g.useMemo)(()=>{if(!i)return[];let t=new Map(i.branches.map(e=>[e.selector,e.text])),n=ce(e,i.type);return[...i.branches.map(e=>e.selector).filter(e=>!n.includes(e)),...n].map(e=>({selector:e,text:t.get(e)??``,required:n.includes(e)}))},[i,e]);if(!i)return null;let o=(e,t)=>{n(se({...i,...e,branches:t??i.branches}))},s=(e,t)=>{o({},a.map(n=>({selector:n.selector,text:n.selector===e?t:n.text})))},c=`w-full bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-lg px-3 py-2 text-xs text-slate-100 placeholder-slate-600 transition duration-150 disabled:opacity-60`;return(0,y.jsxs)(`div`,{className:`space-y-3`,"data-testid":`plural-editor`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsxs)(`span`,{className:`text-[10px] text-slate-500 font-mono`,children:[i.type,` on `,(0,y.jsx)(`span`,{className:`text-indigo-400`,children:i.variable}),i.offset?` · offset ${i.offset}`:``]}),(0,y.jsxs)(`span`,{className:`text-[10px] text-slate-600`,children:[(0,y.jsx)(`code`,{className:`font-mono`,children:`#`}),` = the number`]})]}),i.prefix!==``&&(0,y.jsxs)(`label`,{className:`block space-y-1`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold text-slate-500 uppercase tracking-wider`,children:`Before`}),(0,y.jsx)(`input`,{"data-testid":`plural-prefix`,dir:`auto`,value:i.prefix,disabled:r,onChange:e=>o({prefix:e.target.value}),className:c})]}),(0,y.jsx)(`div`,{className:`space-y-2`,children:a.map(t=>(0,y.jsxs)(`label`,{className:`block space-y-1`,children:[(0,y.jsxs)(`span`,{className:`flex items-center gap-2 text-[10px] font-mono`,children:[(0,y.jsx)(`span`,{className:`text-slate-300`,children:t.selector}),(0,y.jsx)(`span`,{className:`text-slate-600`,children:le[t.selector]??`explicit case`}),t.required&&t.text===``&&t.selector!==`other`&&(0,y.jsxs)(`span`,{className:`text-amber-400`,children:[`needed for `,e]})]}),(0,y.jsx)(`input`,{"data-testid":`plural-branch-${t.selector}`,dir:`auto`,value:t.text,disabled:r,onChange:e=>s(t.selector,e.target.value),className:c})]},t.selector))}),i.suffix!==``&&(0,y.jsxs)(`label`,{className:`block space-y-1`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold text-slate-500 uppercase tracking-wider`,children:`After`}),(0,y.jsx)(`input`,{"data-testid":`plural-suffix`,dir:`auto`,value:i.suffix,disabled:r,onChange:e=>o({suffix:e.target.value}),className:c})]})]})},ue={present:`bg-slate-800/80 border-slate-700 text-slate-300`,missing:`bg-rose-500/10 border-rose-500/40 text-rose-300 line-through`,extra:`bg-amber-500/10 border-amber-500/40 text-amber-300`},de={present:`Placeholder from the reference, present in your translation`,missing:`Placeholder from the reference is missing from your translation`,extra:`Placeholder not present in the reference`},fe=({selected:e,inputValue:t,locale:n=`en`,isLoading:r,isSuccess:i,error:a,saveWarning:o,onInputChange:s,onSave:c,onForceSave:l,onDismissWarning:u,onClear:d})=>{let[f,p]=(0,g.useState)(!1),m=(0,g.useMemo)(()=>O(t)!==null,[t]),h=m&&!f,_=(0,g.useMemo)(()=>{let n=new Set(re(e.fallbackValue||``)),r=new Set(re(t)),i=[];for(let e of n)i.push({token:e,state:r.has(e)?`present`:`missing`});for(let e of r)n.has(e)||i.push({token:e,state:`extra`});return i},[e.fallbackValue,t]);return(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col p-6 overflow-y-auto space-y-6`,children:[(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Translation Key`}),(0,y.jsx)(`button`,{onClick:d,className:`text-[10px] font-medium text-slate-500 hover:text-slate-300 transition duration-200`,children:`Clear Selection`})]}),(0,y.jsx)(`div`,{className:`bg-slate-950 border border-slate-800/80 rounded-xl px-4 py-3 font-mono text-xs text-indigo-400 select-all break-all shadow-inner leading-relaxed`,children:e.key})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Reference (Fallback Value)`}),(0,y.jsx)(`div`,{dir:`auto`,className:`bg-slate-950/40 border border-slate-850 rounded-xl px-4 py-3 text-sm text-slate-400 select-all leading-relaxed whitespace-pre-wrap`,children:e.fallbackValue||(0,y.jsx)(`span`,{className:`italic text-slate-600`,children:`None`})})]}),_.length>0&&(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Placeholders`}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(({token:e,state:t})=>(0,y.jsx)(`span`,{"data-testid":`placeholder-${e}`,"data-state":t,title:de[t],className:`px-2 py-0.5 rounded-md border text-[10px] font-mono ${ue[t]}`,children:e},e))})]}),(0,y.jsxs)(`div`,{className:`space-y-2 flex-1 flex flex-col min-h-[180px]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:h?`Plural forms`:`Translation Output`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m&&(0,y.jsx)(`button`,{type:`button`,"data-testid":`plural-raw-toggle`,onClick:()=>p(e=>!e),className:`text-[10px] font-semibold text-slate-500 hover:text-slate-300 transition duration-150`,children:f?`Edit forms`:`Edit raw`}),(0,y.jsxs)(`span`,{className:`text-[10px] text-slate-500 font-mono`,children:[t.length,`/10000`]})]})]}),h?(0,y.jsx)(k,{locale:n,value:t,onChange:s,disabled:r}):(0,y.jsx)(`textarea`,{id:`studio-translation-input`,dir:`auto`,value:t,onChange:e=>s(e.target.value),disabled:r,placeholder:`Type your translation here...`,className:`w-full min-h-32 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-xl px-4 py-3 text-sm text-slate-100 placeholder-slate-600 font-sans resize-none transition duration-205 shadow-inner leading-relaxed`})]}),o&&(0,y.jsxs)(`div`,{"data-testid":`save-warning`,className:`bg-amber-500/10 border border-amber-500/30 rounded-xl p-3 space-y-3`,children:[(0,y.jsx)(`div`,{className:`text-xs text-amber-200 leading-relaxed`,children:o.message}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`button`,{onClick:l,disabled:r,className:`h-8 px-3 rounded-lg text-[11px] font-semibold text-white bg-amber-600 hover:bg-amber-500 active:bg-amber-700 transition duration-150`,children:`Save anyway`}),(0,y.jsx)(`button`,{onClick:u,className:`h-8 px-3 rounded-lg text-[11px] font-semibold text-slate-300 bg-slate-800 border border-slate-700 hover:border-slate-600 transition duration-150`,children:`Keep editing`})]})]}),a&&(0,y.jsxs)(`div`,{className:`bg-rose-500/10 border border-rose-500/20 rounded-xl p-3 flex items-start gap-[0.625rem] shadow-xs`,children:[(0,y.jsx)(`svg`,{className:`w-4 h-4 text-rose-500 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,y.jsx)(`div`,{className:`text-xs text-rose-400 font-mono leading-normal break-all`,children:a})]}),(0,y.jsx)(`div`,{className:`flex items-center gap-3 pt-4 shrink-0`,children:(0,y.jsx)(`button`,{id:`studio-save-button`,onClick:c,disabled:r||t===e.currentValue,className:`flex-1 h-11 rounded-xl text-sm font-semibold tracking-wide flex items-center justify-center gap-2 shadow-sm transition duration-205 ${t===e.currentValue?`bg-slate-800 text-slate-500 cursor-not-allowed shadow-none border border-slate-850`:`bg-indigo-600 hover:bg-indigo-500 text-white active:bg-indigo-700`}`,children:r?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`svg`,{className:`animate-spin h-4 w-4 text-indigo-200`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,y.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}),(0,y.jsx)(`span`,{children:`Saving...`})]}):i?(0,y.jsxs)(`span`,{"data-testid":`save-success`,className:`flex items-center gap-1 text-emerald-400 font-bold`,children:[(0,y.jsx)(`svg`,{className:`w-4 h-4 text-emerald-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}),(0,y.jsx)(`span`,{children:`Saved!`})]}):(0,y.jsx)(`span`,{children:`Save Changes`})})})]})},pe=()=>(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-6 text-center select-none`,children:[(0,y.jsx)(`div`,{className:`w-16 h-16 rounded-2xl bg-indigo-500/5 border border-indigo-500/10 flex items-center justify-center text-indigo-400 shadow-xs mb-6`,children:(0,y.jsx)(`svg`,{className:`w-8 h-8 text-indigo-500`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,d:`M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122`})})}),(0,y.jsx)(`h3`,{className:`text-slate-200 font-semibold tracking-wide font-outfit`,children:`Select an Element`}),(0,y.jsx)(`p`,{className:`text-xs text-slate-500 max-w-xs mt-2 leading-relaxed`,children:`Hover over elements in the live preview iframe and click to load them into the visual editing sidebar.`})]}),me=/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,4})?$/;function he(e){return typeof e==`string`&&e.length>=2&&e.length<=10&&me.test(e)}var ge=({code:e,isActive:t,isLoading:n,allLocales:r,onRename:i,onDelete:a})=>{let[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(e),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(null);return(0,y.jsx)(`div`,{className:`bg-slate-950/40 border border-slate-850 hover:border-slate-800/80 rounded-xl px-4 py-3 flex items-center justify-between gap-4 transition duration-200`,children:o?(0,y.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,y.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),disabled:n,className:`flex-1 bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs font-mono text-slate-100 focus:outline-hidden focus:border-indigo-500`,autoFocus:!0}),(0,y.jsx)(`button`,{onClick:async()=>{p(null);let t=c.trim();if(!t||t===e){s(!1);return}if(!he(t)){p(`Invalid locale format.`);return}if(r.includes(t)&&t!==e){p(`Target locale already exists.`);return}try{await i(e,t),s(!1)}catch(e){p(e.message||`Failed to rename.`)}},disabled:n,className:`p-1 text-emerald-400 hover:text-emerald-300 transition duration-150`,title:`Save rename`,children:(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M5 13l4 4L19 7`})})}),(0,y.jsx)(`button`,{onClick:()=>s(!1),disabled:n,className:`p-1 text-slate-500 hover:text-slate-400 transition duration-150`,title:`Cancel`,children:(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M6 18L18 6M6 6l12 12`})})})]}):u?(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold text-rose-400`,children:`Confirm deletion? This deletes the translation file.`}),f&&(0,y.jsx)(`span`,{className:`text-[10px] text-rose-400 font-mono`,children:f}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[(0,y.jsx)(`button`,{onClick:()=>d(!1),disabled:n,className:`px-2.5 py-1 text-[10px] font-semibold bg-slate-800 hover:bg-slate-750 text-slate-300 rounded-lg transition`,children:`Cancel`}),(0,y.jsx)(`button`,{onClick:async()=>{p(null);try{await a(e),d(!1)}catch(e){p(e.message||`Failed to delete.`)}},disabled:n,className:`px-2.5 py-1 text-[10px] font-semibold bg-rose-600 hover:bg-rose-500 text-white rounded-lg transition shadow-sm shadow-rose-600/10`,children:`Delete`})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,y.jsx)(`span`,{className:`text-xs font-semibold text-slate-200 truncate`,children:e}),t&&(0,y.jsx)(`span`,{className:`text-[9px] text-indigo-400 font-bold tracking-wide mt-0.5`,children:`ACTIVE WORKSPACE`}),f&&(0,y.jsx)(`span`,{className:`text-[10px] text-rose-400 font-mono mt-0.5`,children:f})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,y.jsx)(`button`,{onClick:()=>{l(e),p(null),s(!0)},disabled:n,className:`p-1.5 text-slate-500 hover:text-slate-300 transition duration-150`,title:`Rename locale code`,children:(0,y.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z`})})}),(0,y.jsx)(`button`,{onClick:()=>{p(null),d(!0)},disabled:n,className:`p-1.5 text-slate-500 hover:text-rose-400 transition duration-150`,title:`Delete locale`,children:(0,y.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})})]})]})})},_e=({locale:e,locales:t,isLoading:n,error:r,onAddLocale:i,onRenameLocale:a,onDeleteLocale:o})=>{let[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(null);return(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col p-6 overflow-y-auto space-y-6`,children:[(0,y.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),u(null);let n=s.trim();if(n){if(!he(n)){u(`Locale format must be 2-3 letters, optionally followed by a region (e.g., fr or es-MX).`);return}if(t.includes(n)){u(`Locale already exists.`);return}try{await i(n),c(``)}catch(e){u(e.message||`Failed to add locale.`)}}},className:`space-y-2.5`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Add New Locale`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g. fr, es-MX`,disabled:n,className:`flex-1 min-w-0 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-600 font-mono transition duration-155`}),(0,y.jsx)(`button`,{type:`submit`,disabled:n||!s.trim(),className:`h-10 px-4 bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-800 disabled:text-slate-500 text-white text-xs font-semibold rounded-xl transition duration-155 flex items-center justify-center gap-1.5 shrink-0`,children:`Add`})]})]}),(l||r)&&(0,y.jsxs)(`div`,{className:`bg-rose-500/10 border border-rose-500/20 rounded-xl p-3 flex items-start gap-[0.625rem] shadow-xs`,children:[(0,y.jsx)(`svg`,{className:`w-4 h-4 text-rose-500 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,y.jsx)(`div`,{className:`text-xs text-rose-400 font-mono leading-normal break-all`,children:l||r})]}),(0,y.jsxs)(`div`,{className:`flex-1 flex flex-col space-y-2`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-1`,children:`Active Locales`}),(0,y.jsx)(`div`,{className:`flex-1 overflow-y-auto space-y-2 pr-1 select-none`,children:t.map(r=>(0,y.jsx)(ge,{code:r,isActive:r===e,isLoading:n,allLocales:t,onRename:a,onDelete:o},r))})]})]})},ve={en:`English`,ar:`Arabic`,es:`Spanish`,fr:`French`,de:`German`,zh:`Chinese`,ja:`Japanese`,pt:`Portuguese`,it:`Italian`,ru:`Russian`,hi:`Hindi`,tr:`Turkish`},ye=e=>`${ve[e.split(`-`)[0]?.toLowerCase()||e]||ve[e]||`Custom`} (${e})`,be=({selected:e,inputValue:t,locale:n,isLoading:r,isSuccess:i,error:a,saveWarning:o,onInputChange:s,onLocaleChange:c,onSave:l,onForceSave:u,onDismissWarning:d,onClear:f,locales:p,onAddLocale:m,onRenameLocale:h,onDeleteLocale:_})=>{let[v,b]=(0,g.useState)(!1);return(0,y.jsxs)(`div`,{className:`w-[420px] bg-slate-900 border border-slate-800 rounded-2xl flex flex-col h-full shadow-2xl overflow-hidden shrink-0`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-outfit text-slate-200`,children:v?`Manage Languages`:`Translation Studio`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!v&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`label`,{className:`text-[10px] font-semibold text-slate-500 uppercase tracking-wider`,children:`Locale`}),(0,y.jsx)(`select`,{value:n,onChange:e=>c(e.target.value),className:`bg-slate-900 border border-slate-800 hover:border-slate-700 text-slate-300 text-xs rounded-lg px-2.5 py-1.5 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 cursor-pointer font-mono`,children:p.map(e=>(0,y.jsx)(`option`,{value:e,children:ye(e)},e))})]}),(0,y.jsx)(`button`,{onClick:()=>b(!v),className:`p-1.5 rounded-lg border transition duration-200 ${v?`bg-indigo-600/20 border-indigo-500 text-indigo-400`:`bg-slate-900 border-slate-800 text-slate-400 hover:text-slate-200 hover:border-slate-700`}`,title:v?`Back to Editor`:`Manage Languages`,children:v?(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M10 19l-7-7m0 0l7-7m-7 7h18`})}):(0,y.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z`}),(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]})})]})]}),v?(0,y.jsx)(_e,{locale:n,locales:p,isLoading:r,error:a,onAddLocale:m,onRenameLocale:h,onDeleteLocale:_}):e?(0,y.jsx)(fe,{selected:e,inputValue:t,locale:n,isLoading:r,isSuccess:i,error:a,saveWarning:o,onInputChange:s,onSave:l,onForceSave:u,onDismissWarning:d,onClear:f}):(0,y.jsx)(pe,{})]})},xe=({coveragePercentage:e,mode:t,changesCount:n,isChangesOpen:r,onToggleChanges:i})=>(0,y.jsxs)(`header`,{className:`h-16 bg-[#080b11]/90 backdrop-blur-md border-b border-slate-900/60 px-8 flex items-center justify-between shrink-0 select-none`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`w-8 h-8 rounded-xl bg-linear-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20`,children:(0,y.jsxs)(`svg`,{className:`w-4 h-4 text-white`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z`})]})}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h1`,{className:`text-base font-extrabold tracking-wide font-outfit bg-linear-to-r from-slate-100 to-slate-300 bg-clip-text text-transparent`,children:`LiveLocale`}),(0,y.jsx)(`p`,{className:`text-[10px] text-slate-500 font-medium tracking-wider uppercase mt-0.5`,children:`Live Visual Translation Studio`})]})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2.5`,title:`${e}% of keys translated`,children:[(0,y.jsx)(`span`,{className:`text-[10px] text-slate-500 font-medium select-none whitespace-nowrap`,children:`Coverage`}),(0,y.jsx)(`div`,{className:`w-28 h-1.5 bg-slate-800 rounded-full overflow-hidden`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full transition-all duration-700 ease-out`,style:{width:`${e}%`,background:e>=80?`linear-gradient(90deg, #34d399, #059669)`:e>=40?`linear-gradient(90deg, #fbbf24, #f59e0b)`:`linear-gradient(90deg, #f87171, #ef4444)`}})}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono text-slate-400 select-none tabular-nums`,children:[e,`%`]})]}),t===`preview`&&(0,y.jsx)(`span`,{className:`px-2.5 py-1 rounded-full bg-amber-500/10 border border-amber-500/30 text-[10px] font-extrabold tracking-wider text-amber-300 select-none`,title:`Edits go to a git branch on the server; nothing is written locally.`,children:`PREVIEW`}),(0,y.jsxs)(`button`,{id:`studio-changes-button`,onClick:i,className:`flex items-center gap-2 px-3 py-1.5 rounded-xl border text-[11px] font-semibold transition duration-150 ${r?`bg-indigo-600/20 border-indigo-500 text-indigo-300`:`bg-slate-900 border-slate-800 text-slate-300 hover:text-slate-100 hover:border-slate-700`}`,title:`Review, commit, or undo locale changes`,children:[(0,y.jsxs)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,y.jsx)(`path`,{d:`M12 3v6M12 15v6`})]}),`Changes`,n>0&&(0,y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-md bg-amber-500/15 border border-amber-500/30 text-[10px] font-mono font-bold text-amber-300`,children:n})]}),(0,y.jsxs)(`span`,{className:`px-3 py-1 rounded-full bg-slate-900 border border-slate-800 text-[10px] font-bold text-slate-400 select-none`,children:[`v`,`0.8.1`,` (BETA)`]})]})]}),Se=({showConfirmModal:e,onConfirm:t,onCancel:n})=>e?(0,y.jsx)(`div`,{className:`fixed inset-0 z-50 bg-slate-950/80 backdrop-blur-sm flex items-center justify-center p-4`,children:(0,y.jsxs)(`div`,{className:`bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 shadow-2xl relative animate-in fade-in zoom-in-95 duration-200`,children:[(0,y.jsx)(`h3`,{className:`text-base font-bold text-slate-200 font-outfit`,children:`Unsaved Changes`}),(0,y.jsx)(`p`,{className:`text-xs text-slate-400 mt-2 leading-relaxed`,children:`You have unsaved edits in your translation. Selecting another element will discard these modifications. Do you want to discard your edits?`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,y.jsx)(`button`,{onClick:n,className:`px-4 py-2 text-xs font-semibold text-slate-400 hover:text-slate-200 bg-slate-800 hover:bg-slate-750 border border-slate-850 hover:border-slate-700 rounded-xl transition duration-150`,children:`Keep Editing`}),(0,y.jsx)(`button`,{onClick:t,className:`px-4 py-2 text-xs font-semibold text-white bg-rose-600 hover:bg-rose-500 rounded-xl shadow-lg shadow-rose-600/10 active:bg-rose-700 transition duration-150`,children:`Discard Edits`})]})]})}):null,Ce=({filteredKeys:e,selected:t,localeData:n,searchTerm:r,setSearchTerm:i,filterPageOnly:a,setFilterPageOnly:o,visibleKeys:s,selectKeyDirectly:c})=>(0,y.jsxs)(`div`,{className:`w-[300px] bg-slate-900 border border-slate-800 rounded-2xl flex flex-col h-full shadow-2xl overflow-hidden shrink-0`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-outfit text-slate-200`,children:`Locale Directory`}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-slate-900 text-indigo-400 border border-slate-850`,children:[e.length,` keys`]})]}),(0,y.jsxs)(`div`,{className:`p-4 border-b border-slate-800/80 shrink-0 bg-slate-900/40 space-y-3`,children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`Search keys or values...`,className:`w-full h-9 pl-9 pr-4 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-lg text-xs text-slate-200 placeholder-slate-600 transition duration-150`}),(0,y.jsx)(`svg`,{className:`w-3.5 h-3.5 text-slate-600 absolute left-3 top-2.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`span`,{className:`text-[10px] text-slate-500 font-semibold uppercase tracking-wider`,children:`Scope`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1 bg-slate-950 border border-slate-850 rounded-lg p-0.5 select-none shrink-0`,children:[(0,y.jsx)(`button`,{onClick:()=>o(!1),className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition duration-150 ${a?`text-slate-500 hover:text-slate-300`:`bg-indigo-600 text-white shadow-sm`}`,children:`All Keys`}),(0,y.jsx)(`button`,{onClick:()=>o(!0),disabled:s===null,className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition duration-150 ${a?`bg-indigo-600 text-white shadow-sm`:`text-slate-500 hover:text-slate-300 disabled:opacity-40 disabled:cursor-not-allowed`}`,title:s===null?`Waiting for preview connection...`:`Only show keys on the current page`,children:`Page Keys`})]})]})]}),(0,y.jsx)(`div`,{className:`flex-1 overflow-y-auto p-3 space-y-1 scrollbar-thin`,children:e.length>0?e.map(e=>{let r=t?.key===e,i=n[e]||``,a=n[e]===void 0;return(0,y.jsxs)(`button`,{onClick:()=>c(e),className:`w-full text-left p-3 rounded-xl border transition duration-150 flex flex-col gap-1.5 ${r?`bg-indigo-600/10 border-indigo-500 text-slate-100 shadow-sm`:`bg-slate-950/20 hover:bg-slate-950/50 border-transparent text-slate-300 hover:text-slate-200`}`,children:[(0,y.jsxs)(`div`,{className:`w-full flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold font-mono break-all line-clamp-2 leading-relaxed text-indigo-400`,children:e}),a&&(0,y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-rose-500/10 text-[8px] font-extrabold text-rose-400 border border-rose-500/20 shrink-0 uppercase tracking-wider`,children:`Missing`})]}),(0,y.jsx)(`span`,{dir:`auto`,className:`text-[10px] text-slate-500 break-all line-clamp-1`,children:i||(0,y.jsx)(`span`,{className:`italic text-slate-750`,children:`Empty`})})]},e)}):(0,y.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center p-6 text-center text-slate-600 select-none`,children:[(0,y.jsx)(`svg`,{className:`w-8 h-8 text-slate-700 mb-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`})}),(0,y.jsx)(`span`,{className:`text-xs`,children:`No keys found`})]})})]}),we={modified:`text-amber-400 border-amber-500/30 bg-amber-500/10`,added:`text-emerald-400 border-emerald-500/30 bg-emerald-500/10`,deleted:`text-rose-400 border-rose-500/30 bg-rose-500/10`,renamed:`text-sky-400 border-sky-500/30 bg-sky-500/10`},Te=e=>e.startsWith(`+++`)||e.startsWith(`---`)?`text-slate-500`:e.startsWith(`@@`)?`text-indigo-400`:e.startsWith(`diff `)||e.startsWith(`new file`)?`text-slate-600`:e.startsWith(`+`)?`text-emerald-300 bg-emerald-500/10`:e.startsWith(`-`)?`text-rose-300 bg-rose-500/10`:`text-slate-400`,Ee=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),De=({isOpen:e,onClose:t,git:n,gitError:r,isGitLoading:i,lastCommit:a,onCommit:o,onDiscard:s,onRefresh:c,history:l,onUndo:u,isUndoing:d})=>{let[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(!1);if(!e)return null;let b=n?.changes??[],x=n?.mode===`github`,S=!!n?.isRepo&&b.length>0&&f.trim().length>0;return(0,y.jsxs)(`div`,{className:`fixed inset-0 top-16 z-40 flex justify-end`,"data-testid":`changes-panel`,children:[(0,y.jsx)(`div`,{className:`absolute inset-0 bg-slate-950/60 backdrop-blur-[2px]`,onClick:t}),(0,y.jsxs)(`aside`,{className:`relative w-[520px] max-w-full h-full bg-slate-900 border-l border-slate-800 shadow-2xl flex flex-col animate-in slide-in-from-right duration-200`,children:[(0,y.jsxs)(`div`,{className:`h-14 bg-slate-950 border-b border-slate-800 flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-outfit text-slate-200`,children:`Changes`}),n?.isRepo&&n.branch&&(0,y.jsx)(`span`,{className:`px-2 py-0.5 rounded-md bg-slate-900 border border-slate-800 text-[10px] font-mono text-indigo-400`,children:n.branch})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`button`,{onClick:c,className:`p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 border border-transparent hover:border-slate-700 transition duration-150`,title:`Refresh`,children:(0,y.jsxs)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,y.jsx)(`path`,{d:`M21 3v5h-5`})]})}),(0,y.jsx)(`button`,{onClick:t,className:`p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 border border-transparent hover:border-slate-700 transition duration-150`,title:`Close`,children:(0,y.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})})})]})]}),(0,y.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6`,children:[(0,y.jsxs)(`section`,{className:`space-y-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Locale files`}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-slate-950 text-indigo-400 border border-slate-850`,children:[b.length,` changed`]})]}),n===null?(0,y.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Loading git status…`}):n.available?n.isRepo?b.length===0?(0,y.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Working tree is clean. Edits you save will show up here.`}):(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:b.map(e=>(0,y.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2 rounded-xl bg-slate-950/40 border border-slate-800/80`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-mono text-slate-300 break-all`,children:e.path}),(0,y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[9px] font-extrabold uppercase tracking-wider border shrink-0 ${we[e.status]??we.modified}`,children:e.status})]},e.path))}):(0,y.jsxs)(`p`,{className:`text-xs text-slate-500 leading-relaxed`,children:[`The locales directory is not inside a git repository, or the`,` `,(0,y.jsx)(`code`,{className:`font-mono text-slate-400`,children:`git`}),` command is not on PATH.`]}):(0,y.jsxs)(`p`,{className:`text-xs text-slate-500 leading-relaxed`,children:[`Git integration is disabled for this handler. Enable it by removing`,` `,(0,y.jsx)(`code`,{className:`font-mono text-slate-400`,children:`git: false`}),` from the route configuration.`]}),n?.isRepo&&b.length>0&&(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`button`,{onClick:()=>v(e=>!e),className:`text-[10px] font-semibold text-slate-500 hover:text-slate-300 transition duration-150`,children:_?`Hide diff`:`Show diff`}),_&&(0,y.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-xl bg-slate-950 border border-slate-800 p-3 text-[10px] font-mono leading-relaxed whitespace-pre`,children:n.diff.split(`
|
|
10
10
|
`).map((e,t)=>(0,y.jsx)(`div`,{className:`px-1 ${Te(e)}`,children:e||` `},t))})]})]}),n?.isRepo&&(0,y.jsxs)(`section`,{className:`space-y-3`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:x?`Propose`:`Commit`}),x&&n?.pullRequestUrl&&(0,y.jsx)(`a`,{href:n.pullRequestUrl,target:`_blank`,rel:`noreferrer`,className:`block text-[11px] text-indigo-400 hover:text-indigo-300 underline underline-offset-2`,children:`View the open pull request`}),(0,y.jsx)(`textarea`,{id:`studio-commit-message`,value:f,onChange:e=>p(e.target.value),disabled:i||b.length===0,placeholder:b.length===0?x?`No changes on the branch yet`:`Nothing to commit`:x?`Pull request title, e.g. "Update checkout copy"`:`i18n: describe the copy change…`,maxLength:500,className:`w-full min-h-20 bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-xl px-4 py-3 text-xs text-slate-100 placeholder-slate-600 font-sans resize-none transition duration-150 disabled:opacity-60`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`button`,{id:`studio-commit-button`,onClick:async()=>{await o(f.trim())&&p(``)},disabled:!S||i,className:`flex-1 h-10 rounded-xl text-xs font-semibold tracking-wide bg-indigo-600 hover:bg-indigo-500 active:bg-indigo-700 text-white disabled:bg-slate-800 disabled:text-slate-500 disabled:cursor-not-allowed transition duration-150`,children:i?`Working…`:x?n?.pullRequestUrl?`Pull request is open`:`Open pull request`:`Commit locale changes`}),m?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`button`,{onClick:async()=>{await s()&&h(!1)},disabled:i,className:`h-10 px-3 rounded-xl text-xs font-semibold text-white bg-rose-600 hover:bg-rose-500 active:bg-rose-700 transition duration-150`,children:x?`Reset to base`:`Discard all`}),(0,y.jsx)(`button`,{onClick:()=>h(!1),className:`h-10 px-3 rounded-xl text-xs font-semibold text-slate-400 hover:text-slate-200 bg-slate-800 border border-slate-850 transition duration-150`,children:`Keep`})]}):(0,y.jsx)(`button`,{onClick:()=>h(!0),disabled:b.length===0||i,className:`h-10 px-4 rounded-xl text-xs font-semibold text-rose-400 bg-rose-500/10 hover:bg-rose-500/20 border border-rose-500/20 disabled:opacity-40 disabled:cursor-not-allowed transition duration-150`,children:x?`Reset branch`:`Discard`})]}),a&&!r&&(0,y.jsx)(`p`,{className:`text-[11px] text-emerald-400 font-mono break-all`,children:x?(0,y.jsxs)(y.Fragment,{children:[`Pull request:`,` `,(0,y.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,className:`underline`,children:a})]}):(0,y.jsxs)(y.Fragment,{children:[`Committed as `,a,`. Push whenever you are ready.`]})}),r&&(0,y.jsx)(`div`,{className:`bg-rose-500/10 border border-rose-500/20 rounded-xl p-3 text-xs text-rose-400 font-mono break-all`,children:r})]}),(0,y.jsxs)(`section`,{className:`space-y-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`label`,{className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`This session`}),(0,y.jsxs)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-slate-950 text-slate-400 border border-slate-850`,children:[l.length,` edits`]})]}),l.length===0?(0,y.jsx)(`p`,{className:`text-xs text-slate-500`,children:`No edits saved yet in this session.`}):(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:l.map(e=>(0,y.jsxs)(`li`,{className:`px-3 py-2 rounded-xl bg-slate-950/40 border border-slate-800/80 space-y-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,y.jsxs)(`span`,{className:`text-[11px] font-mono text-indigo-400 break-all`,children:[e.key,(0,y.jsxs)(`span`,{className:`text-slate-600`,children:[` · `,e.locale]})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,y.jsx)(`span`,{className:`text-[9px] text-slate-600 font-mono`,children:Ee(e.at)}),(0,y.jsx)(`button`,{onClick:()=>u(e),disabled:d,className:`text-[10px] font-semibold text-slate-400 hover:text-slate-100 px-2 py-0.5 rounded-md border border-slate-800 hover:border-slate-600 disabled:opacity-40 transition duration-150`,title:`Restore the previous value`,children:`Undo`})]})]}),(0,y.jsxs)(`div`,{className:`text-[10px] leading-relaxed`,children:[(0,y.jsx)(`span`,{className:`text-rose-400/80 line-through break-all`,children:e.previousValue||(0,y.jsx)(`em`,{children:`empty`})}),(0,y.jsx)(`span`,{className:`text-slate-600`,children:` → `}),(0,y.jsx)(`span`,{className:`text-emerald-300 break-all`,children:e.nextValue||(0,y.jsx)(`em`,{children:`empty`})})]})]},e.id))})]})]})]})]})},Oe=({isOpen:e,onSubmit:t})=>{let[n,r]=(0,g.useState)(``);return e?(0,y.jsx)(`div`,{className:`fixed inset-0 z-50 bg-slate-950/80 backdrop-blur-sm flex items-center justify-center p-4`,children:(0,y.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim())},className:`bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200 space-y-4`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h3`,{className:`text-base font-bold text-slate-200 font-outfit`,children:`Access token required`}),(0,y.jsxs)(`p`,{className:`text-xs text-slate-400 mt-2 leading-relaxed`,children:[`This app runs LiveLocale in preview mode. Paste the access token configured on the server (`,(0,y.jsx)(`code`,{className:`font-mono text-slate-300`,children:`LIVELOCALE_TOKEN`}),`) to edit translations. It is kept in this browser tab only.`]})]}),(0,y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,y.jsx)(`label`,{htmlFor:`studio-access-token`,className:`text-[11px] font-bold text-slate-500 uppercase tracking-wider`,children:`Access token`}),(0,y.jsx)(`input`,{id:`studio-access-token`,type:`password`,autoComplete:`off`,value:n,onChange:e=>r(e.target.value),className:`w-full bg-slate-950 border border-slate-800 hover:border-slate-750 focus:border-indigo-500 focus:outline-hidden focus:ring-1 focus:ring-indigo-500/50 rounded-xl px-4 py-2.5 text-sm text-slate-100 font-mono transition duration-150`})]}),(0,y.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,y.jsx)(`button`,{type:`submit`,disabled:!n.trim(),className:`px-4 py-2 text-xs font-semibold text-white bg-indigo-600 hover:bg-indigo-500 active:bg-indigo-700 disabled:bg-slate-800 disabled:text-slate-500 disabled:cursor-not-allowed rounded-xl transition duration-150`,children:`Connect`})})]})}):null},ke=({problems:e})=>e.length===0?null:(0,y.jsxs)(`div`,{role:`alert`,"data-testid":`setup-problems`,className:`mx-6 mt-4 rounded-xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-xs text-rose-200 select-text`,children:[(0,y.jsx)(`p`,{className:`font-semibold text-rose-100`,children:`Saving will fail until the server setup is fixed:`}),(0,y.jsx)(`ul`,{className:`mt-1.5 space-y-1 list-disc pl-4`,children:e.map(e=>(0,y.jsx)(`li`,{children:e},e))})]});function Ae(e){if(typeof e!=`string`||e.trim()===``)return null;try{let t=new URL(e.trim());return t.protocol!==`http:`&&t.protocol!==`https:`?null:t.origin}catch{return null}}function je(e){let t=null;if(e.search)try{t=new URLSearchParams(e.search).get(`app`)}catch{t=null}return Ae(t)??Ae(e.injected)??Ae(e.buildTime)??`http://localhost:3000`}var Me=je({search:typeof window<`u`?window.location.search:void 0,injected:typeof window<`u`?window.__LIVELOCALE_CONFIG__?.appOrigin:void 0,buildTime:void 0}),Ne=e=>{let[t,n]=(0,g.useState)(`connecting`),[r,i]=(0,g.useState)(`/`),[a,o]=(0,g.useState)(null),s=(0,g.useRef)(null),c=(0,g.useRef)(e);return c.current=e,(0,g.useEffect)(()=>{let e=e=>{if(e.origin!==Me||e.data?.source!==`livelocale-client`)return;let{type:t,payload:r}=e.data;if(t===`READY`){n(`connected`),i(r.url||`/`),o(null);try{let e=new URL(r.url,Me),t=e.searchParams.get(`locale`);if(t)c.current.onLocaleDetected(t);else{let t=e.pathname.split(`/`)[1];t&&t.length===2&&c.current.onLocaleDetected(t)}}catch{}}else t===`ELEMENT_SELECTED`?c.current.onElementSelected(r):t===`ERROR`?c.current.onError(r.error||`Client-side error occurred.`):t===`VISIBLE_KEYS_CHANGED`&&Array.isArray(r)&&o(r)};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[]),{connectionStatus:t,currentPath:r,visibleKeys:a,iframeRef:s,sendToIframe:(0,g.useCallback)((e,t)=>{s.current&&s.current.contentWindow&&s.current.contentWindow.postMessage({source:`livelocale-studio`,type:e,payload:t},Me)},[])}},Pe=`${Me}/api/livelocale`,Fe=`livelocale-token`,Ie=`livelocale:unauthorized`,Le=`livelocale:token-changed`,Re=class extends Error{code;details;constructor(e,t,n){super(e),this.name=`ValidationError`,this.code=t,this.details={missing:n?.missing??[],extra:n?.extra??[]}}},ze=class extends Error{code=`UNAUTHORIZED`;constructor(e=`Unauthorized`){super(e),this.name=`UnauthorizedError`}},Be=null;function Ve(){try{return window.sessionStorage.getItem(`livelocale-token`)??Be}catch{return Be}}function He(e){Be=e;try{e?window.sessionStorage.setItem(Fe,e):window.sessionStorage.removeItem(Fe)}catch{}typeof window<`u`&&window.dispatchEvent(new Event(Le))}function Ue(e={}){let t=Ve();return t?{...e,Authorization:`Bearer ${t}`}:e}async function We(e){let t=null;try{t=await e.json()}catch{}if(e.status===401)throw typeof window<`u`&&window.dispatchEvent(new Event(Ie)),new ze(t?.error||`Unauthorized`);if(e.status===422)throw new Re(t?.error||`The translation was rejected.`,t?.code||`VALIDATION`,t?.details);if(!e.ok)throw Error(t?.error||`Server responded with status ${e.status}`);return t}function Ge(e=``){let t=`${Pe}${e}`;return(Ve()?fetch(t,{headers:Ue()}):fetch(t)).then(e=>We(e))}async function Ke(e){return We(await fetch(Pe,{method:`POST`,headers:Ue({"Content-Type":`application/json`}),body:JSON.stringify(e)}))}var qe=()=>Ge(`?action=info`),Je=()=>Ge(),Ye=()=>Ge(`?action=keys`),Xe=e=>Ge(`?locale=${encodeURIComponent(e)}`),Ze=()=>Ge(`?action=git`),Qe=(e,t,n,r={})=>Ke({locale:e,key:t,value:n,...r.reference===void 0?{}:{reference:r.reference},...r.force?{force:!0}:{}}),$e=e=>Ke({action:`addLocale`,locale:e}),et=(e,t)=>Ke({action:`renameLocale`,locale:e,newLocale:t}),tt=e=>Ke({action:`deleteLocale`,locale:e}),nt=e=>Ke({action:`commit`,message:e}),rt=()=>Ke({action:`discard`});function it(e,t=``){let n={};if(!e||typeof e!=`object`)return n;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=t?`${t}.${r}`:r;typeof e[r]==`object`&&e[r]!==null&&!Array.isArray(e[r])?Object.assign(n,it(e[r],i)):n[i]=String(e[r])}return n}var at=({connectionStatus:e,iframeRef:t})=>{let[n,r]=(0,g.useState)(`en`),[i,a]=(0,g.useState)([]),[o,s]=(0,g.useState)([]),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)({}),[f,p]=(0,g.useState)({}),m=(0,g.useCallback)(async e=>{try{let t=await Je();Array.isArray(t)&&(a(t),e&&t.length>0&&r(e=>t.includes(e)?e:t.includes(`en`)?`en`:t[0]||`en`))}catch(e){console.warn(`[livelocale] Failed to fetch locales list:`,e.message)}},[]),h=(0,g.useCallback)(async()=>{try{let e=await Ye();e&&Array.isArray(e.allKeys)&&s(e.allKeys),e&&Array.isArray(e.codeKeys)&&l(e.codeKeys)}catch(e){console.warn(`[livelocale] Failed to fetch keys metadata:`,e.message)}},[]),_=(0,g.useCallback)(async e=>{try{d(it(await Xe(e)))}catch(e){console.warn(`[livelocale] Failed to load full locale dictionary:`,e.message)}},[]);(0,g.useEffect)(()=>{e===`connected`&&(m(!0),h())},[e,m,h]),(0,g.useEffect)(()=>{e===`connected`&&n&&_(n)},[e,n,_]),(0,g.useEffect)(()=>{e===`connected`&&Xe(`en`).then(e=>p(it(e))).catch(e=>console.warn(`[livelocale] Failed to load reference English locale:`,e.message))},[e]),(0,g.useEffect)(()=>{n===`en`&&p(u)},[n,u]);let v=(0,g.useCallback)(e=>{if(r(e),t.current&&t.current.contentWindow)try{let n=new URL(t.current.src);n.searchParams.set(`locale`,e),t.current.src=n.toString()}catch{}},[t]),y=(0,g.useCallback)(async()=>{await m(),await h(),await _(n)},[m,h,_,n]),b=(0,g.useCallback)((e,t)=>{d(n=>({...n,[e]:t}))},[]),x=o.length,S=o.filter(e=>{let t=u[e];return t!==void 0&&t.trim()!==``}).length;return{locale:n,setLocale:r,locales:i,allKeys:o,codeKeys:c,localeData:u,enLocaleData:f,coveragePercentage:x>0?Math.round(S/x*100):100,handleLocaleChange:v,fetchLocales:m,fetchKeysMetadata:h,fetchLocaleData:_,refreshAll:y,updateLocaleDataCache:b}},ot=({localeData:e,enLocaleData:t,sendToIframe:n,locale:r,refreshKeysMetadata:i,updateLocaleDataCache:a,setLoading:o,setError:s,onSaved:c})=>{let[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(null),v=(0,g.useRef)(null);(0,g.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);let[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(null),C=l!==null&&d!==l.currentValue,w=(0,g.useCallback)(e=>{f(e),_(null),n(`APPLY_PREVIEW`,{key:l?.key,value:e})},[n,l?.key]),T=(0,g.useCallback)(t=>{if(C){S(t),b(!0);return}let n=e[t.key]??t.currentValue;u({...t,currentValue:n}),f(n),m(!1),_(null),s(null)},[C,e,s]),ee=(0,g.useCallback)(()=>{if(x){let t=e[x.key]??x.currentValue;u({...x,currentValue:t}),f(t)}else u(null),f(``),n(`CLEAR_SELECTION`);S(null),b(!1),m(!1),s(null)},[x,e,n,s]),te=(0,g.useCallback)(()=>{S(null),b(!1)},[]),ne=(0,g.useCallback)(t=>{let n=e[t]||``;T({key:t,fallbackValue:n,currentValue:n})},[e,T]);return(0,g.useEffect)(()=>{if(l){let n=e[l.key]||``,r=t[l.key]||l.fallbackValue||``;l.currentValue!==n&&(u(e=>e?{...e,currentValue:n,fallbackValue:r}:null),f(n))}},[e,t]),{selected:l,inputValue:d,isSuccess:p,showConfirmModal:y,hasUnsavedChanges:C,selectElement:T,confirmDiscard:ee,cancelDiscard:te,selectKeyDirectly:ne,handleInputChange:w,handleSave:async(e={})=>{if(l){o(!0),m(!1),s(null);try{let o=l.currentValue,s=r===`en`?o:t[l.key]??l.fallbackValue;await Qe(r,l.key,d,{reference:s||void 0,force:e.force}),_(null),m(!0),c?.({locale:r,key:l.key,previousValue:o,nextValue:d}),u(e=>e?{...e,currentValue:d}:null),a(l.key,d),i(),n(`COMMIT_PREVIEW`,{key:l.key,value:d}),n(`CLEAR_SELECTION`),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{m(!1),v.current=null},2e3)}catch(e){e instanceof Re?_({code:e.code,message:e.message,missing:e.details.missing,extra:e.details.extra}):s(e.message||`Failed to save translation.`)}finally{o(!1)}}},handleClearSelection:(0,g.useCallback)(()=>{if(C){S(null),b(!0);return}u(null),f(``),n(`CLEAR_SELECTION`)},[C,n]),saveWarning:h,dismissSaveWarning:()=>_(null)}},st=({locale:e,locales:t,handleLocaleChange:n,refreshAll:r,handleClearSelection:i,setLoading:a,setError:o})=>({handleAddLocale:(0,g.useCallback)(async e=>{try{a(!0),o(null),await $e(e),await r(),n(e)}catch(e){o(e.message||`Failed to add locale.`)}finally{a(!1)}},[r,n,a,o]),handleRenameLocale:(0,g.useCallback)(async(t,i)=>{try{a(!0),o(null),await et(t,i),await r(),e===t&&n(i)}catch(e){o(e.message||`Failed to rename locale.`)}finally{a(!1)}},[e,r,n,a,o]),handleDeleteLocale:(0,g.useCallback)(async s=>{try{a(!0),o(null),await tt(s);let c=t.filter(e=>e!==s),l=`en`;c.length>0&&(l=c.includes(`en`)?`en`:c[0]||`en`),await r(),e===s&&(n(l),i())}catch(e){o(e.message||`Failed to delete locale.`)}finally{a(!1)}},[t,e,r,n,i,a,o])}),ct=({allKeys:e,visibleKeys:t,localeData:n})=>{let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1);return{searchTerm:r,setSearchTerm:i,filterPageOnly:a,setFilterPageOnly:o,filteredKeys:(0,g.useMemo)(()=>e.filter(e=>{if(a&&t!==null&&!t.includes(e))return!1;let i=n[e]||``;return e.toLowerCase().includes(r.toLowerCase())||i.toLowerCase().includes(r.toLowerCase())}),[e,t,n,r,a])}},lt=({connectionStatus:e,onAfterDiscard:t})=>{let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),u=(0,g.useCallback)(async()=>{try{r(await Ze())}catch(e){s(e.message||`Failed to read git status.`)}},[]);return(0,g.useEffect)(()=>{e===`connected`&&u()},[e,u]),{git:n,isLoading:i,error:o,lastCommit:c,refresh:u,commit:(0,g.useCallback)(async e=>{a(!0),s(null);try{let t=await nt(e);return l(t.hash),await u(),t.hash}catch(e){s(e.message||`Commit failed.`);return}finally{a(!1)}},[u]),discard:(0,g.useCallback)(async()=>{a(!0),s(null);try{return await rt(),await t(),await u(),!0}catch(e){return s(e.message||`Discard failed.`),!1}finally{a(!1)}},[t,u]),clearError:()=>s(null)}},ut=200,dt=0,ft=()=>{let[e,t]=(0,g.useState)([]);return{entries:e,record:(0,g.useCallback)(e=>{dt+=1;let n={...e,id:`${Date.now()}-${dt}`,at:Date.now()};t(e=>[n,...e].slice(0,ut))},[]),remove:(0,g.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clear:(0,g.useCallback)(()=>t([]),[])}},pt=()=>{let[e,t]=(0,g.useState)(()=>Ve()),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(0);return(0,g.useEffect)(()=>{let e=()=>r(!0);return window.addEventListener(Ie,e),()=>window.removeEventListener(Ie,e)},[]),{token:e,needsToken:n,tokenVersion:i,submitToken:(0,g.useCallback)(e=>{let n=e.trim();n&&(He(n),t(n),r(!1),a(e=>e+1))},[]),clearToken:(0,g.useCallback)(()=>{He(null),t(null),a(e=>e+1)},[])}},mt=()=>{let[e,t]=(0,g.useState)(!1),[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)([]),f=pt(),p=(0,g.useRef)(()=>{}),m=(0,g.useRef)(()=>{}),h=(0,g.useRef)(()=>{}),{connectionStatus:_,currentPath:v,visibleKeys:y,iframeRef:b,sendToIframe:x}=Ne({onElementSelected:e=>p.current(e),onLocaleDetected:e=>m.current(e),onError:e=>h.current(e)}),{locale:S,setLocale:C,locales:w,allKeys:T,codeKeys:ee,localeData:te,enLocaleData:ne,coveragePercentage:re,handleLocaleChange:ie,fetchKeysMetadata:ae,refreshAll:E,updateLocaleDataCache:oe}=at({connectionStatus:_,iframeRef:b}),D=ft(),{selected:O,inputValue:se,isSuccess:ce,showConfirmModal:le,selectElement:k,confirmDiscard:ue,cancelDiscard:de,selectKeyDirectly:fe,handleInputChange:pe,handleSave:me,handleClearSelection:he,saveWarning:ge,dismissSaveWarning:_e}=ot({localeData:te,enLocaleData:ne,sendToIframe:x,locale:S,refreshKeysMetadata:ae,updateLocaleDataCache:oe,setLoading:t,setError:r,onSaved:e=>{D.record(e),ve.refresh()}}),ve=lt({connectionStatus:_,onAfterDiscard:async()=>{D.clear(),he(),await E()}});(0,g.useEffect)(()=>{_===`connected`&&qe().then(e=>{l(e.mode),d(e.problems??[])}).catch(()=>{})},[_,f.tokenVersion]);let ye=(0,g.useRef)(f.tokenVersion);(0,g.useEffect)(()=>{f.tokenVersion!==ye.current&&_===`connected`&&(E(),ve.refresh())},[f.tokenVersion]),(0,g.useEffect)(()=>{if(c!==`preview`||_!==`connected`)return;let e=new Map;for(let t of[...D.entries].reverse())t.locale===S&&e.set(t.key,t.nextValue);e.forEach((e,t)=>x(`COMMIT_PREVIEW`,{key:t,value:e}))},[c,_,v,y,S,D.entries]);let be=async e=>{s(!0),r(null);try{await Qe(e.locale,e.key,e.previousValue),e.locale===S&&(oe(e.key,e.previousValue),x(`COMMIT_PREVIEW`,{key:e.key,value:e.previousValue})),D.remove(e.id),await ve.refresh()}catch(e){r(e.message||`Undo failed.`)}finally{s(!1)}};p.current=k,m.current=C,h.current=r;let{handleAddLocale:xe,handleRenameLocale:Se,handleDeleteLocale:Ce}=st({locale:S,locales:w,handleLocaleChange:ie,refreshAll:E,handleClearSelection:he,setLoading:t,setError:r}),{searchTerm:we,setSearchTerm:Te,filterPageOnly:Ee,setFilterPageOnly:De,filteredKeys:Oe}=ct({allKeys:T,visibleKeys:y,localeData:te});return{selected:O,inputValue:se,locale:S,connectionStatus:_,isLoading:e,isSuccess:ce,error:n,currentPath:v,iframeRef:b,appOrigin:Me,showConfirmModal:le,localeData:te,searchTerm:we,filteredKeys:Oe,coveragePercentage:re,setSearchTerm:Te,selectKeyDirectly:fe,handleInputChange:pe,handleLocaleChange:ie,handleSave:me,handleClearSelection:he,confirmDiscard:ue,cancelDiscard:de,locales:w,handleAddLocale:xe,handleRenameLocale:Se,handleDeleteLocale:Ce,allKeys:T,codeKeys:ee,filterPageOnly:Ee,setFilterPageOnly:De,visibleKeys:y,isChangesOpen:i,toggleChanges:()=>a(e=>!e),closeChanges:()=>a(!1),git:ve.git,gitError:ve.error,isGitLoading:ve.isLoading,lastCommit:ve.lastCommit,commitChanges:ve.commit,discardChanges:ve.discard,refreshGit:ve.refresh,history:D.entries,undoEntry:be,isUndoing:o,setupProblems:u,saveWarning:ge,handleForceSave:()=>me({force:!0}),dismissSaveWarning:_e,mode:c,needsToken:f.needsToken,submitToken:f.submitToken}};_.createRoot(document.getElementById(`root`)).render((0,y.jsx)(g.StrictMode,{children:(0,y.jsx)(()=>{let{selected:e,inputValue:t,locale:n,connectionStatus:r,isLoading:i,isSuccess:a,error:o,currentPath:s,iframeRef:c,appOrigin:l,showConfirmModal:u,searchTerm:d,filteredKeys:f,localeData:p,coveragePercentage:m,setSearchTerm:h,selectKeyDirectly:g,handleInputChange:_,handleLocaleChange:v,handleSave:b,saveWarning:S,handleForceSave:C,dismissSaveWarning:w,handleClearSelection:T,confirmDiscard:ee,cancelDiscard:te,locales:ne,handleAddLocale:re,handleRenameLocale:ie,handleDeleteLocale:ae,filterPageOnly:E,setFilterPageOnly:oe,visibleKeys:D,isChangesOpen:O,toggleChanges:se,closeChanges:ce,git:le,gitError:k,isGitLoading:ue,lastCommit:de,commitChanges:fe,discardChanges:pe,refreshGit:me,history:he,undoEntry:ge,isUndoing:_e,mode:ve,needsToken:ye,submitToken:we,setupProblems:Te}=mt();return(0,y.jsxs)(`div`,{className:`w-screen h-screen flex flex-col bg-[#0b0f19] text-slate-100 font-sans select-none overflow-hidden antialiased`,children:[(0,y.jsx)(Oe,{isOpen:ye,onSubmit:we}),(0,y.jsx)(xe,{coveragePercentage:m,mode:ve,changesCount:le?.changes.length??0,isChangesOpen:O,onToggleChanges:se}),(0,y.jsx)(De,{isOpen:O,onClose:ce,git:le,gitError:k,isGitLoading:ue,lastCommit:de,onCommit:fe,onDiscard:pe,onRefresh:me,history:he,onUndo:ge,isUndoing:_e}),(0,y.jsx)(ke,{problems:Te}),(0,y.jsxs)(`main`,{className:`flex-1 flex gap-6 p-6 overflow-hidden min-h-0 bg-linear-to-b from-[#0b0f19] to-[#070a10]`,children:[(0,y.jsx)(Ce,{filteredKeys:f,selected:e,localeData:p,searchTerm:d,setSearchTerm:h,filterPageOnly:E,setFilterPageOnly:oe,visibleKeys:D,selectKeyDirectly:g}),(0,y.jsx)(x,{iframeRef:c,appOrigin:l,connectionStatus:r,currentPath:s}),(0,y.jsx)(be,{selected:e,inputValue:t,locale:n,isLoading:i,isSuccess:a,error:o,onInputChange:_,onLocaleChange:v,onSave:()=>b(),saveWarning:S,onForceSave:C,onDismissWarning:w,onClear:T,locales:ne,onAddLocale:re,onRenameLocale:ie,onDeleteLocale:ae})]}),(0,y.jsx)(Se,{showConfirmModal:u,onConfirm:ee,onCancel:te})]})},{})}));
|