livelocale 0.11.0-next.12 → 0.11.0

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.
@@ -7,7 +7,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
7
7
  Error generating stack: `+e.message+`
8
8
  `+e.stack}return{value:e,source:t,stack:i,digest:null}}function ws(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ts(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Es=typeof WeakMap==`function`?WeakMap:Map;function Ds(e,t,n){n=eo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),Ts(e,t)},n}function Os(e,t,n){n=eo(-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(){Ts(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ts(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function ks(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Es;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 As(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 js(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=eo(-1,1),t.tag=2,to(n,t,1))),n.lanes|=1),e)}var Ms=C.ReactCurrentOwner,Ns=!1;function Ps(e,t,n,r){t.child=e===null?La(t,null,n,r):Ia(t,e.child,n,r)}function Fs(e,t,n,r,i){n=n.render;var a=t.ref;return Ga(t,i),r=Ao(e,t,n,r,a,i),n=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(J&&n&&_a(t),t.flags|=1,Ps(e,t,r,i),t.child)}function Is(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,Ls(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?Dr:n,n(o,r)&&e.ref===t.ref)return tc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ls(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Dr(a,r)&&e.ref===t.ref)if(Ns=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ns=!0);else return t.lanes=e.lanes,tc(e,t,i)}return Bs(e,t,n,r,i)}function Rs(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},q(Kc,Gc),Gc|=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,q(Kc,Gc),Gc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,q(Kc,Gc),Gc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),q(Kc,Gc),Gc|=r;return Ps(e,t,i,n),t.child}function zs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Bs(e,t,n,r,i){var a=Ji(n)?Ki:Wi.current;return a=qi(t,a),Ga(t,i),n=Ao(e,t,n,r,a,i),r=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(J&&r&&_a(t),t.flags|=1,Ps(e,t,n,i),t.child)}function Vs(e,t,n,r,i){if(Ji(n)){var a=!0;Qi(t)}else a=!1;if(Ga(t,i),t.stateNode===null)ec(e,t),bs(t,n,r),Ss(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=Ka(l):(l=Ji(n)?Ki:Wi.current,l=qi(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)&&xs(t,o,r,l),Za=!1;var f=t.memoizedState;o.state=f,io(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Gi.current||Za?(typeof u==`function`&&(_s(t,n,u,r),c=t.memoizedState),(s=Za||ys(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,$a(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:gs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ka(c):(c=Ji(n)?Ki:Wi.current,c=qi(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)&&xs(t,o,r,c),Za=!1,f=t.memoizedState,o.state=f,io(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Gi.current||Za?(typeof p==`function`&&(_s(t,n,p,r),m=t.memoizedState),(l=Za||ys(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 Hs(e,t,n,r,a,i)}function Hs(e,t,n,r,i,a){zs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&$i(t,n,!1),tc(e,t,a);r=t.stateNode,Ms.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ia(t,e.child,null,a),t.child=Ia(t,null,s,a)):Ps(e,t,s,a),t.memoizedState=r.state,i&&$i(t,n,!0),t.child}function Us(e){var t=e.stateNode;t.pendingContext?Xi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Xi(e,t.context,!1),fo(e,t.containerInfo)}function Ws(e,t,n,r,i){return ka(),Aa(i),t.flags|=256,Ps(e,t,n,r),t.child}var Gs={dehydrated:null,treeContext:null,retryLane:0};function Ks(e){return{baseLanes:e,cachePool:null,transitions:null}}function qs(e,t,n){var r=t.pendingProps,i=Y.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),q(Y,i&1),e===null)return Ta(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=Ks(n),t.memoizedState=Gs,e):Js(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Xs(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?Ks(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Gs,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 Js(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Ys(e,t,n,r){return r!==null&&Aa(r),Ia(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ws(Error(r(422))),Ys(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&&Ia(t,e.child,null,s),t.child.memoizedState=Ks(s),t.memoizedState=Gs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Ys(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=ws(o,i,void 0),Ys(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ns||c){if(i=Hc,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,Xa(e,a),hl(i,e,a,-1))}return kl(),i=ws(Error(r(421))),Ys(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,ba=Di(a.nextSibling),ya=t,J=!0,xa=null,e!==null&&(ua[da++]=pa,ua[da++]=ma,ua[da++]=fa,pa=e.id,ma=e.overflow,fa=t),t=Js(t,i.children),t.flags|=4096,t)}function Zs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wa(e.return,t,n)}function Qs(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 $s(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ps(e,t,r.children,n),r=Y.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&&Zs(e,n,t);else if(e.tag===19)Zs(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(q(Y,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&&go(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qs(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&&go(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qs(t,!0,n,null,a);break;case`together`:Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ec(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=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 nc(e,t,n){switch(t.tag){case 3:Us(t),ka();break;case 5:mo(t);break;case 1:Ji(t.type)&&Qi(t);break;case 4:fo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;q(Ra,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(q(Y,Y.current&1),e=tc(e,t,n),e===null?null:e.sibling):qs(e,t,n):(q(Y,Y.current&1),t.flags|=128,null);q(Y,Y.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $s(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),q(Y,Y.current),r)break;return null;case 22:case 23:return t.lanes=0,Rs(e,t,n)}return tc(e,t,n)}var rc=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}},ic=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,uo(so.current);var o=null;switch(n){case`input`:i=me(e,i),r=me(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=be(e,i),r=be(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=_i)}Ne(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`&&G(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ac=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!J)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 sc(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 cc(e,t,n){var i=t.pendingProps;switch(va(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sc(t),null;case 1:return Ji(t.type)&&Yi(),sc(t),null;case 3:return i=t.stateNode,po(),K(Gi),K(Wi),vo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Da(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xa!==null&&(yl(xa),xa=null))),sc(t),null;case 5:ho(t);var o=uo(lo.current);if(n=t.type,e!==null&&t.stateNode!=null)ic(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 sc(t),null}if(e=uo(so.current),Da(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ai]=t,i[ji]=s,e=(t.mode&1)!=0,n){case`dialog`:G(`cancel`,i),G(`close`,i);break;case`iframe`:case`object`:case`embed`:G(`load`,i);break;case`video`:case`audio`:for(o=0;o<ei.length;o++)G(ei[o],i);break;case`source`:G(`error`,i);break;case`img`:case`image`:case`link`:G(`error`,i),G(`load`,i);break;case`details`:G(`toggle`,i);break;case`input`:he(i,s),G(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},G(`invalid`,i);break;case`textarea`:xe(i,s),G(`invalid`,i)}for(var c in Ne(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&gi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&gi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&G(`scroll`,i)}switch(n){case`input`:fe(i),_e(i,s,!0);break;case`textarea`:fe(i),Ce(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=_i)}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=we(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[Ai]=t,e[ji]=i,rc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Pe(n,i),n){case`dialog`:G(`cancel`,e),G(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:G(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ei.length;o++)G(ei[o],e);o=i;break;case`source`:G(`error`,e),o=i;break;case`img`:case`image`:case`link`:G(`error`,e),G(`load`,e),o=i;break;case`details`:G(`toggle`,e),o=i;break;case`input`:he(e,i),o=me(e,i),G(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),G(`invalid`,e);break;case`textarea`:xe(e,i),o=be(e,i),G(`invalid`,e);break;default:o=i}for(s in Ne(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?je(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&De(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&V(e,u):typeof u==`number`&&V(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&G(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:fe(e),_e(e,i,!1);break;case`textarea`:fe(e),Ce(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+de(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&B(e,!!i.multiple,i.defaultValue,!0):B(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=_i)}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 sc(t),null;case 6:if(e&&t.stateNode!=null)ac(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=uo(lo.current),uo(so.current),Da(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ai]=t,(s=i.nodeValue!==n)&&(e=ya,e!==null))switch(e.tag){case 3:gi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&gi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ai]=t,t.stateNode=i}return sc(t),null;case 13:if(K(Y),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(J&&ba!==null&&t.mode&1&&!(t.flags&128))Oa(),ka(),t.flags|=98560,s=!1;else if(s=Da(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[Ai]=t}else ka(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sc(t),s=!1}else xa!==null&&(yl(xa),xa=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||Y.current&1?qc===0&&(qc=3):kl())),t.updateQueue!==null&&(t.flags|=4),sc(t),null);case 4:return po(),e===null&&oi(t.stateNode.containerInfo),sc(t),null;case 10:return Ua(t.type._context),sc(t),null;case 17:return Ji(t.type)&&Yi(),sc(t),null;case 19:if(K(Y),s=t.memoizedState,s===null)return sc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)oc(s,!1);else{if(qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=go(e),c!==null){for(t.flags|=128,oc(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 q(Y,Y.current&1|2),t.child}e=e.sibling}s.tail!==null&&U()>tl&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}else{if(!i)if(e=go(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!J)return sc(t),null}else 2*U()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,oc(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?(sc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=U(),t.sibling=null,n=Y.current,q(Y,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?Gc&1073741824&&(sc(t),t.subtreeFlags&6&&(t.flags|=8192)):sc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function lc(e,t){switch(va(t),t.tag){case 1:return Ji(t.type)&&Yi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return po(),K(Gi),K(Wi),vo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ho(t),null;case 13:if(K(Y),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(Y),null;case 4:return po(),null;case 10:return Ua(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var uc=!1,dc=!1,fc=typeof WeakSet==`function`?WeakSet:Set,Z=null;function pc(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 mc(e,t,n){try{n()}catch(n){$(e,t,n)}}var hc=!1;function gc(e,t){if(vi=un,e=jr(),Mr(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(yi={focusedElem:e,selectionRange:n},un=!1,Z=t;Z!==null;)if(t=Z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;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:gs(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,Z=e;break}Z=t.return}return h=hc,hc=!1,h}function _c(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&&mc(t,n,a)}i=i.next}while(i!==r)}}function vc(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 yc(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 bc(e){var t=e.alternate;t!==null&&(e.alternate=null,bc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ai],delete t[ji],delete t[Ni],delete t[Pi],delete t[Fi])),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 xc(e){return e.tag===5||e.tag===3||e.tag===4}function Sc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||xc(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 Cc(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=_i));else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function wc(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(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}var Tc=null,Ec=!1;function Dc(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(bt&&typeof bt.onCommitFiberUnmount==`function`)try{bt.onCommitFiberUnmount(yt,n)}catch{}switch(n.tag){case 5:dc||pc(n,t);case 6:var r=Tc,i=Ec;Tc=null,Dc(e,t,n),Tc=r,Ec=i,Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tc.removeChild(n.stateNode));break;case 18:Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?Ei(e.parentNode,n):e.nodeType===1&&Ei(e,n),cn(e)):Ei(Tc,n.stateNode));break;case 4:r=Tc,i=Ec,Tc=n.stateNode.containerInfo,Ec=!0,Dc(e,t,n),Tc=r,Ec=i;break;case 0:case 11:case 14:case 15:if(!dc&&(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)&&mc(n,t,o),i=i.next}while(i!==r)}Dc(e,t,n);break;case 1:if(!dc&&(pc(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)}Dc(e,t,n);break;case 21:Dc(e,t,n);break;case 22:n.mode&1?(dc=(r=dc)||n.memoizedState!==null,Dc(e,t,n),dc=r):Dc(e,t,n);break;default:Dc(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ac(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:Tc=c.stateNode,Ec=!1;break a;case 3:Tc=c.stateNode.containerInfo,Ec=!0;break a;case 4:Tc=c.stateNode.containerInfo,Ec=!0;break a}c=c.return}if(Tc===null)throw Error(r(160));Oc(o,s,a),Tc=null,Ec=!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;)jc(t,e),t=t.sibling}function jc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ac(t,e),Mc(e),i&4){try{_c(3,e,e.return),vc(3,e)}catch(t){$(e,e.return,t)}try{_c(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return);break;case 5:if(Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return),e.flags&32){var a=e.stateNode;try{V(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&&ge(a,o),Pe(c,s);var u=Pe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?je(a,f):d===`dangerouslySetInnerHTML`?De(a,f):d===`children`?V(a,f):S(a,d,f,u)}switch(c){case`input`:z(a,o);break;case`textarea`:Se(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?B(a,!!o.multiple,o.multiple?[]:``,!1):B(a,!!o.multiple,o.defaultValue,!0)):B(a,!!o.multiple,m,!1)}a[ji]=o}catch(t){$(e,e.return,t)}}break;case 6:if(Ac(t,e),Mc(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(Ac(t,e),Mc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{cn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:Ac(t,e),Mc(e);break;case 13:Ac(t,e),Mc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=U())),i&4&&kc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(dc=(u=dc)||d,Ac(t,e),dc=u):Ac(t,e),Mc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Z=e,d=e.child;d!==null;){for(f=Z=d;Z!==null;){switch(p=Z,m=p.child,p.tag){case 0:case 11:case 14:case 15:_c(4,p,p.return);break;case 1:pc(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:pc(p,p.return);break;case 22:if(p.memoizedState!==null){Ic(f);continue}}m===null?Ic(f):(m.return=p,Z=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=Ae(`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:Ac(t,e),Mc(e),i&4&&kc(e);break;case 21:break;default:Ac(t,e),Mc(e)}}function Mc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(xc(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&&(V(a,``),i.flags&=-33),wc(e,Sc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Cc(e,Sc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nc(e,t,n){Z=e,Pc(e,t,n)}function Pc(e,t,n){for(var r=(e.mode&1)!=0;Z!==null;){var i=Z,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||uc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||dc;s=uc;var l=dc;if(uc=o,(dc=c)&&!l)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Lc(i):(c.return=o,Z=c);for(;a!==null;)Z=a,Pc(a,t,n),a=a.sibling;Z=i,uc=s,dc=l}Fc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Fc(e,t,n)}}function Fc(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:dc||vc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!dc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:gs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&ao(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}ao(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&&cn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}dc||t.flags&512&&yc(t)}catch(e){$(t,t.return,e)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ic(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Lc(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{vc(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{yc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{yc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){Z=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Z=s;break}Z=t.return}}var Rc=Math.ceil,zc=C.ReactCurrentDispatcher,Bc=C.ReactCurrentOwner,Vc=C.ReactCurrentBatchConfig,Q=0,Hc=null,Uc=null,Wc=0,Gc=0,Kc=Hi(0),qc=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return Q&6?U():dl===-1?dl=U():dl}function ml(e){return e.mode&1?Q&2&&Wc!==0?Wc&-Wc:ja.transition===null?(e=W,e===0?(e=window.event,e=e===void 0?16:gn(e.type),e):e):(fl===0&&(fl=Nt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));Ft(e,n,i),(!(Q&2)||e!==Hc)&&(e===Hc&&(!(Q&2)&&(Xc|=n),qc===4&&xl(e,Wc)),gl(e,i),n===1&&Q===0&&!(t.mode&1)&&(tl=U()+500,ta&&aa()))}function gl(e,t){var n=e.callbackNode;jt(e,t);var r=kt(e,e===Hc?Wc:0);if(r===0)n!==null&&ut(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ut(n),t===1)e.tag===0?ia(Sl.bind(null,e)):ra(Sl.bind(null,e)),wi(function(){!(Q&6)&&aa()}),n=null;else{switch(Rt(r)){case 1:n=mt;break;case 4:n=ht;break;case 16:n=gt;break;case 536870912:n=vt;break;default:n=gt}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,Q&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=kt(e,e===Hc?Wc: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();(Hc!==e||Wc!==t)&&(nl=null,tl=U()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ha(),zc.current=o,Q=a,Uc===null?(Hc=null,Wc=0,t=qc):t=0}if(t!==0){if(t===2&&(a=Mt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,U()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Mt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,U()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-U(),10<t)){if(kt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=xi(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-St(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=U()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Rc(i/1960))-i,10<i){e.timeoutHandle=xi(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,U()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,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(!Er(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&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-St(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(Q&6)throw Error(r(327));Ll();var t=kt(e,0);if(!(t&1))return gl(e,U()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Mt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,U()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,U()),null}function Cl(e,t){var n=Q;Q|=1;try{return e(t)}finally{Q=n,Q===0&&(tl=U()+500,ta&&aa())}}function wl(e){sl!==null&&sl.tag===0&&!(Q&6)&&Ll();var t=Q;Q|=1;var n=Vc.transition,r=W;try{if(Vc.transition=null,W=1,e)return e()}finally{W=r,Vc.transition=n,Q=t,!(Q&6)&&aa()}}function Tl(){Gc=Kc.current,K(Kc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Si(n)),Uc!==null)for(n=Uc.return;n!==null;){var r=n;switch(va(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Yi();break;case 3:po(),K(Gi),K(Wi),vo();break;case 5:ho(r);break;case 4:po();break;case 13:K(Y);break;case 19:K(Y);break;case 10:Ua(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Hc=e,Uc=e=Yl(e.current,null),Wc=Gc=t,qc=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,qa!==null){for(t=0;t<qa.length;t++)if(n=qa[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}qa=null}return e}function Dl(e,t){do{var n=Uc;try{if(Ha(),yo.current=fs,wo){for(var i=X.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}wo=!1}if(xo=0,Co=So=X=null,To=!1,Eo=0,Bc.current=null,n===null||n.return===null){qc=1,Jc=t,Uc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Wc,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=As(s);if(m!==null){m.flags&=-257,js(m,s,c,o,t),m.mode&1&&ks(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)){ks(o,u,t),kl();break a}l=Error(r(426))}}else if(J&&c.mode&1){var _=As(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),js(_,s,c,o,t),Aa(Cs(l,c));break a}}o=l=Cs(l,c),qc!==4&&(qc=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ds(o,l,t);ro(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`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Os(o,c,t);ro(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,Uc===n&&n!==null&&(Uc=n=n.return);continue}break}while(1)}function Ol(){var e=zc.current;return zc.current=fs,e===null?fs:e}function kl(){(qc===0||qc===3||qc===2)&&(qc=4),Hc===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Hc,Wc)}function Al(e,t){var n=Q;Q|=2;var i=Ol();(Hc!==e||Wc!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ha(),Q=n,zc.current=i,Uc!==null)throw Error(r(261));return Hc=null,Wc=0,qc}function jl(){for(;Uc!==null;)Nl(Uc)}function Ml(){for(;Uc!==null&&!dt();)Nl(Uc)}function Nl(e){var t=Ul(e.alternate,e,Gc);e.memoizedProps=e.pendingProps,t===null?Pl(e):Uc=t,Bc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lc(n,t),n!==null){n.flags&=32767,Uc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qc=6,Uc=null;return}}else if(n=cc(n,t,Gc),n!==null){Uc=n;return}if(t=t.sibling,t!==null){Uc=t;return}Uc=t=e}while(t!==null);qc===0&&(qc=5)}function Fl(e,t,n){var r=W,i=Vc.transition;try{Vc.transition=null,W=1,Il(e,t,n,r)}finally{Vc.transition=i,W=r}return null}function Il(e,t,n,i){do Ll();while(sl!==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(It(e,o),e===Hc&&(Uc=Hc=null,Wc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Wl(gt,function(){return Ll(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Vc.transition,Vc.transition=null;var s=W;W=1;var c=Q;Q|=4,Bc.current=null,gc(e,n),jc(n,e),Nr(yi),un=!!vi,yi=vi=null,e.current=n,Nc(n,e,a),ft(),Q=c,W=s,Vc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),xt(n.stateNode,i),gl(e,U()),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(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,aa(),null}function Ll(){if(sl!==null){var e=Rt(cl),t=Vc.transition,n=W;try{if(Vc.transition=null,W=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,Q&6)throw Error(r(331));var a=Q;for(Q|=4,Z=e.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Z=u;Z!==null;){var d=Z;switch(d.tag){case 0:case 11:case 15:_c(8,d,o)}var f=d.child;if(f!==null)f.return=d,Z=f;else for(;Z!==null;){d=Z;var p=d.sibling,m=d.return;if(bc(d),d===u){Z=null;break}if(p!==null){p.return=m,Z=p;break}Z=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)}}Z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Z=s;else b:for(;Z!==null;){if(o=Z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_c(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Z=v;break b}Z=o.return}}var y=e.current;for(Z=y;Z!==null;){s=Z;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Z=b;else b:for(s=y;Z!==null;){if(c=Z,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:vc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){Z=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Z=x;break b}Z=c.return}}if(Q=a,aa(),bt&&typeof bt.onPostCommitFiberRoot==`function`)try{bt.onPostCommitFiberRoot(yt,e)}catch{}i=!0}return i}finally{W=n,Vc.transition=t}}return!1}function Rl(e,t,n){t=Cs(n,t),t=Ds(e,t,1),e=to(e,t,1),t=pl(),e!==null&&(Ft(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`&&(al===null||!al.has(r))){e=Cs(n,e),e=Os(t,e,1),t=to(t,e,1),e=pl(),t!==null&&(Ft(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=pl(),e.pingedLanes|=e.suspendedLanes&n,Hc===e&&(Wc&n)===n&&(qc===4||qc===3&&(Wc&130023424)===Wc&&500>U()-el?El(e,0):Zc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Dt,Dt<<=1,!(Dt&130023424)&&(Dt=4194304)):t=1);var n=pl();e=Xa(e,t),e!==null&&(Ft(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||Gi.current)Ns=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ns=!1,nc(e,t,n);Ns=!!(e.flags&131072)}else Ns=!1,J&&t.flags&1048576&&ga(t,la,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=qi(t,Wi.current);Ga(t,n),a=Ao(null,t,i,e,a,n);var o=jo();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,Ji(i)?(o=!0,Qi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Qa(t),a.updater=vs,t.stateNode=a,a._reactInternals=t,Ss(t,i,e,n),t=Hs(null,t,i,!0,o,n)):(t.tag=0,J&&o&&_a(t),Ps(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=gs(i,e),a){case 0:t=Bs(null,t,i,e,n);break a;case 1:t=Vs(null,t,i,e,n);break a;case 11:t=Fs(null,t,i,e,n);break a;case 14:t=Is(null,t,i,gs(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:gs(i,a),Bs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Vs(e,t,i,a,n);case 3:a:{if(Us(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,$a(e,t),io(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=Cs(Error(r(423)),t),t=Ws(e,t,i,n,a);break a}else if(i!==a){a=Cs(Error(r(424)),t),t=Ws(e,t,i,n,a);break a}else for(ba=Di(t.stateNode.containerInfo.firstChild),ya=t,J=!0,xa=null,n=La(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ka(),i===a){t=tc(e,t,n);break a}Ps(e,t,i,n)}t=t.child}return t;case 5:return mo(t),e===null&&Ta(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,bi(i,a)?s=null:o!==null&&bi(i,o)&&(t.flags|=32),zs(e,t),Ps(e,t,s,n),t.child;case 6:return e===null&&Ta(t),null;case 13:return qs(e,t,n);case 4:return fo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ia(t,null,i,n):Ps(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Fs(e,t,i,a,n);case 7:return Ps(e,t,t.pendingProps,n),t.child;case 8:return Ps(e,t,t.pendingProps.children,n),t.child;case 12:return Ps(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,q(Ra,i._currentValue),i._currentValue=s,o!==null)if(Er(o.value,s)){if(o.children===a.children&&!Gi.current){t=tc(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=eo(-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),Wa(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),Wa(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}Ps(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ga(t,n),a=Ka(a),i=i(a),t.flags|=1,Ps(e,t,i,n),t.child;case 14:return i=t.type,a=gs(i,t.pendingProps),a=gs(i.type,a),Is(e,t,i,a,n);case 15:return Ls(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),ec(e,t),t.tag=1,Ji(i)?(e=!0,Qi(t)):e=!1,Ga(t,n),bs(t,i,a),Ss(t,i,a,n),Hs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Rs(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return lt(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===j)return 11;if(e===N)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 E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case ee:return e=Kl(19,n,t,a),e.elementType=ee,e.lanes=o,e;case te:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case N:s=14;break a;case P: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=te,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=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(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},Qa(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 Ui;e=e._reactInternals;a:{if(rt(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(Ji(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(Ji(n))return Zi(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=pl(),i=ml(n),a=eo(r,i),a.callback=t??null,to(n,a,i),e.current.lanes=i,Ft(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=eo(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=to(i,t,o),e!==null&&(hl(e,i,o,a),no(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[Mi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zt.length&&t!==0&&t<Zt[n].priority;n++);Zt.splice(n,0,e),n===0&&nn(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[Mi]=o.current,oi(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[Mi]=c.current,oi(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)}zt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ot(t.pendingLanes);n!==0&&(Lt(t,n|1),gl(t,U()),!(Q&6)&&(tl=U()+500,aa()))}break;case 13:wl(function(){var t=Xa(e,1);t!==null&&hl(t,e,1,pl())}),lu(e,1)}},Bt=function(e){if(e.tag===13){var t=Xa(e,134217728);t!==null&&hl(t,e,134217728,pl()),lu(e,134217728)}},Vt=function(e){if(e.tag===13){var t=ml(e),n=Xa(e,t);n!==null&&hl(n,e,t,pl()),lu(e,t)}},Ht=function(){return W},Ut=function(e,t){var n=W;try{return W=e,t()}finally{W=n}},Le=function(e,t,n){switch(t){case`input`:if(z(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=zi(i);if(!a)throw Error(r(90));R(i),z(i,a)}}}break;case`textarea`:Se(e,n);break;case`select`:t=n.value,t!=null&&B(e,!!n.multiple,t,!1)}},Ue=Cl,We=wl;var yu={usingClientEntryPoint:!1,Events:[Li,Ri,zi,Ve,He,Cl]},bu={findFiberByHostInstance:Ii,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=st(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{yt=Su.inject(xu),bt=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[Mi]=t.current,oi(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=st(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[Mi]=t.current,oi(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[Mi]=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=new Map;function y(e){return`livelocale:${e}`}function b(e){try{return localStorage.getItem(y(e))}catch{return v.get(e)??null}}function x(e,t){t===null?v.delete(e):v.set(e,t);try{t===null?localStorage.removeItem(y(e)):localStorage.setItem(y(e),t)}catch{}}function S(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.left=`-1000px`;try{return document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}async function C(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return S(e)}var w=3e4;function T(e,t){let n=URL.createObjectURL(new Blob([t],{type:`text/plain;charset=utf-8`})),r=document.createElement(`a`);r.href=n,r.download=e,r.style.display=`none`;let i=()=>{r.remove(),URL.revokeObjectURL(n)};try{document.body.appendChild(r),r.click()}catch(e){throw i(),e}setTimeout(i,w)}var E=[`en`,`ar`],D=[`system`,`light`,`dark`],O=new Set([`ar`,`arz`,`ary`,`arq`,`aeb`,`apc`,`ajp`,`acm`,`afb`,`ayl`,`ars`]);function k(e){return E.includes(e)}function A(e){return D.includes(e)}function j(){let e=b(`studio-language`);return k(e)?e:null}function M(){let e=b(`studio-theme`);return A(e)?e:null}function ee(e){x(`studio-language`,e)}function N(e){x(`studio-theme`,e)}function P(e){if(!e)return!1;let t=e.split(/[-_]/)[0].toLowerCase();return O.has(t)}function te(e){return k(e.stored)?e.stored:e.isShareStudio&&P(e.browserLanguage)?`ar`:`en`}function ne(e){return e?`system`:`dark`}function re(e){return A(e.stored)?e.stored:ne(e.isShareStudio)}var F={"common.arrow":`→`,"language.switch_to_ar":`العربية: show the Studio in Arabic`,"language.switch_to_en":`English: show the Studio in English`,"tips.title":`Welcome to LiveLocale`,"tips.step1":`Hold Alt/Option and click any text.`,"tips.step2":`Type your fix. The page updates as you type, and your changes are kept in this browser.`,"tips.step3":`When you are done, press Send to developer and paste the link to your developer.`,"tips.name_label":`Your name (optional, credited in the pull request)`,"tips.start":`Start editing`,"drafts.unsent":{one:`1 change not sent`,other:`{count} changes not sent`},"send.title":`Send to developer`,"send.name_label":`Your name`,"send.note_label":`Note for the developer (optional)`,"send.include_sent":{one:`Also include 1 change already sent`,other:`Also include {count} changes already sent`},"send.nothing_to_send":`There are no changes to send.`,"send.empty":`empty`,"send.overflow":{one:`1 of {total} changes is in this link. Send again for the rest.`,other:`{count} of {total} changes are in this link. Send again for the rest.`},"send.encode_failed":`Could not create the link: {reason}`,"send.too_long":`This batch is too long for a chat message. Use Download file instead.`,"send.copy":`Copy link`,"send.link_label":`Change link`,"send.download":`Download file`,"send.close":`Close`,"send.open_github":`Open on GitHub`,"send.github_hint":`Press “Submit new issue” on GitHub. A pull-request link appears as a comment about a minute later.`,"send.copied":`Link copied. Paste it to your developer in chat or email.`,"send.downloaded":`File saved. Send it to your developer.`,"send.opened":`GitHub opened in a new tab.`,"send.copy_failed":`Copy did not work in this browser. Select the link above, copy it, then press “I copied it”.`,"send.copied_confirm":`I copied it`,"send.mark_failed":`Could not mark the changes as sent.`,"send.save_failed":`Could not save the file.`,"link_error.not_found":`This is not a LiveLocale change link. A change link contains "lc1.".`,"link_error.ambiguous":`This text holds more than one change link. Paste one link at a time.`,"link_error.damaged":`This change link is damaged or incomplete, which happens when an email or chat app breaks a long link. Ask the sender to send the file instead.`,"link_error.too_big":`This change link is larger than LiveLocale accepts (500 changes, 512 KB).`,"link_error.unsupported_version":`This change link was made by a newer LiveLocale. Update the site and try again.`,"link_error.unsupported_environment":`This browser cannot create or read change links. Use a current Chrome, Edge or Firefox, or Safari 16.4 or later.`,"link_error.unreadable":`Could not read the change link.`,"backup.too_many":`More than {max} changes: send some of them first, then download the backup.`,"backup.no_link":`No change link found in this file.`,"backup.restored":{other:`Restored {count} changes ({skipped} already here).`},"header.tagline":`Live Visual Translation Studio`,"header.locale_unset":`Language: not chosen yet`,"header.editing":`Editing: {locale}`,"header.viewing":`Viewing: {locale}`,"header.source_content":`detected from page text`,"header.source_url":`from the page address`,"header.source_manual":`chosen by you`,"header.source_remembered":`from your last visit`,"header.mismatch":`This text looks like {locale}.`,"header.switch_locale":`Switch to {locale}`,"header.coverage":`Coverage`,"header.coverage_title":`{percent}% of keys translated`,"header.preview":`PREVIEW`,"header.preview_title":`Edits go to a git branch on the server; nothing is written locally.`,"header.reviewing":{one:`Reviewing 1 proposed change`,other:`Reviewing {count} proposed changes`},"header.close_review":`Close review`,"header.unsent_title":`Saved in this browser only. Send them to your developer before you leave.`,"header.send":`Send to developer`,"header.send_title":`Turn your changes into a link or file for your developer`,"header.import":`Import change link`,"header.import_title":`Review a translator's change link and apply it to your local files`,"header.changes":`Changes`,"header.changes_title":`Review, commit, or undo locale changes`,"header.beta":`(BETA)`,"theme.group":`Theme`,"theme.system":`System theme`,"theme.light":`Light theme`,"theme.dark":`Dark theme`,"layout.keys":`Keys`,"layout.review":`Review`,"layout.editor":`Editor`,"keys.title":`Locale Directory`,"keys.count":{other:`{count} keys`},"keys.search":`Search keys or values...`,"keys.search_label":`Search keys or values`,"keys.scope":`Scope`,"keys.all":`All Keys`,"keys.page":`Page Keys`,"keys.page_waiting":`Waiting for preview connection...`,"keys.page_title":`Only show keys on the current page`,"keys.missing":`Missing`,"keys.empty_value":`Empty`,"keys.none":`No keys found`,"viewer.status":`Status`,"viewer.status_connected":`ACTIVE`,"viewer.status_connecting":`CONNECTING`,"viewer.reload":`Reload Frame`,"viewer.connecting_title":`Connecting to Project`,"viewer.connecting_body":`Waiting for client bridge initialization...`,"viewer.slow_title":`Still connecting? Usual causes:`,"viewer.cause_not_running":`The app is not running at {origin}.`,"viewer.cause_framing":`The app blocks framing: its {csp} or {xfo} header must allow {studio}.`,"viewer.cause_provider":`{provider} is not mounted, or LiveLocale is off in the app (preview builds need {env}).`,"viewer.run_doctor":`Run {command} to check.`,"viewer.preview_blocked":`The app preview is unavailable until the setup problem above is fixed.`,"empty.title":`Select an Element`,"empty.body":`Hover over elements in the live preview iframe and click to load them into the visual editing sidebar.`,"setup.title":`Saving will fail until the server setup is fixed:`,"setup.manifest_missing":`This Studio was opened from a website, but livelocale/manifest.json is missing or is not a LiveLocale manifest. Rebuild with share: true (or run livelocale pack) and upload the whole livelocale/ folder.`,"share.storage_problem":`This browser cannot keep your changes after the tab closes (private window or blocked storage). Send them before you leave.`,"share.locale_actions_unsupported":`Adding, renaming or deleting languages is not available on a share link. Ask your developer.`,"share.commit_unsupported":`Use "Send to developer" to hand your changes over.`,"share.load_failed":`Could not load {path} ({status}).`,"share.unknown_language":`Unknown language "{locale}".`,"editor.title":`Translation Studio`,"editor.manage":`Manage Languages`,"editor.back":`Back to Editor`,"editor.locale":`Locale`,"editor.lang_en":`English`,"editor.lang_ar":`Arabic`,"editor.lang_es":`Spanish`,"editor.lang_fr":`French`,"editor.lang_de":`German`,"editor.lang_zh":`Chinese`,"editor.lang_ja":`Japanese`,"editor.lang_pt":`Portuguese`,"editor.lang_it":`Italian`,"editor.lang_ru":`Russian`,"editor.lang_hi":`Hindi`,"editor.lang_tr":`Turkish`,"editor.lang_custom":`Custom`,"editor.key":`Translation Key`,"editor.clear":`Clear Selection`,"editor.reference":`Reference (Fallback Value)`,"editor.reference_none":`None`,"editor.placeholders":`Placeholders`,"editor.chip_present":`Placeholder from the reference, present in your translation`,"editor.chip_missing":`Placeholder from the reference is missing from your translation`,"editor.chip_extra":`Placeholder not present in the reference`,"editor.plural_forms":`Plural forms`,"editor.output":`Translation Output`,"editor.translation_label":`Translation`,"editor.edit_forms":`Edit forms`,"editor.edit_raw":`Edit raw`,"editor.input_placeholder":`Type your translation here...`,"editor.save_anyway":`Save anyway`,"editor.keep_editing":`Keep editing`,"editor.saving":`Saving...`,"editor.saved":`Saved!`,"editor.saved_status":`Saved`,"editor.save":`Save Changes`,"plural.on":`on`,"plural.offset":`· offset {offset}`,"plural.hash":`= the number`,"plural.before":`Before`,"plural.after":`After`,"plural.desc_zero":`zero (e.g. 0)`,"plural.desc_one":`one (singular)`,"plural.desc_two":`two (dual)`,"plural.desc_few":`few (small numbers)`,"plural.desc_many":`many (large numbers)`,"plural.desc_other":`other (default, required)`,"plural.desc_explicit":`explicit case`,"plural.needed":`needed for {locale}`,"locales.add_label":`Add New Locale`,"locales.add_placeholder":`e.g. fr, es-MX`,"locales.add":`Add`,"locales.format_hint":`Locale format must be 2-3 letters, optionally followed by a region (e.g., fr or es-MX).`,"locales.exists":`Locale already exists.`,"locales.list":`Active Locales`,"locales.invalid":`Invalid locale format.`,"locales.target_exists":`Target locale already exists.`,"locales.rename_failed":`Failed to rename.`,"locales.delete_failed":`Failed to delete.`,"locales.save_rename":`Save rename`,"locales.cancel":`Cancel`,"locales.confirm_delete":`Confirm deletion? This deletes the translation file.`,"locales.delete":`Delete`,"locales.active":`ACTIVE WORKSPACE`,"locales.rename_title":`Rename locale code`,"locales.delete_title":`Delete locale`,"locales.rename_aria":`Rename locale {code}`,"locales.delete_aria":`Delete locale {code}`,"locales.new_code_aria":`New code for {code}`,"picker.title":`Which language are you editing?`,"picker.body":`LiveLocale could not tell from the page. Your fix will be saved to the language you pick.`,"picker.cancel":`Cancel`,"confirm.title":`Unsaved Changes`,"confirm.body":`You have unsaved edits in your translation. Selecting another element will discard these modifications. Do you want to discard your edits?`,"confirm.keep":`Keep Editing`,"confirm.discard":`Discard Edits`,"token.title":`Access token required`,"token.body":`This app runs LiveLocale in preview mode. Paste the access token configured on the server ({env}) to edit translations. It is kept in this browser tab only.`,"token.label":`Access token`,"token.connect":`Connect`,"errors.undo_failed":`Undo failed.`,"errors.save_failed":`Failed to save translation.`,"errors.add_locale_failed":`Failed to add locale.`,"errors.rename_locale_failed":`Failed to rename locale.`,"errors.delete_locale_failed":`Failed to delete locale.`,"errors.git_status_failed":`Failed to read git status.`,"errors.commit_failed":`Commit failed.`,"errors.discard_failed":`Discard failed.`,"errors.locale_unknown":`Could not tell which language to edit.`,"errors.client_error":`Client-side error occurred.`,"errors.backup_share_only":`Backups work only on a share link.`,"errors.unauthorized":`Unauthorized`,"errors.translation_rejected":`The translation was rejected.`,"errors.server_status":`Server responded with status {status}`,"changes.title":`Changes`,"changes.refresh":`Refresh`,"changes.close":`Close`,"changes.locale_files":`Locale files`,"changes.changed":{other:`{count} changed`},"changes.loading":`Loading git status…`,"changes.git_disabled":`Git integration is disabled for this handler. Enable it by removing {code} from the route configuration.`,"changes.not_repo":`The locales directory is not inside a git repository, or the {code} command is not on PATH.`,"changes.clean":`Working tree is clean. Edits you save will show up here.`,"changes.status_modified":`modified`,"changes.status_added":`added`,"changes.status_deleted":`deleted`,"changes.status_renamed":`renamed`,"changes.show_diff":`Show diff`,"changes.hide_diff":`Hide diff`,"changes.propose":`Propose`,"changes.commit_section":`Commit`,"changes.commit_label":`Commit message`,"changes.view_pr":`View the open pull request`,"changes.placeholder_branch_clean":`No changes on the branch yet`,"changes.placeholder_nothing":`Nothing to commit`,"changes.placeholder_pr":`Pull request title, e.g. "Update checkout copy"`,"changes.placeholder_commit":`i18n: describe the copy change…`,"changes.working":`Working…`,"changes.pr_open":`Pull request is open`,"changes.open_pr":`Open pull request`,"changes.commit":`Commit locale changes`,"changes.reset_branch":`Reset branch`,"changes.discard":`Discard`,"changes.reset_to_base":`Reset to base`,"changes.discard_all":`Discard all`,"changes.keep":`Keep`,"changes.pull_request":`Pull request:`,"changes.committed":`Committed as {hash}. Push whenever you are ready.`,"changes.session":`This session`,"changes.edits":{other:`{count} edits`},"changes.no_edits":`No edits saved yet in this session.`,"changes.undo":`Undo`,"changes.undo_title":`Restore the previous value`,"changes.restore_aria":`Undo: restore the previous value of {key}`,"changes.empty":`empty`,"draft_list.title":`Your changes`,"draft_list.none":`No changes yet. Alt+Click any text in the app to fix it.`,"draft_list.status_unsent":`Not sent`,"draft_list.status_sent":`Sent`,"draft_list.status_live":`Live now`,"draft_list.status_conflict":`Changed by someone else, please check`,"draft_list.undo":`Undo`,"draft_list.undo_title":`Go back to the published text`,"draft_list.remove":`Remove`,"draft_list.remove_title":`Removes it from this list. A link you already sent still carries it.`,"draft_list.undo_aria":`Undo: go back to the published text of {key} ({locale})`,"draft_list.remove_aria":`Remove: take {key} ({locale}) off this list`,"draft_list.empty":`empty`,"draft_list.dismiss_live":`Dismiss live changes`,"draft_list.download":`Download backup`,"draft_list.restore":`Restore backup`,"draft_list.review":`Review a change link or file`,"draft_list.backup_downloaded":`Backup downloaded.`,"draft_list.backup_failed":`Could not create the backup.`,"draft_list.restore_failed":`Could not restore the backup.`,"review.status_apply":`Ready`,"review.status_already":`Already applied`,"review.status_conflict":`Changed since`,"review.status_invalid":`Invalid`,"review.status_needs_force":`Saved with “Save anyway”`,"review.saved_anyway":`Saved with “Save anyway”.`,"review.no_link":`No change link found. A change link contains "lc1.".`,"review.forced_not_included":`Saved with “Save anyway”; tick the box to include it.`,"review.source_failed":`The source locale "{locale}" could not be loaded.`,"review.title":`Review`,"review.close":`Close review`,"review.error_title":`This change link cannot be opened:`,"review.opening":`Opening the change link…`,"review.from":`From {by}`,"review.from_note":`From {by}: {note}`,"review.from_translator":`From the translator`,"review.from_translator_note":`From the translator: {note}`,"review.summary_count":`{count} {status}`,"review.create_pr":`Create pull request`,"review.change_repo":`Change`,"review.github_hint":`Then press Submit on GitHub. The pull request opens in about a minute.`,"review.apply_local":{one:`Apply 1 change to local files`,other:`Apply {count} changes to local files`},"review.include_forced":{one:`Include 1 change saved with “Save anyway”`,other:`Include {count} changes saved with “Save anyway”`},"review.command_title":`Apply with the command line`,"review.copy_command":`Copy command`,"review.copy_link":`Copy link`,"review.copied":`Copied.`,"review.copy_failed":`Copy did not work in this browser. Select the text above and copy it.`,"review.apply_hint":`Run it in the repository. It opens a pull request with your git and gh, on any git host.`,"review.run_workflow_hint":`Issues turned off? {path}, then paste the link.`,"review.col_language":`Language`,"review.col_key":`Key`,"review.col_before":`Before`,"review.col_after":`After`,"review.col_check":`Check`,"review.show_locale":`Show the page in {locale}`,"review.now_on_site":`Now on the site:`,"review.result_applied":`Applied`,"review.result_failed":`Failed: {message}`,"review.apply_summary":`Apply finished: {applied} applied, {skipped} skipped, {failed} failed.`,"review.result_skipped":`Skipped: {reason}`,"review.empty":`empty`,"repo.question":`Which GitHub repository should get the pull request?`,"repo.malformed":`Enter it as owner/repo, for example acme/website.`,"repo.save":`Save`,"issue.too_large":`Too large for a GitHub issue. Run {command} with this link instead.`,"issue.copy_block":`Copy change block`,"issue.open_and_paste":`Open GitHub and paste`,"issue.copy_failed":`Copying did not work. Copy the block below, then open GitHub and paste it.`,"issue.manual_copy_label":`Issue text to copy`,"import.title":`Import change link`,"import.body":`Review a translator’s changes before they are written to your local files.`,"import.paste_label":`Paste a change link`,"import.file_label":`or choose a file`,"import.file_failed":`This file could not be read. Paste the link instead.`,"import.cancel":`Cancel`,"import.submit":`Review changes`},ie={"common.arrow":`←`,"language.switch_to_ar":`العربية: عرض الاستوديو بالعربية`,"language.switch_to_en":`English: عرض الاستوديو بالإنجليزية`,"tips.title":`مرحبًا بك في LiveLocale`,"tips.step1":`اضغط مع الاستمرار على مفتاح Alt (أو Option في ماك) وانقر على أي نص.`,"tips.step2":`اكتب التصحيح، وستتحدّث الصفحة أثناء الكتابة، وتُحفظ تغييراتك في هذا المتصفح.`,"tips.step3":`عند الانتهاء، اضغط «إرسال إلى المطوّر» ثم أرسل الرابط إلى المطوّر.`,"tips.name_label":`اسمك (اختياري، يُذكر في طلب الدمج)`,"tips.start":`ابدأ التعديل`,"drafts.unsent":{zero:`لا توجد تغييرات غير مرسلة`,one:`تغيير واحد لم يُرسل`,two:`تغييران لم يُرسلا`,few:`{count} تغييرات لم تُرسل`,many:`{count} تغييرًا لم يُرسل`,other:`{count} تغيير لم يُرسل`},"send.title":`إرسال إلى المطوّر`,"send.name_label":`اسمك`,"send.note_label":`ملاحظة للمطوّر (اختيارية)`,"send.include_sent":{zero:`أضف أيضًا التغييرات المرسلة من قبل`,one:`أضف أيضًا التغيير المرسل من قبل`,two:`أضف أيضًا التغييرين المرسلين من قبل`,few:`أضف أيضًا {count} تغييرات مرسلة من قبل`,many:`أضف أيضًا {count} تغييرًا مرسلًا من قبل`,other:`أضف أيضًا {count} تغيير مرسل من قبل`},"send.nothing_to_send":`لا توجد تغييرات لإرسالها.`,"send.empty":`فارغ`,"send.overflow":{zero:`لا يحمل هذا الرابط أي تغيير من {total}. أرسل مرة أخرى لبقية التغييرات.`,one:`يحمل هذا الرابط تغييرًا واحدًا من {total}. أرسل مرة أخرى لبقية التغييرات.`,two:`يحمل هذا الرابط تغييرين من {total}. أرسل مرة أخرى لبقية التغييرات.`,few:`يحمل هذا الرابط {count} تغييرات من {total}. أرسل مرة أخرى لبقية التغييرات.`,many:`يحمل هذا الرابط {count} تغييرًا من {total}. أرسل مرة أخرى لبقية التغييرات.`,other:`يحمل هذا الرابط {count} تغيير من {total}. أرسل مرة أخرى لبقية التغييرات.`},"send.encode_failed":`تعذّر إنشاء الرابط: {reason}`,"send.too_long":`هذه الدفعة أطول من أن تُرسل في رسالة دردشة. استخدم «تنزيل الملف» بدلًا من ذلك.`,"send.copy":`نسخ الرابط`,"send.link_label":`رابط التغييرات`,"send.download":`تنزيل الملف`,"send.close":`إغلاق`,"send.open_github":`فتح في GitHub`,"send.github_hint":`اضغط «Submit new issue» في GitHub، وسيظهر رابط طلب الدمج في تعليق بعد دقيقة تقريبًا.`,"send.copied":`نُسخ الرابط. ألصقه للمطوّر في الدردشة أو البريد الإلكتروني.`,"send.downloaded":`حُفظ الملف. أرسله إلى المطوّر.`,"send.opened":`فُتح GitHub في علامة تبويب جديدة.`,"send.copy_failed":`لم ينجح النسخ في هذا المتصفح. حدّد الرابط أعلاه وانسخه، ثم اضغط «نسختُه».`,"send.copied_confirm":`نسختُه`,"send.mark_failed":`تعذّر وضع علامة «مُرسل» على التغييرات.`,"send.save_failed":`تعذّر حفظ الملف.`,"link_error.not_found":`هذا ليس رابط تغييرات من LiveLocale. يحتوي رابط التغييرات على "lc1.".`,"link_error.ambiguous":`يحتوي هذا النص على أكثر من رابط تغييرات. ألصق رابطًا واحدًا في كل مرة.`,"link_error.damaged":`رابط التغييرات هذا تالف أو ناقص، ويحدث ذلك حين يقطع تطبيق بريد أو دردشة رابطًا طويلًا. اطلب من المرسل أن يرسل الملف بدلًا منه.`,"link_error.too_big":`رابط التغييرات هذا أكبر مما يقبله LiveLocale (500 تغيير، 512 كيلوبايت).`,"link_error.unsupported_version":`أُنشئ رابط التغييرات هذا بإصدار أحدث من LiveLocale. حدّث الموقع ثم حاول مرة أخرى.`,"link_error.unsupported_environment":`لا يستطيع هذا المتصفح إنشاء روابط التغييرات أو قراءتها. استخدم إصدارًا حديثًا من Chrome أو Edge أو Firefox، أو Safari 16.4 أو أحدث.`,"link_error.unreadable":`تعذّرت قراءة رابط التغييرات.`,"backup.too_many":`أكثر من {max} تغيير: أرسل بعضها أولًا، ثم نزّل النسخة الاحتياطية.`,"backup.no_link":`لا يوجد رابط تغييرات في هذا الملف.`,"backup.restored":{zero:`لم يُستعد أي تغيير (الموجود هنا من قبل: {skipped}).`,one:`استُعيد تغيير واحد (الموجود هنا من قبل: {skipped}).`,two:`استُعيد تغييران (الموجود هنا من قبل: {skipped}).`,few:`استُعيدت {count} تغييرات (الموجود هنا من قبل: {skipped}).`,many:`استُعيد {count} تغييرًا (الموجود هنا من قبل: {skipped}).`,other:`استُعيد {count} تغيير (الموجود هنا من قبل: {skipped}).`},"header.tagline":`استوديو الترجمة المرئية المباشرة`,"header.locale_unset":`اللغة: لم تُختر بعد`,"header.editing":`تعديل: {locale}`,"header.viewing":`عرض: {locale}`,"header.source_content":`اكتُشفت من نص الصفحة`,"header.source_url":`من عنوان الصفحة`,"header.source_manual":`اخترتها بنفسك`,"header.source_remembered":`من زيارتك السابقة`,"header.mismatch":`يبدو أن هذا النص بلغة {locale}.`,"header.switch_locale":`التبديل إلى {locale}`,"header.coverage":`التغطية`,"header.coverage_title":`{percent}٪ من المفاتيح مترجمة`,"header.preview":`معاينة`,"header.preview_title":`تذهب التعديلات إلى فرع git على الخادم، ولا يُكتب شيء على هذا الجهاز.`,"header.reviewing":{zero:`لا توجد تغييرات مقترحة للمراجعة`,one:`مراجعة تغيير مقترح واحد`,two:`مراجعة تغييرين مقترحين`,few:`مراجعة {count} تغييرات مقترحة`,many:`مراجعة {count} تغييرًا مقترحًا`,other:`مراجعة {count} تغيير مقترح`},"header.close_review":`إغلاق المراجعة`,"header.unsent_title":`محفوظة في هذا المتصفح فقط. أرسلها إلى المطوّر قبل أن تغادر.`,"header.send":`إرسال إلى المطوّر`,"header.send_title":`حوّل تغييراتك إلى رابط أو ملف للمطوّر`,"header.import":`استيراد رابط تغييرات`,"header.import_title":`راجع رابط التغييرات من المترجم وطبّقه على ملفاتك المحلية`,"header.changes":`التغييرات`,"header.changes_title":`راجع تغييرات اللغات أو احفظها في git أو تراجع عنها`,"header.beta":`(تجريبي)`,"theme.group":`المظهر`,"theme.system":`مظهر النظام`,"theme.light":`المظهر الفاتح`,"theme.dark":`المظهر الداكن`,"layout.keys":`المفاتيح`,"layout.review":`المراجعة`,"layout.editor":`المحرّر`,"keys.title":`دليل المفاتيح`,"keys.count":{zero:`لا مفاتيح`,one:`مفتاح واحد`,two:`مفتاحان`,few:`{count} مفاتيح`,many:`{count} مفتاحًا`,other:`{count} مفتاح`},"keys.search":`ابحث في المفاتيح أو القيم...`,"keys.search_label":`ابحث في المفاتيح أو القيم`,"keys.scope":`النطاق`,"keys.all":`كل المفاتيح`,"keys.page":`مفاتيح الصفحة`,"keys.page_waiting":`بانتظار اتصال المعاينة...`,"keys.page_title":`اعرض مفاتيح الصفحة الحالية فقط`,"keys.missing":`مفقود`,"keys.empty_value":`فارغ`,"keys.none":`لا توجد مفاتيح مطابقة`,"viewer.status":`الحالة`,"viewer.status_connected":`متصل`,"viewer.status_connecting":`جارٍ الاتصال`,"viewer.reload":`إعادة تحميل الإطار`,"viewer.connecting_title":`جارٍ الاتصال بالمشروع`,"viewer.connecting_body":`بانتظار جاهزية جسر الاتصال في التطبيق...`,"viewer.slow_title":`ما زال الاتصال جاريًا؟ الأسباب المعتادة:`,"viewer.cause_not_running":`التطبيق لا يعمل على {origin}.`,"viewer.cause_framing":`التطبيق يمنع عرضه داخل إطار: يجب أن تسمح ترويسة {csp} أو {xfo} فيه بالعنوان {studio}.`,"viewer.cause_provider":`{provider} غير مركّب، أو LiveLocale متوقف في التطبيق (تحتاج نسخ المعاينة إلى {env}).`,"viewer.run_doctor":`شغّل {command} للتحقق.`,"viewer.preview_blocked":`معاينة التطبيق غير متاحة حتى تُصلح مشكلة الإعداد أعلاه.`,"empty.title":`اختر عنصرًا`,"empty.body":`مرّر المؤشر فوق العناصر في المعاينة المباشرة، ثم انقر لتحميلها في لوحة التحرير.`,"setup.title":`سيفشل الحفظ حتى يُصلح إعداد الخادم:`,"setup.manifest_missing":`فُتح هذا الاستوديو من موقع ويب، لكن الملف livelocale/manifest.json مفقود أو ليس ملف بيان من LiveLocale. أعد البناء مع share: true (أو شغّل livelocale pack) ثم ارفع المجلد livelocale/ كاملًا.`,"share.storage_problem":`لا يستطيع هذا المتصفح الاحتفاظ بتغييراتك بعد إغلاق التبويب (نافذة خاصة أو تخزين محظور). أرسلها قبل أن تغادر.`,"share.locale_actions_unsupported":`لا يمكن إضافة اللغات أو إعادة تسميتها أو حذفها من رابط مشاركة. اطلب ذلك من المطوّر.`,"share.commit_unsupported":`استخدم «إرسال إلى المطوّر» لتسليم تغييراتك.`,"share.load_failed":`تعذّر تحميل {path} ({status}).`,"share.unknown_language":`لغة غير معروفة: {locale}.`,"editor.title":`استوديو الترجمة`,"editor.manage":`إدارة اللغات`,"editor.back":`العودة إلى المحرّر`,"editor.locale":`اللغة`,"editor.lang_en":`الإنجليزية`,"editor.lang_ar":`العربية`,"editor.lang_es":`الإسبانية`,"editor.lang_fr":`الفرنسية`,"editor.lang_de":`الألمانية`,"editor.lang_zh":`الصينية`,"editor.lang_ja":`اليابانية`,"editor.lang_pt":`البرتغالية`,"editor.lang_it":`الإيطالية`,"editor.lang_ru":`الروسية`,"editor.lang_hi":`الهندية`,"editor.lang_tr":`التركية`,"editor.lang_custom":`مخصّصة`,"editor.key":`مفتاح الترجمة`,"editor.clear":`إلغاء التحديد`,"editor.reference":`المرجع (القيمة الاحتياطية)`,"editor.reference_none":`لا يوجد`,"editor.placeholders":`العناصر النائبة`,"editor.chip_present":`عنصر نائب من المرجع، موجود في ترجمتك`,"editor.chip_missing":`عنصر نائب من المرجع، مفقود من ترجمتك`,"editor.chip_extra":`عنصر نائب غير موجود في المرجع`,"editor.plural_forms":`صيغ الجمع`,"editor.output":`نص الترجمة`,"editor.translation_label":`الترجمة`,"editor.edit_forms":`حرّر الصيغ`,"editor.edit_raw":`حرّر النص الخام`,"editor.input_placeholder":`اكتب ترجمتك هنا...`,"editor.save_anyway":`احفظ على أي حال`,"editor.keep_editing":`تابع التحرير`,"editor.saving":`جارٍ الحفظ...`,"editor.saved":`حُفظ!`,"editor.saved_status":`حُفظ`,"editor.save":`احفظ التغييرات`,"plural.on":`على`,"plural.offset":`· الإزاحة {offset}`,"plural.hash":`= العدد`,"plural.before":`قبل`,"plural.after":`بعد`,"plural.desc_zero":`الصفر (مثل 0)`,"plural.desc_one":`المفرد`,"plural.desc_two":`المثنى`,"plural.desc_few":`الأعداد القليلة`,"plural.desc_many":`الأعداد الكثيرة`,"plural.desc_other":`الصيغة الافتراضية، مطلوبة`,"plural.desc_explicit":`حالة صريحة`,"plural.needed":`مطلوبة للغة {locale}`,"locales.add_label":`إضافة لغة جديدة`,"locales.add_placeholder":`fr, es-MX`,"locales.add":`أضف`,"locales.format_hint":`رمز اللغة حرفان أو ثلاثة، ويمكن أن تتبعه منطقة (مثل fr أو es-MX).`,"locales.exists":`هذه اللغة موجودة بالفعل.`,"locales.list":`اللغات الحالية`,"locales.invalid":`رمز اللغة غير صالح.`,"locales.target_exists":`اللغة الجديدة موجودة بالفعل.`,"locales.rename_failed":`تعذّرت إعادة التسمية.`,"locales.delete_failed":`تعذّر الحذف.`,"locales.save_rename":`احفظ الاسم الجديد`,"locales.cancel":`إلغاء`,"locales.confirm_delete":`تأكيد الحذف؟ سيُحذف ملف الترجمة.`,"locales.delete":`احذف`,"locales.active":`اللغة الحالية`,"locales.rename_title":`أعد تسمية رمز اللغة`,"locales.delete_title":`احذف اللغة`,"locales.rename_aria":`أعد تسمية اللغة {code}`,"locales.delete_aria":`احذف اللغة {code}`,"locales.new_code_aria":`الرمز الجديد للغة {code}`,"picker.title":`أي لغة تحرّر؟`,"picker.body":`لم يتمكن LiveLocale من معرفتها من الصفحة. سيُحفظ تصحيحك في اللغة التي تختارها.`,"picker.cancel":`إلغاء`,"confirm.title":`تعديلات غير محفوظة`,"confirm.body":`لديك تعديلات غير محفوظة في ترجمتك. اختيار عنصر آخر سيتجاهلها. هل تريد تجاهل تعديلاتك؟`,"confirm.keep":`تابع التحرير`,"confirm.discard":`تجاهل التعديلات`,"token.title":`مطلوب رمز وصول`,"token.body":`يعمل LiveLocale في هذا التطبيق بوضع المعاينة. الصق رمز الوصول المضبوط على الخادم ({env}) لتحرير الترجمات. يبقى في تبويب المتصفح هذا فقط.`,"token.label":`رمز الوصول`,"token.connect":`اتصل`,"errors.undo_failed":`تعذّر التراجع. حاول مرة أخرى.`,"errors.save_failed":`تعذّر حفظ الترجمة. حاول مرة أخرى.`,"errors.add_locale_failed":`تعذّرت إضافة اللغة. حاول مرة أخرى.`,"errors.rename_locale_failed":`تعذّرت إعادة تسمية اللغة. حاول مرة أخرى.`,"errors.delete_locale_failed":`تعذّر حذف اللغة. حاول مرة أخرى.`,"errors.git_status_failed":`تعذّرت قراءة حالة git.`,"errors.commit_failed":`تعذّر الحفظ في git. حاول مرة أخرى.`,"errors.discard_failed":`تعذّر تجاهل التغييرات. حاول مرة أخرى.`,"errors.locale_unknown":`تعذّر معرفة اللغة التي تحرّرها. انقر النص مرة أخرى.`,"errors.client_error":`حدث خطأ في التطبيق. أعد تحميل الإطار.`,"errors.backup_share_only":`النسخ الاحتياطية تعمل في رابط المشاركة فقط.`,"errors.unauthorized":`غير مصرّح بالدخول.`,"errors.translation_rejected":`رُفضت الترجمة.`,"errors.server_status":`ردّ الخادم برمز الحالة {status}.`,"changes.title":`التغييرات`,"changes.refresh":`تحديث`,"changes.close":`إغلاق`,"changes.locale_files":`ملفات اللغات`,"changes.changed":{zero:`لا ملفات معدّلة`,one:`ملف واحد معدّل`,two:`ملفان معدّلان`,few:`{count} ملفات معدّلة`,many:`{count} ملفًا معدّلًا`,other:`{count} ملف معدّل`},"changes.loading":`جارٍ قراءة حالة git…`,"changes.git_disabled":`تكامل git معطّل في هذا المعالج. فعّله بحذف {code} من إعدادات المسار.`,"changes.not_repo":`مجلد اللغات ليس داخل مستودع git، أو الأمر {code} غير موجود في PATH.`,"changes.clean":`لا تغييرات في شجرة العمل. ستظهر هنا التعديلات التي تحفظها.`,"changes.status_modified":`معدّل`,"changes.status_added":`مضاف`,"changes.status_deleted":`محذوف`,"changes.status_renamed":`أعيدت تسميته`,"changes.show_diff":`اعرض الفروق`,"changes.hide_diff":`أخفِ الفروق`,"changes.propose":`الاقتراح`,"changes.commit_section":`الحفظ في git`,"changes.commit_label":`رسالة الحفظ في git`,"changes.view_pr":`اعرض طلب الدمج المفتوح`,"changes.placeholder_branch_clean":`لا تغييرات على الفرع بعد`,"changes.placeholder_nothing":`لا شيء للحفظ`,"changes.placeholder_pr":`عنوان طلب الدمج، مثل "تحديث نصوص صفحة الدفع"`,"changes.placeholder_commit":`i18n: صف تغيير النص…`,"changes.working":`جارٍ العمل…`,"changes.pr_open":`طلب الدمج مفتوح`,"changes.open_pr":`افتح طلب دمج`,"changes.commit":`احفظ تغييرات اللغات في git`,"changes.reset_branch":`أعد ضبط الفرع`,"changes.discard":`تجاهل`,"changes.reset_to_base":`أعد الفرع إلى الأساس`,"changes.discard_all":`تجاهل الكل`,"changes.keep":`أبقِها`,"changes.pull_request":`طلب الدمج:`,"changes.committed":`حُفظ في git باسم {hash}. ادفعه متى كنت جاهزًا.`,"changes.session":`هذه الجلسة`,"changes.edits":{zero:`لا تعديلات`,one:`تعديل واحد`,two:`تعديلان`,few:`{count} تعديلات`,many:`{count} تعديلًا`,other:`{count} تعديل`},"changes.no_edits":`لم تُحفظ أي تعديلات في هذه الجلسة بعد.`,"changes.undo":`تراجع`,"changes.undo_title":`استعد القيمة السابقة`,"changes.restore_aria":`تراجع: استعد القيمة السابقة للمفتاح {key}`,"changes.empty":`فارغ`,"draft_list.title":`تغييراتك`,"draft_list.none":`لا تغييرات بعد. اضغط Alt وانقر أي نص في التطبيق لتصحيحه.`,"draft_list.status_unsent":`لم يُرسل`,"draft_list.status_sent":`أُرسل`,"draft_list.status_live":`منشور الآن`,"draft_list.status_conflict":`غيّره شخص آخر، راجعه`,"draft_list.undo":`تراجع`,"draft_list.undo_title":`عُد إلى النص المنشور`,"draft_list.remove":`إزالة`,"draft_list.remove_title":`يزيله من هذه القائمة. الرابط الذي أرسلته من قبل ما زال يحمله.`,"draft_list.undo_aria":`تراجع: عُد إلى النص المنشور للمفتاح {key} ({locale})`,"draft_list.remove_aria":`إزالة: أزل {key} ({locale}) من هذه القائمة`,"draft_list.empty":`فارغ`,"draft_list.dismiss_live":`أخفِ التغييرات المنشورة`,"draft_list.download":`نزّل نسخة احتياطية`,"draft_list.restore":`استعد نسخة احتياطية`,"draft_list.review":`راجع رابط أو ملف تغييرات`,"draft_list.backup_downloaded":`نُزّلت النسخة الاحتياطية.`,"draft_list.backup_failed":`تعذّر إنشاء النسخة الاحتياطية.`,"draft_list.restore_failed":`تعذّرت استعادة النسخة الاحتياطية.`,"review.status_apply":`جاهز`,"review.status_already":`مطبّق من قبل`,"review.status_conflict":`تغيّر منذ ذلك الحين`,"review.status_invalid":`غير صالح`,"review.status_needs_force":`حُفظ بـ«احفظ على أي حال»`,"review.saved_anyway":`حُفظ بـ«احفظ على أي حال».`,"review.no_link":`لا يوجد رابط تغييرات. يحتوي رابط التغييرات على "lc1.".`,"review.forced_not_included":`حُفظ بـ«احفظ على أي حال»؛ حدّد المربع لتضمينه.`,"review.source_failed":`تعذّر تحميل لغة المصدر {locale}.`,"review.title":`المراجعة`,"review.close":`إغلاق المراجعة`,"review.error_title":`لا يمكن فتح رابط التغييرات هذا:`,"review.opening":`جارٍ فتح رابط التغييرات…`,"review.from":`من {by}`,"review.from_note":`من {by}: {note}`,"review.from_translator":`من المترجم`,"review.from_translator_note":`من المترجم: {note}`,"review.summary_count":`{status}: {count}`,"review.create_pr":`أنشئ طلب دمج`,"review.change_repo":`غيّر`,"review.github_hint":`ثم اضغط Submit في GitHub، وسيُفتح طلب الدمج بعد دقيقة تقريبًا.`,"review.apply_local":{zero:`لا تغييرات للتطبيق على الملفات المحلية`,one:`طبّق تغييرًا واحدًا على الملفات المحلية`,two:`طبّق تغييرين على الملفات المحلية`,few:`طبّق {count} تغييرات على الملفات المحلية`,many:`طبّق {count} تغييرًا على الملفات المحلية`,other:`طبّق {count} تغيير على الملفات المحلية`},"review.include_forced":{zero:`أضف التغييرات المحفوظة بـ«احفظ على أي حال»`,one:`أضف التغيير المحفوظ بـ«احفظ على أي حال»`,two:`أضف التغييرين المحفوظين بـ«احفظ على أي حال»`,few:`أضف {count} تغييرات محفوظة بـ«احفظ على أي حال»`,many:`أضف {count} تغييرًا محفوظًا بـ«احفظ على أي حال»`,other:`أضف {count} تغيير محفوظ بـ«احفظ على أي حال»`},"review.command_title":`التطبيق من سطر الأوامر`,"review.copy_command":`نسخ الأمر`,"review.copy_link":`نسخ الرابط`,"review.copied":`نُسخ.`,"review.copy_failed":`لم ينجح النسخ في هذا المتصفح. حدّد النص أعلاه وانسخه.`,"review.apply_hint":`شغّله داخل المستودع. يفتح طلب دمج باستخدام git وgh على جهازك، مع أي استضافة git.`,"review.run_workflow_hint":`المشكلات (Issues) معطّلة؟ افتح {path}، ثم ألصق الرابط.`,"review.col_language":`اللغة`,"review.col_key":`المفتاح`,"review.col_before":`قبل`,"review.col_after":`بعد`,"review.col_check":`الفحص`,"review.show_locale":`اعرض الصفحة بلغة {locale}`,"review.now_on_site":`الموجود على الموقع الآن:`,"review.result_applied":`طُبّق`,"review.result_failed":`فشل: {message}`,"review.apply_summary":`انتهى التطبيق: طُبّق {applied}، وتُخطّي {skipped}، وفشل {failed}.`,"review.result_skipped":`تُخطّي: {reason}`,"review.empty":`فارغ`,"repo.question":`أي مستودع على GitHub يتلقى طلب الدمج؟`,"repo.malformed":`اكتبه بالشكل owner/repo، مثل acme/website.`,"repo.save":`احفظ`,"issue.too_large":`أكبر من أن تحمله مشكلة على GitHub. شغّل {command} مع هذا الرابط بدلًا من ذلك.`,"issue.copy_block":`نسخ كتلة التغييرات`,"issue.open_and_paste":`افتح GitHub وألصقها`,"issue.copy_failed":`لم ينجح النسخ. انسخ الكتلة أدناه، ثم افتح GitHub وألصقها.`,"issue.manual_copy_label":`نص كتلة التغييرات للنسخ`,"import.title":`استيراد رابط تغييرات`,"import.body":`راجع تغييرات المترجم قبل أن تُكتب في ملفاتك المحلية.`,"import.paste_label":`ألصق رابط تغييرات`,"import.file_label":`أو اختر ملفًا`,"import.file_failed":`تعذّرت قراءة هذا الملف. ألصق الرابط بدلًا منه.`,"import.cancel":`إلغاء`,"import.submit":`راجع التغييرات`},ae=`⁨`,oe=`⁩`;function se(e){return e===`ar`?`rtl`:`ltr`}var ce=new Map;function le(e){let t=ce.get(e);return t||(t=new Intl.PluralRules(e),ce.set(e,t)),t}function ue(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function de(e,t,n){return t[le(e).select(Number(n?.count))]??t.other}function I(e,t,n,r){let i=(e===`ar`?ue(t.ar,n):void 0)??ue(t.en,n);if(i===void 0)return n;let a=typeof i==`string`?i:de(e,i,r);if(!r)return a;let o=se(e)===`rtl`;return a.replace(/\{(\w+)\}/g,(e,t)=>{if(!Object.prototype.hasOwnProperty.call(r,t))return e;let n=String(r[t]);return o?`${ae}${n}${oe}`:n})}var L={en:F,ar:ie};function fe(e){return(t,n)=>I(e,L,t,n)}var R=fe(`en`),pe=[`setup.manifest_missing`,`share.storage_problem`,`share.locale_actions_unsupported`,`share.commit_unsupported`,`share.load_failed`,`share.unknown_language`,`errors.unauthorized`,`errors.translation_rejected`,`errors.server_status`];function me(e,t){let n=[],r=e.split(/\{(\w+)\}/).map((e,t)=>t%2==0?e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`):(n.push(e),`([\\s\\S]+?)`)).join(``),i=RegExp(`^${r}$`).exec(t);return i?Object.fromEntries(n.map((e,t)=>[e,i[t+1]??``])):null}function he(e,t){for(let n of pe){let r=me(R(n),t);if(r)return e(n,r)}return t}var ge=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})),z=o(((e,t)=>{t.exports=ge()}))(),_e=(0,g.createContext)({lang:`en`,dir:`ltr`,t:R,setLang:()=>{}});function ve(e){document.documentElement.lang=e,document.documentElement.dir=se(e)}function ye({initial:e,children:t}){let[n,r]=(0,g.useState)(e);(0,g.useEffect)(()=>{ve(n)},[n]);let i=(0,g.useCallback)(e=>{ee(e),r(e),ve(e)},[]),a=(0,g.useMemo)(()=>({lang:n,dir:se(n),t:fe(n),setLang:i}),[n,i]);return(0,z.jsx)(_e.Provider,{value:a,children:t})}function B(){return(0,g.useContext)(_e)}var be=8e3;function xe(e,t){return e.split(/\{(\w+)\}/).map((e,n)=>n%2==0?e:(0,z.jsx)(g.Fragment,{children:t[e]??`{${e}}`},e))}var Se=({iframeRef:e,appOrigin:t,appUrl:n,connectionStatus:r})=>{let{t:i}=B(),[a,o]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{if(o(!1),r!==`connecting`)return;let e=setTimeout(()=>o(!0),be);return()=>clearTimeout(e)},[r]),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col h-full bg-raised border border-line rounded-2xl overflow-hidden relative`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 select-none shrink-0`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-3 w-1/3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-line-strong`}),(0,z.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-line-strong`}),(0,z.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-line-strong`})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-4 w-1/3 justify-end`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold tracking-wider text-fg-muted uppercase`,children:i(`viewer.status`)}),(0,z.jsx)(`span`,{"data-testid":`connection-status`,"data-status":r,className:`px-2 py-0.5 rounded text-[10px] font-bold ${r===`connected`?`glyph-done bg-success-bg text-success-fg border border-success-line`:r===`connecting`?`glyph-warn bg-warning-bg text-warning-fg border border-warning-line animate-pulse`:`bg-danger-bg text-danger-fg border border-dashed border-danger-line`}`,children:i(r===`connected`?`viewer.status_connected`:`viewer.status_connecting`)})]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>{e.current&&(e.current.src=e.current.src)},className:`p-1.5 hover:bg-raised-hover text-fg-muted hover:text-fg rounded-lg transition duration-200 border border-transparent hover:border-line-strong`,"aria-label":i(`viewer.reload`),title:i(`viewer.reload`),children:(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,z.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,z.jsx)(`path`,{d:`M21 3v5h-5`})]})})]})]}),(0,z.jsxs)(`div`,{className:`flex-1 bg-raised relative`,children:[(0,z.jsx)(`iframe`,{id:`app-preview-iframe`,ref:e,src:`${n}?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`}),r===`connecting`&&(0,z.jsxs)(`div`,{className:`absolute inset-0 bg-surface flex flex-col items-center justify-center gap-4 transition duration-300`,children:[(0,z.jsxs)(`div`,{className:`relative w-12 h-12`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-accent-line`}),(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-t-accent animate-spin`})]}),(0,z.jsxs)(`div`,{className:`text-center`,children:[(0,z.jsx)(`h3`,{className:`text-fg font-semibold tracking-wide font-heading`,children:i(`viewer.connecting_title`)}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted mt-1 font-mono`,children:i(`viewer.connecting_body`)})]}),a&&(0,z.jsxs)(`div`,{role:`status`,"data-testid":`slow-connection-help`,className:`max-w-md mx-6 mt-2 rounded-xl border border-line bg-raised p-4 text-start text-xs text-fg`,children:[(0,z.jsx)(`p`,{className:`font-semibold text-fg`,children:i(`viewer.slow_title`)}),(0,z.jsxs)(`ul`,{className:`mt-2 space-y-1.5 list-disc ps-4`,children:[(0,z.jsx)(`li`,{children:xe(i(`viewer.cause_not_running`),{origin:(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono`,children:t})})}),(0,z.jsx)(`li`,{children:xe(i(`viewer.cause_framing`),{csp:(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono`,children:`frame-ancestors`}),xfo:(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono`,children:`X-Frame-Options`}),studio:(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono`,children:window.location.origin})})}),(0,z.jsx)(`li`,{children:xe(i(`viewer.cause_provider`),{provider:(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono`,children:`LiveLocaleProvider`}),env:(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono`,children:`NEXT_PUBLIC_LIVELOCALE=preview`})})})]}),(0,z.jsx)(`p`,{className:`mt-3 text-fg-muted`,children:xe(i(`viewer.run_doctor`),{command:(0,z.jsxs)(`code`,{dir:`ltr`,className:`font-mono text-fg select-all`,children:[`npx livelocale doctor --app `,t]})})})]})]})]})]})},Ce=new Set([`plural`,`select`,`selectordinal`]);function we(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 Te(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,Ce.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
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 Ee=/\{\{\s*([^{}]*?)\s*\}\}/g,De=/\$t\([^)]*\)/g,V=/%(?:\d+\$)?[-+ 0#]*\d*(?:\.\d+)?[sdifgxXoc]/g,Oe=/<\/?([A-Za-z][\w-]*|\d+)\b[^<>]*>/g;function ke(e){if(typeof e!=`string`||e===``)return[];let t=new Set,n=e.replace(Ee,(e,n)=>{let r=n.split(`,`)[0].trim();return r&&t.add(`{{${r}}}`),` `});for(let e of n.match(De)??[])t.add(e);for(let e of n.replace(/%%/g,``).match(V)??[])t.add(e);for(let e of n.matchAll(Oe))t.add(`<${e[1]}>`);let r=Te(we(n.replace(Oe,` `)));for(let e of r.args)t.add(`{${e}}`);return Array.from(t).sort()}function Ae(e,t){if(!e)return{ok:!0,missing:[],extra:[]};let n=new Set(ke(e)),r=new Set(ke(t)),i=Array.from(n).filter(e=>!r.has(e)),a=Array.from(r).filter(e=>!n.has(e));return{ok:i.length===0&&a.length===0,missing:i,extra:a}}function je(e){return typeof e==`string`?Te(we(e.replace(Ee,` `).replace(Oe,` `))).error:null}var Me=[`zero`,`one`,`two`,`few`,`many`,`other`];function Ne(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 Pe(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`){r=Ne(e,r);continue}if(t===`{`)n+=1;else if(t===`}`&&(--n,n===0))return r;r+=1}return-1}function Fe(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`'`){n=Ne(e,n);continue}if(r===`}`)return null;if(r===`{`){let r=Pe(e,n);if(r===-1)return null;t.push({start:n,end:r}),n=r+1;continue}n+=1}return t}var Ie=/^\s*([\w.]+)\s*,\s*(plural|select|selectordinal)\s*,/;function Le(e){if(typeof e!=`string`)return null;let t=Fe(e);if(!t)return null;let n=t.filter(t=>Ie.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=Ie.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=Pe(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 Re(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 ze(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 Me.filter(e=>r.has(e))}catch{return[`one`,`other`]}}var Be={zero:`plural.desc_zero`,one:`plural.desc_one`,two:`plural.desc_two`,few:`plural.desc_few`,many:`plural.desc_many`,other:`plural.desc_other`},Ve=({locale:e,value:t,onChange:n,disabled:r})=>{let{t:i}=B(),a=(0,g.useMemo)(()=>Le(t),[t]),o=(0,g.useMemo)(()=>{if(!a)return[];let t=new Map(a.branches.map(e=>[e.selector,e.text])),n=ze(e,a.type);return[...a.branches.map(e=>e.selector).filter(e=>!n.includes(e)),...n].map(e=>({selector:e,text:t.get(e)??``,required:n.includes(e)}))},[a,e]);if(!a)return null;let s=(e,t)=>{n(Re({...a,...e,branches:t??a.branches}))},c=(e,t)=>{s({},o.map(n=>({selector:n.selector,text:n.selector===e?t:n.text})))},l=`w-full bg-surface border border-line hover:border-line-strong rounded-lg px-3 py-2 text-xs text-fg placeholder-fg-muted transition duration-150 disabled:opacity-60`;return(0,z.jsxs)(`div`,{className:`space-y-3`,"data-testid":`plural-editor`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`span`,{className:`text-[10px] text-fg-muted font-mono`,children:[(0,z.jsx)(`span`,{dir:`ltr`,children:a.type}),` `,i(`plural.on`),` `,(0,z.jsx)(`span`,{dir:`ltr`,className:`text-fg`,children:a.variable}),a.offset?` ${i(`plural.offset`,{offset:a.offset})}`:``]}),(0,z.jsxs)(`span`,{className:`text-[10px] text-fg-muted`,children:[(0,z.jsx)(`code`,{className:`font-mono`,children:`#`}),` `,i(`plural.hash`)]})]}),a.prefix!==``&&(0,z.jsxs)(`label`,{className:`block space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold text-fg-muted uppercase tracking-wider`,children:i(`plural.before`)}),(0,z.jsx)(`input`,{"data-testid":`plural-prefix`,dir:`auto`,value:a.prefix,disabled:r,onChange:e=>s({prefix:e.target.value}),className:l})]}),(0,z.jsx)(`div`,{className:`space-y-2`,children:o.map(t=>(0,z.jsxs)(`label`,{className:`block space-y-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-2 text-[10px] font-mono`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`text-fg`,children:t.selector}),(0,z.jsx)(`span`,{className:`text-fg-muted`,children:i(Be[t.selector]??`plural.desc_explicit`)}),t.required&&t.text===``&&t.selector!==`other`&&(0,z.jsx)(`span`,{className:`glyph-warn text-warning-fg`,children:i(`plural.needed`,{locale:e})})]}),(0,z.jsx)(`input`,{"data-testid":`plural-branch-${t.selector}`,dir:`auto`,value:t.text,disabled:r,onChange:e=>c(t.selector,e.target.value),className:l})]},t.selector))}),a.suffix!==``&&(0,z.jsxs)(`label`,{className:`block space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold text-fg-muted uppercase tracking-wider`,children:i(`plural.after`)}),(0,z.jsx)(`input`,{"data-testid":`plural-suffix`,dir:`auto`,value:a.suffix,disabled:r,onChange:e=>s({suffix:e.target.value}),className:l})]})]})},He=/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,4})?$/,Ue=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/,We=1e4,Ge=new Set([`__proto__`,`constructor`,`prototype`]);function Ke(e){return typeof e==`string`?!e.split(`.`).some(e=>Ge.has(e)):!1}function qe(e){return typeof e==`string`&&e.length>=2&&e.length<=10&&He.test(e)}function Je(e){return typeof e==`string`&&e.length>=1&&e.length<=200&&Ue.test(e)}function Ye(e){return typeof e==`string`&&e.length<=1e4}function Xe(e){return!(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`)||e.includes(`%`)||e.includes(`\0`))}var Ze=`lc1.`,Qe="```livelocale",$e="```",H=class extends Error{code;constructor(e,t){super(t),this.name=`ChangeLinkError`,this.code=e}},et=`This change link is damaged or incomplete. Ask the sender to send the file instead.`,tt=`This change link was made by a newer LiveLocale. Update LiveLocale and try again.`,nt=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,rt=32768;function it(e){let t=``;for(let n=0;n<e.length;n+=rt)t+=String.fromCharCode(...e.subarray(n,n+rt));return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function at(e){if(!/^[A-Za-z0-9_-]*$/.test(e)||e.length%4==1)throw new H(`CORRUPT`,et);let t=e.length%4;if(t!==0){let n=t===2?15:3;if((nt.indexOf(e[e.length-1])&n)!==0)throw new H(`CORRUPT`,et)}let n=atob(e.replace(/-/g,`+`).replace(/_/g,`/`)+`=`.repeat(t===0?0:4-t)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}function ot(e){return`${Qe}\n${e}\n${$e}\n`}function st(e){let t=RegExp(`${Qe}(?:\\r\\n|\\r|\\n)`).exec(e);if(!t)return null;let n=e.slice(t.index+t[0].length).split(/\r\n|\r|\n/),r=n.indexOf($e);return(r<0?n:n.slice(0,r)).join(``).replace(/\s+/g,``)}function ct(e){let t=(st(e)??e).replace(/%23/gi,`#`),n=new Set;for(let e of t.matchAll(/(?:^|[^A-Za-z0-9_-])lc1\.([A-Za-z0-9_-]+)/g))n.add(e[1]);if(n.size===1)return Ze+[...n][0];throw n.size>1?new H(`AMBIGUOUS`,`This text holds more than one change link. Paste one link at a time.`):/(?:^|[^A-Za-z0-9_-])lc(?:[2-9]|[1-9]\d+)\.[A-Za-z0-9_-]/.test(t)?new H(`UNSUPPORTED_VERSION`,tt):new H(`NOT_FOUND`,`This is not a LiveLocale change link. A change link contains "lc1.".`)}function lt(e){if(!/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!1;let t=e.slice(e.indexOf(`/`)+1);return t!==`.`&&t!==`..`}var ut=/^(?!-)(?!.*\.\.)[^\s\x00-\x1f\x7f]{1,255}$/;function dt(e){return ut.test(e)&&!bt(e)}var ft=2e3;function U(e){return{v:1,...e.repo===void 0?{}:{repo:e.repo},branch:e.branch,base:e.base,src:e.src,by:e.by,note:e.note,e:e.edits.map(({locale:e,key:t,from:n,to:r,force:i})=>i?[e,t,n,r,1]:[e,t,n,r])}}var pt=/^(?:[0-9a-f]{40}|[0-9a-f]{64})?$/,mt=/[\x00-\x1f\x7f]/,ht=/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/,gt=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]/;function _t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function yt(e){return new H(`INVALID`,e)}function bt(e){return typeof e==`string`&&gt.test(e)}function xt(e,t){let n=e=>yt(`edit ${t}: ${e}`);if(!Array.isArray(e)||e.length!==4&&e.length!==5)throw n(`is not a [locale, key, from, to] entry.`);let[r,i,a,o,s]=e;if(typeof r!=`string`||!qe(r))throw n(`the locale is not a locale code.`);if(typeof i!=`string`||!Je(i)||!Ke(i))throw n(`the key is not a valid translation key.`);if(a!==null&&(typeof a!=`string`||!Ye(a)))throw n(`the current text is not text of at most ${We} characters.`);if(typeof o!=`string`||!Ye(o))throw n(`the new text is not text of at most ${We} characters.`);if(e.length===5&&s!==1)throw n(`the force flag must be 1.`);return{locale:r,key:i,from:a,to:o,force:e.length===5}}function St(e){let t=new Map;e.forEach(({locale:e,key:n},r)=>{let i=t.get(e);if(i||t.set(e,i=new Set),i.has(n))throw yt(`edit ${r+1}: an earlier edit changes the same key.`);i.add(n)}),e.forEach(({locale:e,key:n},r)=>{let i=t.get(e);for(let e=n.indexOf(`.`);e>=0;e=n.indexOf(`.`,e+1))if(i.has(n.slice(0,e)))throw yt(`edit ${r+1}: another edit changes a key that contains this one.`)})}function Ct(e){if(!_t(e))throw yt(`This change link does not hold a change set.`);if(vt(e,`v`)!==1)throw new H(`UNSUPPORTED_VERSION`,tt);let t=vt(e,`repo`);if(t!==void 0&&(typeof t!=`string`||!lt(t)))throw yt(`The repository is not an owner/name slug.`);let n=vt(e,`branch`);if(typeof n!=`string`||n!==``&&!dt(n))throw yt(`The branch is not a valid branch name.`);let r=vt(e,`base`);if(typeof r!=`string`||!pt.test(r))throw yt(`The base is not a full commit id.`);let i=vt(e,`src`);if(typeof i!=`string`||!qe(i))throw yt(`The source locale is not a locale code.`);let a=vt(e,`by`);if(typeof a!=`string`||a.length>100||mt.test(a))throw yt(`The name is not one line of at most 100 characters.`);let o=vt(e,`note`);if(typeof o!=`string`||o.length>2e3||ht.test(o))throw yt(`The note is not plain text of at most ${ft} characters.`);let s=vt(e,`e`);if(!Array.isArray(s))throw yt(`This change link holds no list of edits.`);if(s.length>500)throw new H(`TOO_MANY_EDITS`,`A change link holds at most 500 edits. Send the rest in another link.`);if(s.length===0)throw yt(`This change link holds no edits.`);let c=Array.from(s,(e,t)=>xt(e,t+1));if(St(c),[t,n,r,i,a,o].some(bt))throw yt(`This change link holds broken text.`);return c.forEach(({locale:e,key:t,from:n,to:r},i)=>{if([e,t,n,r].some(bt))throw yt(`edit ${i+1}: holds broken text.`)}),{...t===void 0?{}:{repo:t},branch:n,base:r,src:i,by:a,note:o,edits:c}}var wt=512*1024,Tt=`A change link holds at most ${wt/1024} KB of text. Send the changes in smaller links.`,Et=`This browser cannot create or read change links. Use a current Chrome, Edge or Firefox, or Safari 16.4 or later.`,Dt=4096;async function Ot(e,t,n){let r=new Uint8Array(t),i=e.writable.getWriter(),a=e.readable.getReader(),o=!1;(async()=>{for(let e=0;e<r.length;e+=Dt){if(o)return;await i.write(r.subarray(e,e+Dt))}o||await i.close()})().catch(()=>{});let s=[],c=0;try{for(;;){let{done:e,value:t}=await a.read();if(e)break;if(c+=t.length,c>n)throw new H(`TOO_LARGE`,Tt);s.push(t)}}catch(e){throw o=!0,i.abort(e).catch(()=>{}),await a.cancel(e).catch(()=>{}),e}let l=new Uint8Array(c),u=0;for(let e of s)l.set(e,u),u+=e.length;return l}var kt=async e=>{if(typeof globalThis.CompressionStream!=`function`)throw new H(`UNSUPPORTED_ENVIRONMENT`,Et);return Ot(new CompressionStream(`deflate`),e,1/0)},At=async(e,t)=>{if(typeof globalThis.DecompressionStream!=`function`)throw new H(`UNSUPPORTED_ENVIRONMENT`,Et);try{return await Ot(new DecompressionStream(`deflate`),e,t)}catch(e){throw e instanceof H?e:new H(`CORRUPT`,et)}};async function jt(e,t=kt){let n=JSON.stringify(U(Ct(U(e)))),r=new TextEncoder().encode(n);if(r.length>524288)throw new H(`TOO_LARGE`,Tt);return Ze+it(await t(r))}async function Mt(e,t=At){let n=ct(e);if(n.length>1e6)throw new H(`TOO_LARGE`,Tt);try{let e=await t(at(n.slice(4)),wt),r=new TextDecoder(`utf-8`,{fatal:!0}).decode(e);return Ct(JSON.parse(r))}catch(e){throw e instanceof H?e:new H(`CORRUPT`,et)}}var Nt=`manifest.json`,Pt=/^[0-9a-f]{40}([0-9a-f]{24})?$/;function Ft(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function It(e,t){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n++)if(!t(e[n]))return!1;return!0}function Lt(e){return typeof e==`string`}function W(e){return typeof e==`string`&&He.test(e)}function Rt(e,t){return e===null||typeof e==`string`&&t(e)}function zt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Ft(e,`repo`),n=Ft(e,`layout`),r=Ft(e,`locales`),i=Ft(e,`sourceLocale`);return Ft(e,`format`)===1&&(t===void 0||typeof t==`string`&&lt(t))&&Rt(Ft(e,`defaultBranch`),dt)&&Rt(Ft(e,`branch`),dt)&&Rt(Ft(e,`base`),e=>Pt.test(e))&&typeof Ft(e,`localesPath`)==`string`&&(n===`flat`||n===`namespaced`)&&It(r,W)&&typeof i==`string`&&r.includes(i)&&Rt(Ft(e,`basePath`),e=>e.startsWith(`/`)&&e.endsWith(`/`))&&It(Ft(e,`codeKeys`),Lt)}function Bt(e){return zt(e)?e:null}function Vt(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 Ht(e){let t=null;if(e.search)try{t=new URLSearchParams(e.search).get(`app`)}catch{t=null}return Vt(t)??Vt(e.injected)??Vt(e.buildTime)??`http://localhost:3000`}var Ut=`This Studio was opened from a website, but livelocale/manifest.json is missing or is not a LiveLocale manifest. Rebuild with share: true (or run livelocale pack) and upload the whole livelocale/ folder.`;function Wt(e){return new URL(`../`,e).href}var Gt=/\/livelocale\/(index\.html)?$/;async function Kt(e){try{let t=await e.fetch(new URL(Nt,e.href).href,{cache:`no-store`,credentials:`same-origin`});if(!t.ok)return null;let n=await t.text(),r=Bt(JSON.parse(n));return r?{manifest:r,manifestText:n}:null}catch{return null}}async function qt(e){let t=t=>{let n=Ht(e);return{kind:`server`,appOrigin:n,appUrl:n,problems:t}};if(Vt(e.injected)!==null)return t([]);let n=await Kt(e);return n?{kind:`static`,appOrigin:new URL(e.href).origin,appUrl:Wt(e.href),...n}:t(Gt.test(new URL(e.href).pathname)?[Ut]:[])}var Jt=null;function Yt(e){Jt=e}function Xt(){if(Jt)return Jt;let e=typeof window<`u`,t=Ht({search:e?window.location.search:void 0,injected:e?window.__LIVELOCALE_CONFIG__?.appOrigin:void 0,buildTime:void 0});return{kind:`server`,appOrigin:t,appUrl:t,problems:[]}}function Zt(){return Xt().appOrigin}function Qt(){return Xt().appUrl}function $t(){let e=Xt();return e.kind===`static`?e.transport:null}function en(){let e=Xt();if(e.kind!==`static`)return{};let{basePath:t,locales:n}=e.manifest;return{basePath:t??new URL(e.appUrl).pathname,locales:n}}function tn(){let e=Xt();return e.kind===`server`&&e.problems.includes(`This Studio was opened from a website, but livelocale/manifest.json is missing or is not a LiveLocale manifest. Rebuild with share: true (or run livelocale pack) and upload the whole livelocale/ folder.`)}function nn(){return Xt().kind===`static`||tn()}var rn=`studio-translation-input`,an={present:`bg-raised border border-line-strong text-fg`,missing:`bg-transparent border-[1.5px] border-dashed border-danger-line text-danger-fg line-through`,extra:`glyph-warn bg-warning-bg border border-warning-line text-warning-fg`},on={present:`editor.chip_present`,missing:`editor.chip_missing`,extra:`editor.chip_extra`},sn=({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{t:f}=B(),[p,m]=(0,g.useState)(!1),h=(0,g.useMemo)(()=>Le(t)!==null,[t]),_=h&&!p,v=!r&&t!==e.currentValue,y=(0,g.useRef)(null),b=(0,g.useRef)(null),x=e=>{let t=document.activeElement;b.current=t instanceof HTMLElement&&y.current?.contains(t)?t:null,e()};(0,g.useEffect)(()=>{if(r)return;let e=b.current;b.current=null;let t=y.current;if(!e||!t)return;let n=document.activeElement;n&&n!==document.body&&n.isConnected||((e=>e instanceof HTMLElement&&e.isConnected&&!e.matches(`:disabled`))(e)?e:t.querySelector(`textarea:not(:disabled), input:not(:disabled)`))?.focus()},[r]);let S=e=>{e.key!==`Enter`||!(e.ctrlKey||e.metaKey)||(e.preventDefault(),v&&x(c))},C=(0,g.useMemo)(()=>{let n=new Set(ke(e.fallbackValue||``)),r=new Set(ke(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,z.jsxs)(`div`,{ref:y,className:`flex-1 flex flex-col p-6 overflow-y-auto space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:f(`editor.key`)}),(0,z.jsx)(`button`,{type:`button`,onClick:d,className:`text-[10px] font-medium text-fg-muted hover:text-fg transition duration-200`,children:f(`editor.clear`)})]}),(0,z.jsx)(`div`,{dir:`ltr`,className:`bg-surface border border-line rounded-xl px-4 py-3 font-mono text-xs text-info-fg select-all break-all leading-relaxed`,children:e.key})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:f(`editor.reference`)}),(0,z.jsx)(`div`,{dir:`auto`,className:`bg-surface border border-line rounded-xl px-4 py-3 text-sm text-fg-muted select-all leading-relaxed whitespace-pre-wrap`,children:e.fallbackValue||(0,z.jsx)(`span`,{className:`italic text-fg-muted`,children:f(`editor.reference_none`)})})]}),C.length>0&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:f(`editor.placeholders`)}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:C.map(({token:e,state:t})=>(0,z.jsx)(`span`,{"data-testid":`placeholder-${e}`,"data-state":t,dir:`ltr`,title:f(on[t]),className:`px-2 py-0.5 rounded-md text-[10px] font-mono ${an[t]}`,children:e},e))})]}),(0,z.jsxs)(`div`,{className:`space-y-2 flex-1 flex flex-col min-h-[180px]`,onKeyDown:S,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:f(_?`editor.plural_forms`:`editor.output`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h&&(0,z.jsx)(`button`,{type:`button`,"data-testid":`plural-raw-toggle`,onClick:()=>m(e=>!e),className:`text-[10px] font-semibold text-fg-muted hover:text-fg transition duration-150`,children:f(p?`editor.edit_forms`:`editor.edit_raw`)}),(0,z.jsxs)(`span`,{dir:`ltr`,className:`text-[10px] text-fg-muted font-mono`,children:[t.length,`/10000`]})]})]}),_?(0,z.jsx)(Ve,{locale:n,value:t,onChange:s,disabled:r}):(0,z.jsx)(`textarea`,{id:rn,"aria-label":f(`editor.translation_label`),dir:`auto`,value:t,onChange:e=>s(e.target.value),disabled:r,placeholder:f(`editor.input_placeholder`),className:`w-full min-h-32 bg-surface border border-line hover:border-line-strong rounded-xl px-4 py-3 text-sm text-fg placeholder-fg-muted font-sans resize-none transition duration-205 leading-relaxed`})]}),o&&(0,z.jsxs)(`div`,{"data-testid":`save-warning`,role:`alert`,className:`bg-warning-bg border border-warning-line rounded-xl p-3 space-y-3`,children:[(0,z.jsx)(`div`,{className:`glyph-warn text-xs text-warning-fg leading-relaxed`,children:o.message}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>x(l),disabled:r,className:`h-8 px-3 rounded-lg text-[11px] font-semibold text-on-warning bg-warning-solid hover:bg-warning-solid/90 transition duration-150`,children:f(`editor.save_anyway`)}),(0,z.jsx)(`button`,{type:`button`,onClick:u,className:`h-8 px-3 rounded-lg text-[11px] font-semibold text-fg bg-raised border border-line-strong hover:border-line-strong transition duration-150`,children:f(`editor.keep_editing`)})]})]}),a&&(0,z.jsxs)(`div`,{role:`alert`,className:`bg-danger-bg border border-dashed border-danger-line rounded-xl p-3 flex items-start gap-[0.625rem]`,children:[(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4 text-danger-fg shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsx)(`div`,{className:`text-xs text-danger-fg leading-normal break-words`,children:he(f,a)})]}),(0,z.jsx)(`p`,{role:`status`,className:`sr-only`,"data-testid":`save-status`,children:i?f(`editor.saved_status`):``}),(0,z.jsx)(`div`,{className:`flex items-center gap-3 pt-4 shrink-0`,children:(0,z.jsx)(`button`,{type:`button`,id:`studio-save-button`,onClick:()=>x(c),disabled:!v,className:`flex-1 h-11 rounded-xl text-sm font-semibold tracking-wide flex items-center justify-center gap-2 transition duration-205 ${t===e.currentValue?`bg-raised text-fg-muted cursor-not-allowed shadow-none border border-line`:`bg-accent hover:bg-accent-hover text-on-accent`}`,children:r?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`animate-spin h-4 w-4 text-on-accent`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,z.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,z.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,z.jsx)(`span`,{children:f(`editor.saving`)})]}):i?(0,z.jsx)(`span`,{"data-testid":`save-success`,className:`glyph-done flex items-center gap-1 text-success-fg font-bold`,children:(0,z.jsx)(`span`,{children:f(`editor.saved`)})}):(0,z.jsx)(`span`,{children:f(`editor.save`)})})})]})},cn=()=>{let{t:e}=B();return(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-6 text-center select-none`,children:[(0,z.jsx)(`div`,{className:`w-16 h-16 rounded-2xl bg-accent-soft border border-accent-line flex items-center justify-center text-fg mb-6`,children:(0,z.jsx)(`svg`,{className:`w-8 h-8 text-fg`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsx)(`h3`,{className:`text-fg font-semibold tracking-wide font-heading`,children:e(`empty.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted max-w-xs mt-2 leading-relaxed`,children:e(`empty.body`)})]})},ln=({code:e,isActive:t,isLoading:n,allLocales:r,onRename:i,onDelete:a})=>{let{t:o}=B(),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(e),[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(null);return(0,z.jsx)(`div`,{className:`bg-surface border border-line hover:border-line rounded-xl px-4 py-3 flex items-center justify-between gap-4 transition duration-200`,children:s?(0,z.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,z.jsx)(`input`,{type:`text`,value:l,dir:`ltr`,onChange:e=>u(e.target.value),disabled:n,"aria-label":o(`locales.new_code_aria`,{code:e}),className:`flex-1 bg-surface border border-line rounded-lg px-2.5 py-1 text-xs font-mono text-fg`,autoFocus:!0}),(0,z.jsx)(`button`,{type:`button`,onClick:async()=>{m(null);let t=l.trim();if(!t||t===e){c(!1);return}if(!qe(t)){m(o(`locales.invalid`));return}if(r.includes(t)&&t!==e){m(o(`locales.target_exists`));return}try{await i(e,t),c(!1)}catch(e){m(e.message||o(`locales.rename_failed`))}},disabled:n,className:`p-1 text-success-fg hover:text-success-fg transition duration-150`,"aria-label":o(`locales.save_rename`),title:o(`locales.save_rename`),children:(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M5 13l4 4L19 7`})})}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>c(!1),disabled:n,className:`p-1 text-fg-muted hover:text-fg-muted transition duration-150`,"aria-label":o(`locales.cancel`),title:o(`locales.cancel`),children:(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M6 18L18 6M6 6l12 12`})})})]}):d?(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold text-danger-fg`,children:o(`locales.confirm_delete`)}),p&&(0,z.jsx)(`span`,{role:`alert`,className:`text-[10px] text-danger-fg break-words`,children:he(o,p)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:n,className:`px-2.5 py-1 text-[10px] font-semibold bg-raised hover:bg-raised-hover text-fg rounded-lg transition`,children:o(`locales.cancel`)}),(0,z.jsx)(`button`,{type:`button`,onClick:async()=>{m(null);try{await a(e),f(!1)}catch(e){m(e.message||o(`locales.delete_failed`))}},disabled:n,className:`px-2.5 py-1 text-[10px] font-semibold bg-transparent border border-dashed border-danger-line text-danger-fg hover:bg-danger-bg rounded-lg transition`,children:o(`locales.delete`)})]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`text-xs font-semibold text-fg truncate`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-[9px] text-accent-fg font-bold tracking-wide mt-0.5`,children:o(`locales.active`)}),p&&(0,z.jsx)(`span`,{role:`alert`,className:`text-[10px] text-danger-fg break-words mt-0.5`,children:he(o,p)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>{u(e),m(null),c(!0)},disabled:n,className:`p-1.5 text-fg-muted hover:text-fg transition duration-150`,"aria-label":o(`locales.rename_aria`,{code:e}),title:o(`locales.rename_title`),children:(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsx)(`button`,{type:`button`,onClick:()=>{m(null),f(!0)},disabled:n,className:`p-1.5 text-fg-muted hover:text-danger-fg transition duration-150`,"aria-label":o(`locales.delete_aria`,{code:e}),title:o(`locales.delete_title`),children:(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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`})})})]})]})})},un=({locale:e,locales:t,isLoading:n,error:r,onAddLocale:i,onRenameLocale:a,onDeleteLocale:o})=>{let{t:s}=B(),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(null);return(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col p-6 overflow-y-auto space-y-6`,children:[(0,z.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),d(null);let n=c.trim();if(n){if(!qe(n)){d(s(`locales.format_hint`));return}if(t.includes(n)){d(s(`locales.exists`));return}try{await i(n),l(``)}catch(e){d(e.message||s(`errors.add_locale_failed`))}}},className:`space-y-2.5`,children:[(0,z.jsx)(`label`,{htmlFor:`studio-new-locale`,className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:s(`locales.add_label`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`input`,{id:`studio-new-locale`,type:`text`,value:c,dir:`ltr`,onChange:e=>l(e.target.value),placeholder:s(`locales.add_placeholder`),disabled:n,className:`flex-1 min-w-0 bg-surface border border-line hover:border-line-strong rounded-xl px-4 py-2.5 text-xs text-fg placeholder-fg-muted font-mono transition duration-155`}),(0,z.jsx)(`button`,{type:`submit`,disabled:n||!c.trim(),className:`h-10 px-4 bg-raised hover:bg-raised-hover disabled:bg-raised disabled:text-fg-faint text-fg border border-line text-xs font-semibold rounded-xl transition duration-155 flex items-center justify-center gap-1.5 shrink-0`,children:s(`locales.add`)})]})]}),(u||r)&&(0,z.jsxs)(`div`,{role:`alert`,className:`bg-danger-bg border border-dashed border-danger-line rounded-xl p-3 flex items-start gap-[0.625rem]`,children:[(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4 text-danger-fg shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsx)(`div`,{className:`text-xs text-danger-fg leading-normal break-words`,children:he(s,u||r)})]}),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col space-y-2`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider mb-1`,children:s(`locales.list`)}),(0,z.jsx)(`div`,{className:`flex-1 overflow-y-auto space-y-2 pe-1 select-none`,children:t.map(r=>(0,z.jsx)(ln,{code:r,isActive:r===e,isLoading:n,allLocales:t,onRename:a,onDelete:o},r))})]})]})},dn={en:`editor.lang_en`,ar:`editor.lang_ar`,es:`editor.lang_es`,fr:`editor.lang_fr`,de:`editor.lang_de`,zh:`editor.lang_zh`,ja:`editor.lang_ja`,pt:`editor.lang_pt`,it:`editor.lang_it`,ru:`editor.lang_ru`,hi:`editor.lang_hi`,tr:`editor.lang_tr`},fn=(e,t)=>`${t(dn[e.split(`-`)[0]?.toLowerCase()||e]||dn[e]||`editor.lang_custom`)} (${e})`,pn=({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:_,className:v=`w-[420px] shrink-0`})=>{let{t:y}=B(),[b,x]=(0,g.useState)(!1);return(0,z.jsxs)(`div`,{"data-testid":`editor-panel`,className:`${v} bg-raised border border-line rounded-2xl flex flex-col h-full overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-heading text-fg`,children:y(b?`editor.manage`:`editor.title`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!b&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`label`,{htmlFor:`studio-locale-select`,className:`text-[10px] font-semibold text-fg-muted uppercase tracking-wider`,children:y(`editor.locale`)}),(0,z.jsx)(`select`,{id:`studio-locale-select`,value:n,dir:`ltr`,onChange:e=>c(e.target.value),className:`bg-raised border border-line hover:border-line-strong text-fg text-xs rounded-lg px-2.5 py-1.5 cursor-pointer font-mono`,children:p.map(e=>(0,z.jsx)(`option`,{value:e,children:fn(e,y)},e))})]}),(0,z.jsx)(`button`,{type:`button`,"data-testid":`manage-languages-toggle`,onClick:()=>x(!b),className:`p-1.5 rounded-lg border transition duration-200 ${b?`bg-accent-soft border-accent-line text-accent-fg`:`bg-raised border-line text-fg-muted hover:text-fg hover:border-line-strong`}`,"aria-label":y(b?`editor.back`:`editor.manage`),title:y(b?`editor.back`:`editor.manage`),children:b?(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2.5,d:`M10 19l-7-7m0 0l7-7m-7 7h18`})}):(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:[(0,z.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,z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]})})]})]}),b?(0,z.jsx)(un,{locale:n,locales:p,isLoading:r,error:a,onAddLocale:m,onRenameLocale:h,onDeleteLocale:_}):e?(0,z.jsx)(sn,{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,z.jsx)(cn,{})]})};function mn(e,t){if(typeof e!=`object`||!e)return t;if(typeof t!=`object`||!t)return e;let n={...e};for(let r of Object.keys(t))r in e?n[r]=mn(e[r],t[r]):n[r]=t[r];return n}function hn(e,t,n){let r=t.split(`.`);if(r.length>30)throw Error(`[livelocale] Key depth limit exceeded. Maximum depth is 30 levels.`);if(r.some(e=>Ge.has(e)))throw Error(`[livelocale] Forbidden key segment in path: "${t}". Segment names like __proto__, constructor, and prototype are not allowed.`);let i=e;for(let e=0;e<r.length;e++){let t=r[e];if(e===r.length-1){i[t]=n;return}(!(t in i)||i[t]===null||typeof i[t]!=`object`||Array.isArray(i[t]))&&(i[t]={}),i=i[t]}}function gn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vn(e,t){if(!gn(e))return{state:`missing`};let n=t.split(`.`),r=n.length-1,i=e;for(let e=0;e<r;e++){if(_n(i,n.slice(e).join(`.`)))return{state:`occupied`};let t=n[e];if(!_n(i,t))return{state:`missing`};let r=i[t];if(!gn(r))return{state:`occupied`};i=r}let a=n[r];if(!_n(i,a))return{state:`missing`};let o=i[a];return typeof o==`string`?{state:`string`,value:o}:{state:`occupied`}}function yn(e,t=``,n=new Set){if(!e||typeof e!=`object`)return n;for(let r of Object.keys(e)){let i=e[r],a=t?`${t}.${r}`:r;i&&typeof i==`object`&&!Array.isArray(i)?yn(i,a,n):n.add(a)}return n}var bn=(e,t,n)=>({ok:!1,status:e,code:t,error:n});function xn(e,t={}){let{locale:n,key:r,value:i}=e;if(!qe(n))return bn(400,`INVALID_LOCALE_FORMAT`,`Invalid locale string parameter.`);if(!Je(r))return bn(400,`INVALID_KEY_FORMAT`,`Invalid key path. Must be 1-200 characters containing alphanumeric, dots, underscores, or hyphens.`);if(!Ke(r))return bn(400,`INVALID_KEY_FORMAT`,`Forbidden key path: segments like __proto__, constructor, or prototype are not allowed.`);if(!Ye(i))return bn(400,`INVALID_VALUE_FORMAT`,`Invalid value. Must be a string less than 10000 characters.`);let a={ok:!0,locale:n,key:r,value:i};if(t.force===!0)return a;let o=je(a.value);if(o)return bn(422,`MESSAGE_SYNTAX`,`Message syntax: ${o}.`);let s=Ae(t.reference,a.value);if(!s.ok){let e=[];return s.missing.length&&e.push(`missing ${s.missing.join(`, `)}`),s.extra.length&&e.push(`unexpected ${s.extra.join(`, `)}`),{...bn(422,`PLACEHOLDER_MISMATCH`,`Placeholders differ from the reference: ${e.join(`; `)}.`),details:{missing:s.missing,extra:s.extra}}}return a}function Sn(e,t){let n=vn(t.source,e);return n.state===`string`?n.value:null}function Cn(e,t,n){let{locale:r,key:i,value:a}=e,o={locale:r,key:i,value:a},s=xn(o,{force:!0});return s.ok?vn(r===t.sourceLocale?t.source:t.target??{},i).state===`occupied`?bn(409,`KEY_NOT_A_STRING`,`Cannot save "${i}" in ${r}: it would replace translations that are not a single text.`):xn(o,{reference:Sn(i,t),force:n?.force===!0}):s}var wn={markup:`Adds markup that the source text does not have.`,"javascript-url":`Adds a javascript:, vbscript: or data: link.`,"new-url":`Adds a web address that the source text does not have.`,"bidi-control":`Contains invisible text-direction control characters.`},Tn=/<\/?([A-Za-z][\w-]*)\b[^<>]*>/g,En=[/\b(?:javascript|vbscript)\s*:/i,/\bdata:[a-z]+\/[\w.+-]+/i],Dn=/\b(?:https?:\/\/|www\.)[^\s<>"')]+/gi,On=/[\u202A-\u202E\u2066-\u2069]/g,kn=e=>Array.from(e.matchAll(Tn),e=>e[1].toLowerCase()),An=(e,t)=>t.match(e)??[],jn=/^((?:https?:\/\/|www\.)[^/?#]*)(.*)$/i,Mn=e=>{let t=e.replace(/[.,;:!?]+$/,``),n=jn.exec(t);return n?n[1].toLowerCase()+n[2]:t},Nn=e=>An(Dn,e).map(Mn),Pn=(e,t)=>{let n=new Set(e);return t.some(e=>!n.has(e))};function Fn(e,t){let n=e??``,r=[];return Pn(kn(n),kn(t))&&r.push(`markup`),En.some(e=>e.test(t)&&!e.test(n))&&r.push(`javascript-url`),Pn(Nn(n),Nn(t))&&r.push(`new-url`),Pn(An(On,n),An(On,t))&&r.push(`bidi-control`),r}var In=()=>`${Zt()}/api/livelocale`,Ln=`livelocale-token`,Rn=`livelocale:unauthorized`,zn=`livelocale:token-changed`,Bn=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??[]}}},Vn=class extends Error{code=`UNAUTHORIZED`;constructor(e=R(`errors.unauthorized`)){super(e),this.name=`UnauthorizedError`}},Hn=null;function Un(){try{return window.sessionStorage.getItem(`livelocale-token`)??Hn}catch{return Hn}}function Wn(e){Hn=e;try{e?window.sessionStorage.setItem(Ln,e):window.sessionStorage.removeItem(Ln)}catch{}typeof window<`u`&&window.dispatchEvent(new Event(zn))}function Gn(e={}){let t=Un();return t?{...e,Authorization:`Bearer ${t}`}:e}async function Kn(e){let t=null;try{t=await e.json()}catch{}if(e.status===401)throw typeof window<`u`&&window.dispatchEvent(new Event(Rn)),new Vn(t?.error||R(`errors.unauthorized`));if(e.status===422)throw new Bn(t?.error||R(`errors.translation_rejected`),t?.code||`VALIDATION`,t?.details);if(!e.ok)throw Error(t?.error||R(`errors.server_status`,{status:e.status}));return t}function qn(e=``){let t=`${In()}${e}`;return(Un()?fetch(t,{headers:Gn()}):fetch(t)).then(e=>Kn(e))}async function Jn(e){return Kn(await fetch(In(),{method:`POST`,headers:Gn({"Content-Type":`application/json`}),body:JSON.stringify(e)}))}var Yn={fetchInfo:()=>qn(`?action=info`),fetchLocales:()=>qn(),fetchKeysMetadata:()=>qn(`?action=keys`),fetchLocaleDictionary:e=>qn(`?locale=${encodeURIComponent(e)}`),fetchGitState:()=>qn(`?action=git`),saveTranslation:(e,t,n,r={})=>Jn({locale:e,key:t,value:n,...r.reference===void 0?{}:{reference:r.reference},...r.force?{force:!0}:{}}),addLocaleRequest:e=>Jn({action:`addLocale`,locale:e}),renameLocaleRequest:(e,t)=>Jn({action:`renameLocale`,locale:e,newLocale:t}),deleteLocaleRequest:e=>Jn({action:`deleteLocale`,locale:e}),commitLocales:e=>Jn({action:`commit`,message:e}),discardLocales:()=>Jn({action:`discard`})},Xn=Yn;function Zn(e){Xn=e??Yn}var Qn=()=>Xn.fetchInfo(),$n=()=>Xn.fetchLocales(),er=()=>Xn.fetchKeysMetadata(),tr=e=>Xn.fetchLocaleDictionary(e),nr=()=>Xn.fetchGitState(),rr=(e,t,n,r={})=>Xn.saveTranslation(e,t,n,r),ir=e=>Xn.addLocaleRequest(e),ar=(e,t)=>Xn.renameLocaleRequest(e,t),or=e=>Xn.deleteLocaleRequest(e),sr=e=>Xn.commitLocales(e),cr=()=>Xn.discardLocales();function lr(e,t){return e.repo?e.repo:`path:`+new URL(t).pathname}function ur(e,t,n){let r=e.layout===`namespaced`?`${t}/${n.split(`.`)[0]}.json`:`${t}.json`;return e.localesPath===`.`?r:`${e.localesPath}/${r}`}var dr=(e,t)=>e<t?-1:+(e>t);function fr(e,t){let n=e.map(e=>({path:ur(t,e.locale,e.key),draft:e})).sort((e,t)=>dr(e.path,t.path)||dr(e.draft.key,t.draft.key)),r=[],i=null;for(let{path:e,draft:t}of n)e!==i&&(r.push(`--- a/${e}`,`+++ b/${e}`),i=e),r.push(`@@ ${t.key} @@`),t.from!==null&&r.push(`-${JSON.stringify(t.from)}`),r.push(`+${JSON.stringify(t.to)}`);return r.join(`
10
- `)}function pr(e,t){return t===e.to?`live`:(t??null)===e.from?`pending`:`conflict`}var mr=`livelocale:drafts-changed`,hr=R(`share.storage_problem`),gr=R(`share.locale_actions_unsupported`),_r=R(`share.commit_unsupported`),vr=(e,t)=>e.to===t.to&&e.from===t.from&&e.force===t.force&&e.status===t.status&&e.conflict===t.conflict&&e.updatedAt===t.updatedAt&&e.sentAt===t.sentAt,yr=(e,t)=>e.startsWith(t+`.`)||t.startsWith(e+`.`);async function br(e){let{studioUrl:t,appUrl:n,store:r}=e,i=e.manifest,a=e.manifestText,o=e.fetch??((e,t)=>globalThis.fetch(e,t)),s=e.now??(()=>Date.now()),c=e.events??(typeof window<`u`?window:new EventTarget),l=()=>{c.dispatchEvent(new Event(mr))},u=lr(i,n),d=new Map,f=e=>qe(e)&&Xe(e)&&i.locales.includes(e);async function p(e){let n=`locales/${e}.json`,r=await o(new URL(n,t).href,{cache:`no-cache`,credentials:`same-origin`});if(!r.ok)throw Error(R(`share.load_failed`,{path:n,status:r.status}));return await r.json()}function m(e){if(!f(e))return Promise.reject(Error(R(`share.unknown_language`,{locale:e})));let t=d.get(e);return t||(t=p(e),d.set(e,t),t.catch(()=>{d.get(e)===t&&d.delete(e)})),t}async function h(e){return(await r.list(u)).filter(t=>t.locale===e).reverse()}async function g(){let e=await Promise.allSettled(i.locales.map(e=>m(e))),t=[];return e.forEach((e,n)=>{e.status===`fulfilled`&&t.push([i.locales[n],e.value])}),t}async function _(){let e=await r.list(u),t=[...new Set(e.map(e=>e.locale).filter(f))],n=await Promise.allSettled(t.map(e=>m(e))),i=new Map;n.forEach((e,n)=>{e.status===`fulfilled`&&i.set(t[n],e.value)});let a={live:[],conflicts:[]},o=!1;for(let t of e){let e=`conflict`;if(f(t.locale)){let n=i.get(t.locale);if(!n)continue;let r=vn(n,t.key);e=pr(t,r.state===`string`?r.value:void 0)}if(e===`pending`&&!t.conflict)continue;let n=await r.get(u,t.locale,t.key);if(!(!n||!vr(n,t)))if(e===`live`)await r.delete(u,t.locale,t.key),a.live.push(t),o=!0;else if(e===`pending`)await r.put({...t,conflict:!1}),o=!0;else{let e=t.conflict?t:{...t,conflict:!0};t.conflict||(await r.put(e),o=!0),a.conflicts.push(e)}}return o&&l(),a}let v=s(),y=await _().catch(()=>({live:[],conflicts:[]}));async function b(){try{let e=await o(new URL(`manifest.json`,t).href,{cache:`no-store`,credentials:`same-origin`});return e.ok?await e.text():null}catch{return null}}return{get manifest(){return i},scope:u,initialReconcile:y,persistent:r.persistent,events:c,readBuiltLocale:m,async fetchInfo(){return{mode:`static`,authRequired:!1,git:!1,problems:r.persistent?[]:[hr]}},async fetchLocales(){return[...i.locales]},async fetchLocaleDictionary(e){let t=await m(e),n={};for(let t of await h(e))hn(n,t.key,t.to);return mn(t,n)},async fetchKeysMetadata(){let e=new Set(i.codeKeys);for(let[,t]of await g())yn(t,``,e);for(let t of await r.list(u))e.add(t.key);return{allKeys:[...e].sort(),codeKeys:[...i.codeKeys]}},async textCandidates(){let e={};for(let[t,n]of await g()){let r={};for(let e of yn(n)){let t=vn(n,e);t.state===`string`&&(r[e]=[t.value])}for(let e of await h(t)){let t=r[e.key]??=[];t.includes(e.to)||t.push(e.to)}e[t]=r}return e},listDrafts(){return r.list(u)},async discardDraft(e,t){let n=await r.get(u,e,t);return n&&await r.delete(u,e,t),l(),n},async markDraftsSent(e){let t=s();for(let{locale:n,key:i}of e){let e=await r.get(u,n,i);e&&await r.put({...e,status:`sent`,sentAt:t})}l()},async restoreDrafts(e){let t=await r.list(u),n=0;for(let{locale:a,key:o,from:c,to:l,force:d}of e){let e=t.some(e=>e.locale===a&&(e.key===o||yr(e.key,o)));if(!f(a)||e)continue;let p={scope:u,locale:a,key:o,from:c,to:l,force:d,base:i.base,branch:i.branch,status:`unsent`,conflict:!1,updatedAt:s(),sentAt:null};await r.put(p),t.push(p),n++}return n>0&&l(),{added:n,skipped:e.length-n}},async saveTranslation(e,t,n,a={}){let o=await m(e),c=vn(o,t),d=c.state===`string`?c.value:null;if(n===d)return await r.delete(u,e,t),l(),{success:!0,key:t,locale:e};let f=a.force===!0,p=Cn({locale:e,key:t,value:n},{sourceLocale:i.sourceLocale,source:await m(i.sourceLocale),target:o},{force:f});if(!p.ok&&p.status!==422)throw Error(p.error);if((await r.list(u)).filter(n=>n.locale===e&&n.key!==t).some(e=>yr(e.key,t)))throw Error(`Cannot save "${t}" in ${e}: it would replace translations that are not a single text.`);if(!p.ok)throw new Bn(p.error,p.code,p.details);return await r.put({scope:u,locale:e,key:t,from:d,to:n,force:f,base:i.base,branch:i.branch,status:`unsent`,conflict:!1,updatedAt:s(),sentAt:null}),l(),{success:!0,key:t,locale:e}},async discardLocales(){for(let e of await r.list(u))e.status===`unsent`&&await r.delete(u,e.locale,e.key);return l(),{success:!0}},async fetchGitState(){let e=await r.list(u),t=new Set(e.map(e=>ur(i,e.locale,e.key)));return{available:!0,isRepo:!0,branch:i.branch,mode:`static`,changes:[...t].sort().map(e=>({path:e,status:`modified`})),diff:fr(e,i),pullRequestUrl:null}},async refreshManifest(){if(s()-v<6e4)return null;v=s();let e=await b();if(e===null||e===a)return null;let t;try{t=Bt(JSON.parse(e))}catch{t=null}return t?(i=t,a=e,d.clear(),_()):null},addLocaleRequest:()=>Promise.reject(Error(gr)),renameLocaleRequest:()=>Promise.reject(Error(gr)),deleteLocaleRequest:()=>Promise.reject(Error(gr)),commitLocales:()=>Promise.reject(Error(_r))}}function xr(e,t=R){return t(`drafts.unsent`,{count:e})}function Sr(e){let[t,n]=(0,g.useState)([]),[r,i]=(0,g.useState)(()=>e?.initialReconcile?.live??[]),a=(0,g.useCallback)(e=>{e.live.length>0&&i(t=>[...t,...e.live])},[]),o=(0,g.useCallback)(()=>i([]),[]),s=(0,g.useCallback)(async()=>{e&&n(await e.listDrafts())},[e]);(0,g.useEffect)(()=>{if(!e)return;let t=!0,r=()=>{e.listDrafts().then(e=>{t&&n(e)}).catch(()=>{})};return r(),e.events.addEventListener(mr,r),()=>{t=!1,e.events.removeEventListener(mr,r)}},[e]);let c=(0,g.useCallback)(async t=>e?.discardDraft(t.locale,t.key),[e]),l=(0,g.useCallback)(async t=>{e&&await e.markDraftsSent(t.map(({locale:e,key:t})=>({locale:e,key:t})))},[e]),{unsentCount:u,sentCount:d}=(0,g.useMemo)(()=>{let e=t.filter(e=>e.status===`unsent`).length;return{unsentCount:e,sentCount:t.length-e}},[t]);return{drafts:t,unsentCount:u,sentCount:d,refresh:s,discard:c,markSent:l,liveNow:r,noteReconcile:a,dismissLiveNow:o}}var Cr=({className:e})=>(0,z.jsxs)(`svg`,{"data-testid":`brand-mark`,className:e,viewBox:`0 0 64 64`,"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,z.jsxs)(`g`,{className:`fill-logo-ink`,children:[(0,z.jsx)(`rect`,{x:`6`,y:`11`,width:`20`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`29`,y:`11`,width:`29`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`6`,y:`28`,width:`14`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`25`,y:`31`,width:`29`,height:`2`,rx:`1`,opacity:`.5`}),(0,z.jsx)(`rect`,{x:`6`,y:`45`,width:`23`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`32`,y:`45`,width:`12`,height:`8`,rx:`4`})]}),(0,z.jsxs)(`g`,{transform:`rotate(-7 39 32)`,children:[(0,z.jsx)(`rect`,{className:`fill-accent-shadow`,x:`24.5`,y:`24.5`,width:`30`,height:`15`,rx:`4.5`}),(0,z.jsx)(`rect`,{className:`fill-accent`,x:`23`,y:`23`,width:`30`,height:`15`,rx:`4.5`})]})]}),wr={content:`header.source_content`,url:`header.source_url`,manual:`header.source_manual`,remembered:`header.source_remembered`},Tr=({coveragePercentage:e,mode:t,changesCount:n,isChangesOpen:r,onToggleChanges:i,unsentCount:a=0,targetLocale:o=null,locales:s,onChooseLocale:c,canSend:l=!1,onSend:u,reviewCount:d=null,isReviewing:f=d!==null,onCloseReview:p,onImport:m,settings:h})=>{let{t:g}=B(),_=o?.mismatch&&(!s||s.includes(o.mismatch))?o.mismatch:null;return(0,z.jsxs)(`header`,{className:`h-16 bg-surface border-b border-line px-4 xl:px-8 flex items-center justify-between gap-4 shrink-0 select-none`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,z.jsx)(Cr,{className:`h-8 w-8 shrink-0`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{lang:`en`,dir:`ltr`,className:`text-base font-heading font-medium tracking-[-0.02em] text-fg`,children:`livelocale`}),(0,z.jsx)(`p`,{className:`hidden xl:block text-[10px] text-fg-muted font-medium tracking-wider uppercase mt-0.5`,children:g(`header.tagline`)})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-3 xl:gap-5 min-w-0`,children:[o&&(0,z.jsxs)(`div`,{"data-testid":`target-locale`,className:`flex items-center gap-2 select-none min-w-0 overflow-hidden p-1 -m-1`,children:[o.source===null?(0,z.jsx)(`span`,{className:`px-2.5 py-1 rounded-full bg-raised border border-line text-[10px] font-semibold text-fg-muted whitespace-nowrap truncate min-w-0`,children:g(`header.locale_unset`)}):(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-accent-soft border border-accent-line text-[10px] whitespace-nowrap min-w-0`,children:[(0,z.jsx)(`span`,{className:`font-bold text-accent-fg`,children:g(f?`header.viewing`:`header.editing`,{locale:o.locale})}),(0,z.jsx)(`span`,{className:`hidden xl:inline text-fg`,children:g(wr[o.source])})]}),_&&(0,z.jsxs)(`span`,{className:`glyph-warn flex items-center gap-1.5 text-[10px] text-warning-fg whitespace-nowrap shrink-0`,children:[(0,z.jsx)(`span`,{className:`hidden xl:inline`,children:g(`header.mismatch`,{locale:_})}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>c?.(_),title:g(`header.mismatch`,{locale:_}),className:`px-2 py-0.5 rounded-md bg-warning-bg border border-warning-line font-semibold hover:bg-warning-bg transition duration-150`,children:g(`header.switch_locale`,{locale:_})})]})]}),(0,z.jsxs)(`div`,{className:`items-center gap-2.5 shrink-0 ${o?`hidden xl:flex`:`flex`}`,title:g(`header.coverage_title`,{percent:e}),children:[(0,z.jsx)(`span`,{className:`text-[10px] text-fg-muted font-medium select-none whitespace-nowrap`,children:g(`header.coverage`)}),(0,z.jsx)(`div`,{className:`w-16 xl:w-28 h-1.5 bg-raised rounded-full overflow-hidden`,children:(0,z.jsx)(`div`,{className:`h-full rounded-full transition-all duration-700 ease-out ${e>=80?`bg-success-fg`:`bg-warning-fg`}`,style:{width:`${e}%`}})}),(0,z.jsxs)(`span`,{className:`text-[10px] font-bold font-mono text-fg-muted select-none tabular-nums`,children:[e,`%`]})]}),t===`preview`&&(0,z.jsx)(`span`,{className:`glyph-warn px-2.5 py-1 rounded-full bg-warning-bg border border-warning-line text-[10px] font-extrabold tracking-wider text-warning-fg select-none`,title:g(`header.preview_title`),children:g(`header.preview`)}),d!==null&&(0,z.jsx)(`span`,{"data-testid":`review-chip`,className:`shrink-0 px-2.5 py-1 rounded-full bg-accent-soft border border-accent-line text-[10px] font-semibold text-fg select-none whitespace-nowrap`,children:g(`header.reviewing`,{count:d})}),f&&p&&(0,z.jsx)(`button`,{id:`studio-close-review`,type:`button`,onClick:p,className:`shrink-0 px-3 py-1.5 rounded-xl border text-[11px] font-semibold bg-raised border-line text-fg hover:text-fg hover:border-line-strong transition duration-150 whitespace-nowrap`,children:g(`header.close_review`)}),!f&&a>0&&(0,z.jsx)(`span`,{"data-testid":`unsent-counter`,className:`glyph-warn shrink-0 px-2.5 py-1 rounded-full bg-warning-bg border border-warning-line text-[10px] font-semibold text-warning-fg select-none whitespace-nowrap`,title:g(`header.unsent_title`),children:xr(a,g)}),!f&&u&&(0,z.jsx)(`button`,{type:`button`,id:`studio-send-button`,onClick:u,disabled:!l,className:`shrink-0 px-3 py-1.5 rounded-xl border text-[11px] font-semibold bg-accent border-accent-line text-on-accent hover:bg-accent-hover disabled:opacity-40 disabled:cursor-not-allowed transition duration-150 whitespace-nowrap`,title:g(`header.send_title`),children:g(`header.send`)}),t===`development`&&m&&(0,z.jsx)(`button`,{id:`studio-import-button`,type:`button`,onClick:m,className:`shrink-0 px-3 py-1.5 rounded-xl border text-[11px] font-semibold bg-raised border-line text-fg hover:text-fg hover:border-line-strong transition duration-150 whitespace-nowrap`,title:g(`header.import_title`),children:g(`header.import`)}),(0,z.jsxs)(`button`,{type:`button`,id:`studio-changes-button`,onClick:i,className:`shrink-0 flex items-center gap-2 px-3 py-1.5 rounded-xl border text-[11px] font-semibold whitespace-nowrap transition duration-150 ${r?`bg-accent-soft border-accent-line text-accent-fg`:`bg-raised border-line text-fg hover:text-fg hover:border-line-strong`}`,title:g(`header.changes_title`),children:[(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,z.jsx)(`path`,{d:`M12 3v6M12 15v6`})]}),g(`header.changes`),n>0&&(0,z.jsx)(`span`,{className:`glyph-warn px-1.5 py-0.5 rounded-md bg-warning-bg border border-warning-line text-[10px] font-mono font-bold text-warning-fg`,children:n})]}),h!=null&&(0,z.jsx)(`div`,{"data-testid":`header-settings`,className:`flex items-center gap-2 shrink-0`,children:h}),(0,z.jsxs)(`span`,{className:`hidden xl:block px-3 py-1 rounded-full bg-raised border border-line text-[10px] font-bold text-fg-muted select-none whitespace-nowrap`,children:[(0,z.jsxs)(`span`,{dir:`ltr`,children:[`v`,`0.11.0-next.12`]}),` `,g(`header.beta`)]})]})]})},Er=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`),Dr=`[aria-modal="true"]`;function Or(e){let t=document.querySelectorAll(Dr);return t.length===0||t[t.length-1]===e}function kr(e,t){let n=(0,g.useRef)(null),r=(0,g.useRef)(t);return r.current=t,(0,g.useEffect)(()=>{let t=n.current;if(!e||t===null)return;let i=document.activeElement instanceof HTMLElement?document.activeElement:null,a=()=>Array.from(t.querySelectorAll(Er)),o=()=>{let e=a()[0];e?e.focus():(t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus())};o();let s=e=>{if(e.defaultPrevented||!Or(t))return;if(e.key===`Escape`){let t=r.current;if(!t)return;e.preventDefault(),e.stopPropagation(),t();return}if(e.key!==`Tab`)return;let n=a(),i=document.activeElement;if(n.length===0||!t.contains(i)){e.preventDefault(),e.shiftKey&&n.length>0?n[n.length-1].focus():o();return}let s=n[0],c=n[n.length-1];e.shiftKey&&(i===s||i===t)?(e.preventDefault(),c.focus()):!e.shiftKey&&i===c&&(e.preventDefault(),s.focus())};return document.addEventListener(`keydown`,s),()=>{document.removeEventListener(`keydown`,s),i?.isConnected&&i.focus()}},[e]),n}var Ar=({showConfirmModal:e,onConfirm:t,onCancel:n})=>{let{t:r}=B(),i=kr(e,n);return e?(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-confirm-title`,className:`bg-raised border border-line rounded-2xl w-full max-w-md p-6 relative animate-in fade-in zoom-in-95 duration-200`,children:[(0,z.jsx)(`h3`,{id:`studio-confirm-title`,className:`text-base font-bold text-fg font-heading`,children:r(`confirm.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted mt-2 leading-relaxed`,children:r(`confirm.body`)}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:n,className:`px-4 py-2 text-xs font-semibold text-fg-muted hover:text-fg bg-raised hover:bg-raised-hover border border-line hover:border-line-strong rounded-xl transition duration-150`,children:r(`confirm.keep`)}),(0,z.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 text-xs font-semibold bg-transparent border border-dashed border-danger-line text-danger-fg hover:bg-danger-bg rounded-xl transition duration-150`,children:r(`confirm.discard`)})]})]})}):null},jr=({filteredKeys:e,selected:t,localeData:n,searchTerm:r,setSearchTerm:i,filterPageOnly:a,setFilterPageOnly:o,visibleKeys:s,selectKeyDirectly:c,onKeyActivatedByKeyboard:l,className:u=`w-[300px] shrink-0`})=>{let{t:d}=B();return(0,z.jsxs)(`div`,{"data-testid":`keys-directory`,className:`${u} bg-raised border border-line rounded-2xl flex flex-col h-full overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-heading text-fg`,children:d(`keys.title`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-raised text-fg border border-line`,children:d(`keys.count`,{count:e.length})})]}),(0,z.jsxs)(`div`,{className:`p-4 border-b border-line shrink-0 bg-raised space-y-3`,children:[(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(`input`,{id:`studio-keys-search`,type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:d(`keys.search`),"aria-label":d(`keys.search_label`),className:`w-full h-9 ps-9 pe-4 bg-surface border border-line hover:border-line-strong rounded-lg text-xs text-fg placeholder-fg-muted transition duration-150`}),(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5 text-fg-muted absolute start-3 top-2.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[10px] text-fg-muted font-semibold uppercase tracking-wider`,children:d(`keys.scope`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface border border-line rounded-lg p-0.5 select-none shrink-0`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(!1),"aria-pressed":!a,className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition-colors duration-150 ${a?`text-fg-muted hover:text-fg`:`bg-raised hover:bg-raised-hover text-fg border border-line`}`,children:d(`keys.all`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(!0),"aria-pressed":a,disabled:s===null,className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition-colors duration-150 ${a?`bg-raised hover:bg-raised-hover text-fg border border-line`:`text-fg-muted hover:text-fg disabled:opacity-40 disabled:cursor-not-allowed`}`,title:d(s===null?`keys.page_waiting`:`keys.page_title`),children:d(`keys.page`)})]})]})]}),(0,z.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,z.jsxs)(`button`,{type:`button`,onClick:t=>{c(e),t.detail===0&&l?.(e)},"aria-current":r?`true`:void 0,className:`w-full text-start p-3 rounded-xl border transition duration-150 flex flex-col gap-1.5 ${r?`relative bg-accent-soft border-accent-line text-fg`:`bg-surface hover:bg-surface border-transparent text-fg hover:text-fg`}`,children:[r&&(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`key-row-bar`,className:`absolute inset-y-2 start-0 w-0.75 rounded-full bg-accent-fg`}),(0,z.jsxs)(`div`,{className:`w-full flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-semibold font-mono break-all line-clamp-2 leading-relaxed text-info-fg`,children:e}),a&&(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-transparent text-[8px] font-extrabold text-danger-fg border-[1.5px] border-dashed border-danger-line shrink-0 uppercase tracking-wider`,children:d(`keys.missing`)})]}),(0,z.jsx)(`span`,{dir:`auto`,className:`text-[10px] break-all line-clamp-1 ${r?`text-fg`:`text-fg-muted`}`,children:i||(0,z.jsx)(`span`,{className:`italic`,children:d(`keys.empty_value`)})})]},e)}):(0,z.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center p-6 text-center text-fg-muted select-none`,children:[(0,z.jsx)(`svg`,{className:`w-8 h-8 text-fg-muted mb-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsx)(`span`,{className:`text-xs`,children:d(`keys.none`)})]})})]})},Mr={unsent:`draft_list.status_unsent`,sent:`draft_list.status_sent`,live:`draft_list.status_live`,conflict:`draft_list.status_conflict`},Nr={unsent:`glyph-warn text-warning-fg border-warning-line bg-warning-bg`,sent:`glyph-info text-info-fg border-info-line bg-info-bg`,live:`glyph-done text-success-fg border-success-line bg-success-bg`,conflict:`text-danger-fg border-dashed border-danger-line bg-danger-bg`};function Pr(e){return e.conflict?`conflict`:e.status}var Fr=({state:e})=>{let{t}=B();return(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[9px] font-extrabold uppercase tracking-wider border ${Nr[e]}`,children:t(Mr[e])})},Ir=e=>(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-mono text-info-fg break-all`,children:`${e.key} · ${e.locale}`}),Lr=({d:e})=>{let{t}=B();return(0,z.jsxs)(`div`,{className:`text-[10px] leading-relaxed`,children:[e.from?(0,z.jsx)(`span`,{dir:`auto`,className:`text-fg-muted line-through decoration-fg-faint break-all`,children:e.from}):(0,z.jsx)(`em`,{className:`text-fg-muted line-through decoration-fg-faint`,children:t(`draft_list.empty`)}),(0,z.jsx)(`span`,{className:`text-fg-muted`,"aria-hidden":`true`,children:` ${t(`common.arrow`)} `}),e.to?(0,z.jsx)(`span`,{dir:`auto`,className:`text-accent-fg break-all`,children:e.to}):(0,z.jsx)(`em`,{className:`text-accent-fg`,children:t(`draft_list.empty`)})]})},Rr=`px-3 py-2 rounded-xl bg-surface border border-line space-y-1`,zr=`h-9 px-3 rounded-xl text-xs font-semibold text-fg hover:text-fg bg-raised hover:bg-raised-hover border border-line-strong transition duration-150 cursor-pointer`,Br=({drafts:e,onUndo:t,isUndoing:n,onDownloadBackup:r,onRestoreBackup:i,onReviewChange:a,liveNow:o=[],onDismissLiveNow:s})=>{let{t:c}=B(),[l,u]=(0,g.useState)(null);return(0,z.jsxs)(`section`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`h3`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:c(`draft_list.title`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-surface text-fg border border-line`,children:e.length})]}),e.length===0&&o.length===0?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c(`draft_list.none`)}):(0,z.jsxs)(`ul`,{className:`space-y-1.5`,children:[e.map(e=>{let r=Pr(e),i=r===`sent`;return(0,z.jsxs)(`li`,{className:Rr,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[Ir(e),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,z.jsx)(Fr,{state:r}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>t(e),disabled:n,className:`text-[10px] font-semibold text-fg-muted hover:text-fg px-2 py-0.5 rounded-md border border-line hover:border-line-strong disabled:opacity-40 transition duration-150`,title:c(i?`draft_list.remove_title`:`draft_list.undo_title`),"aria-label":c(i?`draft_list.remove_aria`:`draft_list.undo_aria`,{key:e.key,locale:e.locale}),children:c(i?`draft_list.remove`:`draft_list.undo`)})]})]}),(0,z.jsx)(Lr,{d:e})]},`${e.locale}/${e.key}`)}),o.map(e=>(0,z.jsxs)(`li`,{className:Rr,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[Ir(e),(0,z.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,z.jsx)(Fr,{state:`live`})})]}),(0,z.jsx)(Lr,{d:e})]},`live:${e.locale}/${e.key}`))]}),o.length>0&&s&&(0,z.jsx)(`button`,{type:`button`,onClick:s,className:`text-[10px] font-semibold text-fg-muted hover:text-fg transition duration-150`,children:c(`draft_list.dismiss_live`)}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:async()=>{u(null);try{await r(),u(c(`draft_list.backup_downloaded`))}catch(e){u(e?.message||c(`draft_list.backup_failed`))}},disabled:e.length===0,className:`${zr} disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`draft_list.download`)}),(0,z.jsxs)(`label`,{className:`${zr} inline-flex items-center`,children:[c(`draft_list.restore`),(0,z.jsx)(`input`,{type:`file`,accept:`.txt,text/plain`,onChange:async e=>{let t=e.currentTarget,n=t.files?.[0];if(n){u(null);try{u(await i(n))}catch(e){u(e?.message||c(`draft_list.restore_failed`))}finally{t.value=``}}},className:`sr-only`})]}),a&&(0,z.jsx)(`button`,{type:`button`,onClick:a,className:zr,children:c(`draft_list.review`)})]}),l&&(0,z.jsx)(`p`,{role:`status`,className:`text-[11px] text-fg-muted break-words`,children:he(c,l)})]})},Vr=async()=>{},Hr=async()=>``,Ur={modified:`glyph-warn text-warning-fg border-warning-line bg-warning-bg`,added:`text-accent-fg border-accent-line bg-accent-soft`,deleted:`text-danger-fg border-dashed border-danger-line bg-danger-bg`,renamed:`glyph-info text-info-fg border-info-line bg-info-bg`},Wr={modified:`changes.status_modified`,added:`changes.status_added`,deleted:`changes.status_deleted`,renamed:`changes.status_renamed`},Gr=e=>e.startsWith(`+++`)||e.startsWith(`---`)?`text-fg-muted`:e.startsWith(`@@`)?`text-info-fg`:e.startsWith(`diff `)||e.startsWith(`new file`)?`text-fg-muted`:e.startsWith(`+`)?`text-fg bg-accent-soft`:e.startsWith(`-`)?`text-fg-muted line-through decoration-fg-faint`:`text-fg-muted`,Kr=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),qr=({isOpen:e,onClose:t,git:n,gitError:r,isGitLoading:i,lastCommit:a,onCommit:o,onDiscard:s,onRefresh:c,history:l,onUndo:u,isUndoing:d,drafts:f,onUndoDraft:p=Vr,onDownloadBackup:m=Vr,onRestoreBackup:h=Hr,onReviewChange:_,liveNow:v,onDismissLiveNow:y})=>{let{t:b}=B(),[x,S]=(0,g.useState)(``),[C,w]=(0,g.useState)(!1),[T,E]=(0,g.useState)(!1),D=kr(e,t);if(!e)return null;let O=n?.changes??[],k=n?.mode===`github`,A=!!n?.isRepo&&O.length>0&&x.trim().length>0,j=(e,t)=>{let[n,r]=b(e).split(`{code}`);return(0,z.jsxs)(z.Fragment,{children:[n,(0,z.jsx)(`code`,{className:`font-mono text-fg-muted`,children:t}),r]})};return(0,z.jsxs)(`div`,{className:`fixed inset-0 top-16 z-40 flex justify-end`,"data-testid":`changes-panel`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 bg-overlay`,onClick:t}),(0,z.jsxs)(`aside`,{ref:D,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-changes-title`,className:`relative w-[520px] max-w-full h-full bg-raised border-s border-line flex flex-col animate-in slide-in-from-end duration-200`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`h2`,{id:`studio-changes-title`,className:`text-sm font-bold tracking-wide font-heading text-fg`,children:b(`changes.title`)}),n?.isRepo&&n.branch&&(0,z.jsx)(`span`,{dir:`ltr`,className:`px-2 py-0.5 rounded-md bg-raised border border-line text-[10px] font-mono text-fg`,children:n.branch})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:c,className:`p-1.5 rounded-lg text-fg-muted hover:text-fg hover:bg-raised-hover border border-transparent hover:border-line-strong transition duration-150`,"aria-label":b(`changes.refresh`),title:b(`changes.refresh`),children:(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,z.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,z.jsx)(`path`,{d:`M21 3v5h-5`})]})}),(0,z.jsx)(`button`,{type:`button`,onClick:t,className:`p-1.5 rounded-lg text-fg-muted hover:text-fg hover:bg-raised-hover border border-transparent hover:border-line-strong transition duration-150`,"aria-label":b(`changes.close`),title:b(`changes.close`),children:(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})})})]})]}),Array.isArray(f)?(0,z.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6`,children:(0,z.jsx)(Br,{drafts:f,onUndo:p,isUndoing:d,onDownloadBackup:m,onRestoreBackup:h,onReviewChange:_,liveNow:v,onDismissLiveNow:y})}):(0,z.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6`,children:[(0,z.jsxs)(`section`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:b(`changes.locale_files`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-surface text-fg border border-line`,children:b(`changes.changed`,{count:O.length})})]}),n===null?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b(`changes.loading`)}):n.available?n.isRepo?O.length===0?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b(`changes.clean`)}):(0,z.jsx)(`ul`,{className:`space-y-1.5`,children:O.map(e=>(0,z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2 rounded-xl bg-surface border border-line`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-mono text-info-fg break-all`,children:e.path}),(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[9px] font-extrabold uppercase tracking-wider border shrink-0 ${Ur[e.status]??Ur.modified}`,children:Wr[e.status]?b(Wr[e.status]):e.status})]},e.path))}):(0,z.jsx)(`p`,{className:`text-xs text-fg-muted leading-relaxed`,children:j(`changes.not_repo`,`git`)}):(0,z.jsx)(`p`,{className:`text-xs text-fg-muted leading-relaxed`,children:j(`changes.git_disabled`,`git: false`)}),n?.isRepo&&O.length>0&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>E(e=>!e),className:`text-[10px] font-semibold text-fg-muted hover:text-fg transition duration-150`,children:b(T?`changes.hide_diff`:`changes.show_diff`)}),T&&(0,z.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-xl bg-surface border border-line p-3 text-[10px] font-mono leading-relaxed whitespace-pre`,children:n.diff.split(`
10
+ `)}function pr(e,t){return t===e.to?`live`:(t??null)===e.from?`pending`:`conflict`}var mr=`livelocale:drafts-changed`,hr=R(`share.storage_problem`),gr=R(`share.locale_actions_unsupported`),_r=R(`share.commit_unsupported`),vr=(e,t)=>e.to===t.to&&e.from===t.from&&e.force===t.force&&e.status===t.status&&e.conflict===t.conflict&&e.updatedAt===t.updatedAt&&e.sentAt===t.sentAt,yr=(e,t)=>e.startsWith(t+`.`)||t.startsWith(e+`.`);async function br(e){let{studioUrl:t,appUrl:n,store:r}=e,i=e.manifest,a=e.manifestText,o=e.fetch??((e,t)=>globalThis.fetch(e,t)),s=e.now??(()=>Date.now()),c=e.events??(typeof window<`u`?window:new EventTarget),l=()=>{c.dispatchEvent(new Event(mr))},u=lr(i,n),d=new Map,f=e=>qe(e)&&Xe(e)&&i.locales.includes(e);async function p(e){let n=`locales/${e}.json`,r=await o(new URL(n,t).href,{cache:`no-cache`,credentials:`same-origin`});if(!r.ok)throw Error(R(`share.load_failed`,{path:n,status:r.status}));return await r.json()}function m(e){if(!f(e))return Promise.reject(Error(R(`share.unknown_language`,{locale:e})));let t=d.get(e);return t||(t=p(e),d.set(e,t),t.catch(()=>{d.get(e)===t&&d.delete(e)})),t}async function h(e){return(await r.list(u)).filter(t=>t.locale===e).reverse()}async function g(){let e=await Promise.allSettled(i.locales.map(e=>m(e))),t=[];return e.forEach((e,n)=>{e.status===`fulfilled`&&t.push([i.locales[n],e.value])}),t}async function _(){let e=await r.list(u),t=[...new Set(e.map(e=>e.locale).filter(f))],n=await Promise.allSettled(t.map(e=>m(e))),i=new Map;n.forEach((e,n)=>{e.status===`fulfilled`&&i.set(t[n],e.value)});let a={live:[],conflicts:[]},o=!1;for(let t of e){let e=`conflict`;if(f(t.locale)){let n=i.get(t.locale);if(!n)continue;let r=vn(n,t.key);e=pr(t,r.state===`string`?r.value:void 0)}if(e===`pending`&&!t.conflict)continue;let n=await r.get(u,t.locale,t.key);if(!(!n||!vr(n,t)))if(e===`live`)await r.delete(u,t.locale,t.key),a.live.push(t),o=!0;else if(e===`pending`)await r.put({...t,conflict:!1}),o=!0;else{let e=t.conflict?t:{...t,conflict:!0};t.conflict||(await r.put(e),o=!0),a.conflicts.push(e)}}return o&&l(),a}let v=s(),y=await _().catch(()=>({live:[],conflicts:[]}));async function b(){try{let e=await o(new URL(`manifest.json`,t).href,{cache:`no-store`,credentials:`same-origin`});return e.ok?await e.text():null}catch{return null}}return{get manifest(){return i},scope:u,initialReconcile:y,persistent:r.persistent,events:c,readBuiltLocale:m,async fetchInfo(){return{mode:`static`,authRequired:!1,git:!1,problems:r.persistent?[]:[hr]}},async fetchLocales(){return[...i.locales]},async fetchLocaleDictionary(e){let t=await m(e),n={};for(let t of await h(e))hn(n,t.key,t.to);return mn(t,n)},async fetchKeysMetadata(){let e=new Set(i.codeKeys);for(let[,t]of await g())yn(t,``,e);for(let t of await r.list(u))e.add(t.key);return{allKeys:[...e].sort(),codeKeys:[...i.codeKeys]}},async textCandidates(){let e={};for(let[t,n]of await g()){let r={};for(let e of yn(n)){let t=vn(n,e);t.state===`string`&&(r[e]=[t.value])}for(let e of await h(t)){let t=r[e.key]??=[];t.includes(e.to)||t.push(e.to)}e[t]=r}return e},listDrafts(){return r.list(u)},async discardDraft(e,t){let n=await r.get(u,e,t);return n&&await r.delete(u,e,t),l(),n},async markDraftsSent(e){let t=s();for(let{locale:n,key:i}of e){let e=await r.get(u,n,i);e&&await r.put({...e,status:`sent`,sentAt:t})}l()},async restoreDrafts(e){let t=await r.list(u),n=0;for(let{locale:a,key:o,from:c,to:l,force:d}of e){let e=t.some(e=>e.locale===a&&(e.key===o||yr(e.key,o)));if(!f(a)||e)continue;let p={scope:u,locale:a,key:o,from:c,to:l,force:d,base:i.base,branch:i.branch,status:`unsent`,conflict:!1,updatedAt:s(),sentAt:null};await r.put(p),t.push(p),n++}return n>0&&l(),{added:n,skipped:e.length-n}},async saveTranslation(e,t,n,a={}){let o=await m(e),c=vn(o,t),d=c.state===`string`?c.value:null;if(n===d)return await r.delete(u,e,t),l(),{success:!0,key:t,locale:e};let f=a.force===!0,p=Cn({locale:e,key:t,value:n},{sourceLocale:i.sourceLocale,source:await m(i.sourceLocale),target:o},{force:f});if(!p.ok&&p.status!==422)throw Error(p.error);if((await r.list(u)).filter(n=>n.locale===e&&n.key!==t).some(e=>yr(e.key,t)))throw Error(`Cannot save "${t}" in ${e}: it would replace translations that are not a single text.`);if(!p.ok)throw new Bn(p.error,p.code,p.details);return await r.put({scope:u,locale:e,key:t,from:d,to:n,force:f,base:i.base,branch:i.branch,status:`unsent`,conflict:!1,updatedAt:s(),sentAt:null}),l(),{success:!0,key:t,locale:e}},async discardLocales(){for(let e of await r.list(u))e.status===`unsent`&&await r.delete(u,e.locale,e.key);return l(),{success:!0}},async fetchGitState(){let e=await r.list(u),t=new Set(e.map(e=>ur(i,e.locale,e.key)));return{available:!0,isRepo:!0,branch:i.branch,mode:`static`,changes:[...t].sort().map(e=>({path:e,status:`modified`})),diff:fr(e,i),pullRequestUrl:null}},async refreshManifest(){if(s()-v<6e4)return null;v=s();let e=await b();if(e===null||e===a)return null;let t;try{t=Bt(JSON.parse(e))}catch{t=null}return t?(i=t,a=e,d.clear(),_()):null},addLocaleRequest:()=>Promise.reject(Error(gr)),renameLocaleRequest:()=>Promise.reject(Error(gr)),deleteLocaleRequest:()=>Promise.reject(Error(gr)),commitLocales:()=>Promise.reject(Error(_r))}}function xr(e,t=R){return t(`drafts.unsent`,{count:e})}function Sr(e){let[t,n]=(0,g.useState)([]),[r,i]=(0,g.useState)(()=>e?.initialReconcile?.live??[]),a=(0,g.useCallback)(e=>{e.live.length>0&&i(t=>[...t,...e.live])},[]),o=(0,g.useCallback)(()=>i([]),[]),s=(0,g.useCallback)(async()=>{e&&n(await e.listDrafts())},[e]);(0,g.useEffect)(()=>{if(!e)return;let t=!0,r=()=>{e.listDrafts().then(e=>{t&&n(e)}).catch(()=>{})};return r(),e.events.addEventListener(mr,r),()=>{t=!1,e.events.removeEventListener(mr,r)}},[e]);let c=(0,g.useCallback)(async t=>e?.discardDraft(t.locale,t.key),[e]),l=(0,g.useCallback)(async t=>{e&&await e.markDraftsSent(t.map(({locale:e,key:t})=>({locale:e,key:t})))},[e]),{unsentCount:u,sentCount:d}=(0,g.useMemo)(()=>{let e=t.filter(e=>e.status===`unsent`).length;return{unsentCount:e,sentCount:t.length-e}},[t]);return{drafts:t,unsentCount:u,sentCount:d,refresh:s,discard:c,markSent:l,liveNow:r,noteReconcile:a,dismissLiveNow:o}}var Cr=({className:e})=>(0,z.jsxs)(`svg`,{"data-testid":`brand-mark`,className:e,viewBox:`0 0 64 64`,"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,z.jsxs)(`g`,{className:`fill-logo-ink`,children:[(0,z.jsx)(`rect`,{x:`6`,y:`11`,width:`20`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`29`,y:`11`,width:`29`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`6`,y:`28`,width:`14`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`25`,y:`31`,width:`29`,height:`2`,rx:`1`,opacity:`.5`}),(0,z.jsx)(`rect`,{x:`6`,y:`45`,width:`23`,height:`8`,rx:`4`}),(0,z.jsx)(`rect`,{x:`32`,y:`45`,width:`12`,height:`8`,rx:`4`})]}),(0,z.jsxs)(`g`,{transform:`rotate(-7 39 32)`,children:[(0,z.jsx)(`rect`,{className:`fill-accent-shadow`,x:`24.5`,y:`24.5`,width:`30`,height:`15`,rx:`4.5`}),(0,z.jsx)(`rect`,{className:`fill-accent`,x:`23`,y:`23`,width:`30`,height:`15`,rx:`4.5`})]})]}),wr={content:`header.source_content`,url:`header.source_url`,manual:`header.source_manual`,remembered:`header.source_remembered`},Tr=({coveragePercentage:e,mode:t,changesCount:n,isChangesOpen:r,onToggleChanges:i,unsentCount:a=0,targetLocale:o=null,locales:s,onChooseLocale:c,canSend:l=!1,onSend:u,reviewCount:d=null,isReviewing:f=d!==null,onCloseReview:p,onImport:m,settings:h})=>{let{t:g}=B(),_=o?.mismatch&&(!s||s.includes(o.mismatch))?o.mismatch:null;return(0,z.jsxs)(`header`,{className:`h-16 bg-surface border-b border-line px-4 xl:px-8 flex items-center justify-between gap-4 shrink-0 select-none`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,z.jsx)(Cr,{className:`h-8 w-8 shrink-0`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{lang:`en`,dir:`ltr`,className:`text-base font-heading font-medium tracking-[-0.02em] text-fg`,children:`livelocale`}),(0,z.jsx)(`p`,{className:`hidden xl:block text-[10px] text-fg-muted font-medium tracking-wider uppercase mt-0.5`,children:g(`header.tagline`)})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-3 xl:gap-5 min-w-0`,children:[o&&(0,z.jsxs)(`div`,{"data-testid":`target-locale`,className:`flex items-center gap-2 select-none min-w-0 overflow-hidden p-1 -m-1`,children:[o.source===null?(0,z.jsx)(`span`,{className:`px-2.5 py-1 rounded-full bg-raised border border-line text-[10px] font-semibold text-fg-muted whitespace-nowrap truncate min-w-0`,children:g(`header.locale_unset`)}):(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-accent-soft border border-accent-line text-[10px] whitespace-nowrap min-w-0`,children:[(0,z.jsx)(`span`,{className:`font-bold text-accent-fg`,children:g(f?`header.viewing`:`header.editing`,{locale:o.locale})}),(0,z.jsx)(`span`,{className:`hidden xl:inline text-fg`,children:g(wr[o.source])})]}),_&&(0,z.jsxs)(`span`,{className:`glyph-warn flex items-center gap-1.5 text-[10px] text-warning-fg whitespace-nowrap shrink-0`,children:[(0,z.jsx)(`span`,{className:`hidden xl:inline`,children:g(`header.mismatch`,{locale:_})}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>c?.(_),title:g(`header.mismatch`,{locale:_}),className:`px-2 py-0.5 rounded-md bg-warning-bg border border-warning-line font-semibold hover:bg-warning-bg transition duration-150`,children:g(`header.switch_locale`,{locale:_})})]})]}),(0,z.jsxs)(`div`,{className:`items-center gap-2.5 shrink-0 ${o?`hidden xl:flex`:`flex`}`,title:g(`header.coverage_title`,{percent:e}),children:[(0,z.jsx)(`span`,{className:`text-[10px] text-fg-muted font-medium select-none whitespace-nowrap`,children:g(`header.coverage`)}),(0,z.jsx)(`div`,{className:`w-16 xl:w-28 h-1.5 bg-raised rounded-full overflow-hidden`,children:(0,z.jsx)(`div`,{className:`h-full rounded-full transition-all duration-700 ease-out ${e>=80?`bg-success-fg`:`bg-warning-fg`}`,style:{width:`${e}%`}})}),(0,z.jsxs)(`span`,{className:`text-[10px] font-bold font-mono text-fg-muted select-none tabular-nums`,children:[e,`%`]})]}),t===`preview`&&(0,z.jsx)(`span`,{className:`glyph-warn px-2.5 py-1 rounded-full bg-warning-bg border border-warning-line text-[10px] font-extrabold tracking-wider text-warning-fg select-none`,title:g(`header.preview_title`),children:g(`header.preview`)}),d!==null&&(0,z.jsx)(`span`,{"data-testid":`review-chip`,className:`shrink-0 px-2.5 py-1 rounded-full bg-accent-soft border border-accent-line text-[10px] font-semibold text-fg select-none whitespace-nowrap`,children:g(`header.reviewing`,{count:d})}),f&&p&&(0,z.jsx)(`button`,{id:`studio-close-review`,type:`button`,onClick:p,className:`shrink-0 px-3 py-1.5 rounded-xl border text-[11px] font-semibold bg-raised border-line text-fg hover:text-fg hover:border-line-strong transition duration-150 whitespace-nowrap`,children:g(`header.close_review`)}),!f&&a>0&&(0,z.jsx)(`span`,{"data-testid":`unsent-counter`,className:`glyph-warn shrink-0 px-2.5 py-1 rounded-full bg-warning-bg border border-warning-line text-[10px] font-semibold text-warning-fg select-none whitespace-nowrap`,title:g(`header.unsent_title`),children:xr(a,g)}),!f&&u&&(0,z.jsx)(`button`,{type:`button`,id:`studio-send-button`,onClick:u,disabled:!l,className:`shrink-0 px-3 py-1.5 rounded-xl border text-[11px] font-semibold bg-accent border-accent-line text-on-accent hover:bg-accent-hover disabled:opacity-40 disabled:cursor-not-allowed transition duration-150 whitespace-nowrap`,title:g(`header.send_title`),children:g(`header.send`)}),t===`development`&&m&&(0,z.jsx)(`button`,{id:`studio-import-button`,type:`button`,onClick:m,className:`shrink-0 px-3 py-1.5 rounded-xl border text-[11px] font-semibold bg-raised border-line text-fg hover:text-fg hover:border-line-strong transition duration-150 whitespace-nowrap`,title:g(`header.import_title`),children:g(`header.import`)}),(0,z.jsxs)(`button`,{type:`button`,id:`studio-changes-button`,onClick:i,className:`shrink-0 flex items-center gap-2 px-3 py-1.5 rounded-xl border text-[11px] font-semibold whitespace-nowrap transition duration-150 ${r?`bg-accent-soft border-accent-line text-accent-fg`:`bg-raised border-line text-fg hover:text-fg hover:border-line-strong`}`,title:g(`header.changes_title`),children:[(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,z.jsx)(`path`,{d:`M12 3v6M12 15v6`})]}),g(`header.changes`),n>0&&(0,z.jsx)(`span`,{className:`glyph-warn px-1.5 py-0.5 rounded-md bg-warning-bg border border-warning-line text-[10px] font-mono font-bold text-warning-fg`,children:n})]}),h!=null&&(0,z.jsx)(`div`,{"data-testid":`header-settings`,className:`flex items-center gap-2 shrink-0`,children:h}),(0,z.jsxs)(`span`,{className:`hidden xl:block px-3 py-1 rounded-full bg-raised border border-line text-[10px] font-bold text-fg-muted select-none whitespace-nowrap`,children:[(0,z.jsxs)(`span`,{dir:`ltr`,children:[`v`,`0.11.0`]}),` `,g(`header.beta`)]})]})]})},Er=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`),Dr=`[aria-modal="true"]`;function Or(e){let t=document.querySelectorAll(Dr);return t.length===0||t[t.length-1]===e}function kr(e,t){let n=(0,g.useRef)(null),r=(0,g.useRef)(t);return r.current=t,(0,g.useEffect)(()=>{let t=n.current;if(!e||t===null)return;let i=document.activeElement instanceof HTMLElement?document.activeElement:null,a=()=>Array.from(t.querySelectorAll(Er)),o=()=>{let e=a()[0];e?e.focus():(t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus())};o();let s=e=>{if(e.defaultPrevented||!Or(t))return;if(e.key===`Escape`){let t=r.current;if(!t)return;e.preventDefault(),e.stopPropagation(),t();return}if(e.key!==`Tab`)return;let n=a(),i=document.activeElement;if(n.length===0||!t.contains(i)){e.preventDefault(),e.shiftKey&&n.length>0?n[n.length-1].focus():o();return}let s=n[0],c=n[n.length-1];e.shiftKey&&(i===s||i===t)?(e.preventDefault(),c.focus()):!e.shiftKey&&i===c&&(e.preventDefault(),s.focus())};return document.addEventListener(`keydown`,s),()=>{document.removeEventListener(`keydown`,s),i?.isConnected&&i.focus()}},[e]),n}var Ar=({showConfirmModal:e,onConfirm:t,onCancel:n})=>{let{t:r}=B(),i=kr(e,n);return e?(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-confirm-title`,className:`bg-raised border border-line rounded-2xl w-full max-w-md p-6 relative animate-in fade-in zoom-in-95 duration-200`,children:[(0,z.jsx)(`h3`,{id:`studio-confirm-title`,className:`text-base font-bold text-fg font-heading`,children:r(`confirm.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted mt-2 leading-relaxed`,children:r(`confirm.body`)}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:n,className:`px-4 py-2 text-xs font-semibold text-fg-muted hover:text-fg bg-raised hover:bg-raised-hover border border-line hover:border-line-strong rounded-xl transition duration-150`,children:r(`confirm.keep`)}),(0,z.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 text-xs font-semibold bg-transparent border border-dashed border-danger-line text-danger-fg hover:bg-danger-bg rounded-xl transition duration-150`,children:r(`confirm.discard`)})]})]})}):null},jr=({filteredKeys:e,selected:t,localeData:n,searchTerm:r,setSearchTerm:i,filterPageOnly:a,setFilterPageOnly:o,visibleKeys:s,selectKeyDirectly:c,onKeyActivatedByKeyboard:l,className:u=`w-[300px] shrink-0`})=>{let{t:d}=B();return(0,z.jsxs)(`div`,{"data-testid":`keys-directory`,className:`${u} bg-raised border border-line rounded-2xl flex flex-col h-full overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-heading text-fg`,children:d(`keys.title`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-raised text-fg border border-line`,children:d(`keys.count`,{count:e.length})})]}),(0,z.jsxs)(`div`,{className:`p-4 border-b border-line shrink-0 bg-raised space-y-3`,children:[(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(`input`,{id:`studio-keys-search`,type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:d(`keys.search`),"aria-label":d(`keys.search_label`),className:`w-full h-9 ps-9 pe-4 bg-surface border border-line hover:border-line-strong rounded-lg text-xs text-fg placeholder-fg-muted transition duration-150`}),(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5 text-fg-muted absolute start-3 top-2.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[10px] text-fg-muted font-semibold uppercase tracking-wider`,children:d(`keys.scope`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface border border-line rounded-lg p-0.5 select-none shrink-0`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(!1),"aria-pressed":!a,className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition-colors duration-150 ${a?`text-fg-muted hover:text-fg`:`bg-raised hover:bg-raised-hover text-fg border border-line`}`,children:d(`keys.all`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(!0),"aria-pressed":a,disabled:s===null,className:`px-2.5 py-1 text-[9px] font-bold rounded-md transition-colors duration-150 ${a?`bg-raised hover:bg-raised-hover text-fg border border-line`:`text-fg-muted hover:text-fg disabled:opacity-40 disabled:cursor-not-allowed`}`,title:d(s===null?`keys.page_waiting`:`keys.page_title`),children:d(`keys.page`)})]})]})]}),(0,z.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,z.jsxs)(`button`,{type:`button`,onClick:t=>{c(e),t.detail===0&&l?.(e)},"aria-current":r?`true`:void 0,className:`w-full text-start p-3 rounded-xl border transition duration-150 flex flex-col gap-1.5 ${r?`relative bg-accent-soft border-accent-line text-fg`:`bg-surface hover:bg-surface border-transparent text-fg hover:text-fg`}`,children:[r&&(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`key-row-bar`,className:`absolute inset-y-2 start-0 w-0.75 rounded-full bg-accent-fg`}),(0,z.jsxs)(`div`,{className:`w-full flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-semibold font-mono break-all line-clamp-2 leading-relaxed text-info-fg`,children:e}),a&&(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-transparent text-[8px] font-extrabold text-danger-fg border-[1.5px] border-dashed border-danger-line shrink-0 uppercase tracking-wider`,children:d(`keys.missing`)})]}),(0,z.jsx)(`span`,{dir:`auto`,className:`text-[10px] break-all line-clamp-1 ${r?`text-fg`:`text-fg-muted`}`,children:i||(0,z.jsx)(`span`,{className:`italic`,children:d(`keys.empty_value`)})})]},e)}):(0,z.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center p-6 text-center text-fg-muted select-none`,children:[(0,z.jsx)(`svg`,{className:`w-8 h-8 text-fg-muted mb-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.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,z.jsx)(`span`,{className:`text-xs`,children:d(`keys.none`)})]})})]})},Mr={unsent:`draft_list.status_unsent`,sent:`draft_list.status_sent`,live:`draft_list.status_live`,conflict:`draft_list.status_conflict`},Nr={unsent:`glyph-warn text-warning-fg border-warning-line bg-warning-bg`,sent:`glyph-info text-info-fg border-info-line bg-info-bg`,live:`glyph-done text-success-fg border-success-line bg-success-bg`,conflict:`text-danger-fg border-dashed border-danger-line bg-danger-bg`};function Pr(e){return e.conflict?`conflict`:e.status}var Fr=({state:e})=>{let{t}=B();return(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[9px] font-extrabold uppercase tracking-wider border ${Nr[e]}`,children:t(Mr[e])})},Ir=e=>(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-mono text-info-fg break-all`,children:`${e.key} · ${e.locale}`}),Lr=({d:e})=>{let{t}=B();return(0,z.jsxs)(`div`,{className:`text-[10px] leading-relaxed`,children:[e.from?(0,z.jsx)(`span`,{dir:`auto`,className:`text-fg-muted line-through decoration-fg-faint break-all`,children:e.from}):(0,z.jsx)(`em`,{className:`text-fg-muted line-through decoration-fg-faint`,children:t(`draft_list.empty`)}),(0,z.jsx)(`span`,{className:`text-fg-muted`,"aria-hidden":`true`,children:` ${t(`common.arrow`)} `}),e.to?(0,z.jsx)(`span`,{dir:`auto`,className:`text-accent-fg break-all`,children:e.to}):(0,z.jsx)(`em`,{className:`text-accent-fg`,children:t(`draft_list.empty`)})]})},Rr=`px-3 py-2 rounded-xl bg-surface border border-line space-y-1`,zr=`h-9 px-3 rounded-xl text-xs font-semibold text-fg hover:text-fg bg-raised hover:bg-raised-hover border border-line-strong transition duration-150 cursor-pointer`,Br=({drafts:e,onUndo:t,isUndoing:n,onDownloadBackup:r,onRestoreBackup:i,onReviewChange:a,liveNow:o=[],onDismissLiveNow:s})=>{let{t:c}=B(),[l,u]=(0,g.useState)(null);return(0,z.jsxs)(`section`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`h3`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:c(`draft_list.title`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-surface text-fg border border-line`,children:e.length})]}),e.length===0&&o.length===0?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c(`draft_list.none`)}):(0,z.jsxs)(`ul`,{className:`space-y-1.5`,children:[e.map(e=>{let r=Pr(e),i=r===`sent`;return(0,z.jsxs)(`li`,{className:Rr,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[Ir(e),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,z.jsx)(Fr,{state:r}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>t(e),disabled:n,className:`text-[10px] font-semibold text-fg-muted hover:text-fg px-2 py-0.5 rounded-md border border-line hover:border-line-strong disabled:opacity-40 transition duration-150`,title:c(i?`draft_list.remove_title`:`draft_list.undo_title`),"aria-label":c(i?`draft_list.remove_aria`:`draft_list.undo_aria`,{key:e.key,locale:e.locale}),children:c(i?`draft_list.remove`:`draft_list.undo`)})]})]}),(0,z.jsx)(Lr,{d:e})]},`${e.locale}/${e.key}`)}),o.map(e=>(0,z.jsxs)(`li`,{className:Rr,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[Ir(e),(0,z.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,z.jsx)(Fr,{state:`live`})})]}),(0,z.jsx)(Lr,{d:e})]},`live:${e.locale}/${e.key}`))]}),o.length>0&&s&&(0,z.jsx)(`button`,{type:`button`,onClick:s,className:`text-[10px] font-semibold text-fg-muted hover:text-fg transition duration-150`,children:c(`draft_list.dismiss_live`)}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:async()=>{u(null);try{await r(),u(c(`draft_list.backup_downloaded`))}catch(e){u(e?.message||c(`draft_list.backup_failed`))}},disabled:e.length===0,className:`${zr} disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`draft_list.download`)}),(0,z.jsxs)(`label`,{className:`${zr} inline-flex items-center`,children:[c(`draft_list.restore`),(0,z.jsx)(`input`,{type:`file`,accept:`.txt,text/plain`,onChange:async e=>{let t=e.currentTarget,n=t.files?.[0];if(n){u(null);try{u(await i(n))}catch(e){u(e?.message||c(`draft_list.restore_failed`))}finally{t.value=``}}},className:`sr-only`})]}),a&&(0,z.jsx)(`button`,{type:`button`,onClick:a,className:zr,children:c(`draft_list.review`)})]}),l&&(0,z.jsx)(`p`,{role:`status`,className:`text-[11px] text-fg-muted break-words`,children:he(c,l)})]})},Vr=async()=>{},Hr=async()=>``,Ur={modified:`glyph-warn text-warning-fg border-warning-line bg-warning-bg`,added:`text-accent-fg border-accent-line bg-accent-soft`,deleted:`text-danger-fg border-dashed border-danger-line bg-danger-bg`,renamed:`glyph-info text-info-fg border-info-line bg-info-bg`},Wr={modified:`changes.status_modified`,added:`changes.status_added`,deleted:`changes.status_deleted`,renamed:`changes.status_renamed`},Gr=e=>e.startsWith(`+++`)||e.startsWith(`---`)?`text-fg-muted`:e.startsWith(`@@`)?`text-info-fg`:e.startsWith(`diff `)||e.startsWith(`new file`)?`text-fg-muted`:e.startsWith(`+`)?`text-fg bg-accent-soft`:e.startsWith(`-`)?`text-fg-muted line-through decoration-fg-faint`:`text-fg-muted`,Kr=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),qr=({isOpen:e,onClose:t,git:n,gitError:r,isGitLoading:i,lastCommit:a,onCommit:o,onDiscard:s,onRefresh:c,history:l,onUndo:u,isUndoing:d,drafts:f,onUndoDraft:p=Vr,onDownloadBackup:m=Vr,onRestoreBackup:h=Hr,onReviewChange:_,liveNow:v,onDismissLiveNow:y})=>{let{t:b}=B(),[x,S]=(0,g.useState)(``),[C,w]=(0,g.useState)(!1),[T,E]=(0,g.useState)(!1),D=kr(e,t);if(!e)return null;let O=n?.changes??[],k=n?.mode===`github`,A=!!n?.isRepo&&O.length>0&&x.trim().length>0,j=(e,t)=>{let[n,r]=b(e).split(`{code}`);return(0,z.jsxs)(z.Fragment,{children:[n,(0,z.jsx)(`code`,{className:`font-mono text-fg-muted`,children:t}),r]})};return(0,z.jsxs)(`div`,{className:`fixed inset-0 top-16 z-40 flex justify-end`,"data-testid":`changes-panel`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 bg-overlay`,onClick:t}),(0,z.jsxs)(`aside`,{ref:D,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-changes-title`,className:`relative w-[520px] max-w-full h-full bg-raised border-s border-line flex flex-col animate-in slide-in-from-end duration-200`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`h2`,{id:`studio-changes-title`,className:`text-sm font-bold tracking-wide font-heading text-fg`,children:b(`changes.title`)}),n?.isRepo&&n.branch&&(0,z.jsx)(`span`,{dir:`ltr`,className:`px-2 py-0.5 rounded-md bg-raised border border-line text-[10px] font-mono text-fg`,children:n.branch})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:c,className:`p-1.5 rounded-lg text-fg-muted hover:text-fg hover:bg-raised-hover border border-transparent hover:border-line-strong transition duration-150`,"aria-label":b(`changes.refresh`),title:b(`changes.refresh`),children:(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:[(0,z.jsx)(`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}),(0,z.jsx)(`path`,{d:`M21 3v5h-5`})]})}),(0,z.jsx)(`button`,{type:`button`,onClick:t,className:`p-1.5 rounded-lg text-fg-muted hover:text-fg hover:bg-raised-hover border border-transparent hover:border-line-strong transition duration-150`,"aria-label":b(`changes.close`),title:b(`changes.close`),children:(0,z.jsx)(`svg`,{"aria-hidden":`true`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})})})]})]}),Array.isArray(f)?(0,z.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6`,children:(0,z.jsx)(Br,{drafts:f,onUndo:p,isUndoing:d,onDownloadBackup:m,onRestoreBackup:h,onReviewChange:_,liveNow:v,onDismissLiveNow:y})}):(0,z.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-6`,children:[(0,z.jsxs)(`section`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:b(`changes.locale_files`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-surface text-fg border border-line`,children:b(`changes.changed`,{count:O.length})})]}),n===null?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b(`changes.loading`)}):n.available?n.isRepo?O.length===0?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b(`changes.clean`)}):(0,z.jsx)(`ul`,{className:`space-y-1.5`,children:O.map(e=>(0,z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2 rounded-xl bg-surface border border-line`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-mono text-info-fg break-all`,children:e.path}),(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[9px] font-extrabold uppercase tracking-wider border shrink-0 ${Ur[e.status]??Ur.modified}`,children:Wr[e.status]?b(Wr[e.status]):e.status})]},e.path))}):(0,z.jsx)(`p`,{className:`text-xs text-fg-muted leading-relaxed`,children:j(`changes.not_repo`,`git`)}):(0,z.jsx)(`p`,{className:`text-xs text-fg-muted leading-relaxed`,children:j(`changes.git_disabled`,`git: false`)}),n?.isRepo&&O.length>0&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>E(e=>!e),className:`text-[10px] font-semibold text-fg-muted hover:text-fg transition duration-150`,children:b(T?`changes.hide_diff`:`changes.show_diff`)}),T&&(0,z.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-xl bg-surface border border-line p-3 text-[10px] font-mono leading-relaxed whitespace-pre`,children:n.diff.split(`
11
11
  `).map((e,t)=>(0,z.jsx)(`div`,{className:`px-1 ${Gr(e)}`,children:e||` `},t))})]})]}),n?.isRepo&&(0,z.jsxs)(`section`,{className:`space-y-3`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:b(k?`changes.propose`:`changes.commit_section`)}),k&&n?.pullRequestUrl&&(0,z.jsx)(`a`,{href:n.pullRequestUrl,target:`_blank`,rel:`noreferrer`,className:`block text-[11px] text-info-fg hover:text-info-fg underline underline-offset-2`,children:b(`changes.view_pr`)}),(0,z.jsx)(`label`,{htmlFor:`studio-commit-message`,className:`sr-only`,children:b(`changes.commit_label`)}),(0,z.jsx)(`textarea`,{id:`studio-commit-message`,value:x,onChange:e=>S(e.target.value),disabled:i||O.length===0,placeholder:b(O.length===0?k?`changes.placeholder_branch_clean`:`changes.placeholder_nothing`:k?`changes.placeholder_pr`:`changes.placeholder_commit`),maxLength:500,className:`w-full min-h-20 bg-surface border border-line hover:border-line-strong rounded-xl px-4 py-3 text-xs text-fg placeholder-fg-muted font-sans resize-none transition duration-150 disabled:opacity-60`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`button`,{type:`button`,id:`studio-commit-button`,onClick:async()=>{await o(x.trim())&&S(``)},disabled:!A||i,className:`flex-1 h-10 rounded-xl text-xs font-semibold tracking-wide bg-accent hover:bg-accent-hover active:bg-accent-hover text-on-accent disabled:bg-raised disabled:text-fg-faint disabled:cursor-not-allowed transition duration-150`,children:b(i?`changes.working`:k?n?.pullRequestUrl?`changes.pr_open`:`changes.open_pr`:`changes.commit`)}),C?(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:async()=>{await s()&&w(!1)},disabled:i,className:`h-10 px-3 rounded-xl text-xs font-semibold bg-transparent border border-dashed border-danger-line text-danger-fg hover:bg-danger-bg transition duration-150`,children:b(k?`changes.reset_to_base`:`changes.discard_all`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>w(!1),className:`h-10 px-3 rounded-xl text-xs font-semibold text-fg-muted hover:text-fg bg-raised border border-line transition duration-150`,children:b(`changes.keep`)})]}):(0,z.jsx)(`button`,{type:`button`,onClick:()=>w(!0),disabled:O.length===0||i,className:`h-10 px-4 rounded-xl text-xs font-semibold text-danger-fg bg-danger-bg hover:bg-danger-bg border border-dashed border-danger-line disabled:opacity-40 disabled:cursor-not-allowed transition duration-150`,children:b(k?`changes.reset_branch`:`changes.discard`)})]}),a&&!r&&(0,z.jsx)(`p`,{role:`status`,className:`glyph-done text-[11px] text-success-fg break-words`,children:k?(0,z.jsxs)(z.Fragment,{children:[b(`changes.pull_request`),` `,(0,z.jsx)(`a`,{href:a,dir:`ltr`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:a})]}):b(`changes.committed`,{hash:a})}),r&&(0,z.jsx)(`div`,{role:`alert`,className:`bg-danger-bg border border-dashed border-danger-line rounded-xl p-3 text-xs text-danger-fg break-words`,children:he(b,r)})]}),(0,z.jsxs)(`section`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:b(`changes.session`)}),(0,z.jsx)(`span`,{className:`text-[10px] font-bold font-mono px-2 py-0.5 rounded bg-surface text-fg-muted border border-line`,children:b(`changes.edits`,{count:l.length})})]}),l.length===0?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b(`changes.no_edits`)}):(0,z.jsx)(`ul`,{className:`space-y-1.5`,children:l.map(e=>(0,z.jsxs)(`li`,{className:`px-3 py-2 rounded-xl bg-surface border border-line space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`span`,{dir:`ltr`,className:`text-[11px] font-mono text-info-fg break-all`,children:[e.key,(0,z.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.locale]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,z.jsx)(`span`,{className:`text-[9px] text-fg-muted font-mono`,children:Kr(e.at)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>u(e),disabled:d,className:`text-[10px] font-semibold text-fg-muted hover:text-fg px-2 py-0.5 rounded-md border border-line hover:border-line-strong disabled:opacity-40 transition duration-150`,"aria-label":b(`changes.restore_aria`,{key:e.key}),title:b(`changes.undo_title`),children:b(`changes.undo`)})]})]}),(0,z.jsxs)(`div`,{className:`text-[10px] leading-relaxed`,children:[(0,z.jsx)(`span`,{dir:`auto`,className:`text-fg-muted line-through decoration-fg-faint break-all`,children:e.previousValue||(0,z.jsx)(`em`,{children:b(`changes.empty`)})}),(0,z.jsx)(`span`,{className:`text-fg-muted`,"aria-hidden":`true`,children:` ${b(`common.arrow`)} `}),(0,z.jsx)(`span`,{dir:`auto`,className:`text-accent-fg break-all`,children:e.nextValue||(0,z.jsx)(`em`,{children:b(`changes.empty`)})})]})]},e.id))})]})]})]})]})},Jr=({isOpen:e,onSubmit:t})=>{let{t:n}=B(),[r,i]=(0,g.useState)(``),a=kr(e);if(!e)return null;let[o,s]=n(`token.body`).split(`{env}`);return(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`form`,{ref:a,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-token-title`,onSubmit:e=>{e.preventDefault(),r.trim()&&t(r.trim())},className:`bg-raised border border-line rounded-2xl w-full max-w-md p-6 animate-in fade-in zoom-in-95 duration-200 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{id:`studio-token-title`,className:`text-base font-bold text-fg font-heading`,children:n(`token.title`)}),(0,z.jsxs)(`p`,{className:`text-xs text-fg-muted mt-2 leading-relaxed`,children:[o,(0,z.jsx)(`code`,{dir:`ltr`,className:`font-mono text-fg`,children:`LIVELOCALE_TOKEN`}),s]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(`label`,{htmlFor:`studio-access-token`,className:`text-[11px] font-bold text-fg-muted uppercase tracking-wider`,children:n(`token.label`)}),(0,z.jsx)(`input`,{id:`studio-access-token`,type:`password`,autoComplete:`off`,value:r,onChange:e=>i(e.target.value),className:`w-full bg-surface border border-line hover:border-line-strong rounded-xl px-4 py-2.5 text-sm text-fg font-mono transition duration-150`})]}),(0,z.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,z.jsx)(`button`,{type:`submit`,disabled:!r.trim(),className:`px-4 py-2 text-xs font-semibold text-fg bg-raised hover:bg-raised-hover active:bg-raised-hover border border-line disabled:bg-raised disabled:text-fg-faint disabled:cursor-not-allowed rounded-xl transition duration-150`,children:n(`token.connect`)})})]})})},Yr=({problems:e,title:t})=>{let{t:n}=B();return e.length===0?null:(0,z.jsxs)(`div`,{role:`alert`,"data-testid":`setup-problems`,className:`mx-6 mt-4 rounded-xl border border-dashed border-danger-line bg-danger-bg px-4 py-3 text-xs text-danger-fg select-text`,children:[(0,z.jsx)(`p`,{className:`font-semibold text-danger-fg`,children:t??n(`setup.title`)}),(0,z.jsx)(`ul`,{className:`mt-1.5 space-y-1 list-disc ps-4`,children:e.map(e=>(0,z.jsx)(`li`,{children:he(n,e)},e))})]})},Xr=({candidates:e,onChoose:t,onCancel:n})=>{let{t:r}=B(),i=kr(e!==null,n);return e===null?null:(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-locale-picker-title`,className:`bg-raised border border-line rounded-2xl w-full max-w-md p-6 relative animate-in fade-in zoom-in-95 duration-200`,children:[(0,z.jsx)(`h3`,{id:`studio-locale-picker-title`,className:`text-base font-bold text-fg font-heading`,children:r(`picker.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted mt-2 leading-relaxed`,children:r(`picker.body`)}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-5`,children:e.map(e=>(0,z.jsx)(`button`,{type:`button`,dir:`ltr`,onClick:()=>t(e),className:`px-4 py-2 text-xs font-mono font-semibold text-info-fg bg-raised hover:bg-raised-hover border border-line hover:border-line-strong rounded-xl transition duration-150`,children:e},e))}),(0,z.jsx)(`div`,{className:`flex items-center justify-end mt-6`,children:(0,z.jsx)(`button`,{type:`button`,onClick:n,className:`px-4 py-2 text-xs font-semibold text-fg-muted hover:text-fg bg-raised border border-line hover:border-line-strong rounded-xl transition duration-150`,children:r(`picker.cancel`)})})]})})},Zr=[`tips.step1`,`tips.step2`,`tips.step3`];function Qr(e){let[t,n]=(0,g.useState)(()=>b(`tips-seen`)===`1`),[r,i]=(0,g.useState)(()=>b(`translator-name`)??``);return{showTips:e&&!t,dismiss:()=>{x(`tips-seen`,`1`),n(!0)},name:r,setName:e=>{i(e),x(`translator-name`,e===``?null:e)}}}var $r={en:`English`,ar:`العربية`},ei=()=>{let{lang:e,t,setLang:n}=B(),r=e===`ar`?`en`:`ar`;return(0,z.jsx)(`button`,{type:`button`,id:`studio-language-toggle`,"aria-label":t(r===`ar`?`language.switch_to_ar`:`language.switch_to_en`),onClick:()=>n(r),className:`h-7 px-2.5 inline-flex items-center rounded-md text-[11px] font-semibold whitespace-nowrap transition-colors bg-raised hover:bg-raised-hover text-fg border border-line`,children:(0,z.jsx)(`span`,{lang:r,dir:r===`ar`?`rtl`:void 0,children:$r[r]})})},ti=({open:e,name:t,onNameChange:n,onDismiss:r})=>{let{t:i}=B(),a=kr(e,r),o=(0,g.useRef)(null);return(0,g.useEffect)(()=>{e&&o.current?.focus()},[e]),e?(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`div`,{ref:a,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-tips-title`,className:`bg-raised border border-line rounded-2xl w-full max-w-md p-6`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{id:`studio-tips-title`,className:`text-base font-bold text-fg font-heading`,children:i(`tips.title`)}),(0,z.jsx)(ei,{})]}),(0,z.jsx)(`ol`,{className:`mt-3 space-y-2 list-decimal list-inside text-xs text-fg leading-relaxed`,children:Zr.map(e=>(0,z.jsx)(`li`,{children:i(e)},e))}),(0,z.jsx)(`label`,{htmlFor:`studio-tips-name`,className:`block mt-5 text-xs font-semibold text-fg-muted`,children:i(`tips.name_label`)}),(0,z.jsx)(`input`,{id:`studio-tips-name`,ref:o,type:`text`,maxLength:80,dir:`auto`,value:t,onChange:e=>n(e.target.value),className:`mt-1 w-full h-9 px-3 rounded-xl bg-surface border border-line text-xs text-fg`}),(0,z.jsx)(`div`,{className:`flex items-center justify-end mt-6`,children:(0,z.jsx)(`button`,{type:`button`,id:`studio-tips-start`,onClick:r,className:`px-4 py-2 text-xs font-semibold text-on-accent bg-accent hover:bg-accent-hover rounded-xl transition duration-150`,children:i(`tips.start`)})})]})}):null};function ni(e,t){let n=e.filter(e=>!e.conflict&&(e.status===`unsent`||t.includeSent)).sort((e,t)=>e.updatedAt-t.updatedAt);return{included:n.slice(0,500),overflow:Math.max(0,n.length-500)}}function ri(e){return e>=55296&&e<=56319}function G(e){return e>=56320&&e<=57343}function ii(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);ri(r)?n+1<e.length&&G(e.charCodeAt(n+1))&&(t+=e.slice(n,n+2),n++):G(r)||(t+=e.charAt(n))}return t}function ai(e,t){let n=ii(e).slice(0,t);return n.length>0&&ri(n.charCodeAt(n.length-1))?n.slice(0,-1):n}var oi=/[\x00-\x1f\x7f]/g,si=/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;function ci(e){return ai((e??``).replace(/\s+/g,` `).replace(oi,``).trim(),80)}function li(e){return ai((e??``).replace(si,``).trim(),500)}function ui(e,t){return e<t?-1:+(e>t)}function di(e){let{drafts:t,manifest:n}=e,r=t.map(({locale:e,key:t,from:n,to:r,force:i})=>({locale:e,key:t,from:n,to:r,force:i})).sort((e,t)=>ui(e.locale,t.locale)||ui(e.key,t.key));return{...typeof n.repo==`string`&&n.repo!==``?{repo:n.repo}:{},branch:n.branch??``,base:n.base??``,src:n.sourceLocale,by:ci(e.by),note:li(e.note),edits:r}}function fi(e,t){let n=new URL(e),r=n.pathname.endsWith(`/`)?`${n.pathname}index.html`:n.pathname;return`${n.origin}${r}#${t}`}function pi(e,t){return`livelocale-${e}-${t.toISOString().slice(0,10)}.txt`}var mi={NOT_FOUND:`link_error.not_found`,AMBIGUOUS:`link_error.ambiguous`,CORRUPT:`link_error.damaged`,INVALID:`link_error.damaged`,TOO_LARGE:`link_error.too_big`,TOO_MANY_EDITS:`link_error.too_big`,UNSUPPORTED_VERSION:`link_error.unsupported_version`,UNSUPPORTED_ENVIRONMENT:`link_error.unsupported_environment`};function hi(e,t=R){return e instanceof H&&Object.hasOwn(mi,e.code)?t(mi[e.code]):e instanceof Error&&e.message||t(`link_error.unreadable`)}var gi=`Paste here: your clipboard holds the LiveLocale change block (Ctrl+V, or Cmd+V on Mac).
12
12
  `,_i=40;function vi(e){let t=e.trim().replace(/^https:\/\/(?:www\.)?github\.com\//i,``).replace(/^git@github\.com:/i,``).replace(/\/+$/,``).replace(/\.git$/i,``);return lt(t)?t:null}function yi(e,t){return e??t}function bi(e){let t=e.replace(/[\x00-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g,``).replace(/\s+/g,` `).trim().slice(0,_i);return/[\ud800-\udbff]$/.test(t)?t.slice(0,-1):t}function xi(e,t){let n=`LiveLocale: ${e} translation ${e===1?`change`:`changes`}`,r=t===void 0?``:bi(t);return r===``?n:`${n} from ${r}`}function Si(e,t,n){return`https://github.com/${e}/issues/new?title=${encodeURIComponent(t)}&body=${encodeURIComponent(n)}`}function Ci(e,t,n,r){let i=ot(t);if(i.length>65536)return{url:null,clipboard:null,tooLarge:!0};let a=xi(n,r),o=Si(e,a,i);return o.length<=8e3?{url:o,clipboard:null,tooLarge:!1}:{url:Si(e,a,gi),clipboard:i,tooLarge:!1}}var wi=`inline-flex items-center h-8 px-3 rounded-xl text-[11px] font-semibold border transition duration-150 text-fg hover:text-fg bg-raised hover:bg-raised-hover border-line-strong`;function Ti({repo:e,token:t,count:n,by:r,label:i,onOpened:a}){let{t:o}=B(),[s,c]=(0,g.useState)(null),l=Ci(e,t,n,r);if(l.tooLarge||l.url===null)return(0,z.jsx)(`p`,{role:`status`,className:`glyph-warn text-[11px] text-warning-fg`,children:o(`issue.too_large`,{command:`npx livelocale apply`})});let u=e=>(0,z.jsx)(`a`,{href:l.url??void 0,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>a?.(),className:wi,children:e}),d=l.clipboard;return d===null?u(i):(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:async()=>c(await C(d)?`ok`:`failed`),className:wi,children:o(`issue.copy_block`)}),s!==null&&u(o(`issue.open_and_paste`))]}),s===`failed`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{role:`alert`,className:`text-[11px] text-fg-muted`,children:o(`issue.copy_failed`)}),(0,z.jsx)(`textarea`,{"data-testid":`manual-copy`,readOnly:!0,"aria-label":o(`issue.manual_copy_label`),value:d,rows:4,onFocus:e=>e.currentTarget.select(),className:`w-full px-3 py-2 rounded-xl bg-surface border border-line text-[11px] font-mono text-fg resize-none`})]})]})}var Ei=`h-9 px-4 rounded-xl text-xs font-semibold border transition duration-150 disabled:opacity-40 disabled:cursor-not-allowed`,Di=({isOpen:e,onClose:t,drafts:n,manifest:r,studioHref:i,onMarkSent:a})=>{let{t:o}=B(),[s,c]=(0,g.useState)(()=>b(`translator-name`)??``),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(null),[v,y]=(0,g.useState)(!1),[S,w]=(0,g.useState)(null),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(null),[A,j]=(0,g.useState)(null),M=(0,g.useRef)(0),ee=kr(e&&r!==null,t);(0,g.useEffect)(()=>{e&&(c(b(`translator-name`)??``),u(``),f(!1),D(null),k(null),j(null))},[e]),(0,g.useEffect)(()=>j(null),[s,l,d]);let N=(0,g.useMemo)(()=>n.filter(e=>e.status===`sent`&&!e.conflict).length,[n]),{included:P,overflow:te}=(0,g.useMemo)(()=>ni(n,{includeSent:d}),[n,d]);if((0,g.useEffect)(()=>{if(!e||!r)return;let t=++M.current;if(m(null),_(null),w(null),P.length===0){y(!1);return}y(!0),jt(di({drafts:P,manifest:r,by:s,note:l})).then(e=>{t===M.current&&(m(fi(i,e)),_(e))}).catch(e=>{t===M.current&&w(o(`send.encode_failed`,{reason:hi(e,o)}))}).finally(()=>{t===M.current&&y(!1)})},[e,r,P,s,l,i,o]),!e||!r)return null;let ne=P.length===0&&A!==null,re=ne?A:p!==null&&h!==null?{link:p,token:h,count:P.length}:null,F=re?.link??null,ie=F!==null&&F.length>6e3,ae=!v&&F!==null&&!ie,oe=!v&&F!==null,se=async(e,t)=>{if(re!==null){if(j(re),ne){D(t);return}try{await a(e),D(t)}catch(e){k(e?.message||o(`send.mark_failed`))}}},ce=async()=>{if(!F)return;let e=P;k(null),await C(F)?await se(e,`copied`):D(`copy-failed`)},le=async()=>{if(!F)return;let e=P;k(null);try{T(pi(`changes`,new Date),F+`
13
13
  `)}catch(e){k(e?.message||o(`send.save_failed`));return}await se(e,`downloaded`)},ue=e=>{c(e),x(`translator-name`,e===``?null:e)};return(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`div`,{ref:ee,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-send-title`,className:`bg-raised border border-line rounded-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto p-6 space-y-4`,children:[(0,z.jsx)(`h3`,{id:`studio-send-title`,className:`text-base font-bold text-fg font-heading`,children:o(`send.title`)}),(0,z.jsxs)(`label`,{className:`block space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-fg-muted`,children:o(`send.name_label`)}),(0,z.jsx)(`input`,{id:`studio-send-name`,type:`text`,dir:`auto`,maxLength:80,value:s,onChange:e=>ue(e.target.value),className:`w-full h-9 px-3 rounded-xl bg-surface border border-line text-xs text-fg`})]}),(0,z.jsxs)(`label`,{className:`block space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-fg-muted`,children:o(`send.note_label`)}),(0,z.jsx)(`textarea`,{id:`studio-send-note`,dir:`auto`,rows:2,maxLength:500,value:l,onChange:e=>u(e.target.value),className:`w-full px-3 py-2 rounded-xl bg-surface border border-line text-xs text-fg resize-none`})]}),N>0&&(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),o(`send.include_sent`,{count:N})]}),ne?null:P.length===0?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:o(`send.nothing_to_send`)}):(0,z.jsx)(`ul`,{"data-testid":`send-dialog-changes`,className:`max-h-48 overflow-y-auto space-y-1.5`,children:P.map(e=>(0,z.jsxs)(`li`,{className:`px-3 py-2 rounded-xl bg-surface border border-line space-y-1`,children:[(0,z.jsx)(`span`,{dir:`ltr`,className:`block text-[11px] font-mono text-info-fg break-all`,children:`${e.key} · ${e.locale}`}),(0,z.jsxs)(`div`,{className:`text-[10px] leading-relaxed`,children:[e.from?(0,z.jsx)(`span`,{dir:`auto`,className:`text-fg-muted line-through decoration-fg-faint break-all`,children:e.from}):(0,z.jsx)(`em`,{className:`text-fg-muted line-through decoration-fg-faint`,children:o(`send.empty`)}),(0,z.jsx)(`span`,{className:`text-fg-muted`,"aria-hidden":`true`,children:` ${o(`common.arrow`)} `}),e.to?(0,z.jsx)(`span`,{dir:`auto`,className:`text-accent-fg break-all`,children:e.to}):(0,z.jsx)(`em`,{className:`text-accent-fg`,children:o(`send.empty`)})]})]},`${e.locale}/${e.key}`))}),te>0&&(0,z.jsx)(`p`,{role:`status`,className:`glyph-warn text-xs text-warning-fg`,children:o(`send.overflow`,{count:P.length,total:P.length+te})}),S&&(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-danger-fg break-words`,children:S}),F!==null&&!ie&&(0,z.jsx)(`input`,{id:`studio-send-link`,"data-testid":`change-link`,type:`text`,dir:`ltr`,readOnly:!0,"aria-label":o(`send.link_label`),value:F,onFocus:e=>e.currentTarget.select(),className:`w-full h-9 px-3 rounded-xl bg-surface border border-line text-[11px] font-mono text-fg`}),ie&&(0,z.jsx)(`p`,{role:`status`,className:`glyph-warn text-xs text-warning-fg`,children:o(`send.too_long`)}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,id:`studio-send-copy`,onClick:ce,disabled:!ae,className:`${Ei} text-on-accent bg-accent hover:bg-accent-hover border-accent-line`,children:o(`send.copy`)}),(0,z.jsx)(`button`,{type:`button`,id:`studio-send-download`,onClick:le,disabled:!oe,className:`${Ei} text-fg hover:text-fg bg-raised hover:bg-raised-hover border-line-strong`,children:o(`send.download`)}),(0,z.jsx)(`button`,{type:`button`,onClick:t,className:`${Ei} ms-auto text-fg-muted hover:text-fg bg-raised border-line hover:border-line-strong`,children:o(`send.close`)})]}),r.repo&&re!==null&&!v&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(Ti,{repo:r.repo,token:re.token,count:re.count,by:s,label:o(`send.open_github`),onOpened:()=>void se(P,`opened`)}),(0,z.jsx)(`p`,{className:`text-[11px] text-fg-muted`,children:o(`send.github_hint`)})]}),E===`copied`&&(0,z.jsx)(`p`,{role:`status`,className:`glyph-done text-xs text-success-fg`,children:o(`send.copied`)}),E===`downloaded`&&(0,z.jsx)(`p`,{role:`status`,className:`glyph-done text-xs text-success-fg`,children:o(`send.downloaded`)}),E===`opened`&&(0,z.jsx)(`p`,{role:`status`,className:`glyph-done text-xs text-success-fg`,children:o(`send.opened`)}),E===`copy-failed`&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`p`,{role:`alert`,className:`glyph-warn text-xs text-warning-fg`,children:o(`send.copy_failed`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>se(P,`copied`),className:`${Ei} text-fg hover:text-fg bg-raised hover:bg-raised-hover border-line-strong`,children:o(`send.copied_confirm`)})]}),O&&(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-danger-fg break-words`,children:he(o,O)})]})})},Oi=({isOpen:e,onClose:t,onSubmit:n,error:r})=>{let{t:i}=B(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(o(``),u(null),f(!1))},[e]);let p=kr(e,t);if(!e)return null;let m=async e=>{if(e){u(null);try{o(await e.text())}catch{u(i(`import.file_failed`))}}},h=async()=>{c(!0);try{let e=await n(a);f(!0),e&&t()}finally{c(!1)}},_=l??(d?r:null);return(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-overlay flex items-center justify-center p-4`,children:(0,z.jsxs)(`div`,{ref:p,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`studio-import-title`,className:`bg-raised border border-line rounded-2xl w-full max-w-lg p-6 relative animate-in fade-in zoom-in-95 duration-200 select-text`,children:[(0,z.jsx)(`h3`,{id:`studio-import-title`,className:`text-base font-bold text-fg font-heading`,children:i(`import.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted mt-2 leading-relaxed`,children:i(`import.body`)}),(0,z.jsx)(`label`,{htmlFor:`studio-import-text`,className:`block mt-5 text-xs font-semibold text-fg`,children:i(`import.paste_label`)}),(0,z.jsx)(`textarea`,{id:`studio-import-text`,value:a,onChange:e=>o(e.target.value),rows:5,spellCheck:!1,className:`mt-2 w-full px-3 py-2 rounded-xl bg-surface border border-line text-[11px] font-mono text-fg break-all resize-y`}),(0,z.jsx)(`label`,{htmlFor:`studio-import-file`,className:`block mt-4 text-xs font-semibold text-fg`,children:i(`import.file_label`)}),(0,z.jsx)(`input`,{id:`studio-import-file`,type:`file`,accept:`.txt,text/plain`,onChange:e=>void m(e.target.files?.[0]),className:`mt-2 block w-full text-[11px] text-fg-muted file:me-3 file:px-3 file:py-1.5 file:rounded-lg file:border-0 file:bg-raised file:text-fg file:text-[11px] file:font-semibold`}),_&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-4 text-xs text-danger-fg break-words`,children:_}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 mt-6`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 text-xs font-semibold text-fg-muted hover:text-fg bg-raised border border-line hover:border-line-strong rounded-xl transition duration-150`,children:i(`import.cancel`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:a.trim()===``||s,className:`px-4 py-2 text-xs font-semibold text-on-accent bg-accent border border-accent-line hover:bg-accent-hover disabled:opacity-40 disabled:cursor-not-allowed rounded-xl transition duration-150`,children:i(`import.submit`)})]})]})})},ki=/\u200C(?:[\u200B\u200D]{8})+\u200C/g;function Ai(e){ki.lastIndex=0;let t=ki.test(e);return ki.lastIndex=0,t}var ji={...wn,forced:`Saved with “Save anyway”.`,"new-key":`Adds a key the source locale does not have.`};function Mi(e,t){let n=t.indexOf(`.`);if(n===-1)return!1;let r=t.slice(0,n);if(!Object.prototype.hasOwnProperty.call(e,r))return!1;let i=e[r];return typeof i==`object`&&!!i&&!Array.isArray(i)}function Ni(e,t,n){let{locale:r,key:i,from:a,to:o,force:s}=e,c={locale:r,key:i,from:a,to:o,force:s},l=(e,t)=>({...c,status:`invalid`,code:e,message:t,flags:[]}),u=t.targets.get(r);if(!u)return l(`UNKNOWN_LOCALE`,`No "${r}" locale file on the target.`);if(u.layout===`namespaced`&&!Mi(u.dict,i))return l(`UNKNOWN_NAMESPACE`,`"${i}" is not in an existing namespace file of ${r}.`);if(Ai(o))return l(`CONTAINS_WATERMARK`,`The new text contains LiveLocale watermark characters.`);let d={sourceLocale:t.sourceLocale,source:n,target:u.dict},f=Sn(i,d),p=[],m=e=>({...c,...e,flags:[...p,...Fn(f??a??void 0,o)]}),h=vn(u.dict,i);if(h.state===`string`&&h.value===o)return m({status:`already`,current:h.value});let g=Cn({locale:r,key:i,value:o},d,{force:!1});if(!g.ok){if(g.status!==422||!s)return l(g.code,g.error);if(!t.allowForce)return m({status:`needs-force`,code:g.code,message:g.error});p.push(`forced`)}let _=h.state===`string`?h.value:void 0;return _===void 0?a===null?(f===null&&p.push(`new-key`),m({status:`apply`})):m({status:`conflict`,code:`REMOVED_ON_TARGET`,message:`Removed on the target since the link was made.`}):m(_===a?{status:`apply`}:{status:`conflict`,code:`CHANGED_ON_TARGET`,message:`Changed on the target since the link was made.`,current:_})}function Pi(e){let t=e.targets.get(e.sourceLocale);if(!t)throw Error(`Source locale "${e.sourceLocale}" has no locale file on the target.`);let n=e.edits.map(n=>Ni(n,e,t.dict)),r={apply:0,already:0,conflict:0,invalid:0,"needs-force":0};for(let e of n)r[e.status]+=1;return{edits:n,counts:r}}var Fi={apply:`review.status_apply`,already:`review.status_already`,conflict:`review.status_conflict`,invalid:`review.status_invalid`,"needs-force":`review.status_needs_force`};function Ii(e,t){let n=[];e.status===`invalid`&&e.message&&n.push({level:`error`,message:e.message}),e.status===`needs-force`&&e.message&&n.push({level:`warning`,message:`${e.message} ${t(`review.saved_anyway`)}`});for(let t of e.flags)n.push({level:`warning`,message:ji[t]});return n}function Li(e){let t=e.t??R,{edits:n}=Pi({edits:e.set.edits,sourceLocale:e.sourceLocale,targets:e.targets,allowForce:e.allowForce===!0});return n.map(e=>({...e,id:`${e.locale}\u0000${e.key}`,checks:Ii(e,t)}))}function Ri(e){let t={apply:0,already:0,conflict:0,invalid:0,"needs-force":0};for(let n of e)t[n.status]+=1;return t}var zi=({initial:e=``,onSave:t})=>{let{t:n}=B(),[r,i]=(0,g.useState)(e),[a,o]=(0,g.useState)(!1);return(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let n=vi(r);o(n===null),n!==null&&t(n)},className:`space-y-2`,children:[(0,z.jsxs)(`label`,{className:`block space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-fg-muted`,children:n(`repo.question`)}),(0,z.jsx)(`input`,{type:`text`,dir:`ltr`,placeholder:`owner/repo`,spellCheck:!1,autoComplete:`off`,value:r,onChange:e=>{i(e.target.value),o(!1)},"aria-invalid":a||void 0,className:`w-full h-9 px-3 rounded-xl bg-surface border border-line text-xs font-mono text-fg`})]}),a&&(0,z.jsx)(`p`,{role:`alert`,className:`text-[11px] text-danger-fg`,children:n(`repo.malformed`)}),(0,z.jsx)(`button`,{type:`submit`,className:`h-8 px-3 rounded-xl text-[11px] font-semibold border transition duration-150 text-on-accent bg-accent hover:bg-accent-hover border-accent-line`,children:n(`repo.save`)})]})},Bi=`npx livelocale apply --clipboard --pr`;function Vi(e){let t=`npx livelocale apply "${e}" --pr`;return t.length>8e3?Bi:t}var Hi=`Actions → LiveLocale → Run workflow`,K={applied:`glyph-done text-success-fg`,skipped:`text-fg-muted`,failed:`text-danger-fg`},q=(e,t)=>e.state===`applied`?t(`review.result_applied`):e.state===`failed`?t(`review.result_failed`,{message:he(t,e.message)}):t(`review.result_skipped`,{reason:e.reason}),Ui=[`apply`,`already`,`conflict`,`needs-force`,`invalid`],Wi={apply:`glyph-done text-success-fg`,already:`text-fg-muted`,conflict:`glyph-warn text-warning-fg`,"needs-force":`glyph-warn text-warning-fg`,invalid:`text-danger-fg`},Gi=()=>{},Ki=`h-8 px-3 rounded-xl text-[11px] font-semibold border transition duration-150 text-fg hover:text-fg bg-raised hover:bg-raised-hover border-line-strong`,qi=({value:e})=>{let{t}=B();return e===null||e===``?(0,z.jsx)(`em`,{className:`text-fg-muted`,children:t(`review.empty`)}):(0,z.jsx)(`span`,{dir:`auto`,className:`break-all whitespace-pre-wrap`,children:e})},Ji=({row:e})=>Le(e.to)===null?(0,z.jsx)(qi,{value:e.to}):(0,z.jsx)(Ve,{disabled:!0,locale:e.locale,value:e.to,onChange:Gi}),Yi=({review:e,error:t,isLoading:n,focusKey:r,focusSeq:i,locale:a,onSelectLocale:o,onClose:s,studioHref:c,repo:l,repoFromManifest:u,onRepoChange:d,onApplyLocal:f,applyResults:p={},isApplying:m=!1,actions:h,className:_=`w-[420px] shrink-0`})=>{let{t:v}=B(),[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(!1),[w,T]=(0,g.useState)(!1),E=(0,g.useRef)(null),D=(0,g.useMemo)(()=>e?fi(c,e.token):null,[e,c]),O=D===null?null:Vi(D),k=(0,g.useMemo)(()=>e?Ri(e.rows):null,[e]),A=(0,g.useMemo)(()=>{let t=e?.rows.filter(e=>e.key===r)??[];return(t.find(e=>e.locale===a)??t[0])?.id??null},[e,r,a]);(0,g.useEffect)(()=>b(null),[e]),(0,g.useEffect)(()=>T(!1),[e?.token]);let j=k?k.apply+(w?k[`needs-force`]:0):0,M=(0,g.useMemo)(()=>{let e=Object.values(p);if(e.length===0)return null;let t=t=>e.filter(e=>e.state===t).length,n=t(`failed`);return{text:v(`review.apply_summary`,{applied:t(`applied`),skipped:t(`skipped`),failed:n}),failed:n>0}},[p,v]);(0,g.useEffect)(()=>{E.current?.scrollIntoView?.({block:`nearest`})},[A,i]);let ee=async e=>{b(v(await C(e)?`review.copied`:`review.copy_failed`))},N=e=>{S(!1),d(e)},P=e?.set.by??``,te=e?.set.note??``;return(0,z.jsxs)(`section`,{"data-testid":`review-panel`,className:`${_} bg-raised border border-line rounded-2xl flex flex-col h-full overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`h-14 bg-surface border-b border-line flex items-center justify-between px-6 shrink-0 select-none`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-bold tracking-wide font-heading text-fg`,children:v(`review.title`)}),(0,z.jsx)(`button`,{type:`button`,onClick:s,className:`text-[11px] font-semibold text-fg-muted hover:text-fg transition duration-150`,children:v(`review.close`)})]}),(0,z.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4 select-text`,children:[t!==null&&(0,z.jsx)(Yr,{title:v(`review.error_title`),problems:[t]}),n&&e===null&&(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v(`review.opening`)}),e&&k&&D&&O&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{role:`status`,className:`sr-only`,children:M&&!M.failed?M.text:``}),(0,z.jsx)(`p`,{role:`alert`,className:`sr-only`,children:M?.failed?M.text:``}),(P!==``||te!==``)&&(0,z.jsx)(`p`,{"data-testid":`review-note`,dir:`auto`,className:`px-3 py-2 rounded-xl bg-surface border border-line text-xs text-fg whitespace-pre-wrap break-words`,children:P===``?v(te===``?`review.from_translator`:`review.from_translator_note`,{note:te}):v(te===``?`review.from`:`review.from_note`,{by:P,note:te})}),(0,z.jsx)(`ul`,{"data-testid":`review-summary`,className:`flex flex-wrap gap-2 text-[11px]`,children:Ui.filter(e=>k[e]>0).map(e=>(0,z.jsx)(`li`,{className:`px-2.5 py-1 rounded-full bg-surface border border-line ${Wi[e]}`,children:v(`review.summary_count`,{count:k[e],status:v(Fi[e])})},e))}),e.target===`github`&&(0,z.jsx)(`div`,{className:`space-y-2 px-3 py-3 rounded-xl bg-surface border border-line`,children:l===null||x?(0,z.jsx)(zi,{initial:x?l??void 0:e.set.repo,onSave:N}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(Ti,{repo:l,token:e.token,count:e.set.edits.length,by:e.set.by,label:v(`review.create_pr`)},e.token),(0,z.jsx)(`span`,{dir:`ltr`,className:`text-[11px] font-mono text-fg-muted break-all`,children:l}),!u&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>S(!0),className:`text-[11px] font-semibold text-fg-muted hover:text-fg underline-offset-2 hover:underline`,children:v(`review.change_repo`)})]}),(0,z.jsx)(`p`,{className:`text-[11px] text-fg-muted`,children:v(`review.github_hint`)})]})}),e.target===`local`&&f&&(0,z.jsxs)(`div`,{className:`space-y-2 px-3 py-3 rounded-xl bg-surface border border-line`,children:[(0,z.jsx)(`button`,{id:`studio-apply-local`,type:`button`,disabled:j===0||m,onClick:()=>f({includeForced:w}),className:`h-8 px-3 rounded-xl text-[11px] font-semibold border transition duration-150 bg-accent border-accent-line text-on-accent hover:bg-accent-hover disabled:opacity-40 disabled:cursor-not-allowed`,children:v(`review.apply_local`,{count:j})}),k[`needs-force`]>0&&(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px] text-fg`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked)}),v(`review.include_forced`,{count:k[`needs-force`]})]})]}),h,(0,z.jsxs)(`div`,{className:`space-y-2 px-3 py-3 rounded-xl bg-surface border border-line`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-semibold text-fg`,children:v(`review.command_title`)}),(0,z.jsx)(`code`,{"data-testid":`review-apply-command`,dir:`ltr`,className:`block px-3 py-2 rounded-lg bg-surface border border-line text-[11px] font-mono text-fg break-all`,children:O}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>ee(O),className:Ki,children:v(`review.copy_command`)}),O===Bi&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>ee(D),className:Ki,children:v(`review.copy_link`)}),y&&(0,z.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:y})]}),(0,z.jsx)(`p`,{className:`text-[11px] text-fg-muted`,children:v(`review.apply_hint`)})]}),e.target===`github`&&(0,z.jsx)(`p`,{className:`text-[11px] text-fg-muted`,children:v(`review.run_workflow_hint`,{path:Hi})}),(0,z.jsxs)(`table`,{className:`w-full text-[11px] text-start border-collapse`,children:[(0,z.jsx)(`thead`,{className:`text-fg-muted`,children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{className:`py-1 pe-2 font-semibold`,children:v(`review.col_language`)}),(0,z.jsx)(`th`,{className:`py-1 pe-2 font-semibold`,children:v(`review.col_key`)}),(0,z.jsx)(`th`,{className:`py-1 pe-2 font-semibold`,children:v(`review.col_before`)}),(0,z.jsx)(`th`,{className:`py-1 pe-2 font-semibold`,children:v(`review.col_after`)}),(0,z.jsx)(`th`,{className:`py-1 font-semibold`,children:v(`review.col_check`)})]})}),(0,z.jsx)(`tbody`,{className:`text-fg align-top`,children:e.rows.map(e=>{let t=e.id===A;return(0,z.jsxs)(`tr`,{ref:t?E:void 0,"aria-current":t?`true`:void 0,className:`border-t border-line ${t?`bg-accent-soft`:``}`,children:[(0,z.jsx)(`td`,{className:`py-2 pe-2`,children:(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(e.locale),title:v(`review.show_locale`,{locale:e.locale}),dir:`ltr`,className:`font-mono text-info-fg hover:text-info-fg underline-offset-2 hover:underline`,children:e.locale})}),(0,z.jsx)(`td`,{dir:`ltr`,className:`py-2 pe-2 font-mono text-info-fg break-all`,children:e.key}),(0,z.jsxs)(`td`,{className:`py-2 pe-2`,children:[(0,z.jsx)(qi,{value:e.from}),e.status===`conflict`&&e.current!==void 0&&(0,z.jsxs)(`p`,{className:`mt-1 glyph-warn text-warning-fg`,children:[`${v(`review.now_on_site`)} `,(0,z.jsx)(`span`,{dir:`auto`,className:`break-all whitespace-pre-wrap`,children:e.current})]})]}),(0,z.jsx)(`td`,{className:`py-2 pe-2`,children:(0,z.jsx)(Ji,{row:e})}),(0,z.jsxs)(`td`,{className:`py-2`,children:[(0,z.jsx)(`span`,{className:`font-semibold ${Wi[e.status]}`,children:v(Fi[e.status])}),p[e.id]&&(0,z.jsx)(`p`,{"data-testid":`apply-result`,className:`mt-1 inline-block px-2 py-0.5 rounded-full bg-surface border border-line ${K[p[e.id].state]}`,children:q(p[e.id],v)}),e.checks.length>0&&(0,z.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:e.checks.map(e=>(0,z.jsx)(`li`,{className:e.level===`error`?`text-danger-fg`:`glyph-warn text-warning-fg`,children:e.message},e.message))})]})]},e.id)})})]})]})]})]})},Xi=`studio-drawer-keys`,Zi=`studio-drawer-side`,Qi=`absolute top-12 bottom-0 z-30 w-[min(400px,45vw)] p-2`,$i=e=>`px-3 py-1.5 rounded-xl border text-[11px] font-semibold transition duration-150 ${e?`bg-accent-soft border-accent-line text-accent-fg`:`bg-raised border-line text-fg hover:text-fg hover:border-line-strong`}`,ea=({isWide:e,keys:t,viewer:n,side:r,sideLabel:i,openPanel:a,onOpenPanelChange:o,toolbar:s})=>{let{t:c}=B(),l=e?null:a,u=(0,g.useRef)(null),d=(0,g.useRef)(null),f=(0,g.useRef)(null),p=(0,g.useRef)(null),m=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(l===null||l!==m.current){m.current=null;return}(l===`keys`?u.current:d.current)?.querySelector(Er)?.focus()},[l]),(0,g.useEffect)(()=>{if(l===null)return;let e=e=>{if(e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[aria-modal="true"]`)!==null)return;let t=m.current===l?l===`keys`?f.current:p.current:null;o(null),t?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[l,o]);let h=e=>{let t=a!==e;m.current=t?e:null,o(t?e:null)};return(0,z.jsxs)(`main`,{className:`flex-1 flex overflow-hidden min-h-0 bg-app ${e?`gap-6 p-6`:`relative gap-0 p-2`}`,children:[(0,z.jsx)(`div`,{ref:u,id:Xi,"data-testid":Xi,className:e?`h-full shrink-0`:`${Qi} start-0`,hidden:!e&&l!==`keys`,children:t}),(0,z.jsxs)(`div`,{className:`flex-1 min-w-0 h-full flex flex-col gap-2`,children:[!e&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 select-none`,children:[(0,z.jsx)(`button`,{ref:f,type:`button`,"data-testid":`studio-toggle-keys`,"aria-expanded":l===`keys`,"aria-controls":Xi,onClick:()=>h(`keys`),className:$i(l===`keys`),children:c(`layout.keys`)}),(0,z.jsx)(`button`,{ref:p,type:`button`,"data-testid":`studio-toggle-side`,"aria-expanded":l===`side`,"aria-controls":Zi,onClick:()=>h(`side`),className:$i(l===`side`),children:i}),s]}),n]}),(0,z.jsx)(`div`,{ref:d,id:Zi,"data-testid":Zi,className:e?`h-full shrink-0`:`${Qi} end-0`,hidden:!e&&l!==`side`,children:r})]})},ta={system:`theme.system`,light:`theme.light`,dark:`theme.dark`},na={system:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,z.jsx)(`path`,{d:`M8 20h8M12 16v4`})]}),light:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,z.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41`})]}),dark:(0,z.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`})},ra=`h-7 w-7 inline-flex items-center justify-center rounded-md border transition-colors`,ia=`bg-raised text-fg border-line-strong`,aa=`text-fg-muted border-transparent hover:bg-raised-hover`,oa=({choice:e,onChange:t})=>{let{t:n}=B();return(0,z.jsx)(`div`,{role:`group`,"aria-label":n(`theme.group`),className:`flex items-center gap-0.5`,children:D.map(r=>(0,z.jsx)(`button`,{type:`button`,"data-theme-choice":r,"aria-label":n(ta[r]),title:n(ta[r]),"aria-pressed":r===e,onClick:()=>t(r),className:`${ra} ${r===e?ia:aa}`,children:(0,z.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:na[r]})},r))})},sa=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function ca(e,t={}){let n;try{n=new URL(e,`http://localhost`)}catch{return null}let r=n.searchParams.get(`locale`),{basePath:i,locales:a}=t;if(!a){if(r)return r;let e=n.pathname.split(`/`)[1];return e&&e.length===2?e:null}let o=e=>{if(!e)return null;let t=e.toLowerCase();return a.find(e=>e.toLowerCase()===t)??null},s=o(r);if(s)return s;let c=i??`/`;return n.pathname.startsWith(c)?o(n.pathname.slice(c.length).split(`/`)[0]):null}function la(e,t,n={}){let r;try{r=new URL(e,`http://localhost`)}catch{return null}if(ca(e,n)===t)return null;let{basePath:i,locales:a}=n,o=i??`/`;if(!r.searchParams.has(`locale`)&&a&&r.pathname.startsWith(o)){let[e,...n]=r.pathname.slice(o.length).split(`/`),i=(e??``).toLowerCase();if(i!==``&&a.some(e=>e.toLowerCase()===i))return r.pathname=o+[t,...n].join(`/`),r.pathname+r.search+r.hash}return r.searchParams.set(`locale`,t),r.pathname+r.search+r.hash}function ua(e){return e.normalize(`NFC`).replace(/\s+/g,` `).trim().toLowerCase()}function da(e,t,n){let r=new Set(t.map(ua).filter(e=>e!==``));if(r.size===0)return[];let i=[];for(let t of Object.keys(n)){let a=n[t];!a||!sa(a,e)||(a[e]??[]).some(e=>r.has(ua(e)))&&i.push(t)}return i.sort()}function fa(e,t){let n=new Map;for(let{key:r,text:i}of e)for(let e of da(r,[i],t))n.set(e,(n.get(e)??0)+1);let r=Math.max(0,...n.values());return r===0?[]:[...n.keys()].filter(e=>n.get(e)===r).sort()}function pa(e,t,n){let{locale:r,source:i}=t;return i===`manual`?{locale:r,source:i}:e.length===1?{locale:e[0],source:`content`}:e.length>1?i!==null&&e.includes(r)?{locale:r,source:i}:{pick:[...e]}:i===null?{pick:[...n]}:{locale:r,source:i}}function ma(e,t){return t.source===`manual`||e===null?t:{locale:e,source:`url`}}function ha(e,t){return t.source===`manual`?t:e.length===1?{locale:e[0],source:`content`}:t.source===`remembered`&&e.includes(t.locale)?{locale:t.locale,source:`content`}:t}function ga(e,t){if(t.source!==`manual`||e.length!==1)return null;let n=e[0];return n===t.locale?null:n}function _a(e){return e.source===`content`||e.source===`url`||e.source===`manual`}function va(e){let t=[];for(let n of e){if(t.length>=100)break;if(!n||typeof n!=`object`)continue;let{key:e,text:r}=n;typeof e==`string`&&typeof r==`string`&&t.push({key:e,text:r})}return t}var ya=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);c.current=e;let{t:l}=B(),u=(0,g.useRef)(l);return u.current=l,(0,g.useEffect)(()=>{let e=e=>{if(e.origin!==Zt()||e.data?.source!==`livelocale-client`)return;let{type:t,payload:r}=e.data;if(t===`READY`){n(`connected`),i(r.url||`/`),o(null);let e=ca(r.url||`/`,en());e&&c.current.onLocaleDetected(e)}else t===`ELEMENT_SELECTED`?c.current.onElementSelected(r):t===`ERROR`?c.current.onError(r.error||u.current(`errors.client_error`)):t===`VISIBLE_KEYS_CHANGED`?Array.isArray(r)&&o(r):t===`VISIBLE_TEXTS_CHANGED`&&Array.isArray(r)&&c.current.onVisibleTexts?.(va(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},Zt())},[])}};function ba(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,ba(e[r],i)):n[i]=String(e[r])}return n}var J=({connectionStatus:e,iframeRef:t,referenceLocale:n=`en`})=>{let[r,i]=(0,g.useState)(`en`),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)([]),[d,f]=(0,g.useState)({}),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)({}),v=(0,g.useCallback)(async e=>{try{let t=await $n();Array.isArray(t)&&(o(t),e&&t.length>0&&i(e=>t.includes(e)?e:t.includes(`en`)?`en`:t[0]||`en`))}catch(e){console.warn(`[livelocale] Failed to fetch locales list:`,e.message)}},[]),y=(0,g.useCallback)(async()=>{try{let e=await er();e&&Array.isArray(e.allKeys)&&c(e.allKeys),e&&Array.isArray(e.codeKeys)&&u(e.codeKeys)}catch(e){console.warn(`[livelocale] Failed to fetch keys metadata:`,e.message)}},[]),b=(0,g.useCallback)(async e=>{try{f(ba(await tr(e))),m(e)}catch(e){console.warn(`[livelocale] Failed to load full locale dictionary:`,e.message)}},[]);(0,g.useEffect)(()=>{e===`connected`&&(v(!0),y())},[e,v,y]),(0,g.useEffect)(()=>{e===`connected`&&r&&b(r)},[e,r,b]),(0,g.useEffect)(()=>{e===`connected`&&tr(n).then(e=>_(ba(e))).catch(e=>console.warn(`[livelocale] Failed to load reference locale:`,e.message))},[e,n]),(0,g.useEffect)(()=>{r===n&&p===n&&_(d)},[r,p,d,n]);let x=(0,g.useCallback)(e=>{if(i(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]),S=(0,g.useCallback)(async()=>{await v(),await y(),await b(r)},[v,y,b,r]),C=(0,g.useCallback)((e,t)=>{f(n=>({...n,[e]:t}))},[]),w=s.length,T=s.filter(e=>{let t=d[e];return t!==void 0&&t.trim()!==``}).length;return{locale:r,setLocale:i,locales:a,allKeys:s,codeKeys:l,localeData:d,dataLocale:p,enLocaleData:h,coveragePercentage:w>0?Math.round(T/w*100):100,handleLocaleChange:x,fetchLocales:v,fetchKeysMetadata:y,fetchLocaleData:b,refreshAll:S,updateLocaleDataCache:C}},xa=({localeData:e,enLocaleData:t,sendToIframe:n,locale:r,referenceLocale:i=`en`,refreshKeysMetadata:a,updateLocaleDataCache:o,setLoading:s,setError:c,onSaved:l,t:u=R})=>{let[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(0),S=(0,g.useRef)(null);(0,g.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]);let[C,w]=(0,g.useState)(!1),[T,E]=(0,g.useState)(null),D=d!==null&&p!==d.currentValue,O=(0,g.useCallback)(e=>{m(e),y(null),n(`APPLY_PREVIEW`,{key:d?.key,value:e})},[n,d?.key]),k=(0,g.useCallback)(t=>{if(D){E(t),w(!0);return}let n=e[t.key]??t.currentValue;f({...t,currentValue:n}),x(e=>e+1),m(n),_(!1),y(null),c(null)},[D,e,c]),A=(0,g.useCallback)(()=>{if(T){let t=e[T.key]??T.currentValue;f({...T,currentValue:t}),x(e=>e+1),m(t)}else f(null),m(``),n(`CLEAR_SELECTION`);E(null),w(!1),_(!1),c(null)},[T,e,n,c]),j=(0,g.useCallback)(()=>{E(null),w(!1)},[]),M=(0,g.useCallback)(t=>{let n=e[t]||``;k({key:t,fallbackValue:n,currentValue:n})},[e,k]);return(0,g.useEffect)(()=>{if(d){let n=e[d.key]||``,r=t[d.key]||d.fallbackValue||``;d.currentValue!==n&&(f(e=>e?{...e,currentValue:n,fallbackValue:r}:null),m(n))}},[e,t]),{selected:d,selectionCount:b,inputValue:p,isSuccess:h,showConfirmModal:C,hasUnsavedChanges:D,selectElement:k,confirmDiscard:A,cancelDiscard:j,selectKeyDirectly:M,handleInputChange:O,handleSave:async(e={})=>{if(d){s(!0),_(!1),c(null);try{let s=d.currentValue,c=r===i?s:t[d.key]??d.fallbackValue;await rr(r,d.key,p,{reference:c||void 0,force:e.force}),y(null),_(!0),l?.({locale:r,key:d.key,previousValue:s,nextValue:p}),f(e=>e?{...e,currentValue:p}:null),o(d.key,p),a(),n(`COMMIT_PREVIEW`,{key:d.key,value:p}),n(`CLEAR_SELECTION`),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{_(!1),S.current=null},2e3)}catch(e){e instanceof Bn?y({code:e.code,message:e.message,missing:e.details.missing,extra:e.details.extra}):c(e.message||u(`errors.save_failed`))}finally{s(!1)}}},handleClearSelection:(0,g.useCallback)(()=>{if(D){E(null),w(!0);return}f(null),m(``),n(`CLEAR_SELECTION`)},[D,n]),saveWarning:v,dismissSaveWarning:()=>y(null)}},Sa=({locale:e,locales:t,handleLocaleChange:n,refreshAll:r,handleClearSelection:i,setLoading:a,setError:o,t:s=R})=>({handleAddLocale:(0,g.useCallback)(async e=>{try{a(!0),o(null),await ir(e),await r(),n(e)}catch(e){o(e.message||s(`errors.add_locale_failed`))}finally{a(!1)}},[r,n,a,o,s]),handleRenameLocale:(0,g.useCallback)(async(t,i)=>{try{a(!0),o(null),await ar(t,i),await r(),e===t&&n(i)}catch(e){o(e.message||s(`errors.rename_locale_failed`))}finally{a(!1)}},[e,r,n,a,o,s]),handleDeleteLocale:(0,g.useCallback)(async c=>{try{a(!0),o(null),await or(c);let s=t.filter(e=>e!==c),l=`en`;s.length>0&&(l=s.includes(`en`)?`en`:s[0]||`en`),await r(),e===c&&(n(l),i())}catch(e){o(e.message||s(`errors.delete_locale_failed`))}finally{a(!1)}},[t,e,r,n,i,a,o,s])}),Ca=({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])}},wa=({connectionStatus:e,onAfterDiscard:t})=>{let{t:n}=B(),r=(0,g.useRef)(n);r.current=n;let[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),f=(0,g.useCallback)(async()=>{try{a(await nr())}catch(e){l(e.message||r.current(`errors.git_status_failed`))}},[]);return(0,g.useEffect)(()=>{e===`connected`&&f()},[e,f]),{git:i,isLoading:o,error:c,lastCommit:u,refresh:f,commit:(0,g.useCallback)(async e=>{s(!0),l(null);try{let t=await sr(e);return d(t.hash),await f(),t.hash}catch(e){l(e.message||r.current(`errors.commit_failed`));return}finally{s(!1)}},[f]),discard:(0,g.useCallback)(async()=>{s(!0),l(null);try{return await cr(),await t(),await f(),!0}catch(e){return l(e.message||r.current(`errors.discard_failed`)),!1}finally{s(!1)}},[t,f]),clearError:()=>l(null)}},Ta=200,Ea=0,Da=()=>{let[e,t]=(0,g.useState)([]);return{entries:e,record:(0,g.useCallback)(e=>{Ea+=1;let n={...e,id:`${Date.now()}-${Ea}`,at:Date.now()};t(e=>[n,...e].slice(0,Ta))},[]),remove:(0,g.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clear:(0,g.useCallback)(()=>t([]),[])}},Oa=()=>{let[e,t]=(0,g.useState)(()=>Un()),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(0);return(0,g.useEffect)(()=>{let e=()=>r(!0);return window.addEventListener(Rn,e),()=>window.removeEventListener(Rn,e)},[]),{token:e,needsToken:n,tokenVersion:i,submitToken:(0,g.useCallback)(e=>{let n=e.trim();n&&(Wn(n),t(n),r(!1),a(e=>e+1))},[]),clearToken:(0,g.useCallback)(()=>{Wn(null),t(null),a(e=>e+1)},[])}};function ka(e){(0,g.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[e])}function Aa(e){let{mode:t,locale:n,localeConfirmed:r,history:i,drafts:a}=e,o=new Map;if(t===`preview`)for(let e of[...i].reverse())e.locale===n&&o.set(e.key,e.nextValue);else if(t===`static`&&r)for(let e of a)e.locale===n&&o.set(e.key,e.to);return o}var ja=`livelocale-target-locale:`;function Ma(e){try{return localStorage.getItem(ja+e)}catch{return null}}function Na(e,t){try{localStorage.setItem(ja+e,t)}catch{}}var Pa=({enabled:e,scope:t,locale:n,setLocale:r,setMenuLocale:i=r,showLocale:a,locales:o,getCandidates:s})=>{let[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(null),m=(0,g.useRef)(n);m.current=n;let h=(0,g.useRef)(c);h.current=c;let _=(0,g.useRef)(null),v=(0,g.useRef)(null),y=()=>({locale:m.current,source:h.current}),b=e=>{let n=y();e.locale===n.locale&&e.source===n.source||(m.current=e.locale,h.current=e.source,r(e.locale),l(e.source),t!==null&&_a(e)&&Na(t,e.locale))};(0,g.useEffect)(()=>{if(!e||t===null||v.current===t||h.current!==null)return;let n=Ma(t);n===null||!o.includes(n)||(v.current=t,m.current=n,h.current=`remembered`,r(n),l(`remembered`),a?.(n))},[e,t,o]);let x=t=>{if(!e){r(t);return}b(ma(t,y()))},S=async t=>{e&&b(ha(fa(t,await s()),y()))},C=async t=>{if(!e)return!0;let n=await s(),r=da(t.key,[t.currentValue],n),i=y();d(ga(r,i));let a=pa(r,i,o);return`pick`in a?a.pick.length===0?!0:(_.current=t,p(a.pick),!1):(b(a),!0)},w=t=>!e||h.current!==null||o.length===0?!0:(_.current=t,p([...o]),!1),T=e=>{m.current=e,h.current=`manual`,r(e),l(`manual`),t!==null&&Na(t,e),d(null),p(null);let n=_.current;return _.current=null,n},E=t=>{if(!e){i(t);return}T(t),a?.(t)},D=(0,g.useCallback)(()=>{_.current=null,p(null)},[]);return{source:c,confirmed:_a({locale:n,source:c}),mismatch:u,pickerCandidates:f,onUrlLocale:x,onVisibleTexts:S,resolveForSelection:C,resolveForDirectPick:w,choose:T,onMenuLocale:E,cancelPick:D}};async function Fa(e){let{drafts:t,manifest:n,studioHref:r,by:i,t:a=R}=e;if(t.length>500)throw Error(a(`backup.too_many`,{max:500}));let o=await jt(di({drafts:t,manifest:n,by:i}));return{fileName:pi(`backup`,e.now??new Date),text:fi(r,o)+`
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="robots" content="noindex, nofollow" />
7
7
  <title>LiveLocale · Studio</title>
8
- <script type="module" crossorigin src="./assets/index-_1lbk_Vf.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-DriSmNkY.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-BNCZW1xW.css">
10
10
  </head>
11
11
  <body class="antialiased overflow-hidden">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livelocale",
3
- "version": "0.11.0-next.12",
3
+ "version": "0.11.0",
4
4
  "description": "Click any text in your running React app to edit its translation. Edits stay as JSON in git, or arrive as a pull request from a deployed preview. Local-first, zero-dependency.",
5
5
  "license": "MIT",
6
6
  "author": "Araby99",