easel-canvas 0.2.2 → 0.4.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.
@@ -0,0 +1,74 @@
1
+ var dx=Object.defineProperty;var fx=(n,o,r)=>o in n?dx(n,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[o]=r;var cy=(n,o,r)=>fx(n,typeof o!="symbol"?o+"":o,r);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))f(m);new MutationObserver(m=>{for(const g of m)if(g.type==="childList")for(const v of g.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&f(v)}).observe(document,{childList:!0,subtree:!0});function r(m){const g={};return m.integrity&&(g.integrity=m.integrity),m.referrerPolicy&&(g.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?g.credentials="include":m.crossOrigin==="anonymous"?g.credentials="omit":g.credentials="same-origin",g}function f(m){if(m.ep)return;m.ep=!0;const g=r(m);fetch(m.href,g)}})();var Vh={exports:{}},nu={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ry;function hx(){if(ry)return nu;ry=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(f,m,g){var v=null;if(g!==void 0&&(v=""+g),m.key!==void 0&&(v=""+m.key),"key"in m){g={};for(var S in m)S!=="key"&&(g[S]=m[S])}else g=m;return m=g.ref,{$$typeof:n,type:f,key:v,ref:m!==void 0?m:null,props:g}}return nu.Fragment=o,nu.jsx=r,nu.jsxs=r,nu}var uy;function mx(){return uy||(uy=1,Vh.exports=hx()),Vh.exports}var s=mx(),Gh={exports:{}},Pe={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var dy;function gx(){if(dy)return Pe;dy=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),v=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),E=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),M=Symbol.for("react.view_transition"),z=Symbol.iterator;function H(R){return R===null||typeof R!="object"?null:(R=z&&R[z]||R["@@iterator"],typeof R=="function"?R:null)}var W={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,_={};function I(R,Y,ue){this.props=R,this.context=Y,this.refs=_,this.updater=ue||W}I.prototype.isReactComponent={},I.prototype.setState=function(R,Y){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Y,"setState")},I.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function X(){}X.prototype=I.prototype;function ne(R,Y,ue){this.props=R,this.context=Y,this.refs=_,this.updater=ue||W}var ee=ne.prototype=new X;ee.constructor=ne,T(ee,I.prototype),ee.isPureReactComponent=!0;var ie=Array.isArray;function le(){}var he={H:null,A:null,T:null,S:null},ce=Object.prototype.hasOwnProperty;function ge(R,Y,ue){var pe=ue.ref;return{$$typeof:n,type:R,key:Y,ref:pe!==void 0?pe:null,props:ue}}function xe(R,Y){return ge(R.type,Y,R.props)}function Ze(R){return typeof R=="object"&&R!==null&&R.$$typeof===n}function Ne(R){var Y={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ue){return Y[ue]})}var xt=/\/+/g;function et(R,Y){return typeof R=="object"&&R!==null&&R.key!=null?Ne(""+R.key):Y.toString(36)}function me(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(le,le):(R.status="pending",R.then(function(Y){R.status==="pending"&&(R.status="fulfilled",R.value=Y)},function(Y){R.status==="pending"&&(R.status="rejected",R.reason=Y)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function je(R,Y,ue,pe,$e){var Re=typeof R;(Re==="undefined"||Re==="boolean")&&(R=null);var G=!1;if(R===null)G=!0;else switch(Re){case"bigint":case"string":case"number":G=!0;break;case"object":switch(R.$$typeof){case n:case o:G=!0;break;case x:return G=R._init,je(G(R._payload),Y,ue,pe,$e)}}if(G)return $e=$e(R),G=pe===""?"."+et(R,0):pe,ie($e)?(ue="",G!=null&&(ue=G.replace(xt,"$&/")+"/"),je($e,Y,ue,"",function(_t){return _t})):$e!=null&&(Ze($e)&&($e=xe($e,ue+($e.key==null||R&&R.key===$e.key?"":(""+$e.key).replace(xt,"$&/")+"/")+G)),Y.push($e)),1;G=0;var de=pe===""?".":pe+":";if(ie(R))for(var be=0;be<R.length;be++)pe=R[be],Re=de+et(pe,be),G+=je(pe,Y,ue,Re,$e);else if(be=H(R),typeof be=="function")for(R=be.call(R),be=0;!(pe=R.next()).done;)pe=pe.value,Re=de+et(pe,be++),G+=je(pe,Y,ue,Re,$e);else if(Re==="object"){if(typeof R.then=="function")return je(me(R),Y,ue,pe,$e);throw Y=String(R),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return G}function Ce(R,Y,ue){if(R==null)return R;var pe=[],$e=0;return je(R,pe,"","",function(Re){return Y.call(ue,Re,$e++)}),pe}function Ue(R){if(R._status===-1){var Y=R._result,ue=Y();ue.then(function(pe){(R._status===0||R._status===-1)&&(R._status=1,R._result=pe,ue.status===void 0&&(ue.status="fulfilled",ue.value=pe))},function(pe){(R._status===0||R._status===-1)&&(R._status=2,R._result=pe,ue.status===void 0&&(ue.status="rejected",ue.reason=pe))}),R._status===-1&&(R._status=0,R._result=ue)}if(R._status===1)return R._result.default;throw R._result}var fe=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)};function re(R){var Y=he.T,ue={};ue.types=Y!==null?Y.types:null,he.T=ue;try{var pe=R(),$e=he.S;$e!==null&&$e(ue,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(le,fe)}catch(Re){fe(Re)}finally{Y!==null&&ue.types!==null&&(Y.types=ue.types),he.T=Y}}function Fe(R){var Y=he.T;if(Y!==null){var ue=Y.types;ue===null?Y.types=[R]:ue.indexOf(R)===-1&&ue.push(R)}else re(Fe.bind(null,R))}var dt={map:Ce,forEach:function(R,Y,ue){Ce(R,function(){Y.apply(this,arguments)},ue)},count:function(R){var Y=0;return Ce(R,function(){Y++}),Y},toArray:function(R){return Ce(R,function(Y){return Y})||[]},only:function(R){if(!Ze(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Pe.Activity=w,Pe.Children=dt,Pe.Component=I,Pe.Fragment=r,Pe.Profiler=m,Pe.PureComponent=ne,Pe.StrictMode=f,Pe.Suspense=j,Pe.ViewTransition=M,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=he,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(R){return he.H.useMemoCache(R)}},Pe.addTransitionType=Fe,Pe.cache=function(R){return function(){return R.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(R,Y,ue){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var pe=T({},R.props),$e=R.key;if(Y!=null)for(Re in Y.key!==void 0&&($e=""+Y.key),Y)!ce.call(Y,Re)||Re==="key"||Re==="__self"||Re==="__source"||Re==="ref"&&Y.ref===void 0||(pe[Re]=Y[Re]);var Re=arguments.length-2;if(Re===1)pe.children=ue;else if(1<Re){for(var G=Array(Re),de=0;de<Re;de++)G[de]=arguments[de+2];pe.children=G}return ge(R.type,$e,pe)},Pe.createContext=function(R){return R={$$typeof:v,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:g,_context:R},R},Pe.createElement=function(R,Y,ue){var pe,$e={},Re=null;if(Y!=null)for(pe in Y.key!==void 0&&(Re=""+Y.key),Y)ce.call(Y,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&($e[pe]=Y[pe]);var G=arguments.length-2;if(G===1)$e.children=ue;else if(1<G){for(var de=Array(G),be=0;be<G;be++)de[be]=arguments[be+2];$e.children=de}if(R&&R.defaultProps)for(pe in G=R.defaultProps,G)$e[pe]===void 0&&($e[pe]=G[pe]);return ge(R,Re,$e)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(R){return{$$typeof:S,render:R}},Pe.isValidElement=Ze,Pe.lazy=function(R){return{$$typeof:x,_payload:{_status:-1,_result:R},_init:Ue}},Pe.memo=function(R,Y){return{$$typeof:E,type:R,compare:Y===void 0?null:Y}},Pe.startTransition=re,Pe.unstable_useCacheRefresh=function(){return he.H.useCacheRefresh()},Pe.use=function(R){return he.H.use(R)},Pe.useActionState=function(R,Y,ue){return he.H.useActionState(R,Y,ue)},Pe.useCallback=function(R,Y){return he.H.useCallback(R,Y)},Pe.useContext=function(R){return he.H.useContext(R)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(R,Y){return he.H.useDeferredValue(R,Y)},Pe.useEffect=function(R,Y){return he.H.useEffect(R,Y)},Pe.useEffectEvent=function(R){return he.H.useEffectEvent(R)},Pe.useId=function(){return he.H.useId()},Pe.useImperativeHandle=function(R,Y,ue){return he.H.useImperativeHandle(R,Y,ue)},Pe.useInsertionEffect=function(R,Y){return he.H.useInsertionEffect(R,Y)},Pe.useLayoutEffect=function(R,Y){return he.H.useLayoutEffect(R,Y)},Pe.useMemo=function(R,Y){return he.H.useMemo(R,Y)},Pe.useOptimistic=function(R,Y){return he.H.useOptimistic(R,Y)},Pe.useReducer=function(R,Y,ue){return he.H.useReducer(R,Y,ue)},Pe.useRef=function(R){return he.H.useRef(R)},Pe.useState=function(R){return he.H.useState(R)},Pe.useSyncExternalStore=function(R,Y,ue){return he.H.useSyncExternalStore(R,Y,ue)},Pe.useTransition=function(){return he.H.useTransition()},Pe.version="19.3.0",Pe}var fy;function jm(){return fy||(fy=1,Gh.exports=gx()),Gh.exports}var b=jm(),Yh={exports:{}},au={},Xh={exports:{}},Kh={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var hy;function px(){return hy||(hy=1,(function(n){function o(me,je){var Ce=me.length;me.push(je);e:for(;0<Ce;){var Ue=Ce-1>>>1,fe=me[Ue];if(0<m(fe,je))me[Ue]=je,me[Ce]=fe,Ce=Ue;else break e}}function r(me){return me.length===0?null:me[0]}function f(me){if(me.length===0)return null;var je=me[0],Ce=me.pop();if(Ce!==je){me[0]=Ce;e:for(var Ue=0,fe=me.length,re=fe>>>1;Ue<re;){var Fe=2*(Ue+1)-1,dt=me[Fe],R=Fe+1,Y=me[R];if(0>m(dt,Ce))R<fe&&0>m(Y,dt)?(me[Ue]=Y,me[R]=Ce,Ue=R):(me[Ue]=dt,me[Fe]=Ce,Ue=Fe);else if(R<fe&&0>m(Y,Ce))me[Ue]=Y,me[R]=Ce,Ue=R;else break e}}return je}function m(me,je){var Ce=me.sortIndex-je.sortIndex;return Ce!==0?Ce:me.id-je.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var g=performance;n.unstable_now=function(){return g.now()}}else{var v=Date,S=v.now();n.unstable_now=function(){return v.now()-S}}var j=[],E=[],x=1,w=null,M=3,z=!1,H=!1,W=!1,T=!1,_=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,X=typeof setImmediate<"u"?setImmediate:null;function ne(me){for(var je=r(E);je!==null;){if(je.callback===null)f(E);else if(je.startTime<=me)f(E),je.sortIndex=je.expirationTime,o(j,je);else break;je=r(E)}}function ee(me){if(W=!1,ne(me),!H)if(r(j)!==null)H=!0,ie||(ie=!0,Ze());else{var je=r(E);je!==null&&et(ee,je.startTime-me)}}var ie=!1,le=-1,he=5,ce=-1;function ge(){return T?!0:!(n.unstable_now()-ce<he)}function xe(){if(T=!1,ie){var me=n.unstable_now();ce=me;var je=!0;try{e:{H=!1,W&&(W=!1,I(le),le=-1),z=!0;var Ce=M;try{t:{for(ne(me),w=r(j);w!==null&&!(w.expirationTime>me&&ge());){var Ue=w.callback;if(typeof Ue=="function"){w.callback=null,M=w.priorityLevel;var fe=Ue(w.expirationTime<=me);if(me=n.unstable_now(),typeof fe=="function"){w.callback=fe,ne(me),je=!0;break t}w===r(j)&&f(j),ne(me)}else f(j);w=r(j)}if(w!==null)je=!0;else{var re=r(E);re!==null&&et(ee,re.startTime-me),je=!1}}break e}finally{w=null,M=Ce,z=!1}je=void 0}}finally{je?Ze():ie=!1}}}var Ze;if(typeof X=="function")Ze=function(){X(xe)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,xt=Ne.port2;Ne.port1.onmessage=xe,Ze=function(){xt.postMessage(null)}}else Ze=function(){_(xe,0)};function et(me,je){le=_(function(){me(n.unstable_now())},je)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(me){me.callback=null},n.unstable_forceFrameRate=function(me){0>me||125<me?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):he=0<me?Math.floor(1e3/me):5},n.unstable_getCurrentPriorityLevel=function(){return M},n.unstable_next=function(me){switch(M){case 1:case 2:case 3:var je=3;break;default:je=M}var Ce=M;M=je;try{return me()}finally{M=Ce}},n.unstable_requestPaint=function(){T=!0},n.unstable_runWithPriority=function(me,je){switch(me){case 1:case 2:case 3:case 4:case 5:break;default:me=3}var Ce=M;M=me;try{return je()}finally{M=Ce}},n.unstable_scheduleCallback=function(me,je,Ce){var Ue=n.unstable_now();switch(typeof Ce=="object"&&Ce!==null?(Ce=Ce.delay,Ce=typeof Ce=="number"&&0<Ce?Ue+Ce:Ue):Ce=Ue,me){case 1:var fe=-1;break;case 2:fe=250;break;case 5:fe=1073741823;break;case 4:fe=1e4;break;default:fe=5e3}return fe=Ce+fe,me={id:x++,callback:je,priorityLevel:me,startTime:Ce,expirationTime:fe,sortIndex:-1},Ce>Ue?(me.sortIndex=Ce,o(E,me),r(j)===null&&me===r(E)&&(W?(I(le),le=-1):W=!0,et(ee,Ce-Ue))):(me.sortIndex=fe,o(j,me),H||z||(H=!0,ie||(ie=!0,Ze()))),me},n.unstable_shouldYield=ge,n.unstable_wrapCallback=function(me){var je=M;return function(){var Ce=M;M=je;try{return me.apply(this,arguments)}finally{M=Ce}}}})(Kh)),Kh}var my;function yx(){return my||(my=1,Xh.exports=px()),Xh.exports}var Zh={exports:{}},ua={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var gy;function bx(){if(gy)return ua;gy=1;var n=jm();function o(x){var w="https://react.dev/errors/"+x;if(1<arguments.length){w+="?args[]="+encodeURIComponent(arguments[1]);for(var M=2;M<arguments.length;M++)w+="&args[]="+encodeURIComponent(arguments[M])}return"Minified React error #"+x+"; visit "+w+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var f={d:{f:r,r:function(){throw Error(o(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},m=Symbol.for("react.portal"),g=Symbol.for("react.recoverable"),v=Symbol.for("react.optimistic_key");function S(x,w,M){var z=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:z==null?null:z===v?v:""+z,children:x,containerInfo:w,implementation:M}}var j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function E(x,w){if(x==="font")return"";if(typeof w=="string")return w==="use-credentials"?w:""}return ua.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=f,ua.browser=function(x){return{$$typeof:g,_reason:x}},ua.createPortal=function(x,w){var M=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!w||w.nodeType!==1&&w.nodeType!==9&&w.nodeType!==11)throw Error(o(299));return S(x,w,null,M)},ua.flushSync=function(x){var w=j.T,M=f.p;try{if(j.T=null,f.p=2,x)return x()}finally{j.T=w,f.p=M,f.d.f()}},ua.preconnect=function(x,w){typeof x=="string"&&(w?(w=w.crossOrigin,w=typeof w=="string"?w==="use-credentials"?w:"":void 0):w=null,f.d.C(x,w))},ua.prefetchDNS=function(x){typeof x=="string"&&f.d.D(x)},ua.preinit=function(x,w){if(typeof x=="string"&&w&&typeof w.as=="string"){var M=w.as,z=E(M,w.crossOrigin),H=typeof w.integrity=="string"?w.integrity:void 0,W=typeof w.fetchPriority=="string"?w.fetchPriority:void 0;M==="style"?f.d.S(x,typeof w.precedence=="string"?w.precedence:void 0,{crossOrigin:z,integrity:H,fetchPriority:W}):M==="script"&&f.d.X(x,{crossOrigin:z,integrity:H,fetchPriority:W,nonce:typeof w.nonce=="string"?w.nonce:void 0})}},ua.preinitModule=function(x,w){if(typeof x=="string")if(typeof w=="object"&&w!==null){if(w.as==null||w.as==="script"){var M=E(w.as,w.crossOrigin);f.d.M(x,{crossOrigin:M,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0,fetchPriority:typeof w.fetchPriority=="string"?w.fetchPriority:void 0})}}else w==null&&f.d.M(x)},ua.preload=function(x,w){if(typeof x=="string"&&typeof w=="object"&&w!==null&&typeof w.as=="string"){var M=w.as,z=E(M,w.crossOrigin);f.d.L(x,M,{crossOrigin:z,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0,type:typeof w.type=="string"?w.type:void 0,fetchPriority:typeof w.fetchPriority=="string"?w.fetchPriority:void 0,referrerPolicy:typeof w.referrerPolicy=="string"?w.referrerPolicy:void 0,imageSrcSet:typeof w.imageSrcSet=="string"?w.imageSrcSet:void 0,imageSizes:typeof w.imageSizes=="string"?w.imageSizes:void 0,media:typeof w.media=="string"?w.media:void 0})}},ua.preloadModule=function(x,w){if(typeof x=="string")if(w){var M=E(w.as,w.crossOrigin);f.d.m(x,{as:typeof w.as=="string"&&w.as!=="script"?w.as:void 0,crossOrigin:M,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0,fetchPriority:typeof w.fetchPriority=="string"?w.fetchPriority:void 0})}else f.d.m(x)},ua.requestFormReset=function(x){f.d.r(x)},ua.unstable_batchedUpdates=function(x,w){return x(w)},ua.useFormState=function(x,w,M){return j.H.useFormState(x,w,M)},ua.useFormStatus=function(){return j.H.useHostTransitionStatus()},ua.version="19.3.0",ua}var py;function cb(){if(py)return Zh.exports;py=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),Zh.exports=bx(),Zh.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var yy;function vx(){if(yy)return au;yy=1;var n=yx(),o=jm(),r=cb();function f(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function m(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function g(e){for(var t=e,a=t;a&&!a.alternate;)t=a,(t.flags&4098)!==0&&(e=t.return),a=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function v(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function S(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function j(e){if(g(e)!==e)throw Error(f(188))}function E(e){var t=e.alternate;if(!t){if(t=g(e),t===null)throw Error(f(188));return t!==e?null:e}for(var a=e,l=t;;){var i=a.return;if(i===null)break;var u=i.alternate;if(u===null){if(l=i.return,l!==null){a=l;continue}break}if(i.child===u.child){for(u=i.child;u;){if(u===a)return j(i),e;if(u===l)return j(i),t;u=u.sibling}throw Error(f(188))}if(a.return!==l.return)a=i,l=u;else{for(var y=!1,C=i.child;C;){if(C===a){y=!0,a=i,l=u;break}if(C===l){y=!0,l=i,a=u;break}C=C.sibling}if(!y){for(C=u.child;C;){if(C===a){y=!0,a=u,l=i;break}if(C===l){y=!0,l=u,a=i;break}C=C.sibling}if(!y)throw Error(f(189))}}if(a.alternate!==l)throw Error(f(190))}if(a.tag!==3)throw Error(f(188));return a.stateNode.current===a?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}function w(e,t,a,l,i,u){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&a(e,l,i,u)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&w(e.child,t,a,l,i,u))return!0;e=e.sibling}return!1}function M(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function z(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function H(e){var t=[null,null],a=M(e);return a===null||W(t,e,a.child,{foundSelf:!1}),t}function W(e,t,a,l){for(;a!==null;){if(a===t)l.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(l.foundSelf)return e[1]=a,!0;e[0]=a}else if((a.tag!==22||a.memoizedState===null)&&W(e,t,a.child,l))return!0;a=a.sibling}return!1}function T(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(f(559))}}var _=null,I=null;function X(e,t,a){return e===a?!0:e===t?(_=e,!0):!1}function ne(e,t,a){return e===a?(I=e,!1):e===t?(I!==null&&(_=e),!0):!1}function ee(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ie(e,t,a){for(var l=0,i=e;i;i=a(i))l++;i=0;for(var u=t;u;u=a(u))i++;for(;0<l-i;)e=a(e),l--;for(;0<i-l;)t=a(t),i--;for(;l--;){if(e===t||t!==null&&e===t.alternate)return e;e=a(e),t=a(t)}return null}var le=Object.assign,he=Symbol.for("react.element"),ce=Symbol.for("react.transitional.element"),ge=Symbol.for("react.portal"),xe=Symbol.for("react.fragment"),Ze=Symbol.for("react.strict_mode"),Ne=Symbol.for("react.profiler"),xt=Symbol.for("react.consumer"),et=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),Ce=Symbol.for("react.suspense_list"),Ue=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),Fe=Symbol.for("react.legacy_hidden"),dt=Symbol.for("react.memo_cache_sentinel"),R=Symbol.for("react.view_transition"),Y=Symbol.for("react.recoverable"),ue=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var $e=Symbol.for("react.client.reference");function Re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$e?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case xe:return"Fragment";case Ne:return"Profiler";case Ze:return"StrictMode";case je:return"Suspense";case Ce:return"SuspenseList";case re:return"Activity";case R:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case ge:return"Portal";case et:return e.displayName||"Context";case xt:return(e._context.displayName||"Context")+".Consumer";case me:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ue:return t=e.displayName||null,t!==null?t:Re(e.type)||"Memo";case fe:t=e._payload,e=e._init;try{return Re(e(t))}catch{}}return null}var G=Array.isArray,de=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,be=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_t={pending:!1,data:null,method:null,action:null},Ve=[],Qt=-1;function Ut(e){return{current:e}}function at(e){0>Qt||(e.current=Ve[Qt],Ve[Qt]=null,Qt--)}function Ge(e,t){Qt++,Ve[Qt]=e.current,e.current=t}var on=Ut(null),It=Ut(null),Vn=Ut(null),lt=Ut(null);function Rn(e,t){switch(Ge(Vn,t),Ge(It,e),Ge(on,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=bp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}at(on),Ge(on,e)}function D(){at(on),at(It),at(Vn)}function K(e){var t=e.memoizedState;t!==null&&(Uc._currentValue=t.memoizedState,Ge(lt,e)),t=on.current;var a=bp(t,e.type);t!==a&&(Ge(It,e),Ge(on,a))}function ae(e){It.current===e&&(at(on),at(It)),lt.current===e&&(at(lt),Uc._currentValue=_t)}var Me,De;function We(e){if(Me===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Me=t&&t[1]||"",De=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Me+e+De}var ft=!1;function pt(e,t){if(!e||ft)return"";ft=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Se){var U=Se}Reflect.construct(e,[],oe)}else{try{oe.call()}catch(Se){U=Se}oe=!1;try{var F=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),oe=!0,new e}finally{oe&&(F!==void 0?Object.defineProperty(e.prototype,"props",F):delete e.prototype.props)}}}else{try{throw Error()}catch(Se){U=Se}(oe=e())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Se){if(Se&&U&&typeof Se.stack=="string")return[Se.stack,U.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),y=u[0],C=u[1];if(y&&C){var O=y.split(`
44
+ `),V=C.split(`
45
+ `);for(i=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;i<V.length&&!V[i].includes("DetermineComponentFrameRoot");)i++;if(l===O.length||i===V.length)for(l=O.length-1,i=V.length-1;1<=l&&0<=i&&O[l]!==V[i];)i--;for(;1<=l&&0<=i;l--,i--)if(O[l]!==V[i]){if(l!==1||i!==1)do if(l--,i--,0>i||O[l]!==V[i]){var J=`
46
+ `+O[l].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=l&&0<=i);break}}}finally{ft=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?We(a):""}function an(e,t){switch(e.tag){case 26:case 27:case 5:return We(e.type);case 16:return We("Lazy");case 13:return e.child!==t&&t!==null?We("Suspense Fallback"):We("Suspense");case 19:return We("SuspenseList");case 0:case 15:return pt(e.type,!1);case 11:return pt(e.type.render,!1);case 1:return pt(e.type,!0);case 31:return We("Activity");case 30:return We("ViewTransition");default:return""}}function Pt(e){try{var t="",a=null;do t+=an(e,a),a=e,e=e.return;while(e);return t}catch(l){return`
47
+ Error generating stack: `+l.message+`
48
+ `+l.stack}}var Xt=Object.prototype.hasOwnProperty,Dn=n.unstable_scheduleCallback,Qe=n.unstable_cancelCallback,Sn=n.unstable_shouldYield,Wt=n.unstable_requestPaint,tt=n.unstable_now,wt=n.unstable_getCurrentPriorityLevel,Ct=n.unstable_ImmediatePriority,Nt=n.unstable_UserBlockingPriority,ll=n.unstable_NormalPriority,sl=n.unstable_LowPriority,po=n.unstable_IdlePriority,ei=n.log,ha=n.unstable_setDisableYieldValue,ol=null,ta=null;function Na(e){if(typeof ei=="function"&&ha(e),ta&&typeof ta.setStrictMode=="function")try{ta.setStrictMode(ol,e)}catch{}}var cn=Math.clz32?Math.clz32:zs,ma=Math.log,Wl=Math.LN2;function zs(e){return e>>>=0,e===0?32:31-(ma(e)/Wl|0)|0}var es=256,Va=262144,$s=4194304;function en(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ts(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var i=0,u=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var C=l&134217727;return C!==0?(l=C&~u,l!==0?i=en(l):(y&=C,y!==0?i=en(y):a||(a=C&~e,a!==0&&(i=en(a))))):(C=l&~u,C!==0?i=en(C):y!==0?i=en(y):a||(a=l&~e,a!==0&&(i=en(a)))),i===0?0:t!==0&&t!==i&&(t&u)===0&&(u=i&-i,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:i}function jt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Bi(e,t){(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var l=31-cn(a),i=1<<l;t|=e[l],a&=~i}return t}function yu(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ht(){var e=$s;return $s<<=1,($s&62914560)===0&&($s=4194304),e}function za(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function A(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function P(e,t,a,l,i,u){var y=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var C=e.entanglements,O=e.expirationTimes,V=e.hiddenUpdates;for(a=y&~a;0<a;){var J=31-cn(a),oe=1<<J;C[J]=0,O[J]=-1;var U=V[J];if(U!==null)for(V[J]=null,J=0;J<U.length;J++){var F=U[J];F!==null&&(F.lane&=-536870913)}a&=~oe}l!==0&&Be(e,l,0),u!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=u&~(y&~t))}function Be(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-cn(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function ye(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-cn(a),i=1<<l;i&t|e[l]&t&&(e[l]|=t),a&=~i}}function ke(e,t){var a=t&-t;return a=(a&42)!==0?1:ht(a),(a&(e.suspendedLanes|t))!==0?0:a}function ht(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function qe(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function rn(){var e=be.p;return e!==0?e:(e=window.event,e===void 0?32:ty(e.type))}function na(e,t){var a=be.p;try{return be.p=e,t()}finally{be.p=a}}var Et=Math.random().toString(36).slice(2),it="__reactFiber$"+Et,yn="__reactProps$"+Et,Os="__reactContainer$"+Et,Kc="__reactEvents$"+Et,sf="__reactListeners$"+Et,bu="__reactHandles$"+Et,ti="__reactResources$"+Et,ni="__reactMarker$"+Et,Rs="__reactLoad$"+Et;function Hi(e){delete e[it],delete e[yn],delete e[sf],delete e[bu]}function ns(e){var t;if(t=e[it])return t;for(var a=e.parentNode;a;){if(t=a[Os]||a[it]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Dp(e);e!==null;){if(a=e[it])return a;e=Dp(e)}return t}e=a,a=e.parentNode}return null}function as(e){if(e=e[it]||e[Os]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Sa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(f(33))}function il(e){var t=e[ti];return t||(t=e[ti]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function zn(e){e[ni]=!0}function vu(e){e[Rs]=void 0}var ai=new Set,ls={};function un(e,t){ga(e,t),ga(e+"Capture",t)}function ga(e,t){for(ls[e]=t,e=0;e<t.length;e++)ai.add(t[e])}var Ds=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Zc={},Fc={};function xu(e){return Xt.call(Fc,e)?!0:Xt.call(Zc,e)?!1:Ds.test(e)?Fc[e]=!0:(Zc[e]=!0,!1)}var Ye=!1;function Nl(){var e=Ye;return Ye=!1,e}function li(e,t,a){if(xu(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,a)}}function cl(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,a)}}function Zn(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,l)}}function aa(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wu(e,t,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var i=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(y){a=""+y,u.call(this,y)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function si(e){if(!e._valueTracker){var t=Sl(e)?"checked":"value";e._valueTracker=wu(e,t,""+e[t])}}function Qc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=Sl(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}var ju=/[\n"\\]/g;function ka(e){return e.replace(ju,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Bs(e,t,a,l,i,u,y,C){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+aa(t)):e.value!==""+aa(t)&&(e.value=""+aa(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?y==="number"&&e.value==t?Hs(e,aa(e.value)):Hs(e,aa(t)):a!=null?Hs(e,aa(a)):l!=null&&e.removeAttribute("value"),i==null&&u!=null&&(e.defaultChecked=!!u),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+aa(C):e.removeAttribute("name")}function Nu(e,t,a,l,i,u,y,C){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){si(e);return}a=a!=null?""+aa(a):"",t=t!=null?""+aa(t):a,C||t===e.value||(e.value=t),e.defaultValue=t}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=C?e.checked:!!l,e.defaultChecked=!!l,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),si(e)}function Hs(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function pa(e,t,a,l){if(e=e.options,t){t={};for(var i=0;i<a.length;i++)t["$"+a[i]]=!0;for(a=0;a<e.length;a++)i=t.hasOwnProperty("$"+e[a].value),e[a].selected!==i&&(e[a].selected=i),i&&l&&(e[a].defaultSelected=!0)}else{for(a=""+aa(a),t=null,i=0;i<e.length;i++){if(e[i].value===a){e[i].selected=!0,l&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ls(e,t,a){if(t!=null&&(t=""+aa(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+aa(a):""}function ct(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(f(92));if(G(l)){if(1<l.length)throw Error(f(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=aa(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),si(e)}function Ga(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var of=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Pc(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||of.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Li(e,t,a){if(t!=null&&typeof t!="object")throw Error(f(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="",Ye=!0);for(var i in t)l=t[i],t.hasOwnProperty(i)&&a[i]!==l&&(Pc(e,i,l),Ye=!0)}else for(var u in t)t.hasOwnProperty(u)&&Pc(e,u,t[u])}function ve(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var la=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),cf=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ss(e){return cf.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function dn(){}var _s=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rl=null,Gn=null;function oi(e){var t=as(e);if(t&&(e=t.stateNode)){var a=e[yn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Bs(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+ka(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var i=l[yn]||null;if(!i)throw Error(f(90));Bs(l,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Qc(l)}break e;case"textarea":Ls(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&pa(e,!!a.multiple,t,!1)}}}var zt=!1;function Kt(e,t,a){if(zt)return e(t,a);zt=!0;try{var l=e(t);return l}finally{if(zt=!1,(rl!==null||Gn!==null)&&(bd(),rl&&(t=rl,e=Gn,Gn=rl=null,oi(t),e)))for(t=0;t<e.length;t++)oi(e[t])}}function $a(e,t){var a=e.stateNode;if(a===null)return null;var l=a[yn]||null;if(l===null)return null;a=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(f(231,t,typeof a));return a}var Yn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_i=!1;if(Yn)try{var os={};Object.defineProperty(os,"passive",{get:function(){_i=!0}}),window.addEventListener("test",os,os),window.removeEventListener("test",os,os)}catch{_i=!1}var kl=null,ul=null,Ui=null;function dl(){if(Ui)return Ui;var e,t=ul,a=t.length,l,i="value"in kl?kl.value:kl.textContent,u=i.length;for(e=0;e<a&&t[e]===i[e];e++);var y=a-e;for(l=1;l<=y&&t[a-l]===i[u-l];l++);return Ui=i.slice(e,1<l?1-l:void 0)}function Ya(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function qi(){return!0}function Jc(){return!1}function Fn(e){function t(a,l,i,u,y){this._reactName=a,this._targetInst=i,this.type=l,this.nativeEvent=u,this.target=y,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(a=e[C],this[C]=a?a(u):u[C]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?qi:Jc,this.isPropagationStopped=Jc,this}return le(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=qi)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=qi)},persist:function(){},isPersistent:qi}),t}var Tl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ii=Fn(Tl),Us=le({},Tl,{view:0,detail:0}),Ic=Fn(Us),Wc,ci,yo,qs=le({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==yo&&(yo&&e.type==="mousemove"?(Wc=e.screenX-yo.screenX,ci=e.screenY-yo.screenY):ci=Wc=0,yo=e),Wc)},movementY:function(e){return"movementY"in e?e.movementY:ci}}),Xa=Fn(qs),Su=le({},qs,{dataTransfer:0}),ku=Fn(Su),er=le({},Us,{relatedTarget:0}),Vi=Fn(er),rf=le({},Tl,{animationName:0,elapsedTime:0,pseudoElement:0}),bn=Fn(rf),fl=le({},Tl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kn=Fn(fl),fn=le({},Tl,{data:0}),tr=Fn(fn),Oa={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tu={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Cu={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Eu(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cu[e])?!!t[e]:!1}function Gi(){return Eu}var Vs=le({},Us,{key:function(e){if(e.key){var t=Oa[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ya(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tu[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gi,charCode:function(e){return e.type==="keypress"?Ya(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ya(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),we=Fn(Vs),Mu=le({},qs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yi=Fn(Mu),Je=le({},Tl,{submitter:0}),hn=Fn(Je),Gs=le({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gi}),St=Fn(Gs),nr=le({},Tl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Tn=Fn(nr),uf=le({},qs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),df=Fn(uf),hl=le({},Tl,{newState:0,oldState:0,source:0}),ff=Fn(hl),Au=[9,13,27,32],Xi=Yn&&"CompositionEvent"in window,ri=null;Yn&&"documentMode"in document&&(ri=document.documentMode);var ui=Yn&&"TextEvent"in window&&!ri,Cl=Yn&&(!Xi||ri&&8<ri&&11>=ri),Ys=" ",Ki=!1;function Ka(e,t){switch(e){case"keyup":return Au.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bo(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var El=!1;function Zi(e,t){switch(e){case"compositionend":return bo(t);case"keypress":return t.which!==32?null:(Ki=!0,Ys);case"textInput":return e=t.data,e===Ys&&Ki?null:e;default:return null}}function ar(e,t){if(El)return e==="compositionend"||!Xi&&Ka(e,t)?(e=dl(),Ui=ul=kl=null,El=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Cl&&t.locale!=="ko"?null:t.data;default:return null}}var Fi={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Fi[e.type]:t==="textarea"}function zu(e,t,a,l){rl?Gn?Gn.push(l):Gn=[l]:rl=l,t=Sd(t,"onChange"),0<t.length&&(a=new ii("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var di=null,Ra=null;function vo(e){dp(e,0)}function Ta(e){var t=Sa(e);if(Qc(t))return e}function Za(e,t){if(e==="change")return t}var sr=!1;if(Yn){var Xs;if(Yn){var or="oninput"in document;if(!or){var $u=document.createElement("div");$u.setAttribute("oninput","return;"),or=typeof $u.oninput=="function"}Xs=or}else Xs=!1;sr=Xs&&(!document.documentMode||9<document.documentMode)}function xo(){di&&(di.detachEvent("onpropertychange",Qi),Ra=di=null)}function Qi(e){if(e.propertyName==="value"&&Ta(Ra)){var t=[];zu(t,Ra,e,ln(e)),Kt(vo,t)}}function Ou(e,t,a){e==="focusin"?(xo(),di=t,Ra=a,di.attachEvent("onpropertychange",Qi)):e==="focusout"&&xo()}function ir(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ta(Ra)}function Ru(e,t){if(e==="click")return Ta(t)}function is(e,t){if(e==="input"||e==="change")return Ta(t)}function hf(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qn=typeof Object.is=="function"?Object.is:hf;function fi(e,t){if(Qn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var i=a[l];if(!Xt.call(t,i)||!Qn(e[i],t[i]))return!1}return!0}function Pi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ji(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wo(e,t){var a=Ji(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ji(a)}}function Ml(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ml(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pi(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Pi(e.document)}return t}function Ii(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Du=Yn&&"documentMode"in document&&11>=document.documentMode,Al=null,jo=null,cs=null,rr=!1;function ur(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;rr||Al==null||Al!==Pi(l)||(l=Al,"selectionStart"in l&&Ii(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),cs&&fi(cs,l)||(cs=l,l=Sd(jo,"onSelect"),0<l.length&&(t=new ii("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=Al)))}function Da(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Ks={animationend:Da("Animation","AnimationEnd"),animationiteration:Da("Animation","AnimationIteration"),animationstart:Da("Animation","AnimationStart"),transitionrun:Da("Transition","TransitionRun"),transitionstart:Da("Transition","TransitionStart"),transitioncancel:Da("Transition","TransitionCancel"),transitionend:Da("Transition","TransitionEnd")},dr={},Bu={};Yn&&(Bu=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function zl(e){if(dr[e])return dr[e];if(!Ks[e])return e;var t=Ks[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Bu)return dr[e]=t[a];return e}var fr=zl("animationend"),No=zl("animationiteration"),hr=zl("animationstart"),mf=zl("transitionrun"),Wi=zl("transitionstart"),ec=zl("transitioncancel"),tc=zl("transitionend"),mr=new Map,nc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");nc.push("scrollEnd");function ya(e,t){mr.set(e,t),un(t,[e])}var hi=0;function Ba(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Pl.identifierPrefix;var a=hi++;return e="_"+e+"t_"+a.toString(32)+"_",t.autoName=e}function mi(e){if(e==null||typeof e=="string")return e;var t=null,a=Ac;if(a!==null)for(var l=0;l<a.length;l++){var i=e[a[l]];if(i!=null){if(i==="none")return"none";t=t==null?i:t+(" "+i)}}return t??e.default}function $l(e,t){return e=mi(e),t=mi(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var gi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},sa=[],So=0,gr=0;function ko(){for(var e=So,t=gr=So=0;t<e;){var a=sa[t];sa[t++]=null;var l=sa[t];sa[t++]=null;var i=sa[t];sa[t++]=null;var u=sa[t];if(sa[t++]=null,l!==null&&i!==null){var y=l.pending;y===null?i.next=i:(i.next=y.next,y.next=i),l.pending=i}u!==0&&yr(a,i,u)}}function Zs(e,t,a,l){sa[So++]=e,sa[So++]=t,sa[So++]=a,sa[So++]=l,gr|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function pr(e,t,a,l){return Zs(e,t,a,l),To(e)}function rs(e,t){return Zs(e,null,null,t),To(e)}function yr(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var i=!1,u=e.return;u!==null;)u.childLanes|=a,l=u.alternate,l!==null&&(l.childLanes|=a),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(i=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,i&&t!==null&&(i=31-cn(a),e=u.hiddenUpdates,l=e[i],l===null?e[i]=[t]:l.push(t),t.lane=a|536870912),u):null}function To(e){if(50<Yr)throw Yr=0,yd=null,Error(f(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Fs={};function gf(e,t,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(e,t,a,l){return new gf(e,t,a,l)}function ac(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pn(e,t){var a=e.alternate;return a===null?(a=$n(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&1206910976,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function ml(e,t){e.flags&=1206910978;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function br(e,t,a,l,i,u){var y=0;if(l=e,typeof l=="function")ac(l)&&(y=1);else if(typeof l=="string")y=Iv(e,a,on.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(l){case re:return e=$n(31,a,t,i),e.elementType=re,e.lanes=u,e;case xe:return Ol(a.children,i,u,t);case Ze:y=8,i|=24;break;case Ne:return e=$n(12,a,t,i|2),e.elementType=Ne,e.lanes=u,e;case je:return e=$n(13,a,t,i),e.elementType=je,e.lanes=u,e;case Ce:return e=$n(19,a,t,i),e.elementType=Ce,e.lanes=u,e;case Fe:case R:return e=i|32,e=$n(30,a,t,e),e.elementType=R,e.lanes=u,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case et:y=10;break e;case xt:y=9;break e;case me:y=11;break e;case Ue:y=14;break e;case fe:y=16,l=null;break e}y=29,a=Error(f(130,e===null?"null":typeof e,"")),l=null}return t=$n(y,a,t,i),t.elementType=e,t.type=l,t.lanes=u,t}function Ol(e,t,a,l){return e=$n(7,e,l,t),e.lanes=a,e}function ba(e,t,a){return e=$n(6,e,null,t),e.lanes=a,e}function us(e){var t=$n(18,null,null,0);return t.stateNode=e,t}function Rl(e,t,a){return t=$n(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var lc=new WeakMap;function Ca(e,t){if(typeof e=="object"&&e!==null){var a=lc.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Pt(t)},lc.set(e,t),t)}return{value:e,source:t,stack:Pt(t)}}var gl=[],Qs=0,va=null,pl=0,mn=[],Jn=0,Dl=null,Fa=1,yl="";function Bl(e,t){gl[Qs++]=pl,gl[Qs++]=va,va=e,pl=t}function Hu(e,t,a){mn[Jn++]=Fa,mn[Jn++]=yl,mn[Jn++]=Dl,Dl=e;var l=Fa;e=yl;var i=32-cn(l)-1;l&=~(1<<i),a+=1;var u=32-cn(t)+i;if(30<u){var y=i-i%5;u=(l&(1<<y)-1).toString(32),l>>=y,i-=y,Fa=1<<32-cn(t)+i|a<<i|l,yl=u+e}else Fa=1<<u|a<<i|l,yl=e}function pi(e){e.return!==null&&(Bl(e,1),Hu(e,1,0))}function Lu(e){for(;e===va;)va=gl[--Qs],gl[Qs]=null,pl=gl[--Qs],gl[Qs]=null;for(;e===Dl;)Dl=mn[--Jn],mn[Jn]=null,yl=mn[--Jn],mn[Jn]=null,Fa=mn[--Jn],mn[Jn]=null}function _u(e,t){mn[Jn++]=Fa,mn[Jn++]=yl,mn[Jn++]=Dl,Fa=t.id,yl=t.overflow,Dl=e}var vn=null,Zt=null,st=!1,Hl=null,tn=!1,sc=Error(f(519));function Ll(e){var t=Error(f(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yi(Ca(t,e)),sc}function vr(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[it]=e,t[yn]=l,a){case"dialog":gt("cancel",t),gt("close",t);break;case"iframe":case"object":case"embed":gt("load",t);break;case"video":case"audio":for(a=0;a<Kr.length;a++)gt(Kr[a],t);break;case"source":gt("error",t);break;case"img":case"image":case"link":gt("error",t),gt("load",t);break;case"details":gt("toggle",t);break;case"input":gt("invalid",t),Nu(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":gt("invalid",t);break;case"textarea":gt("invalid",t),ct(t,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||gp(t.textContent,a)?(l.popover!=null&&(gt("beforetoggle",t),gt("toggle",t)),l.onScroll!=null&&gt("scroll",t),l.onScrollEnd!=null&&gt("scrollend",t),l.onClick!=null&&(t.onclick=dn),t=!0):t=!1,t||Ll(e,!0)}function xn(e){for(vn=e.return;vn;)switch(vn.tag){case 5:case 31:case 13:tn=!1;return;case 27:case 3:tn=!0;return;default:vn=vn.return}}function Ps(e){if(e!==vn)return!1;if(!st)return xn(e),st=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||jh(e.type,e.memoizedProps)),a=!a),a&&Zt&&Ll(e),xn(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));Zt=Rp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));Zt=Rp(e)}else t===27?(t=Zt,Xo(e.type)?(e=zh,zh=null,Zt=e):Zt=t):Zt=vn?xl(e.stateNode.nextSibling):null;return!0}function _l(){Zt=vn=null,st=!1}function xr(){var e=Hl;return e!==null&&(_a===null?_a=e:_a.push.apply(_a,e),Hl=null),e}function yi(e){Hl===null?Hl=[e]:Hl.push(e)}var oc=Ut(null),ds=null,Ul=null;function ql(e,t,a){Ge(oc,t._currentValue),t._currentValue=a}function Vl(e){e._currentValue=oc.current,at(oc)}function ic(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function wr(e,t,a,l){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var u=i.dependencies;if(u!==null){var y=i.child;u=u.firstContext;e:for(;u!==null;){var C=u;u=i;for(var O=0;O<t.length;O++)if(C.context===t[O]){u.lanes|=a,C=u.alternate,C!==null&&(C.lanes|=a),ic(u.return,a,e),l||(y=null);break e}u=C.next}}else if(i.tag===18){if(y=i.return,y===null)throw Error(f(341));y.lanes|=a,u=y.alternate,u!==null&&(u.lanes|=a),ic(y,a,e),y=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=a,y=i.alternate,y!==null&&(y.lanes|=a),ic(i.return,a,e),y=i.child,y=y!==null?y.sibling:null):y=i.child;if(y!==null)y.return=i;else for(y=i;y!==null;){if(y===e){y=null;break}if(i=y.sibling,i!==null){i.return=y.return,y=i;break}y=y.return}i=y}}function Js(e,t,a,l){e=null;for(var i=t,u=!1;i!==null;){if(!u){if((i.flags&524288)!==0)u=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var y=i.alternate;if(y===null)throw Error(f(387));if(y=y.memoizedProps,y!==null){var C=i.type;Qn(i.pendingProps.value,y.value)||(e!==null?e.push(C):e=[C])}}else if(i===lt.current){if(y=i.alternate,y===null)throw Error(f(387));y.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Uc):e=[Uc])}i=i.return}return e!==null&&wr(t,e,a,l),t.flags|=262144,e!==null}function cc(e){for(e=e.firstContext;e!==null;){if(!Qn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function fs(e){ds=e,Ul=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Bn(e){return jr(ds,e)}function Is(e,t){return ds===null&&fs(e),jr(e,t)}function jr(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Ul===null){if(e===null)throw Error(f(308));Ul=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ul=Ul.next=t;return a}var Uu=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},qu=n.unstable_scheduleCallback,Nr=n.unstable_NormalPriority,Cn={$$typeof:et,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sr(){return{controller:new Uu,data:new Map,refCount:0}}function Co(e){e.refCount--,e.refCount===0&&qu(Nr,function(){e.controller.abort()})}function kr(e,t){if((e.pendingLanes&4194048)!==0){var a=e.transitionTypes;for(a===null&&(a=e.transitionTypes=[]),e=0;e<t.length;e++){var l=t[e];a.indexOf(l)===-1&&a.push(l)}}}var Eo=null;function Vu(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var bi=null,rc=0,Ws=0,Mo=null;function ot(e,t){if(bi===null){var a=bi=[];rc=0,Ws=hh(),Mo={status:"pending",value:void 0,then:function(l){a.push(l)}}}return rc++,t.then(Ao,Ao),t}function Ao(){if(--rc===0&&(Eo=null,bi!==null)){Mo!==null&&(Mo.status="fulfilled");var e=bi;bi=null,Ws=0,Mo=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pf(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(i){a.push(i)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var i=0;i<a.length;i++)(0,a[i])(t)},function(i){for(l.status="rejected",l.reason=i,i=0;i<a.length;i++)(0,a[i])(void 0)}),l}var Tr=de.S;de.S=function(e,t){if(Yg=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ot(e,t),Eo!==null)for(var a=Rc;a!==null;)kr(a,Eo),a=a.next;if(a=e.types,a!==null){for(var l=Rc;l!==null;)kr(l,a),l=l.next;if(Ws!==0){l=Eo,l===null&&(l=Eo=[]);for(var i=0;i<a.length;i++){var u=a[i];l.indexOf(u)===-1&&l.push(u)}}}Tr!==null&&Tr(e,t)};var hs=Ut(null);function Cr(){var e=hs.current;return e!==null?e:Jt.pooledCache}function kt(e,t){t===null?Ge(hs,hs.current):Ge(hs,t.pool)}function Xn(){var e=Cr();return e===null?null:{parent:Cn._currentValue,pool:e}}var En=Error(f(460)),Gl=Error(f(474)),zo=Error(f(542)),eo={then:function(){}};function Er(e){return e=e.status,e==="fulfilled"||e==="rejected"}function uc(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(dn,dn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mr(e),e===void 0&&!("reason"in t)?Error(f(600)):e;default:if(typeof t.status=="string")t.then(dn,dn);else{if(e=Jt,e!==null&&100<e.shellSuspendCounter)throw Error(f(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=l}},function(l){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mr(e),e}throw Yl=t,En}}function to(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Yl=a,En):a}}var Yl=null;function Gu(){if(Yl===null)throw Error(f(459));var e=Yl;return Yl=null,e}function Mr(e){if(e===En||e===zo)throw Error(f(483))}var no=null,vi=0;function ao(e){var t=vi;return vi+=1,no===null&&(no=[]),uc(no,e,t)}function ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function lo(e,t){throw t.$$typeof===he?Error(f(525)):(e=Object.prototype.toString.call(t),Error(f(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function xi(e){function t(q,B){if(e){var Z=q.deletions;Z===null?(q.deletions=[B],q.flags|=16):Z.push(B)}}function a(q,B){if(!e)return null;for(;B!==null;)t(q,B),B=B.sibling;return null}function l(q){for(var B=new Map;q!==null;)q.key===null?B.set(q.index,q):B.set(q.key,q),q=q.sibling;return B}function i(q,B){return q=Pn(q,B),q.index=0,q.sibling=null,q}function u(q,B,Z){return q.index=Z,e?(Z=q.alternate,Z!==null?(Z=Z.index,Z<B?(q.flags|=2,B):Z):(q.flags|=134217730,B)):(q.flags|=1048576,B)}function y(q){return e&&q.alternate===null&&(q.flags|=134217730),q}function C(q,B,Z,se){return B===null||B.tag!==6?(B=ba(Z,q.mode,se),B.return=q,B):(B=i(B,Z),B.return=q,B)}function O(q,B,Z,se){var ze=Z.type;return ze===xe?(q=J(q,B,Z.props.children,se,Z.key),ms(q,Z),q):B!==null&&(B.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===fe&&to(ze)===B.type)?(B=i(B,Z.props),ms(B,Z),B.return=q,B):(B=br(Z.type,Z.key,Z.props,null,q.mode,se),ms(B,Z),B.return=q,B)}function V(q,B,Z,se){return B===null||B.tag!==4||B.stateNode.containerInfo!==Z.containerInfo||B.stateNode.implementation!==Z.implementation?(B=Rl(Z,q.mode,se),B.return=q,B):(B=i(B,Z.children||[]),B.return=q,B)}function J(q,B,Z,se,ze){return B===null||B.tag!==7?(B=Ol(Z,q.mode,se,ze),B.return=q,B):(B=i(B,Z),B.return=q,B)}function oe(q,B,Z){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=ba(""+B,q.mode,Z),B.return=q,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case ce:return Z=br(B.type,B.key,B.props,null,q.mode,Z),ms(Z,B),Z.return=q,Z;case ge:return B=Rl(B,q.mode,Z),B.return=q,B;case fe:return B=to(B),oe(q,B,Z)}if(G(B)||pe(B))return B=Ol(B,q.mode,Z,null),B.return=q,B;if(typeof B.then=="function")return oe(q,ao(B),Z);if(B.$$typeof===et)return oe(q,Is(q,B),Z);lo(q,B)}return null}function U(q,B,Z,se){var ze=B!==null?B.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return ze!==null?null:C(q,B,""+Z,se);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case ce:return Z.key===ze?O(q,B,Z,se):null;case ge:return Z.key===ze?V(q,B,Z,se):null;case fe:return Z=to(Z),U(q,B,Z,se)}if(G(Z)||pe(Z))return ze!==null?null:J(q,B,Z,se,null);if(typeof Z.then=="function")return U(q,B,ao(Z),se);if(Z.$$typeof===et)return U(q,B,Is(q,Z),se);lo(q,Z)}return null}function F(q,B,Z,se,ze){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return q=q.get(Z)||null,C(B,q,""+se,ze);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case ce:return q=q.get(se.key===null?Z:se.key)||null,O(B,q,se,ze);case ge:return q=q.get(se.key===null?Z:se.key)||null,V(B,q,se,ze);case fe:return se=to(se),F(q,B,Z,se,ze)}if(G(se)||pe(se))return q=q.get(Z)||null,J(B,q,se,ze,null);if(typeof se.then=="function")return F(q,B,Z,ao(se),ze);if(se.$$typeof===et)return F(q,B,Z,Is(B,se),ze);lo(B,se)}return null}function Se(q,B,Z,se){for(var ze=null,vt=null,Le=B,Ke=B=0,qn=null;Le!==null&&Ke<Z.length;Ke++){Le.index>Ke?(qn=Le,Le=null):qn=Le.sibling;var Tt=U(q,Le,Z[Ke],se);if(Tt===null){Le===null&&(Le=qn);break}e&&Le&&Tt.alternate===null&&t(q,Le),B=u(Tt,B,Ke),vt===null?ze=Tt:vt.sibling=Tt,vt=Tt,Le=qn}if(Ke===Z.length)return a(q,Le),st&&Bl(q,Ke),ze;if(Le===null){for(;Ke<Z.length;Ke++)Le=oe(q,Z[Ke],se),Le!==null&&(B=u(Le,B,Ke),vt===null?ze=Le:vt.sibling=Le,vt=Le);return st&&Bl(q,Ke),ze}for(Le=l(Le);Ke<Z.length;Ke++)qn=F(Le,q,Ke,Z[Ke],se),qn!==null&&(e&&(Tt=qn.alternate,Tt!==null&&Le.delete(Tt.key===null?Ke:Tt.key)),B=u(qn,B,Ke),vt===null?ze=qn:vt.sibling=qn,vt=qn);return e&&Le.forEach(function(Po){return t(q,Po)}),st&&Bl(q,Ke),ze}function Oe(q,B,Z,se){if(Z==null)throw Error(f(151));for(var ze=null,vt=null,Le=B,Ke=B=0,qn=null,Tt=Z.next();Le!==null&&!Tt.done;Ke++,Tt=Z.next()){Le.index>Ke?(qn=Le,Le=null):qn=Le.sibling;var Po=U(q,Le,Tt.value,se);if(Po===null){Le===null&&(Le=qn);break}e&&Le&&Po.alternate===null&&t(q,Le),B=u(Po,B,Ke),vt===null?ze=Po:vt.sibling=Po,vt=Po,Le=qn}if(Tt.done)return a(q,Le),st&&Bl(q,Ke),ze;if(Le===null){for(;!Tt.done;Ke++,Tt=Z.next())Tt=oe(q,Tt.value,se),Tt!==null&&(B=u(Tt,B,Ke),vt===null?ze=Tt:vt.sibling=Tt,vt=Tt);return st&&Bl(q,Ke),ze}for(Le=l(Le);!Tt.done;Ke++,Tt=Z.next())Tt=F(Le,q,Ke,Tt.value,se),Tt!==null&&(e&&(qn=Tt.alternate,qn!==null&&Le.delete(qn.key===null?Ke:qn.key)),B=u(Tt,B,Ke),vt===null?ze=Tt:vt.sibling=Tt,vt=Tt);return e&&Le.forEach(function(ux){return t(q,ux)}),st&&Bl(q,Ke),ze}function nt(q,B,Z,se){if(typeof Z=="object"&&Z!==null&&Z.type===xe&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case ce:e:{for(var ze=Z.key;B!==null;){if(B.key===ze){if(ze=Z.type,ze===xe){if(B.tag===7){a(q,B.sibling),se=i(B,Z.props.children),ms(se,Z),se.return=q,q=se;break e}}else if(B.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===fe&&to(ze)===B.type){a(q,B.sibling),se=i(B,Z.props),ms(se,Z),se.return=q,q=se;break e}a(q,B);break}else t(q,B);B=B.sibling}Z.type===xe?(se=Ol(Z.props.children,q.mode,se,Z.key),ms(se,Z),se.return=q,q=se):(se=br(Z.type,Z.key,Z.props,null,q.mode,se),ms(se,Z),se.return=q,q=se)}return y(q);case ge:e:{for(ze=Z.key;B!==null;){if(B.key===ze)if(B.tag===4&&B.stateNode.containerInfo===Z.containerInfo&&B.stateNode.implementation===Z.implementation){a(q,B.sibling),se=i(B,Z.children||[]),se.return=q,q=se;break e}else{a(q,B);break}else t(q,B);B=B.sibling}se=Rl(Z,q.mode,se),se.return=q,q=se}return y(q);case fe:return Z=to(Z),nt(q,B,Z,se)}if(G(Z))return Se(q,B,Z,se);if(pe(Z)){if(ze=pe(Z),typeof ze!="function")throw Error(f(150));return Z=ze.call(Z),Oe(q,B,Z,se)}if(typeof Z.then=="function")return nt(q,B,ao(Z),se);if(Z.$$typeof===et)return nt(q,B,Is(q,Z),se);lo(q,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,B!==null&&B.tag===6?(a(q,B.sibling),se=i(B,Z),se.return=q,q=se):(a(q,B),se=ba(Z,q.mode,se),se.return=q,q=se),y(q)):a(q,B)}return function(q,B,Z,se){try{vi=0;var ze=nt(q,B,Z,se);return no=null,ze}catch(Le){if(Le===En||Le===zo)throw Le;var vt=$n(29,Le,null,q.mode);return vt.lanes=se,vt.return=q,vt}finally{}}}var $o=xi(!0),Oo=xi(!1),Xl=!1;function dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function In(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Qa(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Dt&2)!==0){var i=l.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),l.pending=t,t=To(e),yr(e,null,a),t}return Zs(e,l,t,a),To(e)}function so(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,ye(e,a)}}function ji(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var i=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?i=u=y:u=u.next=y,a=a.next}while(a!==null);u===null?i=u=t:u=u.next=t}else i=u=t;a={baseState:l.baseState,firstBaseUpdate:i,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Ro=!1;function xa(){if(Ro){var e=Mo;if(e!==null)throw e}}function gs(e,t,a,l){Ro=!1;var i=e.updateQueue;Xl=!1;var u=i.firstBaseUpdate,y=i.lastBaseUpdate,C=i.shared.pending;if(C!==null){i.shared.pending=null;var O=C,V=O.next;O.next=null,y===null?u=V:y.next=V,y=O;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=V:C.next=V,J.lastBaseUpdate=O))}if(u!==null){var oe=i.baseState;y=0,J=V=O=null,C=u;do{var U=C.lane&-536870913,F=U!==C.lane;if(F?(bt&U)===U:(l&U)===U){U!==0&&U===Ws&&(Ro=!0),J!==null&&(J=J.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Se=e,Oe=C;U=t;var nt=a;switch(Oe.tag){case 1:if(Se=Oe.payload,typeof Se=="function"){oe=Se.call(nt,oe,U);break e}oe=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Oe.payload,U=typeof Se=="function"?Se.call(nt,oe,U):Se,U==null)break e;oe=le({},oe,U);break e;case 2:Xl=!0}}U=C.callback,U!==null&&(e.flags|=64,F&&(e.flags|=8192),F=i.callbacks,F===null?i.callbacks=[U]:F.push(U))}else F={lane:U,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(V=J=F,O=oe):J=J.next=F,y|=U;if(C=C.next,C===null){if(C=i.shared.pending,C===null)break;F=C,C=F.next,F.next=null,i.lastBaseUpdate=F,i.shared.pending=null}}while(!0);J===null&&(O=oe),i.baseState=O,i.firstBaseUpdate=V,i.lastBaseUpdate=J,u===null&&(i.shared.lanes=0),qo|=y,e.lanes=y,e.memoizedState=oe}}function fc(e,t){if(typeof e!="function")throw Error(f(191,e));e.call(t)}function Yu(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)fc(a[e],t)}var ps=Ut(null),Do=Ut(0);function Ar(e,t){e=ho,Ge(Do,e),Ge(ps,t),ho=e|t.baseLanes}function hc(){Ge(Do,ho),Ge(ps,ps.current)}function mc(){ho=Do.current,at(ps),at(Do)}var Hn=Ut(null),oa=null;function oo(e){var t=e.alternate;Ge(Ln,Ln.current&1),Ge(Hn,e),oa===null&&(t===null||ps.current!==null||t.memoizedState!==null)&&(oa=e)}function gc(e){Ge(Ln,Ln.current),Ge(Hn,e),oa===null&&(oa=e)}function zr(e){e.tag===22?(Ge(Ln,Ln.current),Ge(Hn,e),oa===null&&(oa=e)):gn()}function gn(){Ge(Ln,Ln.current),Ge(Hn,Hn.current)}function wa(e){at(Hn),oa===e&&(oa=null),at(Ln)}var Ln=Ut(0);function ys(e,t){Ge(Hn,Hn.current),Ge(Ln,t)}function pc(e){at(Ln),at(Hn),oa===e&&(oa=null)}function Ni(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Mh(a)||Ah(a)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var bl=0,Ie=null,Rt=null,wn=null,Si=!1,io=!1,bs=!1,ki=0,Bo=0,co=null,Xu=0;function sn(){throw Error(f(321))}function yc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Qn(e[a],t[a]))return!1;return!0}function bc(e,t,a,l,i,u){return bl=u,Ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,de.H=e===null||e.memoizedState===null?Km:Zm,bs=!1,u=a(l,i),bs=!1,io&&(u=Or(t,a,l,i)),$r(e),u}function $r(e){de.H=Ju;var t=Rt!==null&&Rt.next!==null;if(bl=0,wn=Rt=Ie=null,Si=!1,Bo=0,co=null,t)throw Error(f(300));e===null||Un||(e=e.dependencies,e!==null&&cc(e)&&(Un=!0))}function Or(e,t,a,l){Ie=e;var i=0;do{if(io&&(co=null),Bo=0,io=!1,25<=i)throw Error(f(301));if(i+=1,wn=Rt=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}de.H=_b,u=t(a,l)}while(io);return u}function Ku(){var e=de.H,t=e.useState()[0];return t=typeof t.then=="function"?N(t):t,e=e.useState()[0],(Rt!==null?Rt.memoizedState:null)!==e&&(Ie.flags|=1024),t}function vc(){var e=ki!==0;return ki=0,e}function xc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function wc(e){if(Si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Si=!1}bl=0,wn=Rt=Ie=null,io=!1,Bo=ki=0,co=null}function c(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wn===null?Ie.memoizedState=wn=e:wn=wn.next=e,wn}function h(){if(Rt===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=Rt.next;var t=wn===null?Ie.memoizedState:wn.next;if(t!==null)wn=t,Rt=e;else{if(e===null)throw Ie.alternate===null?Error(f(467)):Error(f(310));Rt=e,e={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},wn===null?Ie.memoizedState=wn=e:wn=wn.next=e}return wn}function p(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function N(e){var t=Bo;return Bo+=1,co===null&&(co=[]),e=uc(co,e,t),t=Ie,(wn===null?t.memoizedState:wn.next)===null&&(t=t.alternate,de.H=t===null||t.memoizedState===null?Km:Zm),e}function k(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return N(e);if(e.$$typeof===Y)return;if(e.$$typeof===et)return Bn(e)}throw Error(f(438,String(e)))}function $(e){var t=null,a=Ie.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=Ie.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=p(),Ie.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=dt;return t.index++,a}function L(e,t){return typeof t=="function"?t(e):t}function te(e){var t=h();return Ae(t,Rt,e)}function Ae(e,t,a){var l=e.queue;if(l===null)throw Error(f(311));l.lastRenderedReducer=a;var i=e.baseQueue,u=l.pending;if(u!==null){if(i!==null){var y=i.next;i.next=u.next,u.next=y}t.baseQueue=i=u,l.pending=null}if(u=e.baseState,i===null)e.memoizedState=u;else{t=i.next;var C=y=null,O=null,V=t,J=!1;do{var oe=V.lane&-536870913;if(oe!==V.lane?(bt&oe)===oe:(bl&oe)===oe){var U=V.revertLane;if(U===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),oe===Ws&&(J=!0);else if((bl&U)===U){V=V.next,U===Ws&&(J=!0);continue}else oe={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},O===null?(C=O=oe,y=u):O=O.next=oe,Ie.lanes|=U,qo|=U;oe=V.action,bs&&a(u,oe),u=V.hasEagerState?V.eagerState:a(u,oe)}else U={lane:oe,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},O===null?(C=O=U,y=u):O=O.next=U,Ie.lanes|=oe,qo|=oe;V=V.next}while(V!==null&&V!==t);if(O===null?y=u:O.next=C,!Qn(u,e.memoizedState)&&(Un=!0,J&&(a=Mo,a!==null)))throw a;e.memoizedState=u,e.baseState=y,e.baseQueue=O,l.lastRenderedState=u}return i===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ee(e){var t=h(),a=t.queue;if(a===null)throw Error(f(311));a.lastRenderedReducer=e;var l=a.dispatch,i=a.pending,u=t.memoizedState;if(i!==null){a.pending=null;var y=i=i.next;do u=e(u,y.action),y=y.next;while(y!==i);Qn(u,t.memoizedState)||(Un=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,l]}function _e(e,t,a){var l=Ie,i=h(),u=st;if(u){if(a===void 0)throw Error(f(407));a=a()}else a=t();var y=!Qn((Rt||i).memoizedState,a);if(y&&(i.memoizedState=a,Un=!0),i=i.queue,bf(jn.bind(null,l,i,e),[e]),e=i.getSnapshot!==t||y||wn!==null&&(wn.memoizedState.tag&1)!==0,xs(e?9:8,{destroy:void 0},qt.bind(null,l,i,a,t),null),e){if(l.flags|=2048,Jt===null)throw Error(f(349));u||(bl&127)!==0||yt(l,t,a)}return a}function yt(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ie.updateQueue,t===null?(t=p(),Ie.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function qt(e,t,a,l){t.value=a,t.getSnapshot=l,On(t)&&ja(e)}function jn(e,t,a){return a(function(){On(t)&&ja(e)})}function On(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Qn(e,a)}catch{return!0}}function ja(e){var t=rs(e,2);t!==null&&Ua(t,e,2)}function vs(e){var t=c();if(typeof e=="function"){var a=e;if(e=a(),bs){Na(!0);try{a()}finally{Na(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:L,lastRenderedState:e},t}function Kl(e,t,a,l){return e.baseState=a,Ae(e,Rt,typeof l=="function"?l:L)}function Xe(e,t,a,l,i){if(Pu(e))throw Error(f(485));if(e=t.action,e!==null){var u={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){u.listeners.push(y)}};de.T!==null?a(!0):u.isTransition=!1,l(u),a=t.pending,a===null?(u.next=t.pending=u,Ft(t,u)):(u.next=a.next,t.pending=a.next=u)}}function Ft(e,t){var a=t.action,l=t.payload,i=e.state;if(t.isTransition){var u=de.T,y={};y.types=u!==null?u.types:null,de.T=y;try{var C=a(i,l),O=de.S;O!==null&&O(y,C),rt(e,t,C)}catch(V){_n(e,t,V)}finally{u!==null&&y.types!==null&&(u.types=y.types),de.T=u}}else try{u=a(i,l),rt(e,t,u)}catch(V){_n(e,t,V)}}function rt(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){ia(e,t,l)},function(l){return _n(e,t,l)}):ia(e,t,a)}function ia(e,t,a){t.status="fulfilled",t.value=a,Ho(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Ft(e,a)))}function _n(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,Ho(t),t=t.next;while(t!==l)}e.action=null}function Ho(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mt(e,t){return t}function ro(e,t){if(st){var a=Jt.formState;if(a!==null){e:{var l=Ie;if(st){if(Zt){t:{for(var i=Zt,u=tn;i.nodeType!==8;){if(!u){i=null;break t}if(i=xl(i.nextSibling),i===null){i=null;break t}}u=i.data,i=u==="F!"||u==="F"?i:null}if(i){Zt=xl(i.nextSibling),l=i.data==="F!";break e}}Ll(l)}l=!1}l&&(t=a[0])}}return a=c(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mt,lastRenderedState:t},a.queue=l,a=Gm.bind(null,Ie,l),l.dispatch=a,l=vs(!1),u=Nf.bind(null,Ie,!1,l.queue),l=c(),i={state:t,dispatch:null,action:e,pending:null},l.queue=i,a=Xe.bind(null,Ie,i,u,a),i.dispatch=a,l.memoizedState=e,[t,a,!1]}function Pa(e){var t=h();return Ti(t,Rt,e)}function Ti(e,t,a){if(t=Ae(e,t,Mt)[0],e=te(L)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=N(t)}catch(y){throw y===En?zo:y}else l=t;t=h();var i=t.queue,u=i.dispatch;return a!==t.memoizedState&&(Ie.flags|=2048,xs(9,{destroy:void 0},yf.bind(null,i,a),null)),[l,u,e]}function yf(e,t){e.action=t}function Rr(e){var t=h(),a=Rt;if(a!==null)return Ti(t,a,e);h(),t=t.memoizedState,a=h();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function xs(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=Ie.updateQueue,t===null&&(t=p(),Ie.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Zu(){return h().memoizedState}function Fu(e,t,a,l){var i=c();Ie.flags|=e,i.memoizedState=xs(1|t,{destroy:void 0},a,l===void 0?null:l)}function Qu(e,t,a,l){var i=h();l=l===void 0?null:l;var u=i.memoizedState.inst;Rt!==null&&l!==null&&yc(l,Rt.memoizedState.deps)?i.memoizedState=xs(t,u,a,l):(Ie.flags|=e,i.memoizedState=xs(1|t,u,a,l))}function Mm(e,t){Fu(8390656,8,e,t)}function bf(e,t){Qu(2048,8,e,t)}function Db(e){Ie.flags|=4;var t=Ie.updateQueue;if(t===null)t=p(),Ie.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Am(e){var t=h().memoizedState;return Db({ref:t,nextImpl:e}),function(){if((Dt&2)!==0)throw Error(f(440));return t.impl.apply(void 0,arguments)}}function zm(e,t){return Qu(4,2,e,t)}function $m(e,t){return Qu(4,4,e,t)}function Om(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rm(e,t,a){a=a!=null?a.concat([e]):null,Qu(4,4,Om.bind(null,t,e),a)}function vf(){}function Dm(e,t){var a=h();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&yc(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Bm(e,t){var a=h();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&yc(t,l[1]))return l[0];if(l=e(),bs){Na(!0);try{e()}finally{Na(!1)}}return a.memoizedState=[l,t],l}function xf(e,t,a){return a===void 0||(bl&1073741824)!==0&&(bt&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Kg(),Ie.lanes|=e,qo|=e,a)}function Hm(e,t,a,l){return Qn(a,t)?a:ps.current!==null?(e=xf(e,a,l),Qn(e,t)||(Un=!0),e):(bl&106)===0||(bl&1073741824)!==0&&(bt&261930)===0?(Un=!0,e.memoizedState=a):(e=Kg(),Ie.lanes|=e,qo|=e,t)}function Lm(e,t,a,l,i){var u=be.p;be.p=u!==0&&8>u?u:8;var y=de.T,C={};C.types=y!==null?y.types:null,de.T=C,Nf(e,!1,t,a);try{var O=i(),V=de.S;if(V!==null&&V(C,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var J=pf(O,l);Dr(e,t,J,el(e))}else Dr(e,t,l,el(e))}catch(oe){Dr(e,t,{then:function(){},status:"rejected",reason:oe},el())}finally{be.p=u,y!==null&&C.types!==null&&(y.types=C.types),de.T=y}}function Bb(){}function wf(e,t,a,l){if(e.tag!==5)throw Error(f(476));var i=_m(e).queue;Lm(e,i,t,_t,a===null?Bb:function(){return Um(e),a(l)})}function _m(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:_t,baseState:_t,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:L,lastRenderedState:_t},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:L,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Um(e){var t=_m(e);t.next===null&&(t=e.alternate.memoizedState),Dr(e,t.next.queue,{},el())}function jf(){return Bn(Uc)}function qm(){return h().memoizedState}function Vm(){return h().memoizedState}function Hb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=el();e=In(a);var l=Qa(t,e,a);l!==null&&(Ua(l,t,a),so(l,t,a)),t={cache:Sr()},e.payload=t;return}t=t.return}}function Lb(e,t,a){var l=el();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Pu(e)?Ym(t,a):(a=pr(e,t,a,l),a!==null&&(Ua(a,e,l),Xm(a,t,l)))}function Gm(e,t,a){var l=el();Dr(e,t,a,l)}function Dr(e,t,a,l){var i={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Pu(e))Ym(t,i);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var y=t.lastRenderedState,C=u(y,a);if(i.hasEagerState=!0,i.eagerState=C,Qn(C,y))return Zs(e,t,i,0),Jt===null&&ko(),!1}catch{}finally{}if(a=pr(e,t,i,l),a!==null)return Ua(a,e,l),Xm(a,t,l),!0}return!1}function Nf(e,t,a,l){if(l={lane:2,revertLane:hh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Pu(e)){if(t)throw Error(f(479))}else t=pr(e,a,l,2),t!==null&&Ua(t,e,2)}function Pu(e){var t=e.alternate;return e===Ie||t!==null&&t===Ie}function Ym(e,t){io=Si=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Xm(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,ye(e,a)}}var Ju={readContext:Bn,use:k,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn,useHostTransitionStatus:sn,useFormState:sn,useActionState:sn,useOptimistic:sn,useMemoCache:sn,useCacheRefresh:sn,useEffectEvent:sn},Km={readContext:Bn,use:k,useCallback:function(e,t){return c().memoizedState=[e,t===void 0?null:t],e},useContext:Bn,useEffect:Mm,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Fu(4194308,4,Om.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Fu(4194308,4,e,t)},useInsertionEffect:function(e,t){Fu(4,2,e,t)},useMemo:function(e,t){var a=c();t=t===void 0?null:t;var l=e();if(bs){Na(!0);try{e()}finally{Na(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=c();if(a!==void 0){var i=a(t);if(bs){Na(!0);try{a(t)}finally{Na(!1)}}}else i=t;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=Lb.bind(null,Ie,e),[l.memoizedState,e]},useRef:function(e){var t=c();return e={current:e},t.memoizedState=e},useState:function(e){e=vs(e);var t=e.queue,a=Gm.bind(null,Ie,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:vf,useDeferredValue:function(e,t){var a=c();return xf(a,e,t)},useTransition:function(){var e=vs(!1);return e=Lm.bind(null,Ie,e.queue,!0,!1),c().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=Ie,i=c();if(st){if(a===void 0)throw Error(f(407));a=a()}else{if(a=t(),Jt===null)throw Error(f(349));(bt&127)!==0||yt(l,t,a)}i.memoizedState=a;var u={value:a,getSnapshot:t};return i.queue=u,Mm(jn.bind(null,l,u,e),[e]),l.flags|=2048,xs(9,{destroy:void 0},qt.bind(null,l,u,a,t),null),a},useId:function(){var e=c(),t=Jt.identifierPrefix;if(st){var a=yl,l=Fa;a=(l&~(1<<32-cn(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ki++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Xu++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:jf,useFormState:ro,useActionState:ro,useOptimistic:function(e){var t=c();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Nf.bind(null,Ie,!0,a),a.dispatch=t,[e,t]},useMemoCache:$,useCacheRefresh:function(){return c().memoizedState=Hb.bind(null,Ie)},useEffectEvent:function(e){var t=c(),a={impl:e};return t.memoizedState=a,function(){if((Dt&2)!==0)throw Error(f(440));return a.impl.apply(void 0,arguments)}}},Zm={readContext:Bn,use:k,useCallback:Dm,useContext:Bn,useEffect:bf,useImperativeHandle:Rm,useInsertionEffect:zm,useLayoutEffect:$m,useMemo:Bm,useReducer:te,useRef:Zu,useState:function(){return te(L)},useDebugValue:vf,useDeferredValue:function(e,t){var a=h();return Hm(a,Rt.memoizedState,e,t)},useTransition:function(){var e=te(L)[0],t=h().memoizedState;return[typeof e=="boolean"?e:N(e),t]},useSyncExternalStore:_e,useId:qm,useHostTransitionStatus:jf,useFormState:Pa,useActionState:Pa,useOptimistic:function(e,t){var a=h();return Kl(a,Rt,e,t)},useMemoCache:$,useCacheRefresh:Vm,useEffectEvent:Am},_b={readContext:Bn,use:k,useCallback:Dm,useContext:Bn,useEffect:bf,useImperativeHandle:Rm,useInsertionEffect:zm,useLayoutEffect:$m,useMemo:Bm,useReducer:Ee,useRef:Zu,useState:function(){return Ee(L)},useDebugValue:vf,useDeferredValue:function(e,t){var a=h();return Rt===null?xf(a,e,t):Hm(a,Rt.memoizedState,e,t)},useTransition:function(){var e=Ee(L)[0],t=h().memoizedState;return[typeof e=="boolean"?e:N(e),t]},useSyncExternalStore:_e,useId:qm,useHostTransitionStatus:jf,useFormState:Rr,useActionState:Rr,useOptimistic:function(e,t){var a=h();return Rt!==null?Kl(a,Rt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:$,useCacheRefresh:Vm,useEffectEvent:Am};function Sf(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:le({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var kf={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=el(),i=In(l);i.payload=t,a!=null&&(i.callback=a),t=Qa(e,i,l),t!==null&&(Ua(t,e,l),so(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=el(),i=In(l);i.tag=1,i.payload=t,a!=null&&(i.callback=a),t=Qa(e,i,l),t!==null&&(Ua(t,e,l),so(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=el(),l=In(a);l.tag=2,t!=null&&(l.callback=t),t=Qa(e,l,a),t!==null&&(Ua(t,e,a),so(t,e,a))}};function Fm(e,t,a,l,i,u,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,y):t.prototype&&t.prototype.isPureReactComponent?!fi(a,l)||!fi(i,u):!0}function Qm(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&kf.enqueueReplaceState(t,t.state,null)}function Ci(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=le({},a));for(var i in e)a[i]===void 0&&(a[i]=e[i])}return a}function Pm(e){gi(e)}function Jm(e){console.error(e)}function Im(e){gi(e)}function Iu(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Wm(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function Tf(e,t,a){return a=In(a),a.tag=3,a.payload={element:null},a.callback=function(){Iu(e,t)},a}function eg(e){return e=In(e),e.tag=3,e}function tg(e,t,a,l){var i=a.type.getDerivedStateFromError;if(typeof i=="function"){var u=l.value;e.payload=function(){return i(u)},e.callback=function(){Wm(t,a,l)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Wm(t,a,l),typeof i!="function"&&(Vo===null?Vo=new Set([this]):Vo.add(this));var C=l.stack;this.componentDidCatch(l.value,{componentStack:C!==null?C:""})})}function Ub(e,t,a,l,i){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&Js(t,a,i,!0),a=Hn.current,a!==null){switch(a.tag){case 31:case 13:case 19:return oa===null?vd():a.alternate===null&&Mn===0&&(Mn=3),a.flags&=-257,a.flags|=65536,a.lanes=i,l===eo?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),uh(e,l,i)),!1;case 22:return a.flags|=65536,l===eo?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),uh(e,l,i)),!1}throw Error(f(435,a.tag))}return uh(e,l,i),vd(),!1}if(st)return t=Hn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,l!==sc&&(e=Error(f(422),{cause:l}),yi(Ca(e,a)))):(l!==sc&&(t=Error(f(423),{cause:l}),yi(Ca(t,a))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,l=Ca(l,a),i=Tf(e.stateNode,l,i),ji(e,i),Mn!==4&&(Mn=2)),!1;var u=Error(f(520),{cause:l});if(u=Ca(u,a),Gr===null?Gr=[u]:Gr.push(u),Mn!==4&&(Mn=2),t===null)return!0;l=Ca(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=i&-i,a.lanes|=e,e=Tf(a.stateNode,l,e),ji(a,e),!1;case 1:if(t=a.type,u=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Vo===null||!Vo.has(u))))return a.flags|=65536,i&=-i,a.lanes|=i,i=eg(i),tg(i,e,a,l),ji(a,i),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var Cf=Error(f(461)),Un=!1;function Kn(e,t,a,l){t.child=e===null?Oo(t,null,a,l):$o(t,e.child,a,l)}function ng(e,t,a,l,i){a=a.render;var u=t.ref;if("ref"in l){var y={};for(var C in l)C!=="ref"&&(y[C]=l[C])}else y=l;return fs(t),l=bc(e,t,a,y,u,i),C=vc(),e!==null&&!Un?(xc(e,t,i),uo(e,t,i)):(st&&C&&pi(t),t.flags|=1,Kn(e,t,l,i),t.child)}function ag(e,t,a,l,i){if(e===null){var u=a.type;return typeof u=="function"&&!ac(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,lg(e,t,u,l,i)):(e=br(a.type,null,l,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Df(e,i)){var y=u.memoizedProps;if(a=a.compare,a=a!==null?a:fi,a(y,l)&&e.ref===t.ref)return uo(e,t,i)}return t.flags|=1,e=Pn(u,l),e.ref=t.ref,e.return=t,t.child=e}function lg(e,t,a,l,i){if(e!==null){var u=e.memoizedProps;if(fi(u,l)&&e.ref===t.ref)if(Un=!1,t.pendingProps=l=u,Df(e,i))(e.flags&131072)!==0&&(Un=!0);else return t.lanes=e.lanes,uo(e,t,i)}return Ef(e,t,a,l,i)}function sg(e,t,a,l){var i=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|a:a,e!==null){for(l=t.child=e.child,i=0;l!==null;)i=i|l.lanes|l.childLanes,l=l.sibling;l=i&~u}else l=0,t.child=null;return og(e,t,u,a,l)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&kt(t,u!==null?u.cachePool:null),u!==null?Ar(t,u):hc(),zr(t);else return l=t.lanes=536870912,og(e,t,u!==null?u.baseLanes|a:a,a,l)}else u!==null?(kt(t,u.cachePool),Ar(t,u),gn(),t.memoizedState=null):(e!==null&&kt(t,null),hc(),gn());return Kn(e,t,i,a),t.child}function Br(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function og(e,t,a,l,i){var u=Cr();return u=u===null?null:{parent:Cn._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&kt(t,null),hc(),zr(t),e!==null&&Js(e,t,l,!0),t.childLanes=i,null}function Wu(e,t){return t=ed({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ig(e,t,a){return $o(t,e.child,null,a),e=Wu(t,t.pendingProps),e.flags|=2,wa(t),t.memoizedState=null,e}function qb(e,t,a){var l=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(st){if(l.mode==="hidden")return e=Wu(t,l),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Br(null,e);if(gc(t),(e=Zt)?(e=Op(e,tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Dl!==null?{id:Fa,overflow:yl}:null,retryLane:536870912,hydrationErrors:null},a=us(e),a.return=t,t.child=a,vn=t,Zt=null)):e=null,e===null)throw Ll(t);return t.lanes=536870912,null}return Wu(t,l)}var u=e.memoizedState;if(u!==null){var y=u.dehydrated;if(gc(t),i)if(t.flags&256)t.flags&=-257,t=ig(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(f(558));else if(Un||Js(e,t,a,!1),i=(a&e.childLanes)!==0,Un||i){if(ps.current===null){if(l=Jt,l!==null&&(y=ke(l,a),y!==0&&y!==u.retryLane))throw u.retryLane=y,rs(e,y),Ua(l,e,y),Cf;vd()}t=ig(e,t,a)}else e=u.treeContext,Zt=xl(y.nextSibling),vn=t,st=!0,Hl=null,tn=!1,e!==null&&_u(t,e),t=Wu(t,l),t.flags|=134221824;return t}return e=Pn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function jc(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(f(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Ef(e,t,a,l,i){return fs(t),a=bc(e,t,a,l,void 0,i),l=vc(),e!==null&&!Un?(xc(e,t,i),uo(e,t,i)):(st&&l&&pi(t),t.flags|=1,Kn(e,t,a,i),t.child)}function cg(e,t,a,l,i,u){return fs(t),t.updateQueue=null,a=Or(t,l,a,i),$r(e),l=vc(),e!==null&&!Un?(xc(e,t,u),uo(e,t,u)):(st&&l&&pi(t),t.flags|=1,Kn(e,t,a,u),t.child)}function rg(e,t,a,l,i){if(fs(t),t.stateNode===null){var u=Fs,y=a.contextType;typeof y=="object"&&y!==null&&(u=Bn(y)),u=new a(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=kf,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},dc(t),y=a.contextType,u.context=typeof y=="object"&&y!==null?Bn(y):Fs,u.state=t.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(Sf(t,a,y,l),u.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(y=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),y!==u.state&&kf.enqueueReplaceState(u,u.state,null),gs(t,l,u,i),xa(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var C=t.memoizedProps,O=Ci(a,C);u.props=O;var V=u.context,J=a.contextType;y=Fs,typeof J=="object"&&J!==null&&(y=Bn(J));var oe=a.getDerivedStateFromProps;J=typeof oe=="function"||typeof u.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,J||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(C||V!==y)&&Qm(t,u,l,y),Xl=!1;var U=t.memoizedState;u.state=U,gs(t,l,u,i),xa(),V=t.memoizedState,C||U!==V||Xl?(typeof oe=="function"&&(Sf(t,a,oe,l),V=t.memoizedState),(O=Xl||Fm(t,a,O,l,U,V,y))?(J||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=V),u.props=l,u.state=V,u.context=y,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,wi(e,t),y=t.memoizedProps,J=Ci(a,y),u.props=J,oe=t.pendingProps,U=u.context,V=a.contextType,O=Fs,typeof V=="object"&&V!==null&&(O=Bn(V)),C=a.getDerivedStateFromProps,(V=typeof C=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(y!==oe||U!==O)&&Qm(t,u,l,O),Xl=!1,U=t.memoizedState,u.state=U,gs(t,l,u,i),xa();var F=t.memoizedState;y!==oe||U!==F||Xl||e!==null&&e.dependencies!==null&&cc(e.dependencies)?(typeof C=="function"&&(Sf(t,a,C,l),F=t.memoizedState),(J=Xl||Fm(t,a,J,l,U,F,O)||e!==null&&e.dependencies!==null&&cc(e.dependencies))?(V||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,F,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,F,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=F),u.props=l,u.state=F,u.context=O,l=J):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,jc(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=$o(t,e.child,null,i),t.child=$o(t,null,a,i)):Kn(e,t,a,i),t.memoizedState=u.state,e=t.child):e=uo(e,t,i),e}function ug(e,t,a,l){return _l(),t.flags|=256,Kn(e,t,a,l),t.child}var Mf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Af(e){return{baseLanes:e,cachePool:Xn()}}function zf(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Wa),e}function dg(e,t,a){var l=t.pendingProps,i=!1,u=(t.flags&128)!==0,y;if((y=u)||(y=e!==null&&e.memoizedState===null?!1:(Ln.current&2)!==0),y&&(i=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(st){if(i?oo(t):gn(),(e=Zt)?(e=Op(e,tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Dl!==null?{id:Fa,overflow:yl}:null,retryLane:536870912,hydrationErrors:null},a=us(e),a.return=t,t.child=a,vn=t,Zt=null)):e=null,e===null)throw Ll(t);return Ah(e)?t.lanes=32:t.lanes=536870912,null}return u=l.children,l=l.fallback,i?(gn(),i=t.mode,u=ed({mode:"hidden",children:u},i),l=Ol(l,i,a,null),u.return=t,l.return=t,u.sibling=l,t.child=u,l=t.child,l.memoizedState=Af(a),l.childLanes=zf(e,y,a),t.memoizedState=Mf,Br(null,l)):(oo(t),$f(t,u))}var C=e.memoizedState;if(C!==null){var O=C.dehydrated;if(O!==null)return Vb(e,t,u,y,l,O,C,a)}return i?(gn(),i=l.fallback,u=t.mode,C=e.child,O=C.sibling,l=Pn(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&1206910976,O!==null?i=Pn(O,i):(i=Ol(i,u,a,null),i.flags|=2),i.return=t,l.return=t,l.sibling=i,t.child=l,Br(null,l),l=t.child,i=e.child.memoizedState,i===null?i=Af(a):(u=i.cachePool,u!==null?(C=Cn._currentValue,u=u.parent!==C?{parent:C,pool:C}:u):u=Xn(),i={baseLanes:i.baseLanes|a,cachePool:u}),l.memoizedState=i,l.childLanes=zf(e,y,a),t.memoizedState=Mf,Br(e.child,l)):(oo(t),a=e.child,e=a.sibling,a=Pn(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=a,t.memoizedState=null,a)}function $f(e,t){return t=ed({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ed(e,t){return e=$n(22,e,null,t),e.lanes=0,e}function td(e,t,a){return $o(t,e.child,null,a),e=$f(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vb(e,t,a,l,i,u,y,C){if(a)return t.flags&256?(oo(t),t.flags&=-257,td(e,t,C)):t.memoizedState!==null?(gn(),t.child=e.child,t.flags|=128,null):(gn(),u=i.fallback,y=t.mode,i=ed({mode:"visible",children:i.children},y),u=Ol(u,y,C,null),u.flags|=2,i.return=t,u.return=t,i.sibling=u,t.child=i,$o(t,e.child,null,C),i=t.child,i.memoizedState=Af(C),i.childLanes=zf(e,l,C),t.memoizedState=Mf,Br(null,i));if(oo(t),Ah(u)){if(l=u.nextSibling&&u.nextSibling.dataset,l)var O=l.dgst;return l=O,l!==""&&(i=Error(f(419)),i.stack="",i.digest=l,yi({value:i,source:null,stack:null})),td(e,t,C)}if(Un||Js(e,t,C,!1),l=(C&e.childLanes)!==0,Un||l){if(ps.current!==null)return td(e,t,C);if(l=Jt,l!==null&&(i=ke(l,C),i!==0&&i!==y.retryLane))throw y.retryLane=i,rs(e,i),Ua(l,e,i),Cf;return Mh(u)||vd(),td(e,t,C)}return Mh(u)?(t.flags|=192,t.child=e.child,null):(e=y.treeContext,Zt=xl(u.nextSibling),vn=t,st=!0,Hl=null,tn=!1,e!==null&&_u(t,e),t=$f(t,i.children),t.flags|=134221824,t)}function fg(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ic(e.return,t,a)}function hg(e){for(var t=null;e!==null;){var a=e.alternate;a!==null&&Ni(a)===null&&(t=e),e=e.sibling}return t}function nd(e,t,a,l,i,u){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:i,treeForkCount:u}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=l,y.tail=a,y.tailMode=i,y.treeForkCount=u)}function Of(e){var t=e.child;for(e.child=null;t!==null;){var a=t.sibling;t.sibling=e.child,e.child=t,t=a}}function Rf(e,t,a){var l=t.pendingProps,i=l.revealOrder,u=l.tail;l=l.children;var y=Ln.current;if(t.flags&128)return ys(t,y),null;var C=(y&2)!==0;if(C?(y=y&1|2,t.flags|=128):y&=1,ys(t,y),i==="backwards"&&e!==null?(Of(e),Kn(e,t,l,a),Of(e)):Kn(e,t,l,a),l=st?pl:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fg(e,a,t);else if(e.tag===19)fg(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"backwards":a=hg(t.child),a===null?(i=t.child,t.child=null):(i=a.sibling,a.sibling=null,Of(t)),nd(t,!0,i,null,u,l);break;case"unstable_legacy-backwards":for(a=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ni(e)===null){t.child=i;break}e=i.sibling,i.sibling=a,a=i,i=e}nd(t,!0,a,null,u,l);break;case"together":nd(t,!1,null,null,void 0,l);break;case"independent":t.memoizedState=null;break;default:a=hg(t.child),a===null?(i=t.child,t.child=null):(i=a.sibling,a.sibling=null),nd(t,!1,i,a,u,l)}return t.child}function mg(e,t,a){var l=t.pendingProps;return ql(t,t.type,l.value),Kn(e,t,l.children,a),t.child}function uo(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),qo|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Js(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(f(153));if(t.child!==null){for(e=t.child,a=Pn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Pn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Df(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&cc(e)))}function Gb(e,t,a){switch(t.tag){case 3:Rn(t,t.stateNode.containerInfo),ql(t,Cn,e.memoizedState.cache),_l();break;case 27:case 5:K(t);break;case 4:Rn(t,t.stateNode.containerInfo);break;case 10:ql(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,gc(t),null;break;case 13:var l=t.memoizedState;if(l!==null){if(l.dehydrated!==null)return oo(t),t.flags|=128,null;l=Js(e,t,a,!1);var i=t.child.childLanes;return l||(a&i)!==0?dg(e,t,a):(oo(t),e=uo(e,t,a),e!==null?e.sibling:null)}oo(t);break;case 19:if(t.flags&128)return Rf(e,t,a);if(i=(e.flags&128)!==0,l=(a&t.childLanes)!==0,l||(Js(e,t,a,!1),l=(a&t.childLanes)!==0),i){if(l)return Rf(e,t,a);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ys(t,Ln.current),l)break;return null;case 22:return t.lanes=0,sg(e,t,a,t.pendingProps);case 24:ql(t,Cn,e.memoizedState.cache)}return uo(e,t,a)}function gg(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Un=!0;else{if(!Df(e,a)&&(t.flags&128)===0)return Un=!1,Gb(e,t,a);Un=(e.flags&131072)!==0}else Un=!1,st&&(t.flags&1048576)!==0&&Hu(t,pl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=to(t.elementType),t.type=e,typeof e=="function")ac(e)?(l=Ci(e,l),t.tag=1,t=rg(null,t,e,l,a)):(t.tag=0,t=Ef(null,t,e,l,a));else{if(e!=null){var i=e.$$typeof;if(i===me){t.tag=11,t=ng(null,t,e,l,a);break e}else if(i===Ue){t.tag=14,t=ag(null,t,e,l,a);break e}else if(i===et){t.tag=10,t.type=e,t=mg(null,t,a);break e}}throw t=Re(e)||e,Error(f(306,t,""))}}return t;case 0:return Ef(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,i=Ci(l,t.pendingProps),rg(e,t,l,i,a);case 3:e:{if(Rn(t,t.stateNode.containerInfo),e===null)throw Error(f(387));l=t.pendingProps;var u=t.memoizedState;i=u.element,wi(e,t),gs(t,l,null,a);var y=t.memoizedState;if(l=y.cache,ql(t,Cn,l),l!==u.cache&&wr(t,[Cn],a,!0),xa(),l=y.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=ug(e,t,l,a);break e}else if(l!==i){i=Ca(Error(f(424)),t),yi(i),t=ug(e,t,l,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Zt=xl(e.firstChild),vn=t,st=!0,Hl=null,tn=!0,a=Oo(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling}else{if(_l(),l===i){t=uo(e,t,a);break e}Kn(e,t,l,a)}t=t.child}return t;case 26:return jc(e,t),e===null?(a=Up(t.type,null,t.pendingProps,null))?t.memoizedState=a:st||(t.stateNode=vp(t.type,t.pendingProps,Vn.current,t)):t.memoizedState=Up(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return K(t),e===null&&st&&(l=t.stateNode=Bp(t.type,t.pendingProps,Vn.current),vn=t,tn=!0,i=Zt,Xo(t.type)?(zh=i,Zt=xl(l.firstChild)):Zt=i),Kn(e,t,t.pendingProps.children,a),jc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&st&&((i=l=Zt)&&(l=Hv(l,t.type,t.pendingProps,tn),l!==null?(t.stateNode=l,vn=t,Zt=xl(l.firstChild),tn=!1,i=!0):i=!1),i||Ll(t)),K(t),i=t.type,u=t.pendingProps,y=e!==null?e.memoizedProps:null,l=u.children,jh(i,u)?l=null:y!==null&&jh(i,y)&&(t.flags|=32),t.memoizedState!==null&&(i=bc(e,t,Ku,null,null,a),Uc._currentValue=i),jc(e,t),Kn(e,t,l,a),t.child;case 6:return e===null&&st&&((e=a=Zt)&&(a=Lv(a,t.pendingProps,tn),a!==null?(t.stateNode=a,vn=t,Zt=null,e=!0):e=!1),e||Ll(t)),null;case 13:return dg(e,t,a);case 4:return Rn(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=$o(t,null,l,a):Kn(e,t,l,a),t.child;case 11:return ng(e,t,t.type,t.pendingProps,a);case 7:return l=t.pendingProps,jc(e,t),Kn(e,t,l,a),t.child;case 8:return Kn(e,t,t.pendingProps.children,a),t.child;case 12:return Kn(e,t,t.pendingProps.children,a),t.child;case 10:return mg(e,t,a);case 9:return i=t.type._context,l=t.pendingProps.children,fs(t),i=Bn(i),l=l(i),t.flags|=1,Kn(e,t,l,a),t.child;case 14:return ag(e,t,t.type,t.pendingProps,a);case 15:return lg(e,t,t.type,t.pendingProps,a);case 19:return Rf(e,t,a);case 31:return qb(e,t,a);case 22:return sg(e,t,a,t.pendingProps);case 24:return fs(t),l=Bn(Cn),e===null?(i=Cr(),i===null&&(i=Jt,u=Sr(),i.pooledCache=u,u.refCount++,u!==null&&(i.pooledCacheLanes|=a),i=u),t.memoizedState={parent:l,cache:i},dc(t),ql(t,Cn,i)):((e.lanes&a)!==0&&(wi(e,t),gs(t,null,null,a),xa()),i=e.memoizedState,u=t.memoizedState,i.parent!==l?(i={parent:l,cache:l},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),ql(t,Cn,l)):(l=u.cache,ql(t,Cn,l),l!==i.cache&&wr(t,[Cn],a,!0))),Kn(e,t,t.pendingProps.children,a),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),l=t.pendingProps,l.name!=null&&l.name!=="auto"?t.flags|=e===null?18882560:18874368:st&&pi(t),e!==null&&e.memoizedProps.name!==l.name?t.flags|=4194816:jc(e,t),Kn(e,t,l.children,a),t.child;case 29:throw t.pendingProps}throw Error(f(156,t.tag))}function fo(e){e.flags|=4}function Bf(e,t,a,l,i){var u;if((u=(e.mode&32)!==0)&&(u=a===null?Yp(t,l):Yp(t,l)&&(l.src!==a.src||l.srcSet!==a.srcSet)),u){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Pg())e.flags|=8192;else throw Yl=eo,Gl}else e.flags&=-16777217}function pg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xp(t))if(Pg())e.flags|=8192;else throw Yl=eo,Gl}function ad(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ht():536870912,e.lanes|=t,Cc|=t)}function Hr(e,t){if(!st)switch(e.tailMode){case"visible":break;case"collapsed":for(var a=e.tail,l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null;break;default:for(t=e.tail,a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null}}function nn(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var i=e.child;i!==null;)a|=i.lanes|i.childLanes,l|=i.subtreeFlags&1206910976,l|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)a|=i.lanes|i.childLanes,l|=i.subtreeFlags,l|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function Yb(e,t,a){var l=t.pendingProps;switch(Lu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(t),null;case 1:return nn(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Vl(Cn),D(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ps(t)?fo(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,xr())),nn(t),null;case 26:var i=t.type,u=t.memoizedState;return e===null?(fo(t),u!==null?(nn(t),pg(t,u)):(nn(t),Bf(t,i,null,l,a))):u?u!==e.memoizedState?(fo(t),nn(t),pg(t,u)):(nn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&fo(t),nn(t),Bf(t,i,e,l,a)),null;case 27:if(ae(t),a=Vn.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&fo(t);else{if(!l){if(t.stateNode===null)throw Error(f(166));return nn(t),t.subtreeFlags&=-33554433,null}e=on.current,Ps(t)?vr(t):(e=Bp(i,l,a),t.stateNode=e,fo(t))}return nn(t),t.subtreeFlags&=-33554433,null;case 5:if(ae(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&fo(t);else{if(!l){if(t.stateNode===null)throw Error(f(166));return nn(t),t.subtreeFlags&=-33554433,null}if(u=on.current,Ps(t))vr(t);else{var y=Fr(Vn.current);switch(u){case 1:u=y.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:u=y.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":u=y.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":u=y.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":u=y.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?y.createElement("select",{is:l.is}):y.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?y.createElement(i,{is:l.is}):y.createElement(i)}}u[it]=t,u[yn]=l;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)u.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=u;e:switch(ra(u,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&fo(t)}}return nn(t),t.subtreeFlags&=-33554433,Bf(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&fo(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(f(166));if(e=Vn.current,Ps(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,i=vn,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[it]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||gp(e.nodeValue,a)),e||Ll(t,!0)}else e=Fr(e).createTextNode(l),e[it]=t,t.stateNode=e}return nn(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=Ps(t),a!==null){if(e===null){if(!l)throw Error(f(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(557));e[it]=t}else _l(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nn(t),e=!1}else a=xr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(wa(t),t):(wa(t),null);if((t.flags&128)!==0)throw Error(f(558))}return nn(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ps(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(f(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(f(317));i[it]=t}else _l(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nn(t),i=!1}else i=xr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(wa(t),t):(wa(t),null)}return wa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==i&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),ad(t,t.updateQueue),nn(t),null);case 4:return D(),e===null&&yh(t.stateNode.containerInfo),t.flags|=67108864,nn(t),null;case 10:return Vl(t.type),nn(t),null;case 19:if(pc(t),l=t.memoizedState,l===null)return nn(t),null;if(i=(t.flags&128)!==0,u=l.rendering,u===null)if(i)Hr(l,!1);else{if(Mn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Ni(e),u!==null){for(t.flags|=128,Hr(l,!1),e=u.updateQueue,t.updateQueue=e,ad(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)ml(a,e),a=a.sibling;return ys(t,Ln.current&1|2),st&&Bl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&tt()>gd&&(t.flags|=128,i=!0,Hr(l,!1),t.lanes=4194304)}else{if(!i)if(e=Ni(u),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,ad(t,e),Hr(l,!0),l.tail===null&&l.tailMode!=="collapsed"&&l.tailMode!=="visible"&&!u.alternate&&!st)return nn(t),null}else 2*tt()-l.renderingStartTime>gd&&a!==536870912&&(t.flags|=128,i=!0,Hr(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}if(l.tail!==null){e=l.tail;e:{for(a=e;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return l.rendering=e,l.tail=e.sibling,l.renderingStartTime=tt(),e.sibling=null,u=Ln.current,u=i?u&1|2:u&1,l.tailMode==="visible"||l.tailMode==="collapsed"||!a||st?ys(t,u):(a=u,Ge(Hn,t),Ge(Ln,a),oa===null&&(oa=t)),st&&Bl(t,l.treeForkCount),e}return nn(t),null;case 22:case 23:return wa(t),mc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(nn(t),t.subtreeFlags&6&&(t.flags|=8192)):nn(t),a=t.updateQueue,a!==null&&ad(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&at(hs),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Vl(Cn),nn(t),null;case 25:return null;case 30:return t.flags|=33554432,nn(t),null}throw Error(f(156,t.tag))}function Xb(e,t){switch(Lu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vl(Cn),D(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ae(t),null;case 31:if(t.memoizedState!==null){if(wa(t),t.alternate===null)throw Error(f(340));_l()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(wa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(f(340));_l()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pc(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return D(),null;case 10:return Vl(t.type),null;case 22:case 23:return wa(t),mc(),e!==null&&at(hs),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vl(Cn),null;case 25:return null;default:return null}}function yg(e,t){switch(Lu(t),t.tag){case 3:Vl(Cn),D();break;case 26:case 27:case 5:ae(t);break;case 4:D();break;case 31:t.memoizedState!==null&&wa(t);break;case 13:wa(t);break;case 19:pc(t);break;case 10:Vl(t.type);break;case 22:case 23:wa(t),mc(),e!==null&&at(hs);break;case 24:Vl(Cn)}}function Lr(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var i=l.next;a=i;do{if((a.tag&e)===e){l=void 0;var u=a.create,y=a.inst;l=u(),y.destroy=l}a=a.next}while(a!==i)}}catch(C){Gt(t,t.return,C)}}function Lo(e,t,a){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var u=i.next;l=u;do{if((l.tag&e)===e){var y=l.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,i=t;var O=a,V=C;try{V()}catch(J){Gt(i,O,J)}}}l=l.next}while(l!==u)}}catch(J){Gt(t,t.return,J)}}function bg(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Yu(t,a)}catch(l){Gt(e,e.return,l)}}}function vg(e,t,a){a.props=Ci(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Gt(e,t,l)}}function ws(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:var i=e.stateNode,u=Ba(e.memoizedProps,i);(i.ref===null||i.ref.name!==u)&&(i.ref=Tp(u)),l=i.ref;break;case 7:if(e.stateNode===null){var y=new tl(e);w(e.child,!1,Dv,y,void 0,void 0),e.stateNode=y}l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(C){Gt(e,t,C)}}function ca(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(i){Gt(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Gt(e,t,i)}else a.current=null}function ld(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var a=0;a<t.length;a++)$p(e.stateNode,t[a])}function xg(e){for(var t=e.return;t!==null&&(Lf(t)&&$p(e.stateNode,t.stateNode),!Hf(t));)t=t.return}function _r(e){for(var t=e.return;t!==null&&(Lf(t)&&Bv(e.stateNode,t.stateNode),!Hf(t));)t=t.return}function Hf(e){return e.tag===5||e.tag===3||e.tag===27}function Lf(e){return e&&e.tag===7&&e.stateNode!==null}function _f(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(i){Gt(e,e.return,i)}}function Uf(e,t,a){try{var l=e.stateNode;yv(l,e.type,a,t),l[yn]=t}catch(i){Gt(e,e.return,i)}}function wg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Xo(e.type)||e.tag===4}function qf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wg(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.tag===27&&Xo(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Vf(e,t,a,l){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(i),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=dn)),ld(e,l),Ye=!0;else if(i!==4&&(i===27&&(ld(e,l),l=null,Xo(e.type)&&(a=e.stateNode,t=null)),e=e.child,e!==null))for(Vf(e,t,a,l),e=e.sibling;e!==null;)Vf(e,t,a,l),e=e.sibling}function sd(e,t,a,l){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?a.insertBefore(i,t):a.appendChild(i),ld(e,l),Ye=!0;else if(i!==4&&(i===27&&(ld(e,l),l=null,Xo(e.type)&&(a=e.stateNode)),e=e.child,e!==null))for(sd(e,t,a,l),e=e.sibling;e!==null;)sd(e,t,a,l),e=e.sibling}function jg(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ra(t,l,a),t[it]=e,t[yn]=a}catch(u){Gt(e,e.return,u)}}var od=!1,Ja=null;function Ng(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(od=!0)}var js=null;function Sg(){var e=js;return js=null,e}var Ha=0;function Nc(e,t,a,l,i){return Ha=0,kg(e.child,t,a,l,i)}function kg(e,t,a,l,i){for(var u=!1;e!==null;){if(e.tag===5){var y=e.stateNode;if(l!==null){var C=kh(y);l.push(C),C.view&&(u=!0)}else u||kh(y).view&&(u=!0);od=!0,Sp(y,Ha===0?t:t+"_"+Ha,a),Ha++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||kg(e.child,t,a,l,i)&&(u=!0));e=e.sibling}return u}function Ns(e,t){for(;e!==null;)e.tag===5?kp(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Ns(e.child,t)),e=e.sibling}function id(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(id(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(f(544));var a=t.name;t=$l(t.default,t.share),t!=="none"&&(Nc(e,a,t,null,!1)||Ns(e.child,!1))}e=e.sibling}}function Gf(e,t){if(e.tag===30){var a=e.stateNode,l=e.memoizedProps,i=Ba(l,a),u=$l(l.default,a.paired?l.share:l.enter);u!=="none"?Nc(e,i,u,null,!1)?(id(e),a.paired||t||zc(e,l.onEnter)):Ns(e.child,!1):id(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Gf(e,t),e=e.sibling;else id(e)}function Yf(e){if(Ja!==null&&Ja.size!==0){var t=Ja;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var a=e.memoizedProps,l=a.name;if(l!=null&&l!=="auto"){var i=t.get(l);if(i!==void 0){var u=$l(a.default,a.share);if(u!=="none"&&(Nc(e,l,u,null,!1)?(u=e.stateNode,i.paired=u,u.paired=i,zc(e,a.onShare)):Ns(e.child,!1)),t.delete(l),t.size===0)break}}}Yf(e)}e=e.sibling}}}function Xf(e){if(e.tag===30){var t=e.memoizedProps,a=Ba(t,e.stateNode),l=Ja!==null?Ja.get(a):void 0,i=$l(t.default,l!==void 0?t.share:t.exit);i!=="none"&&(Nc(e,a,i,null,!1)?l!==void 0?(i=e.stateNode,l.paired=i,i.paired=l,Ja.delete(a),zc(e,t.onShare)):zc(e,t.onExit):Ns(e.child,!1)),Ja!==null&&Yf(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Xf(e),e=e.sibling;else Ja!==null&&Yf(e)}function Tg(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,a=Ba(t,e.stateNode);t=$l(t.default,t.update),e.flags&=-5,t!=="none"&&Nc(e,a,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Tg(e);e=e.sibling}}function Kf(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Ns(e.child,!1))}Kf(e)}e=e.sibling}}function cd(e){if(e.tag===30)e.stateNode.paired=null,Ns(e.child,!1),Kf(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)cd(e),e=e.sibling;else Kf(e)}function Cg(e){for(e=e.child;e!==null;)e.tag===30?Ns(e.child,!1):(e.subtreeFlags&33554432)!==0&&Cg(e),e=e.sibling}function Zf(e,t,a,l,i,u,y){for(var C=!1;t!==null;){if(t.tag===5){var O=t.stateNode;if(u!==null&&Ha<u.length){var V=u[Ha],J=kh(O);(V.view||J.view)&&(C=!0);var oe;if(oe=(e.flags&4)===0)if(J.clip)oe=!0;else{oe=V.rect;var U=J.rect;oe=oe.y!==U.y||oe.x!==U.x||oe.height!==U.height||oe.width!==U.width}oe&&(e.flags|=4),J.abs?J=!V.abs:(V=V.rect,J=J.rect,J=V.height!==J.height||V.width!==J.width),J&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Sp(O,Ha===0?a:a+"_"+Ha,i),C&&(e.flags&4)!==0||(js===null&&(js=[]),js.push(O,Ha===0?l:l+"_"+Ha,t.memoizedProps)),Ha++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&y?e.flags|=t.flags&32:Zf(e,t.child,a,l,i,u,y)&&(C=!0));t=t.sibling}return C}function Eg(e,t){for(e=e.child;e!==null;){if(e.tag===30){var a=e.memoizedProps,l=e.stateNode,i=Ba(a,l),u=$l(a.default,a.update),y;y=e.memoizedState,e.memoizedState=null,l=e;var C=e.child;Ha=0,i=Zf(l,C,i,i,u,y,!1),(e.flags&4)!==0&&i&&zc(e,a.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Eg(e);e=e.sibling}}var Wn=!1,Lt=!1,Ss=!1,Ff=!1,Mg=typeof WeakSet=="function"?WeakSet:Set,ea=null,ks=!1,Ur=!1,rd=!1,Qf=!1;function Kb(e,t,a){if(e=e.containerInfo,xh=qc,e=cr(e),Ii(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var u=i.anchorOffset,y=i.focusNode;i=i.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var C=0,O=-1,V=-1,J=0,oe=0,U=e,F=null;t:for(;;){for(var Se;U!==l||u!==0&&U.nodeType!==3||(O=C+u),U!==y||i!==0&&U.nodeType!==3||(V=C+i),U.nodeType===3&&(C+=U.nodeValue.length),(Se=U.firstChild)!==null;)F=U,U=Se;for(;;){if(U===e)break t;if(F===l&&++J===u&&(O=C),F===y&&++oe===i&&(V=C),(Se=U.nextSibling)!==null)break;U=F,F=U.parentNode}U=Se}l=O===-1||V===-1?null:{start:O,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(wh={focusedElem:e,selectionRange:l},qc=!1,a=(a&335544064)===a,ea=t,t=a?9270:1024;ea!==null;){if(e=ea,a&&(l=e.deletions,l!==null))for(u=0;u<l.length;u++)a&&Xf(l[u]);if(e.alternate===null&&(e.flags&2)!==0)a&&Ng(e),ud(a);else{if(e.tag===22){if(l=e.alternate,e.memoizedState!==null){l!==null&&l.memoizedState===null&&a&&Xf(l),ud(a);continue}else if(l!==null&&l.memoizedState!==null){a&&Ng(e),ud(a);continue}}l=e.child,(e.subtreeFlags&t)!==0&&l!==null?(l.return=e,ea=l):(a&&Tg(e),ud(a))}}Ja=null}function ud(e){for(;ea!==null;){var t=ea,a=e,l=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((i&1024)!==0&&l!==null){a=void 0,i=l.memoizedProps,l=l.memoizedState;var u=t.stateNode;try{var y=Ci(t.type,i);a=u.getSnapshotBeforeUpdate(y,l),u.__reactInternalSnapshotBeforeUpdate=a}catch(C){Gt(t,t.return,C)}}break;case 3:if((i&1024)!==0){if(l=t.stateNode.containerInfo,a=l.nodeType,a===9)Eh(l);else if(a===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":Eh(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&l!==null&&(a=Ba(l.memoizedProps,l.stateNode),i=t.memoizedProps,i=$l(i.default,i.update),i!=="none"&&Nc(l,a,i,l.memoizedState=[],!0));break;default:if((i&1024)!==0)throw Error(f(163))}if(l=t.sibling,l!==null){l.return=t.return,ea=l;break}ea=t.return}}function Ag(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ts(e,a),l&4&&Lr(5,a);break;case 1:if(Ts(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(y){Gt(a,a.return,y)}else{var i=Ci(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Gt(a,a.return,y)}}l&64&&bg(a),l&512&&ws(a,a.return);break;case 3:if(Ts(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Yu(e,t)}catch(y){Gt(a,a.return,y)}}break;case 27:t===null&&l&4&&jg(a);case 26:case 5:Ts(e,a),t===null&&l&4&&_f(a),l&512&&ws(a,a.return);break;case 12:Ts(e,a);break;case 31:Ts(e,a),l&4&&Rg(e,a);break;case 13:Ts(e,a),l&4&&Dg(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=lv.bind(null,a),_v(e,a))));break;case 22:if(l=a.memoizedState!==null||Wn,!l){var u=t!==null&&t.memoizedState!==null||Lt;t=Wn,i=Lt,Wn=l,(Lt=u)&&!i?(l=2,(a.subtreeFlags&8772)!==0&&(l|=1),Ql(e,a,l)):Ts(e,a),Wn=t,Lt=i}break;case 30:Ts(e,a),l&512&&ws(a,a.return);break;case 7:l&512&&ws(a,a.return);default:Ts(e,a)}}function Pf(e,t){for(e=e.child;e!==null;)zg(e,t),e=e.sibling}function zg(e,t){switch(e.tag){case 5:case 26:try{var a=e.stateNode;if(t){var l=a.style;typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"}else{var i=e.stateNode,u=e.memoizedProps.style,y=u!=null&&u.hasOwnProperty("display")?u.display:null;i.style.display=y==null||typeof y=="boolean"?"":(""+y).trim()}}catch(O){Gt(e,e.return,O)}Jf(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,Ye=!0}catch(O){Gt(e,e.return,O)}break;case 18:try{var C=e.stateNode;t?Np(C,!0):Np(e.stateNode,!1)}catch(O){Gt(e,e.return,O)}break;case 22:case 23:e.memoizedState===null&&Pf(e,t);break;default:Pf(e,t)}}function Jf(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var a=e,l=t;switch(a.tag){case 4:zg(a,l);break e;case 22:a.memoizedState===null&&Jf(a,l);break e;default:Jf(a,l)}}e=e.sibling}}function $g(e){var t=e.alternate;t!==null&&(e.alternate=null,$g(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Hi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var pn=null,La=!1;function Zl(e,t,a){for(a=a.child;a!==null;)Og(e,t,a),a=a.sibling}function Og(e,t,a){if(ta&&typeof ta.onCommitFiberUnmount=="function")try{ta.onCommitFiberUnmount(ol,a)}catch{}switch(a.tag){case 26:Lt||ca(a,t),Zl(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Lt&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Lt||ca(a,t),_r(a);var l=pn,i=La;Xo(a.type)&&(pn=a.stateNode,La=!1),Zl(e,t,a),Hp(a.stateNode,a.type,a.memoizedProps),pn=l,La=i;break;case 5:Lt||ca(a,t),_r(a);case 6:if(a.tag===6&&_r(a),l=pn,i=La,pn=null,Zl(e,t,a),pn=l,La=i,pn!==null)if(La)try{(pn.nodeType===9?pn.body:pn.nodeName==="HTML"?pn.ownerDocument.body:pn).removeChild(a.stateNode),Ye=!0}catch(u){Gt(a,t,u)}else try{pn.removeChild(a.stateNode),Ye=!0}catch(u){Gt(a,t,u)}break;case 18:pn!==null&&(La?(e=pn,jp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Vc(e)):jp(pn,a.stateNode));break;case 4:l=pn,i=La,pn=a.stateNode.containerInfo,La=!0,Zl(e,t,a),pn=l,La=i;break;case 0:case 11:case 14:case 15:Lo(2,a,t),Lt||Lo(4,a,t),Zl(e,t,a);break;case 1:Lt||(ca(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&vg(a,t,l)),Zl(e,t,a);break;case 21:Zl(e,t,a);break;case 22:Lt=(l=Lt)||a.memoizedState!==null,Zl(e,t,a),Lt=l;break;case 30:ca(a,t),Zl(e,t,a);break;case 7:Lt||ca(a,t),Zl(e,t,a);break;default:Zl(e,t,a)}}function Rg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vc(e)}catch(a){Gt(t,t.return,a)}}}function Dg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vc(e)}catch(a){Gt(t,t.return,a)}}function Zb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Mg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Mg),t;default:throw Error(f(435,e.tag))}}function dd(e,t){var a=Zb(e);t.forEach(function(l){if(!a.has(l)){a.add(l);var i=sv.bind(null,e,l);l.then(i,i)}})}function Ea(e,t,a){var l=t.deletions;if(l!==null)for(var i=0;i<l.length;i++){var u=l[i],y=e,C=t,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(Xo(O.type)){pn=O.stateNode,La=!1;break e}break;case 5:pn=O.stateNode,La=!1;break e;case 3:case 4:pn=O.stateNode.containerInfo,La=!0;break e}O=O.return}if(pn===null)throw Error(f(160));Og(y,C,u),pn=null,La=!1,y=u.alternate,y!==null&&(y.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Bg(t,e,a),t=t.sibling}var Fl=null;function Bg(e,t,a){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(l=e.updateQueue,l=l!==null?l.events:null,l!==null))for(var u=0;u<l.length;u++){var y=l[u];y.ref.impl=y.nextImpl}Ea(t,e,a),Ma(e),i&4&&(Lo(3,e,e.return),Lr(3,e),Lo(5,e,e.return));break;case 1:Ea(t,e,a),Ma(e),i&512&&(Lt||l===null||ca(l,l.return)),i&64&&Wn&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?t:a.concat(t))));break;case 26:if(u=Fl,Ea(t,e,a),Ma(e),i&512&&(Lt||l===null||ca(l,l.return)),i&4)if(i=l!==null?l.memoizedState:null,a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null)if(Wn)e.stateNode=vp(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,a=e.memoizedProps,i=u.ownerDocument||u;t:switch(t){case"title":l=i.getElementsByTagName("title")[0],(!l||l[ni]||l[it]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=i.createElement(t),i.head.insertBefore(l,i.querySelector("head > title"))),ra(l,t,a),l[it]=e,zn(l),t=l;break e;case"link":if(u=Gp("link","href",i).get(t+(a.href||""))){for(y=0;y<u.length;y++)if(l=u[y],l.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&l.getAttribute("rel")===(a.rel==null?null:a.rel)&&l.getAttribute("title")===(a.title==null?null:a.title)&&l.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){u.splice(y,1);break t}}l=i.createElement(t),ra(l,t,a),i.head.appendChild(l);break;case"meta":if(u=Gp("meta","content",i).get(t+(a.content||""))){for(y=0;y<u.length;y++)if(l=u[y],l.getAttribute("content")===(a.content==null?null:""+a.content)&&l.getAttribute("name")===(a.name==null?null:a.name)&&l.getAttribute("property")===(a.property==null?null:a.property)&&l.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&l.getAttribute("charset")===(a.charSet==null?null:a.charSet)){u.splice(y,1);break t}}l=i.createElement(t),ra(l,t,a),i.head.appendChild(l);break;default:throw Error(f(468,t))}l[it]=e,zn(l),t=l}e.stateNode=t}else Wn||Dh(u,e.type,e.stateNode);else e.stateNode=Vp(u,a,e.memoizedProps);else i!==a?(i===null?(t=l.stateNode,t===null||Lt||t.parentNode.removeChild(t)):i.count--,a===null?Wn||Dh(u,e.type,e.stateNode):Vp(u,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Uf(e,e.memoizedProps,l.memoizedProps);break;case 27:Ea(t,e,a),Ma(e),i&512&&(Lt||l===null||ca(l,l.return)),l!==null&&i&4&&Uf(e,e.memoizedProps,l.memoizedProps);break;case 5:if(u=Ss,Ss=!1,Ea(t,e,a),Ss=u,Ma(e),i&512&&(Lt||l===null||ca(l,l.return)),e.flags&32){t=e.stateNode;try{Ga(t,""),Ye=!0}catch(J){Gt(e,e.return,J)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,Uf(e,t,l!==null?l.memoizedProps:t)),i&1024&&(Ff=!0);break;case 6:if(Ea(t,e,a),Ma(e),i&4){if(e.stateNode===null)throw Error(f(162));t=e.memoizedProps,a=e.stateNode;try{a.nodeValue=t,Ye=!0}catch(J){Gt(e,e.return,J)}}break;case 3:if(Ye=!1,Td=null,u=Fl,Fl=Qr(t.containerInfo),Ea(t,e,a),Fl=u,Ma(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Vc(t.containerInfo)}catch(J){Gt(e,e.return,J)}Ff&&(Ff=!1,Hg(e)),Ye=!1;break;case 4:i=Ss,Ss=Wn,l=Nl(),u=Fl,Fl=Qr(e.stateNode.containerInfo),Ea(t,e,a),Ma(e),Fl=u,Ye&&Ur&&(rd=!0),Ye=l,Ss=i;break;case 12:Ea(t,e,a),Ma(e);break;case 31:Ea(t,e,a),Ma(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,dd(e,t)));break;case 13:Ea(t,e,a),Ma(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(md=tt()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,dd(e,t)));break;case 22:u=e.memoizedState!==null,y=l!==null&&l.memoizedState!==null;var C=Wn,O=Lt,V=Ss;Wn=C||u,Ss=V||u,Lt=O||y,Ea(t,e,a),Lt=O,Ss=V,Wn=C,Ma(e),i&8192&&(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,!u||l===null||y||Wn||Lt||(t=y||Lt,a=Wn,l=Lt,Wn=u||Wn,Lt=t,_o(e,2),Wn=a,Lt=l),!u&&Ss||Pf(e,u)),i&4&&(t=e.updateQueue,t!==null&&(a=t.retryQueue,a!==null&&(t.retryQueue=null,dd(e,a))));break;case 19:Ea(t,e,a),Ma(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,dd(e,t)));break;case 30:i&512&&(Lt||l===null||ca(l,l.return)),i=Nl(),u=Ur,y=(a&335544064)===a,C=e.memoizedProps,Ur=y&&$l(C.default,C.update)!=="none",Ea(t,e,a),Ma(e),y&&l!==null&&Ye&&(e.flags|=4),Ur=u,Ye=i;break;case 21:break;case 7:i&512&&(Lt||l===null||ca(l,l.return)),l&&l.stateNode!==null&&(l.stateNode._fragmentFiber=e);default:Ea(t,e,a),Ma(e)}}function Ma(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(wg(l)){a=l;break}l=l.return}l=null;for(var i=e.return;i!==null;){if(Lf(i)){var u=i.stateNode;l===null?l=[u]:l.push(u)}if(Hf(i))break;i=i.return}var y=l;if(a==null)throw Error(f(160));switch(a.tag){case 27:var C=a.stateNode,O=qf(e);sd(e,O,C,y);break;case 5:var V=a.stateNode;a.flags&32&&(Ga(V,""),a.flags&=-33);var J=qf(e);sd(e,J,V,y);break;case 3:case 4:var oe=a.stateNode.containerInfo,U=qf(e);Vf(e,U,oe,y);break;default:throw Error(f(161))}}catch(F){Gt(e,e.return,F)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Hg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Hg(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,qc=!0,t.reset(),qc=!1),e=e.sibling}}function Sc(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Lg(t,e),t=t.sibling;else Eg(t)}function Lg(e,t){var a=e.alternate;if(a===null)Gf(e,!1);else switch(e.tag){case 3:if(Qf=ks=!1,Sg(),Sc(t,e),!ks&&!rd){if(e=js,e!==null)for(var l=0;l<e.length;l+=3){a=e[l];var i=e[l+1];kp(a,e[l+2]),a=a.ownerDocument.documentElement,a!==null&&a.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+i+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Qf=!0}js=null;break;case 5:Sc(t,e);break;case 4:l=ks,ks=!1,Sc(t,e),ks&&(rd=!0),ks=l;break;case 22:e.memoizedState===null&&(a.memoizedState!==null?Gf(e,!1):Sc(t,e));break;case 30:l=ks,i=Sg(),ks=!1,Sc(t,e),ks&&(e.flags|=4);var u=e.memoizedProps,y=e.stateNode;t=Ba(u,y),y=Ba(a.memoizedProps,y);var C=$l(u.default,u.update);C==="none"?t=!1:(u=a.memoizedState,a.memoizedState=null,a=e.child,Ha=0,t=Zf(e,a,t,y,C,u,!0),Ha!==(u===null?0:u.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(zc(e,e.memoizedProps.onUpdate),js=i):i!==null&&(i.push.apply(i,js),js=i),ks=(e.flags&32)!==0?!0:l;break;default:Sc(t,e)}}function Ts(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ag(e,t.alternate,t),t=t.sibling}function _o(e,t){for(e=e.child;e!==null;){var a=e,l=t;switch(a.tag){case 0:case 11:case 14:case 15:Lo(4,a,a.return),_o(a,l);break;case 1:ca(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&vg(a,a.return,i),_o(a,l);break;case 27:(l&2)!==0&&Hp(a.stateNode,a.type,a.memoizedProps);case 5:ca(a,a.return),a.tag!==5&&a.tag!==27||_r(a),_o(a,l);break;case 6:_r(a);break;case 26:ca(a,a.return),i=a.stateNode,a.memoizedState!==null||i===null||Lt||i.parentNode.removeChild(i),_o(a,l);break;case 22:a.memoizedState===null&&_o(a,l);break;case 30:ca(a,a.return),_o(a,l);break;case 7:ca(a,a.return);default:_o(a,l)}e=e.sibling}}function Ql(e,t,a){for(a=(t.subtreeFlags&8772)!==0?a:a&-2,t=t.child;t!==null;){var l=t.alternate,i=e,u=t,y=u.flags,C=(a&1)!==0;switch(u.tag){case 0:case 11:case 15:Ql(i,u,a),Lr(4,u);break;case 1:if(Ql(i,u,a),l=u,i=l.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(J){Gt(l,l.return,J)}if(l=u,i=l.updateQueue,i!==null){var O=l.stateNode;try{var V=i.shared.hiddenCallbacks;if(V!==null)for(i.shared.hiddenCallbacks=null,i=0;i<V.length;i++)fc(V[i],O)}catch(J){Gt(l,l.return,J)}}C&&y&64&&bg(u),ws(u,u.return);break;case 27:(a&2)!==0&&jg(u);case 5:u.tag!==5&&u.tag!==27||xg(u),Ql(i,u,a),C&&l===null&&y&4&&_f(u),ws(u,u.return);break;case 6:xg(u);break;case 26:O=u.stateNode,u.memoizedState!==null||O===null||Wn||Dh(Qr(O.ownerDocument),u.type,O),Ql(i,u,a),C&&l===null&&y&4&&_f(u),ws(u,u.return);break;case 12:Ql(i,u,a);break;case 31:Ql(i,u,a),C&&y&4&&Rg(i,u);break;case 13:Ql(i,u,a),C&&y&4&&Dg(i,u);break;case 22:u.memoizedState===null&&Ql(i,u,a),ws(u,u.return);break;case 30:Ql(i,u,a),ws(u,u.return);break;case 7:ws(u,u.return);default:Ql(i,u,a)}t=t.sibling}}function If(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Co(a))}function Wf(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Co(e))}function vl(e,t,a,l){var i=(a&335544064)===a;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)_g(e,t,a,l),t=t.sibling;else i&&Cg(t)}function _g(e,t,a,l){var i=(a&335544064)===a;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&cd(t);var u=t.flags;switch(t.tag){case 0:case 11:case 15:vl(e,t,a,l),u&2048&&Lr(9,t);break;case 1:vl(e,t,a,l);break;case 3:vl(e,t,a,l),i&&Qf&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),u&2048&&(u=null,t.alternate!==null&&(u=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==u&&(t.refCount++,u!=null&&Co(u)));break;case 12:if(u&2048){vl(e,t,a,l),u=t.stateNode;try{var y=t.memoizedProps,C=y.id,O=y.onPostCommit;typeof O=="function"&&O(C,t.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(V){Gt(t,t.return,V)}}else vl(e,t,a,l);break;case 31:vl(e,t,a,l);break;case 13:vl(e,t,a,l);break;case 23:break;case 22:y=t.stateNode,C=t.alternate,t.memoizedState!==null?(i&&C!==null&&C.memoizedState===null&&cd(C),y._visibility&2?vl(e,t,a,l):qr(e,t)):(i&&C!==null&&C.memoizedState!==null&&cd(t),y._visibility&2?vl(e,t,a,l):(y._visibility|=2,kc(e,t,a,l,(t.subtreeFlags&10256)!==0||!1))),u&2048&&If(C,t);break;case 24:vl(e,t,a,l),u&2048&&Wf(t.alternate,t);break;case 30:i&&(u=t.alternate,u!==null&&(Ns(u.child,!0),Ns(t.child,!0))),vl(e,t,a,l);break;default:vl(e,t,a,l)}}function kc(e,t,a,l,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,y=t,C=a,O=l,V=y.flags;switch(y.tag){case 0:case 11:case 15:kc(u,y,C,O,i),Lr(8,y);break;case 23:break;case 22:var J=y.stateNode;y.memoizedState!==null?J._visibility&2?kc(u,y,C,O,i):qr(u,y):(J._visibility|=2,kc(u,y,C,O,i)),i&&V&2048&&If(y.alternate,y);break;case 24:kc(u,y,C,O,i),i&&V&2048&&Wf(y.alternate,y);break;default:kc(u,y,C,O,i)}t=t.sibling}}function qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,i=l.flags;switch(l.tag){case 22:qr(a,l),i&2048&&If(l.alternate,l);break;case 24:qr(a,l),i&2048&&Wf(l.alternate,l);break;default:qr(a,l)}t=t.sibling}}var Ei=8192;function Mi(e,t,a){if(e.subtreeFlags&Ei)for(e=e.child;e!==null;)Ug(e,t,a),e=e.sibling}function Ug(e,t,a){switch(e.tag){case 26:Mi(e,t,a),e.flags&Ei&&(e.memoizedState!==null?Wv(a,Fl,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&Zp(a,e)));break;case 5:Mi(e,t,a),e.flags&Ei&&(e=e.stateNode,(t&335544128)===t&&Zp(a,e));break;case 3:case 4:var l=Fl;Fl=Qr(e.stateNode.containerInfo),Mi(e,t,a),Fl=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ei,Ei=16777216,Mi(e,t,a),Ei=l):Mi(e,t,a));break;case 30:if((e.flags&Ei)!==0&&(l=e.memoizedProps.name,l!=null&&l!=="auto")){var i=e.stateNode;i.paired=null,Ja===null&&(Ja=new Map),Ja.set(l,i)}Mi(e,t,a);break;default:Mi(e,t,a)}}function qg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Vr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];ea=l,Gg(l,e)}qg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vg(e),e=e.sibling}function Vg(e){switch(e.tag){case 0:case 11:case 15:Vr(e),e.flags&2048&&Lo(9,e,e.return);break;case 3:Vr(e);break;case 12:Vr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,fd(e)):Vr(e);break;default:Vr(e)}}function fd(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];ea=l,Gg(l,e)}qg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Lo(8,t,t.return),fd(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,fd(t));break;default:fd(t)}e=e.sibling}}function Gg(e,t){for(;ea!==null;){var a=ea;switch(a.tag){case 0:case 11:case 15:Lo(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Co(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,ea=l;else e:for(a=e;ea!==null;){l=ea;var i=l.sibling,u=l.return;if($g(l),l===a){ea=null;break e}if(i!==null){i.return=u,ea=i;break e}ea=u}}}var Fb={getCacheForType:function(e){var t=Bn(Cn),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Bn(Cn).controller.signal}},Qb=typeof WeakMap=="function"?WeakMap:Map,Dt=0,Jt=null,mt=null,bt=0,Vt=0,Ia=null,Uo=!1,Tc=!1,eh=!1,ho=0,Mn=0,qo=0,Ai=0,hd=0,Wa=0,Cc=0,Gr=null,_a=null,th=!1,md=0,Yg=0,gd=1/0,pd=null,Vo=null,Nn=0,Pl=null,zi=null,Cs=0,nh=0,ah=null,Xg=null,Ec=null,Mc=null,Ac=null,Yr=0,yd=null;function el(){return(Dt&2)!==0&&bt!==0?bt&-bt:de.T!==null?hh():rn()}function Kg(){if(Wa===0)if((bt&536870912)===0||st){var e=Va;Va<<=1,(Va&3932160)===0&&(Va=262144),Wa=e}else Wa=536870912;return e=Hn.current,e!==null&&(e.flags|=32),Wa}function zc(e,t){if(t!=null){var a=e.stateNode,l=a.ref;l===null&&(l=a.ref=Tp(Ba(e.memoizedProps,a))),Mc===null&&(Mc=[]),Mc.push(t.bind(null,l))}}function Ua(e,t,a){(e===Jt&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)&&($c(e,0),Go(e,bt,Wa,!1)),A(e,a),((Dt&2)===0||e!==Jt)&&(e===Jt&&((Dt&2)===0&&(Ai|=a),Mn===4&&Go(e,bt,Wa,!1)),Es(e))}function Zg(e,t,a){if((Dt&6)!==0)throw Error(f(327));var l=!a&&(t&127)===0&&(t&e.expiredLanes)===0||jt(e,t),i=l?Ib(e,t):sh(e,t,!0),u=l;do{if(i===0){Tc&&!l&&Go(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!Pb(a)){i=sh(e,t,!1),u=!1;continue}if(i===2){if(u=t,e.errorRecoveryDisabledLanes&u)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var C=e;i=Gr;var O=C.current.memoizedState.isDehydrated;if(O&&($c(C,y).flags|=256),y=sh(C,y,!1),y!==2&&y!==6){if(eh&&!O){C.errorRecoveryDisabledLanes|=u,Ai|=u,i=4;break e}u=_a,_a=i,u!==null&&(_a===null?_a=u:_a.push.apply(_a,u))}i=y}if(u=!1,i!==2)continue}}if(i===1){$c(e,0),Go(e,t,0,!0);break}e:{switch(l=e,u=i,u){case 0:case 1:throw Error(f(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Go(l,t,Wa,!Uo);break e;case 2:_a=null;break;case 3:case 5:break;default:throw Error(f(329))}if((t&62914560)===t&&(i=md+300-tt(),10<i)){if(Go(l,t,Wa,!Uo),ts(l,0,!0)!==0)break e;Cs=t,l.timeoutHandle=Sh(Fg.bind(null,l,a,_a,pd,th,t,Wa,Ai,Cc,Uo,u,"Throttled",-0,0),i);break e}Fg(l,a,_a,pd,th,t,Wa,Ai,Cc,Uo,u,null,-0,0)}}break}while(!0);Es(e)}function Fg(e,t,a,l,i,u,y,C,O,V,J,oe,U,F){e.timeoutHandle=-1;var Se=t.subtreeFlags,Oe=(u&335544064)===u;if(oe=null,(Oe||Se&8192||(Se&16785408)===16785408)&&(oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:dn},Ja=null,Ug(t,u,oe),Oe&&(Se=oe,Oe=e.containerInfo,Oe=(Oe.nodeType===9?Oe:Oe.ownerDocument).__reactViewTransition,Oe!=null&&(Se.count++,Se.waitingForViewTransition=!0,Se=Ir.bind(Se),Oe.finished.then(Se,Se))),Se=(u&62914560)===u?md-tt():(u&4194048)===u?Yg-tt():0,Se=ex(oe,Se),Se!==null)){Cs=u,e.cancelPendingCommit=Se(np.bind(null,e,t,u,a,l,i,y,C,O,V,J,oe,null,U,F)),Go(e,u,y,!V);return}np(e,t,u,a,l,i,y,C,O,V,J,oe)}function Pb(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var i=a[l],u=i.getSnapshot;i=i.value;try{if(!Qn(u(),i))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Go(e,t,a,l){t=Bi(e,t),t&=~hd,t&=~Ai,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var i=t;0<i;){var u=31-cn(i),y=1<<u;l[u]=-1,i&=~y}a!==0&&Be(e,a,t)}function bd(){return(Dt&6)===0?(Xr(0),!1):!0}function lh(){if(mt!==null){if(Vt===0)var e=mt.return;else e=mt,Ul=ds=null,wc(e),no=null,vi=0,e=mt;for(;e!==null;)yg(e.alternate,e),e=e.return;mt=null}}function $c(e,t){var a=e.timeoutHandle;return a!==-1&&(e.timeoutHandle=-1,xv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Cs=0,lh(),Jt=e,mt=a=Pn(e.current,null),bt=t,Vt=0,Ia=null,Uo=!1,Tc=jt(e,t),eh=!1,Cc=Wa=hd=Ai=qo=Mn=0,_a=Gr=null,th=!1,ho=Bi(e,t),ko(),a}function Qg(e,t){Ie=null,de.H=Ju,t===En||t===zo?(t=Gu(),Vt=3):t===Gl?(t=Gu(),Vt=4):Vt=t===Cf?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ia=t,mt===null&&(Mn=1,Iu(e,Ca(t,e.current)))}function Pg(){var e=Hn.current;return e===null?!0:(bt&4194048)===bt?oa===null:(bt&62914560)===bt||(bt&536870912)!==0?e===oa:!1}function Jg(){var e=de.H;return de.H=Ju,e===null?Ju:e}function Ig(){var e=de.A;return de.A=Fb,e}function vd(){Mn=4,Uo||(bt&4194048)!==bt&&Hn.current!==null||(Tc=!0),(qo&134217727)===0&&(Ai&134217727)===0||Jt===null||Go(Jt,bt,Wa,!1)}function sh(e,t,a){var l=Dt;Dt|=2;var i=Jg(),u=Ig();(Jt!==e||bt!==t)&&(pd=null,$c(e,t)),t=!1;var y=Mn;e:do try{if(Vt!==0&&mt!==null){var C=mt,O=Ia;switch(Vt){case 8:lh(),y=6;break e;case 3:case 2:case 9:case 6:Hn.current===null&&(t=!0);var V=Vt;if(Vt=0,Ia=null,Oc(e,C,O,V),a&&Tc){y=0;break e}break;default:V=Vt,Vt=0,Ia=null,Oc(e,C,O,V)}}Jb(),y=Mn;break}catch(J){Qg(e,J)}while(!0);return t&&e.shellSuspendCounter++,Ul=ds=null,Dt=l,de.H=i,de.A=u,mt===null&&(Jt=null,bt=0,ko()),y}function Jb(){for(;mt!==null;)Wg(mt)}function Ib(e,t){var a=Dt;Dt|=2;var l=Jg(),i=Ig();Jt!==e||bt!==t?(pd=null,gd=tt()+500,$c(e,t)):Tc=jt(e,t);e:do try{if(Vt!==0&&mt!==null){t=mt;var u=Ia;t:switch(Vt){case 1:Vt=0,Ia=null,Oc(e,t,u,1);break;case 2:case 9:if(Er(u)){Vt=0,Ia=null,ep(t);break}t=function(){Vt!==2&&Vt!==9||Jt!==e||(Vt=7),Es(e)},u.then(t,t);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:Er(u)?(Vt=0,Ia=null,ep(t)):(Vt=0,Ia=null,Oc(e,t,u,7));break;case 5:var y=null;switch(mt.tag){case 26:y=mt.memoizedState;case 5:case 27:var C=mt;if(y?Xp(y):C.stateNode.complete){Vt=0,Ia=null;var O=C.sibling;if(O!==null)mt=O;else{var V=C.return;V!==null?(mt=V,xd(V)):mt=null}break t}}Vt=0,Ia=null,Oc(e,t,u,5);break;case 6:Vt=0,Ia=null,Oc(e,t,u,6);break;case 8:lh(),Mn=6;break e;default:throw Error(f(462))}}Wb();break}catch(J){Qg(e,J)}while(!0);return Ul=ds=null,de.H=l,de.A=i,Dt=a,mt!==null?0:(Jt=null,bt=0,ko(),Mn)}function Wb(){for(;mt!==null&&!Sn();)Wg(mt)}function Wg(e){var t=gg(e.alternate,e,ho);e.memoizedProps=e.pendingProps,t===null?xd(e):mt=t}function ep(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=cg(a,t,t.pendingProps,t.type,void 0,bt);break;case 11:t=cg(a,t,t.pendingProps,t.type.render,t.ref,bt);break;case 5:wc(t);var l=t;l===vn&&(st?(xn(l),l.tag===5&&l.stateNode!=null&&(Zt=l.stateNode)):(xn(l),st=!0));default:yg(a,t),t=mt=ml(t,ho),t=gg(a,t,ho)}e.memoizedProps=e.pendingProps,t===null?xd(e):mt=t}function Oc(e,t,a,l){Ul=ds=null,wc(t),no=null,vi=0;var i=t.return;try{if(Ub(e,i,t,a,bt)){Mn=1,Iu(e,Ca(a,e.current)),mt=null;return}}catch(u){if(i!==null)throw mt=i,u;Mn=1,Iu(e,Ca(a,e.current)),mt=null;return}t.flags&32768?(st||l===1?e=!0:Tc||(bt&536870912)!==0?e=!1:(Uo=e=!0,(l===2||l===9||l===3||l===6)&&(l=Hn.current,l!==null&&l.tag===13&&(l.flags|=16384))),tp(t,e)):xd(t)}function xd(e){var t=e;do{if((t.flags&32768)!==0){tp(t,Uo);return}e=t.return;var a=Yb(t.alternate,t,ho);if(a!==null){mt=a;return}if(t=t.sibling,t!==null){mt=t;return}mt=t=e}while(t!==null);Mn===0&&(Mn=5)}function tp(e,t){do{var a=Xb(e.alternate,e);if(a!==null){a.flags&=32767,mt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){mt=e;return}mt=e=a}while(e!==null);Mn=6,mt=null}function np(e,t,a,l,i,u,y,C,O,V,J,oe){e.cancelPendingCommit=null;do wd();while(Nn!==0);if((Dt&6)!==0)throw Error(f(327));if(t!==null){if(t===e.current)throw Error(f(177));e===Jt&&(mt=Jt=null,bt=0),zi=t,Pl=e,Cs=a,ah=i,Xg=l,ev(e,t,a,y,C,O,oe)}}function ev(e,t,a,l,i,u,y){var C=t.lanes|t.childLanes;if(nh=C,C|=gr,P(e,a,C,l,i,u),Mc=null,(a&335544064)===a?(Ac=Vu(e),l=10262):(Ac=null,l=10256),(t.subtreeFlags&l)!==0||(t.flags&l)!==0?(e.callbackNode=null,e.callbackPriority=0,ov(ll,function(){return rh(),null})):(e.callbackNode=null,e.callbackPriority=0),od=!1,l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=de.T,de.T=null,i=be.p,be.p=2,u=Dt,Dt|=4;try{Kb(e,t,a)}finally{Dt=u,be.p=i,de.T=l}}Nn=1,od?Ec=Tv(y,e.containerInfo,Ac,oh,ih,nv,ch,rh,tv):(oh(),ih(),ch())}function tv(e){if(Nn!==0){var t=Pl.onRecoverableError;t(e,{componentStack:null})}}function nv(){Nn===3&&(Nn=0,Lg(zi,Pl),Nn=4)}function oh(){if(Nn===1){Nn=0;var e=Pl,t=zi,a=Cs,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=de.T,de.T=null;var i=be.p;be.p=2;var u=Dt;Dt|=4;try{Ur=rd=!1,Bg(t,e,a),a=wh;var y=cr(e.containerInfo),C=a.focusedElem,O=a.selectionRange;if(y!==C&&C&&C.ownerDocument&&Ml(C.ownerDocument.documentElement,C)){if(O!==null&&Ii(C)){var V=O.start,J=O.end;if(J===void 0&&(J=V),"selectionStart"in C)C.selectionStart=V,C.selectionEnd=Math.min(J,C.value.length);else{var oe=C.ownerDocument||document,U=oe&&oe.defaultView||window;if(U.getSelection){var F=U.getSelection(),Se=C.textContent.length,Oe=Math.min(O.start,Se),nt=O.end===void 0?Oe:Math.min(O.end,Se);!F.extend&&Oe>nt&&(y=nt,nt=Oe,Oe=y);var q=wo(C,Oe),B=wo(C,nt);if(q&&B&&(F.rangeCount!==1||F.anchorNode!==q.node||F.anchorOffset!==q.offset||F.focusNode!==B.node||F.focusOffset!==B.offset)){var Z=oe.createRange();Z.setStart(q.node,q.offset),F.removeAllRanges(),Oe>nt?(F.addRange(Z),F.extend(B.node,B.offset)):(Z.setEnd(B.node,B.offset),F.addRange(Z))}}}}for(oe=[],F=C;F=F.parentNode;)F.nodeType===1&&oe.push({element:F,left:F.scrollLeft,top:F.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<oe.length;C++){var se=oe[C];se.element.scrollLeft=se.left,se.element.scrollTop=se.top}}qc=!!xh,wh=xh=null}finally{Dt=u,be.p=i,de.T=l}}e.current=t,Nn=2}}function ih(){if(Nn===2){Nn=0;var e=Pl,t=zi,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=de.T,de.T=null;var l=be.p;be.p=2;var i=Dt;Dt|=4;try{Ag(e,t.alternate,t)}finally{Dt=i,be.p=l,de.T=a}}Nn=3}}function ch(){if(Nn===4||Nn===3){Nn=0;var e=Ec;Ec=null,Wt();var t=Pl,a=zi,l=Cs,i=Xg,u=(l&335544064)===l?10262:10256;if((a.subtreeFlags&u)!==0||(a.flags&u)!==0?Nn=5:(Nn=0,zi=Pl=null,ap(t,t.pendingLanes)),u=t.pendingLanes,u===0&&(Vo=null),qe(l),a=a.stateNode,ta&&typeof ta.onCommitFiberRoot=="function")try{ta.onCommitFiberRoot(ol,a,void 0,(a.current.flags&128)===128)}catch{}if(i!==null){a=de.T,u=be.p,be.p=2,de.T=null;try{for(var y=t.onRecoverableError,C=0;C<i.length;C++){var O=i[C];y(O.value,{componentStack:O.stack})}}finally{de.T=a,be.p=u}}if(i=Mc,y=Ac,Ac=null,i!==null&&(Mc=null,y===null&&(y=[]),e!==null))for(O=0;O<i.length;O++)a=(0,i[O])(y),a!==void 0&&e.finished.finally(a);(Cs&3)!==0&&wd(),Es(t),u=t.pendingLanes,(l&261930)!==0&&(u&42)!==0?t===yd?Yr++:(Yr=0,yd=t):(Yr=0,yd=null),Xr(0)}}function ap(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Co(t)))}function wd(){return Ec!==null&&(Ec.skipTransition(),Ec=null),oh(),ih(),ch(),rh()}function rh(){if(Nn!==5)return!1;var e=Pl,t=nh;nh=0;var a=qe(Cs),l=de.T,i=be.p;try{be.p=32>a?32:a,de.T=null,a=ah,ah=null;var u=Pl,y=Cs;if(Nn=0,zi=Pl=null,Cs=0,(Dt&6)!==0)throw Error(f(331));var C=Dt;if(Dt|=4,Vg(u.current),_g(u,u.current,y,a),Dt=C,Xr(0,!1),ta&&typeof ta.onPostCommitFiberRoot=="function")try{ta.onPostCommitFiberRoot(ol,u)}catch{}return!0}finally{be.p=i,de.T=l,ap(e,t)}}function lp(e,t,a){t=Ca(a,t),t=Tf(e.stateNode,t,2),e=Qa(e,t,2),e!==null&&(A(e,2),Es(e))}function Gt(e,t,a){if(e.tag===3)lp(e,e,a);else for(;t!==null;){if(t.tag===3){lp(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Vo===null||!Vo.has(l))){e=Ca(a,e),a=eg(2),l=Qa(t,a,2),l!==null&&(tg(a,l,t,e),A(l,2),Es(l));break}}t=t.return}}function uh(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Qb;var i=new Set;l.set(t,i)}else i=l.get(t),i===void 0&&(i=new Set,l.set(t,i));i.has(a)||(eh=!0,i.add(a),e=av.bind(null,e,t,a),t.then(e,e))}function av(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Jt===e&&(bt&a)===a&&((Mn===4||Mn===3&&(bt&62914560)===bt&&300>tt()-md)&&(Dt&2)===0?$c(e,0):hd|=a,Cc===bt&&(Cc=0)),Es(e)}function sp(e,t){t===0&&(t=Ht()),e=rs(e,t),e!==null&&(A(e,t),Es(e))}function lv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),sp(e,a)}function sv(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(f(314))}l!==null&&l.delete(t),sp(e,a)}function ov(e,t){return Dn(e,t)}var Rc=null,Dc=null,dh=!1,jd=!1,fh=!1,Yo=0;function Es(e){e!==Dc&&e.next===null&&(Dc===null?Rc=Dc=e:Dc=Dc.next=e),jd=!0,dh||(dh=!0,cv())}function Xr(e,t){if(!fh&&jd){fh=!0;do for(var a=!1,l=Rc;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var u=0;else{var y=l.suspendedLanes,C=l.pingedLanes;u=(1<<31-cn(42|e)+1)-1,u&=i&~(y&~C),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,rp(l,u))}else u=bt,u=ts(l,l===Jt?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||jt(l,u)||(a=!0,rp(l,u));l=l.next}while(a);fh=!1}}function iv(){op()}function op(){jd=dh=!1;var e=0;Yo!==0&&vv()&&(e=Yo);for(var t=tt(),a=null,l=Rc;l!==null;){var i=l.next,u=ip(l,t);u===0?(l.next=null,a===null?Rc=i:a.next=i,i===null&&(Dc=a)):(a=l,(e!==0||(u&3)!==0)&&(jd=!0)),l=i}Nn!==0&&Nn!==5||Xr(e),Yo!==0&&(Yo=0)}function ip(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var y=31-cn(u),C=1<<y,O=i[y];O===-1?((C&a)===0||(C&l)!==0)&&(i[y]=yu(C,t)):O<=t&&(e.expiredLanes|=C),u&=~C}if(t=Jt,a=bt,a=ts(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Qe(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||jt(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&Qe(l),qe(a)){case 2:case 8:a=Nt;break;case 32:a=ll;break;case 268435456:a=po;break;default:a=ll}return l=cp.bind(null,e),a=Dn(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&Qe(l),e.callbackPriority=2,e.callbackNode=null,2}function cp(e,t){if(Nn!==0&&Nn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(wd()&&e.callbackNode!==a)return null;var l=bt;return l=ts(e,e===Jt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Zg(e,l,t),ip(e,tt()),e.callbackNode!=null&&e.callbackNode===a?cp.bind(null,e):null)}function rp(e,t){if(wd())return null;Zg(e,t,!0)}function cv(){wv(function(){(Dt&6)!==0?Dn(Ct,iv):op()})}function hh(){if(Yo===0){var e=Ws;e===0&&(e=es,es<<=1,(es&261888)===0&&(es=256)),Yo=e}return Yo}function up(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ss(e)}function rv(e,t,a,l,i){if(t==="submit"&&a&&a.stateNode===i){var u=up((i[yn]||null).action),y=l.submitter;y&&(t=(t=y[yn]||null)?up(t.formAction):y.getAttribute("formAction"),t!==null&&(u=t,y=null));var C=new ii("action","action",null,l,i);e.push({event:C,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Yo!==0){var O=new FormData(i,y);wf(a,{pending:!0,data:O,method:i.method,action:u},null,O)}}else typeof u=="function"&&(C.preventDefault(),O=new FormData(i,y),wf(a,{pending:!0,data:O,method:i.method,action:u},u,O))},currentTarget:i}]})}}for(var mh=0;mh<nc.length;mh++){var gh=nc[mh],uv=gh.toLowerCase(),dv=gh[0].toUpperCase()+gh.slice(1);ya(uv,"on"+dv)}ya(fr,"onAnimationEnd"),ya(No,"onAnimationIteration"),ya(hr,"onAnimationStart"),ya("dblclick","onDoubleClick"),ya("focusin","onFocus"),ya("focusout","onBlur"),ya(mf,"onTransitionRun"),ya(Wi,"onTransitionStart"),ya(ec,"onTransitionCancel"),ya(tc,"onTransitionEnd"),ga("onMouseEnter",["mouseout","mouseover"]),ga("onMouseLeave",["mouseout","mouseover"]),ga("onPointerEnter",["pointerout","pointerover"]),ga("onPointerLeave",["pointerout","pointerover"]),un("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),un("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),un("onBeforeInput",["compositionend","keypress","textInput","paste"]),un("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),fv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kr));function dp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],i=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var y=l.length-1;0<=y;y--){var C=l[y],O=C.instance,V=C.currentTarget;if(C=C.listener,O!==u&&i.isPropagationStopped())break e;u=C,i.currentTarget=V;try{u(i)}catch(J){gi(J)}i.currentTarget=null,u=O}else for(y=0;y<l.length;y++){if(C=l[y],O=C.instance,V=C.currentTarget,C=C.listener,O!==u&&i.isPropagationStopped())break e;u=C,i.currentTarget=V;try{u(i)}catch(J){gi(J)}i.currentTarget=null,u=O}}}}function gt(e,t){var a=t[Kc];a===void 0&&(a=t[Kc]=new Set);var l=e+"__bubble";a.has(l)||(fp(t,e,2,!1),a.add(l))}function ph(e,t,a){var l=0;t&&(l|=4),fp(a,e,l,t)}var Nd="_reactListening"+Math.random().toString(36).slice(2);function yh(e){if(!e[Nd]){e[Nd]=!0,ai.forEach(function(a){a!=="selectionchange"&&(fv.has(a)||ph(a,!1,e),ph(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Nd]||(t[Nd]=!0,ph("selectionchange",!1,t))}}function fp(e,t,a,l){switch(ty(t)){case 2:var i=lx;break;case 8:i=sx;break;default:i=Hh}a=i.bind(null,t,a,e),i=void 0,!_i||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),l?i!==void 0?e.addEventListener(t,a,{capture:!0,passive:i}):e.addEventListener(t,a,!0):i!==void 0?e.addEventListener(t,a,{passive:i}):e.addEventListener(t,a,!1)}function bh(e,t,a,l,i){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var y=l.tag;if(y===3||y===4){var C=l.stateNode.containerInfo;if(C===i)break;if(y===4)for(y=l.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===i)return;y=y.return}for(;C!==null;){if(y=ns(C),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){l=u=y;continue e}C=C.parentNode}}l=l.return}Kt(function(){var V=u,J=ln(a),oe=[];e:{var U=mr.get(e);if(U!==void 0){var F=ii,Se=e;switch(e){case"keypress":if(Ya(a)===0)break e;case"keydown":case"keyup":F=we;break;case"focusin":Se="focus",F=Vi;break;case"focusout":Se="blur",F=Vi;break;case"beforeblur":case"afterblur":F=Vi;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":F=Xa;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":F=ku;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":F=St;break;case fr:case No:case hr:F=bn;break;case tc:F=Tn;break;case"scroll":case"scrollend":F=Ic;break;case"wheel":F=df;break;case"copy":case"cut":case"paste":F=kn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":F=Yi;break;case"submit":F=hn;break;case"toggle":case"beforetoggle":F=ff}var Oe=(t&4)!==0,nt=!Oe&&(e==="scroll"||e==="scrollend"),q=Oe?U!==null?U+"Capture":null:U;Oe=[];for(var B=V,Z;B!==null;){var se=B;if(Z=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||Z===null||q===null||(se=$a(B,q),se!=null&&Oe.push(Zr(B,se,Z))),nt)break;B=B.return}0<Oe.length&&(U=new F(U,Se,null,a,J),oe.push({event:U,listeners:Oe}))}}if((t&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",F&&a!==_s&&(Se=a.relatedTarget||a.fromElement)&&(ns(Se)||Se[Os]))break e;(U||F)&&(Se=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,U?(F=a.relatedTarget||a.toElement,U=V,F=F?ns(F):null,F!==null&&(nt=g(F),Oe=F.tag,F!==nt||Oe!==5&&Oe!==27&&Oe!==6)&&(F=null)):(U=null,F=V),U!==F&&(Oe=Xa,se="onMouseLeave",q="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Oe=Yi,se="onPointerLeave",q="onPointerEnter",B="pointer"),nt=U==null?Se:Sa(U),Z=F==null?Se:Sa(F),Se=new Oe(se,B+"leave",U,a,J),Se.target=nt,Se.relatedTarget=Z,se=null,ns(J)===V&&(Oe=new Oe(q,B+"enter",F,a,J),Oe.target=Z,Oe.relatedTarget=nt,se=Oe),nt=se,Oe=U&&F?ie(U,F,hv):null,U!==null&&hp(oe,Se,U,Oe,!1),F!==null&&nt!==null&&hp(oe,nt,F,Oe,!0)))}e:{if(U=V?Sa(V):window,F=U.nodeName&&U.nodeName.toLowerCase(),F==="select"||F==="input"&&U.type==="file")var ze=Za;else if(lr(U))if(sr)ze=is;else{ze=ir;var vt=Ou}else F=U.nodeName,!F||F.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?V&&ve(V.elementType)&&(ze=Za):ze=Ru;if(ze&&(ze=ze(e,V))){zu(oe,ze,a,J);break e}vt&&vt(e,U,V)}switch(vt=V?Sa(V):window,e){case"focusin":(lr(vt)||vt.contentEditable==="true")&&(Al=vt,jo=V,cs=null);break;case"focusout":cs=jo=Al=null;break;case"mousedown":rr=!0;break;case"contextmenu":case"mouseup":case"dragend":rr=!1,ur(oe,a,J);break;case"selectionchange":if(Du)break;case"keydown":case"keyup":ur(oe,a,J)}var Le;if(Xi)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else El?Ka(e,a)&&(Ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ke="onCompositionStart");Ke&&(Cl&&a.locale!=="ko"&&(El||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&El&&(Le=dl()):(kl=J,ul="value"in kl?kl.value:kl.textContent,El=!0)),vt=Sd(V,Ke),0<vt.length&&(Ke=new tr(Ke,e,null,a,J),oe.push({event:Ke,listeners:vt}),Le?Ke.data=Le:(Le=bo(a),Le!==null&&(Ke.data=Le)))),(Le=ui?Zi(e,a):ar(e,a))&&(Ke=Sd(V,"onBeforeInput"),0<Ke.length&&(vt=new tr("onBeforeInput","beforeinput",null,a,J),oe.push({event:vt,listeners:Ke}),vt.data=Le)),rv(oe,e,V,a,J)}dp(oe,t)})}function Zr(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Sd(e,t){for(var a=t+"Capture",l=[];e!==null;){var i=e,u=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||u===null||(i=$a(e,a),i!=null&&l.unshift(Zr(e,i,u)),i=$a(e,t),i!=null&&l.push(Zr(e,i,u))),e.tag===3)return l;e=e.return}return[]}function hv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function hp(e,t,a,l,i){for(var u=t._reactName,y=[];a!==null&&a!==l;){var C=a,O=C.alternate,V=C.stateNode;if(C=C.tag,O!==null&&O===l)break;C!==5&&C!==26&&C!==27||V===null||(O=V,i?(V=$a(a,u),V!=null&&y.unshift(Zr(a,V,O))):i||(V=$a(a,u),V!=null&&y.push(Zr(a,V,O)))),a=a.return}y.length!==0&&e.push({event:t,listeners:y})}var mv=/\r\n?/g,gv=/\u0000|\uFFFD/g;function mp(e){return(typeof e=="string"?e:""+e).replace(mv,`
49
+ `).replace(gv,"")}function gp(e,t){return t=mp(t),mp(e)===t}function Yt(e,t,a,l,i,u){switch(a){case"children":if(typeof l=="string")t==="body"||t==="textarea"&&l===""||Ga(e,l);else if(typeof l=="number"||typeof l=="bigint")t!=="body"&&Ga(e,""+l);else return;break;case"className":cl(e,"class",l);break;case"tabIndex":cl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":cl(e,a,l);break;case"style":Li(e,l,u);return;case"data":if(t!=="object"){cl(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ss(l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(a==="formAction"?(t!=="input"&&Yt(e,t,"name",i.name,i,null),Yt(e,t,"formEncType",i.formEncType,i,null),Yt(e,t,"formMethod",i.formMethod,i,null),Yt(e,t,"formTarget",i.formTarget,i,null)):(Yt(e,t,"encType",i.encType,i,null),Yt(e,t,"method",i.method,i,null),Yt(e,t,"target",i.target,i,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ss(l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=dn);return;case"onScroll":l!=null&&gt("scroll",e);return;case"onScrollEnd":l!=null&&gt("scrollend",e);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(f(61));if(a=l.__html,a!=null){if(i.children!=null)throw Error(f(60));(u!=null?u.__html:void 0)!==a&&(e.innerHTML=a)}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=ss(l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":gt("beforetoggle",e),gt("toggle",e),li(e,"popover",l);break;case"xlinkActuate":Zn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Zn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Zn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Zn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Zn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Zn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":li(e,"is",l);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=la.get(a)||a,li(e,a,l);else return}Ye=!0}function vh(e,t,a,l,i,u){switch(a){case"style":Li(e,l,u);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(f(61));if(a=l.__html,a!=null){if(i.children!=null)throw Error(f(60));(u!=null?u.__html:void 0)!==a&&(e.innerHTML=a)}}break;case"children":if(typeof l=="string")Ga(e,l);else if(typeof l=="number"||typeof l=="bigint")Ga(e,""+l);else return;break;case"onScroll":l!=null&&gt("scroll",e);return;case"onScrollEnd":l!=null&&gt("scrollend",e);return;case"onClick":l!=null&&(e.onclick=dn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!ls.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(i=a.endsWith("Capture"),u=a.slice(2,i?a.length-7:void 0),t=e[yn]||null,t=t!=null?t[a]:null,typeof t=="function"&&e.removeEventListener(u,t,i),typeof l=="function")){typeof t!="function"&&t!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(u,l,i);break e}Ye=!0,a in e?e[a]=l:l===!0?e.setAttribute(a,""):li(e,a,l)}return}Ye=!0}function ra(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":gt("error",e),gt("load",e);var l=!1,i=!1,u;for(u in a)if(a.hasOwnProperty(u)){var y=a[u];if(y!=null)switch(u){case"src":l=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,t));default:Yt(e,t,u,y,a,null)}}i&&Yt(e,t,"srcSet",a.srcSet,a,null),l&&Yt(e,t,"src",a.src,a,null);return;case"input":gt("invalid",e);var C=u=y=i=null,O=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var J=a[l];if(J!=null)switch(l){case"name":i=J;break;case"type":y=J;break;case"checked":O=J;break;case"defaultChecked":V=J;break;case"value":u=J;break;case"defaultValue":C=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(f(137,t));break;default:Yt(e,t,l,J,a,null)}}Nu(e,u,C,O,V,y,i,!1);return;case"select":gt("invalid",e),l=y=u=null;for(i in a)if(a.hasOwnProperty(i)&&(C=a[i],C!=null))switch(i){case"value":u=C;break;case"defaultValue":y=C;break;case"multiple":l=C;default:Yt(e,t,i,C,a,null)}t=u,a=y,e.multiple=!!l,t!=null?pa(e,!!l,t,!1):a!=null&&pa(e,!!l,a,!0);return;case"textarea":gt("invalid",e),u=i=l=null;for(y in a)if(a.hasOwnProperty(y)&&(C=a[y],C!=null))switch(y){case"value":l=C;break;case"defaultValue":i=C;break;case"children":u=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(f(91));break;default:Yt(e,t,y,C,a,null)}ct(e,l,i,u);return;case"option":for(O in a)if(a.hasOwnProperty(O)&&(l=a[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Yt(e,t,O,l,a,null)}return;case"dialog":gt("beforetoggle",e),gt("toggle",e),gt("cancel",e),gt("close",e);break;case"iframe":case"object":gt("load",e);break;case"video":case"audio":for(l=0;l<Kr.length;l++)gt(Kr[l],e);break;case"image":gt("error",e),gt("load",e);break;case"details":gt("toggle",e);break;case"embed":case"source":case"link":gt("error",e),gt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,t));default:Yt(e,t,V,l,a,null)}return;default:if(ve(t)){for(J in a)a.hasOwnProperty(J)&&(l=a[J],l!==void 0&&vh(e,t,J,l,a,void 0));return}}for(C in a)a.hasOwnProperty(C)&&(l=a[C],l!=null&&Yt(e,t,C,l,a,null))}var pv={};function yv(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,u=null,y=null,C=null,O=null,V=null,J=null;for(F in a){var oe=a[F];if(a.hasOwnProperty(F)&&oe!=null)switch(F){case"checked":break;case"value":break;case"defaultValue":O=oe;default:l.hasOwnProperty(F)||Yt(e,t,F,null,l,oe)}}for(var U in l){var F=l[U];if(oe=a[U],l.hasOwnProperty(U)&&(F!=null||oe!=null))switch(U){case"type":F!==oe&&(Ye=!0),u=F;break;case"name":F!==oe&&(Ye=!0),i=F;break;case"checked":F!==oe&&(Ye=!0),V=F;break;case"defaultChecked":F!==oe&&(Ye=!0),J=F;break;case"value":F!==oe&&(Ye=!0),y=F;break;case"defaultValue":F!==oe&&(Ye=!0),C=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(f(137,t));break;default:F!==oe&&Yt(e,t,U,F,l,oe)}}Bs(e,y,C,O,V,J,u,i);return;case"select":F=y=C=U=null;for(u in a)if(O=a[u],a.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":F=O;default:l.hasOwnProperty(u)||Yt(e,t,u,null,l,O)}for(i in l)if(u=l[i],O=a[i],l.hasOwnProperty(i)&&(u!=null||O!=null))switch(i){case"value":u!==O&&(Ye=!0),U=u;break;case"defaultValue":u!==O&&(Ye=!0),C=u;break;case"multiple":u!==O&&(Ye=!0),y=u;default:u!==O&&Yt(e,t,i,u,l,O)}t=C,a=y,l=F,U!=null?pa(e,!!a,U,!1):!!l!=!!a&&(t!=null?pa(e,!!a,t,!0):pa(e,!!a,a?[]:"",!1));return;case"textarea":F=U=null;for(C in a)if(i=a[C],a.hasOwnProperty(C)&&i!=null&&!l.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Yt(e,t,C,null,l,i)}for(y in l)if(i=l[y],u=a[y],l.hasOwnProperty(y)&&(i!=null||u!=null))switch(y){case"value":i!==u&&(Ye=!0),U=i;break;case"defaultValue":i!==u&&(Ye=!0),F=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(f(91));break;default:i!==u&&Yt(e,t,y,i,l,u)}Ls(e,U,F);return;case"option":for(var Se in a)if(U=a[Se],a.hasOwnProperty(Se)&&U!=null&&!l.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:Yt(e,t,Se,null,l,U)}for(O in l)if(U=l[O],F=a[O],l.hasOwnProperty(O)&&U!==F&&(U!=null||F!=null))switch(O){case"selected":U!==F&&(Ye=!0),e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Yt(e,t,O,U,l,F)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Oe in a)U=a[Oe],a.hasOwnProperty(Oe)&&U!=null&&!l.hasOwnProperty(Oe)&&Yt(e,t,Oe,null,l,U);for(V in l)if(U=l[V],F=a[V],l.hasOwnProperty(V)&&U!==F&&(U!=null||F!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(f(137,t));break;default:Yt(e,t,V,U,l,F)}return;default:if(ve(t)){for(var nt in a)U=a[nt],a.hasOwnProperty(nt)&&U!==void 0&&!l.hasOwnProperty(nt)&&vh(e,t,nt,void 0,l,U);for(J in l)U=l[J],F=a[J],!l.hasOwnProperty(J)||U===F||U===void 0&&F===void 0||vh(e,t,J,U,l,F);return}}for(var q in a)U=a[q],a.hasOwnProperty(q)&&U!=null&&!l.hasOwnProperty(q)&&Yt(e,t,q,null,l,U);for(oe in l)U=l[oe],F=a[oe],!l.hasOwnProperty(oe)||U===F||U==null&&F==null||Yt(e,t,oe,U,l,F)}function pp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var i=a[l],u=i.transferSize,y=i.initiatorType,C=i.duration;if(u&&C&&pp(y)){for(y=0,C=i.responseEnd,l+=1;l<a.length;l++){var O=a[l],V=O.startTime;if(V>C)break;var J=O.transferSize,oe=O.initiatorType;J&&pp(oe)&&(O=O.responseEnd,y+=J*(O<C?1:(C-V)/(O-V)))}if(--l,t+=8*(u+y)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var xh=null,wh=null;function Fr(e){return e.nodeType===9?e:e.ownerDocument}function yp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function vp(e,t,a,l){return a=Fr(a).createElement(e),a[it]=l,a[yn]=t,ra(a,e,t),zn(a),a}function jh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Nh=null;function vv(){var e=window.event;return e&&e.type==="popstate"?e===Nh?!1:(Nh=e,!0):(Nh=null,!1)}var Sh=typeof setTimeout=="function"?setTimeout:void 0,xv=typeof clearTimeout=="function"?clearTimeout:void 0,xp=typeof Promise=="function"?Promise:void 0,wp=typeof requestAnimationFrame=="function"?requestAnimationFrame:Sh,wv=typeof queueMicrotask=="function"?queueMicrotask:typeof xp<"u"?function(e){return xp.resolve(null).then(e).catch(jv)}:Sh;function jv(e){setTimeout(function(){throw e})}function Xo(e){return e==="head"}function jp(e,t){var a=t,l=0;do{var i=a.nextSibling;if(e.removeChild(a),i&&i.nodeType===8)if(a=i.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(i),Vc(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")$h(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,$h(a);for(var u=a.firstChild;u;){var y=u.nextSibling,C=u.nodeName;u[ni]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=y}}else a==="body"&&$h(e.ownerDocument.body);a=i}while(a);Vc(t)}function Np(e,t){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Sp(e,t,a){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,a!=null&&(e.style.viewTransitionClass=a),a=getComputedStyle(e),a.display==="inline"){if(t=e.getClientRects(),t.length===1)var l=1;else for(var i=l=0;i<t.length;i++){var u=t[i];0<u.width&&0<u.height&&l++}l===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+a.paddingTop,e.marginBottom="-"+a.paddingBottom)}}function kp(e,t){e=e.style,t=t.style;var a=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(a=t.display,e.display=a==null||typeof a=="boolean"?"":a,a=t.margin,a!=null?e.margin=a:(a=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=a==null||typeof a=="boolean"?"":a,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Nv(e,t,a){return a=a.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=a.innerHeight&&e.left<=a.innerWidth}}function kh(e){var t=e.getBoundingClientRect(),a=getComputedStyle(e);return Nv(t,a,e)}function Sv(e){return e.documentElement.clientHeight}function kv(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Tv(e,t,a,l,i,u,y,C,O){var V=t.nodeType===9?t:t.ownerDocument;try{var J=V.startViewTransition({update:function(){var U=V.defaultView,F=U.navigation&&U.navigation.transition,Se=V.fonts.status;l();var Oe=[];if(Se==="loaded"&&(Sv(V),V.fonts.status==="loading"&&Oe.push(V.fonts.ready)),Se=Oe.length,e!==null)for(var nt=e.suspenseyImages,q=0,B=0;B<nt.length;B++){var Z=nt[B];if(!Z.complete){var se=Z.getBoundingClientRect();if(0<se.bottom&&0<se.right&&se.top<U.innerHeight&&se.left<U.innerWidth){if(q+=Kp(Z),q>Cd){Oe.length=Se;break}Z=new Promise(kv.bind(Z)),Oe.push(Z)}}}if(0<Oe.length)return U=Promise.race([Promise.all(Oe),new Promise(function(ze){return setTimeout(ze,500)})]).then(i,i),(F?Promise.allSettled([F.finished,U]):U).then(u,u);if(i(),F)return F.finished.then(u,u);u()},types:a});V.__reactViewTransition=J;var oe=[];return J.ready.then(function(){for(var U=V.documentElement.getAnimations({subtree:!0}),F=0;F<U.length;F++){var Se=U[F],Oe=Se.effect,nt=Oe.pseudoElement;if(nt!=null&&nt.startsWith("::view-transition")){oe.push(Se),Se=Oe.getKeyframes();for(var q=nt=void 0,B=!0,Z=0;Z<Se.length;Z++){var se=Se[Z],ze=se.width;if(nt===void 0)nt=ze;else if(nt!==ze){B=!1;break}if(ze=se.height,q===void 0)q=ze;else if(q!==ze){B=!1;break}delete se.width,delete se.height,se.transform==="none"&&delete se.transform}B&&nt!==void 0&&q!==void 0&&(Oe.setKeyframes(Se),B=getComputedStyle(Oe.target,Oe.pseudoElement),B.width!==nt||B.height!==q)&&(B=Se[0],B.width=nt,B.height=q,B=Se[Se.length-1],B.width=nt,B.height=q,Oe.setKeyframes(Se))}}y()},function(U){V.__reactViewTransition===J&&(V.__reactViewTransition=null);try{if(typeof U=="object"&&U!==null)switch(U.name){case"InvalidStateError":(U.message==="View transition was skipped because document visibility state is hidden."||U.message==="Skipping view transition because document visibility state has become hidden."||U.message==="Skipping view transition because viewport size changed."||U.message==="Transition was aborted because of invalid state")&&(U=null)}U!==null&&O(U)}finally{l(),i(),y()}}),J.finished.finally(function(){for(var U=0;U<oe.length;U++)oe[U].cancel();V.__reactViewTransition===J&&(V.__reactViewTransition=null),C()}),J}catch{return l(),i(),y(),null}}function $i(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}$i.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:le({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},$i.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,a=e.getAnimations({subtree:!0}),l=[],i=0;i<a.length;i++){var u=a[i].effect;u!==null&&u.target===e&&u.pseudoElement===t&&l.push(a[i])}return l},$i.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Tp(e){return{name:e,group:new $i("group",e),imagePair:new $i("image-pair",e),old:new $i("old",e),new:new $i("new",e)}}function tl(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}tl.prototype.addEventListener=function(e,t,a){var l=null,i=null;if(!(a!=null&&typeof a!="boolean"&&(l=a.signal||null,l!==null&&l.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var u=this._eventListeners;if(Ep(u,e,t,a)===-1){var y=this,C=t;a!=null&&typeof a!="boolean"&&a.once===!0&&(C=function(O){y.removeEventListener(e,t,a),typeof t=="function"?t.call(this,O):t.handleEvent(O)}),l!==null&&(i=y.removeEventListener.bind(y,e,t,a),l.addEventListener("abort",i,{once:!0}),i=l.removeEventListener.bind(l,"abort",i)),l=Bc(a),u.push({type:e,listener:t,optionsOrUseCapture:a,attachedListener:C,cleanup:i}),w(this._fragmentFiber.child,!1,Cv,e,C,l)}this._eventListeners=u}};function Cv(e,t,a,l){return T(e).addEventListener(t,a,l),!1}tl.prototype.removeEventListener=function(e,t,a){var l=this._eventListeners;if(l!==null&&(t=Ep(l,e,t,a),t!==-1)){var i=l[t];a=i.attachedListener;var u=i.cleanup;i=Bc(i.optionsOrUseCapture),w(this._fragmentFiber.child,!1,Ev,e,a,i),l.splice(t,1),u!==null&&u()}};function Ev(e,t,a,l){return T(e).removeEventListener(t,a,l),!1}function Bc(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Cp(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Ep(e,t,a,l){if(e.length===0)return-1;l=Cp(l);for(var i=0;i<e.length;i++){var u=e[i];if(u.type===t&&u.listener===a&&Cp(u.optionsOrUseCapture)===l)return i}return-1}tl.prototype.dispatchEvent=function(e){var t=M(this._fragmentFiber);if(t===null)return!0;t=T(t);var a=this._eventListeners;if(a!==null&&0<a.length||!e.bubbles){var l=t.nodeType===9?t.createComment(""):document.createTextNode("");if(a)for(var i=0;i<a.length;i++){var u=a[i];l.addEventListener(u.type,u.attachedListener,Bc(u.optionsOrUseCapture))}if(t.appendChild(l),e=l.dispatchEvent(e),a)for(i=0;i<a.length;i++)u=a[i],l.removeEventListener(u.type,u.attachedListener,Bc(u.optionsOrUseCapture));return t.removeChild(l),e}return t.dispatchEvent(e)},tl.prototype.focus=function(e){w(this._fragmentFiber.child,!0,Mp,e,void 0,void 0)};function Mp(e,t){return e.tag===6?!1:(e=T(e),Uv(e,t))}tl.prototype.focusLast=function(e){var t=[];w(this._fragmentFiber.child,!0,Th,t,void 0,void 0);for(var a=t.length-1;0<=a&&!Mp(t[a],e);a--);};function Th(e,t){return t.push(e),!1}tl.prototype.blur=function(){var e=M(this._fragmentFiber);e!==null&&(e=T(e),e=Fr(e).activeElement,e!==null&&w(this._fragmentFiber.child,!1,Mv,e,void 0,void 0))};function Mv(e,t){return e.tag===6?!1:(e=T(e),e===t||e.contains(t)?(t.blur(),!0):!1)}tl.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),w(this._fragmentFiber.child,!1,Av,e,void 0,void 0)};function Av(e,t){return e.tag===6||(e=T(e),t.observe(e)),!1}tl.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),w(this._fragmentFiber.child,!1,zv,e,void 0,void 0);for(var a=t=0;a<Jl.length;a++){var l=Jl[a];l.fragmentInstance===this&&l.observer===e?e.unobserve(l.instance):Jl[t++]=l}Jl.length=t}};function zv(e,t){return e.tag===6||(e=T(e),t.unobserve(e)),!1}var Jl=[],Ch=!1;function $v(e,t,a){Jl.push({fragmentInstance:e,observer:t,instance:a}),Ch||(Ch=!0,qv(function(){Ch=!1;var l=Jl;Jl=[];for(var i=0;i<l.length;i++){var u=l[i];u.observer.unobserve(u.instance)}}))}tl.prototype.getClientRects=function(){var e=[];return w(this._fragmentFiber.child,!1,Ov,e,void 0,void 0),e};function Ov(e,t){if(e.tag===6){e=e.stateNode;var a=e.ownerDocument.createRange();a.selectNodeContents(e),t.push.apply(t,a.getClientRects())}else e=T(e),t.push.apply(t,e.getClientRects());return!1}tl.prototype.getRootNode=function(e){var t=M(this._fragmentFiber);return t===null?this:T(t).getRootNode(e)},tl.prototype.compareDocumentPosition=function(e){var t=M(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];w(this._fragmentFiber.child,!1,Th,a,void 0,void 0);var l=T(t);if(a.length===0){if(a=l,z(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(a=t)}t=this._fragmentFiber;var i=l=a.compareDocumentPosition(e);return a===e?i=Node.DOCUMENT_POSITION_CONTAINS:l&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=H(t)[1],a===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=T(a).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=T(a[0]),i=T(a[a.length-1]);var u=z(this._fragmentFiber)?t.parentElement:l;if(u==null)return Node.DOCUMENT_POSITION_DISCONNECTED;l=u.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,u=u.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var y=t.compareDocumentPosition(e),C=i.compareDocumentPosition(e),O=y&Node.DOCUMENT_POSITION_CONTAINED_BY||C&Node.DOCUMENT_POSITION_CONTAINED_BY;return C=l&&u&&y&Node.DOCUMENT_POSITION_FOLLOWING&&C&Node.DOCUMENT_POSITION_PRECEDING,t=l&&t===e||u&&i===e||O||C?Node.DOCUMENT_POSITION_CONTAINED_BY:!l&&t===e||!u&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:y,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Rv(t,this._fragmentFiber,a[0],a[a.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Rv(e,t,a,l,i){var u=ns(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!u)e:{for(;u!==null;){if(u.tag===7&&(u===t||u.alternate===t)){a=!0;break e}u=u.return}a=!1}return a}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(u===null)return u=i.ownerDocument,i===u||i===u.documentElement||i===u.body;e:{for(u=t,t=M(t);u!==null;){if(!(u.tag!==5&&u.tag!==3&&u.tag!==27||u!==t&&u.alternate!==t)){u=!0;break e}u=u.return}u=!1}return u}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!u)&&!(t=u===a)&&(t=ie(a,u,ee),t===null?t=!1:(w(t,!0,X,u,a),u=_,_=null,t=u!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!u)&&!(t=u===l)&&(t=ie(l,u,ee),t===null?t=!1:(w(t,!0,ne,u,l),u=_,I=_=null,t=u!==null)),t):!1}function Ap(e,t){var a=e.ownerDocument.createRange();a.selectNodeContents(e),e=a.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}tl.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(f(566));var t=[];w(this._fragmentFiber.child,!1,Th,t,void 0,void 0);var a=e!==!1;if(t.length===0){var l=H(this._fragmentFiber);if(l=a?l[1]||l[0]||M(this._fragmentFiber):l[0]||l[1],l===null)return;if(l.tag===6){e=T(l),Ap(e,a);return}if(l=T(l),l.nodeType!==9){if(l.nodeType===11){a="host"in l?l.host:null,a!==null&&a.scrollIntoView(e);return}l.scrollIntoView(e)}}for(l=a?t.length-1:0;l!==(a?-1:t.length);){var i=t[l];i.tag===6?(i=T(i),Ap(i,a)):T(i).scrollIntoView(e),l+=a?-1:1}};function Dv(e,t){return e=T(e),zp(e,t),!1}function zp(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function $p(e,t){var a=t._eventListeners;if(a!==null)for(var l=0;l<a.length;l++){var i=a[l];e.addEventListener(i.type,i.attachedListener,Bc(i.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(u){for(var y=0,C=0;C<Jl.length;C++){var O=Jl[C];(O.fragmentInstance!==t||O.observer!==u||O.instance!==e)&&(Jl[y++]=O)}Jl.length=y,u.observe(e)}),zp(e,t))}function Bv(e,t){var a=t._eventListeners;if(a!==null)for(var l=0;l<a.length;l++){var i=a[l];e.removeEventListener(i.type,i.attachedListener,Bc(i.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(u){typeof u.rootMargin=="string"?$v(t,u,e):u.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Eh(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Eh(a),Hi(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Hv(e,t,a,l){for(;e.nodeType===1;){var i=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[ni])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=xl(e.nextSibling),e===null)break}return null}function Lv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=xl(e.nextSibling),e===null))return null;return e}function Op(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=xl(e.nextSibling),e===null))return null;return e}function Mh(e){return e.data==="$?"||e.data==="$~"}function Ah(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function _v(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function xl(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var zh=null;function Rp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return xl(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Dp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Uv(e,t){function a(){l=!0}if(e.ownerDocument.activeElement===e)return!0;var l=!1;try{e.ownerDocument.addEventListener("focus",a,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",a,!0)}return l}function qv(e){wp(function(){wp(function(t){return e(t)})})}function Bp(e,t,a){switch(t=Fr(a),e){case"html":if(e=t.documentElement,!e)throw Error(f(452));return e;case"head":if(e=t.head,!e)throw Error(f(453));return e;case"body":if(e=t.body,!e)throw Error(f(454));return e;default:throw Error(f(451))}}function Hp(e,t,a){for(var l in a){var i=a[l];a.hasOwnProperty(l)&&i!=null&&Yt(e,t,l,null,pv,i)}a.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===dn&&(e.onclick=null),Hi(e)}function $h(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Hi(e)}var wl=new Map,Lp=new Set;function Qr(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var mo=be.d;be.d={f:Vv,r:Gv,D:Yv,C:Xv,L:Kv,m:Zv,X:Qv,S:Fv,M:Pv};function Vv(){var e=mo.f(),t=bd();return e||t}function Gv(e){var t=as(e);t!==null&&t.tag===5&&t.type==="form"?Um(t):mo.r(e)}var Hc=typeof document>"u"?null:document;function _p(e,t,a){var l=Hc;if(l&&typeof t=="string"&&t){var i=ka(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),Lp.has(i)||(Lp.add(i),e={rel:e,crossOrigin:a,href:t},l.querySelector(i)===null&&(t=l.createElement("link"),ra(t,"link",e),zn(t),l.head.appendChild(t)))}}function Yv(e){mo.D(e),_p("dns-prefetch",e,null)}function Xv(e,t){mo.C(e,t),_p("preconnect",e,t)}function Kv(e,t,a){mo.L(e,t,a);var l=Hc;if(l&&e&&t){var i='link[rel="preload"][as="'+ka(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+ka(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+ka(a.imageSizes)+'"]')):i+='[href="'+ka(e)+'"]';var u=i;switch(t){case"style":u=Lc(e);break;case"script":u=_c(e)}if(!(wl.has(u)||(e=le({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),wl.set(u,e),l.querySelector(i)!==null||t==="style"&&l.querySelector(Pr(u))||t==="script"&&l.querySelector(Jr(u))))){var y=l.createElement("link");ra(y,"link",e),t==="style"&&(y[Rs]=!0,y.onload=y.onerror=function(){vu(y)}),zn(y),l.head.appendChild(y)}}}function Zv(e,t){mo.m(e,t);var a=Hc;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ka(l)+'"][href="'+ka(e)+'"]',u=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=_c(e)}if(!wl.has(u)&&(e=le({rel:"modulepreload",href:e},t),wl.set(u,e),a.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Jr(u)))return}l=a.createElement("link"),ra(l,"link",e),zn(l),a.head.appendChild(l)}}}function Fv(e,t,a){mo.S(e,t,a);var l=Hc;if(l&&e){var i=il(l).hoistableStyles,u=Lc(e);t=t||"default";var y=i.get(u);if(!y){var C={loading:0,preload:null};if(y=l.querySelector(Pr(u)))C.loading=5;else{e=le({rel:"stylesheet",href:e,"data-precedence":t},a),(a=wl.get(u))&&Oh(e,a);var O=y=l.createElement("link");zn(O),ra(O,"link",e),O._p=new Promise(function(V,J){O.onload=V,O.onerror=J}),O.addEventListener("load",function(){C.loading|=1}),O.addEventListener("error",function(){C.loading|=2}),C.loading|=4,kd(y,t,l)}y={type:"stylesheet",instance:y,count:1,state:C},i.set(u,y)}}}function Qv(e,t){mo.X(e,t);var a=Hc;if(a&&e){var l=il(a).hoistableScripts,i=_c(e),u=l.get(i);u||(u=a.querySelector(Jr(i)),u||(e=le({src:e,async:!0},t),(t=wl.get(i))&&Rh(e,t),u=a.createElement("script"),zn(u),ra(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(i,u))}}function Pv(e,t){mo.M(e,t);var a=Hc;if(a&&e){var l=il(a).hoistableScripts,i=_c(e),u=l.get(i);u||(u=a.querySelector(Jr(i)),u||(e=le({src:e,async:!0,type:"module"},t),(t=wl.get(i))&&Rh(e,t),u=a.createElement("script"),zn(u),ra(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(i,u))}}function Up(e,t,a,l){var i=(i=Vn.current)?Qr(i):null;if(!i)throw Error(f(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Lc(a.href),t=il(i).hoistableStyles,l=t.get(a),l||(l={type:"style",instance:null,count:0,state:null},t.set(a,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Lc(a.href);var u=il(i).hoistableStyles,y=u.get(e);if(y||(i=i.ownerDocument||i,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,y),(u=i.querySelector(Pr(e)))?u._p||(y.instance=u,y.state.loading=5):(u=wl.get(e),u||(u={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},wl.set(e,u)),Jv(i,e,u,y.state))),t&&l===null)throw Error(f(528,""));return y}if(t&&l!==null)throw Error(f(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(a=_c(a),t=il(i).hoistableScripts,l=t.get(a),l||(l={type:"script",instance:null,count:0,state:null},t.set(a,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,e))}}function Lc(e){return'href="'+ka(e)+'"'}function Pr(e){return'link[rel="stylesheet"]['+e+"]"}function qp(e){return le({},e,{"data-precedence":e.precedence,precedence:null})}function Jv(e,t,a,l){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Rs]!==!0){l.loading=1;return}}else t=e.createElement("link"),t[Rs]=!0,t.onload=t.onerror=vu.bind(null,t),ra(t,"link",a),zn(t),e.head.appendChild(t);l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2})}function _c(e){return'[src="'+ka(e)+'"]'}function Jr(e){return"script[async]"+e}function Vp(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ka(a.href)+'"]');if(l)return t.instance=l,zn(l),l;var i=le({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),zn(l),ra(l,"style",i),kd(l,a.precedence,e),t.instance=l;case"stylesheet":i=Lc(a.href);var u=e.querySelector(Pr(i));if(u)return t.state.loading|=4,t.instance=u,zn(u),u;l=qp(a),(i=wl.get(i))&&Oh(l,i),u=(e.ownerDocument||e).createElement("link"),zn(u);var y=u;return y._p=new Promise(function(C,O){y.onload=C,y.onerror=O}),ra(u,"link",l),t.state.loading|=4,kd(u,a.precedence,e),t.instance=u;case"script":return u=_c(a.src),(i=e.querySelector(Jr(u)))?(t.instance=i,zn(i),i):(l=a,(i=wl.get(u))&&(l=le({},a),Rh(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),zn(i),ra(i,"link",l),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(f(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,kd(l,a.precedence,e));return t.instance}function kd(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,u=i,y=0;y<l.length;y++){var C=l[y];if(C.dataset.precedence===t)u=C;else if(u!==i)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Oh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Rh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Td=null;function Gp(e,t,a){if(Td===null){var l=new Map,i=Td=new Map;i.set(a,l)}else i=Td,l=i.get(a),l||(l=new Map,i.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),i=0;i<a.length;i++){var u=a[i];if(!(u[ni]||u[it]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var y=u.getAttribute(t)||"";y=e+y;var C=l.get(y);C?C.push(u):l.set(y,[u])}}return l}function Dh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Iv(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Yp(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function Xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Kp(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Zp(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Kp(t),e.suspenseyImages.push(t)),e=tx.bind(e),t.decode().then(e,e))}function Wv(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=Lc(l.href),u=t.querySelector(Pr(i));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ir.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,zn(u);return}u=t.ownerDocument||t,l=qp(l),(i=wl.get(i))&&Oh(l,i),u=u.createElement("link"),zn(u);var y=u;y._p=new Promise(function(C,O){y.onload=C,y.onerror=O}),ra(u,"link",l),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Ir.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Cd=0;function ex(e,t){return e.stylesheets&&e.count===0&&Md(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Md(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Cd===0&&(Cd=62500*bv());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Md(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Cd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function Fp(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Md(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Ir(){this.count--,Fp(this)}function tx(){this.imgCount--,Fp(this)}var Ed=null;function Md(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ed=new Map,t.forEach(nx,e),Ed=null,Ir.call(e))}function nx(e,t){if(!(t.state.loading&4)){var a=Ed.get(e);if(a)var l=a.get(null);else{a=new Map,Ed.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<i.length;u++){var y=i[u];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),l=y)}l&&a.set(null,l)}i=t.instance,y=i.getAttribute("data-precedence"),u=a.get(y)||l,u===l&&a.set(null,i),a.set(y,i),this.count++,l=Ir.bind(this),i.addEventListener("load",l),i.addEventListener("error",l),u?u.parentNode.insertBefore(i,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Uc={$$typeof:et,Provider:null,Consumer:null,_currentValue:_t,_currentValue2:_t,_threadCount:0};function ax(e,t,a,l,i,u,y,C,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=za(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=za(0),this.hiddenUpdates=za(null),this.identifierPrefix=l,this.onUncaughtError=i,this.onCaughtError=u,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.transitionTypes=null,this.incompleteTransitions=new Map}function Qp(e,t,a,l,i,u,y,C,O,V,J,oe){return e=new ax(e,t,a,y,O,V,J,oe,C),t=1,u===!0&&(t|=24),u=$n(3,null,null,t),e.current=u,u.stateNode=e,t=Sr(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:a,cache:t},dc(u),e}function Pp(e){return e?(e=Fs,e):Fs}function Jp(e,t,a,l,i,u){i=Pp(i),l.context===null?l.context=i:l.pendingContext=i,l=In(t),l.payload={element:a},u=u===void 0?null:u,u!==null&&(l.callback=u),a=Qa(e,l,t),a!==null&&(Ua(a,e,t),so(a,e,t))}function Ip(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Bh(e,t){Ip(e,t),(e=e.alternate)&&Ip(e,t)}function Wp(e){if(e.tag===13||e.tag===31){var t=rs(e,67108864);t!==null&&Ua(t,e,67108864),Bh(e,67108864)}}function ey(e){if(e.tag===13||e.tag===31){var t=el();t=ht(t);var a=rs(e,t);a!==null&&Ua(a,e,t),Bh(e,t)}}var qc=!0;function lx(e,t,a,l){var i=de.T;de.T=null;var u=be.p;try{be.p=2,Hh(e,t,a,l)}finally{be.p=u,de.T=i}}function sx(e,t,a,l){var i=de.T;de.T=null;var u=be.p;try{be.p=8,Hh(e,t,a,l)}finally{be.p=u,de.T=i}}function Hh(e,t,a,l){if(qc){var i=Lh(l);if(i===null)bh(e,t,l,Ad,a),ny(e,l);else if(ix(i,e,t,a,l))l.stopPropagation();else if(ny(e,l),t&4&&-1<ox.indexOf(e)){for(;i!==null;){var u=as(i);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var y=en(u.pendingLanes);if(y!==0){var C=u;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var O=1<<31-cn(y);C.entanglements[1]|=O,y&=~O}Es(u),(Dt&6)===0&&(gd=tt()+500,Xr(0))}}break;case 31:case 13:C=rs(u,2),C!==null&&Ua(C,u,2),bd(),Bh(u,2)}if(u=Lh(l),u===null&&bh(e,t,l,Ad,a),u===i)break;i=u}i!==null&&l.stopPropagation()}else bh(e,t,l,null,a)}}function Lh(e){return e=ln(e),_h(e)}var Ad=null;function _h(e){if(Ad=null,e=ns(e),e!==null){var t=g(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=v(t),e!==null)return e;e=null}else if(a===31){if(e=S(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ad=e,null}function ty(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(wt()){case Ct:return 2;case Nt:return 8;case ll:case sl:return 32;case po:return 268435456;default:return 32}default:return 32}}var Uh=!1,Ko=null,Zo=null,Fo=null,Wr=new Map,eu=new Map,Qo=[],ox="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ny(e,t){switch(e){case"focusin":case"focusout":Ko=null;break;case"dragenter":case"dragleave":Zo=null;break;case"mouseover":case"mouseout":Fo=null;break;case"pointerover":case"pointerout":Wr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":eu.delete(t.pointerId)}}function tu(e,t,a,l,i,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:u,targetContainers:[i]},t!==null&&(t=as(t),t!==null&&Wp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function ix(e,t,a,l,i){switch(t){case"focusin":return Ko=tu(Ko,e,t,a,l,i),!0;case"dragenter":return Zo=tu(Zo,e,t,a,l,i),!0;case"mouseover":return Fo=tu(Fo,e,t,a,l,i),!0;case"pointerover":var u=i.pointerId;return Wr.set(u,tu(Wr.get(u)||null,e,t,a,l,i)),!0;case"gotpointercapture":return u=i.pointerId,eu.set(u,tu(eu.get(u)||null,e,t,a,l,i)),!0}return!1}function ay(e){var t=ns(e.target);if(t!==null){var a=g(t);if(a!==null){if(t=a.tag,t===13){if(t=v(a),t!==null){e.blockedOn=t,na(e.priority,function(){ey(a)});return}}else if(t===31){if(t=S(a),t!==null){e.blockedOn=t,na(e.priority,function(){ey(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Lh(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);_s=l,a.target.dispatchEvent(l),_s=null}else return t=as(a),t!==null&&Wp(t),e.blockedOn=a,!1;t.shift()}return!0}function ly(e,t,a){zd(e)&&a.delete(t)}function cx(){Uh=!1,Ko!==null&&zd(Ko)&&(Ko=null),Zo!==null&&zd(Zo)&&(Zo=null),Fo!==null&&zd(Fo)&&(Fo=null),Wr.forEach(ly),eu.forEach(ly)}function $d(e,t){e.blockedOn===t&&(e.blockedOn=null,Uh||(Uh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cx)))}var Od=null;function sy(e){Od!==e&&(Od=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Od===e&&(Od=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],i=e[t+2];if(typeof l!="function"){if(_h(l||a)===null)continue;break}var u=as(a);u!==null&&(e.splice(t,3),t-=3,wf(u,{pending:!0,data:i,method:a.method,action:l},l,i))}}))}function Vc(e){function t(O){return $d(O,e)}Ko!==null&&$d(Ko,e),Zo!==null&&$d(Zo,e),Fo!==null&&$d(Fo,e),Wr.forEach(t),eu.forEach(t);for(var a=0;a<Qo.length;a++){var l=Qo[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Qo.length&&(a=Qo[0],a.blockedOn===null);)ay(a),a.blockedOn===null&&Qo.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var i=a[l],u=a[l+1],y=i[yn]||null;if(typeof u=="function")y||sy(a);else if(y){var C=null;if(u&&u.hasAttribute("formAction")){if(i=u,y=u[yn]||null)C=y.formAction;else if(_h(i)!==null)continue}else C=y.action;typeof C=="function"?a[l+1]=C:(a.splice(l,3),l-=3),sy(a)}}}function oy(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(y){return i=y})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function qh(e){this._internalRoot=e}Rd.prototype.render=qh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(f(409));var a=t.current,l=el();Jp(a,l,e,t,null,null)},Rd.prototype.unmount=qh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Jp(e.current,2,null,e,null,null),bd(),t[Os]=null}};function Rd(e){this._internalRoot=e}Rd.prototype.unstable_scheduleHydration=function(e){if(e){var t=rn();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Qo.length&&t!==0&&t<Qo[a].priority;a++);Qo.splice(a,0,e),a===0&&ay(e)}};var iy=o.version;if(iy!=="19.3.0")throw Error(f(527,iy,"19.3.0"));be.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(f(188)):(e=Object.keys(e).join(","),Error(f(268,e)));return e=E(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var rx={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:de,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Dd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Dd.isDisabled&&Dd.supportsFiber)try{ol=Dd.inject(rx),ta=Dd}catch{}}return au.createRoot=function(e,t){if(!m(e))throw Error(f(299));var a=!1,l="",i=Pm,u=Jm,y=Im;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Qp(e,1,!1,null,null,a,l,null,i,u,y,oy),e[Os]=t.current,yh(e),new qh(t)},au.hydrateRoot=function(e,t,a){if(!m(e))throw Error(f(299));var l=!1,i="",u=Pm,y=Jm,C=Im,O=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(i=a.identifierPrefix),a.onUncaughtError!==void 0&&(u=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError),a.formState!==void 0&&(O=a.formState)),t=Qp(e,1,!0,t,a??null,l,i,O,u,y,C,oy),t.context=Pp(null),a=t.current,l=el(),l=ht(l),i=In(l),i.callback=null,Qa(a,i,l),a=l,t.current.lanes=a,A(t,a),Es(t),e[Os]=t.current,yh(e),new Rd(t)},au.version="19.3.0",au}var by;function xx(){if(by)return Yh.exports;by=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),Yh.exports=vx(),Yh.exports}var wx=xx();const Nm=Math.random().toString(36).slice(2),tf=(()=>{try{let n=localStorage.getItem("design-canvas:browser");return n||localStorage.setItem("design-canvas:browser",n=Math.random().toString(36).slice(2)),n}catch{return Nm}})();let Pd="";const jx=n=>void(Pd=n),Bd=()=>({"X-Easel-Client":tf,...Pd?{"X-Easel-Author":encodeURIComponent(Pd)}:{}});async function Oi(n){const o=await n.json().catch(()=>({}));if(!n.ok)throw Object.assign(new Error(o.error??n.statusText),{status:n.status,body:o});return o}const Te={board:()=>fetch("/api/board").then(n=>Oi(n)),update:()=>fetch("/api/update").then(n=>Oi(n)),saveBoard:(n,o)=>fetch("/api/board",{method:"PUT",headers:{"Content-Type":"application/json",...Bd()},body:JSON.stringify({...n,clientId:Nm,...o?{label:o}:{}})}).then(r=>Oi(r)),post:(n,o)=>fetch(n,{method:"POST",headers:{"Content-Type":"application/json",...Bd()},body:JSON.stringify(o)}).then(r=>Oi(r)),put:(n,o)=>fetch(n,{method:"PUT",headers:{"Content-Type":"application/json",...Bd()},body:JSON.stringify(o)}).then(r=>Oi(r)),get:n=>fetch(n).then(o=>Oi(o)),blob:(n,o)=>fetch(n,{method:"POST",headers:{"Content-Type":"application/json",...Bd()},body:JSON.stringify(o)}).then(r=>r.ok?r.blob():Oi(r))};let ou=null,um=null;function rb(n){um=n,(ou==null?void 0:ou.readyState)===1&&ou.send(JSON.stringify({type:"editing",file:n,client:tf,person:Pd||void 0}))}function Nx(n){let o=null,r=!1;const f=()=>{o=ou=new WebSocket(`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`),o.onopen=()=>um&&rb(um),o.onmessage=m=>{try{n(JSON.parse(m.data))}catch{}},o.onclose=()=>{r||setTimeout(f,1e3)}};return f(),()=>{r=!0,o==null||o.close()}}function nl(n){const o=n.ownerDocument,r=[];let f=n;for(;f&&f!==o.body;){const m=f.parentElement;if(!m)return null;r.unshift(Array.prototype.indexOf.call(m.children,f)),f=m}return f===o.body?r.join("/"):null}function An(n,o){let r=n.body;if(!o)return r;for(const f of o.split("/"))if(r=(r==null?void 0:r.children[Number(f)])??null,!r)return null;return r}function As(n){const o=n.getBoundingClientRect();return{x:o.left,y:o.top,w:o.width,h:o.height}}const Sx=["width","height","padding","margin","gap","font-family","font-size","font-weight","color","background-color","border-radius","display","flex-direction","align-items","justify-content","line-height","text-align","border","box-shadow","opacity","flex-wrap","flex-grow","align-self","grid-template-columns","grid-template-rows","position","background-image"];function kx(n){const o=n.ownerDocument.defaultView.getComputedStyle(n),r={};for(const f of Sx)r[f]=o.getPropertyValue(f);return r}function vy(n){const o={},r=n.style;if(!r)return o;for(let f=0;f<r.length;f++)o[r[f]]=r.getPropertyValue(r[f]);return o}function Tx(n,o,r,f){const m=f.replace(/\s+/g," ").trim().slice(0,40);return`${n} ${o} ${m?`"${m}" `:""}(${r})`}const Cx={board:{d:"M3 4.5H15A0.5 0.5 0 0 1 15.5 5V13A0.5 0.5 0 0 1 15 13.5H3A0.5 0.5 0 0 1 2.5 13V5A0.5 0.5 0 0 1 3 4.5ZM3 7.5H15"},compare:{d:"M3 4.5H7A0.5 0.5 0 0 1 7.5 5V13A0.5 0.5 0 0 1 7 13.5H3A0.5 0.5 0 0 1 2.5 13V5A0.5 0.5 0 0 1 3 4.5ZM3 7.5H7M11 4.5H15A0.5 0.5 0 0 1 15.5 5V13A0.5 0.5 0 0 1 15 13.5H11A0.5 0.5 0 0 1 10.5 13V5A0.5 0.5 0 0 1 11 4.5ZM11 7.5H15"},fit:{d:"M2.5 6V2.5H6M12 2.5H15.5V6M15.5 12V15.5H12M6 15.5H2.5V12"},focus:{d:"M2.5 6V2.5H6M12 2.5H15.5V6M15.5 12V15.5H12M6 15.5H2.5V12M6 6.5H12A0.5 0.5 0 0 1 12.5 7V11A0.5 0.5 0 0 1 12 11.5H6A0.5 0.5 0 0 1 5.5 11V7A0.5 0.5 0 0 1 6 6.5Z"},panel:{d:"M3 3.5H15A0.5 0.5 0 0 1 15.5 4V14A0.5 0.5 0 0 1 15 14.5H3A0.5 0.5 0 0 1 2.5 14V4A0.5 0.5 0 0 1 3 3.5ZM6.5 3.5V14.5"},panelRight:{d:"M3 3.5H15A0.5 0.5 0 0 1 15.5 4V14A0.5 0.5 0 0 1 15 14.5H3A0.5 0.5 0 0 1 2.5 14V4A0.5 0.5 0 0 1 3 3.5ZM11.5 3.5V14.5"},canvas:{d:"M3 2.5H7A0.5 0.5 0 0 1 7.5 3V7A0.5 0.5 0 0 1 7 7.5H3A0.5 0.5 0 0 1 2.5 7V3A0.5 0.5 0 0 1 3 2.5ZM11 2.5H15A0.5 0.5 0 0 1 15.5 3V7A0.5 0.5 0 0 1 15 7.5H11A0.5 0.5 0 0 1 10.5 7V3A0.5 0.5 0 0 1 11 2.5ZM3 10.5H7A0.5 0.5 0 0 1 7.5 11V15A0.5 0.5 0 0 1 7 15.5H3A0.5 0.5 0 0 1 2.5 15V11A0.5 0.5 0 0 1 3 10.5ZM11 10.5H15A0.5 0.5 0 0 1 15.5 11V15A0.5 0.5 0 0 1 15 15.5H11A0.5 0.5 0 0 1 10.5 15V11A0.5 0.5 0 0 1 11 10.5Z"},copy:{d:"M3 2.5H9A0.5 0.5 0 0 1 9.5 3V9A0.5 0.5 0 0 1 9 9.5H3A0.5 0.5 0 0 1 2.5 9V3A0.5 0.5 0 0 1 3 2.5ZM9 8.5H15A0.5 0.5 0 0 1 15.5 9V15A0.5 0.5 0 0 1 15 15.5H9A0.5 0.5 0 0 1 8.5 15V9A0.5 0.5 0 0 1 9 8.5Z"},front:{d:"M8 7.5H15A0.5 0.5 0 0 1 15.5 8V15A0.5 0.5 0 0 1 15 15.5H8A0.5 0.5 0 0 1 7.5 15V8A0.5 0.5 0 0 1 8 7.5Z",cells:"M5 10h1v1h-1zM4 10h1v1h-1zM2 10h1v1h-1zM2 9h1v1h-1zM2 7h1v1h-1zM2 6h1v1h-1zM2 4h1v1h-1zM2 3h1v1h-1zM3 2h1v1h-1zM4 2h1v1h-1zM6 2h1v1h-1zM7 2h1v1h-1zM9 2h1v1h-1zM10 2h1v1h-1zM10 4h1v1h-1zM10 5h1v1h-1z"},back:{d:"M3 2.5H10A0.5 0.5 0 0 1 10.5 3V10A0.5 0.5 0 0 1 10 10.5H3A0.5 0.5 0 0 1 2.5 10V3A0.5 0.5 0 0 1 3 2.5Z",cells:"M12 7h1v1h-1zM13 7h1v1h-1zM15 7h1v1h-1zM15 8h1v1h-1zM15 10h1v1h-1zM15 11h1v1h-1zM15 13h1v1h-1zM15 14h1v1h-1zM14 15h1v1h-1zM13 15h1v1h-1zM11 15h1v1h-1zM10 15h1v1h-1zM8 15h1v1h-1zM7 15h1v1h-1zM7 13h1v1h-1zM7 12h1v1h-1z"},sticky:{d:"M3.5 3.5H14.5V11.5L11.5 14.5H3.5ZM11.5 14.5V11.5H14.5"},file:{d:"M4.5 2.5H10.5L13.5 5.5V15.5H4.5ZM10.5 2.5V5.5H13.5"},pdf:{d:"M4.5 2.5H10.5L13.5 5.5V15.5H4.5ZM10.5 2.5V5.5H13.5M7 9.5H11M7 12.5H10"},folder:{d:"M2.5 14.5V3.5H7.5V5.5H15.5V14.5Z"},select:{d:"M4.5 3V14L7.6 11.2L9.8 15L11.4 14.1L9.3 10.4H13Z"},hand:{d:"M6.5 10V4.5a1 1 0 0 1 2 0V9V3a1 1 0 0 1 2 0V9V4a1 1 0 0 1 2 0V9.5V6a1 1 0 0 1 2 0V11a4.5 4.5 0 0 1-4.5 4.5H9.5a4 4 0 0 1-3-1.4L3.5 10.5L5 9.5L6.5 11"},title:{d:"M3 3.5H14M8.5 3.5V15"},bold:{d:"M5.5 3.5H9.5a2.5 2.5 0 0 1 0 5H5.5ZM5.5 8.5H10.5a3 3 0 0 1 0 6H5.5Z"},italic:{d:"M8 3.5H14M4 14.5H10M11.5 3.5L6.5 14.5"},textLeft:{d:"M3 5.5H15M3 9.5H11M3 13.5H13"},textCenter:{d:"M3 5.5H15M5 9.5H13M4 13.5H14"},textRight:{d:"M3 5.5H15M7 9.5H15M5 13.5H15"},underline:{d:"M5.5 2.5V8a3.5 3.5 0 0 0 7 0V2.5M3 15.5H15"},rect:{d:"M3 5.5H15A0.5 0.5 0 0 1 15.5 6V12A0.5 0.5 0 0 1 15 12.5H3A0.5 0.5 0 0 1 2.5 12V6A0.5 0.5 0 0 1 3 5.5Z"},oval:{d:"M9 4.5c3.6 0 6.5 2 6.5 4.5S12.6 13.5 9 13.5 2.5 11.5 2.5 9 5.4 4.5 9 4.5Z"},line:{d:"M3.5 14.5L14.5 3.5"},arrow:{d:"M3.5 14.5L14.5 3.5M9.5 3.5H14.5V8.5"},pen:{d:"M2.5 12.5C4.5 6.5 5.8 5 7 5c2 0 .5 7 3 7c1.6 0 2.8-2.2 5-6.5"},image:{d:"M3 3.5H15A0.5 0.5 0 0 1 15.5 4V14A0.5 0.5 0 0 1 15 14.5H3A0.5 0.5 0 0 1 2.5 14V4A0.5 0.5 0 0 1 3 3.5ZM2.5 13.5L6.5 9.5L10 13L12 11L15.5 14.5"},person:{d:"M9 8.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM3.5 15.5c.6-3 2.8-4.5 5.5-4.5s4.9 1.5 5.5 4.5"},ai:{d:"M3.5 4.5L8 9L3.5 13.5M9 13.5H15"},comment:{d:"M2.5 3.5H15.5V12.5H7.5L4.5 15.5V12.5H2.5Z"},undo:{d:"M6.5 3.5L3.5 6.5L6.5 9.5M3.5 6.5H11a3.5 3.5 0 0 1 0 7H7.5"},redo:{d:"M11.5 3.5L14.5 6.5L11.5 9.5M14.5 6.5H7a3.5 3.5 0 0 0 0 7h3.5"},share:{d:"M8.5 3V12M5.5 5.5L8.5 2.5L11.5 5.5M3.5 9.5V15.5H13.5V9.5"},download:{d:"M8.5 2.5V11.5M5.5 8.5L8.5 11.5L11.5 8.5M3.5 9.5V15.5H13.5V9.5"},expand:{d:"M10.5 2.5H15.5V7.5M15.5 2.5L10.5 7.5M7.5 15.5H2.5V10.5M2.5 15.5L7.5 10.5"},sliders:{d:"M2 5.5H10M13 5.5H16M11 3.5H12A0.5 0.5 0 0 1 12.5 4V7A0.5 0.5 0 0 1 12 7.5H11A0.5 0.5 0 0 1 10.5 7V4A0.5 0.5 0 0 1 11 3.5ZM2 12.5H5M8 12.5H16M6 10.5H7A0.5 0.5 0 0 1 7.5 11V14A0.5 0.5 0 0 1 7 14.5H6A0.5 0.5 0 0 1 5.5 14V11A0.5 0.5 0 0 1 6 10.5Z"},restore:{d:"M10.5 4.5A5 5 0 1 1 5.5 9.5V7.5M2.5 10.5L5.5 7.5L8.5 10.5"},parent:{d:"M13.5 14.5H7.5V3M4.5 5.5L7.5 2.5L10.5 5.5"},link:{d:"M7.5 11.5H5.5a3 3 0 0 1 0-6h2M10.5 5.5h2a3 3 0 0 1 0 6h-2M6 8.5H12"},chevronDown:{d:"M5.5 7L9 10.5L12.5 7"},chevronRight:{d:"M7 5.5L10.5 9L7 12.5"},chevronLeft:{d:"M11 5.5L7.5 9L11 12.5"},lock:{d:"M5 8.5H13A0.5 0.5 0 0 1 13.5 9V15A0.5 0.5 0 0 1 13 15.5H5A0.5 0.5 0 0 1 4.5 15V9A0.5 0.5 0 0 1 5 8.5ZM6.5 8V5.5a2.5 2.5 0 0 1 5 0V8"},edit:{d:"M3.5 14.5V11.5L11.5 3.5L14.5 6.5L6.5 14.5ZM9.5 5.5L12.5 8.5"},radius:{d:"M3.5 15V9.5a6 6 0 0 1 6-6H15"},spacing:{d:"M2.5 3V15M15.5 3V15M5 8.5H13"},alignLeft:{d:"M2.5 2V16M5 5.5H15M5 11.5H11"},alignHcenter:{d:"M8.5 2V16M3 5.5H15M5 11.5H13"},alignRight:{d:"M15.5 2V16M3 5.5H13M7 11.5H13"},alignTop:{d:"M2 2.5H16M5.5 5V15M11.5 5V11"},alignVcenter:{d:"M2 8.5H16M5.5 3V15M11.5 5V13"},alignBottom:{d:"M2 15.5H16M5.5 3V13M11.5 7V13"},search:{d:"M8 13.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11ZM12 12L15.5 15.5"},plus:{d:"M3 8.5H15M8.5 3V15"},minus:{d:"M3 8.5H15"},close:{d:"M4.5 4.5L13.5 13.5M13.5 4.5L4.5 13.5"},check:{d:"M3.5 9.5L7 13L14.5 5.5"},warn:{d:"M9 3.5L15 14.5H3ZM8.5 7V11",fill:"M8 12h1v1h-1z"},info:{d:"M9 15.5a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13ZM8.5 8V13",fill:"M8 5h1.5v1.5h-1.5z"},more:{d:"",fill:"M4 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM9 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM14 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},trash:{d:"M2 4.5H16M6.5 4V2.5H11.5V4M4.5 5V14.5A1 1 0 0 0 5.5 15.5H12.5A1 1 0 0 0 13.5 14.5V5"},play:{d:"M5.5 3.5V14.5L14.5 9Z"},stop:{d:"M5 4.5H13A0.5 0.5 0 0 1 13.5 5V13A0.5 0.5 0 0 1 13 13.5H5A0.5 0.5 0 0 1 4.5 13V5A0.5 0.5 0 0 1 5 4.5Z"},clock:{d:"M9 15.5a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13ZM8.5 5V9.5H12"},eye:{d:"M2.5 9c1.9-3.2 4-4.5 6.5-4.5s4.6 1.3 6.5 4.5c-1.9 3.2-4 4.5-6.5 4.5S4.4 12.2 2.5 9ZM9 11a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}},Ex=n=>n>=28?36:n>=15?18:14;function Q({name:n,size:o=18,...r}){const f=Ex(o),m=Cx[n];return s.jsxs("svg",{width:f,height:f,viewBox:f===14?"2 2 14 14":"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,"aria-hidden":"true",...r,children:[m.d&&s.jsx("path",{d:m.d}),m.cells&&s.jsx("path",{d:m.cells,fill:"currentColor",stroke:"none"}),m.fill&&s.jsx("path",{d:m.fill,fill:"currentColor",stroke:"none"})]})}const Aa=(n,o,r)=>n===1?`1 ${o}`:`${n} ${r}`,Fh=n=>Aa(n,"variant","variants"),Mx={button:"Button",a:"Link",img:"Image",input:"Field",textarea:"Field",select:"Menu",label:"Label",p:"Paragraph",span:"Text",li:"List item",ul:"List",ol:"List",nav:"Navigation",header:"Header",footer:"Footer",main:"Main",section:"Section",form:"Form",svg:"Icon",style:"Styles",script:"Script"},xy=(n,o)=>Mx[n??""]??(/^h[1-6]$/.test(n??"")?"Heading":o?`.${o}`:n?`<${n}>`:"Element"),Ax={app:{title:"Easel",docTitle:n=>`${n} — Easel`,loadFailed:"Couldn't load:",retry:"Try again",crashed:"The canvas hit an error and stopped:",reload:"Reload",loadingBoards:"Loading boards…",loading:"Loading…",emptyPage:"This page is empty",drawBoard:"Draw board",defaultAuthor:"Me",tokensAside:"Design tokens",assetsAside:"Assets",inspectorAside:"Inspector",navigation:"Navigation",announceBoard:(n,o,r)=>`${n} selected, ${o}/${r}. Enter to select inside`,firstRunEdit:"Click anything on a board to select it · double-click text to edit it",firstRunAi:n=>`Press ${n}J to ask the AI for a change`,cleanOn:"Clean view: only the canvas. Press Esc to bring the tools back",cleanOff:"Tools are back"},templates:{blank:"Blank",mobile:"Mobile screen",desktop:"Desktop screen",doc:"Document",tablet:"Tablet screen",watch:"Watch screen",email:"Email"},tools:{select:"Select",hand:"Hand",board:"Draw board",title:"Title",sticky:"Note",rect:"Rectangle",oval:"Oval",line:"Line",arrow:"Arrow",pen:"Pen"},toolHints:{select:"Select and move boards",hand:"Drag to pan the canvas",board:"Drag to draw a board",title:"Click to add a title",sticky:"Click to add a sticky note",rect:"Drag to draw a rectangle",oval:"Drag to draw an oval",line:"Drag to draw a line",arrow:"Drag to draw an arrow",pen:"Drag to draw freehand"},toolbar:{aria:"Tools",leftPanel:"Left panel",leftPanelTitle:n=>`Left panel (${n}\\)`,canvasTools:"Canvas tools",shapes:"Shapes",tool:(n,o)=>`${n} (${o})`,shapeToolTitle:(n,o)=>`${n} (${o}) · Shift for square or circle`,insertImage:"Insert image",insertImageTitle:"Insert image (you can also paste onto the canvas)",undo:"Undo",redo:"Redo",undoTitle:(n,o)=>n?`Undo: ${n} (${o}Z)`:`Undo (${o}Z)`,redoTitle:(n,o)=>n?`Redo: ${n} (⇧${o}Z)`:`Redo (⇧${o}Z)`,newBoard:"New board",newBoardTitle:"New board (choose a template)",themeTitle:"Design system theme (used by swatches, token check and AI)",theme:"Theme",themeOption:n=>`Theme: ${n}`,snapshot:"Snapshot (git)",snapshotTitle:"Snapshot: save the design folder as a git commit",erroredBoards:"Boards with errors",erroredBoardsN:n=>`Boards with errors ${n}`,errors:n=>`Errors ${n}`,zoomOut:"Zoom out",zoomOutTitle:n=>`Zoom out (${n}-)`,zoomIn:"Zoom in",zoomInTitle:n=>`Zoom in (${n}+)`,zoom100:"Zoom to 100%",zoom100Title:n=>`Zoom to 100% (${n}0)`,fitAll:"Fit all",fitAllTitle:"Fit all (⇧1)",aiChat:"AI chat",askAi:"Ask AI",aiChatTitle:n=>`AI chat (${n}J)`,guides:"Show layout guides",guidesTitle:"Show layout guides (⌃G)",appearance:n=>`Appearance: ${n==="system"?"System":n==="light"?"Light":"Dark"}`,appearanceTitle:n=>`Appearance: ${n==="system"?"Follow system":n==="light"?"Light":"Dark"} (click to change)`,minimap:"Minimap",minimapTitle:"Minimap (M)",viewMenu:"View",viewMenuTitle:"View: guides, minimap, appearance, theme, language, snapshot",viewMenuTitleNarrow:"View: zoom, history, guides, minimap, appearance, language, snapshot",language:n=>`Language: ${n}`,project:"Project",history:"History",cleanView:"Clean view",showTools:"Show tools",showToolsTitle:n=>`Show tools (Esc or ⇧${n}\\)`,canvasHints:"Canvas hints",comments:"Comments",commentsTitle:n=>n?`Comments, ${n} open`:"Comments",boardsPanel:"Boards, assets, tokens",viewToggle:"View",viewCanvas:"Canvas",viewPrototype:"Prototype",viewPrototypeTitle:"Prototype (F)",play:"Play",playTitle:"Play (full screen)",panelToggle:"Properties panel",panelToggleTitle:n=>`Properties panel (${n}\\)`,zoomMenu:n=>`Zoom ${n}%`,zoomToSelection:"Zoom to selection",zoomNow:n=>`Now ${n}%`,layoutGuides:"Layout guides",pageCount:n=>`${n} pages`,copyPageLink:"Copy page link",copyLink:"Copy link",restart:"Restart",shortcuts:"Keyboard shortcuts",projectMenu:n=>`${n}: project menu`,shareMenu:"Share…",otherProjects:"Running projects",protoMore:"More",playMenu:"Play",protoHeading:"Prototypes",staticHeading:"Static boards",noBoards:"No boards",protoBoard:n=>`Board: ${n}. Switch board`,protoBoards:"Boards",prevBoard:"Previous board (←)",nextBoard:"Next board (→)"},tabs:{left:"Left panel",boards:"Boards",assets:"Assets",tokens:"Tokens",right:"Right panel",closePanel:"Close panel",properties:"Properties",ai:"AI",code:"Code",tweaks:"Tweaks",layers:"Layers",codeEmpty:"Pick an element to edit its code",tweaksEmpty:"No adjustable values yet. Ask the AI to add some"},boardList:{aria:"Pages and boards",pages:"Pages",addPage:"Add page",newPage:"New page",pageSwitch:n=>`Page: ${n}. Switch page`,pageMore:n=>`More for ${n}`,singlePage:"Viewing everything as one page. Use + to split it into pages.",pageTabTitle:"Drag to reorder · right-click to rename or delete",boardsHead:"Boards",searchPlaceholder:"Find boards (⌘K)",search:"Find boards",noMatch:n=>`No boards match "${n}". Try part of the file name.`,emptyPage:"No boards on this page yet. Press B and drag on the canvas to draw one.",fileMissing:"File missing",otherGroup:"Other",mainPage:"Main",groupTitle:n=>`${Aa(n,"board","boards")} · click to collapse or expand · double-click to rename`,groupMenu:"Group menu"},minimap:{aria:"Minimap: click to move there"},sections:{board:"Board",comments:"Comments",guides:"Layout guides",tweaks:"Adjustable values",tokenCheck:"Token check",a11y:"Accessibility",checks:"Checks",properties:"Properties",layers:"Layers"},boardOptions:{print:"Print",printMode:"Pages",printModes:{continuous:"Continuous",fixed:"Paper"},paper:"Paper size",papers:{letter:"Letter",a4:"A4"},bg:"Background",bgNone:"None",aria:"Board options",positionAndSize:"Position and size",position:"Position",size:"Size",options:"Options",renameTitle:"Rename (F2)",renameFileTitle:"Rename file",width:"Width",height:"Height",radius:"Radius",interactive:"Show Play button",interactiveTitle:"Keeps the ▶ on the board's label always visible, with a dot. Without it the ▶ shows when the board is selected or hovered; any board plays with P or right-click",frameless:"No frame",fill:"Stretch to window",launch:"Open as launch screen",page:"Page",focus:"Focus view",focusTitle:"Focus view (F)",front:"Bring to front",frontTitle:"Bring to front (⌘])",back:"Send to back",backTitle:"Send to back (⌘[)",duplicate:"Duplicate",duplicateTitle:"Duplicate (⌘D)",delete:"Delete",deleteTitle:"Delete (Delete)",selectedN:n=>`${Aa(n,"board","boards")} selected`,frontTitleMod:n=>`Bring to front (${n}])`,backTitleMod:n=>`Send to back (${n}[)`,goToSelected:"Go to selected boards",goToSelectedTitle:"Go to selected boards (⇧2)",deleteTitleKey:"Delete (⌫)"},full:{aria:n=>`${n}, full window`,back:"Back to the canvas (Esc)",fill:"Fill",fillTitle:"Fill the window",fit:"Fit",fitTitle:"The board's own size, scaled down to fit",mode:"Size"},focus:{aria:n=>`${n} focus view`,prev:"Previous board",next:"Next board",pageStyle:" · page-style",close:"Close"},play:{back:"Back",forward:"Forward",viewOnCanvas:"View on canvas",closeTitle:"Close (Esc)",close:"Close"},share:{button:"Share",buttonTitle:"Share a view-only copy (web folder, single file, PDF or PNG)",title:"Share a view-only copy",scope:"What to export",whole:"Whole canvas",page:"This page",pageNone:"This canvas has one page",selected:n=>`Selected boards (${n})`,webTitle:"Web folder",webHint:"Static files. Host on Vercel, GitHub Pages or a PR preview.",singleTitle:"Single file",singleHint:n=>` · ${n} · opens in any browser, no hosting`,singleSwitch:"One .html file",measuring:"measuring…",pdfTitle:"PDF",pdfHint:"One board per page",pngTitle:"PNG",pngHint:"One image per board, 2×",export:"Export",save:"Save",working:"Exporting…",exported:"exported",saved:"saved",reveal:"Reveal",revealTitle:"Show the folder in your file manager",copyDeploy:"Copy deploy command",copyDeployTitle:n=>`Copies ${n} (run it in the project folder)`,copied:n=>`Copied: ${n}`,copyFailed:"Couldn't copy to the clipboard",attachHint:"Attach it to Slack, email or a PR.",skipped:n=>`${n} reference${n===1?"":"s"} could not be included`,largeFiles:"Large canvases make large files. No live updates.",sameAs:"Same as:",unavailable:"Unavailable here."},viewer:{docTitle:n=>`${n} — view only`,noData:"This page is an Easel export, but its data is missing (easel-viewer/data.js).",bar:"Viewer",pages:"Pages",play:"Play",playTitle:"Try the selected board full screen (or the first one)",stamp:n=>`View only · exported ${n}`,stampTitle:"A read-only copy. Changes happen in the design files, then export again.",madeWith:"Made with Easel",comments:"Comments",commentsN:n=>`Comments ${n}`,noComments:"No comments",replies:n=>n===1?"1 reply":`${n} replies`,pin:(n,o)=>`Comment ${n} by ${o}`,threadOf:(n,o)=>`${n} of ${o}`,closeThread:"Close comment",boardsPanel:"Boards",commentsPanel:"Comments panel",empty:"Nothing on this page",embedGate:"Use the canvas: pan, zoom, open a board, press Play. Esc gives the page back.",embedHint:"Click the canvas to pan and zoom",embedHintLive:"Esc or a click outside gives the page back"},canvas:{aria:"Design canvas",board:(n,o,r,f)=>`Board ${n}${o?" (selected)":""}${r?" editing":""}${f?" playing":""}`,interactive:"Marked as playable",hint:"Click selects · Double-click edits text · Esc deselects",notLoaded:"Scroll closer to load",fileMissing:n=>`File missing · ${n}`,playing:"▶ Playing · Esc",exportingPng:"Exporting PNG…",play:"Play",playTitle:"Play (P)",stopPlay:"Stop Play",stopPlayTitle:"Stop Play (P or Esc)",playShort:"Play",edit:"Edit",exportBoard:"Export this board (PNG)",fullWindow:"Open in full window",tweaks:"This board's adjustable values",boardSize:"Board size",titleMaxWidth:"Max width",stickySize:"Sticky note size",deleteNote:"Delete note"},editMode:{fileChanged:"Someone changed this file first. Select the element again."},elementDrag:{moveAria:"Move element (Alt: into the hovered box)",moveTitle:"Drag to move · hold Alt to drop into the hovered box",width:"Width",height:"Height",size:"Size"},extra:{letterSpacing:"Letter spacing",size:"Size",width:"Width",height:"Height",fixed:"Fixed",hug:"Hug",fill:"Fill",mode:n=>`${n} mode`,position:"Position",flow:"Normal flow",absolute:"Absolute",look:"Appearance",opacity:"Opacity",border:"Border",borderStyles:{none:"None",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},shadow:"Shadow",shadows:{none:"None",small:"Small",medium:"Medium",large:"Large",custom:"Custom"},link:"Link",href:"Address",newTab:"New tab",export:"Export",exportPng:"PNG 2×",exporting:"Exporting…"},code:{inline:"Inline style",placeholder:"property: value;",bad:n=>`Not understood: ${n}`,computed:"Computed"},layers:{collapse:"Collapse",expand:"Expand",title:"Layers",outline:"Page outline",hint:"Drop an item on another to move it in front of that item. Shift+click to select several (for wrapping). Click the list, then use ↑↓ to move and ←→ to collapse or expand."},keys:{sections:{tools:"Tools",edit:"Edit",element:"Element",move:"Move around",view:"View",ai:"AI and comments"},rows:{select:"Select",hand:"Hand",board:"Draw a board",title:"Title",note:"Note",rect:"Rectangle",oval:"Oval",line:"Line",arrow:"Arrow",penOrPlay:"Pen · play the picked board in place",undo:"Undo",redo:"Redo",copy:"Copy element",paste:"Paste after",duplicate:"Duplicate",delete:"Delete",selectAll:"Select all",lock:"Lock / unlock",rename:"Rename board",front:"Bring to front",back:"Send to back",copyPng:"Copy as PNG",copyProps:"Copy properties",pasteProps:"Paste properties",flipH:"Flip horizontally",flipV:"Flip vertically",wrap:"Group in a flex box",reorder:"Move among siblings",enter:"Into the board · first child",next:"Next element or board",arrows:"Nudge · walk the elements",escape:"Let go · close",regions:"Next area of the app",zoomIn:"Zoom in",zoomOut:"Zoom out",zoom100:"Zoom to 100%",fitAll:"Fit all",zoomSel:"Zoom to selection",guides:"Layout guides",minimap:"Minimap",prototype:"Prototype view",panel:"Properties panel",clean:"Canvas only",ai:"Ask AI",find:"Find a board",comments:"Comment mode"}},inline:{title:"Ask AI",placeholder:"What should change?",send:"Send",history:"Conversation",visible:n=>n===1?"1 board in view":`${n} boards in view`,result:"AI result",done:"Done.",failed:"It did not finish.",cancelled:"Cancelled.",undo:"Undo",undone:"Undone",open:"Open conversation",close:"Close",running:"Working…",agentItem:n=>`AI agent: ${n}`,modelItem:n=>`Model: ${n||"default"}`,modelTitle:"Model",modelLabel:"Model name (empty for the agent's default)"},select:{toolbar:"Element",text:"Text",textOff:"No text in this element",fill:"Fill",textColor:"Text colour",radius:"Radius",spacing:"Spacing",askAi:"Ask AI",askAiAria:"Ask AI",askAiTitle:"Ask AI about this element",comment:"Comment",commentTitle:"Comment on this element",more:"More",textStyle:"Style and alignment",textAlign:"Alignment",bold:"Bold",italic:"Italic",underline:"Underline",align:n=>({left:"Align left",center:"Align centre",right:"Align right"})[n]??"Align",tokens:"Tokens",custom:"Custom…",hex:"Hex colour",picker:"Pick a colour",tokenNow:n=>`${n} · token`,decrease:n=>`Decrease ${n.toLowerCase()}`,increase:n=>`Increase ${n.toLowerCase()}`},design:{fill:"Fill",text:"Text",font:"Font",size:"Size",weight:"Weight",color:"Color",cornerRadius:"Corner radius",padding:"Padding",gap:"Gap",more:"More (CSS)",none:"None",inherited:n=>`(${n})`,weights:{100:"Thin",200:"Extra light",300:"Light",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Extra bold",900:"Black"},white:"white",black:"black",grade:n=>n>=7?"AAA":n>=4.5?"AA":n>=3?"AA large text only":"too low",contrastWith:(n,o,r)=>`Contrast ${n}:1 with ${o} text · ${r}`,contrastOn:(n,o,r)=>`Contrast ${n}:1 on ${o} · ${r}`,openFill:n=>`${n}: change`},properties:{tokenColors:{text:"Text",secondaryText:"Secondary text",background:"Background",surface:"Surface",divider:"Divider",accent:"Accent",error:"Error"},fields:{width:"Width",height:"Height",fontSize:"Font size",fontWeight:"Weight",color:"Color",background:"Background",radius:"Radius",flexDirection:"Flex direction",alignItems:"Align items",justifyContent:"Justify content",flexWrap:"Wrap",flexGrow:"Grow",alignSelf:"Align self",lineHeight:"Line height",textAlign:"Text align",border:"Border",boxShadow:"Shadow",opacity:"Opacity"},alignButtons:{left:"Align left",hcenter:"Align center",right:"Align right",top:"Align top",vcenter:"Align middle",bottom:"Align bottom"},columns:"Columns",rows:"Rows",align:"Align",layout:"Layout",wrap:"Wrap",image:"Image",replaceImage:"Replace image…",wrapTitle:"Select consecutive siblings with the same parent first",wrapFlex:"Wrap in flex",wrapGrid:"Wrap in grid",duplicate:"Duplicate",delete:"Delete",offToken:n=>`Off tokens: ${n}`,none:"none",contrastTitle:"Contrast with background (4.5 or more for body text, 3 or more for large text)",contrast:"Contrast",largeTextOnly:"Large text only",tooLow:"Too low"},shapes:{selectedN:n=>`${n} shapes selected`,deleteAll:"Delete selected shapes",stickyColors:{yellow:"Yellow",orange:"Orange",pink:"Pink",purple:"Purple",blue:"Blue",green:"Green",gray:"Gray",white:"White"},shapeSize:"Shape size",drawShape:"Draw shape",kinds:{rect:"Rectangle",oval:"Oval",line:"Line",arrow:"Arrow",pen:"Pen",image:"Image"},none:"None",options:"Shape options",strokeColor:"Stroke color",fill:"Fill",weight:"Weight",strokeWeight:"Stroke weight",front:"Bring to front",back:"Send to back",deleteShape:"Delete shape",deleteTitle:"Delete (⌫)"},notes:{selectedN:n=>`${n} notes selected`,deleteAll:"Delete selected notes",options:"Note options",title:"Title",sticky:"Sticky note",fontSize:"Font size",defaultSuffix:" (default)",textStyle:"Text style",bold:"Bold",italic:"Italic",color:"Color",stickyColor:n=>`${n} sticky note`,maxWidth:"Max width",maxHeight:"Max height",width:"Width",height:"Height",titleHint:"Text shrinks once it passes the max width or height (0 means no limit).",stickyHint:"With a height set, overflowing text scrolls (0 fits the content).",deleteNote:"Delete note",deleteTitle:"Delete (⌫)"},guides:{aria:"Layout guides",heading:(n,o)=>`Layout guides ${n}/${o}`,types:{columns:"Columns",rows:"Rows",grid:"Grid"},add:{columns:"Add column guide",rows:"Add row guide",grid:"Add grid guide"},empty:"Add up to 6 column, row or grid guides. They show only on the canvas and never go into the screen HTML. Hide all: ⌃G",color:"Guide color",show:"Show",hide:"Hide",deleteGuide:"Delete guide",delete:"Delete",cell:"Cell",count:"Count",gutter:"Gutter",margin:"Margin",cellSize:"Cell size",align:"Align",alignAria:"Guide alignment",stretch:"Stretch",left:"Left",top:"Top",center:"Center",right:"Right",bottom:"Bottom"},dialog:{renameGroupTitle:"Rename group",menu:"Menu",cancel:"Cancel",ok:"OK",deleteBoardsTitle:(n,o)=>n>1?`Delete ${n} boards?`:`Delete board "${o}"?`,deleteBoardsBody:"The HTML files are deleted too. A copy stays in the trash (docs/design/.trash), and Undo (⌘Z) brings them back right away.",delete:"Delete",renameBoardTitle:"Rename board",name:"Name",rename:"Rename",renameFileTitle:"Rename file",fileName:"File name",renameFileRefs:n=>`Links or iframes pointing to this file: ${n}`,renameFileNoRefs:"No links or iframes point to this file.",renameFileExtra:n=>`Also update ${Aa(n,"reference","references")} to the new name`,newPageTitle:"New page",newPageName:n=>`Page ${n}`,create:"Create",renamePageTitle:"Rename page",deletePageTitle:n=>`Delete page "${n}"?`,deletePageBody:n=>`Its ${Aa(n,"board","boards")} and notes aren't deleted; they move to the first page. You can undo with ⌘Z.`,authorTitle:"Comment author",save:"Save",snapshotTitle:"Save snapshot",snapshotLabel:"Message",snapshotMessage:n=>`docs(design): design snapshot ${n}`,snapshotHint:"Commits only the design folder. The author comes from your git config, and nothing else you staged is included.",commit:"Commit"},toast:{linkCopied:"Link copied",copiedPng:"Copied as PNG",copiedHtml:"Copied as HTML",copiedProps:"Properties copied",saveFailed:n=>`Save failed: ${n}`,undoRedoDone:(n,o)=>`${n==="undo"?"Undo":"Redo"}: ${o}`,nothingToUndo:"Nothing to undo",nothingToRedo:"Nothing to redo",undoAction:"Undo",textOnly:"Only elements that contain just text (and line breaks) can be edited in place",moved:"Moved",movedFrozen:"Moved (kept the size of the original spot)",copiedElement:(n,o)=>`Copied <${n}> — paste it into another board while editing with ${o}V`,nothingCopied:"No element copied. Select an element while editing and press ⌘C",pasted:(n,o)=>`Pasted <${o}> from ${n}`,imageReplaced:n=>`Replaced the image with ${n}`,boardCreated:n=>`Created board ${n}`,boardCreateFailed:n=>`Couldn't create the board: ${n}`,boardsDeleted:n=>`Deleted ${Aa(n,"board","boards")}`,duplicated:n=>`Duplicated as ${n}`,renamed:"Renamed",fileRenamed:(n,o)=>`Renamed to ${n}${o?" (references updated)":""}`,notesMax:n=>`You can have up to ${n} notes`,noteDeleted:"Note deleted",shapeDeleted:"Shape deleted",shapesDeleted:n=>`Deleted ${Aa(n,"shape","shapes")}`,imageReadFailed:"Couldn't read the image",importOnly:n=>`${n}: only HTML or images can be imported`,imported:n=>`Imported ${Aa(n,"board","boards")}`,pagesMax:"You can have up to 40 pages",pageDeleted:"Page deleted",copied:"Copied",elementDeleted:"Element deleted",wrapped:n=>`Wrapped in ${n}`,theme:n=>`Theme: ${n}`,tokensSaved:"Tokens saved",nothingChanged:"Nothing changed",snapshot:n=>`Snapshot ${n}`,cleanedUp:n=>`Cleaned up ${Aa(n,"board","boards")}`,uploaded:n=>`Uploaded ${n}`,tweaksSaved:"Saved tweaks to source",blockFlow:"Vertical alignment doesn't apply in block flow. Try changing the parent to flex",pngExporting:n=>`Rendering ${n}…`,pngExported:n=>`Downloaded ${n}`,pngNeedsBrowser:"PNG export needs a headless browser:",pngFailed:n=>`Couldn't render the PNG: ${n}`},history:{lock:"Lock",unlock:"Unlock",flip:"Flip",renameGroup:"Rename group",pageFromGroup:"Page from group",boardOptions:"Board options",front:"Bring to front",back:"Send to back",moveBoard:"Move board",resizeBoard:"Resize board",addTitle:"Add title",addNote:"Add note",deleteNote:"Delete note",duplicateNote:"Duplicate note",moveNote:"Move note",editNote:"Edit note",noteStyle:"Note style",addShape:"Add shape",deleteShape:"Delete shape",moveShape:"Move shape",resizeShape:"Resize shape",shapeStyle:"Shape style",shapeFront:"Bring shape to front",shapeBack:"Send shape to back",addImage:"Add image",launchPage:"Launch page",moveToPage:"Move to page",launchScreen:"Set launch screen",changeTheme:"Change theme",cleanMissing:"Clean up boards with missing files",editGuide:"Edit layout guide",addGuide:"Add layout guide",deleteGuide:"Delete layout guide",saveTokens:"Save tokens",registerTokens:"Register tokens"},defaults:{newTitle:"New title",note:"Note",pastedImage:"pasted-image.png"},menu:{openProps:"Open properties",newBoard:"New board",renameGroup:"Rename group…",pageFromGroup:"Make a page from this group",drawWithB:"B to draw",rename:"Rename",moveUp:"Move up",moveDown:"Move down",unsetLaunchPage:"Unset launch page",setLaunchPage:"Set as launch page",moveSelectedToPage:n=>`Move ${Aa(n,"selected board","selected boards")} to this page`,delete:"Delete",selectInside:"Select inside",playInPlace:"Play in place",stopPlay:"Stop Play",playFullScreen:"Play full screen",lock:"Lock",unlock:"Unlock",copyPng:"Copy as PNG",copyHtml:"Copy as HTML",copyProps:"Copy properties",pasteProps:"Paste properties",flipH:"Flip horizontal",flipV:"Flip vertical",locked:"Locked",askReview:"Ask AI for a review",focusView:"Prototype view",askAI:"Ask AI",askAIAria:"Ask AI",askFixErrors:"Ask AI to fix errors",goToBoard:"Go to board",exportPng:"Export PNG",exportingPng:"Exporting PNG…",renameFile:"Rename file…",duplicate:"Duplicate",front:"Bring to front",back:"Send to back",deleteBoards:n=>`Delete ${n} boards`,title:"Title",note:"Note",duplicateInFront:"Duplicate in front",newBoardHere:"New board here",mobileFrameHere:"Mobile screen frame here",titleHere:"Title here",noteHere:"Note here",selectAll:"Select all on this page",fitAll:"Fit all",zoom100:"Zoom to 100%",undo:"Undo",redo:"Redo",element:"Element",editText:"Edit text",selectParent:"Select parent",copy:"Copy",pasteAfter:"Paste after",replaceImage:"Replace image…",copyForAI:"Copy description for AI",shape:"Shape",snapshot:"Snapshot",notGit:"The design folder isn't inside a git repository",snapshotStatus:(n,o)=>`Snapshot · ${n} · ${Aa(o,"changed file","changed files")}`,snapshotNow:"Save snapshot now (git commit)…",nothingChanged:"Nothing changed",fileMissing:"File is missing",askFixAll:"Ask AI to fix all",cleanMissing:n=>`Clean up ${Aa(n,"board","boards")} with missing files`},prompts:{fixErrors:n=>`Fix these errors:
50
+ ${n}`,error:"Error",review:"Review this screen: point out accessibility (48px touch targets, 4.5 contrast, labels), information hierarchy, and token violations (get_tokens, check_tokens), with fixes in priority order. Don't edit anything; only suggest.",fixComment:"Fix only that spot, as this comment says",fixTokens:n=>`Replace off-token values with tokens (verify with check_tokens):
51
+ ${n}`,fixA11y:n=>`Fix the accessibility issues (keep the visible size; enlarge touch targets with padding):
52
+ ${n}`,line:"Line "},checks:{tokenCheck:n=>`Token check · ${n}`,noOffToken:"No off-token values",off:"off",tokensOffTitle:"No tokens registered — checks are off",tokensOffBody:"Colours and sizes are not checked, and the AI is not given a default palette.",setUpTokens:"Set up tokens",a11y:"Accessibility",a11yOk:"No touch target, contrast or label issues",askFix:"Ask AI to fix",notVisible:"Checks run when the board is visible on screen.",pickInEdit:n=>`Select ${n} on the board`,line:n=>`Line ${n}`,more:n=>`+${n} more`,colorNotInTokens:"Color not in tokens",tokenFontSizes:n=>`Token font sizes: ${n}`,tokenRadii:n=>`Token radius: ${n}`,notMultipleOf4:"Not a multiple of 4",tokenWeights:n=>`Token weights: ${n}`,smallTarget:(n,o,r,f)=>`<${n}> touch target ${o}×${r} (under ${f})`,noName:n=>`<${n}> has no name (aria-label, text or label)`,noAlt:'<img> has no alt (use alt="" if decorative)',lowContrast:(n,o,r)=>`Contrast ${n}:1 (needs ${o}) "${r}"`},tokens:{import:"Import tokens (tokens.json or Figma variables JSON)",importFailed:n=>`Couldn't import: ${n}`,theme:"Theme",addTheme:"Add theme (copy current theme)",newTheme:"New theme",newThemeN:n=>`New theme ${n}`,activeTheme:"Active theme",themeName:"Theme name",importedTheme:"Imported",colors:n=>`Colors ${n}`,addColor:"Add color",colorN:n=>`Color ${n}`,colorOf:n=>`${n} color`,colorName:"Color name",remove:n=>`Remove ${n}`,fontSizes:"Font sizes",fontWeights:"Font weights",radii:"Radius",spacing:"Spacing",touchTarget:"Touch target",minTouchTarget:"Minimum touch target",saveTitle:"Save to docs/design/tokens.json",save:"Save",register:"Register tokens",registeredHint:"Properties panel swatches, token check and AI (get_tokens) use the selected theme's values.",defaultHint:"Starter values, not in use yet. Registering saves them to tokens.json and turns on the token check and the AI palette.",noColors:"Couldn't find any color values"},tweaks:{revert:"Revert",save:"Save to source",hint:"Applied right away as CSS variables. Saving changes only the values in the board-tweaks JSON."},inspector:{shotFailed:n=>`Failed: ${n}`,kindName:n=>({text:"Text",button:"Button",link:"Link",image:"Image",input:"Input",icon:"Icon",container:"Container"})[n]??n,crumbs:"Selection path",crumbBoard:"Select the board",crumbParent:n=>`Select ${n}`,crumbElement:(n,o)=>`<${n}> ${o}`,more:n=>`+${n} more`,copy:"Copy",copied:"Copied",capturing:"Capturing…",screenshot:"Screenshot",boardScreenshot:"Board screenshot",boardScreenshotTitle:"Save a PNG of this board next to the design folder",screenshotTitle:"Save a PNG of this element",actions:"Element actions",boardActions:"Board actions"},comments:{pinLabel:(n,o,r)=>`Comment ${n} by ${o}: ${r}`,title:"Comments",placeholderElement:n=>`Comment on the selected element (${n})`,placeholderBoard:"Comment on the board",placeholder:"Add a comment",add:"Comment",authorTitle:"Change comment author name",author:n=>`Author: ${n}`,replyPlaceholder:n=>`Reply as ${n} (⌘Enter)`,reply:"Reply",replyResolve:"Reply and resolve",reopen:"Reopen",resolve:"Resolve",sendToAI:"Send to AI",sendToAITitle:"Send to AI to fix only where this comment points",openThread:"Show this comment on its own",allOnBoard:n=>`All ${n} on this board`,mode:"Comment mode",modeTitle:"Comment mode (⌥C)",allTitle:"All comments",thisPage:"This page",allPages:"All pages",showResolved:"Resolved",scope:"Which comments",edit:"Edit",deleteThread:"Delete",more:"Edit or delete",none:"No comments",nothingSelected:"Nothing selected"},assets:{uploading:"Uploading…",upload:"Upload (images and fonts; drag and drop works too)",loading:"Loading…",empty:"No assets yet. Uploaded images are saved to docs/design/assets/ and used in screens as ../assets/name.",copyPath:" · click to copy path",file:"File",pickImage:"Choose image",pickLabel:", use this image",close:"Close"},chat:{aria:"AI chat",agent:"Agent",agentHint:"Which agent edits the files",agentButton:(n,o)=>o?`Agent: ${n} — ${o}`:`Agent: ${n}`,agentStatus:{ready:"ready",signin:"sign-in needed",missing:"not installed",unknown:"couldn't check"},checking:"Checking…",checkedOnOpen:"Checked when the AI tab opened",checkAgain:"Check again",model:"Model",modelDefault:"Default (from CLI config)",modelTitle:n=>`Model for ${n}: an alias or a full model id. Leave empty for the CLI's own default.`,continuing:"Continuing conversation",newConversation:"New conversation",newChat:"New chat",intro:n=>`Sends the selected boards and elements, plus the boards visible on screen, to ${n} as context. The agent edits the source HTML directly, and the canvas redraws right away.`,suggestions:[{label:"AI review: accessibility, contrast, hierarchy",text:"Review the selected screen: accessibility (48px touch targets, 4.5 contrast, labels), information hierarchy, and token violations (get_tokens, check_tokens). Only suggest changes in priority order; don't edit anything.",n:1},{label:"3 variants of this screen",text:"Make 3 variants of the selected screen in different directions (each with a different layout, hierarchy and emphasis).",n:3},{label:"Shorten the selected button text",text:"Shorten the selected button text",n:1},{label:"Make a new empty-state screen",text:"Make a new empty-state screen",n:1}],remedySignin:(n,o)=>`${n} is not signed in. Run \`${o}\` in a terminal.`,remedyMissing:n=>`\`${n}\` command not found. Install it, then Check again.`,copyCommand:"Copy command",copy:"Copy",copied:"Copied",sendNeedsSignin:n=>`Sign in to ${n} to send`,sendNeedsInstall:n=>`Install ${n} to send`,running:"Running",cancelled:"Cancelled",failed:"Failed",retry:"Retry",switchTo:n=>`Switch to ${n}`,details:"Details",noFilesChanged:"No files were changed.",restored:"Restored from the failed message",madeVariants:n=>`Made ${Fh(n)} side by side · View`,thinking:"Thinking…",chipElement:n=>`Element <${n}>`,chipElementText:(n,o)=>`Element <${n}> ${o}`,chipBoards:n=>`${n} boards`,chipVisible:n=>`Visible boards ${n}`,chipComment:n=>`Comment "${n}"`,variants:Fh,tooBig:n=>`${n}: larger than 15MB`,refLink:"Reference link",placeholderRunning:"Running… (Esc to cancel)",placeholder:"What should change? (Enter to send · Shift+Enter for a new line)",input:"Message to AI",attach:"Attach file or image",attachTitle:"Attach file or image (drag and drop or paste works too)",addLink:"Add reference link",variantsTitle:"Copies the selected board and makes different variants side by side",variantsDisabledTitle:"Select one board to use this",variantsAria:"Number of variants",cancel:"Cancel",cancelTitle:"Cancel (Esc)",send:"Send",chipRemoveTitle:"Click to remove",chipAddTitle:"Click to attach",remove:n=>`Remove ${n}`,howToInstall:"How to install",customCommand:"Custom command…",checkedAt:(n,o)=>o?`Checked when the AI tab opened · ${n}`:`Checked again at ${n}`,customTitle:"Custom command",customName:"Name",customCommandLabel:"Command",customNamePlaceholder:"Aider",customCommandPlaceholder:"aider --message {prompt} --yes",customHint:"`{prompt}` is replaced with your request and the canvas context. Output is shown as plain text.",customSave:"Save",customCommandTitle:n=>`Runs without a shell: ${n}`,waiting:"Waiting for you",waitingHint:"answer the request above",permAsk:(n,o,r)=>o==="command"?`${n} asks to run a command`:o==="edit"?`${n} asks to ${r==="Write"?"write":"edit"} a file`:o==="fetch"?`${n} asks to fetch a page`:`${n} asks to use ${r}`,permIn:"in",permOutside:"outside the design folder",allowOnce:"Allow once",alwaysAllow:n=>`Always allow ${n}`,alwaysAllowTitle:"Until Easel restarts, for this canvas only",deny:"Deny",permDone:{once:"Allowed",always:"Always allowed",deny:"Denied"},permDoneOutside:"(outside the design folder)",noPause:{codex:"Codex exec cannot pause to ask; it follows its sandbox setting.",cursor:"Cursor Agent cannot pause to ask here; it runs with --force.",gemini:"Gemini CLI cannot pause to ask here; it accepts edits on its own."},runChanged:(n,o)=>n&&o?`Changed ${n} board${n===1?"":"s"} · added ${o}`:o?`Added ${o} board${o===1?"":"s"}`:n?`Changed ${n} board${n===1?"":"s"}`:"Changed the canvas",chipNew:n=>`${n} (new)`,chipRemoved:n=>`${n} (removed)`,undoRun:"Undo this run",compare:"Compare",redo:"Redo",runUndone:n=>`Run undone · ${n} board${n===1?"":"s"} restored`,conflictUndo:n=>`Changed since this run: ${n}. Undo the rest and keep those, or undo all and overwrite them?`,conflictRedo:n=>`Changed since the undo: ${n}. Redo the rest and keep those, or redo all and overwrite them?`,undoRest:"Undo the rest",undoAll:"Undo all anyway",redoRest:"Redo the rest",redoAll:"Redo all anyway",restoreCopy:"Restore the copy from before this run",savedAt:n=>`Saved ${n}`,copyGone:"The copy from before this run is gone (only the newest 10 are kept).",restoredCopy:"Canvas restored to the copy from before this run",restoreTitle:"Restore the copy from before this run?",restoreBody:n=>`This puts the whole canvas back to ${n}, before this run: every screen and board.json, including anything changed since by you or by other runs. Undo takes the restore back.`,restoreOk:"Restore",restarted:n=>`Easel restarted · ${n}`},compare:{title:n=>`Compare · ${n}`,boards:"Boards",before:"Before",after:"After",notBefore:"This board did not exist before the run.",notAfter:"This run removed the board.",notBeforeChange:"This board did not exist before this change.",close:"Close"},activity:{stepName:n=>String(n),outside:"Outside Easel",ago:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"now":o<60?`${o}m`:o<1440?`${Math.floor(o/60)}h`:`${Math.floor(o/1440)}d`},agoLong:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"just now":o<60?`${o} min ago`:o<1440?`${Math.floor(o/60)} h ago`:`${Math.floor(o/1440)} d ago`},tag:(n,o,r,f)=>`${n} · ${o} · ${f&&r===1?"new board":Aa(r,"change","changes")}`,tagTitle:n=>`${n} — click for the change, Before / After and Undo`,tagsAria:n=>`${Aa(n,"change","changes")} by others`,popAria:n=>`Change by ${n}`,element:xy,change:n=>{const o=xy(n.tag,n.cls);switch(n.kind){case"style":return`Style changed on ${o}`;case"attr":return`${o} attributes changed`;case"edited":return`${o} changed`;case"added":return n.count>1?`${n.count} elements added`:`${o} added`;case"removed":return n.count>1?`${n.count} elements removed`:`${o} removed`;case"replaced":return`${o} replaced`;case"many":return`${n.count}${n.more?"+":""} elements changed`;case"page":return"Page styles or title changed";case"source":return"Only spacing or comments in the source changed";case"new":return"New board";case"deleted":return"Board deleted";case"moved":return"Board moved";case"resized":return"Board resized";case"renamed":return"Board renamed";case"options":return"Board options changed";default:return"Changed"}},changes:n=>`${Aa(n,"change","changes")} on this board`,quote:n=>`“${n}”`,arrow:"→",beforeAfter:"Before / After",undo:"Undo",undoTitle:n=>n===1?"Undo this change":`Undo these ${n} changes`,conflict:n=>`Changed since: ${n}. Undo the rest and keep those, or undo all and overwrite them?`,undoRest:"Undo the rest",undoAll:"Undo all anyway",cancel:"Cancel",close:"Close",historyButton:"History",historyTitle:"History · newest first",historyEmpty:"Nothing yet. Changes made in this session show up here.",historyFoot:"History is kept for this session.",now:"Now",goBack:"Go back to here",goBackAria:(n,o,r)=>`${n} by ${o}, ${r} · Go back to here`,nowAria:(n,o,r)=>`${n} by ${o}, ${r} · current`,undoneAria:(n,o,r)=>`${n} by ${o}, ${r} · undone`,wentBack:n=>`Back to: ${n}`},occupancy:{editing:n=>`${n} is editing…`,you:"You · editing",personEditing:n=>`${n} · editing`,done:(n,o)=>`${n} · done ${o}`,someone:"Someone",clock:n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),tagsAria:"Who is on this board",listDot:n=>`${n} is editing`,youListDot:"You are editing",forked:(n,o,r)=>`Forked ${n} — ${o} started while ${r} was editing`,forkBlock:(n,o)=>n===1?`Fork of ${o}`:`${n} forks of ${o}`,forkBlockWhile:(n,o,r)=>`${n===1?`Fork of ${o}`:`${n} forks of ${o}`} · made while ${r} was editing`,forkBlockShort:n=>n===1?"Fork":`${n} forks`,useThis:"Use this",useThisOne:"Use this one",useThisTitle:"Make this variant the original board; the other variants go to trash",useThisOneTitle:n=>`Keep this version as the board; ${n===1?"the other version goes":`the other ${n} versions go`} to trash`,waitFor:n=>`Wait until ${n} is done editing`,confirmVariant:(n,o)=>`Apply "${n}" to ${o}?`,confirmVariantBody:(n,o)=>`${n} is replaced.${o?` The other ${o===1?"variant goes":`${o} variants go`} to trash.`:""}`,confirmFork:(n,o)=>`Use "${n}" for ${o}?`,confirmForkBody:(n,o)=>`${n} is replaced by this version. ${o?`This fork and the other ${o===1?"fork go":`${o} forks go`} to trash.`:"The fork goes to trash."}`,confirmKeep:n=>`Keep "${n}"?`,confirmKeepBody:(n,o)=>`${n} ${o===1?"goes":"go"} to trash.`,apply:"Apply",keepAll:"Keep all",keepBoth:"Keep both",applied:(n,o)=>`Applied ${n} to ${o}`,kept:(n,o)=>`Kept ${n}; ${o===1?"the other version is":`the other ${o} versions are`} in trash`,keptAll:(n,o)=>n==="variant"?`Kept all ${Fh(o)} as boards`:o===1?"Kept both versions as boards":`Kept all ${o+1} versions as boards`,undo:"Undo"},requests:{goTo:"AI requests go to",easelChat:"Easel chat",easelChatNote:"Easel runs Claude Code itself.",host:"The agent you're talking to",hostNote:"Requests wait on the canvas.",connected:"Connected",noneConnected:"No agent connected",thisFolder:"this folder",otherFolder:"another folder",since:n=>`since ${n}`,sendTo:"Send to",anyAgent:"Any agent",sayTitle:"Say",line:"handle the Easel requests",quote:n=>`“${n}”`,copy:"Copy",copied:"Copied",copyTitle:"Copy the line for your agent's chat (or run /easel:requests)",forAi:"For AI",forAgent:n=>`For ${n}`,addForAi:"Leave",forAiCheck:"For AI",forAiCheckTitle:"Leave this comment as a request for the agent you're talking to",composerTitle:"Ask your agent",composerAria:"Request for your agent",composerPlaceholder:"What should change here?",cancel:"Cancel",waiting:"Waiting",waitingFor:n=>`Waiting for ${n}`,took:(n,o)=>`${n} working · ${o}`,failed:n=>`${n} couldn't finish`,left:n=>`Waiting (${n} left)`,cancelRequest:"Cancel",useChat:"Use Easel chat",more:"More",retry:"Again",undoChange:"Undo",undone:"Undone",undoGone:"Can't be undone now",changedTitle:n=>`Go to ${n}, the board it changed`,waitingTag:n=>`${n} waiting`,pinLabel:(n,o,r)=>o?`Request ${n} waiting for your agent: ${r}`:`Request ${n} for AI: ${r}`,countAria:n=>n===1?"1 request waiting for your agent":`${n} requests waiting for your agent`,filterAria:"Which comments",filterAll:"All",filterForAi:"For AI",listTitle:"For AI",allBoards:"all boards",listEmpty:"No requests",introTitle:"Leave requests for the agent in this window?",switchTo:"Switch",keepChat:"Keep Easel chat",backToRequests:"Back to requests",hostShort:"your agent",easelChatShort:"Easel chat",goesTo:"Requests go to",connectedN:n=>n?`${n} connected`:"none connected",chatOnce:"Easel chat, for this request",menuHost:"AI requests: your agent",menuChat:"AI requests: Easel chat",added:"Left for your agent",cancelled:"Cancelled. The comment stays.",kind:{element:"Element",board:"Board",tokens:"Token check",a11y:"Accessibility",errors:"Errors",review:"Review",comment:"Comment"},frameBoard:n=>`Easel board ${n}`,frameElement:(n,o)=>`Easel board ${n}, selected: ${o}`},update:{out:n=>`Easel ${n} is out`,copy:"Copy command",copied:"Copied. Run it, then restart Easel",hide:"Hide until the next version"}},zx={button:"버튼",a:"링크",img:"이미지",input:"입력란",textarea:"입력란",select:"선택 메뉴",label:"라벨",p:"문단",span:"텍스트",li:"목록 항목",ul:"목록",ol:"목록",nav:"내비게이션",header:"헤더",footer:"푸터",main:"본문",section:"섹션",form:"폼",svg:"아이콘",style:"스타일",script:"스크립트"},wy=(n,o)=>zx[n??""]??(/^h[1-6]$/.test(n??"")?"제목":o?`.${o}`:n?`<${n}>`:"요소");function $x(n,o){const r=n.replace(/[\s>)"'”’\]]+$/,"").slice(-1),f=r.charCodeAt(0);let m=null;f>=44032&&f<=55203?m=(f-44032)%28:/[0-9]/.test(r)?m=[21,8,0,16,0,0,1,8,8,0][Number(r)]:/[lmn]/i.test(r)?m=/l/i.test(r)?8:/m/i.test(r)?16:4:/[a-z]/i.test(r)&&(m=0);const[g,v]=o.split("/");return m==null?o==="으로/로"?"(으)로":`${g}(${v})`:o==="으로/로"?m===0||m===8?"로":"으로":m?g:v}const Bt=(n,o)=>n+$x(n,o),jy=n=>n==="system"?"시스템":n==="light"?"라이트":"다크",ub={app:{title:"Easel",docTitle:n=>`${n} — Easel`,loadFailed:"불러오지 못했어요:",retry:"다시 시도",crashed:"캔버스에 오류가 나서 멈췄어요:",reload:"새로고침",loadingBoards:"보드를 불러오는 중…",loading:"불러오는 중…",emptyPage:"이 페이지는 비어 있어요",drawBoard:"보드 그리기",defaultAuthor:"나",tokensAside:"디자인 토큰",assetsAside:"에셋",inspectorAside:"인스펙터",navigation:"내비게이션",announceBoard:(n,o,r)=>`${n} 선택됨, ${o}/${r}. Enter를 누르면 안쪽을 선택해요`,firstRunEdit:"보드에서 무엇이든 클릭해 선택하고, 텍스트는 더블클릭해 고쳐요",firstRunAi:n=>`${n}J를 눌러 AI에게 수정을 요청해요`,cleanOn:"캔버스만 보여요. Esc를 누르면 도구가 다시 보여요",cleanOff:"도구가 다시 보여요"},templates:{blank:"빈 보드",mobile:"모바일 화면",desktop:"데스크톱 화면",doc:"문서",tablet:"태블릿 화면",watch:"워치 화면",email:"이메일"},tools:{select:"선택",hand:"손",board:"보드 그리기",title:"제목",sticky:"메모",rect:"사각형",oval:"타원",line:"선",arrow:"화살표",pen:"펜"},toolHints:{select:"보드를 선택하고 옮겨요",hand:"끌어서 캔버스를 움직여요",board:"끌어서 보드를 그려요",title:"클릭해 제목을 넣어요",sticky:"클릭해 스티키 노트를 붙여요",rect:"끌어서 사각형을 그려요",oval:"끌어서 타원을 그려요",line:"끌어서 선을 그려요",arrow:"끌어서 화살표를 그려요",pen:"끌어서 자유롭게 그려요"},toolbar:{aria:"도구",leftPanel:"왼쪽 패널",leftPanelTitle:n=>`왼쪽 패널 (${n}\\)`,canvasTools:"캔버스 도구",shapes:"도형",tool:(n,o)=>`${n} (${o})`,shapeToolTitle:(n,o)=>`${n} (${o}) · Shift를 누르면 정사각형이나 원`,insertImage:"이미지 넣기",insertImageTitle:"이미지 넣기 (캔버스에 붙여 넣어도 돼요)",undo:"실행 취소",redo:"다시 실행",undoTitle:(n,o)=>n?`실행 취소: ${n} (${o}Z)`:`실행 취소 (${o}Z)`,redoTitle:(n,o)=>n?`다시 실행: ${n} (⇧${o}Z)`:`다시 실행 (⇧${o}Z)`,newBoard:"새 보드",newBoardTitle:"새 보드 (템플릿 고르기)",themeTitle:"디자인 시스템 테마 (색 견본, 토큰 검사, AI가 써요)",theme:"테마",themeOption:n=>`테마: ${n}`,snapshot:"스냅샷 (git)",snapshotTitle:"스냅샷: 디자인 폴더를 git 커밋으로 저장해요",erroredBoards:"오류가 있는 보드",erroredBoardsN:n=>`오류가 있는 보드 ${n}`,errors:n=>`오류 ${n}`,zoomOut:"축소",zoomOutTitle:n=>`축소 (${n}-)`,zoomIn:"확대",zoomInTitle:n=>`확대 (${n}+)`,zoom100:"100%로 보기",zoom100Title:n=>`100%로 보기 (${n}0)`,fitAll:"전체 보기",fitAllTitle:"전체 보기 (⇧1)",aiChat:"AI에게 요청",askAi:"AI",aiChatTitle:n=>`AI에게 요청 (${n}J)`,guides:"레이아웃 가이드 보기",guidesTitle:"레이아웃 가이드 보기 (⌃G)",appearance:n=>`화면 모드: ${jy(n)}`,appearanceTitle:n=>`화면 모드: ${n==="system"?"시스템 설정 따르기":jy(n)} (클릭해 바꾸기)`,minimap:"미니맵",minimapTitle:"미니맵 (M)",viewMenu:"보기",viewMenuTitle:"보기: 가이드, 미니맵, 화면 모드, 테마, 언어, 스냅샷",viewMenuTitleNarrow:"보기: 확대/축소, 기록, 가이드, 미니맵, 화면 모드, 언어, 스냅샷",language:n=>`언어: ${n}`,project:"프로젝트",history:"기록",cleanView:"캔버스만 보기",showTools:"도구 보이기",showToolsTitle:n=>`도구 보이기 (Esc 또는 ⇧${n}\\)`,canvasHints:"캔버스 도움말",comments:"댓글",commentsTitle:n=>n?`댓글, 열린 것 ${n}`:"댓글",boardsPanel:"보드·에셋·토큰",viewToggle:"보기",viewCanvas:"캔버스",viewPrototype:"프로토타입",viewPrototypeTitle:"프로토타입 (F)",play:"재생",playTitle:"재생 (전체 화면)",panelToggle:"속성 패널",panelToggleTitle:n=>`속성 패널 (${n}\\)`,zoomMenu:n=>`확대 ${n}%`,zoomToSelection:"선택 항목에 맞추기",zoomNow:n=>`현재 ${n}%`,layoutGuides:"레이아웃 가이드",pageCount:n=>`페이지 ${n}개`,copyPageLink:"페이지 링크 복사",copyLink:"링크 복사",restart:"처음부터",shortcuts:"키보드 단축키",projectMenu:n=>`${n}: 프로젝트 메뉴`,shareMenu:"공유…",otherProjects:"실행 중인 프로젝트",protoMore:"더 보기",playMenu:"재생",protoHeading:"프로토타입",staticHeading:"정적 보드",noBoards:"보드 없음",protoBoard:n=>`보드: ${n}. 다른 보드로`,protoBoards:"보드",prevBoard:"이전 보드 (←)",nextBoard:"다음 보드 (→)"},tabs:{left:"왼쪽 패널",boards:"보드",assets:"에셋",tokens:"토큰",right:"오른쪽 패널",closePanel:"패널 닫기",properties:"속성",ai:"AI",code:"코드",tweaks:"조정",layers:"레이어",codeEmpty:"요소를 고르면 코드를 고칠 수 있어요",tweaksEmpty:"아직 조정 값이 없어요. AI에게 추가해 달라고 하세요"},boardList:{aria:"페이지와 보드",pages:"페이지",addPage:"페이지 추가",newPage:"새 페이지",pageSwitch:n=>`페이지: ${n}. 페이지 바꾸기`,pageMore:n=>`${n} 메뉴`,singlePage:"모든 보드를 한 페이지로 보고 있어요. +를 눌러 페이지를 나눠요.",pageTabTitle:"끌어서 순서 바꾸기 · 오른쪽 클릭으로 이름 바꾸기나 삭제",boardsHead:"보드",searchPlaceholder:"보드 찾기 (⌘K)",search:"보드 찾기",noMatch:n=>`"${n}"에 맞는 보드가 없어요. 파일 이름의 일부로 찾아 보세요.`,emptyPage:"이 페이지에는 아직 보드가 없어요. B를 누르고 캔버스에서 끌어 그려요.",fileMissing:"파일 없음",otherGroup:"기타",mainPage:"기본",groupTitle:n=>`보드 ${n}개 · 클릭해 접고 펼치기 · 더블클릭해 이름 바꾸기`,groupMenu:"그룹 메뉴"},minimap:{aria:"미니맵: 클릭한 곳으로 이동"},sections:{board:"보드",comments:"댓글",guides:"레이아웃 가이드",tweaks:"조정 값",tokenCheck:"토큰 검사",a11y:"접근성",checks:"검사",properties:"속성",layers:"레이어"},boardOptions:{print:"인쇄",printMode:"쪽",printModes:{continuous:"연속",fixed:"용지"},paper:"용지 크기",papers:{letter:"레터",a4:"A4"},bg:"배경",bgNone:"없음",aria:"보드 옵션",positionAndSize:"위치와 크기",position:"위치",size:"크기",options:"옵션",renameTitle:"이름 바꾸기 (F2)",renameFileTitle:"파일 이름 바꾸기",width:"너비",height:"높이",radius:"모서리",interactive:"재생 버튼 표시",interactiveTitle:"보드 라벨의 ▶를 점과 함께 늘 보여 줘요. 끄면 보드를 선택하거나 마우스를 올렸을 때만 ▶가 보여요. 어떤 보드든 P나 오른쪽 클릭으로 재생할 수 있어요",frameless:"프레임 없음",fill:"창에 맞춰 늘이기",launch:"시작 화면으로 열기",page:"페이지",focus:"포커스 보기",focusTitle:"포커스 보기 (F)",front:"맨 앞으로 가져오기",frontTitle:"맨 앞으로 가져오기 (⌘])",back:"맨 뒤로 보내기",backTitle:"맨 뒤로 보내기 (⌘[)",duplicate:"복제",duplicateTitle:"복제 (⌘D)",delete:"삭제",deleteTitle:"삭제 (Delete)",selectedN:n=>`보드 ${n}개 선택됨`,frontTitleMod:n=>`맨 앞으로 가져오기 (${n}])`,backTitleMod:n=>`맨 뒤로 보내기 (${n}[)`,goToSelected:"선택한 보드로 이동",goToSelectedTitle:"선택한 보드로 이동 (⇧2)",deleteTitleKey:"삭제 (⌫)"},full:{aria:n=>`${n} 전체 창`,back:"캔버스로 (Esc)",fill:"채우기",fillTitle:"창 채우기",fit:"맞추기",fitTitle:"보드 원래 크기로, 창에 맞게 축소",mode:"크기"},focus:{aria:n=>`${n} 포커스 보기`,prev:"이전 보드",next:"다음 보드",pageStyle:" · 페이지형",close:"닫기"},play:{back:"뒤로",forward:"앞으로",viewOnCanvas:"캔버스에서 보기",closeTitle:"닫기 (Esc)",close:"닫기"},share:{button:"공유",buttonTitle:"보기 전용 사본 공유 (웹 폴더, 파일 하나, PDF, PNG)",title:"보기 전용 사본 공유",scope:"내보낼 범위",whole:"캔버스 전체",page:"이 페이지",pageNone:"이 캔버스는 페이지가 하나예요",selected:n=>`선택한 보드 (${n})`,webTitle:"웹 폴더",webHint:"정적 파일이에요. Vercel, GitHub Pages, PR 미리보기에 올려요.",singleTitle:"파일 하나",singleHint:n=>` · ${n} · 호스팅 없이 어느 브라우저에서나 열려요`,singleSwitch:".html 파일 하나로",measuring:"크기 재는 중…",pdfTitle:"PDF",pdfHint:"한 페이지에 보드 하나",pngTitle:"PNG",pngHint:"보드마다 이미지 하나, 2배",export:"내보내기",save:"저장",working:"내보내는 중…",exported:"내보냄",saved:"저장함",reveal:"폴더 보기",revealTitle:"파일 관리자에서 폴더를 보여 줘요",copyDeploy:"배포 명령 복사",copyDeployTitle:n=>`${Bt(n,"을/를")} 복사해요 (프로젝트 폴더에서 실행해요)`,copied:n=>`복사함: ${n}`,copyFailed:"클립보드에 복사하지 못했어요",attachHint:"Slack, 이메일, PR에 첨부해요.",skipped:n=>`참조 ${n}개는 넣지 못했어요`,largeFiles:"캔버스가 크면 파일도 커져요. 실시간으로 바뀌지 않아요.",sameAs:"같은 명령:",unavailable:"여기서는 쓸 수 없어요."},viewer:{docTitle:n=>`${n} — 보기 전용`,noData:"Easel에서 내보낸 페이지지만 데이터가 없어요 (easel-viewer/data.js).",bar:"뷰어",pages:"페이지",play:"재생",playTitle:"선택한 보드(없으면 첫 보드)를 전체 화면으로 재생해요",stamp:n=>`보기 전용 · ${n}에 내보냄`,stampTitle:"읽기 전용 사본이에요. 디자인 파일을 고친 뒤 다시 내보내요.",madeWith:"Easel로 만듦",comments:"댓글",commentsN:n=>`댓글 ${n}`,noComments:"댓글 없음",replies:n=>`답글 ${n}개`,pin:(n,o)=>`${o}의 댓글 ${n}`,threadOf:(n,o)=>`${n}/${o}`,closeThread:"댓글 닫기",boardsPanel:"보드",commentsPanel:"댓글 패널",empty:"이 페이지에는 아무것도 없어요",embedGate:"캔버스를 직접 써 볼 수 있어요. 화면 이동, 확대/축소, 보드 열기, 재생. Esc를 누르면 페이지로 돌아가요.",embedHint:"클릭하면 캔버스를 움직이고 확대/축소할 수 있어요",embedHintLive:"Esc를 누르거나 바깥을 클릭하면 페이지로 돌아가요"},canvas:{aria:"디자인 캔버스",board:(n,o,r,f)=>`보드 ${n}${o?" (선택됨)":""}${r?" 편집 중":""}${f?" 재생 중":""}`,interactive:"재생할 수 있는 보드",hint:"클릭해 선택 · 더블클릭해 텍스트 고치기 · Esc로 선택 해제",notLoaded:"가까이 가면 불러와요",fileMissing:n=>`파일 없음 · ${n}`,playing:"▶ 재생 중 · Esc",exportingPng:"PNG 내보내는 중…",play:"재생",playTitle:"재생 (P)",stopPlay:"재생 중지",stopPlayTitle:"재생 중지 (P 또는 Esc)",playShort:"재생",edit:"편집",exportBoard:"이 보드 내보내기 (PNG)",fullWindow:"전체 창으로 열기",tweaks:"이 보드의 조정 값",boardSize:"보드 크기",titleMaxWidth:"최대 너비",stickySize:"스티키 노트 크기",deleteNote:"메모 삭제"},editMode:{fileChanged:"다른 사람이 먼저 이 파일을 바꿨어요. 요소를 다시 선택해 주세요."},elementDrag:{moveAria:"요소 옮기기 (Alt: 가리킨 상자 안으로)",moveTitle:"끌어서 옮기기 · Alt를 누르고 있으면 가리킨 상자 안에 넣어요",width:"너비",height:"높이",size:"크기"},extra:{letterSpacing:"자간",size:"크기",width:"너비",height:"높이",fixed:"고정",hug:"콘텐츠 맞춤",fill:"채우기",mode:n=>`${n} 방식`,position:"위치",flow:"일반 흐름",absolute:"절대",look:"모양",opacity:"불투명도",border:"테두리",borderStyles:{none:"없음",solid:"실선",dashed:"파선",dotted:"점선"},shadow:"그림자",shadows:{none:"없음",small:"작게",medium:"보통",large:"크게",custom:"사용자 지정"},link:"링크",href:"주소",newTab:"새 탭",export:"내보내기",exportPng:"PNG 2×",exporting:"내보내는 중…"},code:{inline:"인라인 스타일",placeholder:"속성: 값;",bad:n=>`읽을 수 없는 선언: ${n}`,computed:"계산값"},layers:{collapse:"접기",expand:"펼치기",title:"레이어",outline:"페이지 개요",hint:"항목을 다른 항목 위에 놓으면 그 앞으로 옮겨요. Shift+클릭으로 여러 개를 골라 감쌀 수 있어요. 목록을 클릭한 뒤 ↑↓로 옮기고 ←→로 접고 펼쳐요."},keys:{sections:{tools:"도구",edit:"편집",element:"요소",move:"이동",view:"보기",ai:"AI와 댓글"},rows:{select:"선택",hand:"손",board:"보드 그리기",title:"제목",note:"메모",rect:"사각형",oval:"타원",line:"선",arrow:"화살표",penOrPlay:"펜 · 고른 보드는 제자리에서 재생",undo:"실행 취소",redo:"다시 실행",copy:"요소 복사",paste:"뒤에 붙여넣기",duplicate:"복제",delete:"삭제",selectAll:"모두 선택",lock:"잠금 / 풀기",rename:"보드 이름 바꾸기",front:"맨 앞으로",back:"맨 뒤로",copyPng:"PNG로 복사",copyProps:"속성 복사",pasteProps:"속성 붙여넣기",flipH:"좌우 반전",flipV:"상하 반전",wrap:"flex 상자로 묶기",reorder:"형제 사이에서 옮기기",enter:"보드 안으로 · 첫 자식",next:"다음 요소나 보드",arrows:"조금씩 옮기기 · 요소 사이 이동",escape:"선택 풀기 · 닫기",regions:"앱의 다음 영역",zoomIn:"확대",zoomOut:"축소",zoom100:"100%로 보기",fitAll:"전체 보기",zoomSel:"선택 항목에 맞추기",guides:"레이아웃 가이드",minimap:"미니맵",prototype:"프로토타입 보기",panel:"속성 패널",clean:"캔버스만 보기",ai:"AI에게 요청",find:"보드 찾기",comments:"댓글 모드"}},inline:{title:"AI에게 요청",placeholder:"무엇을 바꿀까요?",send:"보내기",history:"대화",visible:n=>`보이는 보드 ${n}개`,result:"AI 결과",done:"끝났어요.",failed:"끝내지 못했어요.",cancelled:"취소했어요.",undo:"되돌리기",undone:"되돌림",open:"대화 보기",close:"닫기",running:"작업 중…",agentItem:n=>`AI 에이전트: ${n}`,modelItem:n=>`모델: ${n||"기본값"}`,modelTitle:"모델",modelLabel:"모델 이름(비우면 에이전트 기본값)"},select:{toolbar:"요소",text:"텍스트",textOff:"이 요소에는 텍스트가 없어요",fill:"채우기",textColor:"글자색",radius:"모서리",spacing:"간격",askAi:"AI",askAiAria:"AI에게 요청",askAiTitle:"이 요소에 대해 AI에게 요청",comment:"댓글",commentTitle:"이 요소에 댓글 달기",more:"더 보기",textStyle:"스타일과 정렬",textAlign:"정렬",bold:"굵게",italic:"기울임",underline:"밑줄",align:n=>({left:"왼쪽 정렬",center:"가운데 정렬",right:"오른쪽 정렬"})[n]??"정렬",tokens:"토큰",custom:"직접 입력…",hex:"Hex 색",picker:"색 고르기",tokenNow:n=>`${n} · 토큰`,decrease:n=>`${n} 줄이기`,increase:n=>`${n} 늘리기`},design:{fill:"채우기",text:"텍스트",font:"글꼴",size:"크기",weight:"굵기",color:"색",cornerRadius:"모서리 반경",padding:"패딩",gap:"간격",more:"더 보기 (CSS)",none:"없음",inherited:n=>`(${n})`,weights:{100:"Thin",200:"Extra light",300:"Light",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Extra bold",900:"Black"},white:"흰색",black:"검은색",grade:n=>n>=7?"AAA":n>=4.5?"AA":n>=3?"AA 큰 글자만":"너무 낮음",contrastWith:(n,o,r)=>`${o} 글자와 명도 대비 ${n}:1 · ${r}`,contrastOn:(n,o,r)=>`${o} 위 명도 대비 ${n}:1 · ${r}`,openFill:n=>`${n}: 바꾸기`},properties:{tokenColors:{text:"텍스트",secondaryText:"보조 텍스트",background:"배경",surface:"표면",divider:"구분선",accent:"강조",error:"오류"},fields:{width:"너비",height:"높이",fontSize:"글자 크기",fontWeight:"굵기",color:"색",background:"배경",radius:"모서리",flexDirection:"Flex 방향",alignItems:"항목 정렬",justifyContent:"콘텐츠 배치",flexWrap:"줄바꿈",flexGrow:"늘이기",alignSelf:"자기 정렬",lineHeight:"줄 높이",textAlign:"텍스트 정렬",border:"테두리",boxShadow:"그림자",opacity:"불투명도"},alignButtons:{left:"왼쪽 정렬",hcenter:"가운데 정렬",right:"오른쪽 정렬",top:"위쪽 정렬",vcenter:"세로 가운데 정렬",bottom:"아래쪽 정렬"},columns:"열",rows:"행",align:"정렬",layout:"레이아웃",wrap:"감싸기",image:"이미지",replaceImage:"이미지 바꾸기…",wrapTitle:"같은 부모 아래 이어진 형제 요소를 먼저 선택해요",wrapFlex:"Flex로 감싸기",wrapGrid:"Grid로 감싸기",duplicate:"복제",delete:"삭제",offToken:n=>`토큰 밖: ${n}`,none:"없음",contrastTitle:"배경과의 명도 대비 (본문 4.5 이상, 큰 글자 3 이상)",contrast:"명도 대비",largeTextOnly:"큰 글자만",tooLow:"너무 낮음"},shapes:{selectedN:n=>`도형 ${n}개 선택됨`,deleteAll:"선택한 도형 삭제",stickyColors:{yellow:"노랑",orange:"주황",pink:"분홍",purple:"보라",blue:"파랑",green:"초록",gray:"회색",white:"흰색"},shapeSize:"도형 크기",drawShape:"도형 그리기",kinds:{rect:"사각형",oval:"타원",line:"선",arrow:"화살표",pen:"펜",image:"이미지"},none:"없음",options:"도형 옵션",strokeColor:"선 색",fill:"채우기",weight:"굵기",strokeWeight:"선 굵기",front:"맨 앞으로 가져오기",back:"맨 뒤로 보내기",deleteShape:"도형 삭제",deleteTitle:"삭제 (⌫)"},notes:{selectedN:n=>`메모 ${n}개 선택됨`,deleteAll:"선택한 메모 삭제",options:"메모 옵션",title:"제목",sticky:"스티키 노트",fontSize:"글자 크기",defaultSuffix:" (기본)",textStyle:"텍스트 스타일",bold:"굵게",italic:"기울임",color:"색",stickyColor:n=>`${n} 스티키 노트`,maxWidth:"최대 너비",maxHeight:"최대 높이",width:"너비",height:"높이",titleHint:"최대 너비나 높이를 넘으면 글자가 작아져요 (0은 제한 없음).",stickyHint:"높이를 정하면 넘치는 글은 스크롤돼요 (0은 내용에 맞춤).",deleteNote:"메모 삭제",deleteTitle:"삭제 (⌫)"},guides:{aria:"레이아웃 가이드",heading:(n,o)=>`레이아웃 가이드 ${n}/${o}`,types:{columns:"열",rows:"행",grid:"그리드"},add:{columns:"열 가이드 추가",rows:"행 가이드 추가",grid:"그리드 가이드 추가"},empty:"열, 행, 그리드 가이드를 6개까지 넣을 수 있어요. 캔버스에만 보이고 화면 HTML에는 들어가지 않아요. 모두 숨기기: ⌃G",color:"가이드 색",show:"보이기",hide:"숨기기",deleteGuide:"가이드 삭제",delete:"삭제",cell:"칸",count:"개수",gutter:"거터",margin:"여백",cellSize:"칸 크기",align:"정렬",alignAria:"가이드 정렬",stretch:"늘이기",left:"왼쪽",top:"위",center:"가운데",right:"오른쪽",bottom:"아래"},dialog:{renameGroupTitle:"그룹 이름 바꾸기",menu:"메뉴",cancel:"취소",ok:"확인",deleteBoardsTitle:(n,o)=>n>1?`보드 ${n}개를 삭제할까요?`:`"${o}" 보드를 삭제할까요?`,deleteBoardsBody:"HTML 파일도 함께 지워져요. 사본은 휴지통(docs/design/.trash)에 남고, 실행 취소(⌘Z)로 바로 되돌릴 수 있어요.",delete:"삭제",renameBoardTitle:"보드 이름 바꾸기",name:"이름",rename:"이름 바꾸기",renameFileTitle:"파일 이름 바꾸기",fileName:"파일 이름",renameFileRefs:n=>`이 파일을 가리키는 링크나 iframe: ${n}`,renameFileNoRefs:"이 파일을 가리키는 링크나 iframe이 없어요.",renameFileExtra:n=>`참조 ${n}개도 새 이름으로 바꾸기`,newPageTitle:"새 페이지",newPageName:n=>`페이지 ${n}`,create:"만들기",renamePageTitle:"페이지 이름 바꾸기",deletePageTitle:n=>`"${n}" 페이지를 삭제할까요?`,deletePageBody:n=>`보드 ${n}개와 메모는 지워지지 않고 첫 페이지로 옮겨져요. ⌘Z로 되돌릴 수 있어요.`,authorTitle:"댓글 작성자",save:"저장",snapshotTitle:"스냅샷 저장",snapshotLabel:"메시지",snapshotMessage:n=>`docs(design): design snapshot ${n}`,snapshotHint:"디자인 폴더만 커밋해요. 작성자는 git 설정을 따르고, 따로 스테이징한 다른 파일은 들어가지 않아요.",commit:"커밋"},toast:{linkCopied:"링크를 복사했어요",copiedPng:"PNG로 복사했어요",copiedHtml:"HTML로 복사했어요",copiedProps:"속성을 복사했어요",saveFailed:n=>`저장하지 못했어요: ${n}`,undoRedoDone:(n,o)=>`${n==="undo"?"실행 취소":"다시 실행"}: ${o}`,nothingToUndo:"되돌릴 작업이 없어요",nothingToRedo:"다시 실행할 작업이 없어요",undoAction:"실행 취소",textOnly:"텍스트(와 줄바꿈)만 든 요소만 그 자리에서 고칠 수 있어요",moved:"옮겼어요",movedFrozen:"옮겼어요 (원래 자리의 크기를 유지했어요)",copiedElement:(n,o)=>`${Bt(`<${n}>`,"을/를")} 복사했어요. 다른 보드를 편집하면서 ${o}V로 붙여 넣어요`,nothingCopied:"복사한 요소가 없어요. 편집 중에 요소를 선택하고 ⌘C를 눌러요",pasted:(n,o)=>`${n}에서 ${Bt(`<${o}>`,"을/를")} 붙여 넣었어요`,imageReplaced:n=>`이미지를 ${Bt(n,"으로/로")} 바꿨어요`,boardCreated:n=>`${n} 보드를 만들었어요`,boardCreateFailed:n=>`보드를 만들지 못했어요: ${n}`,boardsDeleted:n=>`보드 ${n}개를 삭제했어요`,duplicated:n=>`${Bt(n,"으로/로")} 복제했어요`,renamed:"이름을 바꿨어요",fileRenamed:(n,o)=>`${Bt(n,"으로/로")} 이름을 바꿨어요${o?" (참조도 바꿨어요)":""}`,notesMax:n=>`메모는 ${n}개까지 둘 수 있어요`,noteDeleted:"메모를 삭제했어요",shapeDeleted:"도형을 삭제했어요",shapesDeleted:n=>`도형 ${n}개를 삭제했어요`,imageReadFailed:"이미지를 읽지 못했어요",importOnly:n=>`${n}: HTML이나 이미지만 가져올 수 있어요`,imported:n=>`보드 ${n}개를 가져왔어요`,pagesMax:"페이지는 40개까지 만들 수 있어요",pageDeleted:"페이지를 삭제했어요",copied:"복사했어요",elementDeleted:"요소를 삭제했어요",wrapped:n=>`${Bt(n,"으로/로")} 감쌌어요`,theme:n=>`테마: ${n}`,tokensSaved:"토큰을 저장했어요",nothingChanged:"바뀐 것이 없어요",snapshot:n=>`스냅샷 ${n}`,cleanedUp:n=>`보드 ${n}개를 정리했어요`,uploaded:n=>`${Bt(n,"을/를")} 올렸어요`,tweaksSaved:"조정 값을 소스에 저장했어요",blockFlow:"블록 흐름에서는 세로 정렬이 적용되지 않아요. 부모를 flex로 바꿔 보세요",pngExporting:n=>`${n} 만드는 중…`,pngExported:n=>`${Bt(n,"을/를")} 내려받았어요`,pngNeedsBrowser:"PNG로 내보내려면 헤드리스 브라우저가 필요해요:",pngFailed:n=>`PNG를 만들지 못했어요: ${n}`},history:{lock:"잠금",unlock:"잠금 해제",flip:"뒤집기",renameGroup:"그룹 이름 바꾸기",pageFromGroup:"그룹으로 페이지 만들기",boardOptions:"보드 옵션",front:"맨 앞으로 가져오기",back:"맨 뒤로 보내기",moveBoard:"보드 옮기기",resizeBoard:"보드 크기 바꾸기",addTitle:"제목 추가",addNote:"메모 추가",deleteNote:"메모 삭제",duplicateNote:"메모 복제",moveNote:"메모 옮기기",editNote:"메모 고치기",noteStyle:"메모 스타일",addShape:"도형 추가",deleteShape:"도형 삭제",moveShape:"도형 옮기기",resizeShape:"도형 크기 바꾸기",shapeStyle:"도형 스타일",shapeFront:"도형 맨 앞으로",shapeBack:"도형 맨 뒤로",addImage:"이미지 추가",launchPage:"시작 페이지",moveToPage:"페이지로 옮기기",launchScreen:"시작 화면 정하기",changeTheme:"테마 바꾸기",cleanMissing:"파일 없는 보드 정리",editGuide:"레이아웃 가이드 고치기",addGuide:"레이아웃 가이드 추가",deleteGuide:"레이아웃 가이드 삭제",saveTokens:"토큰 저장",registerTokens:"토큰 등록"},defaults:{newTitle:"새 제목",note:"메모",pastedImage:"pasted-image.png"},menu:{openProps:"속성 패널 열기",newBoard:"새 보드",renameGroup:"그룹 이름 바꾸기…",pageFromGroup:"이 그룹으로 페이지 만들기",drawWithB:"B로 그리기",rename:"이름 바꾸기",moveUp:"위로 옮기기",moveDown:"아래로 옮기기",unsetLaunchPage:"시작 페이지 해제",setLaunchPage:"시작 페이지로 정하기",moveSelectedToPage:n=>`선택한 보드 ${n}개를 이 페이지로 옮기기`,delete:"삭제",selectInside:"안쪽 선택",playInPlace:"제자리에서 재생",stopPlay:"재생 중지",playFullScreen:"전체 화면으로 재생",lock:"잠금",unlock:"잠금 해제",copyPng:"PNG로 복사",copyHtml:"HTML로 복사",copyProps:"속성 복사",pasteProps:"속성 붙여넣기",flipH:"좌우 반전",flipV:"상하 반전",locked:"잠김",askReview:"AI에게 리뷰 요청",focusView:"프로토타입 보기",askAI:"AI",askAIAria:"AI에게 요청",askFixErrors:"AI에게 오류 수정 요청",goToBoard:"보드로 이동",exportPng:"PNG로 내보내기",exportingPng:"PNG 내보내는 중…",renameFile:"파일 이름 바꾸기…",duplicate:"복제",front:"맨 앞으로 가져오기",back:"맨 뒤로 보내기",deleteBoards:n=>`보드 ${n}개 삭제`,title:"제목",note:"메모",duplicateInFront:"앞에 복제",newBoardHere:"여기에 새 보드",mobileFrameHere:"여기에 모바일 화면 프레임",titleHere:"여기에 제목",noteHere:"여기에 메모",selectAll:"이 페이지 모두 선택",fitAll:"전체 보기",zoom100:"100%로 보기",undo:"실행 취소",redo:"다시 실행",element:"요소",editText:"텍스트 고치기",selectParent:"부모 선택",copy:"복사",pasteAfter:"뒤에 붙여넣기",replaceImage:"이미지 바꾸기…",copyForAI:"AI용 설명 복사",shape:"도형",snapshot:"스냅샷",notGit:"디자인 폴더가 git 저장소 안에 있지 않아요",snapshotStatus:(n,o)=>`스냅샷 · ${n} · 바뀐 파일 ${o}개`,snapshotNow:"지금 스냅샷 저장 (git 커밋)…",nothingChanged:"바뀐 것 없음",fileMissing:"파일이 없어요",askFixAll:"AI에게 모두 수정 요청",cleanMissing:n=>`파일 없는 보드 ${n}개 정리`},prompts:{fixErrors:n=>`이 오류들을 고쳐 줘:
53
+ ${n}`,error:"오류",review:"이 화면을 리뷰해 줘: 접근성(48px 터치 영역, 명도 대비 4.5, 라벨), 정보 위계, 토큰 위반(get_tokens, check_tokens)을 짚고 우선순위대로 고칠 방법을 알려 줘. 아무것도 고치지 말고 제안만 해 줘.",fixComment:"이 댓글이 말하는 대로 그 부분만 고쳐 줘",fixTokens:n=>`토큰 밖의 값을 토큰으로 바꿔 줘 (check_tokens로 확인해 줘):
54
+ ${n}`,fixA11y:n=>`접근성 문제를 고쳐 줘 (보이는 크기는 그대로 두고 터치 영역은 패딩으로 넓혀 줘):
55
+ ${n}`,line:"줄 "},checks:{tokenCheck:n=>`토큰 검사 · ${n}`,noOffToken:"토큰 밖의 값이 없어요",off:"꺼짐",tokensOffTitle:"등록된 토큰이 없어 검사가 꺼져 있어요",tokensOffBody:"색과 크기를 검사하지 않고, AI에게 기본 팔레트도 주지 않아요.",setUpTokens:"토큰 설정",a11y:"접근성",a11yOk:"터치 영역, 명도 대비, 라벨 문제가 없어요",askFix:"AI에게 수정 요청",notVisible:"보드가 화면에 보일 때 검사해요.",pickInEdit:n=>`보드에서 ${n} 선택`,line:n=>`${n}번째 줄`,more:n=>`외 ${n}개`,colorNotInTokens:"토큰에 없는 색",tokenFontSizes:n=>`토큰 글자 크기: ${n}`,tokenRadii:n=>`토큰 모서리: ${n}`,notMultipleOf4:"4의 배수가 아님",tokenWeights:n=>`토큰 굵기: ${n}`,smallTarget:(n,o,r,f)=>`<${n}> 터치 영역 ${o}×${r} (${f} 미만)`,noName:n=>`<${n}>에 이름이 없어요 (aria-label, 텍스트, label)`,noAlt:'<img>에 alt가 없어요 (장식용이면 alt="")',lowContrast:(n,o,r)=>`명도 대비 ${n}:1 (${o} 필요) "${r}"`},tokens:{import:"토큰 가져오기 (tokens.json 또는 Figma 변수 JSON)",importFailed:n=>`가져오지 못했어요: ${n}`,theme:"테마",addTheme:"테마 추가 (지금 테마 복사)",newTheme:"새 테마",newThemeN:n=>`새 테마 ${n}`,activeTheme:"사용 중인 테마",themeName:"테마 이름",importedTheme:"가져온 테마",colors:n=>`색 ${n}`,addColor:"색 추가",colorN:n=>`색 ${n}`,colorOf:n=>`${n} 색`,colorName:"색 이름",remove:n=>`${n} 삭제`,fontSizes:"글자 크기",fontWeights:"글자 굵기",radii:"모서리",spacing:"간격",touchTarget:"터치 영역",minTouchTarget:"최소 터치 영역",saveTitle:"docs/design/tokens.json에 저장",save:"저장",register:"토큰 등록",registeredHint:"속성 패널의 색 견본, 토큰 검사, AI(get_tokens)가 선택한 테마의 값을 써요.",defaultHint:"아직 쓰이지 않는 시작 값이에요. 등록하면 tokens.json에 저장되고 토큰 검사와 AI 팔레트가 켜져요.",noColors:"색 값을 찾지 못했어요"},tweaks:{revert:"되돌리기",save:"소스에 저장",hint:"CSS 변수로 바로 적용돼요. 저장하면 board-tweaks JSON의 값만 바뀌어요."},inspector:{shotFailed:n=>`실패: ${n}`,kindName:n=>({text:"텍스트",button:"버튼",link:"링크",image:"이미지",input:"입력란",icon:"아이콘",container:"컨테이너"})[n]??n,crumbs:"선택 경로",crumbBoard:"보드 선택",crumbParent:n=>`${n} 선택`,crumbElement:(n,o)=>`<${n}> ${o}`,more:n=>`외 ${n}개`,copy:"복사",copied:"복사함",capturing:"캡처하는 중…",screenshot:"스크린샷",boardScreenshot:"보드 스크린샷",boardScreenshotTitle:"이 보드의 PNG를 디자인 폴더 옆에 저장해요",screenshotTitle:"이 요소의 PNG를 저장해요",actions:"요소 작업",boardActions:"보드 작업"},comments:{pinLabel:(n,o,r)=>`${o}의 댓글 ${n}: ${r}`,title:"댓글",placeholderElement:n=>`선택한 요소(${n})에 댓글 달기`,placeholderBoard:"보드에 댓글 달기",placeholder:"댓글 달기",add:"댓글",authorTitle:"댓글 작성자 이름 바꾸기",author:n=>`작성자: ${n}`,replyPlaceholder:n=>`${Bt(n,"으로/로")} 답글 달기 (⌘Enter)`,reply:"답글",replyResolve:"답글 달고 해결",reopen:"다시 열기",resolve:"해결",sendToAI:"AI에게 보내기",sendToAITitle:"이 댓글이 가리키는 곳만 고치도록 AI에게 보내요",openThread:"이 댓글만 보기",allOnBoard:n=>`이 보드 댓글 ${n}개 모두`,mode:"댓글 모드",modeTitle:"댓글 모드 (⌥C)",allTitle:"모든 댓글",thisPage:"이 페이지",allPages:"모든 페이지",showResolved:"해결됨",scope:"보일 댓글",edit:"편집",deleteThread:"삭제",more:"편집·삭제",none:"댓글 없음",nothingSelected:"선택 없음"},assets:{uploading:"올리는 중…",upload:"올리기 (이미지와 글꼴, 끌어다 놓아도 돼요)",loading:"불러오는 중…",empty:"아직 에셋이 없어요. 올린 이미지는 docs/design/assets/에 저장되고 화면에서는 ../assets/이름 으로 써요.",copyPath:" · 클릭해 경로 복사",file:"파일",pickImage:"이미지 고르기",pickLabel:", 이 이미지 쓰기",close:"닫기"},chat:{aria:"AI 채팅",agent:"에이전트",agentHint:"파일을 고칠 에이전트",agentButton:(n,o)=>o?`에이전트: ${n} — ${o}`:`에이전트: ${n}`,agentStatus:{ready:"준비됨",signin:"로그인 필요",missing:"설치 안 됨",unknown:"확인하지 못함"},checking:"확인하는 중…",checkedOnOpen:"AI 탭을 열 때 확인함",checkAgain:"다시 확인",model:"모델",modelDefault:"기본값 (CLI 설정)",modelTitle:n=>`${n}의 모델: 별칭이나 전체 모델 ID. 비워 두면 CLI 기본값을 써요.`,continuing:"대화 이어 가는 중",newConversation:"새 대화",newChat:"새 채팅",intro:n=>`선택한 보드와 요소, 화면에 보이는 보드를 맥락으로 ${n}에게 보내요. 에이전트가 소스 HTML을 바로 고치고, 캔버스는 곧바로 다시 그려져요.`,suggestions:[{label:"AI 리뷰: 접근성, 명도 대비, 위계",text:"선택한 화면을 리뷰해 줘: 접근성(48px 터치 영역, 명도 대비 4.5, 라벨), 정보 위계, 토큰 위반(get_tokens, check_tokens). 아무것도 고치지 말고 우선순위대로 제안만 해 줘.",n:1},{label:"이 화면의 시안 3개",text:"선택한 화면을 서로 다른 방향으로 시안 3개 만들어 줘 (레이아웃, 위계, 강조점을 각각 다르게).",n:3},{label:"선택한 버튼 문구 줄이기",text:"선택한 버튼 문구를 줄여 줘",n:1},{label:"새 빈 상태 화면 만들기",text:"새 빈 상태 화면을 만들어 줘",n:1}],remedySignin:(n,o)=>`${n}에 로그인되어 있지 않아요. 터미널에서 \`${o}\` 명령을 실행해요.`,remedyMissing:n=>`\`${n}\` 명령을 찾지 못했어요. 설치한 뒤 다시 확인해요.`,copyCommand:"명령 복사",copy:"복사",copied:"복사함",sendNeedsSignin:n=>`보내려면 ${n}에 로그인해요`,sendNeedsInstall:n=>`보내려면 ${Bt(n,"을/를")} 설치해요`,running:"실행 중",cancelled:"취소됨",failed:"실패",retry:"다시 시도",switchTo:n=>`${Bt(n,"으로/로")} 바꾸기`,details:"자세히",noFilesChanged:"바뀐 파일이 없어요.",restored:"실패한 메시지에서 되살렸어요",madeVariants:n=>`시안 ${n}개를 나란히 만들었어요 · 보기`,thinking:"생각하는 중…",chipElement:n=>`요소 <${n}>`,chipElementText:(n,o)=>`요소 <${n}> ${o}`,chipBoards:n=>`보드 ${n}개`,chipVisible:n=>`보이는 보드 ${n}`,chipComment:n=>`댓글 "${n}"`,variants:n=>`시안 ${n}개`,tooBig:n=>`${n}: 15MB보다 커요`,refLink:"참고 링크",placeholderRunning:"실행 중… (Esc로 취소)",placeholder:"무엇을 바꿀까요? (Enter로 보내기 · Shift+Enter로 줄바꿈)",input:"AI에게 보낼 메시지",attach:"파일이나 이미지 첨부",attachTitle:"파일이나 이미지 첨부 (끌어다 놓거나 붙여 넣어도 돼요)",addLink:"참고 링크 추가",variantsTitle:"선택한 보드를 복사해 서로 다른 시안을 나란히 만들어요",variantsDisabledTitle:"보드를 하나 선택하면 쓸 수 있어요",variantsAria:"시안 개수",cancel:"취소",cancelTitle:"취소 (Esc)",send:"보내기",chipRemoveTitle:"클릭해 빼기",chipAddTitle:"클릭해 첨부",remove:n=>`${n} 빼기`,howToInstall:"설치 방법",customCommand:"직접 지정한 명령…",checkedAt:(n,o)=>o?`AI 탭을 열 때 확인함 · ${n}`:`${n}에 다시 확인함`,customTitle:"직접 지정한 명령",customName:"이름",customCommandLabel:"명령",customNamePlaceholder:"Aider",customCommandPlaceholder:"aider --message {prompt} --yes",customHint:"`{prompt}`는 요청과 캔버스 맥락으로 바뀌어요. 출력은 일반 텍스트로 보여요.",customSave:"저장",customCommandTitle:n=>`셸 없이 실행해요: ${n}`,waiting:"응답 기다리는 중",waitingHint:"위의 요청에 답해 주세요",permAsk:(n,o,r)=>o==="command"?`${Bt(n,"이/가")} 명령 실행을 요청해요`:o==="edit"?`${Bt(n,"이/가")} 파일 ${r==="Write"?"쓰기를":"수정을"} 요청해요`:o==="fetch"?`${Bt(n,"이/가")} 페이지 가져오기를 요청해요`:`${Bt(n,"이/가")} ${r} 사용을 요청해요`,permIn:"위치",permOutside:"디자인 폴더 밖",allowOnce:"한 번 허용",alwaysAllow:n=>`${n} 항상 허용`,alwaysAllowTitle:"Easel을 다시 시작할 때까지, 이 캔버스에서만",deny:"거부",permDone:{once:"허용함",always:"항상 허용함",deny:"거부함"},permDoneOutside:"(디자인 폴더 밖)",noPause:{codex:"Codex exec는 멈추고 물어볼 수 없어서 샌드박스 설정을 따라요.",cursor:"Cursor Agent는 여기서 멈추고 물어볼 수 없어서 --force로 실행돼요.",gemini:"Gemini CLI는 여기서 멈추고 물어볼 수 없어서 수정을 스스로 받아들여요."},runChanged:(n,o)=>n&&o?`보드 ${n}개 바꿈 · ${o}개 추가`:o?`보드 ${o}개 추가`:n?`보드 ${n}개 바꿈`:"캔버스를 바꿈",chipNew:n=>`${n} (새로 만듦)`,chipRemoved:n=>`${n} (삭제됨)`,undoRun:"이 실행 취소",compare:"비교",redo:"다시 실행",runUndone:n=>`실행을 취소했어요 · 보드 ${n}개를 되돌렸어요`,conflictUndo:n=>`이 실행 뒤에 바뀐 보드: ${n}. 나머지만 취소하고 이 보드는 그대로 둘까요, 모두 취소하고 덮어쓸까요?`,conflictRedo:n=>`취소한 뒤에 바뀐 보드: ${n}. 나머지만 다시 실행하고 이 보드는 그대로 둘까요, 모두 다시 실행하고 덮어쓸까요?`,undoRest:"나머지만 취소",undoAll:"그래도 모두 취소",redoRest:"나머지만 다시 실행",redoAll:"그래도 모두 다시 실행",restoreCopy:"이 실행 전 사본으로 되돌리기",savedAt:n=>`${n}에 저장함`,copyGone:"이 실행 전 사본이 없어요 (최근 10개만 보관해요).",restoredCopy:"캔버스를 이 실행 전 사본으로 되돌렸어요",restoreTitle:"이 실행 전 사본으로 되돌릴까요?",restoreBody:n=>`캔버스 전체를 이 실행 전인 ${n} 상태로 되돌려요. 모든 화면과 board.json이 바뀌고, 그 뒤에 내가 바꾸거나 다른 실행이 바꾼 것도 포함돼요. 실행 취소로 되돌리기를 취소할 수 있어요.`,restoreOk:"되돌리기",restarted:n=>`Easel 다시 시작됨 · ${n}`},compare:{title:n=>`비교 · ${n}`,boards:"보드",before:"전",after:"후",notBefore:"실행 전에는 없던 보드예요.",notAfter:"이 실행이 보드를 삭제했어요.",notBeforeChange:"이 변경 전에는 없던 보드예요.",close:"닫기"},activity:{stepName:n=>{const o=String(n),r={text:"텍스트",heading:"제목","button copy":"버튼 글","link text":"링크 글",label:"라벨",style:"스타일",attribute:"속성",tweaks:"조정 값",colour:"글자색",fill:"채우기","text size":"글자 크기",weight:"굵기",italic:"기울임",underline:"밑줄",alignment:"정렬",radius:"모서리",padding:"패딩",gap:"간격",opacity:"불투명도","letter spacing":"자간",size:"크기",position:"위치",shadow:"그림자",border:"테두리"},f={Delete:"요소 삭제",Duplicate:"요소 복제",Move:"요소 이동",Add:"요소 추가"},m={"Add board":"보드 추가","Duplicate board":"보드 복제","Delete board":"보드 삭제","Rename board":"보드 이름 변경","Move board":"보드 이동","Resize board":"보드 크기 변경","Change board":"보드 변경","Board options":"보드 옵션","Bring to front":"맨 앞으로","Send to back":"맨 뒤로","Move to page":"페이지로 이동","Set launch screen":"시작 화면 지정"};let g;if(g=o.match(/^Undo (\d+) changes$/))return`변경 ${g[1]}개 실행 취소`;if(g=o.match(/^Undo (.+)$/))return`실행 취소: ${ub.activity.stepName(g[1])}`;if((g=o.match(/^Change (.+) on (.+)$/))&&r[g[1]])return`${g[2]} · ${r[g[1]]} 변경`;if(g=o.match(/^(Delete|Duplicate|Move|Add) element on (.+)$/))return`${g[2]} · ${f[g[1]]}`;if(g=o.match(/^Group elements on (.+)$/))return`${g[1]} · 요소 묶기`;if(g=o.match(/^(Add|Delete|Move|Resize|Change) (\d+) boards$/))return`보드 ${g[2]}개 ${{Add:"추가",Delete:"삭제",Move:"이동",Resize:"크기 변경",Change:"변경"}[g[1]]}`;for(const[v,S]of Object.entries(m))if(o.startsWith(v+" "))return`${S} · ${o.slice(v.length+1)}`;return(g=o.match(/^Edit (.+)$/))?`${g[1]} · 편집`:(g=o.match(/^Change (.+)$/))?`${g[1]} · 변경`:o},outside:"Easel 밖",ago:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"방금":o<60?`${o}분`:o<1440?`${Math.floor(o/60)}시간`:`${Math.floor(o/1440)}일`},agoLong:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"방금":o<60?`${o}분 전`:o<1440?`${Math.floor(o/60)}시간 전`:`${Math.floor(o/1440)}일 전`},tag:(n,o,r,f)=>`${n} · ${o} · ${f&&r===1?"새 보드":`변경 ${r}개`}`,tagTitle:n=>`${n} — 클릭해 변경 내용, 전/후, 실행 취소 보기`,tagsAria:n=>`다른 사람의 변경 ${n}개`,popAria:n=>`${n}의 변경`,element:wy,change:n=>{const o=wy(n.tag,n.cls);switch(n.kind){case"style":return`${o} 스타일 바뀜`;case"attr":return`${o} 속성 바뀜`;case"edited":return`${o} 바뀜`;case"added":return n.count>1?`요소 ${n.count}개 추가됨`:`${o} 추가됨`;case"removed":return n.count>1?`요소 ${n.count}개 삭제됨`:`${o} 삭제됨`;case"replaced":return`${o} 교체됨`;case"many":return`요소 ${n.count}${n.more?"+":""}개 바뀜`;case"page":return"페이지 스타일이나 제목 바뀜";case"source":return"소스의 공백이나 주석만 바뀜";case"new":return"새 보드";case"deleted":return"보드 삭제됨";case"moved":return"보드 옮겨짐";case"resized":return"보드 크기 바뀜";case"renamed":return"보드 이름 바뀜";case"options":return"보드 옵션 바뀜";default:return"바뀜"}},changes:n=>`이 보드의 변경 ${n}개`,quote:n=>`“${n}”`,arrow:"→",beforeAfter:"전 / 후",undo:"실행 취소",undoTitle:n=>n===1?"이 변경 실행 취소":`이 변경 ${n}개 실행 취소`,conflict:n=>`그 뒤에 바뀐 보드: ${n}. 나머지만 취소하고 이 보드는 그대로 둘까요, 모두 취소하고 덮어쓸까요?`,undoRest:"나머지만 취소",undoAll:"그래도 모두 취소",cancel:"취소",close:"닫기",historyButton:"기록",historyTitle:"기록 · 최신순",historyEmpty:"아직 없어요. 이 세션에서 바꾼 것이 여기에 보여요.",historyFoot:"기록은 이 세션 동안 보관돼요.",now:"지금",goBack:"여기로 돌아가기",goBackAria:(n,o,r)=>`${o}, ${r}: ${n} · 여기로 돌아가기`,nowAria:(n,o,r)=>`${o}, ${r}: ${n} · 지금`,undoneAria:(n,o,r)=>`${o}, ${r}: ${n} · 취소됨`,wentBack:n=>`되돌아감: ${n}`},occupancy:{editing:n=>`${n} 편집 중…`,you:"나 · 편집 중",personEditing:n=>`${n} · 편집 중`,done:(n,o)=>`${n} · ${o} 완료`,someone:"누군가",clock:n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),tagsAria:"이 보드에 있는 사람",listDot:n=>`${n} 편집 중`,youListDot:"내가 편집 중",forked:(n,o,r)=>`${n}에 포크됨 — ${Bt(r,"이/가")} 편집하는 동안 ${Bt(o,"이/가")} 시작함`,forkBlock:(n,o)=>n===1?`${o}의 포크`:`${o}의 포크 ${n}개`,forkBlockWhile:(n,o,r)=>`${n===1?`${o}의 포크`:`${o}의 포크 ${n}개`} · ${Bt(r,"이/가")} 편집하는 동안 만듦`,forkBlockShort:n=>n===1?"포크":`포크 ${n}개`,useThis:"이걸로 쓰기",useThisOne:"이 버전으로 쓰기",useThisTitle:"이 시안을 원래 보드로 만들고 나머지 시안은 휴지통으로 보내요",useThisOneTitle:n=>`이 버전을 보드로 남기고 다른 버전 ${n}개는 휴지통으로 보내요`,waitFor:n=>`${Bt(n,"이/가")} 편집을 마칠 때까지 기다려요`,confirmVariant:(n,o)=>`${Bt(`"${n}"`,"을/를")} ${o}에 적용할까요?`,confirmVariantBody:(n,o)=>`${Bt(n,"이/가")} 바뀌어요.${o?` 다른 시안 ${o}개는 휴지통으로 가요.`:""}`,confirmFork:(n,o)=>`${o}에 ${Bt(`"${n}"`,"을/를")} 쓸까요?`,confirmForkBody:(n,o)=>`${Bt(n,"이/가")} 이 버전으로 바뀌어요. ${o?`이 포크와 다른 포크 ${o}개는 휴지통으로 가요.`:"포크는 휴지통으로 가요."}`,confirmKeep:n=>`${Bt(`"${n}"`,"을/를")} 남길까요?`,confirmKeepBody:(n,o)=>`${Bt(n,"은/는")} 휴지통으로 가요.`,apply:"적용",keepAll:"모두 남기기",keepBoth:"둘 다 남기기",applied:(n,o)=>`${Bt(n,"을/를")} ${o}에 적용했어요`,kept:(n,o)=>`${Bt(n,"을/를")} 남겼어요. 다른 버전 ${o}개는 휴지통에 있어요`,keptAll:(n,o)=>n==="variant"?`시안 ${o}개를 모두 보드로 남겼어요`:`버전 ${o+1}개를 모두 보드로 남겼어요`,undo:"실행 취소"},requests:{goTo:"AI 요청 보낼 곳",easelChat:"Easel 채팅",easelChatNote:"Easel이 Claude Code를 직접 실행해요.",host:"대화 중인 에이전트",hostNote:"요청이 캔버스에 남아요.",connected:"연결됨",noneConnected:"연결된 에이전트 없음",thisFolder:"이 폴더",otherFolder:"다른 폴더",since:n=>`${n}부터`,sendTo:"받는 에이전트",anyAgent:"아무 에이전트",sayTitle:"에이전트에게",line:"Easel 요청 처리해 줘",quote:n=>`“${n}”`,copy:"복사",copied:"복사됨",copyTitle:"에이전트 채팅에 붙여 넣을 말 복사 (또는 /easel:requests)",forAi:"AI용",forAgent:n=>`${n}용`,addForAi:"남기기",forAiCheck:"AI용",forAiCheckTitle:"이 댓글을 대화 중인 에이전트에게 남기는 요청으로",composerTitle:"AI에게 요청",composerAria:"AI에게 남길 요청",composerPlaceholder:"여기서 무엇을 바꿀까요?",cancel:"취소",waiting:"대기 중",waitingFor:n=>`${n} 대기 중`,took:(n,o)=>`${n} 작업 중 · ${o}`,failed:n=>`${Bt(n,"이/가")} 끝내지 못함`,left:n=>`대기 중 (${n} 나감)`,cancelRequest:"취소",useChat:"Easel 채팅으로",more:"더 보기",retry:"다시",undoChange:"되돌리기",undone:"되돌림",undoGone:"지금은 되돌릴 수 없음",changedTitle:n=>`바뀐 보드 ${Bt(n,"으로/로")} 가기`,waitingTag:n=>`대기 ${n}`,pinLabel:(n,o,r)=>o?`에이전트를 기다리는 요청 ${n}: ${r}`:`AI용 요청 ${n}: ${r}`,countAria:n=>`에이전트를 기다리는 요청 ${n}개`,filterAria:"보일 댓글",filterAll:"전체",filterForAi:"AI용",listTitle:"AI용",allBoards:"모든 보드",listEmpty:"요청 없음",introTitle:"이 창의 에이전트에게 요청을 남길까요?",switchTo:"바꾸기",keepChat:"Easel 채팅 유지",backToRequests:"요청으로 돌아가기",hostShort:"대화 중인 에이전트",easelChatShort:"Easel 채팅",goesTo:"요청 보낼 곳",connectedN:n=>n?`${n}개 연결됨`:"연결 없음",chatOnce:"Easel 채팅, 이 요청만",menuHost:"AI 요청: 대화 중인 에이전트",menuChat:"AI 요청: Easel 채팅",added:"에이전트에게 남겼어요",cancelled:"취소했어요. 댓글은 남아요.",kind:{element:"요소",board:"보드",tokens:"토큰 검사",a11y:"접근성",errors:"오류",review:"검토",comment:"댓글"},frameBoard:n=>`Easel 보드 ${n}`,frameElement:(n,o)=>`Easel 보드 ${n}, 선택: ${o}`},update:{out:n=>`Easel ${Bt(n,"이/가")} 나왔어요`,copy:"명령 복사",copied:"복사했어요. 실행한 뒤 Easel을 다시 시작해요",hide:"다음 버전까지 숨기기"}},Hd=[{id:"en",name:"English"},{id:"ko",name:"한국어"}],db="design-canvas:lang";function Ox(n,o){return n==="en"||n==="ko"?n:/^ko($|[-_])/i.test(o??"")?"ko":"en"}function Rx(){if(typeof window>"u")return"en";let n=null;try{n=localStorage.getItem(db)}catch{}return Ox(n,navigator.language)}const Jd=Rx();function Dx(n){try{localStorage.setItem(db,n)}catch{}location.reload()}const Bx={en:Ax,ko:ub},d=Bx[Jd],Hx=1440*60*1e3,Qh=n=>`design-canvas:seen:${n}`,nf=n=>n.by?"ai":n.person||!n.outside?"person":"file",Sm=(n,o)=>n.by??n.person??(n.outside?d.activity.outside:o);function Lx(n){const[o,r]=b.useState(null),[f,m]=b.useState(()=>Date.now()),[g,v]=b.useState({}),S=b.useRef(null),j=b.useCallback(()=>{S.current&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{Te.get(`/api/activity?client=${encodeURIComponent(tf)}`).then(r).catch(()=>{})},120)},[]);b.useEffect(()=>{j();const M=window.setInterval(()=>m(Date.now()),3e4);return()=>window.clearInterval(M)},[j]),b.useEffect(()=>{if(!(!n||!o))try{const M=JSON.parse(localStorage.getItem(Qh(n))??"{}"),z=Object.fromEntries(Object.entries(M).filter(([H])=>H.startsWith(`${o.boot}:`)));v(z),Object.keys(z).length!==Object.keys(M).length&&localStorage.setItem(Qh(n),JSON.stringify(z))}catch{}},[n,o==null?void 0:o.boot]);const E=b.useCallback(M=>{!o||!M.length||v(z=>{const H=M.filter(T=>!z[`${o.boot}:${T}`]);if(!H.length)return z;const W={...z,...Object.fromEntries(H.map(T=>[`${o.boot}:${T}`,Date.now()]))};try{n&&localStorage.setItem(Qh(n),JSON.stringify(W))}catch{}return W})},[o,n]),x=b.useCallback(M=>{if(!o)return"fresh";const z=M.steps.map(H=>g[`${o.boot}:${H}`]);return z.some(H=>!H)?"fresh":f-Math.max(...z)>Hx?"gone":"seen"},[o,g,f]),w=b.useCallback(M=>((o==null?void 0:o.tags[M])??[]).filter(z=>x(z)!=="gone"),[o,x]);return{data:o,now:f,reload:j,markSeen:E,stateOf:x,tagsOf:w}}function _x({file:n,act:o,me:r,onOpen:f,lead:m,open:g}){const v=o.tagsOf(n);return!v.length&&!m?null:s.jsxs("span",{className:"act-tags",role:"group","aria-label":v.length?d.activity.tagsAria(v.reduce((S,j)=>S+j.count,0)):d.occupancy.tagsAria,children:[m,v.map(S=>{const j=d.activity.tag(Sm(S,r),d.activity.ago(o.now-S.at),S.count,S.newBoard);return s.jsxs("button",{className:`act-tag ${o.stateOf(S)==="seen"?"seen":""}`,"data-tag":`${n}|${S.key}`,title:d.activity.tagTitle(j),"aria-haspopup":"dialog","aria-expanded":g===S.key,onPointerDown:E=>E.stopPropagation(),onDoubleClick:E=>E.stopPropagation(),onClick:E=>{E.stopPropagation(),f(n,S.key)},children:[s.jsx(Q,{name:nf(S),size:16}),s.jsx("span",{className:"act-tag-text",children:j})]},S.key)})]})}function Ux({tag:n}){const o=n.change;return n.count>1?s.jsx("div",{className:"callout-diff",children:d.activity.changes(n.count)}):(o==null?void 0:o.kind)==="text"?s.jsxs("div",{className:"callout-diff",children:[s.jsx("span",{className:"diff-old",children:d.activity.quote(o.from??"")})," ",d.activity.arrow," ",s.jsx("span",{className:"diff-new",children:d.activity.quote(o.to??"")})]}):s.jsx("div",{className:"callout-diff",children:o?d.activity.change(o):d.activity.change({kind:"",count:1})})}function qx(n){const o=b.useRef(null),[r,f]=b.useState(null),m=()=>document.querySelector(`[data-tag="${CSS.escape(`${n.file}|${n.tag.key}`)}"]`);b.useLayoutEffect(()=>{var M,z;const v=m();if(!v)return void n.onClose();const S=v.getBoundingClientRect(),j=((M=o.current)==null?void 0:M.offsetWidth)??280,E=((z=o.current)==null?void 0:z.offsetHeight)??140,x=Math.max(8,Math.min(S.left,window.innerWidth-j-8)),w=S.bottom+8+E>window.innerHeight-8?Math.max(8,S.top-E-8):S.bottom+8;(!r||Math.abs(r.x-x)>.5||Math.abs(r.y-w)>.5)&&f({x,y:w})}),b.useEffect(()=>{var S,j;(j=(S=o.current)==null?void 0:S.querySelector("button"))==null||j.focus();const v=E=>{var w,M;const x=E.target;(w=o.current)!=null&&w.contains(x)||(M=m())!=null&&M.contains(x)||x instanceof Element&&x.closest(".dialog-backdrop")||n.onClose()};return window.addEventListener("pointerdown",v,!0),()=>window.removeEventListener("pointerdown",v,!0)},[n.file,n.tag.key]);const g=Sm(n.tag,n.me);return s.jsxs("div",{ref:o,className:"callout",role:"dialog","aria-label":d.activity.popAria(g),style:{left:(r==null?void 0:r.x)??-9999,top:(r==null?void 0:r.y)??-9999},onKeyDown:v=>{var S;v.key==="Escape"&&(v.stopPropagation(),n.onClose(),(S=m())==null||S.focus())},children:[s.jsxs("div",{className:"callout-top",children:[s.jsx(Q,{name:nf(n.tag),size:16}),g," ",s.jsxs("span",{className:"muted",children:["· ",d.activity.agoLong(n.now-n.tag.at)]}),s.jsx("button",{className:"icon-btn sm callout-x","aria-label":d.activity.close,title:d.activity.close,onClick:n.onClose,children:s.jsx(Q,{name:"close",size:14})})]}),s.jsx(Ux,{tag:n.tag}),s.jsxs("div",{className:"callout-actions",children:[s.jsxs("button",{onClick:n.onCompare,children:[s.jsx(Q,{name:"compare",size:14})," ",d.activity.beforeAfter]}),s.jsxs("button",{disabled:n.busy,title:d.activity.undoTitle(n.tag.steps.length),onClick:()=>n.onUndo(),children:[s.jsx(Q,{name:"undo",size:14})," ",d.activity.undo]})]}),n.conflict&&s.jsxs("div",{className:"rr-conflict",role:"alert",children:[s.jsx("p",{children:d.activity.conflict(n.conflict.join(", "))}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{onClick:()=>n.onUndo("rest"),children:d.activity.undoRest}),s.jsx("button",{className:"danger",onClick:()=>n.onUndo("all"),children:d.activity.undoAll}),s.jsx("button",{onClick:n.onCancelConflict,children:d.activity.cancel})]})]})]})}function Vx({frame:n,paths:o,zoom:r}){const[f,m]=b.useState([]),g=o.join(",");b.useEffect(()=>{if(!n)return m([]);const S=()=>{const E=n.isConnected?n.contentDocument:null;if(!(E!=null&&E.body))return m([]);m(o.map(x=>An(E,x)).filter(x=>!!x&&x!==E.body).map(As))};S();const j=window.setTimeout(S,300);return n.addEventListener("load",S),n.addEventListener("dc-reloaded",S),n.addEventListener("dc-patched",S),()=>{n.removeEventListener("dc-patched",S),window.clearTimeout(j),n.removeEventListener("load",S),n.removeEventListener("dc-reloaded",S)}},[n,g]);const v=1/Math.max(r,.05);return s.jsx(s.Fragment,{children:f.map((S,j)=>s.jsx("div",{className:"box change-outline",style:{left:S.x,top:S.y,width:S.w,height:S.h,"--px":`${v}px`}},j))})}function Gx(n){var E;const o=b.useRef(null),r=Math.max(0,n.steps.findIndex(x=>x.now)),[f,m]=b.useState(r),g=b.useRef([]),v=(E=n.steps[r])==null?void 0:E.id;b.useEffect(()=>{var x;(x=g.current[r])==null||x.focus(),m(r)},[v]),b.useEffect(()=>{const x=w=>{var z;const M=w.target;(z=o.current)!=null&&z.contains(M)||M instanceof Element&&M.closest(".caret-btn")||n.onClose()};return window.addEventListener("pointerdown",x,!0),()=>window.removeEventListener("pointerdown",x,!0)},[n.onClose]);const S=x=>{var M;const w=Math.max(0,Math.min(n.steps.length-1,x));m(w),(M=g.current[w])==null||M.focus()},j=b.useMemo(()=>{var z;const x=((z=document.querySelector(".oc-dock"))==null?void 0:z.getBoundingClientRect())??n.anchor,w=Math.min(448,window.innerWidth-16);if(!x)return{left:8,bottom:76,width:w};const M=Math.round(window.innerHeight-x.top+8);return{left:Math.round(Math.max(8,Math.min(x.right-w,window.innerWidth-w-8))),bottom:M,width:w,maxHeight:Math.round(window.innerHeight-M-8)}},[n.anchor]);return s.jsxs("div",{ref:o,className:"menu oc-hist entering",role:"menu","aria-label":d.activity.historyTitle,style:j,onKeyDown:x=>{var w;["Escape","ArrowDown","ArrowUp","Home","End","Enter"," "].includes(x.key)&&x.stopPropagation(),x.key==="Escape"?(x.preventDefault(),n.onClose(),(w=document.querySelector(".caret-btn"))==null||w.focus()):x.key==="ArrowDown"||x.key==="ArrowUp"?(x.preventDefault(),S(f+(x.key==="ArrowDown"?1:-1))):(x.key==="Home"||x.key==="End")&&(x.preventDefault(),S(x.key==="Home"?0:n.steps.length-1))},children:[s.jsx("div",{className:"oc-menu-h",children:d.activity.historyTitle}),!n.steps.length&&s.jsx("p",{className:"hist-empty",children:d.activity.historyEmpty}),s.jsx("div",{className:"hist-rows",children:n.steps.map((x,w)=>{const M=Sm(x,n.me),z=d.activity.ago(n.now-x.at);return s.jsxs("button",{ref:H=>void(g.current[w]=H),role:"menuitem",className:`menu-item oc-hrow ${x.now?"now":""} ${x.undone?"past":""} ${f===w?"active":""}`,"aria-label":(x.now?d.activity.nowAria:x.undone?d.activity.undoneAria:d.activity.goBackAria)(d.activity.stepName(x.name),M,z),"aria-current":x.now?"step":void 0,title:x.label,"aria-disabled":n.busy||void 0,onMouseEnter:()=>m(w),onFocus:()=>m(w),onClick:()=>!x.now&&!n.busy&&n.onGo(x),children:[s.jsx("span",{className:"oc-now-dot","aria-hidden":"true"}),s.jsxs("span",{className:"oc-who",children:[s.jsx(Q,{name:nf(x),size:16}),s.jsx("span",{children:M})]}),s.jsx("span",{className:"oc-what",children:d.activity.stepName(x.name)}),x.now?s.jsx("span",{className:"oc-mark",children:d.activity.now}):f===w?s.jsx("span",{className:"oc-mark go",children:d.activity.goBack}):s.jsx("span",{}),s.jsx("span",{className:"oc-when",children:z})]},x.id)})}),s.jsx("div",{className:"menu-foot",children:s.jsx("span",{children:d.activity.historyFoot})})]})}const Yx=3,Ny=(n,o,r=Yx)=>Math.abs(n)+Math.abs(o)>=r;function Xx(n,o,r=8,f=n){const m=(o.full??o.w)>Math.min(n,f)-r*2;let g=Math.max(r,Math.round((n-o.w)/2));return g+o.w>f-r&&(g=Math.max(r,Math.round((f-o.w)/2))),{x:g,icons:m}}function Kx(n,o=2){const r=n.split("/"),f=r.slice(1).map((m,g)=>r.slice(0,g+1).join("/"));return{paths:f.slice(-o),skipped:f.length>o}}function qa(n){const o=(n??"").trim(),r=o.match(/^(-?\d+(?:\.\d+)?)px$/);return r?String(Number(r[1])):o}const dm=n=>(n??"").trim().split(/\s+/).filter(Boolean).map(qa).join(" · ");function Zx(n){return n.replace(/·/g," ").trim().split(/\s+/).filter(Boolean).map(r=>/^-?\d+(?:\.\d+)?$/.test(r)?`${Number(r)}px`:r).join(" ")}function fm(n,o){const r=Number(n);return!n||!Number.isFinite(r)?String(n??""):o[r]?`${o[r]} · ${r}`:String(r)}const Fx=/^(system-ui|-apple-system|blinkmacsystemfont|ui-sans-serif)$/i;function Sy(n){var r;const o=((r=(n??"").split(",")[0])==null?void 0:r.trim().replace(/^["']|["']$/g,""))??"";return Fx.test(o)?"System UI":o}function Qx(n){const o=n.trim();return/^system ui$/i.test(o)?"system-ui":o.includes(",")||/^["'].*["']$/.test(o)||!/\s/.test(o)?o:`"${o}"`}function fa(n){const o=(n??"").trim().toLowerCase();let r=o.match(/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/);if(r){let f=r[1];return f.length<=4&&(f=[...f].map(m=>m+m).join("")),f.length===8&&f.slice(6)!=="ff"?null:"#"+f.slice(0,6).toUpperCase()}return r=o.match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+%?))?\s*\)$/),r?r[4]!=null&&parseFloat(r[4])<(r[4].endsWith("%")?100:1)?null:"#"+[r[1],r[2],r[3]].map(f=>Math.round(Number(f)).toString(16).padStart(2,"0")).join("").toUpperCase():null}const fb=n=>n.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"token";function pu(n,o){var g;const r=(n??"").trim(),f=r.match(/^var\(\s*--([a-z0-9-]+)/i);if(f){const v=o.find(j=>fb(j.name)===f[1].toLowerCase());if(v)return v;const S=(g=r.match(/,\s*([^)]+)\)\s*$/))==null?void 0:g[1];return S?pu(S,o):null}const m=fa(r);return m?o.find(v=>fa(v.value)===m)??null:null}function Px(n,o){const r=fb(n.name);if(o[`--${r}`]!=null)return`var(--${r})`;const f=fa(n.value),m=Object.keys(o).find(g=>f&&fa(o[g])===f);return m?`var(${m})`:`var(--${r}, ${f??n.value})`}const Jx=(n,o)=>n==="text"&&fa(o)==null?"color":"background";function Xd(n,o,r=1,f=0){const m=parseFloat(n),g=Number.isFinite(m)?m:0;return Math.max(f,Math.round((g+o*r)*100)/100)}function Ix(n,o,r=4){return(n||"0px").trim().split(/\s+/).map(m=>`${Xd(m,o,r)}px`).join(" ")}const hm=[{id:"yellow",label:d.shapes.stickyColors.yellow,bg:"#FFF1A8"},{id:"orange",label:d.shapes.stickyColors.orange,bg:"#FFD9BC"},{id:"pink",label:d.shapes.stickyColors.pink,bg:"#FFD6E2"},{id:"purple",label:d.shapes.stickyColors.purple,bg:"#E5DAFF"},{id:"blue",label:d.shapes.stickyColors.blue,bg:"#D2E4FF"},{id:"green",label:d.shapes.stickyColors.green,bg:"#D5F0D3"},{id:"gray",label:d.shapes.stickyColors.gray,bg:"#ECEBE7"},{id:"white",label:d.shapes.stickyColors.white,bg:"#FFFFFF"}],Wx=n=>{var o;return((o=hm.find(r=>r.id===n))==null?void 0:o.bg)??hm[0].bg},ky=200,Ty=6,e0=["#111111","#6B6B6B","#C94F0C","#B42318","#1E7A4C","#2F6FDE","#FFFFFF","none"];function hb({s:n,id:o}){var E;const r=n.strokeWidth??4,f=n.stroke??"#111111",m=n.fill??"none",g=r,v=Math.max(1,n.w),S=Math.max(1,n.h),j=(n.points??[]).map(([x,w])=>`${x},${w}`).join(" ");return s.jsxs("svg",{width:v+g*2,height:S+g*2,viewBox:`${-g} ${-g} ${v+g*2} ${S+g*2}`,style:{position:"absolute",left:-g,top:-g,overflow:"visible"},children:[n.kind==="arrow"&&s.jsx("defs",{children:s.jsx("marker",{id:`ah-${o}`,viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:s.jsx("path",{d:"M0 0L10 5L0 10z",fill:f})})}),n.kind==="rect"&&s.jsx("rect",{x:0,y:0,width:v,height:S,rx:8,fill:m,stroke:f,strokeWidth:r}),n.kind==="oval"&&s.jsx("ellipse",{cx:v/2,cy:S/2,rx:v/2,ry:S/2,fill:m,stroke:f,strokeWidth:r}),(n.kind==="line"||n.kind==="arrow")&&s.jsx("polyline",{points:j,fill:"none",stroke:f,strokeWidth:r,strokeLinecap:"round",markerEnd:n.kind==="arrow"?`url(#ah-${o})`:void 0}),n.kind==="pen"&&s.jsx("polyline",{points:j,fill:"none",stroke:f,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),n.kind==="image"&&s.jsx("image",{href:(E=n.src)==null?void 0:E.replace(/^\.\.\//,"/"),x:0,y:0,width:v,height:S,preserveAspectRatio:"xMidYMid slice"})]})}function t0(n){const o=b.useRef(null),r=(m,g)=>v=>{v.button!==0||!n.interactive||(v.stopPropagation(),n.onSelect(m,v.shiftKey),!v.shiftKey&&(o.current={id:m,mode:g,sx:v.clientX,sy:v.clientY,o:n.shapes[m],moved:!1},v.currentTarget.setPointerCapture(v.pointerId)))},f=(m,g=!1)=>{const v=o.current;if(!v)return;const S=(m.clientX-v.sx)/n.zoom,j=(m.clientY-v.sy)/n.zoom;if(!v.moved&&Math.abs(S)+Math.abs(j)<2/n.zoom){g&&(o.current=null);return}if(v.moved=!0,v.mode==="move")n.onChange(v.id,{x:Math.round(v.o.x+S),y:Math.round(v.o.y+j)},g);else{const E=Math.max(8,v.o.w+S),x=Math.max(8,v.o.h+j),w=E/Math.max(1,v.o.w),M=x/Math.max(1,v.o.h),z={w:Math.round(E),h:Math.round(x)};v.o.points&&(z.points=v.o.points.map(([H,W])=>[Math.round(H*w),Math.round(W*M)])),n.onChange(v.id,z,g)}g&&(o.current=null)};return s.jsx(s.Fragment,{children:n.ids.map(m=>{const g=n.shapes[m],v=n.selected.includes(m);return s.jsxs("div",{className:`shape ${v?"selected":""}`,"data-shape":m,style:{left:g.x,top:g.y,width:Math.max(1,g.w),height:Math.max(1,g.h),pointerEvents:n.interactive?"auto":"none"},onPointerDown:r(m,"move"),onPointerMove:S=>f(S),onPointerUp:S=>f(S,!0),onContextMenu:S=>{S.preventDefault(),S.stopPropagation(),n.selected.includes(m)||n.onSelect(m),n.onContext(m,S)},children:[s.jsx(hb,{s:g,id:m}),v&&s.jsx("div",{className:"shape-resize",role:"slider","aria-label":d.shapes.shapeSize,"aria-valuetext":`${g.w} × ${g.h}`,style:{width:12/n.zoom,height:12/n.zoom,right:-6/n.zoom,bottom:-6/n.zoom,borderWidth:1.5/n.zoom},onPointerDown:r(m,"resize"),onPointerMove:S=>f(S),onPointerUp:S=>f(S,!0)})]},m)})})}function n0({tool:n,view:o,onDone:r}){const[f,m]=b.useState(null),g=b.useRef(null),v=j=>{const E=j.currentTarget.getBoundingClientRect();return{x:(j.clientX-E.left-o.x)/o.zoom,y:(j.clientY-E.top-o.y)/o.zoom}},S=(j,E,x,w,M,z)=>{if(z&&(n==="rect"||n==="oval")){const I=Math.max(Math.abs(x-j),Math.abs(w-E));x=j+Math.sign(x-j||1)*I,w=E+Math.sign(w-E||1)*I}if(n==="pen"){const I=M.map(ie=>ie[0]),X=M.map(ie=>ie[1]),ne=Math.min(...I),ee=Math.min(...X);return{kind:"pen",x:ne,y:ee,w:Math.max(...I)-ne,h:Math.max(...X)-ee,points:M.map(([ie,le])=>[Math.round(ie-ne),Math.round(le-ee)])}}const H=Math.min(j,x),W=Math.min(E,w),T=Math.abs(x-j),_=Math.abs(w-E);return n==="line"||n==="arrow"?{kind:n,x:H,y:W,w:T,h:_,points:[[Math.round(j-H),Math.round(E-W)],[Math.round(x-H),Math.round(w-W)]]}:{kind:n,x:H,y:W,w:T,h:_}};return s.jsx("div",{className:"shape-drawer","aria-label":d.shapes.drawShape,onPointerDown:j=>{if(j.button!==0)return;j.currentTarget.setPointerCapture(j.pointerId);const E=v(j);g.current={x0:E.x,y0:E.y,pts:[[E.x,E.y]]}},onPointerMove:j=>{const E=g.current;if(!E)return;const x=v(j);n==="pen"&&E.pts.push([x.x,x.y]),m(S(E.x0,E.y0,x.x,x.y,E.pts,j.shiftKey))},onPointerUp:j=>{const E=g.current;if(g.current=null,m(null),!E)return;const x=v(j);let w=S(E.x0,E.y0,x.x,x.y,E.pts,j.shiftKey);if(w.w<4&&w.h<4){if(n==="pen")return;w=n==="line"||n==="arrow"?{kind:n,x:E.x0,y:E.y0,w:200,h:0,points:[[0,0],[200,0]]}:{kind:n,x:E.x0,y:E.y0,w:200,h:140}}r({...w,x:Math.round(w.x),y:Math.round(w.y),w:Math.round(w.w),h:Math.round(w.h)})},children:f&&s.jsx("div",{className:"world",style:{transform:`translate(${o.x}px, ${o.y}px) scale(${o.zoom})`,pointerEvents:"none"},children:s.jsx("div",{className:"shape",style:{left:f.x,top:f.y,width:Math.max(1,f.w),height:Math.max(1,f.h)},children:s.jsx(hb,{s:{...f,strokeWidth:4},id:"draft"})})})})}function a0({shape:n,onPatch:o,onDelete:r,onFront:f,onBack:m}){const g=d.shapes.kinds,v=({value:S,onPick:j,allowNone:E})=>s.jsx("span",{className:"swatches",children:e0.filter(x=>E||x!=="none").map(x=>s.jsx("button",{className:`swatch ${S===x?"on":""} ${x==="none"?"none":""}`,title:x==="none"?d.shapes.none:x,"aria-label":x==="none"?d.shapes.none:x,style:{background:x==="none"?void 0:x},onClick:()=>j(x)},x))});return s.jsxs("section",{className:"board-opts","aria-label":d.shapes.options,children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:g[n.kind]})}),n.kind!=="image"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:d.shapes.strokeColor}),s.jsx(v,{value:n.stroke??"#111111",onPick:S=>o({stroke:S})})]}),(n.kind==="rect"||n.kind==="oval")&&s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:d.shapes.fill}),s.jsx(v,{value:n.fill??"none",onPick:S=>o({fill:S}),allowNone:!0})]}),s.jsxs("label",{className:"field-row",children:[s.jsx("span",{children:d.shapes.weight}),s.jsx("input",{type:"range",min:1,max:24,value:n.strokeWidth??4,onChange:S=>o({strokeWidth:Number(S.target.value)}),"aria-label":d.shapes.strokeWeight})]})]}),s.jsxs("div",{className:"muted small",children:[n.w," × ",n.h," · (",n.x,", ",n.y,")"]}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"icon-btn","aria-label":d.shapes.front,title:d.shapes.front,onClick:f,children:s.jsx(Q,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":d.shapes.back,title:d.shapes.back,onClick:m,children:s.jsx(Q,{name:"back"})}),s.jsx("button",{className:"icon-btn danger","aria-label":d.shapes.deleteShape,title:d.shapes.deleteTitle,onClick:r,children:s.jsx(Q,{name:"trash"})})]})]})}function l0({note:n,onPatch:o,onDelete:r}){const f=n.kind==="title",m=f?72:22;return s.jsxs("section",{className:"board-opts","aria-label":d.notes.options,children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:f?d.notes.title:d.notes.sticky})}),s.jsxs("label",{className:"field-row",children:[s.jsx("span",{children:d.notes.fontSize}),s.jsx("select",{value:n.size??m,onChange:g=>o({size:Number(g.target.value)===m?void 0:Number(g.target.value)}),"aria-label":d.notes.fontSize,children:(f?[32,48,56,72,96,128]:[14,18,22,28,36]).map(g=>s.jsxs("option",{value:g,children:[g,"px",g===m?d.notes.defaultSuffix:""]},g))})]}),s.jsxs("div",{className:"btn-row",role:"group","aria-label":d.notes.textStyle,children:[s.jsx("button",{className:`icon-btn ${n.bold??f?"on":""}`,"aria-pressed":!!(n.bold??f),"aria-label":d.notes.bold,title:d.notes.bold,onClick:()=>o({bold:!(n.bold??f)}),children:s.jsx("strong",{children:"B"})}),s.jsx("button",{className:`icon-btn ${n.italic?"on":""}`,"aria-pressed":!!n.italic,"aria-label":d.notes.italic,title:d.notes.italic,onClick:()=>o({italic:!n.italic||void 0}),children:s.jsx("em",{children:"I"})})]}),!f&&s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:d.notes.color}),s.jsx("span",{className:"swatches",children:hm.map(g=>s.jsx("button",{className:`swatch ${(n.color??"yellow")===g.id?"on":""}`,title:g.label,"aria-label":d.notes.stickyColor(g.label),style:{background:g.bg},onClick:()=>o({color:g.id==="yellow"?void 0:g.id})},g.id))})]}),f?s.jsxs("div",{className:"grid2",children:[s.jsx(go,{label:d.notes.maxWidth,value:n.maxW??2e3,onCommit:g=>o({maxW:g})}),s.jsx(go,{label:d.notes.maxHeight,value:n.maxH??0,onCommit:g=>o({maxH:g||void 0})})]}):s.jsxs("div",{className:"grid2",children:[s.jsx(go,{label:d.notes.width,value:n.w??400,onCommit:g=>o({w:g})}),s.jsx(go,{label:d.notes.height,value:n.h??0,onCommit:g=>o({h:g||void 0})})]}),s.jsx("p",{className:"muted small",children:f?d.notes.titleHint:d.notes.stickyHint}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":d.notes.deleteNote,title:d.notes.deleteTitle,onClick:r,children:s.jsx(Q,{name:"trash"})})})]})}function go({label:n,value:o,onCommit:r}){return s.jsxs("label",{className:"num",children:[s.jsx("span",{children:n}),s.jsx("input",{inputMode:"numeric",defaultValue:o,onBlur:f=>{const m=Math.max(0,Math.round(Number(f.target.value)));Number.isFinite(m)&&m!==o&&r(m)},onKeyDown:f=>!f.nativeEvent.isComposing&&f.key==="Enter"&&f.target.blur()},o)]})}const s0=n=>n==="grid"?{type:n,count:0,gutter:0,margin:0,align:"stretch",size:8,color:"#C94F0C"}:{type:n,count:n==="columns"?4:6,gutter:16,margin:20,align:"stretch",size:80,color:"#C94F0C"};function o0(n,o){const r=Math.max(1,Math.round(o.count));if(o.align==="stretch"){const v=(n-o.margin*2-o.gutter*(r-1))/r;return Array.from({length:r},(S,j)=>[o.margin+j*(v+o.gutter),v])}const f=r*o.size+(r-1)*o.gutter,m=o.align==="start"?o.margin:o.align==="end"?n-o.margin-f:(n-f)/2;return Array.from({length:r},(g,v)=>[m+v*(o.size+o.gutter),o.size])}function i0({guides:n,w:o,h:r}){return s.jsx("div",{className:"layout-guides","aria-hidden":"true",children:n.filter(f=>!f.hidden).map((f,m)=>f.type==="grid"?s.jsx("div",{className:"lg-grid",style:{backgroundImage:`linear-gradient(to right, ${f.color}55 1px, transparent 1px), linear-gradient(to bottom, ${f.color}55 1px, transparent 1px)`,backgroundSize:`${f.size}px ${f.size}px`}},m):o0(f.type==="columns"?o:r,f).map(([g,v],S)=>s.jsx("div",{className:"lg-track",style:f.type==="columns"?{left:g,top:0,width:v,height:r,background:`${f.color}1f`}:{top:g,left:0,height:v,width:o,background:`${f.color}1f`}},`${m}-${S}`)))})}function c0({guides:n,onChange:o}){const r=(m,g)=>o(n.map((v,S)=>S===m?{...v,...g}:v),d.history.editGuide),f=d.guides.types;return s.jsxs("section",{className:"board-opts guides-editor","aria-label":d.guides.aria,children:[s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:d.guides.heading(n.length,Ty)}),s.jsx("span",{className:"btn-row",children:["columns","rows","grid"].map(m=>s.jsx("button",{className:"icon-btn sm",disabled:n.length>=Ty,title:d.guides.add[m],"aria-label":d.guides.add[m],onClick:()=>o([...n,s0(m)],d.history.addGuide),children:s.jsx("span",{className:"small",children:f[m]})},m))})]}),n.length===0&&s.jsx("p",{className:"muted small",children:d.guides.empty}),n.map((m,g)=>s.jsxs("div",{className:"guide-row",children:[s.jsxs("div",{className:"guide-head",children:[s.jsx("strong",{children:f[m.type]}),s.jsx("input",{type:"color",value:m.color,onChange:v=>r(g,{color:v.target.value}),"aria-label":d.guides.color}),s.jsx("div",{className:"spacer"}),s.jsx("button",{className:"icon-btn sm","aria-label":m.hidden?d.guides.show:d.guides.hide,title:m.hidden?d.guides.show:d.guides.hide,onClick:()=>r(g,{hidden:!m.hidden||void 0}),children:s.jsx(Q,{name:m.hidden?"close":"check",size:14})}),s.jsx("button",{className:"icon-btn sm danger","aria-label":d.guides.deleteGuide,title:d.guides.delete,onClick:()=>o(n.filter((v,S)=>S!==g),d.history.deleteGuide),children:s.jsx(Q,{name:"trash",size:14})})]}),m.type==="grid"?s.jsx("div",{className:"grid2",children:s.jsx(go,{label:d.guides.cell,value:m.size,onCommit:v=>r(g,{size:Math.max(2,v)})})}):s.jsxs("div",{className:"grid2",children:[s.jsx(go,{label:d.guides.count,value:m.count,onCommit:v=>r(g,{count:Math.max(1,Math.min(48,v))})}),s.jsx(go,{label:d.guides.gutter,value:m.gutter,onCommit:v=>r(g,{gutter:v})}),s.jsx(go,{label:d.guides.margin,value:m.margin,onCommit:v=>r(g,{margin:v})}),m.align!=="stretch"&&s.jsx(go,{label:d.guides.cellSize,value:m.size,onCommit:v=>r(g,{size:Math.max(1,v)})}),s.jsxs("label",{className:"field-row span2",children:[s.jsx("span",{children:d.guides.align}),s.jsxs("select",{value:m.align,onChange:v=>r(g,{align:v.target.value}),"aria-label":d.guides.alignAria,children:[s.jsx("option",{value:"stretch",children:d.guides.stretch}),s.jsx("option",{value:"start",children:m.type==="columns"?d.guides.left:d.guides.top}),s.jsx("option",{value:"center",children:d.guides.center}),s.jsx("option",{value:"end",children:m.type==="columns"?d.guides.right:d.guides.bottom})]})]})]})]},g))]})}const Cy={paths:[],rects:[],selection:null,error:null};function r0(n,o){const[r,f]=b.useState(Cy),m=b.useRef([]);m.current=r.paths;const g=b.useCallback(()=>{var E;if(!n)return;const j=(E=o(n))==null?void 0:E.contentDocument;j&&f(x=>{const w=x.paths.map(M=>An(j,M));return w.some(M=>!M)?{...x,paths:[],rects:[],selection:null,error:d.editMode.fileChanged}:{...x,rects:w.map(M=>As(M))}})},[n,o]),v=b.useCallback(async j=>{var M;if(!n)return;const E=(M=o(n))==null?void 0:M.contentDocument,x=E?j.map(z=>An(E,z)):[];if(!E||!j.length||x.some(z=>!z)){f(z=>({...z,paths:[],rects:[],selection:null})),await Te.put("/api/selection",{file:null}).catch(()=>{});return}const w=j[j.length-1];f(z=>({...z,paths:j,rects:x.map(H=>As(H)),error:null}));try{const{selection:z}=await Te.put("/api/selection",{file:n,path:w,paths:j,styles:kx(An(E,w)),...iu(An(E,w))});f(H=>H.paths===j||H.paths.join()===j.join()?{...H,selection:z}:H)}catch(z){f(H=>({...H,selection:null,error:String(z.message)}))}},[n,o]),S=b.useRef(!0);return b.useEffect(()=>{f(Cy),S.current?S.current=!1:n||Te.put("/api/selection",{file:null}).catch(()=>{})},[n]),b.useEffect(()=>{var z;if(!n)return;const j=o(n);if(!j)return;let E=()=>{};const x=()=>{E();const H=j.contentDocument,W=j.contentWindow;if(!H||!W)return;const T=I=>{var X;I.isComposing||(X=I.target)!=null&&X.isContentEditable||(window.dispatchEvent(new KeyboardEvent("keydown",{key:I.key,code:I.code,metaKey:I.metaKey,ctrlKey:I.ctrlKey,shiftKey:I.shiftKey,altKey:I.altKey})),(/^(Arrow|Delete|Backspace|Tab|Enter|Escape)/.test(I.key)||(I.metaKey||I.ctrlKey)&&/^[zydcvg]$/i.test(I.key))&&I.preventDefault())},_=()=>g();H.addEventListener("keydown",T,!0),W.addEventListener("scroll",_,!0),E=()=>{H.removeEventListener("keydown",T,!0),W.removeEventListener("scroll",_,!0)}},w=()=>{x(),m.current.length&&v(m.current)},M=()=>m.current.length&&void v(m.current);return((z=j.contentDocument)==null?void 0:z.readyState)==="complete"&&x(),j.addEventListener("load",w),j.addEventListener("dc-patched",M),()=>{j.removeEventListener("load",w),j.removeEventListener("dc-patched",M),E()}},[n,o,v,g]),{state:r,select:v,refresh:g,setError:j=>f(E=>({...E,error:j}))}}function Ld(n,o,r){const f=n==null?void 0:n.contentDocument;if(!n||!(f!=null&&f.body))return null;const m=n.getBoundingClientRect(),g=m.width/(n.offsetWidth||m.width)||1,v=f.elementFromPoint((o-m.left)/g,(r-m.top)/g);if(!v||v===f.body||v===f.documentElement)return null;const S=nl(v);return S==null?null:{el:v,path:S}}function u0(n,o,r,f,m){const g=n==null?void 0:n.contentDocument,v=n==null?void 0:n.contentWindow;if(!n||!(g!=null&&g.body)||!v)return!1;const S=n.getBoundingClientRect(),j=S.width/(n.offsetWidth||S.width)||1,E=g.scrollingElement??g.documentElement,x=z=>{const H=z===E?null:v.getComputedStyle(z),W=(!H||/auto|scroll/.test(H.overflowY))&&(m<0?z.scrollTop>0:m>0&&z.scrollTop+z.clientHeight<z.scrollHeight-1),T=(!H||/auto|scroll/.test(H.overflowX))&&(f<0?z.scrollLeft>0:f>0&&z.scrollLeft+z.clientWidth<z.scrollWidth-1);return W||T};let w=g.elementFromPoint((o-S.left)/j,(r-S.top)/j);for(;w&&w!==E&&w!==g.body&&!x(w);)w=w.parentElement;const M=w&&w!==g.body&&x(w)?w:x(E)?E:null;return M?(M.scrollBy(f/j,m/j),!0):!1}function d0(n,o){const r=g=>{const v=g.getBoundingClientRect();return v.width>0&&v.height>0&&v.left>=o.x&&v.top>=o.y&&v.right<=o.x+o.w&&v.bottom<=o.y+o.h},f=[],m=g=>{for(const v of Array.from(g.children))if(!/^(script|style|template)$/i.test(v.tagName))if(r(v)){const S=nl(v);S!=null&&f.push(S)}else m(v)};return m(n.body),f}function iu(n){var g,v,S;const o=n.tagName.toLowerCase(),r=n.getAttribute("role"),f=o==="img"||o==="picture"||(v=(g=n.style)==null?void 0:g.backgroundImage)!=null&&v.includes("url(")?"image":o==="button"||r==="button"?"button":o==="a"?"link":/^(input|textarea|select)$/.test(o)?"input":o==="svg"?"icon":!n.children.length&&((S=n.textContent)!=null&&S.trim())?"text":"container",m=(n.getAttribute("aria-label")||n.getAttribute("alt")||n.getAttribute("title")||n.getAttribute("placeholder")||n.innerText||n.textContent||"").trim().replace(/\s+/g," ").slice(0,60);return{kind:f,label:m}}function f0(n){let o=n;const r=new Set;return{get:()=>o,set(f){const m=typeof f=="function"?f(o):f;if(!(m===o||m.x===o.x&&m.y===o.y&&m.zoom===o.zoom)){o=m;for(const g of[...r])g()}},subscribe(f){return r.add(f),()=>r.delete(f)}}}function h0(n){const o=b.useRef(null);return o.current||(o.current=f0(n)),o.current}function km(n){return b.useSyncExternalStore(n.subscribe,n.get,n.get)}function Id(n,o){const r=()=>o(n.get());return b.useSyncExternalStore(n.subscribe,r,r)}function m0(n,o){const r=()=>o?n.get():null;return b.useSyncExternalStore(n.subscribe,r,r)}const Tm=.04,Cm=4,g0=.25,p0=640,Ph=.5,Ey=150,y0=40,hu=[600,1200,2400],b0=n=>hu.find(o=>o>=n)??hu[hu.length-1],v0=6,mb={url:n=>`/screens/${n}`,thumbs:!0};function x0(n){var Rn;const o=km(n.view),r=n.view.set,f=b.useRef(null),m=b.useRef(null),[g,v]=b.useState({w:1200,h:800}),[S,j]=b.useState(!1),[E,x]=b.useState([]),[w,M]=b.useState(null),z=b.useRef(null),H=b.useRef(null);b.useLayoutEffect(()=>{const D=f.current,K=()=>{var De;const Me={w:D.clientWidth,h:D.clientHeight};!Me.w||!Me.h||(v(We=>We.w===Me.w&&We.h===Me.h?We:Me),(De=n.onSize)==null||De.call(n,Me))},ae=new ResizeObserver(K);return ae.observe(D),document.addEventListener("visibilitychange",K),()=>{ae.disconnect(),document.removeEventListener("visibilitychange",K)}},[]);const W=b.useRef(!1);b.useEffect(()=>{const D=m.current;if(!D)return;if(!W.current){W.current=!0;return}D.style.willChange="transform";const K=setTimeout(()=>D.style.willChange="",200);return()=>clearTimeout(K)},[o.x,o.y,o.zoom]),b.useEffect(()=>{const D=f.current,K=ae=>{var ft,pt,an;ae.preventDefault();const Me=D.getBoundingClientRect(),De=ae.clientX-Me.left,We=ae.clientY-Me.top;if(ae.ctrlKey||ae.metaKey)r(Pt=>{const Xt=Xc(Pt.zoom*Math.exp(-ae.deltaY*.01),Tm,Cm),Dn=(De-Pt.x)/Pt.zoom,Qe=(We-Pt.y)/Pt.zoom;return{zoom:Xt,x:De-Dn*Xt,y:We-Qe*Xt}});else{const Pt=((an=(pt=(ft=ae.target)==null?void 0:ft.closest)==null?void 0:pt.call(ft,".board-frame[data-inside]"))==null?void 0:an.querySelector("iframe"))??null;if(u0(Pt,ae.clientX,ae.clientY,ae.deltaX,ae.deltaY))return;r(Xt=>({...Xt,x:Xt.x-ae.deltaX,y:Xt.y-ae.deltaY}))}};return D.addEventListener("wheel",K,{passive:!1}),()=>D.removeEventListener("wheel",K)},[r]),b.useEffect(()=>{const D=ae=>{ae.code==="Space"&&!cu(ae)&&!ae.repeat&&(ae.preventDefault(),j(!0))},K=ae=>ae.code==="Space"&&j(!1);return window.addEventListener("keydown",D),window.addEventListener("keyup",K),()=>{window.removeEventListener("keydown",D),window.removeEventListener("keyup",K)}},[]);const T=(D,K)=>{const ae=f.current.getBoundingClientRect();return{x:(D-ae.left-o.x)/o.zoom,y:(K-ae.top-o.y)/o.zoom}},_=D=>{z.current=D,M(D)},I=S||n.tool==="hand"||!!n.readOnly,X=n.screens??mb,ne=D=>{if(D.target!==D.currentTarget&&D.button!==1)return;if(D.currentTarget.setPointerCapture(D.pointerId),D.button===1||I){H.current={kind:"pan",sx:D.clientX,sy:D.clientY,vx:o.x,vy:o.y};return}if(D.button!==0)return;const K=T(D.clientX,D.clientY);if(n.tool==="title"||n.tool==="sticky"){n.onCreateNote(n.tool,{x:Math.round(K.x),y:Math.round(K.y)}),n.setTool("select");return}H.current={kind:n.tool==="board"?"draw":"marquee",sx:K.x,sy:K.y,additive:D.shiftKey,moved:!1}},ee=D=>{const K=H.current;if(!K)return;if(K.kind==="pan"){r(De=>({...De,x:K.vx+D.clientX-K.sx,y:K.vy+D.clientY-K.sy}));return}const ae=T(D.clientX,D.clientY),Me={x:Math.min(K.sx,ae.x),y:Math.min(K.sy,ae.y),w:Math.abs(ae.x-K.sx),h:Math.abs(ae.y-K.sy)};(Me.w+Me.h)*o.zoom>4&&(K.moved=!0),K.moved&&_(Me)},ie=D=>{const K=H.current;if(H.current=null,(K==null?void 0:K.kind)==="pan"&&n.readOnly&&Math.abs(D.clientX-K.sx)+Math.abs(D.clientY-K.sy)<4&&n.onSelect([],"replace"),!K||K.kind==="pan")return;const ae=z.current;if(_(null),K.kind==="draw"){const ft=T(D.clientX,D.clientY);n.onCreateBoard(K.moved&&ae&&ae.w>20&&ae.h>20?S0(ae):{x:Math.round(ft.x),y:Math.round(ft.y),w:390,h:844}),n.setTool("select");return}if(!K.moved||!ae){K.additive||(n.onSelect([],"replace"),n.onSelectNote(null));return}const Me=n.visibleBoards.filter(ft=>!n.board.boards[ft].locked&&Jh(n.board.boards[ft],ae)),De=n.visibleNotes.filter(ft=>{var Dn,Qe;if((Dn=n.board.notes[ft])!=null&&Dn.locked)return!1;const pt=(Qe=f.current)==null?void 0:Qe.querySelector(`[data-note="${ft}"]`);if(!pt)return!1;const an=pt.getBoundingClientRect(),Pt=T(an.left,an.top),Xt=T(an.right,an.bottom);return Jh({x:Pt.x,y:Pt.y,w:Xt.x-Pt.x,h:Xt.y-Pt.y},ae)}),We=Object.entries(n.board.shapes??{}).filter(([,ft])=>Jh({x:ft.x,y:ft.y,w:Math.max(1,ft.w),h:Math.max(1,ft.h)},ae)).map(([ft])=>ft);n.onMarquee({boards:Me,notes:De,shapes:We},K.additive)},le=b.useRef(null),he=(D,K)=>{const ae=n.selected.includes(K)?n.selected:[K],Me={};for(const De of ae)n.board.boards[De].locked||(Me[De]={x:n.board.boards[De].x,y:n.board.boards[De].y});le.current={sx:D.clientX,sy:D.clientY,origins:Me,moved:!1},D.currentTarget.setPointerCapture(D.pointerId)},ce=(D,K=!1)=>{const ae=le.current;if(!ae)return;let Me=(D.clientX-ae.sx)/o.zoom,De=(D.clientY-ae.sy)/o.zoom;if(!ae.moved&&!Ny(D.clientX-ae.sx,D.clientY-ae.sy))return;ae.moved=!0;const We=Object.keys(ae.origins),ft=We.map(Qe=>({...n.board.boards[Qe],x:ae.origins[Qe].x+Me,y:ae.origins[Qe].y+De})),pt=gb(ft),an=n.visibleBoards.filter(Qe=>!We.includes(Qe)).map(Qe=>n.board.boards[Qe]),Pt=v0/o.zoom,Xt=[];if(!D.altKey){const Qe=Ay([pt.x,pt.x+pt.w/2,pt.x+pt.w],an.flatMap(Wt=>[Wt.x,Wt.x+Wt.w/2,Wt.x+Wt.w]),Pt),Sn=Ay([pt.y,pt.y+pt.h/2,pt.y+pt.h],an.flatMap(Wt=>[Wt.y,Wt.y+Wt.h/2,Wt.y+Wt.h]),Pt);if(Qe){Me+=Qe.d;const Wt=an.filter(tt=>[tt.x,tt.x+tt.w/2,tt.x+tt.w].some(wt=>Math.abs(wt-Qe.at)<.5));Xt.push({axis:"x",at:Qe.at,from:Math.min(pt.y+((Sn==null?void 0:Sn.d)??0),...Wt.map(tt=>tt.y)),to:Math.max(pt.y+pt.h+((Sn==null?void 0:Sn.d)??0),...Wt.map(tt=>tt.y+tt.h))})}if(Sn){De+=Sn.d;const Wt=an.filter(tt=>[tt.y,tt.y+tt.h/2,tt.y+tt.h].some(wt=>Math.abs(wt-Sn.at)<.5));Xt.push({axis:"y",at:Sn.at,from:Math.min(pt.x+((Qe==null?void 0:Qe.d)??0),...Wt.map(tt=>tt.x)),to:Math.max(pt.x+pt.w+((Qe==null?void 0:Qe.d)??0),...Wt.map(tt=>tt.x+tt.w))})}}x(K?[]:Xt);const Dn={};for(const Qe of We)Dn[Qe]={x:Math.round(ae.origins[Qe].x+Me),y:Math.round(ae.origins[Qe].y+De)};n.onMoveBoards(Dn,K)},ge=D=>{const K=le.current;K!=null&&K.moved&&ce(D,!0),le.current=null,x([])},xe=g.w/o.zoom,Ze=g.h/o.zoom,Ne=-o.x/o.zoom,xt=-o.y/o.zoom,et=D=>D.x+D.w>Ne-200&&D.x<Ne+xe+200&&D.y+D.h>xt-200&&D.y<xt+Ze+200,me=D=>{D.currentTarget.setPointerCapture(D.pointerId),H.current={kind:"pan",sx:D.clientX,sy:D.clientY,vx:o.x,vy:o.y}},je=b.useRef(null),Ce=!!n.onPickElement&&!n.readOnly&&!I&&n.tool==="select",Ue=(D,K,ae,Me)=>{var We;if(D.button!==0)return;if(D.stopPropagation(),n.readOnly||I)return n.readOnly&&n.onSelect([K],"replace"),me(D);const De=n.selected.includes(K);if((We=n.onHoverElement)==null||We.call(n,null),ae==="frame"&&Ce&&Me&&D.shiftKey&&n.editFile===K){D.currentTarget.setPointerCapture(D.pointerId),je.current={file:K,kind:"elements",sx:D.clientX,sy:D.clientY,moved:!1};return}if(D.shiftKey)return n.onSelect([K],"toggle");De||n.onSelect([K],"replace"),he(D,K),je.current={file:K,kind:ae==="frame"&&Ce&&Me?"board":"label",sx:D.clientX,sy:D.clientY,moved:!1}},fe=(D,K)=>({x:Math.min(D.sx,K.clientX),y:Math.min(D.sy,K.clientY),w:Math.abs(K.clientX-D.sx),h:Math.abs(K.clientY-D.sy)}),re=(D,K,ae)=>{var De,We,ft;if(n.readOnly||((De=H.current)==null?void 0:De.kind)==="pan")return ee(D);je.current&&D.buttons===0&&(je.current=null,le.current=null);const Me=je.current;if(!Me){D.buttons===0&&Ce&&ae&&((We=n.onHoverElement)==null||We.call(n,K,D));return}if(Me.kind==="elements"){if(!Me.moved&&!Ny(D.clientX-Me.sx,D.clientY-Me.sy))return;Me.moved=!0,(ft=n.onElementMarquee)==null||ft.call(n,Me.file,fe(Me,D),!1);return}ce(D)},Fe=(D,K)=>{var De,We,ft,pt,an;if(n.readOnly||((De=H.current)==null?void 0:De.kind)==="pan")return void(H.current=null);const ae=je.current;if(je.current=null,(ae==null?void 0:ae.kind)==="elements"){ae.moved?(We=n.onElementMarquee)==null||We.call(n,ae.file,fe(ae,D),!0):(ft=n.onPickElement)==null||ft.call(n,K,D,{add:!0,double:!1});return}const Me=!!((pt=le.current)!=null&&pt.moved);ge(D),!(!ae||Me)&&(ae.kind==="board"?(an=n.onPickElement)==null||an.call(n,K,D,{add:!1,double:!1}):ae.kind==="label"&&n.editFile===K&&n.onSelect([K],"replace"))},dt=new Set(n.visibleBoards),R=new Set;for(const D of n.visibleBoards){const K=(Rn=n.board.boards[D])==null?void 0:Rn.origin;(K==null?void 0:K.kind)==="fork"&&(R.add(D),dt.has(K.of)&&R.add(K.of))}const Y=b.useRef(new Set),ue=b.useRef([]),pe=b.useRef(!1),$e=b.useRef(0),[,Re]=b.useState(0),G=()=>{if($e.current||!pe.current)return;const D=ue.current.find(K=>!Y.current.has(K));D&&(Y.current.add(D),Re(K=>K+1),$e.current=window.setTimeout(()=>{$e.current=0,G()},y0))},de=b.useRef(0);b.useEffect(()=>{pe.current=!1;const D=performance.now(),K=D-de.current;de.current=D;const ae=window.setTimeout(()=>{pe.current=!0,G()},K<400?Math.max(Ey,K*3):Ey);return()=>window.clearTimeout(ae)},[o.x,o.y,o.zoom]),b.useEffect(()=>()=>window.clearTimeout($e.current),[]);const be=[],_t=Ne+xe/2,Ve=xt+Ze/2;b.useEffect(()=>{const D=new Set(be.map(K=>K.f));for(const K of Y.current)D.has(K)||Y.current.delete(K);ue.current=be.sort((K,ae)=>K.d-ae.d).map(K=>K.f),G()});const Qt=b.useRef({p:n,pressBoard:Ue,moveBoardPress:re,releaseBoard:Fe,picking:Ce});Qt.current={p:n,pressBoard:Ue,moveBoardPress:re,releaseBoard:Fe,picking:Ce};const Ut=b.useMemo(()=>{const D=()=>Qt.current;return{press:(K,ae,Me,De)=>D().pressBoard(K,ae,Me,De),pressMove:(K,ae,Me)=>D().moveBoardPress(K,ae,Me),release:(K,ae)=>D().releaseBoard(K,ae),leave:()=>{var K,ae;return!je.current&&((ae=(K=D().p).onHoverElement)==null?void 0:ae.call(K,null))},doubleClickFrame:(K,ae)=>{var Me,De;return(De=(Me=D().p).onPickElement)==null?void 0:De.call(Me,ae,K,{add:!1,double:!0})},contextFrame:(K,ae,Me)=>{var De,We;return D().picking&&Me&&!!((We=(De=D().p).onElementContext)!=null&&We.call(De,ae,K))},resize:(K,ae,Me)=>D().p.onMoveBoards({[K]:ae},Me),play:K=>D().p.onPlay(K),action:(K,ae,Me)=>{var De,We;return(We=(De=D().p).onBoardAction)==null?void 0:We.call(De,K,ae,Me)},rename:K=>D().p.onRename(K),context:(K,ae)=>D().p.onContext({type:"board",file:K},ae),iframeRef:(K,ae)=>{var Me,De;return(De=(Me=D().p).iframeRef)==null?void 0:De.call(Me,K,ae)},selectNote:(K,ae)=>D().p.onSelectNote(K,ae),moveNote:(K,ae,Me)=>D().p.onMoveNote(K,ae,Me),deleteNote:K=>D().p.onDeleteNote(K),contextNote:(K,ae)=>D().p.onContext({type:"note",id:K},ae)}},[]),at=b.useMemo(()=>new Set(n.files),[n.files]),Ge=b.useRef({zoom:0,of:new Map,pins:new Map});(Ge.current.fn!==n.renderBoardOverlay||Ge.current.pf!==n.renderBoardPins||Ge.current.zoom!==o.zoom)&&(Ge.current={fn:n.renderBoardOverlay,pf:n.renderBoardPins,zoom:o.zoom,of:new Map,pins:new Map});const on=D=>{var ae;const K=Ge.current.pins;return K.has(D)||K.set(D,(ae=n.renderBoardPins)==null?void 0:ae.call(n,D,o.zoom)),K.get(D)},It=D=>{var ae;const K=Ge.current.of;return K.has(D)||K.set(D,(ae=n.renderBoardOverlay)==null?void 0:ae.call(n,D,o.zoom)),K.get(D)},Vn=b.useMemo(()=>{var D;return(D=n.underLayer)==null?void 0:D.call(n,o.zoom)},[n.underLayer,o.zoom]),lt=b.useMemo(()=>{var D;return(D=n.worldLayer)==null?void 0:D.call(n,o.zoom)},[n.worldLayer,o.zoom]);return s.jsxs("div",{ref:f,className:`canvas tool-${I?"hand":n.tool}`,onPointerDown:ne,onPointerMove:ee,onPointerUp:ie,onAuxClick:D=>D.preventDefault(),onContextMenu:D=>{if(D.target!==D.currentTarget)return;D.preventDefault();const K=T(D.clientX,D.clientY);n.onContext({type:"canvas",x:Math.round(K.x),y:Math.round(K.y)},D)},role:"application","aria-label":d.canvas.aria,children:[s.jsxs("div",{ref:m,className:"world",style:{transform:`translate(${o.x}px, ${o.y}px) scale(${o.zoom})`},children:[Vn,n.visibleNotes.map(D=>s.jsx(N0,{note:n.board.notes[D],zoom:o.zoom,id:D,selected:n.selectedNotes.includes(D),readOnly:n.readOnly,h:Ut},D)),n.visibleBoards.map(D=>{var an,Pt,Xt,Dn,Qe,Sn;const K=n.board.boards[D],ae=n.playing===D||n.editFile===D||n.typing===D,Me=ae||et(K),De=ae||Me&&(!X.thumbs||o.zoom>=g0||Math.max(K.w,K.h)*o.zoom>=p0);De&&be.push({f:D,d:ae?-1:Math.hypot(K.x+K.w/2-_t,K.y+K.h/2-Ve)}),ae&&Y.current.add(D);const We=ae||De&&Y.current.has(D),ft=De&&!We,pt=n.selected.includes(D);return s.jsx(w0,{file:D,item:K,exists:at.has(D),zoom:o.zoom,live:We,selected:pt,single:pt&&n.selected.length===1&&!n.readOnly,readOnly:n.readOnly,screens:X,editing:n.editFile===D,typing:n.typing===D,playing:n.playing===D,near:Me,waiting:ft,reloadKey:n.reloadKeys[D]??0,stamp:(an=n.stamps)==null?void 0:an[D],pickable:Ce&&We,h:Ut,overlay:It(D),pins:on(D),compact:K.w*o.zoom>=48&&o.zoom<Ph&&R.has(D),forkScene:R.has(D),tags:K.w*o.zoom>=48&&!(o.zoom<Ph&&R.has(D))&&n.playing!==D?(Pt=n.renderBoardTags)==null?void 0:Pt.call(n,D):null,buttons:n.readOnly?null:(Xt=n.renderBoardButtons)==null?void 0:Xt.call(n,D,o.zoom<Ph&&R.has(D)),ring:((Dn=n.boardRing)==null?void 0:Dn.call(n,D))??null,pick:((Qe=n.frameInfo)==null?void 0:Qe.call(n,D))??null,actions:!n.readOnly&&!!n.onBoardAction,tweaks:!!((Sn=n.hasTweaks)!=null&&Sn.call(n,D))},D)}),lt,E.map((D,K)=>D.axis==="x"?s.jsx("div",{className:"guide",style:{left:D.at,top:D.from,width:1/o.zoom,height:D.to-D.from}},K):s.jsx("div",{className:"guide",style:{left:D.from,top:D.at,height:1/o.zoom,width:D.to-D.from}},K)),w&&s.jsx("div",{className:n.tool==="board"?"draft-board":"marquee",style:{left:w.x,top:w.y,width:w.w,height:w.h,borderWidth:1/o.zoom},children:n.tool==="board"&&s.jsxs("span",{style:{transform:`scale(${1/o.zoom})`},children:[Math.round(w.w)," × ",Math.round(w.h)]})})]}),S&&s.jsx("div",{className:"pan-capture",onPointerDown:me,onPointerMove:ee,onPointerUp:()=>H.current=null})]})}const w0=b.memo(function(o){var ie,le,he,ce,ge,xe,Ze;const{item:r,zoom:f,file:m,h:g,live:v}=o,S=mm(f),j=r.title??o.file,[E,x]=b.useState(!1);b.useEffect(()=>{o.live||x(!1)},[o.live]);const w=r.w*f<48,M=!w&&!!o.compact,z=((ie=r.origin)==null?void 0:ie.kind)==="fork"&&r.origin.by?r.origin:null,H=z?d.occupancy.forked(d.occupancy.clock(Date.parse(z.at??"")||Date.now()),z.by,z.while??d.occupancy.someone):null,W=Ne=>{Ne.preventDefault(),Ne.stopPropagation(),g.context(m,Ne)},T=Ne=>Ne.stopPropagation(),_=r.w*f,I=!!o.actions&&_>=180,X=Ne=>xt=>{var me;xt.stopPropagation();const et=xt.currentTarget.getBoundingClientRect();(me=g.action)==null||me.call(g,m,Ne,{clientX:et.left,clientY:et.bottom+4})},ne=_>=110&&s.jsxs("button",{className:`icon-btn sm board-play ${I?"pill":""} ${r.is_interactive?"always":""} ${o.playing?"pressed":""}`,"aria-label":o.playing?o.actions?d.canvas.edit:d.canvas.stopPlay:d.canvas.play,"aria-haspopup":o.actions&&!o.playing?"menu":void 0,title:o.playing?d.canvas.stopPlayTitle:d.canvas.playTitle,onPointerDown:T,onClick:Ne=>{if(Ne.stopPropagation(),o.actions&&!o.playing)return X("playMenu")(Ne);g.play(m)},children:[o.playing&&I?s.jsx("span",{className:"pill-label",children:d.canvas.edit}):s.jsx(Q,{name:o.playing?"stop":"play",size:14}),I&&!o.playing&&s.jsx("span",{className:"pill-label",children:d.canvas.playShort})]}),ee=o.actions&&_>=220&&s.jsxs(s.Fragment,{children:[o.tweaks&&s.jsx("button",{className:"icon-btn sm board-tool","aria-label":d.canvas.tweaks,title:d.canvas.tweaks,onPointerDown:T,onClick:X("tweaks"),children:s.jsx(Q,{name:"sliders",size:14})}),s.jsx("button",{className:"icon-btn sm board-tool","aria-label":d.canvas.fullWindow,title:d.canvas.fullWindow,onPointerDown:T,onClick:X("expand"),children:s.jsx(Q,{name:"expand",size:14})}),s.jsx("button",{className:"icon-btn sm board-tool","aria-label":d.canvas.exportBoard,title:d.canvas.exportBoard,onPointerDown:T,onClick:X("export"),children:s.jsx(Q,{name:"download",size:14})})]});return s.jsxs("div",{className:`board ${o.selected?"selected":""} ${o.editing?"editing":""} ${o.playing?"playing":""} ${r.frameless?"frameless":""} ${r.is_interactive?"interactive":""} ${o.ring?"held":""}`,style:{left:r.x,top:r.y,width:r.w,height:r.h,...o.ring?{"--ring":o.ring}:{}},"data-file":o.file,role:"group","aria-label":d.canvas.board(j,!!o.selected,!!o.editing,!!o.playing),"aria-description":H??void 0,children:[s.jsxs("div",{className:`board-label ${w?"tiny":""} ${M?"compact":""} ${o.tags?"tagged":""} ${o.forkScene?"fork-scene":""}`,style:{transform:`scale(${1/f})`,width:r.w*f},onPointerDown:Ne=>g.press(Ne,m,"label",v),onPointerMove:Ne=>g.pressMove(Ne,m,v),onPointerUp:Ne=>g.release(Ne,m),onContextMenu:W,title:`${j} · ${o.file}${H?`
56
+ ${H}`:""}`,children:[o.tags,s.jsxs("span",{className:"lab-row",children:[r.is_interactive&&s.jsx("span",{className:"dot","aria-label":d.canvas.interactive}),M&&z?s.jsxs("span",{className:`occ-tag fork-who ${o.ring?"":"done"}`,onDoubleClick:Ne=>Ne.stopPropagation(),children:[o.ring?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(Q,{name:"ai",size:14}),s.jsx("span",{className:"act-tag-text",children:z.by})]}):s.jsx("span",{className:"board-title",onDoubleClick:Ne=>{Ne.stopPropagation(),o.readOnly||g.rename(m)},children:j}),r.locked&&s.jsx("span",{className:"board-lock",role:"img","aria-label":d.menu.locked,title:d.menu.locked,children:s.jsx(Q,{name:"lock",size:14})}),r.w*f>=160&&j!==o.file&&!(M&&z)&&s.jsx("span",{className:"board-file",children:o.file}),M&&o.selected&&(o.buttons||ne)&&s.jsxs("span",{className:"board-btns pinned",children:[o.buttons,ne]}),!M&&r.w*f>=110&&s.jsxs("span",{className:`board-btns ${o.buttons?"pinned":""}`,children:[o.buttons,ee,ne]})]})]}),s.jsxs("div",{className:"board-frame","data-inside":o.editing&&!o.readOnly?"":void 0,"data-easel-file":(le=o.pick)==null?void 0:le.file,"data-easel-path":(he=o.pick)==null?void 0:he.path,"data-easel-element":(ce=o.pick)==null?void 0:ce.element,"aria-label":(ge=o.pick)==null?void 0:ge.label,style:{borderRadius:r.radius??0,background:r.bg||void 0},onDoubleClick:Ne=>{o.playing||o.typing||!o.pickable||(Ne.stopPropagation(),g.doubleClickFrame(Ne,m))},onPointerDown:Ne=>!o.playing&&!o.typing&&g.press(Ne,m,"frame",v),onPointerMove:Ne=>!o.playing&&!o.typing&&g.pressMove(Ne,m,v),onPointerUp:Ne=>!o.playing&&!o.typing&&g.release(Ne,m),onPointerLeave:g.leave,onContextMenu:Ne=>{o.playing||o.typing||(g.contextFrame(Ne,m,v)?(Ne.preventDefault(),Ne.stopPropagation()):W(Ne))},children:[o.exists?o.live?s.jsxs(s.Fragment,{children:[s.jsx(j0,{reloadKey:o.reloadKey,iframeRef:Ne=>g.iframeRef(m,Ne),src:o.screens.url(o.file),html:(Ze=(xe=o.screens).html)==null?void 0:Ze.call(xe,o.file),title:j,interactive:!!o.playing||!!o.typing,onLoad:()=>x(!0)}),!E&&o.screens.thumbs&&s.jsx("div",{className:"board-placeholder loading board-cover",style:{position:"absolute",inset:0,pointerEvents:"none",fontSize:Math.min(64,14/f)},"aria-hidden":"true",children:s.jsx(My,{file:o.file,s:o.stamp,px:hu[0]})})]}):s.jsxs("div",{className:`board-placeholder ${o.near?"loading":"far"}`,style:{fontSize:Math.min(64,14/f)},children:[o.near&&o.screens.thumbs&&s.jsx(My,{file:o.file,s:o.stamp,px:o.waiting?hu[0]:b0(Math.max(r.w,r.h)*f*(window.devicePixelRatio||1))}),s.jsx("span",{className:"ph-title","data-hint":o.near?"":d.canvas.notLoaded,children:j}),o.near&&s.jsx("span",{className:"ph-bar",style:{height:3/Math.max(f,.05)},"aria-hidden":"true"})]}):s.jsx("div",{className:"board-missing",children:d.canvas.fileMissing(o.file)}),o.playing&&!o.actions&&s.jsx("div",{className:"playing-badge",style:{transform:`scale(${1/Math.max(f,.25)})`},children:d.canvas.playing}),o.overlay]}),o.single&&!r.locked&&s.jsx("div",{className:"board-resize",role:"slider","aria-label":d.canvas.boardSize,"aria-valuetext":`${r.w} × ${r.h}`,style:{width:12/f,height:12/f,right:-6/f,bottom:-6/f,borderWidth:1.5/f},onPointerDown:Ne=>{Ne.button===0&&(Ne.stopPropagation(),S.start(Ne,{x:r.w,y:r.h},(xt,et)=>g.resize(m,{w:Xc(Math.round(xt.x),40,8e3),h:Xc(Math.round(xt.y),40,8e3)},et)))},onPointerMove:S.move,onPointerUp:S.end}),o.pins&&s.jsx("div",{className:"pin-layer",children:o.pins})]})});function My({file:n,s:o,px:r}){const[f,m]=b.useState(!1),[g,v]=b.useState(r);b.useEffect(()=>v(w=>Math.max(w,r)),[r]);const S=`/api/thumb?f=${encodeURIComponent(n)}${o?`&s=${o}`:""}&px=${g}`,[j,E]=b.useState(null),x=b.useRef(null);return b.useEffect(()=>{if(S===x.current)return;const w=new Image;return w.onload=()=>E(x.current=S),w.onerror=()=>!x.current&&m(!0),w.src=S,()=>{w.onload=w.onerror=null}},[S]),f||!j?null:s.jsx("img",{className:"board-thumb",src:j,alt:"",decoding:"async",draggable:!1,onLoad:w=>{var M;w.currentTarget.classList.add("loaded"),(M=w.currentTarget.parentElement)==null||M.classList.remove("loading")}})}function j0(n){const o=b.useRef(null),r=b.useRef(!0);return b.useEffect(()=>{if(r.current){r.current=!1;return}const f=o.current,m=f==null?void 0:f.contentWindow;if(!f||!m)return;const g=m.document,v=[];g.querySelectorAll("*").forEach((x,w)=>{(x.scrollTop||x.scrollLeft)&&v.push([w,x.scrollTop,x.scrollLeft])});const S=m.scrollX,j=m.scrollY,E=()=>{f.removeEventListener("load",E);const x=f.contentWindow;x.scrollTo(S,j);const w=x.document.querySelectorAll("*");for(const[M,z,H]of v){const W=w[M];W&&(W.scrollTop=z,W.scrollLeft=H)}f.dispatchEvent(new CustomEvent("dc-reloaded"))};f.addEventListener("load",E),m.location.reload()},[n.reloadKey]),s.jsx("iframe",{ref:f=>{o.current=f,n.iframeRef(f)},src:n.html==null?n.src:void 0,srcDoc:n.html??void 0,title:n.title,onLoad:n.onLoad,style:{pointerEvents:n.interactive?"auto":"none"}})}const N0=b.memo(function(o){const{note:r,h:f,id:m}=o,g=(X,ne)=>f.moveNote(m,X,ne),v=mm(o.zoom),[S,j]=b.useState(!1),E=b.useRef(null);b.useEffect(()=>{if(S&&E.current){E.current.focus();const X=document.createRange();X.selectNodeContents(E.current);const ne=getSelection();ne==null||ne.removeAllRanges(),ne==null||ne.addRange(X)}},[S]);const x=b.useRef(!1),w=b.useRef(!1),M=X=>{j(!1);const ne=X.innerText;ne!==r.text&&g({text:ne},!0)},z=r.size??(r.kind==="title"?72:22),[H,W]=b.useState(z);b.useLayoutEffect(()=>{const X=E.current;if(!X||r.kind!=="title"||S)return W(z);let ne=z;X.style.fontSize=`${ne}px`;const ee=r.maxW??4e3,ie=r.maxH||1/0;for(let le=0;le<40&&ne>12&&(X.scrollWidth>ee+1||X.scrollHeight>ie+1);le++)ne=Math.max(12,Math.floor(ne*.92)),X.style.fontSize=`${ne}px`;W(ne)},[r.text,z,r.maxW,r.maxH,r.kind,S]);const T=mm(o.zoom),_=r.kind==="title"?{left:r.x,top:r.y,maxWidth:r.maxW??4e3,maxHeight:r.maxH||void 0}:{left:r.x,top:r.y,width:r.w??320,height:r.h||void 0,background:Wx(r.color)},I={fontSize:H,fontWeight:r.bold??r.kind==="title"?700:400,fontStyle:r.italic?"italic":void 0};return r.kind==="title"&&H*o.zoom<12&&Object.assign(_,{transform:`scale(${12/(H*o.zoom)})`,transformOrigin:"0 0"}),s.jsxs("div",{className:`note note-${r.kind} ${o.selected?"selected":""} ${o.readOnly?"read-only":""}`,"data-note":o.id,style:_,onPointerDown:X=>{S||X.button!==0||o.readOnly||(X.stopPropagation(),X.shiftKey?f.selectNote(m,!0):o.selected||f.selectNote(m,!1),r.locked||v.start(X,{x:r.x,y:r.y},(ne,ee)=>g({x:Math.round(ne.x),y:Math.round(ne.y)},ee)))},onPointerMove:v.move,onPointerUp:v.end,onDoubleClick:X=>{X.stopPropagation(),o.readOnly||j(!0)},onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),!o.readOnly&&(f.selectNote(m,!1),f.contextNote(m,X))},children:[s.jsx("div",{ref:E,className:"note-text",style:I,contentEditable:S,suppressContentEditableWarning:!0,onCompositionStart:()=>x.current=!0,onCompositionEnd:X=>{x.current=!1,w.current&&(w.current=!1,M(X.currentTarget))},onBlur:X=>{x.current?w.current=!0:M(X.currentTarget)},onKeyDown:X=>{X.nativeEvent.isComposing||X.key==="Escape"&&X.currentTarget.blur()},children:r.text}),r.locked&&s.jsx("span",{className:"note-lock",role:"img","aria-label":d.menu.locked,title:d.menu.locked,style:{transform:`scale(${1/Math.max(o.zoom,.25)})`},children:s.jsx(Q,{name:"lock",size:14})}),o.selected&&o.zoom>=.2&&!S&&!r.locked&&s.jsx("div",{className:"note-resize",role:"slider","aria-label":r.kind==="title"?d.canvas.titleMaxWidth:d.canvas.stickySize,style:{width:12/o.zoom,height:12/o.zoom,right:-6/o.zoom,bottom:-6/o.zoom,borderWidth:1.5/o.zoom},onPointerDown:X=>{if(X.button!==0)return;X.stopPropagation();const ne=X.currentTarget.parentElement.getBoundingClientRect(),ee=ne.width/o.zoom,ie=ne.height/o.zoom;T.start(X,{x:ee,y:ie},(le,he)=>g(r.kind==="title"?{maxW:Math.max(80,Math.round(le.x))}:{w:Math.max(80,Math.round(le.x)),h:Math.max(60,Math.round(le.y))},he))},onPointerMove:T.move,onPointerUp:T.end}),o.selected&&!S&&o.zoom>=.2&&s.jsx("button",{className:"note-del icon-btn","aria-label":d.canvas.deleteNote,style:{transform:`scale(${1/o.zoom})`},onPointerDown:X=>X.stopPropagation(),onClick:X=>{X.stopPropagation(),f.deleteNote(m)},children:s.jsx(Q,{name:"close",size:14})})]})});function mm(n){const o=b.useRef(null);return{start(r,f,m){o.current={sx:r.clientX,sy:r.clientY,ox:f.x,oy:f.y,cb:m,moved:!1},r.currentTarget.setPointerCapture(r.pointerId)},move(r){const f=o.current;if(!f)return;const m=(r.clientX-f.sx)/n,g=(r.clientY-f.sy)/n;!f.moved&&Math.abs(m)+Math.abs(g)<2/n||(f.moved=!0,f.cb({x:f.ox+m,y:f.oy+g},!1))},end(r){const f=o.current;o.current=null,!(!f||!f.moved)&&f.cb({x:f.ox+(r.clientX-f.sx)/n,y:f.oy+(r.clientY-f.sy)/n},!0)}}}function Ay(n,o,r){let f=null;for(const m of n)for(const g of o){const v=g-m;Math.abs(v)<=r&&(!f||Math.abs(v)<Math.abs(f.d))&&(f={d:v,at:g})}return f}const gb=n=>{const o=Math.min(...n.map(f=>f.x)),r=Math.min(...n.map(f=>f.y));return{x:o,y:r,w:Math.max(...n.map(f=>f.x+f.w))-o,h:Math.max(...n.map(f=>f.y+f.h))-r}},Jh=(n,o)=>n.x<o.x+o.w&&n.x+n.w>o.x&&n.y<o.y+o.h&&n.y+n.h>o.y,S0=n=>({x:Math.round(n.x),y:Math.round(n.y),w:Math.round(n.w),h:Math.round(n.h)});function Xc(n,o,r){return Math.min(r,Math.max(o,n))}function cu(n){const o=n.target;return o?o.tagName==="INPUT"?!/^(checkbox|radio|button|range|color)$/.test(o.type):o.isContentEditable||/^(TEXTAREA|SELECT)$/.test(o.tagName):!1}function Ri(n,o,r=60,f){if(!n.length)return{x:0,y:0,zoom:1};(o.w<100||o.h<100)&&(o={w:window.innerWidth,h:Math.max(200,window.innerHeight)});const m=f&&f.w>=100&&f.h>=100?f:{x:0,y:0,w:o.w,h:o.h};r=Math.min(r,m.w*.08,m.h*.08);const g=gb(n),v=Xc(Math.min((m.w-r*2)/g.w,(m.h-r*2)/g.h),Tm,Cm);return{zoom:v,x:Math.round(m.x+r-g.x*v+(m.w-r*2-g.w*v)/2),y:Math.round(m.y+r-g.y*v+(m.h-r*2-g.h*v)/2)}}function k0(n){const[o,r]=b.useState(null),f=b.useCallback(()=>Te.get("/api/assets").then(m=>r(m.assets)).catch(()=>r([])),[]);return b.useEffect(()=>{f()},[f,n]),{list:o,reload:f}}async function gm(n){const o=[];for(const r of Array.from(n)){const f=await new Promise(m=>{const g=new FileReader;g.onload=()=>m(String(g.result).split(",")[1]??""),g.readAsDataURL(r)});o.push(await Te.post("/api/assets",{name:r.name,data:f}))}return o}const T0=n=>n>1024*1024?`${(n/1024/1024).toFixed(1)}MB`:`${Math.max(1,Math.round(n/1024))}KB`;function pb(n){const{list:o,reload:r}=k0(n.version),[f,m]=b.useState(!1),[g,v]=b.useState(!1),S=async E=>{var x;m(!0);try{const w=await gm(E);await r(),(x=n.onUploaded)==null||x.call(n,w)}catch(w){n.onError(w.message)}finally{m(!1)}},j=(o??[]).filter(E=>!n.only||E.kind===n.only);return s.jsxs("div",{className:`assets ${g?"over":""}`,onDragOver:E=>{E.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:E=>{E.preventDefault(),v(!1),E.dataTransfer.files.length&&S(E.dataTransfer.files)},children:[s.jsxs("label",{className:"upload",children:[s.jsx(Q,{name:"plus",size:14})," ",f?d.assets.uploading:d.assets.upload,s.jsx("input",{type:"file",hidden:!0,multiple:!0,accept:"image/*,.woff,.woff2,.ttf,.otf",onChange:E=>E.target.files&&void S(E.target.files)})]}),o==null?s.jsxs("p",{className:"empty",children:[s.jsx("span",{className:"spinner","aria-hidden":"true"})," ",d.assets.loading]}):j.length===0?s.jsx("p",{className:"empty",children:d.assets.empty}):s.jsx("ul",{className:"asset-grid",children:j.map(E=>s.jsx("li",{children:s.jsxs("button",{className:"asset",title:`${E.ref} · ${T0(E.size)}${n.onPick?"":d.assets.copyPath}`,"aria-label":`${E.name}${n.pickLabel??""}`,onClick:()=>n.onPick?n.onPick(E):void navigator.clipboard.writeText(E.ref).catch(()=>{}),children:[E.kind==="image"?s.jsx("img",{src:E.url,alt:"",loading:"lazy"}):s.jsx("span",{className:"asset-font",children:E.kind==="font"?"Aa":d.assets.file}),s.jsx("span",{className:"asset-name",children:E.name})]})},E.name))})]})}function C0({open:n,version:o,onClose:r,onPick:f,onError:m}){return b.useEffect(()=>{if(!n)return;const g=v=>v.key==="Escape"&&r();return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[n,r]),n?s.jsx("div",{className:"dialog-backdrop",onPointerDown:g=>g.target===g.currentTarget&&r(),children:s.jsxs("div",{className:"dialog wide",role:"dialog","aria-modal":"true","aria-label":d.assets.pickImage,children:[s.jsx("h2",{children:d.assets.pickImage}),s.jsx(pb,{version:o,only:"image",pickLabel:d.assets.pickLabel,onPick:f,onError:m,onUploaded:g=>g[0]&&g[0].kind==="image"&&f(g[0])}),s.jsx("div",{className:"dialog-actions",children:s.jsx("button",{onClick:r,children:d.assets.close})})]})}):null}var Ih=cb();function zy({label:n,src:o,empty:r,w:f,h:m}){const g=b.useRef(null),[v,S]=b.useState(0);return b.useEffect(()=>{const j=g.current;if(!j)return;const E=()=>S(Math.min(1,(j.clientWidth-16)/f,(j.clientHeight-16)/m));E();const x=new ResizeObserver(E);return x.observe(j),()=>x.disconnect()},[f,m]),s.jsxs("figure",{className:"cmp-pane",children:[s.jsx("figcaption",{children:n}),s.jsx("div",{className:"cmp-stage",ref:g,children:o?s.jsx("div",{className:"cmp-frame",style:{width:f*v,height:m*v},children:v>0&&s.jsx("iframe",{title:n,src:o,style:{width:f,height:m,transform:`scale(${v})`}})}):s.jsx("p",{className:"muted",children:r})})]})}const E0=n=>o=>`/api/chat/run-file?id=${encodeURIComponent(n)}&f=${encodeURIComponent(`screens/${o}`)}`,M0=n=>o=>`/api/history/step-file?id=${encodeURIComponent(n)}&f=${encodeURIComponent(o)}`;function yb({before:n,boards:o,onClose:r,notBefore:f=d.compare.notBefore}){const[m,g]=b.useState(()=>Math.max(0,o.findIndex(j=>j.kind==="changed"))),v=o[m];if(!v)return null;const S=j=>j.split("/").map(encodeURIComponent).join("/");return s.jsx("div",{className:"dialog-backdrop",onPointerDown:j=>j.target===j.currentTarget&&r(),children:s.jsxs("div",{className:"dialog cmp",role:"dialog","aria-modal":"true","aria-label":d.compare.title(v.title),onKeyDown:j=>{j.key==="Escape"&&(j.stopPropagation(),r())},children:[s.jsxs("div",{className:"cmp-head",children:[s.jsx("h2",{children:d.compare.title(v.title)}),s.jsx("button",{className:"icon-btn sm","aria-label":d.compare.close,title:d.compare.close,autoFocus:!0,onClick:r,children:s.jsx(Q,{name:"close",size:14})})]}),o.length>1&&s.jsx("div",{className:"chips",role:"tablist","aria-label":d.compare.boards,children:o.map((j,E)=>s.jsx("button",{role:"tab","aria-selected":E===m,className:`chip cmp-tab ${E===m?"on":""}`,onClick:()=>g(E),children:j.kind==="added"?d.chat.chipNew(j.title):j.title},j.file))}),s.jsxs("div",{className:"cmp-panes",children:[s.jsx(zy,{label:d.compare.before,src:v.kind==="added"?null:n(v.file),empty:f,w:v.w,h:v.h},`b-${v.file}`),s.jsx(zy,{label:d.compare.after,src:v.kind==="removed"?null:`/screens/${S(v.file)}`,empty:d.compare.notAfter,w:v.w,h:v.h},`a-${v.file}`)]})]})})}const A0=/^ {0,3}(`{3,}|~{3,})\s*([\w#+.-]*)/,z0=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,ru=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/,$0=/^ {0,3}([-*_])(\s*\1){2,}\s*$/,O0=n=>/^https?:\/\/[^\s<>"]+$/i.test(n)?n:null;function R0(n){const o=String(n??"").replace(/\r\n?/g,`
57
+ `).split(`
58
+ `),r=[];let f=[];const m=()=>{f.length&&r.push({t:"p",c:Di(f.join(`
59
+ `))}),f=[]};for(let g=0;g<o.length;g++){const v=o[g],S=A0.exec(v);if(S){m();const E=S[1],x=[];let w=!0;for(g++;g<o.length;g++){if(new RegExp(`^ {0,3}${E[0]==="`"?"`":"~"}{${E.length},}\\s*$`).test(o[g])){w=!1;break}x.push(o[g])}r.push({t:"code",lang:S[2]??"",v:x.join(`
60
+ `),open:w});continue}if(!v.trim()){m();continue}const j=z0.exec(v);if(j){m(),r.push({t:"h",level:j[1].length,c:Di(j[2])});continue}if($0.test(v)&&!f.length){r.push({t:"hr"});continue}if(ru.test(v)&&(!f.length||!/^\s/.test(v))){m(),g=D0(o,g,r)-1;continue}f.push(v.trim())}return m(),r}const lu=n=>/\d/.test(n)?"ol":"ul";function D0(n,o,r){var j;const f=ru.exec(n[o]),m=f[1].length,g={t:lu(f[2]),start:lu(f[2])==="ol"?parseInt(f[2],10):1,items:[]},v=[],S=[];for(;o<n.length;o++){const E=n[o];if(!E.trim()){const M=n.slice(o+1).find(z=>z.trim());if(M&&ru.test(M)&&ru.exec(M)[1].length>=m)continue;break}const x=ru.exec(E);if(x&&x[1].length<=m+1){if(lu(x[2])!==g.t)break;g.items.push({c:[]}),v.push([x[3]]),S.push({list:{t:"ul",start:1,items:[]},texts:[]});continue}if(!g.items.length)break;const w=S[S.length-1];if(x){w.list.items.length||(w.list={t:lu(x[2]),start:lu(x[2])==="ol"?parseInt(x[2],10):1,items:[]}),w.list.items.push({c:[]}),w.texts.push([x[3]]);continue}if(!/^\s/.test(E)&&!((j=n[o-1])!=null&&j.trim()))break;(w.texts.length?w.texts[w.texts.length-1]:v[v.length-1]).push(E.trim())}return g.items.forEach((E,x)=>{E.c=Di(v[x].join(`
61
+ `));const w=S[x];w.list.items.length&&(w.list.items.forEach((M,z)=>M.c=Di(w.texts[z].join(`
62
+ `))),E.sub=w.list)}),r.push(g),o}function Di(n){const o=[];let r="";const f=g=>{r&&o.push({t:"text",v:r}),r="",o.push(g)};let m=0;for(;m<n.length;){const g=n[m];if(g==="\\"&&m+1<n.length&&/[\\`*_[\]()#+\-.!>~|]/.test(n[m+1])){r+=n[m+1],m+=2;continue}if(g===`
63
+ `){f({t:"br"}),m++;continue}if(g==="`"){let v=1;for(;n[m+v]==="`";)v++;const S="`".repeat(v),j=n.indexOf(S,m+v);if(j>m){const E=n.slice(m+v,j);f({t:"code",v:E.length>2&&E.startsWith(" ")&&E.endsWith(" ")?E.slice(1,-1):E}),m=j+v;continue}r+=S,m+=v;continue}if((g==="*"||g==="_")&&n[m+1]===g){const v=n.indexOf(g+g,m+2);if(v>m+2&&n[m+2]!==" "){f({t:"b",c:Di(n.slice(m+2,v))}),m=v+2;continue}}else if(g==="*"||g==="_"){const v=g==="*"||!/\w/.test(n[m-1]??"");let S=-1;for(let j=m+1;j<n.length;j++)if(n[j]===g&&n[j+1]!==g&&n[j-1]!==" "&&(g==="*"||!/\w/.test(n[j+1]??""))){S=j;break}if(v&&S>m+1&&n[m+1]!==" "&&!n.slice(m+1,S).includes(`
64
+ `)){f({t:"i",c:Di(n.slice(m+1,S))}),m=S+1;continue}}if(g==="["){const v=/^\[([^\]\n]*)\]\(([^)\s]*)\)/.exec(n.slice(m));if(v){const S=O0(v[2]),j=Di(v[1]);if(S)f({t:"a",href:S,c:j});else for(const E of j)E.t==="text"?r+=E.v:f(E);m+=v[0].length;continue}}if((g==="h"||g==="H")&&!/\w/.test(n[m-1]??"")){const v=/^https?:\/\/[^\s<>"`]+/i.exec(n.slice(m));if(v){const S=v[0].replace(/[.,;:!?)\]'"]+$/,"");f({t:"a",href:S,c:[{t:"text",v:S}]}),m+=S.length;continue}}r+=g,m++}return r&&o.push({t:"text",v:r}),o}const bb=b.createContext(()=>{}),vb=()=>b.useContext(bb);function B0({children:n}){const[o,r]=b.useState([]),f=b.useCallback(m=>{const g=Date.now()+Math.random();r(v=>[...v.slice(-3),{...m,id:g}]),setTimeout(()=>r(v=>v.filter(S=>S.id!==g)),m.ms??(m.tone==="error"?6e3:3200))},[]);return s.jsxs(bb.Provider,{value:f,children:[n,s.jsx("div",{className:"toasts",role:"status","aria-live":"polite",children:o.map(m=>s.jsxs("div",{className:`toast ${m.tone??"info"}`,children:[m.tone==="error"?s.jsx(Q,{name:"warn"}):m.tone==="ok"?s.jsx(Q,{name:"check"}):null,m.dot&&s.jsx("span",{className:"toast-dot","aria-hidden":"true"}),s.jsx("span",{children:m.text}),m.code&&s.jsx("code",{className:"toast-code",children:m.code}),m.action&&s.jsx("button",{className:"toast-action",onClick:()=>{m.action.run(),r(g=>g.filter(v=>v.id!==m.id))},children:m.action.label}),m.close&&s.jsx("button",{className:"icon-btn oc-ib toast-close","aria-label":m.close.label,title:m.close.label,onClick:()=>{var g,v;(v=(g=m.close).run)==null||v.call(g),r(S=>S.filter(j=>j.id!==m.id))},children:s.jsx(Q,{name:"close",size:16})})]},m.id))})]})}function xb({icon:n,text:o,alt:r}){return s.jsxs("span",{className:"swap-label",children:[s.jsxs("span",{children:[n," ",o]}),s.jsxs("span",{"aria-hidden":"true",children:[n," ",r]})]})}function H0({menu:n,onClose:o,head:r}){const f=b.useRef(null),[m,g]=b.useState({x:0,y:0}),[v,S]=b.useState(-1);if(b.useLayoutEffect(()=>{if(!n||!f.current)return;const x=f.current.getBoundingClientRect(),w=n.right?n.x-x.width:n.x,M=n.up?n.y-x.height:n.y;g({x:Math.round(Math.max(8,Math.min(w,window.innerWidth-x.width-8))),y:Math.round(Math.max(8,Math.min(M,window.innerHeight-x.height-8)))}),S(-1),f.current.focus()},[n]),b.useEffect(()=>{if(!n)return;const x=w=>{f.current&&w.target instanceof Node&&f.current.contains(w.target)||o()};return window.addEventListener("pointerdown",x,!0),window.addEventListener("blur",o),()=>{window.removeEventListener("pointerdown",x,!0),window.removeEventListener("blur",o)}},[n,o]),!n)return null;const j=n.items,E=j.map((x,w)=>x!=="sep"&&!x.disabled&&!x.heading?w:-1).filter(x=>x>=0);return s.jsxs("div",{ref:f,className:`menu entering ${n.className??""}`,role:"menu",tabIndex:-1,"aria-label":n.title??d.dialog.menu,style:{left:m.x,top:m.y},onKeyDown:x=>{var w,M;if(["Escape","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"].includes(x.key)&&x.stopPropagation(),x.key==="Escape")o();else if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();const z=E.indexOf(v),H=x.key==="ArrowDown"?E[(z+1)%E.length]:E[(z-1+E.length)%E.length];S(H)}else if((x.key==="ArrowRight"||x.key==="F10"&&x.shiftKey)&&v>=0){const z=j[v],H=z!=="sep"&&z.more,W=H&&((M=(w=f.current)==null?void 0:w.querySelector(`[data-more="${v}"]`))==null?void 0:M.getBoundingClientRect());H&&W&&(x.preventDefault(),o(),H.open({clientX:W.left,clientY:W.bottom+4}))}else if(x.key==="Enter"&&v>=0){const z=j[v];z!=="sep"&&(o(),z.run())}},children:[n.title&&s.jsx("div",{className:"menu-title",children:n.title}),r??n.head,j.map((x,w)=>x==="sep"?s.jsx("div",{className:"menu-sep",role:"separator"},w):x.heading?s.jsx("div",{className:"menu-title menu-heading",role:"presentation",children:x.label},w):x.more?s.jsxs("div",{className:`menu-row ${v===w?"active":""}`,role:"none",children:[s.jsx(L0,{it:x,icons:!!n.icons,active:v===w,onHover:()=>S(w),onClose:o}),s.jsx("button",{className:"icon-btn menu-more",role:"menuitem",tabIndex:-1,"data-more":w,"aria-haspopup":"menu","aria-label":x.more.label,title:x.more.label,onMouseEnter:()=>S(w),onClick:M=>{const z=M.currentTarget.getBoundingClientRect();o(),x.more.open({clientX:z.left,clientY:z.bottom+4})},children:s.jsx(Q,{name:"more",size:16})})]},w):s.jsxs("button",{role:x.check===void 0?"menuitem":"menuitemcheckbox","aria-checked":x.check===void 0?void 0:x.check,"aria-label":x.aria&&x.aria!==x.label?x.aria:void 0,title:x.aria&&x.aria!==x.label?x.shortcut?`${x.aria} (${x.shortcut})`:x.aria:x.tip,className:`menu-item ${v===w?"active":""} ${x.danger?"danger":""}`,disabled:x.disabled,onMouseEnter:()=>S(w),onClick:()=>{o(),x.run()},children:[n.icons&&s.jsx("span",{className:"menu-icon",children:x.icon&&s.jsx(Q,{name:x.icon})}),s.jsx("span",{className:"menu-label",children:x.label}),x.check!==void 0&&s.jsx("span",{className:`menu-check ${x.check?"on":""}`,"aria-hidden":"true",children:s.jsx(Q,{name:"check",size:14})}),x.shortcut&&s.jsx("kbd",{children:x.shortcut})]},w))]})}function L0({it:n,icons:o,active:r,onHover:f,onClose:m}){return s.jsxs("button",{role:n.check===void 0?"menuitem":"menuitemcheckbox","aria-checked":n.check===void 0?void 0:n.check,"aria-label":n.aria&&n.aria!==n.label?n.aria:void 0,className:`menu-item ${r?"active":""} ${n.danger?"danger":""}`,disabled:n.disabled,title:n.aria&&n.aria!==n.label?n.aria:n.tip,onMouseEnter:f,onClick:()=>{m(),n.run()},children:[o&&s.jsx("span",{className:"menu-icon",children:n.icon&&s.jsx(Q,{name:n.icon})}),s.jsx("span",{className:"menu-label",children:n.label}),n.check!==void 0&&s.jsx("span",{className:`menu-check ${n.check?"on":""}`,"aria-hidden":"true",children:s.jsx(Q,{name:"check",size:14})})]})}function _0({state:n,onClose:o}){const[r,f]=b.useState(""),[m,g]=b.useState(!1),v=b.useRef(null),S=b.useRef(null);if(b.useEffect(()=>{var x;n&&(n.kind==="prompt"?(f(n.value),g(((x=n.extra)==null?void 0:x.checked)??!1),setTimeout(()=>{var w;return(w=v.current)==null?void 0:w.select()},0)):setTimeout(()=>{var w;return(w=S.current)==null?void 0:w.focus()},0))},[n]),!n)return null;const j=()=>{n.kind==="prompt"?n.resolve(null):n.resolve(!1),o()},E=()=>{n.kind==="prompt"?n.resolve({value:r,extra:m}):n.resolve(!0),o()};return s.jsx("div",{className:"dialog-backdrop",onPointerDown:x=>x.target===x.currentTarget&&j(),children:s.jsxs("div",{className:"dialog",role:"dialog","aria-modal":"true","aria-label":n.title,onKeyDown:x=>{x.key==="Escape"&&j(),x.key==="Enter"&&!x.nativeEvent.isComposing&&E()},children:[s.jsx("h2",{children:n.title}),n.kind==="prompt"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"dialog-field",children:[n.label&&s.jsx("span",{children:n.label}),s.jsx("input",{ref:v,value:r,onChange:x=>f(x.target.value)})]}),n.hint&&s.jsx("p",{className:"muted",children:n.hint}),n.extra&&s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:m,onChange:x=>g(x.target.checked)}),n.extra.label]})]}):s.jsx("p",{children:n.body}),s.jsxs("div",{className:"dialog-actions",children:[s.jsx("button",{onClick:j,children:d.dialog.cancel}),s.jsx("button",{ref:S,className:n.kind==="confirm"&&n.danger?"danger primary":"primary",onClick:E,children:n.ok})]})]})})}function U0(){const[n,o]=b.useState(null);return{state:n,close:()=>o(null),prompt:m=>new Promise(g=>o({kind:"prompt",value:m.value??"",ok:m.ok??d.dialog.ok,...m,resolve:g})),confirm:m=>new Promise(g=>o({kind:"confirm",ok:m.ok??d.dialog.ok,...m,resolve:g}))}}const $y=n=>`design-canvas:open:${n}`;function uu({id:n,title:o,count:r,defaultOpen:f=!1,right:m,variant:g="head",children:v}){const[S,j]=b.useState(()=>{try{const M=localStorage.getItem($y(n));return M==null?f:M==="1"}catch{return f}}),E=()=>{j(M=>{try{localStorage.setItem($y(n),M?"0":"1")}catch{}return!M})},w=r!==void 0&&r!==""&&s.jsx("span",{className:`collapsible-count ${typeof r=="string"?"oc-off":""}`,children:r});return g==="row"?s.jsxs("div",{className:`pp-foldset ${S?"open":""}`,children:[s.jsxs("button",{className:"pp-fold","aria-expanded":S,"aria-controls":`sec-${n}`,onClick:E,children:[s.jsx("span",{className:"pp-l",children:o}),s.jsxs("span",{className:"pp-v",children:[w,s.jsx(Q,{name:"chevronRight",size:14,className:"chev"})]})]}),S&&s.jsx("div",{className:"pp-fold-body",id:`sec-${n}`,children:v})]}):s.jsxs("section",{className:`pp-group collapsible ${S?"open":""}`,"data-collapsible":n,children:[s.jsxs("div",{className:"collapsible-head",children:[s.jsxs("button",{className:"pp-fold-h","aria-expanded":S,"aria-controls":`sec-${n}`,onClick:E,children:[s.jsx(Q,{name:"chevronRight",size:14,className:"chev"}),s.jsx("span",{className:"collapsible-title",children:o}),w]}),m&&s.jsx("span",{className:"collapsible-right",children:m})]}),S&&s.jsx("div",{className:"pp-fold-body",id:`sec-${n}`,children:v})]})}function Il(n,o="button"){var v,S;if(!n)return;const r=Array.from(n.querySelectorAll(o)),f=`${window.innerWidth}|${(v=document.fonts)==null?void 0:v.status}|${((S=n.closest(".app"))==null?void 0:S.className)??""}|${r.map(j=>`${j.className}${j.textContent}`).join("")}`,m=Wh.get(n);if(m&&m.key===f&&m.els.length===r.length&&m.els.every((j,E)=>j===r[E]))return;for(const j of r)j.style.width="";const g=r.map(j=>j.getBoundingClientRect().width);r.forEach((j,E)=>{g[E]%1>.01&&(j.style.width=`${Math.ceil(g[E])}px`)}),g.some(j=>j===0)?Wh.delete(n):Wh.set(n,{key:f,els:r})}const Wh=new WeakMap;function wb(n,o,r=o){const[f,m]=b.useState(null);return b.useLayoutEffect(()=>{const g=n.current;if(!g)return;Il(g);let v=Math.max(8,Math.round((o-g.offsetWidth)/2));v+g.offsetWidth>r-8&&(v=Math.max(8,Math.round((r-g.offsetWidth)/2))),v!==f&&m(v)}),f}function Yc({c:n}){return s.jsx(s.Fragment,{children:n.map((o,r)=>o.t==="text"?o.v:o.t==="code"?s.jsx("code",{className:o.v.length>24?"long":void 0,children:o.v},r):o.t==="b"?s.jsx("strong",{children:s.jsx(Yc,{c:o.c})},r):o.t==="i"?s.jsx("em",{children:s.jsx(Yc,{c:o.c})},r):o.t==="a"?s.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",children:s.jsx(Yc,{c:o.c})},r):s.jsx("br",{},r))})}function jb({list:n}){const o=n.items.map((r,f)=>s.jsxs("li",{children:[s.jsx(Yc,{c:r.c}),r.sub&&s.jsx(jb,{list:r.sub})]},f));return n.t==="ol"?s.jsx("ol",{start:n.start,children:o}):s.jsx("ul",{children:o})}function q0({v:n}){const[o,r]=b.useState(!1);return s.jsxs("div",{className:"codeblock",children:[s.jsx("button",{className:"copy",onClick:()=>{var f;return void((f=navigator.clipboard)==null?void 0:f.writeText(n).then(()=>{r(!0),window.setTimeout(()=>r(!1),1500)}))},children:s.jsx(xb,{icon:s.jsx(Q,{name:"copy",size:12}),text:o?d.chat.copied:d.chat.copy,alt:o?d.chat.copy:d.chat.copied})}),s.jsx("pre",{children:s.jsx("code",{children:n})})]})}const V0=({b:n})=>n.t==="p"?s.jsx("p",{children:s.jsx(Yc,{c:n.c})}):n.t==="h"?s.jsx("p",{className:`md-h h${Math.min(n.level,3)}`,role:"heading","aria-level":n.level,children:s.jsx(Yc,{c:n.c})}):n.t==="code"?s.jsx(q0,{v:n.v}):n.t==="hr"?s.jsx("hr",{}):s.jsx(jb,{list:n});function G0({text:n,className:o=""}){const r=b.useMemo(()=>R0(n),[n]);return s.jsx("div",{className:`md ${o}`,children:r.map((f,m)=>s.jsx(V0,{b:f},m))})}const Gc={claude:"Claude Code",codex:"Codex",cursor:"Cursor Agent",gemini:"Gemini CLI"},Y0=Object.entries(Gc).map(([n,o])=>({id:n,label:o,ok:!0})),X0={claude:"claude",codex:"codex",cursor:"cursor-agent",gemini:"gemini"},Oy={claude:"claude auth login",codex:"codex login",cursor:"cursor-agent login",gemini:"gemini"},K0={claude:"npm install -g @anthropic-ai/claude-code",codex:"npm install -g @openai/codex",cursor:"curl https://cursor.com/install -fsS | bash",gemini:"npm install -g @google/gemini-cli"},Z0={claude:["opus","sonnet","haiku"],codex:[],cursor:[],gemini:["gemini-2.5-pro","gemini-2.5-flash"]},_d={changed:0,added:1,removed:2},F0=n=>Gc[n]?`var(--agent-${n})`:"var(--line-strong)",Ry=(n,o)=>{try{const r=localStorage.getItem(n);return r==null?o:JSON.parse(r)}catch{return o}},Dy=(n,o)=>{try{localStorage.setItem(n,JSON.stringify(o))}catch{}},By=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),Hy=n=>new Date(n).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}),Q0=n=>(n.split(/[\\/]/).filter(Boolean).pop()??n)+"/";function em({text:n}){return s.jsx(s.Fragment,{children:n.split("`").map((o,r)=>r%2?s.jsx("code",{children:o},r):o)})}function Ud(n,o){const r=[...n.parts],f=r[r.length-1],m={...n};if(o.kind==="delta")(f==null?void 0:f.t)==="text"?r[r.length-1]={t:"text",text:f.text+o.text}:r.push({t:"text",text:o.text});else if(o.kind==="break")(f==null?void 0:f.t)==="text"&&f.text&&r.push({t:"text",text:""});else if(o.kind==="text")r.push({t:"text",text:o.text});else if(o.kind==="plain")(f==null?void 0:f.t)==="plain"?r[r.length-1]={t:"plain",text:`${f.text}
65
+ ${o.text}`}:r.push({t:"plain",text:o.text});else if(o.kind==="tool")r.push({t:"tool",name:o.name,detail:o.detail});else if(o.kind==="permission"){const{kind:g,...v}=o,S=r.findIndex(j=>j.t==="perm"&&j.id===o.id);S>=0?r[S]={...r[S],...v}:r.push({t:"perm",...v})}else if(o.kind==="permission-answered"){const g=r.findIndex(v=>v.t==="perm"&&v.id===o.id);g>=0&&(r[g]={...r[g],decision:o.decision})}else if(o.kind==="error"&&o.cause){for(let g=r.length-1;g>=0;g--)r[g].t==="error"&&r.splice(g,1);r.push({t:"error",text:o.text,cause:o.cause,raw:o.raw,changed:o.changed})}else o.kind==="error"?r.push({t:"error",text:o.text}):o.kind==="done"?m.cost=o.cost:o.kind==="start"?m.variants=o.variants:o.kind==="run-undo"?m.undone=o.undone:o.kind==="end"&&(m.status=o.status,m.step=o.step,m.boards=o.boards);return m.parts=r.filter(g=>g.t!=="text"&&g.t!=="plain"||g.text),m}function P0(n){const[o,r]=b.useState([]),[f,m]=b.useState(!1),[g,v]=b.useState(null),[S,j]=b.useState(!1),[E,x]=b.useState(null),[w,M]=b.useState(!1),[z,H]=b.useState(()=>Ry("design-canvas:models",{})),[W,T]=b.useState(!1),[_,I]=b.useState(null),[X,ne]=b.useState(()=>{try{return localStorage.getItem("design-canvas:agent")??"claude"}catch{return"claude"}}),[ee,ie]=b.useState([]),[le,he]=b.useState(null),[ce,ge]=b.useState({}),[xe,Ze]=b.useState(!0),[Ne,xt]=b.useState(!0),[et,me]=b.useState(!0),[je,Ce]=b.useState(1),[Ue,fe]=b.useState(null),[re,Fe]=b.useState(null),[dt,R]=b.useState(null),[Y,ue]=b.useState(null),[pe,$e]=b.useState(!1),[Re,G]=b.useState({}),[de,be]=b.useState(null),[_t,Ve]=b.useState(null),[Qt,Ut]=b.useState(null),[at,Ge]=b.useState(null),on=b.useRef(null),It=b.useRef(null),Vn=b.useRef(null),lt=b.useRef(null),Rn=b.useRef(null),D=b.useRef(null);D.current=le;const K=b.useRef(new Map),ae=n.storeKey?`easel:chat:${n.storeKey}`:null,Me=b.useRef(0),De=b.useCallback((A=!1)=>{m(!0);const P=++Me.current;Te.get("/api/agents").then(Be=>{P===Me.current&&(r(Be.agents),v({at:Be.checkedAt,onOpen:A}))}).catch(()=>{}).finally(()=>P===Me.current&&m(!1))},[]);b.useEffect(()=>{n.open&&De(!0)},[n.open,De]),b.useEffect(()=>{try{localStorage.setItem("design-canvas:agent",X)}catch{}},[X]),b.useEffect(()=>Dy("design-canvas:models",z),[z]),b.useEffect(()=>{if(!S)return;const A=Be=>{const ye=ke=>ke.current&&Be.target instanceof Node&&ke.current.contains(Be.target);ye(Vn)||ye(lt)||j(!1)},P=()=>j(!1);return window.addEventListener("pointerdown",A,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("pointerdown",A,!0),window.removeEventListener("resize",P)}},[S]),b.useEffect(()=>{var A,P;S&&((P=(A=lt.current)==null?void 0:A.querySelector('[aria-checked="true"], [role^="menuitem"]'))==null||P.focus())},[S]);const We=()=>{var A,P;j(!1),(P=(A=Vn.current)==null?void 0:A.querySelector(".agent-btn"))==null||P.focus()},ft=A=>{if(A.key==="Escape")return We();if(A.key!=="Tab"||!lt.current)return;const P=Array.from(lt.current.querySelectorAll("button:not(:disabled), a[href]"));A.target===P[A.shiftKey?0:P.length-1]&&(A.preventDefault(),We())},pt=A=>{const P=A.getBoundingClientRect();x({right:Math.round(window.innerWidth-P.right),top:Math.round(P.bottom+4)}),j(Be=>!Be)},an=(A,P)=>{var Be;(Be=navigator.clipboard)==null||Be.writeText(P).then(()=>{I(A),window.setTimeout(()=>I(ye=>ye===A?null:ye),1500)})},Pt=b.useRef(new Set),Xt=b.useRef(new Map),Dn=b.useRef(()=>{});b.useEffect(()=>n.subscribe((A,P)=>{if(P.kind==="boot")return R(P.boot);if(!Pt.current.has(A)){Xt.current.set(A,[...Xt.current.get(A)??[],P]);return}Dn.current(A,P)}),[n.subscribe]),Dn.current=(A,P)=>{if(ie(ye=>ye.map(ke=>ke.role==="ai"&&ke.id===A?Ud(ke,P):ke)),P.kind==="end"&&n.onRunEnd){const ye=ee.find(qe=>qe.role==="ai"&&qe.id===A),ke=ye?Ud(ye,P):null,ht=((ke==null?void 0:ke.parts)??[]).filter(qe=>qe.t==="text").map(qe=>qe.text).join("").trim();n.onRunEnd({id:A,status:P.status,reply:ht,files:(P.boards??(ke==null?void 0:ke.boards)??[]).map(qe=>qe.file)})}if(P.kind==="end"&&he(ye=>ye===A?null:ye),P.kind==="session"){const ye=ee.find(ke=>ke.role==="ai"&&ke.id===A);ye&&ge(ke=>({...ke,[ye.agent]:P.id}))}P.kind==="error"&&(P.cause==="signin"||P.cause==="missing")&&De();const Be=K.current.get(A);P.kind==="end"&&P.status==="error"&&Be&&!n.draft.trim()&&!n.attach.comments.length&&!n.attach.refs.length&&(n.setDraft(Be.text),n.setAttach(()=>Be.attach),T(!0))},b.useEffect(()=>{Te.get("/api/chat/runs?ids=").then(A=>R(P=>P??A.boot)).catch(()=>{})},[]),b.useEffect(()=>{var P;if(!ae||pe)return;const A=Ry(ae,null);(P=A==null?void 0:A.msgs)!=null&&P.length&&(ie(A.msgs),ge(A.sessions??{})),ue((A==null?void 0:A.boot)??null),$e(!0)},[ae,pe]),b.useEffect(()=>{pe&&ae&&Dy(ae,{msgs:ee.slice(-100),sessions:ce,boot:dt??Y})},[pe,ae,ee,ce,dt,Y]),b.useEffect(()=>{if(!pe||!dt)return;const A=!!Y&&Y!==dt;ue(dt),ie(ye=>{if(!A||!ye.length)return ye;const ke=ye.map(ht=>ht.role==="ai"&&ht.status==="running"?{...ht,status:"cancelled"}:ht);return ke[ke.length-1].role==="restart"?ke:[...ke,{role:"restart",at:dt}]});const P=ee.filter(ye=>ye.role==="ai");for(const ye of P)ye.status==="running"&&!A&&!Pt.current.has(ye.id)&&Te.get(`/api/chat?id=${encodeURIComponent(ye.id)}`).then(ke=>{Pt.current.add(ye.id),ie(ht=>ht.map(qe=>qe.role==="ai"&&qe.id===ye.id?ke.events.reduce(Ud,{...qe,parts:[]}):qe)),ke.events.some(ht=>ht.kind==="end")||he(ye.id)});const Be=P.filter(ye=>ye.step).map(ye=>ye.id);Be.length&&Te.get(`/api/chat/runs?ids=${Be.join(",")}`).then(ye=>G(ke=>({...ke,...ye.runs}))).catch(()=>{})},[pe,dt]),b.useEffect(()=>{const A=on.current;A&&A.scrollHeight-A.scrollTop-A.clientHeight<160&&(A.scrollTop=A.scrollHeight)},[ee]);const Qe=xe?n.selection:null,Sn=Ne?n.boards:[],Wt=Sn.length===1||!Sn.length&&!!Qe,tt=o.length?o:Y0,wt=tt.find(A=>A.id===X),Ct=(wt==null?void 0:wt.label)??Gc[X]??X,Nt=X.startsWith("custom:"),ll=z[X]??"",sl=(wt==null?void 0:wt.status)==="signin"?d.chat.sendNeedsSignin(Ct):(wt==null?void 0:wt.status)==="missing"?d.chat.sendNeedsInstall(Ct):null,po=ee.find(A=>A.role==="ai"&&A.id===le),ei=!!(po!=null&&po.parts.some(A=>A.t==="perm"&&!A.decision)),ha=async(A=n.draft.trim(),P=n.attach,Be=!1)=>{if(!A)return{error:""};if(le)return{error:d.chat.running};if(sl)return{error:sl};Fe(null);const ye=[...Qe?[d.chat.chipElement(Qe.tag)]:[],...Sn.map(ke=>n.titleOf(ke)),...et&&n.visibleCount?[d.chat.chipVisible(n.visibleCount)]:[],...P.comments.map(ke=>d.chat.chipComment(ke.text.slice(0,16))),...P.refs.map(ke=>ke.name??ke.value),...je>1?[d.chat.variants(je)]:[]];try{const ke=await Te.post("/api/chat",{agent:X,text:A,model:Nt?void 0:ll.trim()||void 0,resume:ce[X],variants:Wt?je:0,attach:{selection:!!Qe,boards:Sn,visible:et,comments:P.comments.map(ht=>ht.id),refs:P.refs}});K.current.set(ke.id,{text:A,attach:P}),T(!1),ie(ht=>[...ht,{role:"user",text:A,chips:ye},{role:"ai",id:ke.id,agent:X,label:Ct,parts:[],status:"running",boot:dt??void 0}]),he(ke.id),Pt.current.add(ke.id);for(const ht of Xt.current.get(ke.id)??[])Dn.current(ke.id,ht);return Xt.current.delete(ke.id),Be||(n.setDraft(""),n.setAttach(()=>({comments:[],refs:[]}))),Ce(1),ke.variants.length&&n.onLocate(ke.variants),{id:ke.id}}catch(ke){return Fe(ke.message),{error:ke.message}}};n.handle&&(n.handle.current={send:A=>ha(A,{comments:[],refs:[]},!0),undo:A=>ma(A,"undo"),check:()=>De(),agent:X,label:Ct,model:ll,isCustom:Nt,setModel:A=>H(P=>({...P,[X]:A})),openAgentMenu:A=>{De(),x(A),j(!0)},running:le});const ol=()=>le&&Te.post("/api/chat/cancel",{id:le}).catch(()=>{}),ta=A=>{const P=K.current.get(A);n.draft.trim()||!P?ha():ha(P.text,P.attach)},Na=(A,P)=>ie(Be=>Be.map(ye=>ye.role==="ai"&&ye.id===A?P(ye):ye)),cn=(A,P,Be)=>{Na(A,ye=>Ud(ye,{kind:"permission-answered",id:P,decision:Be})),Te.post("/api/chat/permission/answer",{id:P,decision:Be}).catch(ye=>Fe(ye.message))},ma=async(A,P,Be)=>{var ye;Ve(A);try{await Te.post(`/api/chat/${P}-run`,{id:A,mode:Be}),be(null),Na(A,ke=>({...ke,undone:P==="undo"}))}catch(ke){const ht=ke;ht.status===409&&((ye=ht.body)!=null&&ye.conflicts)?be({id:A,kind:P,names:[...new Set(ht.body.conflicts.map(qe=>qe.file.endsWith(".html")?n.titleOf(qe.file):qe.file))]}):Fe(ht.message)}finally{Ve(null)}},Wl=async(A,P)=>{if(await n.confirm({title:d.chat.restoreTitle,body:d.chat.restoreBody(Hy(P)),ok:d.chat.restoreOk,danger:!0}))try{await Te.post("/api/chat/revert",{id:A.id}),Na(A.id,Be=>({...Be,restored:!0}))}catch(Be){Fe(Be.message)}},zs=A=>Ut({id:A.id,boards:[...A.boards??[]].sort((P,Be)=>_d[P.kind]-_d[Be.kind]).map(P=>({...P,title:n.titleOf(P.file),...n.sizeOf(P.file)??{w:390,h:844}}))}),es=async()=>{if(at)try{const A=await Te.post("/api/agents/custom",{name:at.name,command:at.command});r(P=>[...P.filter(Be=>Be.id!==A.agent.id),A.agent]),ne(A.agent.id),Ge(null)}catch(A){Ge(P=>P&&{...P,error:A.message})}},Va=async A=>{await Te.post("/api/agents/custom",{action:"delete",id:A}).catch(()=>{}),r(P=>P.filter(Be=>Be.id!==A)),X===A&&ne("claude")},$s=A=>A.status?d.chat.agentStatus[A.status]:f?d.chat.checking:"",en=(wt==null?void 0:wt.status)==="signin"?{text:d.chat.remedySignin(Ct,Oy[X]??`${X} login`),cmd:Oy[X]??`${X} login`}:(wt==null?void 0:wt.status)==="missing"?{text:d.chat.remedyMissing(Nt?(wt.command??"").split(/\s+/)[0]:X0[X]??X),cmd:Nt?null:K0[X]??X}:null,ts=async A=>{for(const P of Array.from(A)){if(P.size>15*1024*1024){Fe(d.chat.tooBig(P.name));continue}const Be=await new Promise(ye=>{const ke=new FileReader;ke.onload=()=>ye(String(ke.result).split(",")[1]??""),ke.readAsDataURL(P)});try{const ye=await Te.post("/api/refs",{name:P.name||d.defaults.pastedImage,data:Be});n.setAttach(ke=>({...ke,refs:[...ke.refs,ye]}))}catch(ye){Fe(ye.message)}}},jt=A=>{const P=[...A.boards??[]].sort((Et,it)=>_d[Et.kind]-_d[it.kind]),Be=P.filter(Et=>Et.kind!=="added").length,ye=P.filter(Et=>Et.kind==="added").length,ke=d.chat.runChanged(Be,ye),ht=!!dt&&!!A.boot&&A.boot!==dt,qe=Re[A.id],rn=(de==null?void 0:de.id)===A.id?de:null;if(A.restored)return s.jsx("div",{className:"run-result undone",children:s.jsx("div",{className:"oc-rr-top",children:s.jsxs("span",{className:"rr-line",children:[s.jsx(Q,{name:"restore",size:14})," ",d.chat.restoredCopy]})})});if(ht)return s.jsxs("div",{className:"run-result",children:[s.jsx("div",{className:"oc-rr-top",children:s.jsx("span",{className:"rr-line",children:ke})}),qe===void 0?null:qe.copy?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"btn-row",children:s.jsxs("button",{className:"btn",onClick:()=>void Wl(A,qe.copy.at),children:[s.jsx(Q,{name:"restore",size:14})," ",d.chat.restoreCopy]})}),s.jsx("p",{className:"sub",children:d.chat.savedAt(Hy(qe.copy.at))})]}):s.jsx("p",{className:"sub",children:d.chat.copyGone})]});const na=rn&&s.jsxs("div",{className:"rr-conflict",role:"alert",children:[s.jsx("p",{children:(rn.kind==="undo"?d.chat.conflictUndo:d.chat.conflictRedo)(rn.names.join(", "))}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn",onClick:()=>void ma(A.id,rn.kind,"rest"),children:rn.kind==="undo"?d.chat.undoRest:d.chat.redoRest}),s.jsx("button",{className:"btn danger",onClick:()=>void ma(A.id,rn.kind,"all"),children:rn.kind==="undo"?d.chat.undoAll:d.chat.redoAll}),s.jsx("button",{className:"btn",onClick:()=>be(null),children:d.chat.cancel})]})]});return A.undone?s.jsxs("div",{className:"run-result undone",children:[s.jsx("div",{className:"oc-rr-top",children:s.jsxs("span",{className:"rr-line",children:[s.jsx(Q,{name:"undo",size:14})," ",d.chat.runUndone(P.length)]})}),s.jsx("div",{className:"btn-row",children:s.jsxs("button",{className:"btn",disabled:_t===A.id||!!le,onClick:()=>void ma(A.id,"redo"),children:[s.jsx(Q,{name:"redo",size:14})," ",d.chat.redo]})}),na]}):s.jsxs("div",{className:"run-result",children:[s.jsxs("div",{className:"oc-rr-top",children:[s.jsx("span",{className:"rr-line",children:ke}),P.map(Et=>Et.kind==="removed"?s.jsxs("span",{className:"chip",children:[s.jsx(Q,{name:"board",size:12})," ",d.chat.chipRemoved(n.titleOf(Et.file))]},Et.file):s.jsxs("button",{className:"chip",title:Et.file,onClick:()=>n.onLocate([Et.file]),children:[s.jsx(Q,{name:"board",size:12})," ",Et.kind==="added"?d.chat.chipNew(n.titleOf(Et.file)):n.titleOf(Et.file)]},Et.file))]}),s.jsxs("div",{className:"btn-row",children:[s.jsxs("button",{className:"btn",disabled:_t===A.id||!!le,onClick:()=>void ma(A.id,"undo"),children:[s.jsx(Q,{name:"undo",size:14})," ",d.chat.undoRun]}),P.length>0&&s.jsxs("button",{className:"btn",onClick:()=>zs(A),children:[s.jsx(Q,{name:"compare",size:14})," ",d.chat.compare]})]}),na]})},Bi=(A,P)=>P.decision?s.jsxs("div",{className:"perm-done",title:P.subject,children:[s.jsx(Q,{name:P.decision==="deny"?"close":"check",size:14,className:P.decision==="deny"?"no":"ok"}),s.jsxs("span",{children:[d.chat.permDone[P.decision]," · ",P.tool," ",P.what==="tool"?null:s.jsx("code",{children:P.subject}),P.outside?` ${d.chat.permDoneOutside}`:""]})]}):s.jsxs("div",{className:"perm",role:"group","aria-label":d.chat.permAsk(A.label??Gc[A.agent]??A.agent,P.what,P.tool),children:[s.jsxs("div",{className:"perm-head",children:[s.jsx("span",{className:"idot","aria-hidden":"true"}),d.chat.permAsk(A.label??Gc[A.agent]??A.agent,P.what,P.tool)]}),s.jsx("div",{className:"perm-cmd",children:P.subject}),s.jsxs("div",{className:"perm-where",title:P.where,children:[s.jsx(Q,{name:"folder",size:14})," ",d.chat.permIn," ",s.jsx("code",{children:Q0(P.where)}),P.outside&&s.jsxs("span",{className:"perm-outside",children:["· ",d.chat.permOutside]})]}),s.jsxs("div",{className:`btn-row ${P.rule?"":"oc-one"}`,children:[s.jsx("button",{className:"btn primary",onClick:()=>cn(A.id,P.id,"once"),children:d.chat.allowOnce}),P.rule&&s.jsx("button",{className:"btn",title:d.chat.alwaysAllowTitle,onClick:()=>cn(A.id,P.id,"always"),children:d.chat.alwaysAllow(P.rule)}),s.jsx("button",{className:"btn",onClick:()=>cn(A.id,P.id,"deny"),children:d.chat.deny})]})]}),yu=ee.map(A=>A.role==="ai"?`${A.status}${A.undone?"u":""}${A.restored?"r":""}${A.parts.length}`:A.role).join(),Ht=b.useCallback(()=>{Il(Rn.current,".chat-head .new-chat, .rr-line, .chip, .bubble, .btn-row .btn, .oc-variants, .run-status > *"),Il(lt.current,".agent-status, .menu-foot .btn")},[]);b.useLayoutEffect(Ht,[Ht,yu,le,X,S,n.open,n.attach,n.selection,n.boards,n.visibleCount,_,Re,de,f,o,xe,Ne,et]),b.useEffect(()=>{const A=Rn.current;if(!A)return;const P=new ResizeObserver(Ht);return P.observe(A),()=>P.disconnect()},[Ht]);const za=(A,P)=>{const Be=[];let ye=[],ke=0;const ht=()=>{ye.length&&Be.push(s.jsx("div",{className:"oc-tools",children:ye},`t${ke}`)),ye=[]};return A.parts.forEach((qe,rn)=>{if(qe.t==="tool"||qe.t==="perm"&&qe.decision){ye.length||(ke=rn);const na=A.status==="running"&&rn===A.parts.length-1;ye.push(qe.t==="tool"?s.jsxs("div",{className:`ai-tool ${na?"is-current":""}`,children:[s.jsx(Q,{name:"edit",size:14}),s.jsx("span",{children:qe.name}),qe.detail&&s.jsx("code",{children:qe.detail})]},rn):s.jsx(b.Fragment,{children:Bi(A,qe)},rn));return}ht(),Be.push(qe.t==="text"?s.jsx(G0,{className:"ai-text",text:qe.text},rn):qe.t==="plain"?s.jsx("pre",{className:"ai-plain",children:qe.text},rn):qe.t==="perm"?s.jsx(b.Fragment,{children:Bi(A,qe)},rn):qe.cause?s.jsxs("div",{className:"ai-fail",children:[s.jsx("div",{className:"ai-error",children:s.jsx("span",{children:s.jsx(em,{text:qe.text})})}),P&&s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn",disabled:!!le||!!sl,title:sl??void 0,onClick:()=>ta(A.id),children:d.chat.retry}),(()=>{const na=tt.find(Et=>Et.id!==A.agent&&Et.status!=="missing"&&Et.ok&&!Et.custom);return na&&na.id!==X?s.jsx("button",{className:"btn",onClick:()=>ne(na.id),children:d.chat.switchTo(na.label)}):null})()]}),qe.raw&&s.jsxs("details",{className:"ai-details",children:[s.jsxs("summary",{children:[s.jsx(Q,{name:"chevronDown",size:14}),d.chat.details]}),s.jsx("div",{className:"ai-details-bar",children:s.jsx("button",{className:"btn copy",onClick:()=>an(`raw-${A.id}`,qe.raw),children:s.jsx(xb,{icon:s.jsx(Q,{name:"copy",size:12}),text:_===`raw-${A.id}`?d.chat.copied:d.chat.copy,alt:_===`raw-${A.id}`?d.chat.copy:d.chat.copied})})}),s.jsx("pre",{children:qe.raw})]}),qe.changed===!1&&s.jsx("p",{className:"muted small",children:d.chat.noFilesChanged})]},rn):s.jsxs("div",{className:"ai-error",children:[s.jsx(Q,{name:"warn",size:14})," ",qe.text]},rn))}),ht(),Be};return s.jsxs("section",{className:"chat","aria-label":d.chat.aria,ref:Rn,children:[s.jsxs("div",{className:`chat-head ${w?"is-scrolled":""}`,children:[!n.settingsElsewhere&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"chat-head-row oc-field",children:[s.jsx("span",{className:"pp-l",children:d.chat.agent}),s.jsx("div",{className:"agent-pick",ref:Vn,children:s.jsxs("button",{className:`agent-btn ${S?"is-open":""}`,"aria-haspopup":"menu","aria-expanded":S,"aria-label":d.chat.agentButton(Ct,wt?$s(wt):""),title:d.chat.agentHint,disabled:!!le,onClick:A=>pt(A.currentTarget),onKeyDown:A=>A.key==="Escape"&&j(!1),children:[s.jsx("span",{className:`dot ${(wt==null?void 0:wt.status)??""}`,"aria-hidden":"true"}),s.jsx("span",{className:"agent-name",children:Ct}),s.jsx(Q,{name:"chevronDown",size:14})]})})]}),s.jsxs("div",{className:"chat-head-row oc-field",children:[s.jsx("span",{className:"pp-l",children:Nt?d.chat.customCommandLabel:d.chat.model}),Nt?s.jsx("span",{className:"model-field mono custom-cmd",title:wt==null?void 0:wt.command,children:wt==null?void 0:wt.command}):s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"model-field",list:`models-${X}`,value:ll,placeholder:d.chat.modelDefault,"aria-label":d.chat.model,title:d.chat.modelTitle(Ct),disabled:!!le,spellCheck:!1,onChange:A=>H(P=>({...P,[X]:A.target.value}))}),s.jsx("datalist",{id:`models-${X}`,children:(Z0[X]??[]).map(A=>s.jsx("option",{value:A},A))})]})]})]}),s.jsxs("div",{className:"chat-head-row sub",children:[s.jsx("span",{className:"muted small",children:le?d.chat.running:ce[X]?d.chat.continuing:d.chat.newConversation}),s.jsx("div",{className:"spacer"}),s.jsxs("button",{className:"icon-btn sm new-chat","aria-label":d.chat.newChat,title:d.chat.newChat,disabled:!!le||!ee.length&&!ce[X],onClick:()=>{ie([]),ge({}),T(!1),be(null),M(!1)},children:[s.jsx(Q,{name:"plus",size:14})," ",s.jsx("span",{children:d.chat.newChat})]})]})]}),S&&E&&Ih.createPortal(s.jsxs("div",{ref:lt,className:"menu agent-menu oc-agent-menu entering",role:"menu","aria-label":d.chat.agent,style:{right:E.right,top:E.top},onKeyDown:ft,children:[tt.map(A=>s.jsxs("div",{className:`menu-item agent-item ${A.status==="missing"?"off":""}`,role:"none",children:[s.jsxs("button",{role:"menuitemradio","aria-checked":A.id===X,className:"agent-choose",title:A.custom&&A.command?d.chat.customCommandTitle(A.command):void 0,onClick:()=>{ne(A.id),j(!1)},children:[s.jsx("span",{className:`menu-check ${A.id===X?"on":""}`,"aria-hidden":"true",children:s.jsx(Q,{name:"check",size:14})}),s.jsx("span",{className:"idot",style:{background:F0(A.id)},"aria-hidden":"true"}),s.jsx("span",{className:"menu-label",children:A.label})]}),s.jsxs("span",{className:`agent-status ${A.status==="missing"?"off":A.status??""}`,children:[A.status&&A.status!=="missing"&&s.jsx("span",{className:`dot ${A.status}`,"aria-hidden":"true"}),$s(A),A.status==="missing"&&A.install&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("a",{className:"link",href:A.install,target:"_blank",rel:"noopener noreferrer",children:d.chat.howToInstall})]})]}),A.custom&&s.jsx("button",{className:"icon-btn sm oc-remove","aria-label":d.chat.remove(A.label),title:d.chat.remove(A.label),onClick:()=>void Va(A.id),children:s.jsx(Q,{name:"close",size:12})})]},A.id)),s.jsx("div",{className:"menu-sep",role:"separator"}),s.jsxs("button",{role:"menuitem",className:"menu-item oc-custom",onClick:()=>{j(!1),Ge({name:"",command:""})},children:[s.jsx("span",{className:"menu-check on muted","aria-hidden":"true",children:s.jsx(Q,{name:"plus",size:14})}),s.jsx("span",{className:"menu-label",children:d.chat.customCommand})]}),s.jsxs("div",{className:"menu-foot",children:[s.jsx("span",{children:f?d.chat.checking:g?d.chat.checkedAt(By(g.at),g.onOpen):d.chat.checkedOnOpen}),s.jsx("button",{className:"btn",disabled:f,onClick:()=>De(),children:d.chat.checkAgain})]})]}),document.body),at&&Ih.createPortal(s.jsx("div",{className:"dialog-backdrop",onPointerDown:A=>A.target===A.currentTarget&&Ge(null),children:s.jsxs("div",{className:"dialog cf",role:"dialog","aria-modal":"true","aria-label":d.chat.customTitle,onKeyDown:A=>A.key==="Escape"&&Ge(null),children:[s.jsxs("h2",{className:"cf-title",children:[s.jsx("span",{className:"idot","aria-hidden":"true"}),d.chat.customTitle]}),s.jsxs("label",{className:"dialog-field",children:[d.chat.customName,s.jsx("input",{autoFocus:!0,value:at.name,placeholder:d.chat.customNamePlaceholder,onChange:A=>Ge({...at,name:A.target.value,error:void 0})})]}),s.jsxs("label",{className:"dialog-field",children:[d.chat.customCommandLabel,s.jsx("input",{className:"mono",value:at.command,spellCheck:!1,placeholder:d.chat.customCommandPlaceholder,onChange:A=>Ge({...at,command:A.target.value,error:void 0}),onKeyDown:A=>A.key==="Enter"&&!A.nativeEvent.isComposing&&void es()})]}),s.jsx("p",{className:"cf-hint",children:s.jsx(em,{text:d.chat.customHint})}),at.error&&s.jsxs("p",{className:"cf-error",children:[s.jsx(Q,{name:"warn",size:14})," ",at.error]}),s.jsxs("div",{className:"dialog-actions",children:[s.jsx("button",{onClick:()=>Ge(null),children:d.chat.cancel}),s.jsx("button",{className:"primary",disabled:!at.name.trim()||!at.command.trim(),onClick:()=>void es(),children:d.chat.customSave})]})]})}),document.body),s.jsx("div",{className:"chat-list",ref:on,"aria-live":"polite",onScroll:A=>M(A.currentTarget.scrollTop>0),children:ee.length===0?s.jsxs("div",{className:"chat-empty",children:[s.jsx("p",{children:d.chat.intro(Ct)}),s.jsx("div",{className:"chat-suggest",children:d.chat.suggestions.map(A=>s.jsx("button",{className:"btn",onClick:()=>{n.setDraft(A.text),Ce(A.n)},children:A.label},A.label))})]}):ee.map((A,P)=>{var Be;return A.role==="restart"?s.jsx("div",{className:"restart",role:"separator",children:d.chat.restarted(By(A.at))},P):A.role==="user"?s.jsxs("div",{className:"msg user",children:[A.chips.length>0&&s.jsx("div",{className:"chips",children:A.chips.map((ye,ke)=>s.jsx("span",{className:"chip",children:ye},ke))}),s.jsx("div",{className:"bubble",children:A.text})]},P):s.jsxs("div",{className:`msg ai ${A.status}`,children:[s.jsxs("div",{className:"msg-head",children:[s.jsx("strong",{children:A.label??Gc[A.agent]??A.agent}),A.status==="running"&&(A.parts.some(ye=>ye.t==="perm"&&!ye.decision)?s.jsxs("span",{className:"waiting",children:[s.jsx("span",{className:"pulse","aria-hidden":"true"}),d.chat.waiting]}):s.jsx("span",{className:"spinner",role:"img","aria-label":d.chat.running})),A.status==="cancelled"&&s.jsx("span",{className:"muted",children:d.chat.cancelled}),A.status==="error"&&s.jsxs("span",{className:"oc-failed",children:[s.jsx(Q,{name:"warn",size:14}),d.chat.failed]}),A.status==="done"&&A.cost!=null&&s.jsxs("span",{className:"muted small",children:["$",A.cost.toFixed(3)]})]}),(Be=A.variants)!=null&&Be.length?s.jsxs("button",{className:"btn oc-variants",onClick:()=>n.onLocate(A.variants),children:[s.jsx(Q,{name:"board",size:14})," ",d.chat.madeVariants(A.variants.length)]}):null,za(A,P===ee.length-1),A.status==="running"&&!A.parts.length&&s.jsx("div",{className:"muted oc-thinking",children:d.chat.thinking}),d.chat.noPause[A.agent]&&A.parts.some(ye=>ye.t==="tool")&&s.jsx("p",{className:"ai-note",children:d.chat.noPause[A.agent]}),A.status!=="running"&&A.step&&jt(A)]},P)})}),en&&s.jsxs("div",{className:"remedy",role:"status",children:[s.jsx(Q,{name:"warn",size:16}),s.jsxs("div",{children:[s.jsx("p",{children:s.jsx(em,{text:en.text})}),s.jsxs("div",{className:"btn-row",children:[en.cmd&&s.jsxs("button",{className:"btn",onClick:()=>an("cmd",en.cmd),title:en.cmd,children:[s.jsx(Q,{name:"copy",size:14})," ",_==="cmd"?d.chat.copied:d.chat.copyCommand]}),s.jsx("button",{className:"btn",disabled:f,onClick:()=>De(),children:f?d.chat.checking:d.chat.checkAgain})]})]})]}),s.jsxs("div",{className:"composer",onDragOver:A=>A.preventDefault(),onDrop:A=>{A.preventDefault(),A.dataTransfer.files.length&&ts(A.dataTransfer.files)},children:[ei&&s.jsxs("div",{className:"run-status",role:"status",children:[s.jsxs("span",{className:"waiting",children:[s.jsx("span",{className:"pulse","aria-hidden":"true"}),d.chat.waiting]}),s.jsxs("span",{className:"muted",children:["· ",d.chat.waitingHint]})]}),s.jsxs("div",{className:"chips",children:[n.selection&&s.jsx(su,{on:xe,onToggle:()=>Ze(A=>!A),icon:"select",label:d.chat.chipElementText(n.selection.tag,n.selection.text.slice(0,14))}),n.boards.length>0&&s.jsx(su,{on:Ne,onToggle:()=>xt(A=>!A),icon:"board",label:n.boards.length===1?n.titleOf(n.boards[0]):d.chat.chipBoards(n.boards.length)}),n.visibleCount>0&&s.jsx(su,{on:et,onToggle:()=>me(A=>!A),icon:"fit",label:d.chat.chipVisible(n.visibleCount)}),n.attach.comments.map(A=>s.jsx(su,{on:!0,icon:"comment",label:d.chat.chipComment(A.text.slice(0,14)),onRemove:()=>n.setAttach(P=>({...P,comments:P.comments.filter(Be=>Be.id!==A.id)}))},A.id)),n.attach.refs.map((A,P)=>s.jsx(su,{on:!0,icon:A.kind==="url"?"link":"file",label:A.name??A.value,onRemove:()=>n.setAttach(Be=>({...Be,refs:Be.refs.filter((ye,ke)=>ke!==P)}))},P))]}),Ue!=null&&s.jsx("div",{className:"url-row",children:s.jsx("input",{autoFocus:!0,value:Ue,placeholder:"https://","aria-label":d.chat.refLink,onChange:A=>fe(A.target.value),onKeyDown:A=>{A.nativeEvent.isComposing||(A.key==="Enter"&&/^https?:\/\/\S+$/.test(Ue.trim())&&(n.setAttach(P=>({...P,refs:[...P.refs,{kind:"url",value:Ue.trim()}]})),fe(null)),A.key==="Escape"&&fe(null))}})}),W&&n.draft.trim()&&s.jsx("span",{className:"restored muted small",children:d.chat.restored}),s.jsx("textarea",{ref:n.inputRef,value:n.draft,rows:3,placeholder:le?d.chat.placeholderRunning:d.chat.placeholder,"aria-label":d.chat.input,onChange:A=>n.setDraft(A.target.value),onPaste:A=>{const P=Array.from(A.clipboardData.files);P.length&&(A.preventDefault(),ts(P))},onKeyDown:A=>{A.nativeEvent.isComposing||A.keyCode===229||(A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),ha()),A.key==="Escape"&&(le?ol():A.target.blur()))}}),re&&s.jsxs("p",{className:"warn small oc-err",children:[s.jsx(Q,{name:"warn",size:14})," ",re]}),sl&&!le&&s.jsxs("p",{className:"send-why",children:[s.jsx(Q,{name:"warn",size:14})," ",sl]}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("button",{className:"icon-btn sm","aria-label":d.chat.attach,title:d.chat.attachTitle,onClick:()=>{var A;return(A=It.current)==null?void 0:A.click()},children:s.jsx(Q,{name:"plus",size:14})}),s.jsx("button",{className:"icon-btn sm","aria-label":d.chat.addLink,title:d.chat.addLink,onClick:()=>fe(""),children:s.jsx(Q,{name:"link",size:14})}),s.jsx("input",{ref:It,type:"file",multiple:!0,hidden:!0,accept:"image/*,.pdf,.md,.txt,.html,.csv,.json",onChange:A=>A.target.files&&void ts(A.target.files)}),s.jsx("label",{className:"variants",title:Wt?d.chat.variantsTitle:d.chat.variantsDisabledTitle,children:s.jsxs("select",{value:je,disabled:!Wt||!!le,onChange:A=>Ce(Number(A.target.value)),"aria-label":d.chat.variantsAria,children:[s.jsx("option",{value:1,children:d.chat.variants(1)}),s.jsx("option",{value:2,children:d.chat.variants(2)}),s.jsx("option",{value:3,children:d.chat.variants(3)}),s.jsx("option",{value:4,children:d.chat.variants(4)})]})}),s.jsx("div",{className:"spacer"}),le?s.jsxs("button",{className:"btn oc-cancel",title:d.chat.cancelTitle,onClick:ol,children:[s.jsx(Q,{name:"close",size:14})," ",d.chat.cancel]}):s.jsx("button",{className:"primary",disabled:!n.draft.trim()||!!sl,title:sl??void 0,onClick:()=>void ha(),children:d.chat.send})]})]}),Qt&&Ih.createPortal(s.jsx(yb,{before:E0(Qt.id),boards:Qt.boards,onClose:()=>Ut(null)}),document.body)]})}function su({on:n,onToggle:o,onRemove:r,icon:f,label:m}){return s.jsxs("span",{className:`chip ${n?"on":"off"}`,children:[s.jsxs("button",{className:"chip-main",onClick:o,disabled:!o,"aria-pressed":o?n:void 0,title:o?n?d.chat.chipRemoveTitle:d.chat.chipAddTitle:void 0,children:[s.jsx(Q,{name:f,size:12}),s.jsx("span",{children:m})]}),r&&s.jsx("button",{className:"chip-x","aria-label":d.chat.remove(m),onClick:r,children:s.jsx(Q,{name:"close",size:12})})]})}function J0(n,o,r,f=8){const m=typeof f=="number"?{above:f,below:f}:f;let g=!1,v=n.y-m.above-o.h;if(v<r.top){const j=n.y+n.h+m.below;j+o.h<=r.bottom?(v=j,g=!0):v=r.top}v=Math.max(r.top,Math.min(v,r.bottom-o.h));let S=n.x+n.w/2-o.w/2;return S=Math.max(r.left,Math.min(S,r.right-o.w)),{x:Math.round(S),y:Math.round(v),below:g}}function af(n,o,r,f,m=8){const g=b.useRef({target:r,bounds:f,gap:m});g.current={target:r,bounds:f,gap:m};const v=()=>{const S=n.current;if(!S)return;const j=g.current.target();if(!j){S.style.visibility="hidden";return}const E=J0(j,{w:S.offsetWidth,h:S.offsetHeight},g.current.bounds,g.current.gap);S.style.left=`${E.x}px`,S.style.top=`${E.y}px`,S.style.visibility="",S.dataset.below=E.below?"true":"false"};return b.useLayoutEffect(v),b.useEffect(()=>o.subscribe(v),[o]),v}const Kd={above:28,below:12},da=d.inline;function I0(n){const o=b.useRef(null),r=b.useRef(null),[f,m]=b.useState(n.initial??""),[g,v]=b.useState(!1),[S,j]=b.useState(null),E=Math.min(380,n.bounds.right-n.bounds.left),x=af(o,n.store,n.target,n.bounds,n.gap??8);b.useEffect(()=>{var M;return(M=r.current)==null?void 0:M.focus()},[]),b.useEffect(()=>{const M=r.current;M&&(M.style.height="auto",M.style.height=`${Math.min(M.scrollHeight,132)}px`,x())},[f]),b.useEffect(()=>{const M=z=>{var H,W;(H=o.current)!=null&&H.contains(z.target)||(W=r.current)!=null&&W.value.trim()||n.onClose()};return window.addEventListener("pointerdown",M,!0),()=>window.removeEventListener("pointerdown",M,!0)},[]);const w=async()=>{const M=f.trim();if(!M||g)return;v(!0),j(null);const z=await n.onSend(M);v(!1),z!=null&&j(z||null)};return s.jsxs("div",{ref:o,className:"oc-ask oc-anchored",role:"dialog","aria-label":da.title,style:{width:E},onPointerDown:M=>M.stopPropagation(),children:[s.jsxs("div",{className:"oc-ask-top",children:[s.jsx("span",{className:"oc-ask-about",title:n.about,children:n.about}),n.onHistory&&s.jsx("button",{className:"link oc-ask-history",onClick:n.onHistory,children:da.history})]}),s.jsxs("div",{className:"oc-ask-row",children:[s.jsx("textarea",{ref:r,rows:1,value:f,placeholder:da.placeholder,"aria-label":da.title,onChange:M=>m(M.target.value),onKeyDown:M=>{M.stopPropagation(),!(M.nativeEvent.isComposing||M.keyCode===229)&&(M.key==="Enter"&&!M.shiftKey?(M.preventDefault(),w()):M.key==="Escape"&&(M.preventDefault(),n.onClose()))}}),s.jsx("button",{className:`oc-ask-send ${f.trim()?"is-ready":""}`,disabled:!f.trim()||g,onClick:()=>void w(),children:n.sendLabel??da.send})]}),S&&s.jsxs("p",{className:"oc-ask-err",children:[s.jsx(Q,{name:"warn",size:14})," ",S]})]})}function W0(n){const o=b.useRef(null);return af(o,n.store,n.target,n.bounds,n.gap??8),s.jsx("div",{ref:o,className:"oc-result oc-anchored is-running",role:"status","aria-label":da.running,onPointerDown:r=>r.stopPropagation(),children:s.jsxs("div",{className:"oc-result-head",children:[s.jsx("span",{className:"spinner","aria-hidden":"true"}),s.jsx("p",{className:"oc-result-text",children:da.running}),s.jsx("button",{className:"link oc-result-open",onClick:n.onOpen,children:da.open})]})})}function e1(n){const o=b.useRef(null),[r,f]=b.useState(!1);af(o,n.store,n.target,n.bounds,n.gap??8),b.useEffect(()=>{const g=v=>{var S;return!((S=o.current)!=null&&S.contains(v.target))&&n.onClose()};return window.addEventListener("pointerdown",g,!0),()=>window.removeEventListener("pointerdown",g,!0)},[]);const m=n.reply||(n.status==="done"?da.done:n.status==="cancelled"?da.cancelled:da.failed);return s.jsxs("div",{ref:o,className:`oc-result oc-anchored is-${n.status}`,role:"status","aria-label":da.result,onPointerDown:g=>g.stopPropagation(),children:[s.jsxs("div",{className:"oc-result-head",children:[s.jsx("span",{className:`dot ${n.status==="done"?"ok":"bad"}`,"aria-hidden":"true"}),s.jsx("p",{className:"oc-result-text",children:m}),s.jsx("button",{className:"icon-btn sm","aria-label":da.close,title:da.close,onClick:n.onClose,children:s.jsx(Q,{name:"close",size:14})})]}),s.jsxs("div",{className:"oc-result-acts",children:[n.onUndo&&n.status==="done"&&s.jsx("button",{className:"btn",disabled:r,onClick:()=>void n.onUndo().then(()=>{f(!0)}),children:r?da.undone:da.undo}),s.jsx("button",{className:"btn",onClick:n.onOpen,children:da.open})]})]})}const lf=n=>(n==null?void 0:n.querySelector("script[data-dc-probe]"))??null;function Em(n,o){const r=n!=null&&n.isConnected?n.contentDocument:null;if(!r||r.readyState!=="complete"||!r.body)return null;try{if(decodeURIComponent(r.location.pathname)!==`/screens/${o}`)return null}catch{return null}return r}function Nb(n,o){const r=lf(Em(n,o));return!r||r.hasAttribute("data-dc-dirty")?null:r.getAttribute("data-dc-src")}const Ly=(n,o)=>{var r;return!!((r=lf(Em(n,o)))!=null&&r.hasAttribute("data-dc-patched"))},t1=n=>{var o;return(o=lf(n))==null?void 0:o.setAttribute("data-dc-dirty","")};function n1(n,o,r){var v;if(!((v=r.live)!=null&&v.length)||!r.base||!r.hash||r.forked)return!1;const f=Em(n,o);if(!f||Nb(n,o)!==r.base)return!1;const m=r.live.map(S=>An(f,S.path));if(m.some((S,j)=>!S||S===f.body||S.localName!==r.live[j].tag||S.namespaceURI!=="http://www.w3.org/1999/xhtml"))return!1;r.live.forEach((S,j)=>{const E=m[j];for(const[x,w]of S.attrs??[])w==null?E.removeAttribute(x):E.setAttribute(x,w);S.inner!=null&&(E.innerHTML=S.inner)});const g=lf(f);return g.setAttribute("data-dc-src",r.hash),g.setAttribute("data-dc-patched",""),n.dispatchEvent(new CustomEvent("dc-patched")),!0}function a1(){const n=new Map,o=new Map,r=new Map;return{begin(f){n.set(f,(n.get(f)??0)+1)},end(f){const m=(n.get(f)??1)-1;if(m>0)return n.set(f,m),[];n.delete(f);const g=o.get(f)??[];return o.delete(f),g},patched(f,m,g){const v=r.get(f)??new Set;v.add(m).add(g),r.set(f,v)},reset(f){r.delete(f)},decide(f,m,g,v=!1){var S;return n.get(f)?(o.set(f,[...o.get(f)??[],m]),"queue"):m?v?m===g.shown?"keep":"reload":!g.patched||!g.shown?"reload":m===g.shown?"keep":(S=r.get(f))!=null&&S.has(m)?"check":"reload":"reload"}}}function l1(n){const[o,r]=b.useState(null);return b.useEffect(()=>{Te.get("/api/tokens").then(r).catch(()=>{})},[n]),o}const Sb=n=>Object.entries((n==null?void 0:n.themes[n.active])??{}).map(([o,r])=>({name:o,value:r}));function Wd(n){const o=n.trim().toLowerCase();let r=o.match(/^#([0-9a-f]{3,8})$/);if(r){let f=r[1];return f.length<=4&&(f=[...f].map(m=>m+m).join("")),[parseInt(f.slice(0,2),16),parseInt(f.slice(2,4),16),parseInt(f.slice(4,6),16),f.length===8?parseInt(f.slice(6),16)/255:1]}return r=o.match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+))?\s*\)$/),r?[Number(r[1]),Number(r[2]),Number(r[3]),r[4]==null?1:Number(r[4])]:o==="transparent"?[0,0,0,0]:null}const _y=([n,o,r])=>{const f=m=>{const g=m/255;return g<=.03928?g/12.92:((g+.055)/1.055)**2.4};return .2126*f(n)+.7152*f(o)+.0722*f(r)};function Zd(n,o){const r=Wd(n),f=Wd(o);if(!r||!f)return null;const[m,g]=[_y(r),_y(f)].sort((v,S)=>S-v);return(m+.05)/(g+.05)}const pm=n=>{const o=Wd(n);return o&&o[3]===1?"#"+o.slice(0,3).map(r=>Math.round(r).toString(16).padStart(2,"0")).join("").toUpperCase():null};function Uy(n,o,r){if(!(r!=null&&r.registered)||!o)return null;const f=new Set(Sb(r).map(g=>pm(g.value)));if(/^(color|background|background-color|border-color)$/.test(n)){const g=pm(o);if(g&&!f.has(g))return d.checks.colorNotInTokens}const m=[...o.matchAll(/(-?\d+(?:\.\d+)?)px/g)].map(g=>Number(g[1]));return n==="font-size"&&m.some(g=>!r.fontSizes.includes(g))?d.checks.tokenFontSizes(r.fontSizes.join("·")):n==="border-radius"&&m.some(g=>!r.radii.includes(g)&&g<999)?d.checks.tokenRadii(r.radii.join("·")):/^(gap|padding|margin)/.test(n)&&m.some(g=>g%4!==0)?d.checks.notMultipleOf4:n==="font-weight"&&/^\d+$/.test(o)&&!r.fontWeights.includes(Number(o))?d.checks.tokenWeights(r.fontWeights.join("·")):null}function s1(n,o=48){var E,x;const r=n.defaultView,f=[],m=w=>{for(let M=w;M&&M.nodeType===1;M=M.parentElement){const z=r.getComputedStyle(M),H=Wd(z.backgroundColor);if(z.backgroundImage!=="none")return"";if(H&&H[3]>.5)return z.backgroundColor}return"rgb(255,255,255)"},g=w=>{const M=w.getBoundingClientRect(),z=r.getComputedStyle(w);return M.width>0&&M.height>0&&z.visibility!=="hidden"&&z.display!=="none"},v=n.body.querySelectorAll("a[href], button, input:not([type=hidden]), select, textarea, [role=button], [role=tab], [onclick]");for(const w of Array.from(v)){if(!g(w))continue;const M=nl(w);if(M==null)continue;const z=w.getBoundingClientRect();z.width<o&&z.height<o&&f.push({path:M,kind:"target",message:d.checks.smallTarget(w.tagName.toLowerCase(),Math.round(z.width),Math.round(z.height),o)});const H=(w.getAttribute("aria-label")||w.getAttribute("title")||w.getAttribute("placeholder")||w.innerText||((E=w.querySelector("img[alt]"))==null?void 0:E.getAttribute("alt"))||"").trim(),W=w.getAttribute("aria-labelledby")||w.id&&n.querySelector(`label[for="${w.id}"]`)||w.closest("label");!H&&!W&&f.push({path:M,kind:"label",message:d.checks.noName(w.tagName.toLowerCase())})}for(const w of Array.from(n.body.querySelectorAll("img")))if(!w.hasAttribute("alt")&&g(w)){const M=nl(w);M!=null&&f.push({path:M,kind:"label",message:d.checks.noAlt})}const S=n.createTreeWalker(n.body,NodeFilter.SHOW_TEXT),j=new Set;for(let w=S.nextNode();w;w=S.nextNode()){const M=w.parentElement;if(!M||j.has(M)||!((x=w.textContent)!=null&&x.trim())||/^(SCRIPT|STYLE)$/.test(M.tagName)||!g(M))continue;j.add(M);const z=r.getComputedStyle(M),H=m(M);if(!H)continue;const W=Zd(z.color,H);if(W==null)continue;const T=parseFloat(z.fontSize),I=T>=24||T>=18.66&&Number(z.fontWeight)>=700?3:4.5;if(W<I){const X=nl(M);X!=null&&f.push({path:X,kind:"contrast",message:d.checks.lowContrast(W.toFixed(2),I,w.textContent.trim().slice(0,16))})}}return f}function o1({tokens:n,onSave:o}){const[r,f]=b.useState(n);b.useEffect(()=>f(n),[n]);const m=r.themes[r.active]??{},g=JSON.stringify(r)!==JSON.stringify(n)||!n.registered,v=j=>f({...r,themes:{...r.themes,[r.active]:j}}),S=(j,E)=>s.jsxs("label",{className:"field-row tok-list",children:[s.jsx("span",{children:E}),s.jsx("input",{defaultValue:r[j].join(", "),"aria-label":E,onBlur:x=>f({...r,[j]:x.target.value.split(/[,\s]+/).map(Number).filter(w=>Number.isFinite(w))})},r[j].join())]});return s.jsxs("div",{className:"tokens",children:[s.jsxs("label",{className:"upload small",children:[s.jsx(Q,{name:"plus",size:14})," ",d.tokens.import,s.jsx("input",{type:"file",hidden:!0,accept:".json,application/json",onChange:async j=>{var x;const E=(x=j.target.files)==null?void 0:x[0];if(E)try{f(i1(JSON.parse(await E.text()),r))}catch(w){alert(d.tokens.importFailed(w.message))}}})]}),s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:d.tokens.theme}),s.jsx("button",{className:"icon-btn sm","aria-label":d.tokens.addTheme,title:d.tokens.addTheme,onClick:()=>{let j=d.tokens.newTheme;for(let E=2;r.themes[j];E++)j=d.tokens.newThemeN(E);f({...r,themes:{...r.themes,[j]:{...m}},active:j})},children:s.jsx(Q,{name:"plus",size:14})})]}),s.jsxs("div",{className:"theme-row",children:[s.jsx("select",{value:r.active,onChange:j=>f({...r,active:j.target.value}),"aria-label":d.tokens.activeTheme,children:Object.keys(r.themes).map(j=>s.jsx("option",{children:j},j))}),s.jsx("input",{defaultValue:r.active,"aria-label":d.tokens.themeName,onBlur:j=>{const E=j.target.value.trim();if(!E||E===r.active||r.themes[E])return;const{[r.active]:x,...w}=r.themes;f({...r,themes:{...w,[E]:x},active:E})}},r.active)]}),s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:d.tokens.colors(Object.keys(m).length)}),s.jsx("button",{className:"icon-btn sm","aria-label":d.tokens.addColor,title:d.tokens.addColor,onClick:()=>v({...m,[d.tokens.colorN(Object.keys(m).length+1)]:"#111111"}),children:s.jsx(Q,{name:"plus",size:14})})]}),s.jsx("ul",{className:"tok-colors",children:Object.entries(m).map(([j,E])=>{var x;return s.jsxs("li",{children:[s.jsx("input",{type:"color",value:((x=pm(E))==null?void 0:x.toLowerCase())??"#000000","aria-label":d.tokens.colorOf(j),onChange:w=>v({...m,[j]:w.target.value.toUpperCase()})}),s.jsx("input",{defaultValue:j,"aria-label":d.tokens.colorName,onBlur:w=>{const M=w.target.value.trim();!M||M===j||m[M]||v(Object.fromEntries(Object.entries(m).map(([z,H])=>z===j?[M,H]:[z,H])))}}),s.jsx("code",{children:E}),s.jsx("button",{className:"icon-btn sm danger","aria-label":d.tokens.remove(j),onClick:()=>v(Object.fromEntries(Object.entries(m).filter(([w])=>w!==j))),children:s.jsx(Q,{name:"close",size:12})})]},j)})}),S("fontSizes",d.tokens.fontSizes),S("fontWeights",d.tokens.fontWeights),S("radii",d.tokens.radii),S("spacing",d.tokens.spacing),s.jsxs("label",{className:"field-row tok-list",children:[s.jsx("span",{children:d.tokens.touchTarget}),s.jsx("input",{type:"number",value:r.minTarget,onChange:j=>f({...r,minTarget:Number(j.target.value)||48}),"aria-label":d.tokens.minTouchTarget})]}),s.jsx("button",{disabled:!g,title:d.tokens.saveTitle,onClick:()=>o(r,n.registered?d.history.saveTokens:d.history.registerTokens),children:n.registered?d.tokens.save:d.tokens.register}),s.jsx("p",{className:"muted small",children:n.registered?d.tokens.registeredHint:d.tokens.defaultHint})]})}function i1(n,o){const r=n;if(r&&typeof r=="object"&&r.themes&&typeof r.themes=="object")return{...o,...r,active:r.active??Object.keys(r.themes)[0]};const f={},m=(g,v)=>{if(typeof g=="string"&&/^#|^rgb/i.test(g))f[v]=g.toUpperCase();else if(g&&typeof g=="object"){const S=g.value??g.$value;if(typeof S=="string")m(S,v);else for(const[j,E]of Object.entries(g))m(E,v?`${v} ${j}`:j)}};if(m(n,""),!Object.keys(f).length)throw new Error(d.tokens.noColors);return{...o,themes:{...o.themes,[d.tokens.importedTheme]:f},active:d.tokens.importedTheme}}function qy({title:n,items:o,empty:r,onPick:f,onAskAI:m}){return s.jsxs("section",{className:"board-opts","aria-label":n,children:[s.jsxs("div",{className:"sec-head",children:[s.jsxs("span",{children:[n," ",o?o.length:""]}),m&&o&&o.length>0&&s.jsx("button",{className:"link",onClick:m,children:d.checks.askFix})]}),o==null?s.jsx("p",{className:"muted small",children:d.checks.notVisible}):o.length===0?s.jsxs("p",{className:"ok-line",children:[s.jsx(Q,{name:"check",size:14})," ",r]}):s.jsxs("ul",{className:"check-list",children:[o.slice(0,30).map((g,v)=>s.jsx("li",{children:s.jsxs("button",{className:"check-item",disabled:!g.path,onClick:()=>g.path&&f(g.path),title:g.path?d.checks.pickInEdit(g.path):d.checks.line(g.line),children:[s.jsx(Q,{name:"warn",size:12}),s.jsx("span",{children:g.message}),s.jsx("code",{children:g.path??d.checks.line(g.line)})]})},v)),o.length>30&&s.jsx("li",{className:"muted small",children:d.checks.more(o.length-30)})]})]})}function c1({onSetUp:n}){const o=b.useRef(null);return b.useLayoutEffect(()=>Il(o.current,".btn"),[]),s.jsxs("div",{ref:o,className:"oc-tc-off",role:"note","aria-label":d.checks.tokensOffTitle,children:[s.jsx(Q,{name:"info",size:16}),s.jsxs("div",{children:[s.jsx("strong",{children:d.checks.tokensOffTitle}),s.jsx("p",{children:d.checks.tokensOffBody})]}),s.jsx("button",{className:"btn",onClick:n,children:d.checks.setUpTokens})]})}function mu(n){const o=n==null?void 0:n.getElementById("board-tweaks");if(!o)return null;try{return JSON.parse(o.textContent??"")}catch{return null}}function Vy(n,o,r){t1(n);const f=r.type==="boolean"?r.value?"1":"0":String(r.value)+(r.type==="number"&&r.unit?r.unit:"");r.var&&n.documentElement.style.setProperty(r.var,f),n.documentElement.setAttribute(`data-tweak-${o}`,r.type==="boolean"?r.value?"on":"off":String(r.value))}function r1({doc:n,onSave:o}){const[r,f]=b.useState(()=>mu(n)),[m,g]=b.useState(()=>JSON.stringify(mu(n)));if(b.useEffect(()=>{const j=mu(n);f(j),g(JSON.stringify(j))},[n]),!r)return null;const v=(j,E)=>{const x={...r,[j]:{...r[j],value:E}};f(x),n&&Vy(n,j,x[j])},S=JSON.stringify(r)!==m;return s.jsxs("section",{className:"tweaks","aria-label":d.tabs.tweaks,children:[Object.entries(r).map(([j,E])=>{const x=E.label??j;return s.jsxs("div",{className:"pp-row tw-row",children:[s.jsx("span",{className:"pp-l",title:E.var??j,children:x}),s.jsx("span",{className:"pp-v",children:E.type==="boolean"?s.jsx("button",{type:"button",role:"switch","aria-checked":!!E.value,"aria-label":x,className:`switch ${E.value?"on":""}`,onClick:()=>v(j,!E.value)}):E.type==="color"?s.jsxs("span",{className:"tw-color",children:[s.jsx("label",{className:"sw-btn",style:{background:String(E.value)},children:s.jsx("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(String(E.value))?String(E.value):"#000000",onChange:w=>v(j,w.target.value.toUpperCase()),"aria-label":x})}),s.jsx("input",{className:"tw-hex",value:String(E.value),"aria-label":`${x} (hex)`,spellCheck:!1,onChange:w=>v(j,w.target.value)})]}):E.type==="enum"?s.jsx("select",{value:String(E.value),onChange:w=>v(j,w.target.value),"aria-label":x,children:(E.options??[]).map(w=>s.jsx("option",{children:w},w))}):E.type==="number"?s.jsxs("span",{className:"num tw-num",children:[s.jsx("input",{type:"number",min:E.min,max:E.max,step:E.step??1,value:Number(E.value),onChange:w=>w.target.value!==""&&v(j,Number(w.target.value)),"aria-label":x}),E.unit&&s.jsx("span",{children:E.unit})]}):s.jsx("input",{value:String(E.value),onChange:w=>v(j,w.target.value),"aria-label":x})})]},j)}),S&&s.jsxs("div",{className:"tw-foot",children:[s.jsx("button",{className:"btn",onClick:()=>{const j=JSON.parse(m);if(f(j),n)for(const[E,x]of Object.entries(j))Vy(n,E,x)},children:d.tweaks.revert}),s.jsx("button",{className:"btn primary",onClick:()=>void o(Object.fromEntries(Object.entries(r).map(([j,E])=>[j,E.value]))).then(()=>g(JSON.stringify(r))),children:d.tweaks.save})]})]})}const Ot=d.select,Ms=d.design,kb=n=>n!=null&&n.registered?Sb(n):[];function u1(n){const o={};if(!(n!=null&&n.documentElement))return o;const r=f=>{for(let m=0;m<f.length;m++)f[m].startsWith("--")&&(o[f[m]]=f.getPropertyValue(f[m]).trim())};for(const f of Array.from(n.styleSheets)){let m=null;try{m=f.cssRules}catch{continue}for(const g of Array.from(m??[])){const v=g;v.selectorText&&v.style&&/(^|,)\s*(:root|html|body)\s*(,|$)/.test(v.selectorText)&&r(v.style)}}return r(n.documentElement.style),o}function Tb(n,o){const r=Jx(n.kind,n.styles["background-color"]);if(r==="color")return{prop:r,css:"color",value:o.color||n.styles.color||""};const f=o.background!=null?"background":"background-color";return{prop:r,css:f,value:o.background||o["background-color"]||n.styles["background-color"]||""}}function ym(n){const o=pu(n.value,n.colors),r=fa(n.value)??(o?fa(o.value):null)??"",[f,m]=b.useState(r);b.useEffect(()=>m(r),[r]);const g=b.useRef(null);b.useEffect(()=>{var S,j;n.autoFocus&&((j=(S=g.current)==null?void 0:S.querySelector("button, input"))==null||j.focus())},[]);const v=()=>{const S=fa(f.startsWith("#")?f:`#${f}`);S&&S!==r?n.onPick(S):m(r)};return s.jsxs("div",{className:"fill-picker",ref:g,children:[s.jsxs("div",{className:"pop-top",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{className:"muted",children:o?Ot.tokenNow(o.name):r||Ms.none})]}),n.colors.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"pop-h",children:Ot.tokens}),s.jsx("div",{className:"tok-row",role:"group","aria-label":Ot.tokens,children:n.colors.map(S=>s.jsxs("button",{className:`tok ${(o==null?void 0:o.name)===S.name?"on":""}`,"aria-pressed":(o==null?void 0:o.name)===S.name,title:`${S.name} ${fa(S.value)??S.value}`,onClick:()=>n.onPick(Px(S,n.vars)),children:[s.jsx("i",{style:{background:S.value}}),s.jsx("span",{children:S.name})]},S.name))}),s.jsx("div",{className:"pop-sep"})]}),s.jsx("div",{className:"custom-row",children:s.jsx("span",{children:Ot.custom})}),s.jsxs("div",{className:"hex",children:[s.jsx("input",{type:"color",className:"sw","aria-label":Ot.picker,value:(fa(f)??(r||"#000000")).toLowerCase(),onChange:S=>m(S.target.value.toUpperCase()),onBlur:v}),s.jsx("input",{className:"num","aria-label":Ot.hex,value:f,spellCheck:!1,onChange:S=>m(S.target.value),onBlur:v,onKeyDown:S=>{S.nativeEvent.isComposing||S.key==="Enter"&&v()}})]})]})}function qd(n){const[o,r]=b.useState(n.value);b.useEffect(()=>r(n.value),[n.value]);const f=()=>o.trim()!==n.value.trim()&&n.onCommit(o.trim());return s.jsxs("div",{className:"pop-field",children:[s.jsx("span",{className:"pop-h",title:n.css,children:n.label}),n.chips&&n.chips.length>0&&s.jsx("span",{className:"chips-row",children:n.chips.map(m=>s.jsx("button",{className:`tchip ${qa(n.value||n.placeholder)===String(m)?"on":""}`,onClick:()=>n.onCommit(String(m)),children:m},m))}),s.jsxs("span",{className:"stepper",children:[s.jsx("button",{className:"icon-btn sm","aria-label":Ot.decrease(n.label),onClick:()=>n.onStep(-1),children:s.jsx(Q,{name:"minus",size:14})}),s.jsx("input",{"aria-label":n.label,title:n.css,value:o,placeholder:n.placeholder,onChange:m=>r(m.target.value),onBlur:f,onKeyDown:m=>{m.nativeEvent.isComposing||m.key==="Enter"&&f()}}),s.jsx("button",{className:"icon-btn sm","aria-label":Ot.increase(n.label),onClick:()=>n.onStep(1),children:s.jsx(Q,{name:"plus",size:14})})]})]})}const Vd=n=>/^-?\d+(?:\.\d+)?$/.test(n)?`${Number(n)}px`:n;function d1(n){var R,Y,ue,pe,$e,Re;const o=n.selection,r=b.useRef(null),f=b.useRef(null),[m,g]=b.useState({w:420,h:36}),v=b.useRef(0),[S,j]=b.useState(null),[E,x]=b.useState(null),[w,M]=b.useState(0),z=b.useRef([]),[H,W]=b.useState({});b.useEffect(()=>W({}),[o.hash,o.path,o.file]);const T=G=>H[G]??n.inline[G]??o.styles[G]??"",_=(G,de)=>{W(be=>({...be,[G]:de})),n.onStyle(G,de)},I={icons:(v.current||m.w)>n.bounds.right-n.bounds.left};b.useLayoutEffect(()=>{const G=r.current;G&&(Il(G),I.icons||(v.current=G.offsetWidth),(G.offsetWidth!==m.w||G.offsetHeight!==m.h)&&g({w:G.offsetWidth,h:G.offsetHeight}))}),af(r,n.store,n.target,n.bounds,Kd),b.useEffect(()=>S?n.store.subscribe(()=>j(null)):void 0,[S,n.store]),b.useLayoutEffect(()=>{if(!S)return x(null);const G=f.current,de=z.current[Ze.findIndex(D=>D.pop===S)],be=r.current;if(!G||!de||!be)return;const _t=be.getBoundingClientRect(),Ve=G.offsetWidth,Qt=G.offsetHeight,Ut=n.bounds,at=Math.round(Math.max(Ut.left,Math.min(_t.left+de.offsetLeft,Ut.right-Ve))),Ge=be.dataset.below==="true",on=_t.top-8-Qt,It=_t.bottom+8,Vn=on>=Ut.top,lt=It+Qt<=Ut.bottom,Rn=Math.round(Ge?lt?It:Vn?on:Math.max(Ut.top,Math.min(It,Ut.bottom-Qt)):Vn?on:lt?It:Math.max(Ut.top,Math.min(It,Ut.bottom-Qt)));(!E||E.x!==at||E.y!==Rn)&&x({x:at,y:Rn})}),b.useEffect(()=>{if(!S)return;const G=de=>{var _t,Ve;const be=de.target;(_t=f.current)!=null&&_t.contains(be)||(Ve=r.current)!=null&&Ve.contains(be)||j(null)};return window.addEventListener("pointerdown",G,!0),()=>window.removeEventListener("pointerdown",G,!0)},[S]);const X=kb(n.tokens),ne=!!o.text.trim(),ee=Tb(o,n.inline),ie=ee.prop==="color"?Ot.textColor:Ot.fill,le=H[ee.css]??ee.value,he=fa(le)??fa((R=pu(le,X))==null?void 0:R.value)??null,ce=Number(T("font-weight"))>=600,ge=T("font-style")==="italic",xe=/underline/.test(T("text-decoration-line")||T("text-decoration")),Ze=[{id:"text",label:Ot.text,icon:"title",pop:"text",disabled:!ne,title:ne?Ot.text:Ot.textOff},...ne?[{id:"bold",label:Ot.bold,icon:"bold",iconOnly:!0,on:ce,title:Ot.bold,run:()=>_("font-weight",ce?"400":"700")},{id:"italic",label:Ot.italic,icon:"italic",iconOnly:!0,on:ge,title:Ot.italic,run:()=>_("font-style",ge?"normal":"italic")},{id:"underline",label:Ot.underline,icon:"underline",iconOnly:!0,on:xe,title:Ot.underline,run:()=>_("text-decoration-line",xe?"none":"underline")}]:[],{id:"fill",label:ie,pop:"fill",title:`${ie} (${ee.css})`},{id:"radius",label:Ot.radius,icon:"radius",pop:"radius",title:`${Ms.cornerRadius} (border-radius)`},{id:"spacing",label:Ot.spacing,icon:"spacing",pop:"spacing",title:`${Ms.padding} · ${Ms.gap}`},{id:"ask",label:Ot.askAi,aria:Ot.askAiAria,icon:"ai",cls:"accent",title:Ot.askAiTitle,run:n.onAskAi},{id:"comment",label:Ot.comment,icon:"comment",title:Ot.commentTitle,run:n.onComment},{id:"more",label:Ot.more,icon:"more",title:Ot.more,run:()=>{var de;const G=(de=z.current[Ze.length-1])==null?void 0:de.getBoundingClientRect();G&&n.onMore({clientX:G.left,clientY:G.bottom+8})}}],Ne=Ze.map((G,de)=>G.disabled?-1:de).filter(G=>G>=0),xt=Ne.includes(w)?w:Ne[0],et=G=>{var de;return G.pop?j(be=>be===G.pop?null:G.pop):(de=G.run)==null?void 0:de.call(G)},me=()=>{var de;const G=Ze.findIndex(be=>be.pop===S);j(null),(de=z.current[G])==null||de.focus()},je=G=>{if(!G.nativeEvent.isComposing){if(G.key==="Escape"){S&&(G.preventDefault(),G.stopPropagation(),me());return}G.metaKey||G.ctrlKey||/^(Arrow|Home$|End$|Enter$| $|Delete$|Backspace$)/.test(G.key)&&G.stopPropagation()}},Ce=G=>{const de=Ne.indexOf(xt),be=_t=>{var Qt;G.preventDefault();const Ve=Ne[(_t+Ne.length)%Ne.length];M(Ve),(Qt=z.current[Ve])==null||Qt.focus()};G.key==="ArrowRight"?be(de+1):G.key==="ArrowLeft"?be(de-1):G.key==="Home"?be(0):G.key==="End"&&be(Ne.length-1)},Ue=(Y=n.tokens)!=null&&Y.registered?n.tokens.fontSizes:[],fe=[...new Set([...(ue=n.tokens)!=null&&ue.registered?n.tokens.fontWeights:[],400,500,600,700])].sort((G,de)=>G-de),re=(pe=n.tokens)!=null&&pe.registered?n.tokens.radii.filter(G=>G<999):[],Fe=($e=n.tokens)!=null&&$e.registered?n.tokens.spacing.filter(G=>G<=64):[];let dt=null;return S==="text"?dt=s.jsxs(s.Fragment,{children:[s.jsx(qd,{label:Ms.size,css:"font-size",value:qa(T("font-size")),chips:Ue,onStep:G=>_("font-size",`${Xd(T("font-size"),G,1,1)}px`),onCommit:G=>_("font-size",Vd(G))}),s.jsxs("label",{className:"pop-field",children:[s.jsx("span",{className:"pop-h",title:"font-weight",children:Ms.weight}),s.jsx("select",{className:"pop-select",value:String(Number(T("font-weight"))||""),onChange:G=>_("font-weight",G.target.value),children:fe.map(G=>s.jsx("option",{value:String(G),children:fm(G,Ms.weights)},G))})]}),s.jsx("div",{className:"pop-row",role:"group","aria-label":Ot.textAlign,children:[["left","textLeft"],["center","textCenter"],["right","textRight"]].map(([G,de])=>s.jsx("button",{className:`pop-tog ${T("text-align")===G||G==="left"&&/^(start|left|)$/.test(T("text-align"))?"on":""}`,"aria-pressed":T("text-align")===G,"aria-label":Ot.align(G),title:Ot.align(G),onClick:()=>_("text-align",G),children:s.jsx(Q,{name:de,size:14})},G))})]}):S==="fill"?dt=s.jsx(ym,{title:ie,value:le,colors:X,vars:n.vars,autoFocus:!0,onPick:G=>_(ee.css,G)}):S==="radius"?dt=s.jsx(qd,{label:Ms.cornerRadius,css:"border-radius",value:qa(T("border-radius")),chips:re,onStep:G=>_("border-radius",`${Xd(T("border-radius"),G)}px`),onCommit:G=>_("border-radius",Vd(G))}):S==="spacing"&&(dt=s.jsxs(s.Fragment,{children:[s.jsx(qd,{label:Ms.padding,css:"padding",value:dm(T("padding")),chips:Fe,onStep:G=>_("padding",Ix(T("padding"),G)),onCommit:G=>_("padding",G.replace(/·/g," ").trim().split(/\s+/).map(Vd).join(" "))}),s.jsx(qd,{label:Ms.gap,css:"gap",value:qa(T("gap")==="normal"?"0px":T("gap")),chips:Fe,onStep:G=>_("gap",`${Xd(T("gap"),G,4)}px`),onCommit:G=>_("gap",Vd(G))})]})),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:r,className:`etb oc-anchored ${I.icons?"is-icons":""}`,role:"toolbar","aria-label":Ot.toolbar,"aria-orientation":"horizontal",onKeyDown:G=>{je(G),Ce(G)},onPointerDown:G=>G.stopPropagation(),children:Ze.map((G,de)=>s.jsxs("span",{className:"etb-item",children:[G.id==="ask"&&s.jsx("span",{className:"sep","aria-hidden":"true"}),s.jsxs("button",{ref:be=>void(z.current[de]=be),className:`${G.cls??""} ${S&&S===G.pop||G.on?"on":""} ${G.iconOnly?"is-icon":""}`,tabIndex:de===xt?0:-1,disabled:G.disabled,title:G.title,"aria-pressed":G.iconOnly?!!G.on:void 0,"aria-label":G.id==="fill"?ie:G.id==="more"||G.iconOnly?G.label:G.aria&&G.aria!==G.label?G.aria:I.icons?G.label:void 0,"aria-haspopup":G.pop?"dialog":void 0,"aria-expanded":G.pop?S===G.pop:void 0,onFocus:()=>M(de),onClick:()=>et(G),children:[G.id==="fill"?s.jsx("span",{className:"sw",style:{background:he??"transparent"}}):s.jsx(Q,{name:G.icon,size:14}),G.id!=="fill"&&G.id!=="more"&&!G.iconOnly&&!I.icons&&G.label,(G.id==="text"||G.id==="fill")&&s.jsx(Q,{name:"chevronDown",size:14})]})]},G.id))}),S&&s.jsx("div",{ref:f,className:"menu pop",role:"dialog","aria-label":(Re=Ze.find(G=>G.pop===S))==null?void 0:Re.label,style:E?{left:E.x,top:E.y}:{visibility:"hidden",left:0,top:0},onKeyDown:je,onPointerDown:G=>G.stopPropagation(),children:dt})]})}function f1(n){return s.jsxs("nav",{className:"crumb","aria-label":d.inspector.crumbs,children:[s.jsx("button",{className:"link",title:d.inspector.crumbBoard,onClick:n.onBoard,children:n.board}),n.skipped&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("span",{children:"…"})]}),n.parents.map(o=>s.jsxs("span",{className:"crumb-step",children:[s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("button",{className:"link",title:d.inspector.crumbParent(o.name),onClick:()=>n.onPath(o.path),children:o.name})]},o.path)),s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("b",{"aria-current":"true",title:n.title,children:n.current})]})}const h1=n=>n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",du=n=>`${Math.round(n)}px`;function m1(n,o,r,f,m){const g=o.style.pointerEvents;o.style.pointerEvents="none";const v=n.elementFromPoint(r,f);if(o.style.pointerEvents=g,!v||v===n.documentElement||o.contains(v))return null;const S=n.defaultView,j=X=>{const ne=S.getComputedStyle(X);return/flex/.test(ne.display)&&!ne.flexDirection.startsWith("column")},E=/^(img|input|br|hr|textarea|select|svg|path|video|iframe)$/i,x=X=>{const ne=X===n.body?"":nl(X);if(ne==null)return null;const ee=j(X),ie=Array.from(X.children).filter(ge=>{var xe;return ge!==o&&!((xe=ge.hasAttribute)!=null&&xe.call(ge,"data-dc-probe"))});let le=ie.length;for(let ge=0;ge<ie.length;ge++){const xe=As(ie[ge]);if(ee?r<xe.x+xe.w/2:f<xe.y+xe.h/2){le=ge;break}}const he=As(X);let ce;if(le<ie.length){const ge=As(ie[le]);ce=ee?{x:ge.x-1,y:ge.y,w:2,h:ge.h}:{x:ge.x,y:ge.y-1,w:ge.w,h:2}}else if(ie.length){const ge=As(ie[ie.length-1]);ce=ee?{x:ge.x+ge.w,y:ge.y,w:2,h:ge.h}:{x:ge.x,y:ge.y+ge.h,w:ge.w,h:2}}else ce={x:he.x,y:he.y+he.h-2,w:he.w,h:2};return{toParentPath:ne,index:le,freeze:[],line:ce}};if(v.contains(o)||v===n.body)return x(v===n.body?n.body:v);if(m&&!E.test(v.tagName))return x(v);const w=v.parentElement,M=w===n.body?"":nl(w);if(M==null)return null;const z=j(w),H=As(v),W=z?r>H.x+H.w/2:f>H.y+H.h/2,_=Array.from(w.children).filter(X=>X!==o).indexOf(v)+(W?1:0),I=z?{x:W?H.x+H.w:H.x-1,y:H.y,w:2,h:H.h}:{x:H.x,y:W?H.y+H.h:H.y-1,w:H.w,h:2};return{toParentPath:M,index:_,freeze:[],line:I}}function g1(n,o,r){const f=o.parentElement;if(!f||f===n.body)return[];const m=nl(f);if(m==null||m===r)return[];const g=n.defaultView.getComputedStyle(f);if(!/flex|grid/.test(g.display))return[];const v=[],S=(x,w)=>{const M=nl(x),z=x.style,H=x.getBoundingClientRect(),W={};for(const T of w)z.getPropertyValue(T)||(W[T]=du(T==="width"?H.width:H.height));M!=null&&Object.keys(W).length&&v.push({path:M,props:W})};S(f,["width","height"]);const j=g.display.includes("grid"),E=!g.flexDirection.startsWith("column");for(const x of Array.from(f.children))x!==o&&S(x,j?["width","height"]:E?["width"]:["height"]);return v}function p1(n){const[o,r]=b.useState(null),[f,m]=b.useState(null),g=b.useRef(null),v=1/Math.max(n.zoom,.25),S=M=>z=>{if(z.button!==0)return;z.stopPropagation(),z.preventDefault();const H=An(n.doc,n.path);if(!H)return;const W=n.doc.defaultView.getComputedStyle(H),T=W.position==="absolute"||W.position==="fixed",_=H.getBoundingClientRect();g.current={kind:M,sx:z.clientX,sy:z.clientY,el:H,abs:T,left:parseFloat(W.left)||0,top:parseFloat(W.top)||0,w:_.width,h:_.height,plan:null,moved:!1},z.currentTarget.setPointerCapture(z.pointerId)},j=M=>{var T,_;const z=g.current;if(!z)return;const H=(M.clientX-z.sx)/n.zoom,W=(M.clientY-z.sy)/n.zoom;if(!(!z.moved&&Math.abs(H)+Math.abs(W)<3)){if(z.moved=!0,z.kind==="move"){if(z.abs){z.el.style.left=du(z.left+H),z.el.style.top=du(z.top+W);return}m({...n.rect,x:n.rect.x+H,y:n.rect.y+W});const I=(_=(T=n.doc.defaultView)==null?void 0:T.frameElement)==null?void 0:_.getBoundingClientRect(),X=I?I.width/(n.doc.defaultView.innerWidth||I.width):n.zoom,ne=I?(M.clientX-I.left)/X:n.rect.x+H,ee=I?(M.clientY-I.top)/X:n.rect.y+W,ie=m1(n.doc,z.el,ne,ee,M.altKey);z.plan=ie?{toParentPath:ie.toParentPath,index:ie.index,freeze:[]}:null,r((ie==null?void 0:ie.line)??null);return}z.kind!=="s"&&(z.el.style.width=du(Math.max(8,z.w+H))),z.kind!=="e"&&(z.el.style.height=du(Math.max(8,z.h+W)))}},E=M=>{const z=g.current;if(g.current=null,r(null),m(null),!z||!z.moved)return;const H=(M.clientX-z.sx)/n.zoom,W=(M.clientY-z.sy)/n.zoom;if(z.kind==="move"){if(z.abs)return n.onPosition(Math.round(z.left+H),Math.round(z.top+W));if(!z.plan||z.plan.toParentPath===h1(n.path)&&z.plan.index===Array.from(z.el.parentElement.children).indexOf(z.el))return;n.onMove({...z.plan,freeze:g1(n.doc,z.el,z.plan.toParentPath)});return}n.onResize(Math.round(z.kind==="s"?z.w:Math.max(8,z.w+H)),Math.round(z.kind==="e"?z.h:Math.max(8,z.h+W)))},x=n.rect,w=10*v;return s.jsxs(s.Fragment,{children:[f&&s.jsx("div",{className:"drag-ghost",style:{left:f.x,top:f.y,width:f.w,height:f.h}}),o&&s.jsx("div",{className:"drop-line",style:{left:o.x,top:o.y,width:Math.max(o.w,2*v),height:Math.max(o.h,2*v)}}),s.jsx("button",{className:"el-move","aria-label":d.elementDrag.moveAria,title:d.elementDrag.moveTitle,style:{left:Math.max(0,x.x),top:x.y>=22*v?x.y-22*v:Math.max(0,x.y),transform:`scale(${v})`,transformOrigin:x.y>=22*v?"0 100%":"0 0"},onPointerDown:S("move"),onPointerMove:j,onPointerUp:E,children:s.jsx(Q,{name:"hand",size:12})}),["e","s","se"].map(M=>s.jsx("div",{className:`el-resize ${M}`,role:"slider","aria-label":M==="e"?d.elementDrag.width:M==="s"?d.elementDrag.height:d.elementDrag.size,"aria-valuetext":`${Math.round(x.w)} × ${Math.round(x.h)}`,style:{left:M==="s"?x.x+x.w/2-w/2:x.x+x.w-w/2,top:M==="e"?x.y+x.h/2-w/2:x.y+x.h-w/2,width:w,height:w,borderWidth:1.5*v},onPointerDown:S(M),onPointerMove:j,onPointerUp:E},M))]})}function y1(n,o,r,f){const m=An(n,o),g=m==null?void 0:m.parentElement;if(!m||!g)return null;const v=n.defaultView.getComputedStyle(g),S=/flex/.test(v.display),j=S&&v.flexDirection.startsWith("column"),E=f==="left"||f==="hcenter"||f==="right",x=f==="left"||f==="top"?"start":f==="right"||f==="bottom"?"end":"center",w={start:"flex-start",center:"center",end:"flex-end"}[x],M=(z,H)=>({op:"setStyle",path:o,hash:r,prop:z,value:H});return S&&(E?j:!j)?[M("align-self",w)]:E?x==="start"?[M("margin-left","0"),M("margin-right","auto")]:x==="end"?[M("margin-left","auto"),M("margin-right","0")]:[M("margin-left","auto"),M("margin-right","auto")]:S?x==="start"?[M("margin-top","0"),M("margin-bottom","auto")]:x==="end"?[M("margin-top","auto"),M("margin-bottom","0")]:[M("margin-top","auto"),M("margin-bottom","auto")]:null}const He=d.requests,tm=n=>{var o;return((o=n.request)==null?void 0:o.state)==="done"&&n.request.replyId?(n.replies??[]).find(r=>r.id===n.request.replyId):void 0},al=n=>!!n.forAgent&&!!n.request,Gy=(n,o)=>n.filter(r=>al(r)&&r.request.state==="waiting"&&(!o||r.file===o)).length,b1=()=>/\bClaude\/\d/.test(navigator.userAgent),Cb=n=>d.occupancy.clock(n?Date.parse(n):Date.now());function v1(){const[n,o]=b.useState({mode:"chat",to:"any",intro:!1}),[r,f]=b.useState([]),[m,g]=b.useState(!1),v=b.useCallback(()=>{Te.get("/api/requests/settings").then(j=>(o(j),g(!0))).catch(()=>{}),Te.get("/api/agents/connected").then(j=>f(j.agents)).catch(()=>{})},[]);b.useEffect(()=>{v();const j=window.setInterval(v,6e4);return()=>window.clearInterval(j)},[v]);const S=b.useCallback(async j=>{o(E=>({...E,...j})),o(await Te.post("/api/requests/settings",j))},[]);return{settings:n,agents:r,ready:m,reload:v,save:S,host:n.mode==="host"}}function bm({comments:n}){const[o,r]=b.useState(!1);return!n.some(f=>al(f)&&f.request.state==="waiting")||n.some(f=>al(f)&&f.request.state==="taken")?null:s.jsxs("p",{className:"req-say1",children:[s.jsxs("span",{className:"req-say1-text",children:[He.sayTitle," ",s.jsx("strong",{children:He.quote(He.line)})]}),s.jsx("button",{className:"icon-btn req-say1-copy","aria-label":o?He.copied:He.copy,title:He.copyTitle,onClick:()=>void navigator.clipboard.writeText(He.line).catch(()=>{}).then(()=>{r(!0),window.setTimeout(()=>r(!1),1400)}),children:s.jsx(Q,{name:o?"check":"copy",size:16})})]})}function Eb({req:n,inLine:o=!1}){const{settings:r,agents:f}=n,m=g=>void n.save({mode:g,intro:!0});return s.jsxs("section",{className:`req-mode ${o?"in-line":""}`,"aria-label":He.goTo,id:o?"req-mode-more":void 0,children:[!o&&s.jsx("h3",{className:"req-h",children:He.goTo}),s.jsx("div",{className:"req-opts",role:"radiogroup","aria-label":He.goTo,children:["chat","host"].map(g=>s.jsxs("button",{role:"radio","aria-checked":r.mode===g,className:`req-opt ${r.mode===g?"on":""}`,onClick:()=>m(g),children:[s.jsx("span",{className:"req-radio","aria-hidden":"true"}),s.jsxs("span",{className:"req-opt-text",children:[s.jsx("strong",{children:g==="chat"?He.easelChat:He.host}),s.jsx("span",{children:g==="chat"?He.easelChatNote:He.hostNote})]})]},g))}),r.mode==="host"&&s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"req-h",children:He.connected}),f.length?s.jsx("ul",{className:"req-agents",children:f.map(g=>s.jsxs("li",{children:[s.jsx("span",{className:"req-dot","aria-hidden":"true"}),s.jsx("span",{className:"req-agent",children:g.label}),s.jsxs("span",{className:"req-agent-where",children:[g.here?He.thisFolder:He.otherFolder," · ",He.since(d.occupancy.clock(g.at))]})]},g.client))}):s.jsx("p",{className:"req-note",children:He.noneConnected}),new Set(f.map(g=>g.label)).size>=2&&s.jsxs("label",{className:"req-to",children:[s.jsx("span",{children:He.sendTo}),s.jsxs("select",{value:r.to,onChange:g=>void n.save({to:g.target.value}),children:[s.jsx("option",{value:"any",children:He.anyAgent}),[...new Set(f.map(g=>g.label))].map(g=>s.jsx("option",{value:g,children:g},g))]})]})]})]})}function x1({req:n}){const[o,r]=b.useState(!1),f=n.settings.mode==="host"?He.hostShort:He.easelChatShort,m=n.agents.length;return s.jsxs("section",{className:`req-mode-line ${o?"is-open":""}`,children:[s.jsxs("button",{className:"req-line","aria-expanded":o,"aria-controls":"req-mode-more",title:He.connectedN(m),onClick:()=>r(g=>!g),children:[s.jsx("span",{className:"req-line-k",children:He.goesTo}),s.jsx("span",{className:"req-line-v",children:f}),n.host&&s.jsx("span",{className:`req-dot ${m?"":"is-off"}`,"aria-hidden":"true"}),n.host&&s.jsx("span",{className:"sr-only",children:He.connectedN(m)}),s.jsx(Q,{name:"chevronDown",size:16,className:"chev"})]}),o&&s.jsx(Eb,{req:n,inLine:!0})]})}const Mb=({c:n})=>al(n)?s.jsx("span",{className:"req-badge",children:n.forAgent===!0?He.forAi:He.forAgent(String(n.forAgent))}):null;function Ab({c:n,a:o}){var v,S;if(!al(n))return null;const r=n.request,f=n.forAgent===!0?null:String(n.forAgent),m=r.state==="done"?((v=o.undoFor)==null?void 0:v.call(o,n))??null:null,g=r.state==="waiting"?r.left?He.left(r.left):f?He.waitingFor(f):He.waiting:r.state==="taken"?He.took(r.by??"AI",Cb(r.takenAt)):r.state==="failed"?r.reason??He.failed(r.by??"AI"):null;return s.jsxs("div",{className:`req-status is-${r.state}`,"data-req":n.id,children:[g&&s.jsx("span",{className:"req-state",role:"status",children:g}),r.state==="done"&&((((S=r.changed)==null?void 0:S.length)??0)>0||m||r.undo)&&s.jsxs("div",{className:"req-done",children:[(r.changed??[]).map(j=>s.jsxs("button",{className:"req-chip",title:He.changedTitle(o.titleOf(j)),onClick:()=>o.onBoard(j),children:[s.jsx(Q,{name:"board",size:14}),s.jsx("span",{className:"req-chip-title",children:o.titleOf(j)})]},j)),m&&s.jsx("button",{className:"btn oc-plain req-undo",onClick:m,children:He.undoChange}),!m&&r.undo==="undone"&&s.jsx("span",{className:"req-undone",role:"status",children:He.undone}),!m&&r.undo==="gone"&&s.jsx("span",{className:"req-undone",children:He.undoGone})]})]})}function zb({c:n,a:o}){const[r,f]=b.useState(!1);if(!al(n))return null;const m=n.request.state;return m!=="waiting"&&m!=="failed"?null:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn oc-plain",onClick:()=>m==="waiting"?o.onCancel(n):o.onRetry(n),children:m==="waiting"?He.cancelRequest:He.retry}),r?s.jsx("button",{className:"btn oc-plain",onClick:()=>o.onChat(n),children:He.useChat}):s.jsx("button",{className:"icon-btn req-more","aria-label":He.more,title:He.useChat,"aria-expanded":!1,onClick:()=>f(!0),children:s.jsx(Q,{name:"more",size:16})})]})}function Yy({all:n,forAi:o,value:r,onChange:f}){return s.jsxs("span",{className:"req-filter",role:"group","aria-label":He.filterAria,children:[s.jsxs("button",{"aria-pressed":r==="all",className:r==="all"?"on":"",onClick:()=>f("all"),children:[He.filterAll," ",s.jsx("span",{className:"req-n",children:n})]}),s.jsxs("button",{"aria-pressed":r==="ai",className:r==="ai"?"on":"",onClick:()=>f("ai"),children:[He.filterForAi," ",s.jsx("span",{className:"req-n",children:o})]})]})}const w1=({n})=>n>0?s.jsxs("span",{className:"occ-tag req-tag",title:He.waitingTag(n),children:[s.jsx(Q,{name:"clock",size:16}),s.jsx("span",{className:"act-tag-text",children:He.waitingTag(n)}),s.jsx("span",{className:"req-tag-n","aria-hidden":"true",children:n})]}):null,j1=({n})=>n>0?s.jsx("span",{className:"req-count","aria-label":He.countAria(n),title:He.countAria(n),children:n}):null,N1=(n,o)=>{var f;const r=(f=n.request)==null?void 0:f.attach;return r!=null&&r.label?r.label.startsWith(o)?r.label:`${o} · ${r.label}`:r!=null&&r.kind&&r.kind!=="element"?`${o} · ${He.kind[r.kind]}`:o};function S1({req:n,comments:o,actions:r,onOpen:f,chatBack:m,compact:g=!1}){const v=new Date().toDateString(),S=o.filter(j=>al(j)&&(j.request.state!=="done"||new Date(j.request.doneAt??0).toDateString()===v)).sort((j,E)=>+(E.request.state!=="done")-+(j.request.state!=="done")||Date.parse(E.createdAt)-Date.parse(j.createdAt));return s.jsx("div",{className:`pp req-panel ${g?"is-compact":""}`,children:s.jsxs("div",{className:"pp-scroll",children:[m,!g&&s.jsx(Eb,{req:n}),n.host&&s.jsxs("section",{className:"req-list","aria-label":He.listTitle,children:[s.jsxs("h3",{className:"req-h",children:[He.listTitle," ",s.jsx("span",{className:"oc-count",children:S.filter(j=>j.request.state!=="done").length}),s.jsx("span",{className:"req-h-side",children:He.allBoards})]}),s.jsx(bm,{comments:S}),S.length===0?s.jsx("p",{className:"req-note",children:He.listEmpty}):s.jsx("ul",{className:"req-items",children:S.map(j=>s.jsxs("li",{className:"req-item",children:[s.jsxs("button",{className:"req-item-head",onClick:()=>f(j),children:[s.jsx("span",{className:"who",children:j.author}),j.forAgent!==!0&&s.jsx(Mb,{c:j}),s.jsx("span",{className:"when",children:Cb(j.createdAt)})]}),s.jsx("div",{className:"req-item-text",children:j.text}),s.jsx("div",{className:"req-where",children:N1(j,r.titleOf(j.file))}),tm(j)&&s.jsxs("div",{className:"req-reply",children:[s.jsx("span",{className:"who",children:tm(j).author})," ",tm(j).text]}),s.jsx(Ab,{c:j,a:r}),(j.request.state==="waiting"||j.request.state==="failed")&&s.jsx("div",{className:"oc-cmt-bar req-actions",children:s.jsx(zb,{c:j,a:r})})]},j.id))})]}),g&&s.jsx(x1,{req:n})]})})}function k1(n){const o=Math.min(360,n.win.w-16),r=n.room<n.win.w?Math.max(8,Math.round((n.room-o)/2)):Xx(n.win.w,{w:o},8,n.room).x;return s.jsxs("div",{className:"req-composer req-intro",role:"dialog","aria-label":He.introTitle,style:{left:r,width:o,bottom:n.bottom},onPointerDown:f=>f.stopPropagation(),children:[s.jsx("strong",{className:"req-intro-title",children:He.introTitle}),s.jsxs("div",{className:"req-comp-foot",children:[s.jsx("span",{className:"req-comp-hint"}),s.jsx("button",{className:"btn oc-plain",onClick:n.onKeep,children:He.keepChat}),s.jsx("button",{className:"btn req-primary",autoFocus:!0,onClick:n.onSwitch,children:He.switchTo})]})]})}function Xy(n){const[o,r]=b.useState(""),[f,m]=b.useState(null),[g,v]=b.useState(!1),[S,j]=b.useState(!1),[E,x]=b.useState(null),[w,M]=b.useState(""),[z,H]=b.useState(!1),[W,T]=b.useState("all"),[_,I]=b.useState("page"),[X,ne]=b.useState(!1),ee=b.useRef(null),ie=b.useRef(null);b.useLayoutEffect(()=>{Il(ee.current),Il(ie.current,".crumb button, .crumb span[aria-hidden], .oc-cmt button")});const le=async(re,Fe=!1)=>{w.trim()&&(await Te.post("/api/comments",{action:"reply",id:re,text:w,author:n.author,resolve:Fe}),M(""),x(null))},he=re=>new Date(re).toLocaleString("ko-KR",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}),ce=n.selection,ge=!!ce&&!!n.file&&ce.file===n.file,xe=n.comments.filter(re=>(!n.file||re.file===n.file)&&(!n.listAll||(_==="all"||!n.pageFiles||n.pageFiles.includes(re.file))&&(X||!re.resolved))),Ze=xe.filter(al).length,Ne=W==="ai"&&Ze?xe.filter(al):xe,xt=xe.filter(re=>!re.resolved).length,et=b.useRef(null);b.useEffect(()=>{var re;n.focusComment&&(!Ne.some(Fe=>Fe.id===n.focusComment)&&xe.some(Fe=>Fe.id===n.focusComment)&&T("all"),(re=et.current)==null||re.scrollIntoView({block:"nearest"}))},[n.focusComment,n.file,Ne.length]);const me=n.threadOnly?n.comments.find(re=>re.id===n.focusComment):void 0,je=async()=>{ce&&(await navigator.clipboard.writeText(Tx(ce.file,ce.path,ce.tag,ce.text)).catch(()=>{}),j(!0),setTimeout(()=>j(!1),1200))},Ce=async()=>{if(n.file){v(!0);try{const re=await Te.post("/api/screenshot",{file:n.file,path:ce==null?void 0:ce.path});m(re.path)}catch(re){m(d.inspector.shotFailed(re.message))}finally{v(!1)}}},Ue=async()=>{if(!n.file||!o.trim())return;const re=(ce==null?void 0:ce.file)===n.file?ce.path:"";n.host&&z&&n.onAddForAi?await n.onAddForAi(o,re):await Te.post("/api/comments",{file:n.file,path:re,text:o,author:n.author}),r("")},fe=re=>{var Fe,dt,R,Y;return s.jsxs("li",{ref:re.id===n.focusComment?et:void 0,className:`oc-cmt-item ${re.resolved?"resolved":""} ${re.id===n.focusComment&&!n.threadOnly?"on":""}`,"aria-current":re.id===n.focusComment?"true":void 0,children:[s.jsxs("div",{className:"c-head",children:[s.jsx("span",{className:"who",children:re.author}),s.jsx(Mb,{c:re}),re.path&&s.jsx("button",{className:"btn oc-plain c-path",title:re.path,onClick:()=>n.onSelectPath(re.path),children:((dt=(Fe=re.request)==null?void 0:Fe.attach)==null?void 0:dt.label)??((R=n.nameOf)==null?void 0:R.call(n,re.file,re.path))??re.path}),n.listAll&&s.jsx("span",{className:"c-file",children:((Y=n.titleOf)==null?void 0:Y.call(n,re.file))??re.file}),s.jsx("span",{className:"when",children:he(re.createdAt)})]}),(n.compact||n.listAll)&&!n.threadOnly&&n.onOpenThread?s.jsx("button",{className:"c-open",title:d.comments.openThread,onClick:()=>n.onOpenThread(re),children:re.text}):s.jsx("div",{children:re.text}),n.reqActions&&s.jsx(Ab,{c:re,a:n.reqActions}),(re.replies??[]).length>0&&s.jsx("ul",{className:"replies",children:re.replies.map(ue=>s.jsxs("li",{children:[s.jsxs("div",{className:"c-head",children:[s.jsx("span",{className:"who",children:ue.author}),s.jsx("span",{className:"when",children:he(ue.createdAt)})]}),s.jsx("div",{children:ue.text})]},ue.id))}),E===re.id&&s.jsxs("div",{className:"reply-box",children:[s.jsx("textarea",{autoFocus:!0,value:w,placeholder:d.comments.replyPlaceholder(n.author),"aria-label":d.comments.reply,onChange:ue=>M(ue.target.value),onKeyDown:ue=>{ue.nativeEvent.isComposing||(ue.key==="Enter"&&(ue.metaKey||ue.ctrlKey)&&le(re.id),ue.key==="Escape"&&x(null))}}),s.jsxs("div",{className:"oc-cmt-bar",children:[s.jsx("button",{className:"btn",onClick:()=>void le(re.id),disabled:!w.trim(),children:d.comments.reply}),s.jsx("button",{className:"btn",onClick:()=>void le(re.id,!0),disabled:!w.trim(),children:d.comments.replyResolve})]})]}),s.jsxs("div",{className:"oc-cmt-bar",children:[n.reqActions&&s.jsx(zb,{c:re,a:n.reqActions}),E!==re.id&&s.jsx("button",{className:"btn oc-plain",onClick:()=>x(re.id),children:d.comments.reply}),s.jsx("button",{className:"btn oc-plain",onClick:()=>Te.post("/api/comments",{action:"resolve",id:re.id,resolved:!re.resolved}),children:re.resolved?d.comments.reopen:d.comments.resolve}),!re.resolved&&n.onAskAI&&!(al(re)&&re.request.state!=="done")&&s.jsx("button",{className:"btn oc-plain",onClick:()=>n.onAskAI(re),title:d.comments.sendToAITitle,children:d.comments.sendToAI}),n.onCommentMenu&&s.jsx("button",{className:"icon-btn oc-ib c-more","aria-haspopup":"menu","aria-label":d.comments.more,title:d.comments.more,onClick:ue=>{const pe=ue.currentTarget.getBoundingClientRect();n.onCommentMenu(re,{clientX:pe.left,clientY:pe.bottom+4})},children:s.jsx(Q,{name:"more",size:16})})]})]},re.id)};return me?s.jsx("div",{className:"pp inspector is-thread",children:s.jsx("div",{className:"pp-scroll",ref:ie,children:s.jsxs("section",{className:"pp-group oc-cmt","aria-label":d.comments.title,children:[s.jsxs("h3",{className:"pp-group-h",children:[d.comments.title,s.jsx("span",{className:"c-file",children:me.file}),n.onAllComments&&xe.length>1&&s.jsx("button",{className:"btn oc-plain c-all",onClick:n.onAllComments,children:d.comments.allOnBoard(xe.length)})]}),s.jsx("ul",{className:"comments",children:fe(me)})]})})}):n.listAll&&!me?s.jsx("div",{className:`pp inspector is-all ${n.listAll==="comments"?"is-comments":""}`,children:s.jsxs("div",{className:"pp-scroll",ref:ie,children:[n.listAll==="empty"&&s.jsx("p",{className:"pp-note muted pp-nothing",children:d.comments.nothingSelected}),s.jsxs("section",{className:"pp-group oc-cmt","aria-label":d.comments.title,children:[s.jsxs("div",{className:"cmt-filters",role:"group","aria-label":d.comments.scope,children:[s.jsx("span",{className:"pp-seg",children:["page","all"].map(re=>s.jsx("button",{"aria-pressed":_===re,className:_===re?"on":"",onClick:()=>I(re),children:re==="page"?d.comments.thisPage:d.comments.allPages},re))}),s.jsx("button",{"aria-pressed":X,className:`cmt-resolved ${X?"on":""}`,onClick:()=>ne(re=>!re),children:d.comments.showResolved})]}),Ze>0&&s.jsx(Yy,{all:xe.length,forAi:Ze,value:W,onChange:T}),n.host&&s.jsx(bm,{comments:xe}),Ne.length?s.jsx("ul",{className:"comments",children:Ne.map(fe)}):s.jsx("p",{className:"oc-empty oc-cmt-none",children:d.comments.none})]})]})}):s.jsxs("div",{className:"pp inspector",children:[s.jsxs("div",{className:"pp-scroll",ref:ie,children:[ge&&ce&&s.jsxs("header",{className:"pp-head",children:[s.jsx("span",{className:"pp-file",children:ce.file}),s.jsx("h2",{className:"pp-name",children:s.jsxs("span",{children:[d.inspector.kindName(ce.kind??ce.tag),ce.label&&` · ${ce.label.slice(0,40)}`,n.multi>1&&s.jsxs("span",{className:"muted",children:[" ",d.inspector.more(n.multi-1)]})]})}),s.jsxs("div",{className:"pp-crumb",children:[n.crumbs,ce.path.includes("/")&&s.jsx("button",{className:"icon-btn pp-ib","aria-label":d.menu.selectParent,title:d.menu.selectParent,onClick:()=>n.onSelectPath(ce.path.slice(0,ce.path.lastIndexOf("/"))),children:s.jsx(Q,{name:"parent",size:16})})]}),ce.text&&!ce.label&&s.jsxs("p",{className:"pp-note sel-text",children:["“",ce.text.slice(0,120),"”"]})]}),n.error&&s.jsx("p",{className:"pp-note warn",children:n.error}),f&&s.jsx("p",{className:"pp-note muted shot",children:f}),n.section!=="comments"&&n.children,n.file&&n.section!=="props"&&s.jsxs("section",{className:"pp-group oc-cmt","aria-label":d.comments.title,children:[s.jsxs("h3",{className:"pp-group-h",children:[d.comments.title,xt>0&&s.jsx("span",{className:"oc-count",children:xt}),Ze>0&&s.jsx(Yy,{all:xe.length,forAi:Ze,value:W,onChange:T})]}),s.jsx("textarea",{ref:n.commentRef,value:o,"aria-label":d.comments.title,placeholder:ge&&ce?d.comments.placeholderElement(ce.path):d.comments.placeholderBoard,onChange:re=>r(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.metaKey||re.ctrlKey)&&Ue()}}),s.jsxs("div",{className:"oc-cmt-bar",children:[n.host&&n.onAddForAi&&s.jsxs("label",{className:"req-check",title:d.requests.forAiCheckTitle,children:[s.jsx("input",{type:"checkbox",checked:z,onChange:re=>H(re.target.checked)}),d.requests.forAiCheck]}),s.jsx("button",{className:`btn ${n.host&&z?"req-primary":""}`,onClick:Ue,disabled:!o.trim(),children:n.host&&z?d.requests.addForAi:d.comments.add}),s.jsx("button",{className:"btn oc-plain",onClick:n.onAuthor,title:d.comments.authorTitle,children:d.comments.author(n.author)}),!ge&&s.jsx("button",{className:"btn oc-plain shot-link",onClick:Ce,disabled:g,title:d.inspector.boardScreenshotTitle,children:g?d.inspector.capturing:d.inspector.boardScreenshot})]}),n.host&&s.jsx(bm,{comments:xe}),s.jsx("ul",{className:"comments",children:Ne.map(fe)})]})]}),n.section==="comments"?null:ge?s.jsxs("footer",{className:"pp-actions","aria-label":d.inspector.actions,ref:ee,children:[n.onDuplicate&&s.jsx("button",{className:"btn",onClick:n.onDuplicate,children:d.properties.duplicate}),s.jsx("button",{className:"btn",onClick:je,children:S?d.inspector.copied:d.inspector.copy}),s.jsx("button",{className:"btn",onClick:Ce,disabled:g,title:d.inspector.screenshotTitle,children:g?d.inspector.capturing:d.inspector.screenshot}),n.onDelete&&s.jsx("button",{className:"icon-btn pp-del","aria-label":d.properties.delete,title:d.boardOptions.deleteTitleKey,onClick:n.onDelete,children:s.jsx(Q,{name:"trash"})})]}):n.footer]})}const T1=(n,o)=>n.x<o.x+o.w+(n.w+o.w)/2&&o.x<n.x+n.w+(n.w+o.w)/2&&n.y<o.y+o.h+(n.h+o.h)/2&&o.y<n.y+n.h+(n.h+o.h)/2;function C1(n){const o=new Set,r=[];for(const f of n){if(o.has(f))continue;const m=[f];o.add(f);for(let g=0;g<m.length;g++)for(const v of n)!o.has(v)&&T1(v,m[g])&&(o.add(v),m.push(v));r.push(n.filter(g=>m.includes(g)))}return r}function E1(n){const o=Math.min(...n.map(r=>r.y));return n.filter(r=>r.y-o<r.h/2).reduce((r,f)=>f.x<r.x?f:r)}function M1(n){const o=Math.min(...n.map(f=>f.x)),r=Math.min(...n.map(f=>f.y));return{x:o,y:r,w:Math.max(...n.map(f=>f.x+f.w))-o,h:Math.max(...n.map(f=>f.y+f.h))-r}}function A1(n,o,r,f){const m=new Set(r.map(g=>g??"")).size===1&&r[0]?r[0]:null;return{long:m?f.forkBlockWhile(n,o,m):null,medium:f.forkBlock(n,o),short:f.forkBlockShort(n)}}function z1(n,o,r,f){if(n.long&&r(n.long)<=o&&!f(r(n.long)))return n.long;for(const m of[n.medium,n.short])if(!f(r(m)))return m;return null}const vm=n=>n.kind==="person"&&n.client===tf,gu=n=>n.by??n.person??d.occupancy.someone,$b=(n,o)=>(n[o]??[]).filter(r=>r.kind==="agent"&&r.state==="editing");function $1({list:n}){return s.jsx(s.Fragment,{children:n.map(o=>{const r=vm(o),f=r?d.occupancy.you:o.state==="done"?d.occupancy.done(gu(o),d.occupancy.clock(o.doneAt??Date.now())):o.kind==="person"?d.occupancy.personEditing(gu(o)):d.occupancy.editing(gu(o));return s.jsxs("span",{className:`occ-tag ${r?"you":""} ${o.state==="done"?"done":""}`,"data-occ":o.key,title:f,children:[r?s.jsx("span",{className:"idot","aria-hidden":"true"}):o.state==="editing"&&o.kind==="agent"?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(Q,{name:nf(o.kind==="agent"?{by:o.by??""}:{person:o.person??""}),size:16}),s.jsx("span",{className:"act-tag-text",children:f})]},o.key)})})}function O1(n,o){const r=(n[o]??[]).find(f=>f.state==="editing");return r?{color:vm(r)?"var(--select)":"var(--text)",label:vm(r)?d.occupancy.youListDot:d.occupancy.listDot(gu(r))}:null}function Gd(n,o){var g;const r=n.boards[o];if(!r)return null;const f=(v,S)=>Object.keys(n.boards).filter(j=>{var E,x;return j!==v&&((E=n.boards[j].origin)==null?void 0:E.of)===v&&((x=n.boards[j].origin)==null?void 0:x.kind)===S});if((g=r.origin)!=null&&g.of&&n.boards[r.origin.of])return{original:r.origin.of,kind:r.origin.kind,chosen:o,alts:f(r.origin.of,r.origin.kind)};const m=f(o,"fork");return m.length?{original:o,kind:"fork",chosen:o,alts:m}:null}const R1=(n,o)=>[o.original,...o.alts].flatMap(r=>$b(n,r))[0]??null,D1=n=>n.replace(/:.*$/,"");function B1({file:n,group:o,busy:r,open:f,onOpen:m,compact:g=!1}){const v=o.kind==="variant"?d.occupancy.useThis:d.occupancy.useThisOne;return s.jsxs("button",{className:`icon-btn sm use-btn ${r?"":"ready"} ${f?"pressed":""} ${g?"icon-only":""}`,"data-use":n,"aria-disabled":r?!0:void 0,"aria-haspopup":"dialog","aria-expanded":f,"aria-label":g?v:void 0,title:r?d.occupancy.waitFor(gu(r)):g?v:o.kind==="variant"?d.occupancy.useThisTitle:d.occupancy.useThisOneTitle(o.alts.length),onPointerDown:S=>S.stopPropagation(),onDoubleClick:S=>S.stopPropagation(),onClick:S=>{S.stopPropagation(),r||m()},children:[s.jsx(Q,{name:"check",size:14}),!g&&s.jsx("span",{className:"use-label",children:v})]})}function H1(n){const o=b.useRef(null),[r,f]=b.useState(null),m=()=>document.querySelector(`[data-use="${CSS.escape(n.file)}"]`),g=w=>{var M;return((M=n.board.boards[w])==null?void 0:M.title)??w},v=n.group,S=g(v.original),j=d.occupancy,[E,x]=v.kind==="variant"?[j.confirmVariant(g(v.chosen),S),j.confirmVariantBody(S,v.alts.length-1)]:v.chosen===v.original?[j.confirmKeep(S),j.confirmKeepBody(v.alts.map(g).join(", "),v.alts.length)]:[j.confirmFork(g(v.chosen),S),j.confirmForkBody(S,v.alts.length-1)];return b.useLayoutEffect(()=>{var _,I;const w=m();if(!w)return void n.onClose();const M=w.getBoundingClientRect(),z=((_=o.current)==null?void 0:_.offsetWidth)??288,H=Math.round(Math.max(8,Math.min(M.right-z,window.innerWidth-z-8))),W=((I=o.current)==null?void 0:I.offsetHeight)??120,T=Math.round(Math.max(8,Math.min(M.bottom+8,window.innerHeight-W-8)));(!r||r.x!==H||r.y!==T)&&f({x:H,y:T})}),b.useEffect(()=>{var M,z;(z=(M=o.current)==null?void 0:M.querySelector("button"))==null||z.focus();const w=H=>{var T,_;const W=H.target;(T=o.current)!=null&&T.contains(W)||(_=m())!=null&&_.contains(W)||n.onClose()};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[n.file]),s.jsxs("div",{ref:o,className:"menu confirm entering",role:"dialog","aria-label":E,style:{left:(r==null?void 0:r.x)??-9999,top:(r==null?void 0:r.y)??-9999},onKeyDown:w=>{var M;w.key==="Escape"&&(w.stopPropagation(),n.onClose(),(M=m())==null||M.focus())},children:[s.jsx("p",{className:"c-title",children:E}),s.jsx("p",{className:"c-body",children:x}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn oc-strong",disabled:n.busy,onClick:n.onApply,children:j.apply}),s.jsx("button",{className:"btn oc-plain",disabled:n.busy,onClick:n.onKeepAll,children:v.kind==="variant"||v.alts.length>1?j.keepAll:j.keepBoth})]})]})}function L1({board:n,files:o,zoom:r}){const f=new Set(o),m=new Map;for(const g of o){const v=n.boards[g].origin;(v==null?void 0:v.kind)==="fork"&&f.has(v.of)&&n.boards[v.of]&&m.set(v.of,[...m.get(v.of)??[],{...n.boards[g],f:g}])}return m.size?s.jsx(s.Fragment,{children:[...m].flatMap(([g,v])=>C1(v).map(S=>s.jsx(_1,{of:g,from:n.boards[g],forks:S,zoom:Math.max(r,.05),board:n},S.map(j=>j.f).join(" "))))}):null}function _1({of:n,from:o,forks:r,zoom:f,board:m}){const g=b.useRef(null),v=b.useRef(null),S=E1(r),j=M1(r),E=r.length,x=o.title??n,w=A1(E,x,r.map(he=>{var ce;return(ce=he.origin)==null?void 0:ce.while}),d.occupancy),[M,z]=b.useState(w.medium),H={left:j.x,top:j.y+j.h+10/f,transform:`scale(${1/f})`,transformOrigin:"0 0"};b.useLayoutEffect(()=>{var Ce;const he=v.current,ce=(Ce=g.current)==null?void 0:Ce.getBoundingClientRect();if(!he||!ce)return;const ge=document.createElement("canvas").getContext("2d"),xe=getComputedStyle(he),Ze=parseFloat(xe.paddingLeft)+parseFloat(xe.paddingRight);ge&&(ge.font=`${xe.fontWeight} ${xe.fontSize} ${xe.fontFamily}`);const Ne=parseFloat(xe.lineHeight)||16,xt=ce.left+j.x*f,et=ce.top+(j.y+j.h)*f+10,me=[...document.querySelectorAll(".canvas .note, .canvas .board-frame, .canvas .board-label")].map(Ue=>Ue.getBoundingClientRect()),je=z1(w,j.w*f,Ue=>(ge?ge.measureText(Ue).width:Ue.length*7)+Ze,Ue=>me.some(fe=>fe.left<xt+Ue&&fe.right>xt&&fe.top<et+Ne&&fe.bottom>et));je!==M&&z(je)},[f,j.x,j.y,j.w,j.h,w.long,w.medium,w.short,m]);const W=U1(o,S),T=W[W.length-1],_=W[0];if(Math.hypot(T.x-_.x,T.y-_.y)<4)return null;const I=1.5/f,X=W[W.length-2],ne=Math.atan2(T.y-X.y,T.x-X.x),ee=6/f,ie=Math.min(...W.map(he=>he.x))-ee,le=Math.min(...W.map(he=>he.y))-ee;return s.jsxs("div",{ref:g,className:"fork-link","data-fork":S.f,"data-forks":r.map(he=>he.f).join(" "),"aria-label":w.long??w.medium,role:"img",children:[s.jsx("svg",{className:"fork-svg",style:{left:ie,top:le,width:Math.max(...W.map(he=>he.x))+ee-ie,height:Math.max(...W.map(he=>he.y))+ee-le},"aria-hidden":"true",children:s.jsxs("g",{transform:`translate(${-ie} ${-le})`,children:[s.jsx("path",{d:W.map((he,ce)=>`${ce?"L":"M"}${he.x} ${he.y}`).join(""),strokeWidth:I,strokeDasharray:`${4*I} ${4*I}`}),s.jsx("path",{d:`M${T.x-ee*Math.cos(ne-.6)} ${T.y-ee*Math.sin(ne-.6)}L${T.x} ${T.y}L${T.x-ee*Math.cos(ne+.6)} ${T.y-ee*Math.sin(ne+.6)}`,strokeWidth:I})]})}),s.jsx("div",{className:"fork-caption",style:{...H,visibility:M?void 0:"hidden"},"aria-hidden":"true",children:s.jsx("span",{ref:v,children:M??w.short})})]})}function U1(n,o){const r=Math.max(n.y,o.y)+Math.min(48,Math.min(n.h,o.h)/4),f=r<Math.min(n.y+n.h,o.y+o.h);if(f&&o.x>=n.x+n.w)return[{x:n.x+n.w+8,y:r},{x:o.x-8,y:r}];if(f&&o.x+o.w<=n.x)return[{x:n.x-8,y:r},{x:o.x+o.w+8,y:r}];const m=S=>Math.min(48,S.h/4);if(o.x<n.x+n.w&&o.x+o.w>n.x){const S=Math.min(n.x,o.x)-40,j=o.y>=n.y,E=j?n.y+n.h-m(n):n.y+m(n),x=j?o.y+m(o):o.y+o.h-m(o);return[{x:n.x-8,y:E},{x:S,y:E},{x:S,y:x},{x:o.x-8,y:x}]}const g={x:n.x+n.w/2,y:n.y+n.h/2},v={x:o.x+o.w/2,y:o.y+o.h/2};return o.y>=n.y+n.h?[{x:g.x,y:n.y+n.h+8},{x:v.x,y:o.y-8}]:[{x:g.x,y:n.y-8},{x:v.x,y:o.y+o.h+8}]}const nm=n=>n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",Ky=n=>Number(n.split("/").pop());function xm(n){var ne;const[o,r]=b.useState([]),[f,m]=b.useState(()=>n.bare?{}:{0:!0}),[g,v]=b.useState(null),[S,j]=b.useState(null),[E,x]=b.useState(null);b.useEffect(()=>{Te.get(`/api/outline?f=${encodeURIComponent(n.file)}`).then(ee=>r(ee.tree)).catch(()=>r([]))},[n.file,n.version]),b.useEffect(()=>{const ee={};for(const ie of n.selected){const le=ie.split("/");for(let he=1;he<le.length;he++)ee[le.slice(0,he).join("/")]=!0}Object.keys(ee).length&&m(ie=>({...ie,...ee}))},[n.selected.join("|")]);const w=ee=>{if(!g||g===ee||ee.startsWith(g+"/"))return;const ie=nm(ee);let le=Ky(ee);nm(g)===ie&&Ky(g)<le&&(le-=1),n.onMove(g,ie,le)},M=[],z=new Map,H=ee=>{for(const ie of ee)M.push(ie),z.set(ie.path,ie),ie.children.length&&f[ie.path]&&H(ie.children)};H(o);const W=E??n.selected[n.selected.length-1]??((ne=M[0])==null?void 0:ne.path)??null,T=ee=>{ee==null||!z.has(ee)||(x(ee),n.onSelect(ee,!1))},_=ee=>{if(!W)return;const ie=M.findIndex(ge=>ge.path===W),le=z.get(W),ce={ArrowDown:()=>{var ge;return T((ge=M[ie+1])==null?void 0:ge.path)},ArrowUp:()=>{var ge;return T((ge=M[ie-1])==null?void 0:ge.path)},ArrowRight:()=>le!=null&&le.children.length?f[W]?T(le.children[0].path):m(ge=>({...ge,[W]:!0})):void 0,ArrowLeft:()=>le!=null&&le.children.length&&f[W]?m(ge=>({...ge,[W]:!1})):T(W.includes("/")?nm(W):null),Home:()=>{var ge;return T((ge=M[0])==null?void 0:ge.path)},End:()=>{var ge;return T((ge=M[M.length-1])==null?void 0:ge.path)},Enter:()=>T(W)," ":()=>T(W)}[ee.key];ce&&(ee.preventDefault(),ee.stopPropagation(),ce())},I=(ee,ie)=>{const le=ee.children.length>0,he=f[ee.path];return s.jsxs("li",{children:[s.jsxs("div",{role:"treeitem","aria-selected":n.selected.includes(ee.path),"aria-expanded":le?!!he:void 0,"aria-level":ie+1,className:`layer ${n.selected.includes(ee.path)?"on":""} ${S===ee.path?"over":""} ${W===ee.path?"kbd-focus":""}`,style:{paddingLeft:8+(ie+(n.bare?1:0))*16},draggable:!0,onDragStart:ce=>{v(ee.path),ce.dataTransfer.effectAllowed="move"},onDragEnd:()=>{v(null),j(null)},onDragOver:ce=>{g&&(ce.preventDefault(),j(ee.path))},onDragLeave:()=>j(ce=>ce===ee.path?null:ce),onDrop:ce=>{ce.preventDefault(),w(ee.path),j(null)},onClick:ce=>{x(ee.path),n.onSelect(ee.path,ce.shiftKey)},children:[s.jsx("button",{className:"twisty",tabIndex:-1,"aria-label":he?d.layers.collapse:d.layers.expand,style:{visibility:le?"visible":"hidden"},onClick:ce=>{ce.stopPropagation(),m(ge=>({...ge,[ee.path]:!he}))},children:s.jsx(Q,{name:he?"chevronDown":"chevronRight",size:14})}),s.jsx("span",{className:"tag",children:ee.tag}),s.jsxs("span",{className:"lname",children:[ee.cls&&`.${ee.cls}`,ee.cls&&ee.text&&" · ",ee.text]})]}),le&&he&&s.jsx("ul",{children:ee.children.map(ce=>I(ce,ie+1))})]},ee.path)},X=s.jsx("ul",{className:"layer-tree",role:n.bare?"group":"tree","aria-label":n.bare?void 0:d.layers.title,title:d.layers.hint,tabIndex:0,onKeyDown:_,children:o.map(ee=>I(ee,0))});return n.bare?X:s.jsxs("section",{className:"pp-group layers",children:[s.jsx("h3",{className:"pp-group-h",title:d.layers.hint,children:d.layers.title}),X]})}function Zy(n){const[o,r]=b.useState({});return n.boards.length?s.jsx("section",{className:"pp-group layers page-outline","aria-label":d.layers.outline,children:s.jsx("ul",{className:"layer-tree",role:"tree","aria-label":d.layers.outline,children:n.boards.map(f=>s.jsxs("li",{children:[s.jsxs("div",{role:"treeitem","aria-expanded":!!o[f.file],"aria-level":1,className:"layer board-layer",style:{paddingLeft:8},onClick:()=>n.onPickBoard(f.file),children:[s.jsx("button",{className:"twisty",tabIndex:-1,"aria-label":o[f.file]?d.layers.collapse:d.layers.expand,onClick:m=>{m.stopPropagation(),r(g=>({...g,[f.file]:!g[f.file]}))},children:s.jsx(Q,{name:o[f.file]?"chevronDown":"chevronRight",size:14})}),s.jsx(Q,{name:"board",size:14,className:"layer-icon"}),s.jsx("span",{className:"lname",children:f.title})]}),o[f.file]&&s.jsx(xm,{bare:!0,file:f.file,version:n.versions[f.file]??0,selected:[],onSelect:m=>n.onPickElement(f.file,m),onMove:()=>{}})]},f.file))})}):s.jsx("p",{className:"oc-empty pp-nothing",children:d.comments.nothingSelected})}const q1=12,Fy=n=>{var o;return((o=/^([a-z]+)[-_]/i.exec(n))==null?void 0:o[1].toUpperCase())??""},V1=b.forwardRef(function(o,r){var T;const[f,m]=b.useState(""),[g,v]=b.useState(null),[S,j]=b.useState(null),E=(T=o.pages[0])==null?void 0:T.id,x=b.useMemo(()=>{const _=f.trim().toLowerCase();return[...new Set(o.board.order)].filter(I=>{const X=o.board.boards[I];return X?_?I.toLowerCase().includes(_)||(X.title??"").toLowerCase().includes(_):!o.pages.length||(X.page??E)===o.currentPage:!1})},[f,o.board,o.pages,o.currentPage,E]),w=b.useMemo(()=>{if(f.trim()||x.length<q1)return null;const _=new Map;for(const ne of x){const ee=Fy(ne);_.has(ee)||_.set(ee,[]),_.get(ee).push(ne)}const I=[..._.keys()].filter(ne=>ne&&_.get(ne).length>=2);if(I.length<2)return null;const X=x.filter(ne=>!I.includes(Fy(ne)));return[...I.map(ne=>({key:ne,label:ne,files:_.get(ne)})),...X.length?[{key:"",label:d.boardList.otherGroup,files:X}]:[]]},[x,f]),[M,z]=b.useState(()=>{try{return JSON.parse(localStorage.getItem("design-canvas:groups-closed")??"{}")}catch{return{}}}),H=_=>z(I=>{const X={...I,[_]:!I[_]};try{localStorage.setItem("design-canvas:groups-closed",JSON.stringify(X))}catch{}return X}),W=_=>{var ee;const I=o.board.boards[_],X=!!I.title&&I.title!==_.replace(/\.html$/,""),ne=(ee=o.dotOf)==null?void 0:ee.call(o,_);return s.jsx("li",{children:s.jsxs("button",{className:`row oc-row ${o.selected.includes(_)?"on":""}`,"aria-current":o.selected.includes(_)||void 0,onClick:ie=>o.onPick(_,ie.shiftKey||ie.metaKey),onContextMenu:ie=>{o.onBoardMenu&&(ie.preventDefault(),o.onBoardMenu(_,ie))},title:_,children:[s.jsx("span",{className:"row-title",children:I.title??_}),o.missing.includes(_)&&s.jsx(Q,{name:"warn",size:14,className:"warn-icon","aria-label":d.boardList.fileMissing}),ne&&s.jsx("span",{className:"idot occ-dot",style:{background:ne.color},role:"img","aria-label":ne.label,title:ne.label}),X&&s.jsx("span",{className:"row-file",children:_})]})},_)};return s.jsxs("aside",{ref:o.cardRef,className:o.className??"left",style:o.style,"aria-label":d.boardList.aria,children:[o.header,o.showPages!==!1&&s.jsxs("section",{className:"left-pages",children:[s.jsxs("div",{className:"oc-sec",children:[s.jsx("span",{children:d.boardList.pages}),o.onAddPage&&s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.boardList.addPage,title:d.boardList.addPage,onClick:o.onAddPage,children:s.jsx(Q,{name:"plus",size:16})})]}),o.pages.length===0?s.jsx("p",{className:"oc-empty",children:d.boardList.singlePage}):s.jsx("ul",{className:"oc-list",role:"tablist","aria-label":d.boardList.pages,children:o.pages.map((_,I)=>s.jsx("li",{draggable:!!o.onMovePage,onDragStart:X=>{v(_.id),X.dataTransfer.effectAllowed="move"},onDragOver:X=>{g&&(X.preventDefault(),j(I))},onDragEnd:()=>{v(null),j(null)},onDrop:X=>{var ee;X.preventDefault();const ne=o.pages.findIndex(ie=>ie.id===g);g&&ne!==I&&((ee=o.onMovePage)==null||ee.call(o,g,I)),v(null),j(null)},children:s.jsxs("button",{role:"tab",title:d.boardList.pageTabTitle,"aria-selected":_.id===o.currentPage,className:`row oc-row ${_.id===o.currentPage?"on":""} ${S===I&&g!==_.id?"drop-before":""}`,onClick:()=>o.onPage(_.id),onContextMenu:X=>{o.onPageMenu&&(X.preventDefault(),o.onPageMenu(_.id,X))},children:[s.jsx("span",{className:"row-title",children:_.name}),s.jsx("span",{className:"row-count",children:Object.values(o.board.boards).filter(X=>(X.page??E)===_.id).length})]})},_.id))})]}),s.jsxs("section",{className:"left-boards",children:[s.jsx("div",{className:"oc-sec",children:s.jsxs("span",{children:[d.boardList.boardsHead,s.jsx("span",{className:"oc-count",children:x.length})]})}),s.jsxs("label",{className:"oc-search",children:[s.jsx(Q,{name:"search",size:16}),s.jsx("input",{ref:r,value:f,placeholder:d.boardList.searchPlaceholder,"aria-label":d.boardList.search,onChange:_=>m(_.target.value),onKeyDown:_=>{_.nativeEvent.isComposing||(_.key==="Enter"&&x[0]&&o.onPick(x[0],!1),_.key==="Escape"&&(m(""),_.target.blur()))}})]}),x.length===0?s.jsx("p",{className:"oc-empty",children:f?d.boardList.noMatch(f):d.boardList.emptyPage}):w?s.jsx("ul",{className:"oc-list board-list",children:w.map(_=>{var X;const I=!M[_.key]||_.files.some(ne=>o.selected.includes(ne));return s.jsxs("li",{className:`group ${I?"open":""}`,children:[s.jsxs("div",{className:"row oc-row group-head",role:"button",tabIndex:0,"aria-expanded":I,title:d.boardList.groupTitle(_.files.length),onClick:()=>H(_.key),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),H(_.key))},onDoubleClick:()=>{var ne;return _.key&&((ne=o.onGroupRename)==null?void 0:ne.call(o,_.key))},onContextMenu:ne=>{o.onGroupMenu&&(ne.preventDefault(),o.onGroupMenu(_.key,_.files,ne))},children:[s.jsx(Q,{name:"chevronRight",size:14,className:"chev"}),s.jsx("span",{className:"row-title",children:_.key&&((X=o.board.groupNames)==null?void 0:X[_.key])||_.label}),s.jsx("span",{className:"row-count",children:_.files.length}),o.onGroupMenu&&s.jsx("button",{className:"icon-btn sm group-more","aria-label":d.boardList.groupMenu,title:d.boardList.groupMenu,onClick:ne=>{ne.stopPropagation();const ee=ne.currentTarget.getBoundingClientRect();o.onGroupMenu(_.key,_.files,{clientX:ee.left,clientY:ee.bottom+4})},children:s.jsx(Q,{name:"more",size:14})})]}),I&&s.jsx("ul",{className:"oc-list oc-sub",children:_.files.map(W)})]},_.key)})}):s.jsx("ul",{className:"oc-list board-list",children:x.map(W)})]}),o.footer]})});function G1({rects:n,selected:o,view:r,size:f,onJump:m,w:g=200,h:v=130,inset:S=0,reserve:j=0,className:E="minimap"}){const x=b.useMemo(()=>{if(!n.length)return{x:0,y:0,w:1,h:1};const I=Math.min(...n.map(ne=>ne.x)),X=Math.min(...n.map(ne=>ne.y));return{x:I,y:X,w:Math.max(...n.map(ne=>ne.x+ne.w))-I,h:Math.max(...n.map(ne=>ne.y+ne.h))-X}},[n]),w=v-S-Math.max(S,j),M=Math.min((g-S*2)/x.w,w/x.h),z=(g-x.w*M)/2,H=S+(w-x.h*M)/2,W={x:(-r.x/r.zoom-x.x)*M+z,y:(-r.y/r.zoom-x.y)*M+H,w:Math.max(0,f.w/r.zoom*M),h:Math.max(0,f.h/r.zoom*M)},T=b.useRef(!1),_=I=>{const X=I.currentTarget.getBoundingClientRect(),ne=X.width/g;m(((I.clientX-X.left)/ne-z)/M+x.x,((I.clientY-X.top)/ne-H)/M+x.y)};return s.jsx("div",{className:`${E} ${n.length>30?"many":""}`,role:"img","aria-label":d.minimap.aria,onPointerDown:I=>{T.current=!0,I.currentTarget.setPointerCapture(I.pointerId),_(I)},onPointerMove:I=>T.current&&_(I),onPointerUp:()=>T.current=!1,children:s.jsxs("svg",{width:g,height:v,children:[n.map(I=>s.jsx("rect",{x:(I.x-x.x)*M+z,y:(I.y-x.y)*M+H,width:Math.max(1,I.w*M),height:Math.max(1,I.h*M),rx:2,className:o.includes(I.file)?"mm-sel":"mm-board"},I.file)),j>0&&s.jsx("clipPath",{id:`mm-clip-${g}`,children:s.jsx("rect",{x:0,y:0,width:g,height:v-j+2})}),s.jsx("rect",{x:Math.round(W.x)+.5,y:Math.round(W.y)+.5,width:Math.max(0,Math.round(W.w)-1),height:Math.max(0,Math.round(W.h)-1),rx:3,className:"mm-view",clipPath:j>0?`url(#mm-clip-${g})`:void 0})]})})}function Y1(n){const o=n.item,r=d.boardOptions,f=(m,g,v,S,j=!1)=>s.jsx(Z1,{label:g,bare:j,value:o[m]??0,min:v,max:S,onCommit:E=>n.onPatch({[m]:E})},m+n.file+(o[m]??""));return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"pp-head","aria-label":r.aria,children:[s.jsx("button",{className:"pp-file",onClick:n.onRenameFile,title:r.renameFileTitle,children:n.file}),s.jsxs("h2",{className:"pp-name",children:[s.jsx("span",{children:o.title??n.file}),s.jsx("button",{className:"icon-btn pp-ib","aria-label":d.menu.rename,title:r.renameTitle,onClick:n.onRename,children:s.jsx(Q,{name:"edit",size:16})})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.positionAndSize}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.position}),s.jsxs("span",{className:"pp-two",children:[f("x","X"),f("y","Y")]})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.boardOptions.size}),s.jsxs("span",{className:"pp-two",children:[f("w",r.width,40,8e3),f("h",r.height,40,8e3)]})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.radius}),s.jsx("span",{className:"pp-two",children:f("radius",r.radius,0,200,!0)})]}),s.jsxs("div",{className:"pp-row",title:"bg",children:[s.jsx("span",{className:"pp-l",children:r.bg}),s.jsxs("span",{className:"tw-color",children:[s.jsx("label",{className:"sw-btn",style:{background:o.bg??"transparent"},children:s.jsx("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(o.bg??"")?o.bg:"#ffffff","aria-label":r.bg,onChange:m=>n.onPatch({bg:m.target.value.toUpperCase()})})}),s.jsx(X1,{value:o.bg??"",placeholder:r.bgNone,label:`${r.bg} (hex)`,onCommit:m=>n.onPatch({bg:m||void 0})},n.file+(o.bg??""))]})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.print}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.printMode}),s.jsx("span",{className:"pp-seg",role:"radiogroup","aria-label":r.print,children:["continuous","fixed"].map(m=>s.jsx("button",{role:"radio","aria-checked":(o.print??"continuous")===m,className:(o.print??"continuous")===m?"on":"",onClick:()=>n.onPatch({print:m==="fixed"?"fixed":void 0,...m==="continuous"?{paper:void 0}:{}}),children:r.printModes[m]},m))})]}),o.print==="fixed"&&s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.paper}),s.jsx("span",{className:"pp-seg",role:"radiogroup","aria-label":r.paper,children:["letter","a4"].map(m=>s.jsx("button",{role:"radio","aria-checked":(o.paper??"letter")===m,className:(o.paper??"letter")===m?"on":"",onClick:()=>n.onPatch({paper:m==="letter"?void 0:m}),children:r.papers[m]},m))})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.options}),s.jsx(Yd,{on:!!o.is_interactive,label:r.interactive,title:r.interactiveTitle,onChange:m=>n.onPatch({is_interactive:m||void 0})}),s.jsx(Yd,{on:!!o.frameless,label:r.frameless,onChange:m=>n.onPatch({frameless:m||void 0})}),s.jsx(Yd,{on:o.expand==="fill",label:r.fill,onChange:m=>n.onPatch({expand:m?"fill":void 0})}),s.jsx(Yd,{on:n.isLaunch,label:r.launch,onChange:n.onLaunch}),n.pages.length>0&&s.jsxs("label",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.page}),s.jsx("select",{value:o.page??n.pages[0].id,onChange:m=>n.onPatch({page:m.target.value}),children:n.pages.map(m=>s.jsx("option",{value:m.id,children:m.name},m.id))})]})]})]})}function X1(n){const[o,r]=b.useState(n.value);return s.jsx("input",{className:"tw-hex","aria-label":n.label,value:o,placeholder:n.placeholder,spellCheck:!1,onChange:f=>r(f.target.value),onBlur:()=>o.trim()!==n.value&&n.onCommit(o.trim()),onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur(),f.key==="Escape"&&r(n.value)}})}function K1(n){const o=d.boardOptions;return s.jsxs("footer",{className:"pp-actions","aria-label":d.inspector.boardActions,children:[s.jsx("button",{className:"icon-btn","aria-label":o.focus,title:o.focusTitle,onClick:n.onFocus,children:s.jsx(Q,{name:"focus"})}),s.jsx("button",{className:"icon-btn","aria-label":o.duplicate,title:o.duplicateTitle,onClick:n.onDuplicate,children:s.jsx(Q,{name:"copy"})}),s.jsx("button",{className:"icon-btn","aria-label":o.front,title:o.frontTitle,onClick:n.onFront,children:s.jsx(Q,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":o.back,title:o.backTitle,onClick:n.onBack,children:s.jsx(Q,{name:"back"})}),s.jsx("button",{className:"icon-btn pp-del","aria-label":o.delete,title:o.deleteTitleKey,onClick:n.onDelete,children:s.jsx(Q,{name:"trash"})})]})}function Yd(n){return s.jsxs("label",{className:"check",title:n.title,children:[s.jsx("input",{type:"checkbox",checked:n.on,onChange:o=>n.onChange(o.target.checked)}),s.jsx("i",{className:n.on?"on":"","aria-hidden":"true",children:n.on&&s.jsx(Q,{name:"check",size:12})}),n.label]})}function Z1({label:n,value:o,min:r,max:f,bare:m,onCommit:g}){const[v,S]=b.useState(String(o));b.useEffect(()=>S(String(o)),[o]);const j=()=>{let E=Math.round(Number(v));if(!Number.isFinite(E))return S(String(o));r!=null&&(E=Math.max(r,E)),f!=null&&(E=Math.min(f,E)),E!==o&&g(E),S(String(E))};return s.jsxs("label",{className:"num",children:[!m&&s.jsx("span",{children:n}),s.jsx("input",{inputMode:"numeric","aria-label":m?n:void 0,value:v,onChange:E=>S(E.target.value),onBlur:j,onKeyDown:E=>{if(!E.nativeEvent.isComposing&&(E.key==="Enter"&&E.target.blur(),E.key==="ArrowUp"||E.key==="ArrowDown")){E.preventDefault();const x=Number(v)+(E.key==="ArrowUp"?1:-1)*(E.shiftKey?10:1);S(String(x))}}})]})}function F1({store:n,...o}){return s.jsx(G1,{...o,view:km(n)})}const Qy="https://screens.invalid/",Q1=n=>n.split("/").map(encodeURIComponent).join("/");function P1({board:n,file:o,onClose:r,onLocate:f,screens:m=mb}){var T;const g=b.useRef(null),[v,S]=b.useState(o),[j,E]=b.useState({list:[o],i:0}),x=!!m.html,w=x?j.list[j.i]:v,M=n.boards[w]??n.boards[o],z=_=>E(I=>({list:[...I.list.slice(0,I.i+1),_],i:I.i+1})),H=_=>{var I,X,ne,ee;if(x)return E(ie=>({...ie,i:Math.max(0,Math.min(ie.list.length-1,ie.i+_))}));try{_<0?(X=(I=g.current)==null?void 0:I.contentWindow)==null||X.history.back():(ee=(ne=g.current)==null?void 0:ne.contentWindow)==null||ee.history.forward()}catch{}},W=()=>{var I,X,ne;let _=null;try{_=((I=g.current)==null?void 0:I.contentDocument)??null}catch{}if(_==null||_.addEventListener("click",ee=>{var he,ce,ge;const ie=(ce=(he=ee.target)==null?void 0:he.closest)==null?void 0:ce.call(he,"a[href]");if(!ie)return;if(x){const xe=new URL(ie.getAttribute("href")??"",Qy+Q1(w));if(xe.href.startsWith(Qy)){const Ze=decodeURIComponent(xe.pathname.slice(1));if(Ze===w&&xe.hash)return;ee.preventDefault(),((ge=m.html)==null?void 0:ge.call(m,Ze))!=null&&z(Ze);return}ee.preventDefault(),window.open(xe.href,"_blank","noopener");return}const le=new URL(ie.href,_.baseURI);le.origin!==location.origin&&(ee.preventDefault(),window.open(le.href,"_blank","noopener"))}),!x)try{const ee=new URL(m.url(""),location.href).href,ie=((ne=(X=g.current)==null?void 0:X.contentWindow)==null?void 0:ne.location.href)??"";ie.startsWith(ee)&&S(decodeURIComponent(ie.slice(ee.length).split(/[?#]/)[0]))}catch{}};return b.useEffect(()=>{const _=I=>I.key==="Escape"&&r();return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[r]),s.jsxs("div",{className:"play",onPointerDown:_=>_.target===_.currentTarget&&r(),children:[s.jsxs("div",{className:"play-bar",children:[s.jsx("button",{onClick:()=>H(-1),title:d.play.back,disabled:x&&j.i===0,children:"←"}),s.jsx("button",{onClick:()=>H(1),title:d.play.forward,disabled:x&&j.i>=j.list.length-1,children:"→"}),s.jsx("strong",{children:(M==null?void 0:M.title)??w}),s.jsx("span",{className:"muted",children:w}),s.jsx("div",{className:"spacer"}),s.jsx("button",{onClick:()=>{f(w),r()},children:d.play.viewOnCanvas}),s.jsx("button",{onClick:r,title:d.play.closeTitle,children:d.play.close})]}),s.jsx("iframe",{ref:g,className:"play-frame",src:x?void 0:m.url(o),srcDoc:x?(T=m.html)==null?void 0:T.call(m,w):void 0,title:d.viewer.play,onLoad:W,style:{width:Math.min((M==null?void 0:M.w)??390,window.innerWidth-32)}})]})}function J1(n,o){return n.length===1&&Object.hasOwn(o,n[0])?"play":"pen"}function Py(n){return(n.split(/[\\/]/).pop()||"board.html").replace(/\.html?$/i,"")+".png"}function am(n,o){return n===501||/executable doesn't exist|playwright install|playwright is not installed|failed to launch|browserType\.launch/i.test(o)?"browser":"render"}const lm=n=>(n.split(`
66
+ `)[0]??"").trim().slice(0,140),$t=d.design,I1=[{prop:"width",label:d.properties.fields.width},{prop:"height",label:d.properties.fields.height},{prop:"margin",label:"margin"},{prop:"color",label:d.properties.fields.color,color:!0},{prop:"background",label:d.properties.fields.background,color:!0},{prop:"display",label:"display",options:["","block","flex","grid","inline-flex","none"]},{prop:"flex-direction",label:d.properties.fields.flexDirection,options:["","row","column"]},{prop:"align-items",label:d.properties.fields.alignItems,options:["","flex-start","center","flex-end","stretch","baseline"]},{prop:"justify-content",label:d.properties.fields.justifyContent,options:["","flex-start","center","flex-end","space-between"]},{prop:"flex-wrap",label:d.properties.fields.flexWrap,options:["","nowrap","wrap"]},{prop:"flex-grow",label:d.properties.fields.flexGrow,options:["","0","1"]},{prop:"align-self",label:d.properties.fields.alignSelf,options:["","auto","flex-start","center","flex-end","stretch"]},{prop:"line-height",label:d.properties.fields.lineHeight},{prop:"text-align",label:d.properties.fields.textAlign,options:["","left","center","right"]},{prop:"border",label:d.properties.fields.border},{prop:"box-shadow",label:d.properties.fields.boxShadow},{prop:"opacity",label:d.properties.fields.opacity}];function Jy(n){if(!n||n==="none")return null;const o=n.match(/^\s*repeat\(\s*(\d+)\s*,/);if(o)return Number(o[1]);let r=0,f=0,m=!1;for(const g of n)g==="("&&r++,g===")"&&r--,/\s/.test(g)&&r===0?m=!1:m||(m=!0,f++);return f||null}const W1=n=>`repeat(${n}, minmax(0, 1fr))`,ew=[{dir:"left",label:d.properties.alignButtons.left,icon:"alignLeft"},{dir:"hcenter",label:d.properties.alignButtons.hcenter,icon:"alignHcenter"},{dir:"right",label:d.properties.alignButtons.right,icon:"alignRight"},{dir:"top",label:d.properties.alignButtons.top,icon:"alignTop"},{dir:"vcenter",label:d.properties.alignButtons.vcenter,icon:"alignVcenter"},{dir:"bottom",label:d.properties.alignButtons.bottom,icon:"alignBottom"}],tw={a:["href"],img:["src","alt"],input:["placeholder"],button:["aria-label"]};function nw(n){var W;const o=n.selection,r=tw[o.tag]??[],f=kb(n.tokens),m=Tb(o,n.inline),g=!!o.text.trim(),[v,S]=b.useState(null);b.useEffect(()=>S(null),[o.file,o.path]);const j=o.path+o.hash,E=T=>Uy(T,n.inline[T]??"",n.tokens),x=T=>{var I;const _=fa(T);return _==="#FFFFFF"?$t.white:_==="#000000"?$t.black:((I=pu(T,f))==null?void 0:I.name)??_??T},w=fa(o.styles["background-color"]),M=g?m.prop==="background"?Zd(o.styles.color??"",w??n.bg):Zd(o.styles.color??"",n.bg):null,z=M==null?null:m.prop==="background"?$t.contrastWith(M.toFixed(1),x(o.styles.color??""),$t.grade(M)):$t.contrastOn(M.toFixed(1),x(n.bg),$t.grade(M)),H=[...new Set([...(W=n.tokens)!=null&&W.registered?n.tokens.fontWeights:[],100,200,300,400,500,600,700,800,900])].sort((T,_)=>T-_);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:$t.fill}),s.jsx(jl,{word:$t.color,css:m.css,children:s.jsx(Wy,{value:m.value,computed:m.prop==="color"?o.styles.color:o.styles["background-color"],colors:f,css:m.css,label:$t.fill,open:v==="fill",onToggle:()=>S(T=>T==="fill"?null:"fill")})}),z&&s.jsx("div",{className:"pp-row",children:s.jsx("span",{className:`pp-note contrast ${M>=4.5?"ok":M>=3?"mid":"bad"}`,title:d.properties.contrastTitle,children:z})}),v==="fill"&&s.jsx(ym,{title:$t.fill,value:m.value,colors:f,vars:n.vars,onPick:T=>n.onStyle(m.css,T)})]}),g&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:$t.text}),s.jsx(jl,{word:$t.font,css:"font-family",children:s.jsx(Io,{label:$t.font,value:Sy(n.inline["font-family"]),placeholder:Sy(o.styles["font-family"]),onCommit:T=>n.onStyle("font-family",T?Qx(T):"")},"ff"+j)}),s.jsx(jl,{word:$t.size,css:"font-size",warn:E("font-size"),children:s.jsx(Io,{label:$t.size,value:qa(n.inline["font-size"]),placeholder:qa(o.styles["font-size"]),onCommit:T=>n.onStyle("font-size",Fd(T))},"fs"+j)}),s.jsx(jl,{word:$t.weight,css:"font-weight",warn:E("font-weight"),children:s.jsxs("select",{"aria-label":$t.weight,defaultValue:n.inline["font-weight"]??"",onChange:T=>n.onStyle("font-weight",T.target.value),children:[s.jsx("option",{value:"",children:$t.inherited(fm(o.styles["font-weight"],$t.weights))}),H.map(T=>s.jsx("option",{value:String(T),children:fm(T,$t.weights)},T))]},"fw"+j)}),s.jsx(jl,{word:At.letterSpacing,css:"letter-spacing",children:s.jsx(Io,{label:At.letterSpacing,value:qa(n.inline["letter-spacing"]),placeholder:o.styles["letter-spacing"]==="normal"?"0":qa(o.styles["letter-spacing"]),onCommit:T=>n.onStyle("letter-spacing",aw(T))},"ls"+j)}),m.prop==="background"&&s.jsxs(s.Fragment,{children:[s.jsx(jl,{word:$t.color,css:"color",children:s.jsx(Wy,{value:n.inline.color??"",computed:o.styles.color,colors:f,css:"color",label:$t.color,open:v==="color",onToggle:()=>S(T=>T==="color"?null:"color")})}),v==="color"&&s.jsx(ym,{title:$t.color,value:n.inline.color||o.styles.color||"",colors:f,vars:n.vars,onPick:T=>n.onStyle("color",T)})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.properties.layout}),s.jsx(jl,{word:$t.cornerRadius,css:"border-radius",warn:E("border-radius"),children:s.jsx(Io,{label:$t.cornerRadius,value:qa(n.inline["border-radius"]),placeholder:qa(o.styles["border-radius"]),onCommit:T=>n.onStyle("border-radius",Fd(T))},"br"+j)}),s.jsx(jl,{word:$t.padding,css:"padding",warn:E("padding"),children:s.jsx(Io,{label:$t.padding,value:dm(n.inline.padding),placeholder:dm(o.styles.padding),onCommit:T=>n.onStyle("padding",Zx(T))},"pd"+j)}),s.jsx(jl,{word:$t.gap,css:"gap",warn:E("gap"),children:s.jsx(Io,{label:$t.gap,value:qa(n.inline.gap),placeholder:qa(o.styles.gap==="normal"?"":o.styles.gap),onCommit:T=>n.onStyle("gap",Fd(T))},"gp"+j)}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.properties.align}),s.jsx("span",{className:"align-set",role:"group","aria-label":d.properties.align,children:ew.map(T=>s.jsx("button",{className:"icon-btn","aria-label":T.label,title:T.label,onClick:()=>n.onAlign(T.dir),children:s.jsx(Q,{name:T.icon,size:16})},T.dir))})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.properties.wrap}),s.jsxs("span",{className:"pp-btns",children:[s.jsx("button",{className:"btn",onClick:()=>n.onWrap("flex"),disabled:!n.canWrap,title:d.properties.wrapTitle,children:d.properties.wrapFlex}),s.jsx("button",{className:"btn",onClick:()=>n.onWrap("grid"),disabled:!n.canWrap,title:d.properties.wrapTitle,children:d.properties.wrapGrid})]})]}),n.onReplaceImage&&s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.properties.image}),s.jsx("span",{className:"pp-btns",children:s.jsx("button",{className:"btn",onClick:n.onReplaceImage,children:d.properties.replaceImage})})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:At.size}),["width","height"].map(T=>s.jsx(lw,{axis:T,inline:n.inline[T]??"",computed:o.styles[T]??"",onStyle:n.onStyle},T+j)),s.jsx(jl,{word:At.position,css:"position",children:s.jsxs("select",{"aria-label":At.position,value:n.inline.position==="absolute"?"absolute":"",onChange:T=>n.onStyle("position",T.target.value),children:[s.jsx("option",{value:"",children:At.flow}),s.jsx("option",{value:"absolute",children:At.absolute})]},"ps"+j)})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:At.look}),s.jsx(sw,{inline:n.inline.opacity??"",computed:o.styles.opacity??"1",onStyle:n.onStyle},"op"+j),s.jsxs("div",{className:"pp-row",title:"border-style",children:[s.jsx("span",{className:"pp-l",children:At.border}),s.jsx("span",{className:"pp-seg",role:"radiogroup","aria-label":At.border,children:["none","solid","dashed","dotted"].map(T=>{const _=n.inline["border-style"]||(n.inline.border??"").split(/\s+/).find(I=>["solid","dashed","dotted","none"].includes(I))||(o.styles["border-style"]&&o.styles["border-width"]!=="0px"?o.styles["border-style"]:"none");return s.jsx("button",{role:"radio","aria-checked":_===T,className:_===T?"on":"",onClick:()=>{if(T==="none")return n.onStyle("border-style",n.inline.border?"none":"");!n.inline.border&&(o.styles["border-width"]??"0px").startsWith("0")?n.onStyle("border",`1px ${T} currentColor`):n.onStyle("border-style",T)},children:At.borderStyles[T]},T)})})]}),s.jsx(jl,{word:At.shadow,css:"box-shadow",children:s.jsxs("select",{"aria-label":At.shadow,value:Iy(n.inline["box-shadow"]??""),onChange:T=>n.onStyle("box-shadow",wm[T.target.value]??""),children:[Object.keys(wm).map(T=>s.jsx("option",{value:T,children:At.shadows[T]},T)),Iy(n.inline["box-shadow"]??"")==="custom"&&s.jsx("option",{value:"custom",disabled:!0,children:At.shadows.custom})]},"sh"+j)})]}),o.tag==="a"&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:At.link}),s.jsx(jl,{word:At.href,css:"href",children:s.jsx(Io,{label:At.href,value:n.attrs.href??"",placeholder:"https://",onCommit:T=>n.onAttr("href",T||null)},"hr"+j)}),s.jsxs("div",{className:"pp-row",title:"target",children:[s.jsx("span",{className:"pp-l",children:At.newTab}),s.jsx("span",{className:"pp-v",children:s.jsx("button",{type:"button",role:"switch","aria-checked":n.attrs.target==="_blank","aria-label":At.newTab,className:`switch ${n.attrs.target==="_blank"?"on":""}`,onClick:()=>n.onAttr("target",n.attrs.target==="_blank"?null:"_blank")})})]})]}),n.onExport&&s.jsx(ow,{onExport:n.onExport},"ex"+j),n.children,s.jsx(uu,{id:"more-css",title:$t.more,children:s.jsxs("div",{className:"more-css",children:[I1.map(T=>s.jsx(sm,{label:T.label,value:n.inline[T.prop]??(T.prop==="background"?n.inline["background-color"]??"":""),placeholder:o.styles[T.prop==="background"?"background-color":T.prop]??"",options:T.options,color:T.color,swatches:T.color?f:void 0,warn:Uy(T.prop,n.inline[T.prop]??(T.prop==="background"?n.inline["background-color"]??"":""),n.tokens),ratio:T.prop==="color"?Zd(n.inline.color||o.styles.color||"",n.bg):null,onCommit:_=>n.onStyle(T.prop,_)},T.prop+j)),(n.inline.display??o.styles.display??"").includes("grid")&&["grid-template-columns","grid-template-rows"].map(T=>s.jsx(sm,{label:T.endsWith("columns")?d.properties.columns:d.properties.rows,value:String(Jy(n.inline[T])??""),placeholder:String(Jy(o.styles[T])??""),onCommit:_=>n.onStyle(T,/^\d+$/.test(_)&&Number(_)>0?W1(Math.min(24,Number(_))):_)},T+j)),r.map(T=>s.jsx(sm,{label:T,value:n.attrs[T]??"",placeholder:"",onCommit:_=>n.onAttr(T,_===""?null:_)},T+j))]})})]})}const At=d.extra,wm={none:"",small:"0 1px 2px rgba(0, 0, 0, 0.12)",medium:"0 4px 12px rgba(0, 0, 0, 0.16)",large:"0 12px 32px rgba(0, 0, 0, 0.2)"},Iy=n=>{var o;return((o=Object.entries(wm).find(([,r])=>r.replace(/\s+/g,"")===n.replace(/\s+/g,"")))==null?void 0:o[0])??(n?"custom":"none")},aw=n=>/^-?\d*(?:\.\d+)?$/.test(n.trim())&&n.trim()?`${Number(n)}em`:n.trim();function lw(n){const o=n.inline==="fit-content"||n.inline==="auto"?"hug":n.inline==="100%"?"fill":n.inline?"fixed":"hug",r=n.axis==="width"?At.width:At.height,f=Math.round(parseFloat(n.computed)||0);return s.jsxs("div",{className:"pp-row",title:n.axis,children:[s.jsx("span",{className:"pp-l",children:r}),s.jsxs("span",{className:"pp-two",children:[s.jsx(Io,{label:r,value:o==="fixed"?qa(n.inline):"",placeholder:String(f),onCommit:m=>n.onStyle(n.axis,Fd(m))}),s.jsxs("select",{"aria-label":At.mode(r),value:o,onChange:m=>n.onStyle(n.axis,m.target.value==="hug"?n.inline?"fit-content":"":m.target.value==="fill"?"100%":`${f}px`),children:[s.jsx("option",{value:"fixed",children:At.fixed}),s.jsx("option",{value:"hug",children:At.hug}),s.jsx("option",{value:"fill",children:At.fill})]})]})]})}function sw(n){const o=Math.round(Number(n.inline||n.computed||1)*100),[r,f]=b.useState(o);b.useEffect(()=>f(o),[o]);const m=g=>{const v=Math.max(0,Math.min(100,Math.round(g)));v!==o&&n.onStyle("opacity",v===100?"":String(v/100))};return s.jsxs("div",{className:"pp-row",title:"opacity",children:[s.jsx("span",{className:"pp-l",children:At.opacity}),s.jsxs("span",{className:"pp-v op-row",children:[s.jsxs("span",{className:"num",children:[s.jsx("input",{type:"number",min:0,max:100,value:r,"aria-label":At.opacity,onChange:g=>f(Number(g.target.value)),onBlur:()=>m(r),onKeyDown:g=>g.key==="Enter"&&m(r)}),s.jsx("span",{children:"%"})]}),s.jsx("input",{type:"range",min:0,max:100,value:r,"aria-label":`${At.opacity} (slider)`,onChange:g=>f(Number(g.target.value)),onPointerUp:()=>m(r),onKeyUp:()=>m(r)})]})]})}function ow(n){const[o,r]=b.useState(!1);return s.jsx("section",{className:"pp-group","aria-label":At.export,children:s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:At.export}),s.jsx("span",{className:"pp-btns",children:s.jsx("button",{className:"btn",disabled:o,onClick:()=>{r(!0),n.onExport().finally(()=>r(!1))},children:o?At.exporting:At.exportPng})})]})})}const Fd=n=>/^-?\d+(?:\.\d+)?$/.test(n.trim())?`${Number(n)}px`:n.trim();function jl(n){return s.jsxs("label",{className:"pp-row",title:n.css,children:[s.jsxs("span",{className:"pp-l",children:[n.word,n.warn&&s.jsxs("span",{className:"tok-warn",title:n.warn,"aria-label":d.properties.offToken(n.warn),children:[" ","⚠"]})]}),n.children]})}function Io(n){const[o,r]=b.useState(n.value);b.useEffect(()=>r(n.value),[n.value]);const f=()=>o.trim()!==n.value.trim()&&n.onCommit(o.trim());return s.jsx("input",{"aria-label":n.label,value:o,placeholder:n.placeholder,onChange:m=>r(m.target.value),onBlur:f,onKeyDown:m=>{m.nativeEvent.isComposing||(m.key==="Enter"&&m.currentTarget.blur(),m.key==="Escape"&&(r(n.value),m.stopPropagation()))}})}function Wy(n){const o=n.value||n.computed||"",r=pu(o,n.colors),f=fa(o)??fa(n.computed)??(r?fa(r.value):null);return s.jsxs("button",{className:`fillv ${n.open?"on":""}`,"aria-expanded":n.open,"aria-label":$t.openFill(n.label),title:n.css,onClick:m=>{m.preventDefault(),n.onToggle()},children:[s.jsx("span",{className:"sw",style:{background:f??"transparent"}}),s.jsx("span",{className:"fillv-name",children:(r==null?void 0:r.name)??f??$t.none}),r&&f&&s.jsx("span",{className:"muted",children:f})]})}function sm(n){const[o,r]=b.useState(n.value);b.useEffect(()=>r(n.value),[n.value]);const f=(m=o)=>{m.trim()!==n.value.trim()&&n.onCommit(m.trim())};return s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:[n.label,n.warn&&s.jsxs("span",{className:"tok-warn",title:n.warn,"aria-label":d.properties.offToken(n.warn),children:[" ","⚠"]})]}),n.options?s.jsx("select",{value:o,onChange:m=>{r(m.target.value),f(m.target.value)},children:n.options.map(m=>s.jsx("option",{value:m,children:m||`(${n.placeholder||d.properties.none})`},m))}):s.jsx("input",{value:o,placeholder:n.placeholder,onChange:m=>r(m.target.value),onBlur:()=>f(),onKeyDown:m=>{m.nativeEvent.isComposing||(m.key==="Enter"&&m.currentTarget.blur(),m.key==="Escape"&&(r(n.value),m.currentTarget.blur()))}}),n.ratio!=null&&s.jsxs("span",{className:`ratio ${n.ratio>=4.5?"ok":n.ratio>=3?"mid":"bad"}`,title:d.properties.contrastTitle,children:[d.properties.contrast," ",n.ratio.toFixed(2),":1 · ",n.ratio>=7?"AAA":n.ratio>=4.5?"AA":n.ratio>=3?d.properties.largeTextOnly:d.properties.tooLow]}),n.chips&&s.jsx("span",{className:"chips-row",children:n.chips.map(m=>s.jsx("button",{className:`tchip ${o===m?"on":""}`,onClick:g=>{g.preventDefault(),r(m),f(m)},children:m.replace("px","")},m))}),n.color&&s.jsx("span",{className:"swatches",children:(n.swatches??[]).map(m=>s.jsx("button",{className:`swatch ${o.toUpperCase()===m.value?"on":""}`,title:`${m.name} ${m.value}`,style:{background:m.value},onClick:g=>{g.preventDefault(),r(m.value),f(m.value)}},m.value))})]})}const eb=384,tb=n=>/^[\w./@:,=+-]+$/.test(n)?n:`'${n.replace(/'/g,"'\\''")}'`,iw=n=>n>=1048576?`${(n/1048576).toFixed(1)} MB`:`${Math.max(1,Math.round(n/1024))} KB`;function cw(n){const o=["npx easel-canvas export"];return n.dirFlag&&o.push(n.dirFlag),n.scope==="page"&&n.page&&o.push(`--page ${tb(n.pages.filter(r=>r.name===n.page.name).length>1?n.page.id:n.page.name)}`),n.scope==="boards"&&n.boards.length&&o.push(`--boards ${tb(n.boards.join(","))}`),n.single&&o.push("--single-file"),o.join(" ")}function rw({pages:n,currentPage:o,selected:r}){const f=vb(),[m,g]=b.useState(!1),[v,S]=b.useState("all"),[j,E]=b.useState(!1),[x,w]=b.useState(null),[M,z]=b.useState(null),[H,W]=b.useState(null),[T,_]=b.useState({}),[I,X]=b.useState({}),[ne,ee]=b.useState({left:0,top:0,width:eb}),ie=b.useRef(null),le=b.useRef(null),he=n.find(Y=>Y.id===o)??n[0],ce=v==="boards"&&!r.length||v==="page"&&!n.length?"all":v,ge={scope:ce,page:ce==="page"?he==null?void 0:he.id:void 0,boards:ce==="boards"?r:void 0},xe=(Y=!0)=>{var ue;g(!1),Y&&((ue=ie.current)==null||ue.focus())},Ze=()=>{if(m)return xe();S(r.length?"boards":"all"),g(!0)};b.useLayoutEffect(()=>{if(!m)return;const Y=()=>{var Re;const ue=ie.current.getBoundingClientRect(),pe=((Re=ie.current.closest(".oc-card"))==null?void 0:Re.getBoundingClientRect())??ue,$e=Math.min(eb,window.innerWidth-16);ee({width:$e,top:Math.round(ue.bottom+8),left:Math.round(Math.max(8,Math.min(pe.right-$e,window.innerWidth-$e-8)))})};return Y(),window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},[m]),b.useLayoutEffect(()=>{m&&Il(le.current,".oc-seg button, .btn")}),b.useEffect(()=>{var pe,$e;if(!m)return;($e=(pe=le.current)==null?void 0:pe.querySelector(".oc-seg [aria-checked='true']"))==null||$e.focus();const Y=Re=>{var de,be;const G=Re.target;!((de=le.current)!=null&&de.contains(G))&&!((be=ie.current)!=null&&be.contains(G))&&xe(!1)},ue=Re=>{Re.key==="Escape"&&(Re.stopPropagation(),xe())};return document.addEventListener("pointerdown",Y,!0),window.addEventListener("keydown",ue,!0),()=>{document.removeEventListener("pointerdown",Y,!0),window.removeEventListener("keydown",ue,!0)}},[m]),b.useEffect(()=>{m&&!x&&Te.get("/api/export").then(w,()=>{})},[m]);const Ne=JSON.stringify(ge);b.useEffect(()=>{if(!m||!j)return;let Y=!0;return z(null),Te.post("/api/export/estimate",ge).then(ue=>Y&&z(ue.bytes),()=>{}),()=>{Y=!1}},[m,j,Ne]);const xt=async Y=>{if(!H){W(Y),X(ue=>({...ue,[Y]:void 0}));try{const ue=await Te.post("/api/export",{...ge,format:Y==="pdf"||Y==="png"?Y:"web",singleFile:Y==="single"});_(pe=>({...pe,[Y]:ue})),Y==="single"&&z(ue.bytes)}catch(ue){X(pe=>({...pe,[Y]:ue.message}))}finally{W(null)}}},et=()=>Te.post("/api/export/reveal",{}).catch(Y=>f({tone:"error",text:Y.message})),me=async Y=>{try{await navigator.clipboard.writeText(Y),f({tone:"ok",text:d.share.copied(Y)})}catch{f({tone:"error",text:d.share.copyFailed})}},je=j?"single":"web",Ce=T[je],Ue=x&&!x.browser.ok?x.browser.reason??"":null,fe=(x==null?void 0:x.project)??"",re=Y=>`${fe?fe+"/":""}${Y.mainRel.endsWith("/")||Y.kind==="web"?Y.outRel:Y.mainRel}`,Fe=(x==null?void 0:x.single)??`${fe}-canvas.html`,dt=(Y,ue)=>s.jsxs("span",{className:"oc-res",role:"status",children:[s.jsxs("span",{className:"oc-rline",children:[s.jsx(Q,{name:"check",size:16}),s.jsx("code",{children:Y.kind==="single"?Y.mainRel.split("/").pop():re(Y)})," ",Y.kind==="single"?d.share.saved:d.share.exported]}),s.jsxs("span",{className:"oc-racts",children:[s.jsx("button",{className:"btn",title:d.share.revealTitle,onClick:()=>void et(),children:d.share.reveal}),ue.deploy&&Y.deploy&&s.jsx("button",{className:"btn",title:d.share.copyDeployTitle(Y.deploy),onClick:()=>void me(Y.deploy),children:d.share.copyDeploy})]}),ue.hint&&s.jsx("span",{className:"oc-rhint",children:d.share.attachHint}),Y.skipped.length>0&&s.jsx("span",{className:"oc-rhint",title:Y.skipped.map(pe=>`${pe.ref} (${pe.from}): ${pe.reason}`).join(`
67
+ `),children:d.share.skipped(Y.skipped.length)})]}),R=(Y,ue,pe,$e)=>s.jsxs("div",{className:"oc-orow",children:[s.jsx("span",{className:"out-ic",children:s.jsx(Q,{name:ue})}),s.jsxs("span",{className:"oc-otext",children:[s.jsx("strong",{children:pe}),s.jsx("span",{children:Ue?`${d.share.unavailable} ${Ue}`:$e})]}),s.jsx("button",{className:"btn",disabled:!!Ue,"aria-busy":H===Y,onClick:()=>void xt(Y),children:H===Y?d.share.working:d.share.export}),I[Y]&&s.jsx(nb,{text:I[Y]}),T[Y]&&!I[Y]&&dt(T[Y],{})]});return s.jsxs("div",{className:"share-wrap",children:[s.jsxs("button",{ref:ie,className:`share-btn ${m?"on":""}`,"aria-haspopup":"dialog","aria-expanded":m,"aria-label":d.share.button,title:d.share.buttonTitle,onClick:Ze,children:[s.jsx(Q,{name:"share",size:16})," ",s.jsx("span",{className:"share-label",children:d.share.button})]}),m&&s.jsxs("div",{ref:le,className:"share-pop oc-share entering",role:"dialog","aria-label":d.share.title,style:{left:ne.left,top:ne.top,width:ne.width},onKeyDown:Y=>{Y.stopPropagation()},children:[s.jsx("h4",{children:d.share.title}),s.jsxs("div",{className:"oc-seg",role:"radiogroup","aria-label":d.share.scope,children:[s.jsx("button",{role:"radio","aria-checked":ce==="all",className:ce==="all"?"on":"",onClick:()=>S("all"),children:d.share.whole}),s.jsx("button",{role:"radio","aria-checked":ce==="page",className:ce==="page"?"on":"",disabled:!n.length,title:n.length?he==null?void 0:he.name:d.share.pageNone,onClick:()=>S("page"),children:d.share.page}),r.length>0&&s.jsx("button",{role:"radio","aria-checked":ce==="boards",className:ce==="boards"?"on":"",onClick:()=>S("boards"),children:d.share.selected(r.length)})]}),s.jsxs("div",{className:"oc-out",children:[s.jsxs("div",{className:"oc-orow first",children:[s.jsx("span",{className:"out-ic",children:s.jsx(Q,{name:j?"file":"folder"})}),s.jsxs("span",{className:"oc-otext",children:[s.jsx("strong",{children:j?d.share.singleTitle:d.share.webTitle}),s.jsx("span",{children:j?s.jsxs(s.Fragment,{children:[s.jsx("code",{children:Fe}),d.share.singleHint(M==null?d.share.measuring:iw(M))]}):d.share.webHint}),s.jsxs("label",{className:"oc-sw",children:[s.jsx("button",{type:"button",role:"switch","aria-checked":j,className:`switch ${j?"on":""}`,onClick:()=>E(Y=>!Y)}),s.jsx("span",{children:d.share.singleSwitch})]})]}),s.jsx("button",{className:"btn","aria-busy":H===je,onClick:()=>void xt(je),children:H===je?d.share.working:j?d.share.save:d.share.export}),I[je]&&s.jsx(nb,{text:I[je]}),Ce&&!I[je]&&dt(Ce,{deploy:!j,hint:j})]}),R("pdf","pdf",d.share.pdfTitle,d.share.pdfHint),R("png","image",d.share.pngTitle,d.share.pngHint)]}),s.jsxs("div",{className:"oc-pfoot",children:[j&&s.jsx("span",{children:d.share.largeFiles}),s.jsxs("span",{children:[d.share.sameAs," ",s.jsx("code",{children:cw({dirFlag:x==null?void 0:x.dirFlag,scope:ce,page:he,pages:n,boards:r,single:j})})]})]})]})]})}function nb({text:n}){return s.jsxs("span",{className:"oc-err",role:"alert",children:[s.jsx(Q,{name:"warn",size:16}),s.jsx("span",{children:n})]})}function ab(n){const o=n.board.boards[n.file],r=b.useRef(null),[f,m]=b.useState({w:0,h:0});b.useLayoutEffect(()=>{const w=r.current;if(!w)return;const M=()=>m({w:w.clientWidth,h:w.clientHeight});M();const z=new ResizeObserver(M);return z.observe(w),()=>z.disconnect()},[]);const g=b.useRef(null);b.useEffect(()=>{var w;n.bare||(w=g.current)==null||w.focus({preventScroll:!0})},[n.bare]);const v=b.useRef(n.onKey);v.current=n.onKey;const S=w=>{const M=w.contentDocument;M&&M.addEventListener("keydown",z=>{if(!v.current||!["Escape","ArrowLeft","ArrowRight"].includes(z.key))return;const H=z.target;H&&(H.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(H.tagName))||(z.preventDefault(),v.current(z.key))})};if(!o)return null;const j=o.title??n.file,E=24,x=Math.min(1,(f.w-E*2)/o.w,(f.h-E*2)/o.h);return s.jsxs("div",{className:`oc-full ${n.bare?"bare":""} ${n.className??""}`,style:n.style,role:"dialog","aria-label":d.full.aria(j),children:[!n.bare&&s.jsxs("div",{className:"oc-full-bar",children:[s.jsx("button",{ref:g,className:"icon-btn oc-ib","aria-label":d.full.back,title:d.full.back,onClick:n.onClose,children:s.jsx(Q,{name:"chevronLeft"})}),n.title??s.jsx("strong",{className:"oc-full-name",title:`${j} · ${n.file}`,children:j}),n.nav,s.jsx("span",{className:"oc-full-gap"}),n.onExport&&s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.canvas.exportBoard,title:d.canvas.exportBoard,onClick:n.onExport,children:s.jsx(Q,{name:"download"})}),s.jsx("div",{className:"oc-seg oc-full-mode",role:"radiogroup","aria-label":d.full.mode,children:["fill","fit"].map(w=>s.jsx("button",{role:"radio","aria-checked":n.mode===w,className:n.mode===w?"on":"",title:w==="fill"?d.full.fillTitle:d.full.fitTitle,onClick:()=>n.onMode(w),children:w==="fill"?d.full.fill:d.full.fit},w))})]}),s.jsx("div",{ref:r,className:`oc-full-stage ${n.mode}`,children:n.mode==="fill"?s.jsx("iframe",{src:`/screens/${n.file}`,title:j,className:"oc-full-fill",onLoad:w=>S(w.currentTarget)},`${n.file}-fill-${n.reloadKey??0}`):f.w>0&&s.jsx("div",{className:"oc-full-frame",style:{width:Math.round(o.w*x),height:Math.round(o.h*x),borderRadius:(o.radius??0)*x},children:s.jsx("iframe",{src:`/screens/${n.file}`,title:j,style:{width:o.w,height:o.h,transform:`scale(${x})`,transformOrigin:"0 0"},onLoad:w=>S(w.currentTarget)},`${n.file}-fit-${n.reloadKey??0}`)})})]})}function Ob(n,o){const r=b.useRef(null),[f,m]=b.useState({left:n.x+12,top:n.y-8});return b.useLayoutEffect(()=>{const g=r.current;if(!g)return;const v=g.getBoundingClientRect(),S=n.x+12+o>window.innerWidth-8?n.x-12-o:n.x+12,j=Math.min(Math.max(48,n.y-8),window.innerHeight-v.height-8);m({left:Math.max(8,Math.round(S)),top:Math.round(j)})},[n.x,n.y,o]),{ref:r,pos:f}}function uw(n){const{ref:r,pos:f}=Ob(n.at,300),[m,g]=b.useState(""),[v,S]=b.useState(!1),[j,E]=b.useState(!1),x=async()=>{if(!(!m.trim()||j)){E(!0);try{await n.onSubmit(m.trim(),v)}finally{E(!1)}}};return s.jsxs("div",{ref:r,className:"cmt-pop cmt-composer",role:"dialog","aria-label":d.comments.title,style:{left:f.left,top:f.top,width:300},onPointerDown:w=>w.stopPropagation(),children:[s.jsx("p",{className:"cmt-crumbs",title:n.crumbs.join(" › "),children:n.crumbs.map((w,M)=>s.jsxs("span",{children:[M>0&&s.jsx("span",{className:"cmt-sep","aria-hidden":"true",children:" › "}),w]},M))}),s.jsx("textarea",{autoFocus:!0,value:m,"aria-label":d.comments.title,placeholder:d.comments.placeholder,onChange:w=>g(w.target.value),onKeyDown:w=>{w.nativeEvent.isComposing||(w.key==="Enter"&&(w.metaKey||w.ctrlKey)&&x(),w.key==="Escape"&&(w.stopPropagation(),n.onCancel()))}}),s.jsxs("div",{className:"cmt-bar",children:[n.host&&s.jsxs("label",{className:"check req-check",title:d.requests.forAiCheckTitle,children:[s.jsx("input",{type:"checkbox",checked:v,onChange:w=>S(w.target.checked)}),s.jsx("i",{className:v?"on":"","aria-hidden":"true",children:v&&s.jsx(Q,{name:"check",size:12})}),d.requests.forAiCheck]}),s.jsx("span",{className:"cmt-gap"}),s.jsx("button",{className:"btn",onClick:n.onCancel,children:d.requests.cancel}),s.jsx("button",{className:"btn primary",disabled:!m.trim()||j,onClick:()=>void x(),children:d.comments.add})]})]})}function dw(n){const{ref:r,pos:f}=Ob(n.at,320);return b.useEffect(()=>{const m=v=>{var j;const S=v.target;S&&((j=r.current)!=null&&j.contains(S)||S.closest(".pin, .menu, .dialog"))||n.onClose()},g=v=>{v.key==="Escape"&&!(document.activeElement instanceof HTMLTextAreaElement)&&n.onClose()};return window.addEventListener("pointerdown",m,!0),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",m,!0),window.removeEventListener("keydown",g)}},[n.onClose]),s.jsx("div",{ref:r,className:"cmt-pop cmt-thread",style:{left:f.left,top:f.top,width:320},onPointerDown:m=>m.stopPropagation(),children:n.children})}const fw=["font-family","font-size","font-weight","line-height","letter-spacing","color","text-align"];function om(n){return n.split(";").map(o=>o.trim()).filter(Boolean).map(o=>{const r=o.indexOf(":");return r<0?`${o};`:`${o.slice(0,r).trim()}: ${o.slice(r+1).trim()};`}).join(`
68
+ `)}function hw(n){const o=document.createElement("div").style;return n.split(/;|\n/).map(r=>r.trim()).filter(Boolean).filter(r=>{const f=r.indexOf(":");if(f<=0)return!0;const m=r.slice(0,f).trim(),g=r.slice(f+1).trim();return m.startsWith("--")?!g:(o.cssText="",o.setProperty(m,g),!o.getPropertyValue(m))})}function mw(n){var z;const o=n.el.getAttribute("style")??"",[r,f]=b.useState(()=>om(o)),[m,g]=b.useState([]),v=b.useRef(om(o)),S=b.useRef(null);b.useEffect(()=>{const H=om(o);(document.activeElement!==S.current||H!==v.current)&&(f(H),g([])),v.current=H},[n.path,o]);const j=async()=>{if(r.trim()===v.current.trim())return;const H=hw(r);g(H),!H.length&&await n.onSave(r)&&(v.current=r)},E=(z=n.el.ownerDocument.defaultView)==null?void 0:z.getComputedStyle(n.el),x=new Set(o.split(";").map(H=>H.split(":")[0].trim().toLowerCase())),w=E?fw.filter(H=>!x.has(H)).map(H=>[H,E.getPropertyValue(H)]):[],M=Math.max(3,r.split(`
69
+ `).length+1);return s.jsx("div",{className:"pp inspector oc-code",children:s.jsxs("div",{className:"pp-scroll",children:[s.jsxs("p",{className:"code-target",children:[s.jsxs("code",{children:["<",n.tag,">"]}),n.label&&s.jsxs("span",{children:[" “",n.label.slice(0,40),"”"]})]}),s.jsx("textarea",{ref:S,className:"code-css","aria-label":d.code.inline,spellCheck:!1,rows:M,value:r,placeholder:d.code.placeholder,onChange:H=>{f(H.target.value),m.length&&g([])},onBlur:()=>void j(),onKeyDown:H=>{H.key==="Enter"&&(H.metaKey||H.ctrlKey)&&(H.preventDefault(),j()),H.key==="Escape"&&(H.stopPropagation(),f(v.current),g([]))}}),m.length>0&&s.jsx("p",{className:"pp-note warn code-bad",role:"alert",children:d.code.bad(m.join("; "))}),w.length>0&&s.jsxs("section",{className:"pp-group code-inh","aria-label":d.code.computed,children:[s.jsx("h3",{className:"pp-group-h",children:d.code.computed}),w.map(([H,W])=>s.jsxs("div",{className:"code-row",children:[s.jsx("span",{className:"code-k",children:H}),s.jsxs("span",{className:"code-v",title:W,children:[H==="color"&&s.jsx("i",{className:"sw",style:{background:W}}),W]})]},H))]})]})})}const Rb="design-canvas:hint",im={picks:2,edits:2,sessions:3},Qd={picks:0,edits:0,sessions:0};function gw(){try{const n=JSON.parse(localStorage.getItem(Rb)??"null");return n&&typeof n=="object"?{...Qd,...n}:Qd}catch{return Qd}}let fu=typeof window>"u"?Qd:gw();const pw=new Set;function yw(n){fu=n;try{localStorage.setItem(Rb,JSON.stringify(n))}catch{}for(const o of pw)o()}const bw=n=>!n.on&&(!!n.off||n.picks>=im.picks&&n.edits>=im.edits||n.sessions>=im.sessions);function lb(n){bw(fu)||fu.on||yw({...fu,[n]:fu[n]+1})}const vw=["tools","edit","element","move","view","ai"],xw=[{id:"select",section:"tools",combos:["v"]},{id:"hand",section:"tools",combos:["h"]},{id:"board",section:"tools",combos:["b"]},{id:"title",section:"tools",combos:["t"]},{id:"note",section:"tools",combos:["n"]},{id:"rect",section:"tools",combos:["r"]},{id:"oval",section:"tools",combos:["o"]},{id:"line",section:"tools",combos:["l"]},{id:"arrow",section:"tools",combos:["a"]},{id:"penOrPlay",section:"tools",combos:["p"]},{id:"undo",section:"edit",combos:["cmd+z"]},{id:"redo",section:"edit",combos:["cmd+shift+z","cmd+y"]},{id:"copy",section:"edit",combos:["cmd+c"]},{id:"paste",section:"edit",combos:["cmd+v"]},{id:"duplicate",section:"edit",combos:["cmd+d"]},{id:"delete",section:"edit",combos:["delete","backspace"]},{id:"selectAll",section:"edit",combos:["cmd+a"]},{id:"lock",section:"edit",combos:["cmd+l"]},{id:"rename",section:"edit",combos:["f2"]},{id:"front",section:"edit",combos:["cmd+]"]},{id:"back",section:"edit",combos:["cmd+["]},{id:"copyPng",section:"element",combos:["cmd+shift+c"]},{id:"copyProps",section:"element",combos:["cmd+alt+c"]},{id:"pasteProps",section:"element",combos:["cmd+alt+v"]},{id:"flipH",section:"element",combos:["shift+h"]},{id:"flipV",section:"element",combos:["shift+v"]},{id:"wrap",section:"element",combos:["cmd+g"]},{id:"reorder",section:"element",combos:["alt+arrowup","alt+arrowdown"]},{id:"enter",section:"move",combos:["enter"]},{id:"next",section:"move",combos:["tab"]},{id:"arrows",section:"move",combos:["arrowup","arrowdown","arrowleft","arrowright"]},{id:"escape",section:"move",combos:["escape"]},{id:"regions",section:"move",combos:["f6"]},{id:"zoomIn",section:"view",combos:["cmd+="]},{id:"zoomOut",section:"view",combos:["cmd+-"]},{id:"zoom100",section:"view",combos:["cmd+0"]},{id:"fitAll",section:"view",combos:["shift+1","cmd+1"]},{id:"zoomSel",section:"view",combos:["shift+2"]},{id:"guides",section:"view",combos:["ctrl+g"]},{id:"minimap",section:"view",combos:["m"]},{id:"prototype",section:"view",combos:["f"]},{id:"panel",section:"view",combos:["cmd+\\"]},{id:"clean",section:"view",combos:["cmd+shift+\\"]},{id:"ai",section:"ai",combos:["cmd+j"]},{id:"find",section:"ai",combos:["cmd+k"]},{id:"comments",section:"ai",combos:["alt+c"]}],ww={arrowup:"↑",arrowdown:"↓",arrowleft:"←",arrowright:"→",escape:"Esc",enter:"↵",tab:"Tab",delete:"⌦",backspace:"⌫",f2:"F2",f6:"F6","=":"+"};function jw(n,o){const r=n.split("+"),f=n.endsWith("+")?"+":r[r.length-1],m=g=>r.slice(0,-1).includes(g);return`${m("ctrl")?"⌃":""}${m("alt")?"⌥":""}${m("shift")?"⇧":""}${m("cmd")?o:""}${ww[f]??f.toUpperCase()}`}const Nw=400,ut=navigator.platform.includes("Mac")?"⌘":"Ctrl+",sb=1200,cm=7,Sw=120,Jo=335,ef=n=>`design-canvas:${n}`;function kw(n){try{return JSON.parse(sessionStorage.getItem(ef(n))??localStorage.getItem(ef(n))??"{}")}catch{return{}}}const ob=[{id:"blank",label:d.templates.blank,size:"390×844",w:390,h:844,group:0},{id:"watch",label:d.templates.watch,size:"198×242",w:198,h:242,group:1},{id:"mobile",label:d.templates.mobile,size:"390×844",w:390,h:844,group:1},{id:"tablet",label:d.templates.tablet,size:"834×1194",w:834,h:1194,group:1},{id:"desktop",label:d.templates.desktop,size:"1440×900",w:1440,h:900,group:1},{id:"doc",label:d.templates.doc,size:"800×1000",w:800,h:1e3,group:2},{id:"email",label:d.templates.email,size:"600×1200",w:600,h:1200,group:2}],Wo=[{id:"select",icon:"select",label:d.tools.select,hint:d.toolHints.select,key:"V"},{id:"hand",icon:"hand",label:d.tools.hand,hint:d.toolHints.hand,key:"H"},{id:"board",icon:"board",label:d.tools.board,hint:d.toolHints.board,key:"B"},{id:"title",icon:"title",label:d.tools.title,hint:d.toolHints.title,key:"T"},{id:"sticky",icon:"sticky",label:d.tools.sticky,hint:d.toolHints.sticky,key:"N"},{id:"rect",icon:"rect",label:d.tools.rect,hint:d.toolHints.rect,key:"R"},{id:"oval",icon:"oval",label:d.tools.oval,hint:d.toolHints.oval,key:"O"},{id:"line",icon:"line",label:d.tools.line,hint:d.toolHints.line,key:"L"},{id:"arrow",icon:"arrow",label:d.tools.arrow,hint:d.toolHints.arrow,key:"A"},{id:"pen",icon:"pen",label:d.tools.pen,hint:d.toolHints.pen,key:"P"}],Tw=["rect","oval","line","arrow","pen"];function Cw(){var pc,Ni,bl,Ie,Rt,wn,Si,io,bs,ki,Bo,co,Xu,sn,yc,bc,$r,Or,Ku,vc,xc,wc;const[n,o]=b.useState(null),[r,f]=b.useState(null),m=h0({x:0,y:0,zoom:.1}),g=m.set,[v,S]=b.useState(null),[j,E]=b.useState("select"),[x,w]=b.useState([]),[M,z]=b.useState([]),H=M.length===1?M[0]:null,W=c=>z(c?[c]:[]),[T,_]=b.useState(null),[I,X]=b.useState(null),[ne,ee]=b.useState(null),[ie,le]=b.useState(null),he=b.useRef(null),[ce,ge]=b.useState(null),[xe,Ze]=b.useState(null),Ne=b.useRef(new Set),[xt,et]=b.useState([]),[me,je]=b.useState(!1),[Ce,Ue]=b.useState(""),[fe,re]=b.useState(null),[Fe,dt]=b.useState(null),[R,Y]=b.useState("fit"),[ue,pe]=b.useState(0),[$e,Re]=b.useState(!0),[G,de]=b.useState(()=>({w:window.innerWidth,h:window.innerHeight}));b.useEffect(()=>{const c=()=>de({w:window.innerWidth,h:window.innerHeight});return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]);const be=G.w<=1e3,_t=G.w<=480,Ve=G.w<=sb,Qt=36,Ut=Ve?32:36,at=_t?8:12,Ge=at+40+8,on=b.useRef(!0),[It,Vn]=b.useState(!1),lt=G,[Rn,D]=b.useState(null),[K,ae]=b.useState(!0),[Me,De]=b.useState(null),[We,ft]=b.useState(0);b.useLayoutEffect(()=>{if(!Me)return;const c=()=>ft(Math.round(Me.getBoundingClientRect().bottom));c();const h=new ResizeObserver(c);return h.observe(Me),()=>h.disconnect()},[Me,lt.w,lt.h]);const[pt,an]=b.useState(0),[Pt,Xt]=b.useState(0),Dn=b.useCallback((c,h)=>{an(c),Xt(h)},[]),[Qe,Sn]=b.useState(0),Wt=b.useRef(null),[tt,wt]=b.useState(!1);b.useLayoutEffect(()=>{var N;const c=((N=document.querySelector(".oc .oc-dock"))==null?void 0:N.offsetWidth)??0;c!==Qe&&Sn(c);const h=Wt.current,p=!!h&&[...document.querySelectorAll(".oc .etb.oc-anchored, .oc .canvas-hint, .oc .oc-ask, .oc .oc-result")].some(k=>{const $=k.getBoundingClientRect();return $.width>0&&$.left<h.right+8&&$.right>h.left-8&&$.top<h.bottom+8&&$.bottom>h.top-8});p!==tt&&wt(p)});const[Ct,Nt]=b.useState(null),[ll,sl]=b.useState({canUndo:!1,canRedo:!1,undo:[],redo:[]}),[po,ei]=b.useState({}),[ha,ol]=b.useState({}),[ta,Na]=b.useState({}),cn=c=>h=>({...h,[c]:(h[c]??0)+1}),ma=b.useRef(a1()).current,Wl=b.useRef(()=>{});Wl.current=(c,h,p=!1)=>{const N=ct.current.get(c),k=ma.decide(c,h,{shown:Nb(N,c),patched:Ly(N,c)},p);if(!(k==="queue"||k==="keep")){if(k==="check")return void Te.get(`/api/file-hash?f=${encodeURIComponent(c)}`).then($=>Wl.current(c,$.hash,!0)).catch(()=>Wl.current(c,void 0));ma.reset(c),ei(cn(c))}};const[zs,es]=b.useState(null),[Va,$s]=b.useState(null),[en,ts]=b.useState([]),jt=v1(),[Bi,yu]=b.useState(null),[Ht,za]=b.useState(null),A=b.useRef(null),[P,Be]=b.useState(null),[ye,ke]=b.useState(null),ht=b.useRef(null),[qe,rn]=b.useState(null),[na,Et]=b.useState(!1),[it,yn]=b.useState("inspect"),[Os,Kc]=b.useState(""),[sf,bu]=b.useState({comments:[],refs:[]}),[ti,ni]=b.useState({}),Rs=b.useRef(new Set),Hi=b.useCallback(c=>(Rs.current.add(c),()=>void Rs.current.delete(c)),[]),ns=b.useRef(null),as=b.useRef(0),[Sa,il]=b.useState("boards"),[zn,vu]=b.useState(0),[ai,ls]=b.useState(null),[un,ga]=b.useState([]),Ds=un.length===1?un[0]:null,Zc=c=>ga(c?[c]:[]),[Fc,xu]=b.useState(0),Ye=l1(Fc),[Nl,li]=b.useState(()=>{try{return localStorage.getItem("design-canvas:author")??""}catch{return""}});b.useEffect(()=>{Nl||Te.get("/api/me").then(c=>c.name&&li(c.name)).catch(()=>{})},[]),b.useEffect(()=>jx(Nl),[Nl]);const cl=Nl||d.app.defaultAuthor,[Zn,aa]=b.useState(null),[Sl,wu]=b.useState(null),si=b.useRef(null),Qc=b.useRef(()=>{}),[ju,ka]=b.useState(!0),[Bs,Nu]=b.useState(()=>{try{return localStorage.getItem("design-canvas:theme")||"system"}catch{return"system"}});b.useEffect(()=>{Bs==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",Bs);try{localStorage.setItem("design-canvas:theme",Bs)}catch{}},[Bs]);const[Hs,pa]=b.useState(null),Ls=b.useRef(!1),ct=b.useRef(new Map),[Ga,of]=b.useState(0),Pc=Dw(),Li=b.useRef(null),ve=vb(),la=U0();b.useEffect(()=>{let c=!1;const h="design-canvas:update-seen";return Te.update().then(({update:p})=>{if(c||!p)return;try{if(localStorage.getItem(h)===p.latest)return}catch{}const N=()=>{try{localStorage.setItem(h,p.latest)}catch{}};ve({dot:!0,text:d.update.out(p.latest),code:p.command,ms:12e3,action:{label:d.update.copy,run:()=>(N(),void navigator.clipboard.writeText(p.command).then(()=>ve({tone:"ok",text:d.update.copied})))},close:{label:d.update.hide,run:N}})}).catch(()=>{}),()=>void(c=!0)},[ve]);const cf=b.useCallback(c=>ct.current.get(c)??null,[Ga]),ss=b.useRef(null),dn=b.useRef(null);dn.current=r;const _s=b.useRef(null),ln=b.useCallback(async()=>{try{const c=await Te.board();o(c),Na(c.stamps??{}),f(h=>Bw(h,c.board)),es(null)}catch(c){es(String(c.message))}},[]),rl=b.useCallback(()=>Te.get("/api/comments").then(c=>ts(c.comments)).catch(()=>{}),[]),Gn=b.useCallback(()=>Te.get("/api/history").then(sl).catch(()=>{}),[]),oi=b.useCallback(()=>Te.get("/api/errors").then(c=>ni(h=>JSON.stringify(h)===JSON.stringify(c.errors)?h:c.errors)).catch(()=>{}),[]),zt=Lx((n==null?void 0:n.dir)??null),[Kt,$a]=b.useState(null),[Yn,_i]=b.useState(null),[os,kl]=b.useState(!1),[ul,Ui]=b.useState({}),[dl,Ya]=b.useState(null),[qi,Jc]=b.useState(!1),Fn=b.useRef(null),Tl=b.useRef(null),ii=b.useRef(null),Us=b.useRef(null);b.useLayoutEffect(()=>{var _n,Ho;Il(Tl.current),Il(ii.current),Il(Us.current);const c=Us.current,h=c==null?void 0:c.querySelector(".oc-cmts");if(!c||!h)return;const p=[...c.children].filter(Mt=>Mt.getClientRects().length).pop();if(!p||!h.getClientRects().length)return;const N=Math.ceil(p.getBoundingClientRect().right-h.getBoundingClientRect().left),k=((_n=c.closest(".oc-right.is-rest"))==null?void 0:_n.offsetWidth)??0;k!==Ic&&Wc(k);const $=document.querySelector(".oc-left .oc-head"),L=$==null?void 0:$.closest(".oc-left");if(!$||!L)return;const te=(Mt,ro)=>[...Mt.children].filter(Ti=>Ti.getClientRects().length).pop().getBoundingClientRect().right-Mt.getBoundingClientRect().left+parseFloat(getComputedStyle(Mt).paddingRight)-ro.getBoundingClientRect().width,Ae=(Mt,ro)=>{const Pa=Mt==null?void 0:Mt.querySelector(ro);return Mt&&Pa?Math.ceil(te(Mt,Pa)+Math.max(Pa.scrollWidth,Pa.getBoundingClientRect().width)):0},Ee=$.querySelector(".oc-project"),_e=$.querySelector(".oc-page"),yt=((Ee==null?void 0:Ee.getBoundingClientRect().width)??0)+((_e==null?void 0:_e.getBoundingClientRect().width)??0),qt=(Mt,ro)=>{const Pa=Mt==null?void 0:Mt.querySelector(ro);if(!Mt||!Pa)return 0;const Ti=[...Pa.textContent??""];let yf=0;const Rr=Ti.findIndex(Zu=>/\S/.test(Zu)&&++yf>4);if(Rr<0)return Ae(Mt,ro);const xs=er.current??(er.current=document.createElement("canvas").getContext("2d"));return xs?(xs.font=getComputedStyle(Pa).font,Math.ceil(te(Mt,Pa)+xs.measureText(Ti.slice(0,Rr).join("").trimEnd()+"…").width)):0},jn=qt(Ee,".app-title"),On=qt(_e,".oc-page-name");Ee&&Ee.style.minWidth!==`${jn}px`&&(Ee.style.minWidth=`${jn}px`),_e&&_e.style.minWidth!==`${On}px`&&(_e.style.minWidth=`${On}px`);const ja=Mt=>Mt<2?Math.min(Ae(Ee,".app-title"),Sw)+Ae(_e,".oc-page-name"):Mt<6?jn+On:On,Kl=(((Ho=[...$.children].filter(Mt=>Mt.getClientRects().length).pop())==null?void 0:Ho.getBoundingClientRect().right)??0)-$.getBoundingClientRect().left+parseFloat(getComputedStyle($).paddingRight)-yt,Xe=L.classList.contains("is-collapsed"),Ft=Math.ceil(Kl+Math.min(200,Ae(Ee,".app-title"))+Ae(_e,".oc-page-name"));Ft!==Vi&&rf(Ft);const rt=Mt=>Mt>=cm?1/0:Math.min(fe?1/0:Jo-4-16,G.w-at*2-8-8-(Xe?Kl+ja(Mt):L.offsetWidth)),ia=[G.w,Xe,fe,r==null?void 0:r.title,hn,ys,kt].join("|");if(ia!==ku.current&&(ku.current=ia,Xa!==0))return Su(0);N>rt(Xa)&&Xa<cm&&Su(Xa+1)});const[Ic,Wc]=b.useState(0),[ci,yo]=b.useState([]),qs=()=>Te.get("/api/projects").then(c=>yo(c.projects),()=>yo([]));b.useEffect(()=>(qs(),window.addEventListener("focus",qs),()=>window.removeEventListener("focus",qs)),[]);const[Xa,Su]=b.useState(0),ku=b.useRef(""),er=b.useRef(null),[Vi,rf]=b.useState(240);b.useEffect(()=>{ln(),rl(),Gn(),oi()},[ln,rl,Gn,oi]),b.useEffect(()=>{document.title=r!=null&&r.title?d.app.docTitle(r.title):d.app.title},[r==null?void 0:r.title]),b.useEffect(()=>{const c=new Map,h=N=>{const k=c.get(N);window.clearTimeout(k.t),k.t=window.setTimeout(()=>void Te.put("/api/errors",{file:N,errors:k.list}).catch(()=>{}),200)},p=N=>{const k=N.data;if(!k||k.type!=="dc-error"||typeof k.file!="string")return;if(k.start)return void c.set(k.file,{list:[],loaded:!1});const $=c.get(k.file)??{list:[],loaded:!0};if(c.set(k.file,$),k.loaded)return $.loaded=!0,h(k.file);$.list.length<20&&!$.list.some(L=>L.message===k.message)&&$.list.push({kind:k.kind,message:k.message,line:k.line}),$.loaded&&h(k.file)};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[]);const bn=b.useCallback((c,h)=>{const p=dn.current;if(!p)return;const N=c(p);if(dn.current=N,f(N),!h)return;_s.current&&window.clearTimeout(_s.current);const k=()=>(as.current++,Te.saveBoard(dn.current,h==="draft"?void 0:h).catch($=>ve({tone:"error",text:d.toast.saveFailed($.message)})).finally(()=>as.current--));h==="draft"?_s.current=window.setTimeout(()=>{_s.current=null,k()},Nw):k()},[ve]),fl=b.useCallback(async c=>{try{const h=await Te.post(`/api/history/${c}`,{});h.label?ve({text:d.toast.undoRedoDone(c,d.activity.stepName(h.label))}):ve({text:c==="undo"?d.toast.nothingToUndo:d.toast.nothingToRedo}),await ln()}catch(h){ve({tone:"error",text:String(h.message)})}Gn()},[ve,ln,Gn]),kn={label:d.toast.undoAction,run:()=>void fl("undo")},fn=b.useCallback(async(c,h=T)=>{var p;if(!h)return!1;ma.begin(h);try{const N=await Te.post("/api/edit",{file:h,...c});return N.base&&N.hash&&n1(ct.current.get(h),h,N)&&(ma.patched(h,N.base,N.hash),ol(cn(h))),!0}catch(N){return(p=ss.current)==null||p.setError(String(N.message)),ve({tone:"error",text:String(N.message)}),!1}finally{for(const N of ma.end(h))Wl.current(h,N)}},[T,ve,ma]),tr=b.useCallback((c,h,p)=>{var Kl,Xe,Ft;if(Array.from(h.children).some(rt=>rt.tagName!=="BR")){(Kl=ss.current)==null||Kl.setError(d.toast.textOnly);return}const N=h.innerText??"";lb("edits"),X(c);const k=h.getAttribute("contenteditable");h.contentEditable="true",h.focus();const $=h.ownerDocument,L=$.createRange();L.selectNodeContents(h),(Xe=$.getSelection())==null||Xe.removeAllRanges(),(Ft=$.getSelection())==null||Ft.addRange(L);const te=rt=>{if(h.contains(rt.target))return void(rt.type==="click"&&rt.preventDefault());rt.preventDefault(),rt.stopPropagation(),rt.type==="mousedown"&&h.blur()};$.addEventListener("mousedown",te,!0),$.addEventListener("click",te,!0);let Ae=!1;const Ee=async()=>{var _n;h.removeEventListener("keydown",_e),$.removeEventListener("mousedown",te,!0),$.removeEventListener("click",te,!0),k==null?h.removeAttribute("contenteditable"):h.setAttribute("contenteditable",k),X(null),document.activeElement===((_n=$.defaultView)==null?void 0:_n.frameElement)&&ib();const rt=(h.innerText??"").replace(/\n$/,"");if(Ae||rt===N){Ae&&(h.innerText=N);return}const ia=await Oa(c,p);await fn({op:"setText",path:p,hash:ia,text:rt},c)||(h.innerText=N)},_e=rt=>{rt.isComposing||rt.keyCode===229||(rt.key==="Enter"&&!rt.shiftKey?(rt.preventDefault(),h.blur()):rt.key==="Escape"&&(Ae=!0,h.blur()))};let yt=!1,qt=!1;const jn=()=>yt=!0,On=()=>{yt=!1,qt&&ja()},ja=()=>{h.removeEventListener("compositionstart",jn),h.removeEventListener("compositionend",On),h.removeEventListener("blur",vs),Ee()},vs=()=>{yt?qt=!0:ja()};h.addEventListener("compositionstart",jn),h.addEventListener("compositionend",On),h.addEventListener("keydown",_e),h.addEventListener("blur",vs)},[fn]),Oa=(c,h)=>Te.get(`/api/element?f=${encodeURIComponent(c)}&path=${encodeURIComponent(h)}`).then(p=>(p.fileHash&&Ly(ct.current.get(c),c)&&Wl.current(c,p.fileHash,!0),p.hash)),Tu=async(c,h)=>{var N;if(!T)return;const p=await Oa(T,c);await fn({op:"move",path:c,hash:p,...h})&&((N=ss.current)==null||N.select([Ew(c,h.toParentPath,h.index)]),ve({text:h.freeze.length?d.toast.movedFrozen:d.toast.moved,action:kn}))},Cu=async()=>{var p;const c=we.state.selection;if(!T||!c)return;const{source:h}=await Te.get(`/api/element?f=${encodeURIComponent(T)}&path=${encodeURIComponent(c.path)}&full=1`);try{localStorage.setItem("design-canvas:clip",JSON.stringify({source:h,file:T,path:c.path,tag:c.tag}))}catch{}await((p=navigator.clipboard)==null?void 0:p.writeText(h).catch(()=>{})),ve({tone:"ok",text:d.toast.copiedElement(c.tag,ut)})},Eu=async()=>{if(!T)return;let c=null;try{c=JSON.parse(localStorage.getItem("design-canvas:clip")??"null")}catch{c=null}if(!c)return ve({text:d.toast.nothingCopied});const h=we.state.selection,p=(h==null?void 0:h.file)===T?h.path:"";if(await fn({op:"insert",path:p,hash:p?h.hash:void 0,position:"after",html:c.source})&&(ve({tone:"ok",text:d.toast.pasted(c.file,c.tag),action:kn}),p)){const N=p.split("/");N[N.length-1]=String(Number(N[N.length-1])+1),setTimeout(()=>{var k;return void((k=ss.current)==null?void 0:k.select([N.join("/")]))},600)}},Gi=(c,h)=>ls(()=>async p=>{if(ls(null),!T)return;const N=await Oa(T,c);(h?await fn({op:"setAttr",path:c,hash:N,name:"src",value:p.ref}):await fn({op:"setStyle",path:c,hash:N,prop:"background-image",value:`url("${p.ref}")`}))&&ve({tone:"ok",text:d.toast.imageReplaced(p.name),action:kn})}),Vs=b.useRef(null),we=r0(T,cf);ss.current=we;const Mu=b.useRef(Promise.resolve()),Yi=(c,h)=>{var k;const p=T,N=(k=we.state.selection)==null?void 0:k.path;!p||!N||(Mu.current=Mu.current.then(async()=>{const $=await Oa(p,N).catch(()=>null);$&&await fn({op:"setStyle",path:N,hash:$,prop:c,value:h},p)}))};b.useEffect(()=>Nx(c=>{if(c.type==="file-changed")ol(cn(c.file)),c.stamp&&Na(h=>h[c.file]===c.stamp?h:{...h,[c.file]:c.stamp}),c.kind!=="change"?(ma.reset(c.file),ei(cn(c.file)),ln()):Wl.current(c.file,c.hash);else if(c.type==="board-changed"&&c.source!==Nm)ln(),zt.reload();else if(c.type==="comments-changed")rl();else if(c.type==="history-changed")rl(),Gn(),zt.reload();else if(c.type==="errors-changed")oi();else if(c.type==="assets-changed")vu(h=>h+1);else if(c.type==="tokens-changed")xu(h=>h+1);else if(c.type==="app-changed")window.location.reload();else if(c.type==="chat")for(const h of Rs.current)h(c.id,c.ev);else if(c.type==="hello")for(const h of Rs.current)h("",{kind:"boot",boot:c.boot});else c.type==="occupancy"?Ui(c.boards):(c.type==="requests-settings"||c.type==="agents-changed")&&jt.reload()}),[ln,rl,Gn,oi,zt.reload,jt.reload]);const Je=(r==null?void 0:r.pages)??[],hn=((pc=Je.find(c=>c.id===v))==null?void 0:pc.id)??((Ni=Je[0])==null?void 0:Ni.id)??null,Gs=b.useCallback(c=>!Je.length||(c.page??Je[0].id)===hn,[Je,hn]),St=b.useMemo(()=>r?[...new Set(r.order)].filter(c=>r.boards[c]&&Gs(r.boards[c])):[],[r,Gs]),nr=b.useMemo(()=>r?Object.keys(r.notes).filter(c=>Gs(r.notes[c])):[],[r,Gs]),Tn=Va??lt,uf=Id(m,c=>c.zoom>=.25),df=b.useCallback(c=>r?s.jsx(L1,{board:r,files:St,zoom:c}):null,[r,St]),hl=()=>{const c=at;if(It)return{x:0,y:0,w:Tn.w,h:Tn.h};const h=!Ve&&$e?c+240+c:0,p=!Ve&&Pn?Tn.w-Jo:Tn.w,N=c+Qt,k=Tn.h-Ge-Ut;return{x:h,y:N,w:p-h,h:k-N}},ff=(c,h)=>{const p=hl();g(N=>({...N,x:Math.round(p.x+p.w/2-c*N.zoom),y:Math.round(p.y+p.h/2-h*N.zoom)}))};b.useEffect(()=>{if(Ls.current||!r||!Va)return;Ls.current=!0;const c=kw(r.title);c.left!=null&&(on.current=c.left),window.innerWidth<=sb?Re(c.leftPane??!1):c.left!=null&&Re(c.left),c.minimap!=null&&ae(c.minimap);const h=r.launch;if(h!=null&&h.page?S(h.page):c.page&&S(c.page),(h==null?void 0:h.view)==="focused"&&h.file&&r.boards[h.file]&&re(h.file),c.view&&!(h!=null&&h.page))g(c.view);else if(!c.view&&r.order.length>0){const p=r.order.find(k=>r.boards[k]&&Gs(r.boards[k]))??r.order[0],N=r.boards[p];if(N){const k=Ri([N],Va,80,hl());g({...k,zoom:Math.min(k.zoom,1)}),je(!0)}else g(Ri(Object.values(r.boards),Va,60,hl()))}else g(Ri(Object.values(r.boards),Va,60,hl()));location.hash&&mr(location.hash)},[r,Va]),b.useEffect(()=>{const c=()=>mr(location.hash);return window.addEventListener("popstate",c),()=>window.removeEventListener("popstate",c)});const Au=b.useRef(null);b.useEffect(()=>{if(!r||!Ls.current)return;const c=T??(x.length===1?x[0]:null),h=fe?`#play-${encodeURIComponent(fe)}`:c?`#artboard-${encodeURIComponent(c)}`:hn&&Je.length>1?`#page-${encodeURIComponent(hn)}`:"",p=`${fe?"play":"canvas"}:${hn??""}:${fe??""}`,N=Au.current;if(Au.current={hash:h,step:p},location.hash===h||!h&&!location.hash)return;const k=`${location.pathname}${location.search}${h}`;N&&N.step!==p&&!tc.current?history.pushState(null,"",k):history.replaceState(null,"",k)},[r,hn,fe,x,T,Je.length]),b.useEffect(()=>{if(!r)return;let c=0;const h=()=>{window.clearTimeout(c),Ls.current&&(c=window.setTimeout(()=>{try{const N={view:m.get(),page:hn,left:Ve?on.current:$e,minimap:K};localStorage.setItem(ef(r.title),JSON.stringify(N)),sessionStorage.setItem(ef(r.title),JSON.stringify({...N,leftPane:Ve?$e:void 0}))}catch{}},300))};h();const p=m.subscribe(h);return()=>{p(),window.clearTimeout(c)}},[hn,$e,K,r==null?void 0:r.title,Ve]);const Xi=b.useRef(Ve);b.useEffect(()=>{if(Xi.current!==Ve){Xi.current=Ve,Ls.current&&Re(Ve?!1:on.current);return}!Ve&&Ls.current&&(on.current=$e)},[Ve,$e]),b.useEffect(()=>{if(!r)return;let c=0;const h=()=>{window.clearTimeout(c),c=window.setTimeout(()=>{var Ee;const N=m.get(),k=-N.x/N.zoom,$=-N.y/N.zoom,L=Tn.w/N.zoom,te=Tn.h/N.zoom,Ae=Fe?[Fe]:fe?[fe]:St.filter(_e=>{const yt=r.boards[_e];return yt.x<k+L&&yt.x+yt.w>k&&yt.y<$+te&&yt.y+yt.h>$});Te.put("/api/context",{mode:ce?"play":fe||Fe?"focus":T?"edit":"canvas",page:hn,pageName:((Ee=Je.find(_e=>_e.id===hn))==null?void 0:Ee.name)??null,visibleArtboards:Ae,selectedArtboards:x,dirty:as.current>0||!!_s.current}).catch(()=>{})},300)};h();const p=m.subscribe(h);return()=>{p(),window.clearTimeout(c)}},[hn,x,T,fe,Fe,ce,St,Tn.w,Tn.h]),b.useEffect(()=>{!Hs||!r||!Hs.every(c=>r.boards[c])||(w(Hs),g(Ri(Hs.map(c=>r.boards[c]),Tn,80,hl())),pa(null))},[Hs,r]);const ri=c=>({x:c.x,y:c.y,w:c.w??c.maxW??400,h:c.kind==="title"?90:200}),ui=()=>{r&&g(Ri([...St.map(c=>r.boards[c]),...nr.map(c=>ri(r.notes[c]))],Tn,60,hl()))},Cl=c=>{!r||!c.length||g(Ri(c.map(h=>r.boards[h]).filter(Boolean),Tn,80,hl()))},Ys=c=>g(h=>{const p=Xc(h.zoom*c,Tm,Cm),N=hl(),k=N.x+N.w/2,$=N.y+N.h/2;return{zoom:p,x:Math.round(k-(k-h.x)/h.zoom*p),y:Math.round($-($-h.y)/h.zoom*p)}}),Ki=c=>Ys(c/m.get().zoom);b.useEffect(()=>{if(!me)return;let c=!1;const h=window.setTimeout(()=>c=!0,1500),p=()=>c&&je(!1),N=window.setTimeout(()=>je(!1),8e3);return window.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",p,!0),()=>{window.clearTimeout(h),window.clearTimeout(N),window.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",p,!0)}},[me]);const Ka=(c,h="replace")=>{w(p=>h==="replace"?c:h==="add"?[...new Set([...p,...c])]:c.reduce((N,k)=>N.includes(k)?N.filter($=>$!==k):[...N,k],p)),h==="replace"&&_(null),c.length&&h==="replace"&&(z([]),ga([]))},bo=()=>Je.length&&hn?{page:hn}:{},El=async(c,h="blank")=>{try{const p=await Te.post("/api/boards/create",{...c,template:h,...bo()});return await ln(),w([p.file]),E("select"),ve({tone:"ok",text:d.toast.boardCreated(p.file),action:kn}),p}catch(p){return ve({tone:"error",text:d.toast.boardCreateFailed(p.message)}),null}},Zi=async c=>{if(!c.length||!r)return;const h=c.map(N=>{var k;return((k=r.boards[N])==null?void 0:k.title)??N});if(await la.confirm({title:d.dialog.deleteBoardsTitle(c.length,h[0]),body:d.dialog.deleteBoardsBody,ok:d.dialog.delete,danger:!0}))try{await Te.post("/api/boards/delete",{files:c}),T&&c.includes(T)&&_(null),w([]),await ln(),ve({text:d.toast.boardsDeleted(c.length),action:kn})}catch(N){ve({tone:"error",text:String(N.message)})}},ar=async c=>{try{const h=await Te.post("/api/boards/duplicate",{file:c});await ln(),w([h.file]),ve({tone:"ok",text:d.toast.duplicated(h.file),action:kn})}catch(h){ve({tone:"error",text:String(h.message)})}},Fi=async c=>{var N;const h=(N=dn.current)==null?void 0:N.boards[c];if(!h)return;const p=await la.prompt({title:d.dialog.renameBoardTitle,label:d.dialog.name,value:h.title??c.replace(/\.html$/,""),ok:d.dialog.rename});if(!(!p||p.value.trim()===(h.title??"")))try{await Te.post("/api/boards/rename",{file:c,title:p.value.trim()}),await ln(),ve({tone:"ok",text:d.toast.renamed,action:kn})}catch(k){ve({tone:"error",text:String(k.message)})}},lr=async c=>{const{refs:h}=await Te.get(`/api/boards/refs?file=${encodeURIComponent(c)}`).catch(()=>({refs:[]})),p=await la.prompt({title:d.dialog.renameFileTitle,label:d.dialog.fileName,value:c,hint:h.length?d.dialog.renameFileRefs(h.map(k=>k.file).join(", ")):d.dialog.renameFileNoRefs,ok:d.dialog.rename,extra:h.length?{label:d.dialog.renameFileExtra(h.reduce((k,$)=>k+($.count??1),0)),checked:!0}:void 0});if(!p)return;let N=p.value.trim();if(N.endsWith(".html")||(N+=".html"),N!==c)try{await Te.post("/api/boards/rename",{file:c,newFile:N,updateRefs:p.extra}),T===c&&_(N),w([N]),await ln(),ve({tone:"ok",text:d.toast.fileRenamed(N,!!p.extra),action:kn})}catch(k){ve({tone:"error",text:String(k.message)})}},zu=c=>{const h=hl(),p=m.get(),N=(h.x+h.w/2-p.x)/p.zoom,k=(h.y+h.h/2-p.y)/p.zoom,$=x.length===1&&(r!=null&&r.boards[x[0]])?x[0]:null,L=$?{beside:$,w:c.w,h:c.h}:{x:Math.round(N-c.w/2),y:Math.round(k-c.h/2),w:c.w,h:c.h,near:!0};El(L,c.id).then(te=>te&&g(Ri([{x:te.x,y:te.y,w:te.w,h:te.h}],Tn,80,hl())))},di=c=>Nt({x:c.clientX,y:c.clientY,up:!0,title:d.menu.newBoard,items:ob.flatMap((h,p)=>[...p&&ob[p-1].group!==h.group?["sep"]:[],{label:`${h.label} · ${h.size}`,shortcut:h.id==="blank"?d.menu.drawWithB:void 0,run:()=>zu(h)}])}),Ra=(c,h)=>{yn("chat"),ml(!0),h!=null&&h.length&&w(h),c!=null&&Kc(c),setTimeout(()=>{var p;return(p=ns.current)==null?void 0:p.focus()},0)},vo=()=>{const c=we.state.selection;if(!T||!c||c.file!==T)return null;const h=d.inspector.kindName(c.kind??c.tag);return{file:T,path:c.path,kind:"element",label:c.label?`${h} “${c.label.slice(0,40)}”`:h}},Ta=(c,h="board",p,N)=>{var k,$;return{file:c,path:"",kind:h,label:h==="board"?((k=r==null?void 0:r.boards[c])==null?void 0:k.title)??c:`${(($=r==null?void 0:r.boards[c])==null?void 0:$.title)??c} · ${d.requests.kind[h]}`,...p?{text:p}:{},...N&&N.length>1?{boards:N}:{}}},Za=(c,h)=>{if(jt.host)return sr(c);if(jt.ready&&!jt.settings.intro&&b1()&&jt.agents.some(p=>p.here))return void rn({target:c,chat:h});h()},sr=c=>{rn(null),typeof c=="function"?c():Xs(c)},Xs=c=>{var te;if(ke(null),(te=ht.current)==null||te.check(),c&&c.kind==="element")return za({kind:"element",file:c.file,path:c.path,about:c.label,target:c});if(c)return za({kind:"board",file:c.file,about:c.label,target:c});const h=m.get(),p=-h.x/h.zoom,N=-h.y/h.zoom,k=Tn.w/h.zoom,$=Tn.h/h.zoom,L=St.filter(Ae=>{const Ee=r.boards[Ae];return Ee.x<p+k&&Ee.x+Ee.w>p&&Ee.y<N+$&&Ee.y+Ee.h>N});za({kind:"canvas",about:d.inline.visible(L.length),target:L.length?Ta(L[0],"board",void 0,L):null})},or=async(c,h)=>{if(jt.host){const k=c.target??(St[0]?Ta(St[0],"board",void 0,St):null);if(!k)return d.app.emptyPage;try{return await Te.post("/api/requests",{action:"create",file:k.file,path:k.path,text:h,author:cl,attach:{kind:k.kind,label:k.label,...k.boards?{boards:k.boards}:{}}}),za(null),ve({tone:"ok",text:d.requests.added}),null}catch($){return $.message}}const p=ht.current;if(!p)return"";const N=await p.send(h);return"error"in N?N.error:(A.current={id:N.id,at:c},Be({id:N.id,at:c}),za(null),null)},$u=c=>{var h;((h=A.current)==null?void 0:h.id)===c.id&&(ke({...c,at:A.current.at}),Be(null),A.current=null)},xo=c=>ve({tone:"error",text:c.message}),Qi=c=>{bu(h=>({...h,comments:h.comments.some(p=>p.id===c.id)?h.comments:[...h.comments,{id:c.id,text:c.text,file:c.file}]})),Ra(Os||d.prompts.fixComment,[c.file])},Ou=c=>void Te.post("/api/requests",{action:"mark",id:c.id,attach:{kind:c.path?"element":"comment"}}).then(()=>ve({tone:"ok",text:d.requests.added})).catch(xo),ir={onCancel:c=>void Te.post("/api/requests",{action:"cancel",id:c.id}).then(()=>ve({text:d.requests.cancelled})).catch(xo),onChat:c=>void Te.post("/api/requests",{action:"chat",id:c.id}).then(()=>{Et(!0),Qi(c)}).catch(xo),onRetry:c=>void Te.post("/api/requests",{action:"retry",id:c.id}).catch(xo),undoFor:c=>{var k,$,L;const h=c.request,p=(k=h==null?void 0:h.changed)==null?void 0:k[0];if(!h||!p||($=h.steps)!=null&&$.length&&h.undo!=="ready")return null;if((L=h.steps)!=null&&L.length)return()=>void Te.post("/api/history/undo-steps",{ids:h.steps}).then(async()=>{var te;ve({text:d.toast.undoRedoDone("undo",h.steps.length===1?((te=r==null?void 0:r.boards[p])==null?void 0:te.title)??p:d.activity.changes(h.steps.length)),action:{label:d.toolbar.redo,run:()=>void fl("redo")}}),await ln(),Gn(),zt.reload()}).catch(xo);const N=zt.tagsOf(p).find(te=>h.by?te.by===h.by:te.outside);return N?()=>{pa([p]),window.setTimeout(()=>qu(p,N.key),450)}:null},onBoard:c=>{w([c]),pa([c])},titleOf:c=>{var h;return((h=r==null?void 0:r.boards[c])==null?void 0:h.title)??c},connected:jt.agents.length},Ru=c=>{const h=d.prompts.fixErrors(c.map(N=>`- ${N}: ${(ti[N]??[{message:n!=null&&n.missing.includes(N)?d.menu.fileMissing:d.prompts.error}])[0].message}`).join(`
70
+ `)),p=c.filter(N=>r==null?void 0:r.boards[N]);Za(p.length?Ta(p[0],"errors",h,p):null,()=>Ra(h,p))},is=(c,h)=>bn(p=>{const N=p.order.filter($=>!c.includes($)),k=p.order.filter($=>c.includes($));return{...p,order:h==="front"?[...N,...k]:[...k,...N]}},h==="front"?d.history.front:d.history.back),hf=(c,h,p=d.history.boardOptions)=>bn(N=>{const k={...N.boards[c],...h};for(const $ of Object.keys(k))k[$]===void 0&&delete k[$];return{...N,boards:{...N.boards,[c]:k}}},p),Qn=(c,h,p,N=x,k=M,$=un)=>({...c,boards:{...c.boards,...Object.fromEntries(N.filter(L=>c.boards[L]).map(L=>[L,{...c.boards[L],x:c.boards[L].x+h,y:c.boards[L].y+p,autoPlaced:void 0}]))},notes:{...c.notes,...Object.fromEntries(k.filter(L=>c.notes[L]).map(L=>[L,{...c.notes[L],x:c.notes[L].x+h,y:c.notes[L].y+p}]))},shapes:{...c.shapes??{},...Object.fromEntries($.filter(L=>{var te;return(te=c.shapes)==null?void 0:te[L]}).map(L=>[L,{...c.shapes[L],x:c.shapes[L].x+h,y:c.shapes[L].y+p}]))}}),fi=(c,h)=>bn(p=>Qn(p,c,h,x.filter(N=>{var k;return!((k=p.boards[N])!=null&&k.locked)}),M.filter(N=>{var k;return!((k=p.notes[N])!=null&&k.locked)})),x.length?d.history.moveBoard:M.length?d.history.moveNote:d.history.moveShape),Pi=()=>{var h;let c="";do c=`n${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;while((h=dn.current)!=null&&h.notes[c]);return c},Ji=(c,h)=>{var $;if(Object.keys((($=dn.current)==null?void 0:$.notes)??{}).length>=ky)return ve({tone:"error",text:d.toast.notesMax(ky)});const p=Pi(),N=Math.round(h.x),k=Math.round(h.y);bn(L=>({...L,notes:{...L.notes,[p]:c==="title"?{kind:c,x:N,y:k,text:d.defaults.newTitle,maxW:2e3,...bo()}:{kind:c,x:N,y:k,text:d.defaults.note,w:400,...bo()}}}),c==="title"?d.history.addTitle:d.history.addNote),W(p),w([]),E("select")},wo=c=>{bn(h=>{const p={...h.notes};for(const N of c)delete p[N];return{...h,notes:p}},d.history.deleteNote),z([]),ve({text:d.toast.noteDeleted,action:kn})},Ml=(r==null?void 0:r.shapes)??{},cr=b.useMemo(()=>Object.keys(Ml).filter(c=>Gs(Ml[c])).sort((c,h)=>(Ml[c].z??0)-(Ml[h].z??0)||(c<h?-1:1)),[Ml,Gs]),Ii=(c,h=d.history.addShape)=>{var k,$,L;let p="";do p=`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;while(($=(k=dn.current)==null?void 0:k.shapes)!=null&&$[p]);const N=Math.max(0,...Object.values(((L=dn.current)==null?void 0:L.shapes)??{}).map(te=>te.z??0))+1;return bn(te=>({...te,shapes:{...te.shapes??{},[p]:{...c,z:N,...bo()}}}),h),Zc(p),w([]),W(null),E("select"),p},Du=(c,h,p)=>bn(N=>({...N,shapes:{...N.shapes??{},[c]:{...N.shapes[c],...h}}}),p),Al=c=>{bn(h=>{const p={...h.shapes??{}};for(const N of c)delete p[N];return{...h,shapes:p}},d.history.deleteShape),ga([]),ve({text:c.length===1?d.toast.shapeDeleted:d.toast.shapesDeleted(c.length),action:kn})},jo=(c,h)=>{var N;const p=Object.values(((N=dn.current)==null?void 0:N.shapes)??{}).map(k=>k.z??0);Du(c,{z:h==="front"?Math.max(0,...p)+1:Math.min(0,...p)-1},h==="front"?d.history.shapeFront:d.history.shapeBack)},cs=(c,h)=>{const p=new Image;p.onload=()=>{const N=Math.min(1,600/Math.max(p.naturalWidth,p.naturalHeight)),k=Math.round(p.naturalWidth*N)||300,$=Math.round(p.naturalHeight*N)||200,L=m.get(),te=h??{x:(Tn.w/2-L.x)/L.zoom-k/2,y:(Tn.h/2-L.y)/L.zoom-$/2};Ii({kind:"image",x:Math.round(te.x),y:Math.round(te.y),w:k,h:$,src:c.ref},d.history.addImage)},p.onerror=()=>ve({tone:"error",text:d.toast.imageReadFailed}),p.src=c.url};b.useEffect(()=>{const c=async h=>{var N,k,$;if(T||(k=(N=h.target)==null?void 0:N.closest)!=null&&k.call(N,"input,textarea,[contenteditable=true]"))return;const p=Array.from((($=h.clipboardData)==null?void 0:$.files)??[]).filter(L=>L.type.startsWith("image/"));if(p.length){h.preventDefault();try{const[L]=await gm(p.map(te=>te.name?te:new File([te],d.defaults.pastedImage,{type:te.type})));cs(L)}catch(L){ve({tone:"error",text:String(L.message)})}}};return window.addEventListener("paste",c),()=>window.removeEventListener("paste",c)});const rr=async(c,h)=>{var k,$;let p=Math.round(h.x);const N=[];for(const L of c)try{if(/\.html?$/i.test(L.name)){const te=await L.text(),Ae=te.match(/<meta[^>]+name=["']board-size["'][^>]+content=["'](\d+)x(\d+)/i),Ee=Ae?Number(Ae[1]):390,_e=Ae?Number(Ae[2]):844,yt=(($=(k=te.match(/<title>([^<]*)<\/title>/i))==null?void 0:k[1])==null?void 0:$.trim())||L.name.replace(/\.html?$/i,""),qt=L.name.toLowerCase().replace(/\.htm$/,".html").replace(/[^a-z0-9._-]+/g,"-"),jn=await Te.post("/api/boards/create",{file:qt,html:te,title:yt,x:p,y:Math.round(h.y),w:Ee,h:_e,...bo()});N.push(jn.file),p+=Ee+80}else if(L.type.startsWith("image/")){const[te]=await gm([L]);cs(te,{x:p,y:h.y}),p+=400}else ve({tone:"error",text:d.toast.importOnly(L.name)})}catch(te){ve({tone:"error",text:`${L.name}: ${te.message}`})}N.length&&(await ln(),pa(N),ve({tone:"ok",text:d.toast.imported(N.length),action:kn}))},ur=async c=>{var p;if(!r)return;const h=await la.prompt({title:d.dialog.renameGroupTitle,label:d.dialog.name,value:((p=r.groupNames)==null?void 0:p[c])??c,ok:d.dialog.save});h!=null&&h.value.trim()&&bn(N=>({...N,groupNames:{...N.groupNames??{},[c]:h.value.trim()}}),d.history.renameGroup)},Da=async(c,h)=>{try{const p=await Te.post("/api/pages",c);return await ln(),h&&ve({tone:"ok",text:h,action:kn}),p}catch(p){return ve({tone:"error",text:String(p.message)}),null}},Ks=async()=>{if(Je.length>=40)return ve({tone:"error",text:d.toast.pagesMax});const c=await la.prompt({title:d.dialog.newPageTitle,label:d.dialog.name,value:d.dialog.newPageName(Math.max(Je.length,1)+1),ok:d.dialog.create});if(!(c!=null&&c.value.trim()))return;const h=await Da({action:"add",name:c.value.trim()});h!=null&&h.id&&S(h.id)},dr=async c=>{const h=Je.find(N=>N.id===c),p=await la.prompt({title:d.dialog.renamePageTitle,label:d.dialog.name,value:(h==null?void 0:h.name)??"",ok:d.dialog.rename});!(p!=null&&p.value.trim())||p.value.trim()===(h==null?void 0:h.name)||await Da({action:"rename",id:c,name:p.value.trim()})},Bu=async c=>{const h=Je.find(N=>N.id===c),p=Object.values((r==null?void 0:r.boards)??{}).filter(N=>{var k;return(N.page??((k=Je[0])==null?void 0:k.id))===c}).length;await la.confirm({title:d.dialog.deletePageTitle((h==null?void 0:h.name)??""),body:d.dialog.deletePageBody(p),ok:d.dialog.delete,danger:!0})&&(hn===c&&S(null),await Da({action:"delete",id:c},d.toast.pageDeleted))},zl=(c,h)=>void Da({action:"move",id:c,index:h}),fr=(c,h)=>{var N,k;const p=Je.findIndex($=>$.id===c);Nt({x:h.clientX,y:h.clientY,title:(N=Je[p])==null?void 0:N.name,items:[{label:d.toolbar.copyPageLink,run:()=>void ec(Wi("page",c))},{label:d.menu.rename,run:()=>void dr(c)},{label:d.menu.moveUp,disabled:p<=0,run:()=>zl(c,p-1)},{label:d.menu.moveDown,disabled:p>=Je.length-1,run:()=>zl(c,p+1)},{label:((k=r==null?void 0:r.launch)==null?void 0:k.page)===c?d.menu.unsetLaunchPage:d.menu.setLaunchPage,run:()=>bn($=>{var L;return{...$,launch:{...$.launch??{view:"canvas"},page:((L=$.launch)==null?void 0:L.page)===c?void 0:c}}},d.history.launchPage)},...x.length?[{label:d.menu.moveSelectedToPage(x.length),run:()=>bn($=>({...$,boards:{...$.boards,...Object.fromEntries(x.map(L=>{var te;return[L,{...$.boards[L],page:c===((te=Je[0])==null?void 0:te.id)?void 0:c}]}))}}),d.history.moveToPage)}]:[],"sep",{label:d.menu.delete,danger:!0,disabled:Je.length<=1,run:()=>void Bu(c)}]})},No=async c=>{if(Ne.current.has(c))return;Ne.current.add(c),et([...Ne.current]);const h=Py(c);ve({text:d.toast.pngExporting(h)});try{const p=await Te.blob("/api/screenshot",{file:c,inline:!0}),N=URL.createObjectURL(p),k=document.createElement("a");k.href=N,k.download=h,document.body.append(k),k.click(),k.remove(),setTimeout(()=>URL.revokeObjectURL(N),1e4),ve({tone:"ok",text:d.toast.pngExported(h)})}catch(p){const N=p;am(N.status,N.message)==="browser"?ve({tone:"error",text:d.toast.pngNeedsBrowser,code:"npx playwright install chromium",ms:1e4}):ve({tone:"error",text:d.toast.pngFailed(lm(N.message))})}finally{Ne.current.delete(c),et([...Ne.current])}},hr=b.useRef(new WeakMap),mf=b.useCallback(c=>{var N;const h=(N=ct.current.get(c))==null?void 0:N.contentDocument;if(!h)return!1;let p=hr.current.get(h);return p===void 0&&(p=!!mu(h),h.readyState==="complete"&&hr.current.set(h,p)),p},[]),Wi=(c,h)=>`${location.origin}${location.pathname}${location.search}#${c}-${encodeURIComponent(h)}`,ec=async c=>{try{await navigator.clipboard.writeText(c),ve({tone:"ok",text:d.toast.linkCopied})}catch(h){ve({tone:"error",text:String(h.message)})}},tc=b.useRef(!1),mr=c=>{if(!r)return!1;const h=/^#(page|artboard|play)-(.+)$/.exec(c);if(!h)return!1;const p=decodeURIComponent(h[2]),N=k=>{var $,L;return(($=r.boards[k])==null?void 0:$.page)??((L=Je[0])==null?void 0:L.id)??null};return tc.current=!0,window.setTimeout(()=>tc.current=!1,0),h[1]==="page"?Je.some(k=>k.id===p)?(dt(null),re(null),S(p),!0):!1:r.boards[p]?(dt(null),S(N(p)),h[1]==="play"?(re(p),!0):(re(null),_(null),pa([p]),!0)):!1},nc=()=>{Fe&&w([Fe]),dt(null)},ya=b.useMemo(()=>r?(Je.length?Je.map(h=>h.id):[null]).map(h=>({page:h,files:r.order.filter(p=>{var N;return r.boards[p]&&(h===null||(r.boards[p].page??((N=Je[0])==null?void 0:N.id))===h)})})):[],[r,Je]),hi=c=>{Gl(),dt(null),re(c)},Ba=()=>{fe&&w([fe]),re(null)},mi=c=>{const h=ya.flatMap(k=>k.files),p=h.indexOf(fe??""),N=h[p+c];N&&re(N)},$l=c=>Nt({x:c.clientX,y:c.clientY,title:sa(d.toolbar.protoBoards,c).title,className:"proto-menu",items:[...sa(d.toolbar.protoBoards,c).items,...ya.flatMap(h=>{var p;return[...Je.length>1?[{label:((p=Je.find(N=>N.id===h.page))==null?void 0:p.name)??"",heading:!0,run:()=>{}}]:[],...h.files.map(N=>({label:r.boards[N].title??N,tip:N,check:N===fe,run:()=>re(N)}))]})]}),gi=c=>Xa===6&&r?[{label:r.title??"",shortcut:"›",aria:d.toolbar.projectMenu(r.title??""),tip:(n==null?void 0:n.dir)??r.title,run:()=>window.setTimeout(()=>ql(c),0)},"sep"]:[],sa=(c,h)=>gi(h).length?{items:[...gi(h),{label:c,heading:!0,run:()=>{}}]}:{title:c,items:[]},So=c=>{const h=St.filter(k=>{var $;return($=r.boards[k])==null?void 0:$.is_interactive}),p=St.filter(k=>{var $;return!(($=r.boards[k])!=null&&$.is_interactive)}),N=k=>({label:r.boards[k].title??k,tip:k,check:fe?k===fe:void 0,run:()=>hi(k)});Nt({x:c.clientX,y:c.clientY,right:!0,className:"play-menu oc-menu",title:d.toolbar.playMenu,items:[...h.length?[{label:d.toolbar.protoHeading,heading:!0,run:()=>{}},...h.map(N)]:[],...h.length&&p.length?["sep"]:[],...p.length?[{label:d.toolbar.staticHeading,heading:!0,run:()=>{}},...p.map(N)]:[],...St.length?[]:[{label:d.toolbar.noBoards,disabled:!0,run:()=>{}}]]})},gr=(c,h,p)=>{if(h==="export")return void No(c);if(h==="expand")return dt(c);if(h==="tweaks"){lc("tweaks"),us(!1),_(null),w([c]),z([]),ga([]),yn("inspect"),ml(!0);return}Nt({x:p.clientX,y:p.clientY,className:"play-menu",items:[{label:d.menu.playInPlace,shortcut:"P",run:()=>xe===c?$n():Ze(c)},{label:d.menu.playFullScreen,run:()=>ge(c)}]})},ko=(c=x,h=M)=>{if(!r||!c.length&&!h.length)return;const p=c.every(k=>{var $;return($=r.boards[k])==null?void 0:$.locked})&&h.every(k=>{var $;return($=r.notes[k])==null?void 0:$.locked}),N=k=>{const $={...k};return p?delete $.locked:$.locked=!0,$};bn(k=>({...k,boards:{...k.boards,...Object.fromEntries(c.filter($=>k.boards[$]).map($=>[$,N(k.boards[$])]))},notes:{...k.notes,...Object.fromEntries(h.filter($=>k.notes[$]).map($=>[$,N(k.notes[$])]))}}),p?d.history.unlock:d.history.lock)},Zs=async(c,h)=>{try{const p=await Te.blob("/api/screenshot",{file:c,path:h??"",inline:!0});await navigator.clipboard.write([new ClipboardItem({"image/png":p})]),ve({tone:"ok",text:d.toast.copiedPng})}catch(p){const N=p;ve({tone:"error",text:am(N.status,N.message)==="browser"?d.toast.pngNeedsBrowser:d.toast.pngFailed(lm(N.message))})}},pr=async c=>{const h=(await(await fetch(`/screens/${encodeURIComponent(c)}`)).text()).replace(/<script data-dc-probe[\s\S]*?<\/script>/,"");await navigator.clipboard.writeText(h),ve({tone:"ok",text:d.toast.copiedHtml})},rs=()=>{var N;const c=we.state.selection,h=T?(N=ct.current.get(T))==null?void 0:N.contentDocument:null,p=c&&h?An(h,c.path):null;if(p){try{localStorage.setItem("design-canvas:props",p.getAttribute("style")??"")}catch{}ve({tone:"ok",text:d.toast.copiedProps})}},yr=async()=>{let c=null;try{c=localStorage.getItem("design-canvas:props")}catch{}if(!(c==null||!T))for(const h of we.state.paths){const p=await Oa(T,h).catch(()=>null);p&&await fn({op:"setStyleText",path:h,hash:p,text:c},T)}},To=c=>{var te;const h=we.state.selection,p=T?(te=ct.current.get(T))==null?void 0:te.contentDocument:null,N=h&&p?An(p,h.path):null;if(!N)return;const k=c==="x"?"scaleX(-1)":"scaleY(-1)",$=N.style.transform||"",L=$.includes(k)?$.replace(k,"").trim():`${$} ${k}`.trim();Yi("transform",L)},Fs=c=>{const h=x.includes(c)?x:[c],p=h.length>1;return[{label:d.menu.selectInside,shortcut:"Enter",disabled:p,run:()=>vr(c)},{label:d.menu.focusView,shortcut:"F",disabled:p,run:()=>hi(c)},{label:d.menu.goToBoard,shortcut:"⇧2",run:()=>Cl(h)},"sep",{label:xe===c?d.menu.stopPlay:d.menu.playInPlace,shortcut:"P",disabled:p,run:()=>xe===c?$n():Ze(c)},{label:d.menu.playFullScreen,disabled:p,run:()=>ge(c)},"sep",{label:d.menu.rename,shortcut:"F2",disabled:p,run:()=>void Fi(c)},{label:d.menu.renameFile,disabled:p,run:()=>void lr(c)},{label:d.menu.duplicate,shortcut:`${ut}D`,disabled:p,run:()=>void ar(c)},{label:h.every(N=>{var k;return(k=r==null?void 0:r.boards[N])==null?void 0:k.locked})?d.menu.unlock:d.menu.lock,shortcut:`${ut}L`,run:()=>ko(h,[])},"sep",{label:d.toolbar.copyLink,disabled:p,run:()=>void ec(Wi("artboard",c))},{label:d.menu.copyPng,shortcut:`⇧${ut}C`,disabled:p||!!(n!=null&&n.missing.includes(c)),run:()=>void Zs(c)},{label:d.menu.copyHtml,disabled:p,run:()=>void pr(c)},{label:xt.includes(c)?d.menu.exportingPng:d.menu.exportPng,disabled:p||xt.includes(c)||!!(n!=null&&n.missing.includes(c)),run:()=>void No(c)},"sep",{label:d.menu.front,shortcut:`${ut}]`,run:()=>is(h,"front")},{label:d.menu.back,shortcut:`${ut}[`,run:()=>is(h,"back")},"sep",{label:d.menu.askReview,run:()=>Za(Ta(c,"review",d.prompts.review,h),()=>Ra(d.prompts.review,h))},{label:d.menu.askAI,aria:d.menu.askAIAria,shortcut:`${ut}J`,run:()=>Za(Ta(c,"board",void 0,h),()=>Xs(Ta(c,"board",void 0,h)))},...ti[c]||n!=null&&n.missing.includes(c)?[{label:d.menu.askFixErrors,run:()=>Ru([c])}]:[],"sep",{label:p?d.menu.deleteBoards(h.length):d.menu.delete,shortcut:"⌫",danger:!0,run:()=>void Zi(h)}]},gf=(c,h)=>{var p,N,k;r&&(c.type==="board"?(x.includes(c.file)||Ka([c.file]),Nt({x:h.clientX,y:h.clientY,title:((p=r.boards[c.file])==null?void 0:p.title)??c.file,items:Fs(c.file)})):c.type==="note"?(W(c.id),Nt({x:h.clientX,y:h.clientY,title:((N=r.notes[c.id])==null?void 0:N.kind)==="title"?d.menu.title:d.menu.note,items:[{label:d.menu.duplicateInFront,shortcut:`${ut}D`,run:()=>{const $=r.notes[c.id],L=Pi();bn(te=>({...te,notes:{...te.notes,[L]:{...$,x:$.x+40,y:$.y+40}}}),d.history.duplicateNote),W(L)}},{label:(k=r.notes[c.id])!=null&&k.locked?d.menu.unlock:d.menu.lock,shortcut:`${ut}L`,run:()=>ko([],[c.id])},"sep",{label:d.menu.delete,shortcut:"⌫",danger:!0,run:()=>wo([c.id])}]})):Nt({x:h.clientX,y:h.clientY,items:[{label:d.menu.newBoardHere,shortcut:"B",run:()=>void El({x:Math.round(c.x),y:Math.round(c.y),w:390,h:844})},{label:d.menu.mobileFrameHere,run:()=>void El({x:Math.round(c.x),y:Math.round(c.y)},"mobile")},{label:d.menu.titleHere,shortcut:"T",run:()=>Ji("title",c)},{label:d.menu.noteHere,shortcut:"N",run:()=>Ji("sticky",c)},"sep",{label:d.menu.selectAll,shortcut:`${ut}A`,run:()=>Ka(St)},{label:d.menu.fitAll,shortcut:"⇧1",run:ui},{label:d.menu.zoom100,shortcut:`${ut}0`,run:()=>Ki(1)},"sep",{label:d.menu.undo,shortcut:`${ut}Z`,disabled:!ll.canUndo,run:()=>void fl("undo")},{label:d.menu.redo,shortcut:`⇧${ut}Z`,disabled:!ll.canRedo,run:()=>void fl("redo")}]}))};Vs.current=(c,h)=>{var $;if(!T)return;const p=()=>Oa(T,c),N=($=ct.current.get(T))!=null&&$.contentDocument?An(ct.current.get(T).contentDocument,c):null,k=c.includes("/")?c.slice(0,c.lastIndexOf("/")):null;Nt({x:h.clientX,y:h.clientY,title:N?`<${N.tagName.toLowerCase()}>`:d.menu.element,items:[{label:d.menu.openProps,shortcut:`${ut}\\`,run:()=>{yn("inspect"),lc("props"),us(!1),Ol(!0),ml(!0)}},"sep",{label:d.menu.editText,disabled:!N||N.children.length>0,run:()=>N&&tr(T,N,c)},{label:d.menu.selectParent,shortcut:"↑",disabled:k==null,run:()=>k!=null&&void we.select([k])},...(N==null?void 0:N.tagName)==="IMG"?[{label:d.menu.replaceImage,run:()=>Gi(c,!0)}]:[],"sep",{label:d.menu.copy,shortcut:`${ut}C`,run:()=>void Cu()},{label:d.menu.pasteAfter,shortcut:`${ut}V`,run:()=>void Eu()},{label:d.menu.duplicate,shortcut:`${ut}D`,run:async()=>void fn({op:"duplicate",path:c,hash:await p()})},"sep",{label:d.menu.copyPng,shortcut:`⇧${ut}C`,run:()=>void Zs(T,c)},{label:d.menu.copyProps,shortcut:`⌥${ut}C`,run:rs},{label:d.menu.pasteProps,shortcut:`⌥${ut}V`,run:()=>void yr()},{label:d.menu.copyForAI,run:()=>void navigator.clipboard.writeText(`${T} ${c} <${N==null?void 0:N.tagName.toLowerCase()}> "${((N==null?void 0:N.textContent)??"").trim().slice(0,60)}"`).then(()=>ve({tone:"ok",text:d.toast.copied}))},"sep",{label:d.menu.flipH,shortcut:"⇧H",run:()=>To("x")},{label:d.menu.flipV,shortcut:"⇧V",run:()=>To("y")},"sep",{label:d.menu.delete,shortcut:"⌫",danger:!0,run:async()=>{await fn({op:"delete",path:c,hash:await p()})&&(we.select([]),ve({text:d.toast.elementDeleted,action:kn}))}}]})};const $n=()=>{var h,p;const c=xe;Ze(null),(p=(h=document.activeElement)==null?void 0:h.blur)==null||p.call(h),ib(),c&&(ma.reset(c),ei(cn(c)),ol(cn(c)))};b.useEffect(()=>{if(!xe)return;const c=ct.current.get(xe);if(!c)return;const h=k=>k.key==="Escape"&&ac.current();let p=null;const N=()=>{p==null||p.removeEventListener("keydown",h,!0),p=c.contentDocument,p==null||p.addEventListener("keydown",h,!0)};return N(),c.addEventListener("load",N),()=>{c.removeEventListener("load",N),p==null||p.removeEventListener("keydown",h,!0)}},[xe,Ga]);const ac=b.useRef(()=>{});ac.current=$n;const[Pn,ml]=b.useState(!1),[br,Ol]=b.useState(!1),[ba,us]=b.useState(!1),[Rl,lc]=b.useState("props"),Ca=b.useRef(0),[gl,Qs]=b.useState(!1),[va,pl]=b.useState(null),[mn,Jn]=b.useState(null),Dl=b.useRef(!1),Fa=b.useRef(Ve);b.useEffect(()=>{if(Fa.current!==Ve){Fa.current=Ve,ml(Ve?!1:Dl.current);return}Ve||(Dl.current=Pn)},[Ve,Pn]);const yl=Id(m,c=>{if(!r||!Pn||it!=="chat")return 0;const h=-c.x/c.zoom,p=-c.y/c.zoom,N=Tn.w/c.zoom,k=Tn.h/c.zoom;return St.filter($=>{const L=r.boards[$];return L.x<h+N&&L.x+L.w>h&&L.y<p+k&&L.y+L.h>p}).length}),Bl=m0(m,_t&&Pn),Hu=b.useRef(!1);b.useEffect(()=>{const c=setTimeout(()=>Hu.current=!0,1500);return()=>clearTimeout(c)},[]);const pi=b.useRef(!1),[Lu,_u]=b.useState(0);!T||((bl=we.state.selection)==null||bl.file),b.useEffect(()=>{Date.now()-Ca.current<600||(T||x.length||M.length||un.length)&&us(!1)},[T,x,M,un]),b.useEffect(()=>{be&&$e&&ml(!1)},[be,$e]),b.useEffect(()=>{be&&Pn&&Re(!1)},[be,Pn]);const vn=()=>{Ue(It?d.app.cleanOff:d.app.cleanOn),Vn(!It)},Zt=c=>{const h=[".oc-left",".canvas",".oc-right",".oc-dock"].map($=>document.querySelector($)).filter(Boolean),p=h.findIndex($=>$.contains(document.activeElement)),N=h[(p+(c?-1:1)+h.length)%h.length],k=N.matches(".canvas")?N:N.querySelector("button:not([disabled]), input, select, textarea, [tabindex]");N.matches(".canvas")&&(N.tabIndex=-1),(k??N).focus()},st=async c=>{if(!T)return;const h=[...we.state.paths].sort((N,k)=>Number(N.split("/").pop())-Number(k.split("/").pop())),p=await Promise.all(h.map(N=>Oa(T,N)));await fn({op:"wrap",paths:h,hashes:p,display:c})&&(we.select([h[0]]),ve({tone:"ok",text:d.toast.wrapped(c),action:kn}))},Hl=async(c,h)=>{try{await Te.put("/api/tokens",{...c,label:h}),xu(p=>p+1),ve({tone:"ok",text:h===d.history.changeTheme?d.toast.theme(c.active):d.toast.tokensSaved,action:kn})}catch(p){ve({tone:"error",text:String(p.message)})}},tn=(c,h)=>{if(T===c){h.join()!==we.state.paths.join()&&we.select(h);return}si.current={file:c,paths:h},_(c),w([c]),z([]),ga([])},sc=(c,h)=>tn(c,[h]),Ll=(c,h,p)=>{const N=Ld(ct.current.get(c),h.clientX,h.clientY);if(!N)return void(!p.add&&T===c&&_(null));if(p.add&&T===c){const k=we.state.paths;return void we.select(k.includes(N.path)?k.filter($=>$!==N.path):[...k,N.path])}tn(c,[N.path]),p.double||lb("picks"),p.double&&tr(c,N.el,N.path)};Qc.current=Ll,b.useEffect(()=>{var N,k;const c=si.current,h=c&&T===c.file?ct.current.get(c.file):null;if(!c||!h)return;const p=()=>{si.current=null,we.select(c.paths)};return((N=h.contentDocument)==null?void 0:N.readyState)==="complete"&&((k=h.contentDocument.body)!=null&&k.childElementCount)?p():(h.addEventListener("load",p,{once:!0}),()=>h.removeEventListener("load",p))},[T,Ga]);const vr=c=>{var k,$;const h=(k=ct.current.get(c))==null?void 0:k.contentDocument,p=h?Array.from((($=h.body)==null?void 0:$.children)??[]).find(L=>!/^(SCRIPT|STYLE|TEMPLATE)$/.test(L.tagName)):null,N=p?nl(p):"0";N!=null&&tn(c,[N])};b.useEffect(()=>{T&&!(x.length===1&&x[0]===T)&&_(null)},[x]),b.useEffect(()=>{ee(null),le(null)},[T,j]),b.useEffect(()=>{xe&&T===xe&&_(null)},[xe]);const xn=T??(x.length===1?x[0]:null),Ps=b.useMemo(()=>{var c;return u1(T?(c=ct.current.get(T))==null?void 0:c.contentDocument:null)},[T,Ga,ha[T??""],(Ie=we.state.selection)==null?void 0:Ie.hash]);b.useEffect(()=>{if(!xn)return aa(null);Te.get(`/api/lint?f=${encodeURIComponent(xn)}`).then(c=>aa(c.files[xn]??[])).catch(()=>aa(null))},[xn,ha[xn??""],Fc]),b.useEffect(()=>{if(!xn)return wu(null);const c=()=>{var N;const p=(N=ct.current.get(xn))==null?void 0:N.contentDocument;wu((p==null?void 0:p.readyState)==="complete"?s1(p,(Ye==null?void 0:Ye.minTarget)??48):null)},h=window.setTimeout(c,600);return()=>window.clearTimeout(h)},[xn,Ga,ha[xn??""],Ye==null?void 0:Ye.minTarget,uf]);const _l=c=>{var N;const h=c.currentTarget.getBoundingClientRect(),p=((N=c.currentTarget.closest(".oc-dock"))==null?void 0:N.getBoundingClientRect())??h;return{clientX:h.left,clientY:p.top-8}},xr=c=>Nt({x:c.clientX,y:c.clientY,up:!0,title:d.toolbar.canvasTools,icons:!0,items:Wo.slice(0,5).map(h=>({label:h.label,icon:h.icon,shortcut:h.key,check:j===h.id,run:()=>E(h.id)}))}),yi=c=>Nt({x:c.clientX,y:c.clientY,up:!0,title:d.toolbar.shapes,icons:!0,items:[...Wo.slice(5).map(h=>({label:h.label,icon:h.icon,shortcut:h.key,check:j===h.id,run:()=>E(h.id)})),"sep",{label:d.toolbar.insertImage,icon:"image",run:()=>ls(()=>h=>{ls(null),cs(h)})}]}),oc=(c,h=!1)=>{const p=Math.round(m.get().zoom*100);Nt({x:c.clientX,y:c.clientY,right:!h,up:h,className:"zoom-menu oc-menu",items:[{label:d.toolbar.zoomIn,shortcut:`${ut}+`,run:()=>Ys(2)},{label:d.toolbar.zoomOut,shortcut:`${ut}−`,run:()=>Ys(1/2)},{label:d.toolbar.fitAll,shortcut:"⇧1",run:ui},{label:d.toolbar.zoomToSelection,shortcut:"⇧2",disabled:!x.length,run:()=>Cl(x)},"sep",{label:d.toolbar.zoomNow(p),disabled:!0,run:()=>{}},...[50,100,200].map(N=>({label:`${N}%`,shortcut:N===100?`${ut}0`:void 0,check:p===N,run:()=>Ki(N/100)})),"sep",{label:d.toolbar.layoutGuides,shortcut:"⌃G",check:ju,run:()=>ka(N=>!N)},{label:d.toolbar.minimap,shortcut:"M",check:K,run:ds},{label:d.toolbar.cleanView,shortcut:`⇧${ut}\\`,check:It,run:vn}]})},ds=()=>ae(c=>!c),Ul=c=>Nt({x:c.clientX,y:c.clientY,title:d.toolbar.shortcuts,className:"keys-menu",items:vw.flatMap(h=>[{label:d.keys.sections[h],heading:!0,run:()=>{}},...xw.filter(p=>p.section===h).map(p=>({label:d.keys.rows[p.id],shortcut:p.combos.map(N=>jw(N,ut)).join(" "),run:()=>{}}))])}),ql=c=>{const h=Ye?Object.keys(Ye.themes):[];qs();const p=k=>k.split(/[\\/]/).filter(Boolean).pop()??k,N=k=>ci.some($=>$!==k&&$.title===k.title)||k.title===(r==null?void 0:r.title)?`${k.title} · ${p(k.root)}`:k.title;Nt({x:c.clientX,y:c.clientY,title:(n==null?void 0:n.dir)??(r==null?void 0:r.title),className:"project-menu oc-menu",items:[{label:d.boardList.search,shortcut:`${ut}K`,run:()=>{il("boards"),Re(!0),setTimeout(()=>{var k;return(k=Li.current)==null?void 0:k.focus()},0)}},{label:d.toolbar.shareMenu,run:()=>{var k;return(k=document.querySelector(".oc-rhead .share-btn"))==null?void 0:k.click()}},{label:d.toolbar.snapshot,run:()=>void wr(c)},...be?[{label:d.toolbar.history,run:()=>kr()}]:[],"sep",{label:d.toolbar.appearance(Bs),run:()=>Nu(k=>k==="system"?"light":k==="light"?"dark":"system")},...h.length>1?h.map(k=>({label:d.toolbar.themeOption(k),check:Ye.active===k,run:()=>void Hl({...Ye,active:k},d.history.changeTheme)})):[],{label:d.toolbar.language(Hd.find(k=>k.id===Jd).name),run:()=>Dx(Hd[(Hd.findIndex(k=>k.id===Jd)+1)%Hd.length].id)},"sep",{label:d.requests.menuChat,check:!jt.host,run:()=>void jt.save({mode:"chat",intro:!0})},{label:d.requests.menuHost,check:jt.host,run:()=>void jt.save({mode:"host",intro:!0})},...!jt.host&&ht.current?(()=>{const k=ht.current;return[{label:d.inline.agentItem(k.label),run:()=>window.setTimeout(()=>k.openAgentMenu({right:Math.max(8,window.innerWidth-c.clientX-340),top:c.clientY}),0)},...k.isCustom?[]:[{label:d.inline.modelItem(k.model),run:()=>void la.prompt({title:d.inline.modelTitle,label:d.inline.modelLabel,value:k.model,ok:d.dialog.ok}).then($=>{var L;return $&&((L=ht.current)==null?void 0:L.setModel($.value.trim()))})}]]})():[],"sep",{label:d.toolbar.shortcuts,run:()=>window.setTimeout(()=>Ul(c),0)},...ci.length?["sep",{label:d.toolbar.otherProjects,heading:!0,run:()=>{}},...ci.map(k=>({label:N(k),tip:k.root,run:()=>window.location.assign(`http://localhost:${k.port}/`)}))]:[]]})},Vl=c=>Nt({x:c.clientX,y:c.clientY,title:sa(d.boardList.pages,c).title,className:"pages-menu",items:[...sa(d.boardList.pages,c).items,...Je.length?Je.map(h=>({label:h.name,tip:h.name,check:h.id===hn,run:()=>S(h.id),more:{label:d.boardList.pageMore(h.name),open:p=>fr(h.id,p)}})):[{label:d.boardList.mainPage,check:!0,run:()=>{}}],"sep",{label:d.boardList.newPage,disabled:Je.length>=40,run:()=>void Ks()}]}),ic=(c,h)=>{!r||!n||Nt({x:c.clientX,y:c.clientY,title:d.toolbar.erroredBoardsN(h.length),items:[...h.slice(0,12).map(p=>{var N,k,$;return{label:`${((N=r.boards[p])==null?void 0:N.title)??p} — ${((($=(k=ti[p])==null?void 0:k[0])==null?void 0:$.message)??d.menu.fileMissing).slice(0,40)}`,run:()=>{Ka([p]),Cl([p])}}}),"sep",{label:d.menu.askFixAll,run:()=>Ru(h)},...n.missing.length?[{label:d.menu.cleanMissing(n.missing.length),danger:!0,run:()=>{bn(p=>{const N={...p.boards};for(const k of n.missing)delete N[k];return{...p,boards:N,order:p.order.filter(k=>!n.missing.includes(k))}},d.history.cleanMissing),ve({text:d.toast.cleanedUp(n.missing.length),action:kn})}}]:[]]})},wr=async(c,h=!1)=>{const p=await Te.get("/api/snapshots").catch(()=>null);if(!(p!=null&&p.git))return Nt({x:c.clientX,y:c.clientY,right:h,title:d.menu.snapshot,items:[{label:d.menu.notGit,disabled:!0,run:()=>{}}]});Nt({x:c.clientX,y:c.clientY,right:h,title:d.menu.snapshotStatus(p.branch??"",p.changed),items:[{label:p.changed?d.menu.snapshotNow:d.menu.nothingChanged,disabled:!p.changed,run:async()=>{const N=await la.prompt({title:d.dialog.snapshotTitle,label:d.dialog.snapshotLabel,value:d.dialog.snapshotMessage(new Date().toLocaleDateString("en-CA")),hint:d.dialog.snapshotHint,ok:d.dialog.commit});if(N)try{const k=await Te.post("/api/snapshot",{message:N.value});ve({tone:"ok",text:k.nothing?d.toast.nothingChanged:d.toast.snapshot(k.hash??"")})}catch(k){ve({tone:"error",text:String(k.message)})}}},"sep",...p.snapshots.slice(0,10).map(N=>({label:`${N.hash} ${N.subject.slice(0,40)} · ${N.when}`,disabled:!0,run:()=>{}}))]})};b.useEffect(()=>rb(T),[T]);const Js=async c=>{const h=dn.current,p=h&&Gd(h,c);if(!h||!p)return;const N=k=>{var $;return(($=h.boards[k])==null?void 0:$.title)??k};Ya(k=>k&&{...k,busy:!0});try{const k=await Te.post("/api/boards/use",{file:c});Ya(null),T&&p.alts.includes(T)&&_(null),await ln(),pa([p.original]);const $=p.chosen===p.original?d.occupancy.kept(N(p.original),p.alts.length):d.occupancy.applied(D1(N(p.chosen)),N(p.original));ve({tone:"ok",text:$,action:k.step?{label:d.occupancy.undo,run:()=>void fs(k.step,$,[p.original,...p.alts])}:kn})}catch(k){Ya($=>$&&{...$,busy:!1}),ve({tone:"error",text:String(k.message)})}Gn(),zt.reload()},cc=async c=>{const h=dn.current,p=h&&Gd(h,c);if(!(!h||!p)){Ya(N=>N&&{...N,busy:!0});try{const N=await Te.post("/api/boards/keep",{file:c});Ya(null),await ln();const k=d.occupancy.keptAll(p.kind,p.alts.length);ve({text:k,action:N.step?{label:d.occupancy.undo,run:()=>void fs(N.step,k)}:kn})}catch(N){Ya(k=>k&&{...k,busy:!1}),ve({tone:"error",text:String(N.message)})}Gn(),zt.reload()}},fs=async(c,h,p=[])=>{try{await Te.post("/api/history/undo-steps",{ids:[c],mode:"rest"}),await ln(),p.length&&pa(p),ve({text:d.toast.undoRedoDone("undo",h),action:{label:d.toolbar.redo,run:()=>void fl("redo")}})}catch(N){ve({tone:"error",text:String(N.message)})}Gn(),zt.reload()},Bn=b.useRef([]);b.useEffect(()=>{const c=[...x,...T?[T]:[]],h=c.filter(p=>!Bn.current.includes(p));Bn.current=c;for(const p of h)zt.markSeen(zt.tagsOf(p).flatMap(N=>N.steps))},[x,T]);const Is=(c,h)=>zt.tagsOf(c).find(p=>p.key===h)??null,jr=(c,h)=>{Is(c,h)&&$a(p=>(p==null?void 0:p.file)===c&&p.key===h?null:{file:c,key:h,conflict:null,busy:!1})},Uu=b.useRef(jr);Uu.current=jr;const qu=b.useCallback((c,h)=>Uu.current(c,h),[]),Nr=b.useRef(null);b.useEffect(()=>{var p;const c=Nr.current,h=Kt&&Is(Kt.file,Kt.key);Nr.current=h?{id:`${Kt.file}|${h.key}`,steps:h.steps}:null,c&&c.id!==((p=Nr.current)==null?void 0:p.id)&&zt.markSeen(c.steps)},[Kt==null?void 0:Kt.file,Kt==null?void 0:Kt.key]);const Cn=async(c,h,p)=>{var k,$,L;$a(te=>te&&{...te,busy:!0});const N=d.activity.stepName((($=(k=zt.data)==null?void 0:k.steps.find(te=>te.id===h.steps[0]))==null?void 0:$.name)??"");try{const te=()=>Te.post("/api/history/undo-steps",{ids:h.steps,mode:p});h.run?await Te.post("/api/chat/undo-run",{id:h.run,mode:p}).catch(Ae=>Ae.status===404?te():Promise.reject(Ae)):await te(),$a(null),ve({text:d.toast.undoRedoDone("undo",h.steps.length===1?N:d.activity.changes(h.steps.length)),action:{label:d.toolbar.redo,run:()=>void fl("redo")}}),await ln()}catch(te){const Ae=te,Ee=Ae.status===409?(L=Ae.body)==null?void 0:L.conflicts:void 0;Ee?$a(_e=>_e&&{..._e,busy:!1,conflict:[...new Set(Ee.map(yt=>{var qt,jn;return yt.file.endsWith(".html")?((jn=(qt=dn.current)==null?void 0:qt.boards[yt.file])==null?void 0:jn.title)??yt.file:yt.file}))]}):($a(_e=>_e&&{..._e,busy:!1}),ve({tone:"error",text:Ae.message}))}Gn(),zt.reload()},Sr=async c=>{Jc(!0);try{await Te.post("/api/history/goto",{id:c.id}),ve({text:d.activity.wentBack(d.activity.stepName(c.name))}),await ln()}catch(h){ve({tone:"error",text:String(h.message)})}finally{Jc(!1),Gn(),zt.reload()}},Co=b.useCallback(()=>kl(!1),[]),kr=()=>{zt.reload(),kl(!0)};b.useEffect(()=>{Kt&&!Is(Kt.file,Kt.key)&&$a(null)},[zt.data,zt.now]);const Eo=b.useRef(()=>{});Eo.current=c=>{var Ae,Ee,_e,yt,qt,jn,On,ja,vs,Kl;if(!r||la.state||ce)return;if(fe){if(cu(c)||Ct||(Ae=document.activeElement)!=null&&Ae.closest(".menu"))return;if(c.altKey&&c.code==="KeyC")return c.preventDefault(),uc();(c.key==="Escape"||c.key==="ArrowLeft"||c.key==="ArrowRight")&&(c.preventDefault(),c.key==="Escape"?Ba():mi(c.key==="ArrowLeft"?-1:1));return}if(Fe){c.key==="Escape"&&!cu(c)&&(c.preventDefault(),nc());return}if((c.metaKey||c.ctrlKey)&&!c.shiftKey&&c.key==="\\"&&!c.isComposing&&cu(c))return c.preventDefault(),zo();if(cu(c)||c.isComposing||(c.key==="Enter"||c.key===" ")&&c.target instanceof Element&&c.target.closest("button, a[href], [role=button]"))return;const h=c.metaKey||c.ctrlKey,p=c.key.toLowerCase(),N=x.length===1?x[0]:null,k=Xe=>{c.preventDefault(),Xe()};if(h&&p==="z")return k(()=>void fl(c.shiftKey?"redo":"undo"));if(h&&p==="y")return k(()=>void fl("redo"));if(h&&p==="j")return k(()=>it==="chat"&&Ve&&!kt?Gl():it==="chat"&&!Ve?yn("inspect"):Za(vo()??(N?Ta(N):null),()=>Xs(vo()??(N?Ta(N):null))));if(h&&p==="k")return k(()=>{Re(!0),setTimeout(()=>{var Xe;return(Xe=Li.current)==null?void 0:Xe.focus()},0)});if(h&&p==="a"&&!T)return k(()=>Ka(St));if(h&&p==="a"&&T){const Xe=(Ee=ct.current.get(T))==null?void 0:Ee.contentDocument,Ft=(_e=we.state.selection)==null?void 0:_e.path,rt=Xe&&(Ft?(yt=An(Xe,Ft))==null?void 0:yt.parentElement:Xe.body.firstElementChild),ia=rt?Array.from(rt.children).filter(_n=>!/^(SCRIPT|STYLE)$/.test(_n.tagName)).map(_n=>nl(_n)).filter(_n=>_n!=null):[];return k(()=>ia.length&&void we.select(ia))}if(h&&p==="l"&&(x.length||M.length))return k(()=>ko());if(h&&c.altKey&&c.code==="KeyC"&&T&&we.state.selection)return k(rs);if(h&&c.altKey&&c.code==="KeyV"&&T&&we.state.paths.length)return k(()=>void yr());if(h&&c.shiftKey&&p==="c"&&T&&we.state.selection)return k(()=>void Zs(T,we.state.selection.path));if(h&&c.shiftKey&&p==="c"&&N&&!T)return k(()=>void Zs(N));if(!h&&c.shiftKey&&(p==="h"||p==="v")&&T&&we.state.selection)return k(()=>To(p==="h"?"x":"y"));if(h&&p==="c"&&T&&we.state.selection)return k(()=>void Cu());if(h&&p==="v"&&T)return k(()=>void Eu());if(h&&p==="d"&&T&&we.state.selection){const Xe=we.state.selection;return k(()=>void fn({op:"duplicate",path:Xe.path,hash:Xe.hash}))}if(h&&p==="d"&&N&&!T)return k(()=>void ar(N));if(h&&c.key==="]"&&x.length)return k(()=>is(x,"front"));if(h&&c.key==="["&&x.length)return k(()=>is(x,"back"));if(h&&c.key==="0")return k(()=>Ki(1));if(h&&c.key==="1")return k(ui);if(h&&(c.key==="="||c.key==="+"))return k(()=>Ys(2));if(h&&c.key==="-")return k(()=>Ys(1/2));if(h&&c.shiftKey&&c.code==="Backslash")return k(()=>vn());if(h&&c.key==="\\")return k(()=>zo());if(c.ctrlKey&&!c.metaKey&&p==="g")return k(()=>ka(Xe=>!Xe));if(h&&p==="g"&&T&&we.state.paths.length>=2)return k(()=>void st("flex"));if(h)return;if(c.shiftKey&&c.code==="Digit1")return k(ui);if(c.shiftKey&&c.code==="Digit2")return k(()=>Cl(x));if(c.altKey&&!h&&c.code==="KeyC")return k(uc);if(c.key==="Escape"){if(va)return k(()=>pl(null));if(mn)return k(eo);if(gl)return k(()=>Qs(!1));if(It)return k(()=>vn());if(xe)return k(()=>$n());if(Ve&&$e)return k(()=>Re(!1));const Xe=!!((qt=document.activeElement)!=null&&qt.closest(".oc-right"))&&!((jn=document.activeElement)!=null&&jn.closest(".oc-rhead"));if(!kt&&(Ve||(hs||ba||it==="chat")&&!Xe))return k(Gl);if(T)return k(()=>_(null));if(j!=="select")return k(()=>E("select"));w([]),W(null),Zc(null);return}if(c.key==="F6")return k(()=>Zt(c.shiftKey));const $=document.activeElement,L=!$||$===document.body||!!((On=$.closest)!=null&&On.call($,".canvas"))||$.tagName==="IFRAME";if(c.key==="Tab"&&!c.shiftKey&&L&&T&&we.state.selection){const Xe=document.querySelector('.etb button[tabindex="0"]');if(Xe)return k(()=>Xe.focus())}if(c.key==="Tab"&&L&&!T&&St.length){const Xe=x.length?St.indexOf(x[x.length-1]):-1,Ft=St[(Xe+(c.shiftKey?-1:1)+St.length)%St.length];return k(()=>{var rt;Ka([Ft]),Cl([Ft]),Ue(d.app.announceBoard(((rt=r.boards[Ft])==null?void 0:rt.title)??Ft,St.indexOf(Ft)+1,St.length))})}if(c.key==="Enter"&&!T&&x.length===1&&L)return k(()=>vr(x[0]));if(c.key==="Enter"&&T&&we.state.selection){const Xe=(ja=ct.current.get(T))==null?void 0:ja.contentDocument,Ft=Xe&&An(Xe,we.state.selection.path),rt=c.shiftKey?Ft==null?void 0:Ft.parentElement:Ft==null?void 0:Ft.firstElementChild,ia=rt&&rt!==(Xe==null?void 0:Xe.body)?nl(rt):null;return ia!=null?k(()=>void we.select([ia])):void 0}if(p==="p"&&!h&&J1(x,r.boards)==="play")return k(()=>xe===x[0]?$n():Ze(x[0]));if((c.key==="Delete"||c.key==="Backspace")&&un.length&&!T)return k(()=>Al(un));if(c.key==="Delete"||c.key==="Backspace"){if(T&&we.state.selection){const Xe=we.state.selection;return k(async()=>{await fn({op:"delete",path:Xe.path,hash:Xe.hash})&&(we.select([]),ve({text:d.toast.elementDeleted,action:kn}))})}return M.length||x.length&&!T?k(()=>{M.length&&wo(M),x.length&&!T&&Zi(x)}):void 0}if((c.key.startsWith("Arrow")||c.key==="Enter")&&T&&we.state.selection){const Xe=we.state.selection,Ft=(vs=ct.current.get(T))==null?void 0:vs.contentDocument,rt=Ft&&An(Ft,Xe.path);if(!rt)return;if(c.altKey&&(c.key==="ArrowUp"||c.key==="ArrowDown")){const _n=Xe.path.includes("/")?Xe.path.slice(0,Xe.path.lastIndexOf("/")):"",Ho=Number(Xe.path.split("/").pop()),Mt=c.key==="ArrowUp"?Ho-1:Ho+1;return Mt<0||Mt>=(((Kl=rt.parentElement)==null?void 0:Kl.children.length)??0)?k(()=>{}):k(()=>void Tu(Xe.path,{toParentPath:_n,index:Mt,freeze:[]}))}const ia=c.key==="ArrowUp"||c.key==="Enter"&&c.shiftKey?rt.parentElement:c.key==="ArrowDown"||c.key==="Enter"?rt.firstElementChild:c.key==="ArrowRight"?rt.nextElementSibling:rt.previousElementSibling;if(ia&&ia!==Ft.body){const _n=nl(ia);if(_n!=null)return k(()=>void we.select([_n]))}return k(()=>{})}if(c.key.startsWith("Arrow")&&(x.length||M.length||un.length)&&!T){const Xe=c.altKey?100:c.shiftKey?10:1;return k(()=>fi(c.key==="ArrowLeft"?-Xe:c.key==="ArrowRight"?Xe:0,c.key==="ArrowUp"?-Xe:c.key==="ArrowDown"?Xe:0))}if(c.key==="F2"&&N)return k(()=>void Fi(N));if(p==="f"&&N)return k(()=>hi(N));if(p==="m")return k(ds);const te=Wo.find(Xe=>Xe.key.toLowerCase()===p);if(te)return k(()=>E(te.id))},b.useEffect(()=>{const c=h=>Eo.current(h);return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[]);const Vu=b.useRef(new Map),bi=c=>{var te,Ae;if(!n||!r)return null;const h=((te=r.boards[c])==null?void 0:te.title)??c,p=T===c&&((Ae=we.state.selection)==null?void 0:Ae.file)===c?we.state.selection:null,N=p?`${d.inspector.kindName(p.kind??p.tag)}${p.label?` "${p.label.slice(0,40)}"`:""}`:void 0,k={file:`${n.screens??"screens"}/${c}`,...p?{path:p.path,element:N}:{},label:N?d.requests.frameElement(h,N):d.requests.frameBoard(h)},$=JSON.stringify(k),L=Vu.current.get(c);return(L==null?void 0:L.sig)===$?L.v:(Vu.current.set(c,{sig:$,v:k}),k)},rc=c=>{var h;if(kt){const p=(h=document.querySelector(`.pin-layer [data-comment="${c.id}"]`))==null?void 0:h.getBoundingClientRect();Jn({id:c.id,x:p?p.right:lt.w/2,y:p?p.top:80}),D(c.id);return}Jn(null),D(c.id),ml(!0),yn("inspect"),Ca.current=Date.now(),us(!0),c.path?tn(c.file,[c.path]):(_(null),w([c.file]),z([]),ga([])),window.setTimeout(()=>{var $,L;const p=($=document.querySelector(`.pin-layer [data-comment="${c.id}"]`))==null?void 0:$.getBoundingClientRect(),N=(L=document.querySelector(".oc-right"))==null?void 0:L.getBoundingClientRect();if(!p||!N||p.right+12<=N.left||p.left>=N.right)return;const k=p.right+24-N.left;g(te=>({...te,x:te.x-k}))},260)},Ws=(c,h)=>{var $;const p=en.filter(L=>L.file===c&&!L.resolved);if(!p.length)return null;const N=($=ct.current.get(c))==null?void 0:$.contentDocument,k=j==="select"&&!It&&xe!==c&&!ce;return s.jsx("div",{className:`pins ${k?"live":""}`,children:p.map((L,te)=>{const Ae=N&&L.path?An(N,L.path):null,Ee=Ae?As(Ae):null,_e=1/Math.max(h,.25);return s.jsxs("button",{className:`pin ${al(L)?`req-pin is-${L.request.state}`:""} ${Rn===L.id?"on":""}`,title:L.text,"aria-label":al(L)?d.requests.pinLabel(te+1,L.request.state==="waiting",L.text.split(`
71
+ `)[0].slice(0,80)):d.comments.pinLabel(te+1,L.author,L.text.split(`
72
+ `)[0].slice(0,80)),"aria-pressed":Rn===L.id,tabIndex:k?0:-1,"data-comment":L.id,onPointerDown:yt=>yt.stopPropagation(),onDoubleClick:yt=>yt.stopPropagation(),onClick:()=>rc(L),style:Ee?{left:Ee.x+Ee.w-12,top:Math.max(Ee.y-12,24/Math.max(h,.25)-24),transform:`scale(${1/Math.max(h,.25)})`}:{right:32*_e-24,top:(8+te*30)*_e+24*_e-24,transform:`scale(${_e})`},children:[te+1,al(L)&&s.jsx("span",{className:"req-flag","aria-hidden":"true",title:d.requests.forAi,children:L.request.state==="taken"?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(Q,{name:"ai",size:14})})]},L.id)})})},Mo=(c,h)=>{var _e,yt;const p=(_e=ct.current.get(c))==null?void 0:_e.contentDocument,N=T===c,k=ju?(((yt=r==null?void 0:r.guides)==null?void 0:yt[c])??[]).filter(qt=>!qt.hidden):[],$=xe===c?void 0:zt.tagsOf(c).find(qt=>qt.paths.length&&zt.stateOf(qt)==="fresh"),L=(ne==null?void 0:ne.file)===c&&xe!==c&&!(N&&we.state.paths.includes(ne.path))?ne:null,te=(ie==null?void 0:ie.file)===c?ie.rect:null,Ae=xt.includes(c);if(!N&&!k.length&&!$&&!L&&!te&&!Ae)return null;const Ee=1/Math.max(h,.05);return s.jsxs("div",{className:"overlay",children:[Ae&&s.jsx("div",{className:"export-badge",role:"status",style:{transform:`scale(${1/Math.max(h,.25)})`},children:d.canvas.exportingPng}),$&&s.jsx(Vx,{frame:ct.current.get(c)??null,paths:$.paths,zoom:h}),k.length>0&&r&&s.jsx(i0,{guides:k,w:r.boards[c].w,h:r.boards[c].h}),L&&s.jsx(rm,{r:L.rect,cls:"hover",px:Ee}),N&&we.state.rects.map((qt,jn)=>s.jsx(rm,{r:qt,cls:"sel",px:Ee},jn)),te&&s.jsx(rm,{r:te,cls:"marquee-el",px:Ee}),N&&I!==c&&p&&we.state.paths.length===1&&we.state.rects[0]&&s.jsx(p1,{doc:p,path:we.state.paths[0],rect:we.state.rects[0],zoom:h,onMove:qt=>void Tu(we.state.paths[0],qt),onPosition:async(qt,jn)=>{const On=we.state.paths[0],ja=await Oa(c,On);await fn({op:"batch",ops:[{op:"setStyle",path:On,hash:ja,prop:"left",value:`${qt}px`},{op:"setStyle",path:On,hash:ja,prop:"top",value:`${jn}px`}]})},onResize:async(qt,jn)=>{const On=we.state.paths[0],ja=await Oa(c,On);await fn({op:"batch",ops:[{op:"setStyle",path:On,hash:ja,prop:"width",value:`${qt}px`},{op:"setStyle",path:On,hash:ja,prop:"height",value:`${jn}px`}]})}})]})};if(!r||!n)return s.jsx("div",{className:"loading",role:"status",children:zs?s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"warn"})," ",d.app.loadFailed," ",zs,s.jsx("button",{onClick:()=>void ln(),children:d.app.retry})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner","aria-hidden":"true"})," ",d.app.loadingBoards]})});const ot=x.length===1?x[0]:null,Ao=[...new Set([...n.missing,...Object.keys(ti)])],pf=s.jsxs("div",{className:"oc-tabs",role:"tablist","aria-label":d.tabs.left,ref:Tl,children:[s.jsx("button",{role:"tab","aria-selected":Sa==="boards",className:Sa==="boards"?"on":"",onClick:()=>il("boards"),children:d.tabs.boards}),s.jsx("button",{role:"tab","aria-selected":Sa==="assets",className:Sa==="assets"?"on":"",onClick:()=>il("assets"),children:d.tabs.assets}),s.jsx("button",{role:"tab","aria-selected":Sa==="tokens",className:Sa==="tokens"?"on":"",onClick:()=>il("tokens"),children:d.tabs.tokens})]}),Tr=St.map(c=>({file:c,...r.boards[c]})),hs=!T&&!x.length&&!M.length&&!un.length,Cr=Ve&&it==="inspect"&&!!T&&!(((Rt=we.state.selection)==null?void 0:Rt.file)===T&&we.state.paths.length>0),kt=!Pn||Cr,Xn=_t&&!kt,En=at,Gl=()=>{ml(!1),D(null),Ol(!1),us(!1)},zo=()=>{if(!kt)return Gl();yn("inspect"),us(!1),Ol(!0),ml(!0)},eo=()=>{Jn(null),D(null)},Er=(c,h)=>Nt({x:h.clientX,y:h.clientY,items:[{label:d.comments.edit,run:async()=>{const p=await la.prompt({title:d.comments.edit,label:d.comments.title,value:c.text,ok:d.dialog.save});p!=null&&p.value.trim()&&p.value.trim()!==c.text&&await Te.post("/api/comments",{action:"edit",id:c.id,text:p.value.trim()})}},"sep",{label:d.comments.deleteThread,danger:!0,run:async()=>{(mn==null?void 0:mn.id)===c.id&&eo(),await Te.post("/api/comments",{action:"delete",id:c.id})}}]}),uc=()=>{pl(null),Jn(null),Qs(c=>!c)},to=()=>{if(ba&&!kt)return Gl();D(null),yn("inspect"),us(!0),ml(!0)},Yl=T??ot??St[0]??null,Gu=it==="chat"&&(!jt.host||na),Mr=Ve&&it==="inspect"&&!!Rn&&en.some(c=>c.id===Rn),no=c=>{if(!Ve||It)return;const h=c.target instanceof Element?c.target:null;if(!h||h.closest(".pin, .oc-card, .etb, .req-composer, .oc-dock"))return;if(kt){c.type==="pointerdown"&&c.button===0&&!h.matches(".canvas, .pan-capture")&&h.closest(".board")&&!document.querySelector(".canvas.tool-hand")&&(D(null),_u(k=>k+1));return}const p=it==="chat"&&!Gu||Mr;c.type==="wheel"||c.button===1||document.querySelector(".canvas.tool-hand")||(h.matches(".canvas, .pan-capture")||p)&&Gl()},vi=Jo,ao=!kt&&!Xn,ms=Ge+Math.max(Ut,pt)+8,lo=Ve?144:192,xi=Ve?96:128,Oo=Qe>0&&Math.floor((lt.w-Qe)/2)>=En+lo+8?En:Ge,Xl=Qe>0&&lt.h-Oo-xi>=En+Qt+8;Wt.current=Xl?{left:En,right:En+lo,top:lt.h-Oo-xi,bottom:lt.h-Oo}:null;const dc=Xl&&K&&Tr.length>0&&(!$e||!Ve)&&!Xn&&!fe&&!tt,wi=Math.max(Qt,lt.h-En-(dc&&!Ve?Oo+xi+8:ms)),In=$e&&!fe,Qa=`oc-card oc-left ${In?"":"is-collapsed"} ${In&&Sa!=="boards"?"is-tall":""}`,so=Math.max(0,lt.w-En-8-(!kt&&!Xn?Jo:Xa>=cm?En-8:Ic>0?Ic+En:0)),ji=Math.max(240,Math.min(Vi,so)),Ro=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"oc-head",children:[s.jsxs("div",{className:"oc-views",role:"radiogroup","aria-label":d.toolbar.viewToggle,children:[s.jsx("button",{role:"radio","aria-checked":!fe,className:`icon-btn oc-vb ${fe?"":"on"}`,"aria-label":d.toolbar.viewCanvas,title:d.toolbar.viewCanvas,onClick:()=>fe&&Ba(),children:s.jsx(Q,{name:"canvas"})}),s.jsx("button",{role:"radio","aria-checked":!!fe,className:`icon-btn oc-vb ${fe?"on":""}`,"aria-label":d.toolbar.viewPrototype,title:d.toolbar.viewPrototypeTitle,disabled:!Yl,onClick:()=>!fe&&Yl&&hi(Yl),children:s.jsx(Q,{name:"focus"})})]}),!fe&&s.jsx("button",{className:`icon-btn oc-ib oc-lp ${In?"on":""}`,"aria-label":d.toolbar.boardsPanel,"aria-pressed":In,title:d.toolbar.boardsPanel,onClick:()=>Re(c=>!c),children:s.jsx(Q,{name:"panel"})}),s.jsx("span",{className:"oc-hsep","aria-hidden":"true"}),Xa!==6&&s.jsxs("button",{className:"oc-project",title:(n==null?void 0:n.dir)??r.title,"aria-haspopup":"menu","aria-label":d.toolbar.projectMenu(r.title??""),"aria-expanded":!!((wn=Ct==null?void 0:Ct.className)!=null&&wn.startsWith("project")),onClick:c=>{const h=c.currentTarget.closest(".oc-head").getBoundingClientRect();ql({clientX:h.left,clientY:h.bottom+8})},children:[s.jsx("span",{className:"app-title",children:r.title}),s.jsx(Q,{name:"chevronDown",size:16})]}),Xa!==6&&s.jsx("span",{className:"oc-crumb","aria-hidden":"true",children:s.jsx(Q,{name:"chevronRight",size:14})}),fe&&r.boards[fe]?s.jsxs("button",{className:"oc-page oc-proto-board",title:`${r.boards[fe].title??fe} · ${fe}`,"aria-haspopup":"menu","aria-label":d.toolbar.protoBoard(r.boards[fe].title??fe),onClick:c=>{const h=c.currentTarget.closest(".oc-head").getBoundingClientRect();$l({clientX:h.left,clientY:h.bottom+8})},children:[s.jsx("span",{className:"oc-page-name",children:r.boards[fe].title??fe}),s.jsx(Q,{name:"chevronDown",size:16})]}):s.jsxs("button",{className:"oc-page",title:((Si=Je.find(c=>c.id===hn))==null?void 0:Si.name)??d.boardList.mainPage,"aria-haspopup":"menu","aria-label":d.boardList.pageSwitch(((io=Je.find(c=>c.id===hn))==null?void 0:io.name)??d.boardList.mainPage),onClick:c=>{const h=c.currentTarget.closest(".oc-head").getBoundingClientRect();Vl({clientX:h.left,clientY:h.bottom+8})},children:[Je.length>1&&s.jsx("span",{className:"oc-pcount","aria-label":d.toolbar.pageCount(Je.length),children:Je.length}),s.jsx("span",{className:"oc-page-name",children:((bs=Je.find(c=>c.id===hn))==null?void 0:bs.name)??d.boardList.mainPage}),s.jsx(Q,{name:"chevronDown",size:16})]})]}),(Ao.length>0||zs)&&s.jsxs("div",{className:"oc-status",children:[Ao.length>0&&s.jsxs("button",{className:"err-chip","aria-haspopup":"menu",title:d.toolbar.erroredBoards,onClick:c=>{const h=c.currentTarget.getBoundingClientRect();ic({clientX:h.left,clientY:h.bottom+8},Ao)},children:[s.jsx(Q,{name:"warn",size:16})," ",d.toolbar.errors(Ao.length)]}),zs&&s.jsx("span",{className:"warn",children:zs})]}),In&&pf]}),xa=we.state.selection,gs={left:En,top:at+Qt+8,right:lt.w-En-(!kt&&!Xn?Jo:0),bottom:lt.h-Ge},fc=()=>{const c=T?we.state.rects[0]:null,h=T?r.boards[T]:null;if(!c||!h)return null;const p=m.get();return{x:p.x+(h.x+c.x)*p.zoom,y:p.y+(h.y+c.y)*p.zoom,w:c.w*p.zoom,h:c.h*p.zoom}},Yu=c=>{const h=r.boards[c];if(!h)return null;const p=m.get();return{x:p.x+h.x*p.zoom,y:p.y+h.y*p.zoom-28,w:h.w*p.zoom,h:h.h*p.zoom+28}},ps=()=>{var h;const c=(h=document.querySelector(".oc-rhead .ask-ai"))==null?void 0:h.getBoundingClientRect();return c?{x:c.left,y:c.top,w:c.width,h:c.height}:null},Do=c=>{var h;return c.kind==="element"&&c.file===T&&((h=we.state.selection)==null?void 0:h.path)===c.path?fc():c.file?Yu(c.file):ps()},Ar=!!T&&!!r.boards[T]&&!!xa&&xa.file===T&&we.state.paths.length===1&&!I&&j==="select"&&xe!==T,hc=os||!!(Ct!=null&&Ct.up),mc=me&&St.length>0,Hn=!Ar&&j==="select"&&!I&&!hc&&!(ot&&xe===ot)&&mc,gc=Qe>0&&(lt.w+Qe)/2>lt.w-Jo?!Xn&&(!!qe||Hn)?Ge+Ut+8:Ge:0,zr=(()=>{if(!Xn)return 0;const c=T?r.boards[T]:ot?r.boards[ot]:null,h=T?we.state.rects[0]:null,p=Bl??m.get(),N=c?p.y+(c.y+(h?h.y+h.h:c.h))*p.zoom+4:0;return Math.round(Xc(N+8,En+Qt+En,lt.h-8-(it==="chat"?480:280)))})(),gn=T&&((ki=we.state.selection)==null?void 0:ki.file)===T?we.state.selection:null,wa=()=>!Xn&&(T??(un.length||M.length?null:ot))&&(()=>{const c=T??ot;return s.jsx(xm,{file:c,version:ha[c]??0,selected:T?we.state.paths:[],onSelect:(h,p)=>{const N=T?we.state.paths:[];tn(c,p?N.includes(h)?N.filter(k=>k!==h):[...N,h]:[h])},onMove:async(h,p,N)=>{const k=await Oa(c,h);await fn({op:"move",path:h,hash:k,toParentPath:p,index:N},c)&&tn(c,[p?`${p}/${N}`:String(N)])}})})(),Ln=xn&&r.boards[xn]&&((Zn==null?void 0:Zn.length)??0)+((Sl==null?void 0:Sl.length)??0)>0&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.sections.checks}),Ye&&!Ye.registered?s.jsx(uu,{variant:"row",id:"token-check",title:d.sections.tokenCheck,count:d.checks.off,children:s.jsx(c1,{onSetUp:()=>{il("tokens"),Re(!0)}})}):s.jsx(uu,{variant:"row",id:"token-check",title:d.sections.tokenCheck,count:(Zn==null?void 0:Zn.length)??0,children:s.jsx(qy,{title:d.checks.tokenCheck((Ye==null?void 0:Ye.active)??""),items:Zn,empty:d.checks.noOffToken,onPick:c=>sc(xn,c),onAskAI:()=>{const c=d.prompts.fixTokens((Zn??[]).slice(0,12).map(h=>`- ${h.path??d.prompts.line+h.line}: ${h.message}`).join(`
73
+ `));Za(Ta(xn,"tokens",c),()=>Ra(c,[xn]))}})}),s.jsx(uu,{variant:"row",id:"a11y",title:d.sections.a11y,count:(Sl==null?void 0:Sl.length)??0,children:s.jsx(qy,{title:d.checks.a11y,items:Sl,empty:d.checks.a11yOk,onPick:c=>sc(xn,c),onAskAI:()=>{const c=d.prompts.fixA11y((Sl??[]).slice(0,12).map(h=>`- ${h.path}: ${h.message}`).join(`
74
+ `));Za(Ta(xn,"a11y",c),()=>Ra(c,[xn]))}})})]}),ys=en.filter(c=>!c.resolved&&St.includes(c.file)).length;return s.jsx(s.Fragment,{children:s.jsxs("div",{className:`app oc oc-cd rs-${Xa} ${gl?"is-cmt-mode":""} ${be?"oc-n":""} ${Ve?"oc-pane":""} ${lt.w<=760?"narrow":""} ${_t?"oc-phone":""} ${It?"oc-clean":""} ${fe?"is-proto":""} ${xe?"is-playing":""}`,children:[In&&Sa==="tokens"?s.jsxs("aside",{ref:De,className:Qa,style:{maxHeight:wi,width:ji},"aria-label":d.app.tokensAside,children:[Ro,Ye?s.jsx(o1,{tokens:Ye,onSave:(c,h)=>void Hl(c,h)}):s.jsx("p",{className:"oc-empty",children:d.app.loading})]}):In&&Sa==="assets"?s.jsxs("aside",{ref:De,className:Qa,style:{maxHeight:wi,width:ji},"aria-label":d.app.assetsAside,children:[Ro,s.jsx(pb,{version:zn,onError:c=>ve({tone:"error",text:c}),onUploaded:c=>ve({tone:"ok",text:d.toast.uploaded(c.map(h=>h.name).join(", "))})})]}):In?s.jsx(V1,{cardRef:De,className:Qa,style:{maxHeight:wi,width:ji},header:Ro,ref:Li,board:r,pages:Je,currentPage:hn,selected:x,missing:Ao,onPage:S,onAddPage:()=>void Ks(),onPageMenu:fr,onMovePage:zl,onPick:(c,h)=>{const p=r.boards[c];Je.length&&p&&(p.page??Je[0].id)!==hn&&S(p.page??Je[0].id),Ka([c],h?"toggle":"replace"),h||Cl([c]),Ve&&!h&&Re(!1)},onGroupRename:c=>void ur(c),onGroupMenu:(c,h,p)=>{var N;return Nt({x:p.clientX,y:p.clientY,title:c&&((N=r.groupNames)==null?void 0:N[c])||c||d.boardList.otherGroup,items:[...c?[{label:d.menu.renameGroup,run:()=>void ur(c)}]:[],{label:d.menu.pageFromGroup,run:async()=>{var $;if(!Je.length&&!await Da({action:"add",name:d.boardList.mainPage}))return;const k=await Da({action:"add",name:c&&(($=r.groupNames)==null?void 0:$[c])||c||d.boardList.otherGroup});k!=null&&k.id&&(bn(L=>({...L,boards:{...L.boards,...Object.fromEntries(h.filter(te=>L.boards[te]).map(te=>[te,{...L.boards[te],page:k.id}]))}}),d.history.pageFromGroup),S(k.id))}}]})},dotOf:c=>O1(ul,c),onBoardMenu:(c,h)=>{var p;x.includes(c)||Ka([c]),Nt({x:h.clientX,y:h.clientY,title:((p=r.boards[c])==null?void 0:p.title)??c,items:Fs(c)})}}):s.jsx("aside",{ref:De,className:Qa,style:!In&&so>0?{maxWidth:so}:void 0,"aria-label":d.boardList.aria,children:Ro}),s.jsxs("div",{className:"canvas-wrap",onPointerDownCapture:c=>{var N;const h=c.target instanceof Element?c.target:null,p=h==null?void 0:h.closest(".board");if(gl&&j==="select"&&c.button===0&&p&&!h.closest(".pin, .board-btns, .board-resize")){c.stopPropagation(),c.preventDefault();const k=p.dataset.file,$=Ld(ct.current.get(k),c.clientX,c.clientY),L=$&&h.closest(".board-frame")?$:null,te=L?(()=>{const{kind:Ae,label:Ee}=iu(L.el);return Ee?`${d.inspector.kindName(Ae)} “${Ee.slice(0,24)}”`:d.inspector.kindName(Ae)})():null;Jn(null),pl({file:k,path:(L==null?void 0:L.path)??"",x:c.clientX,y:c.clientY,crumbs:[((N=r.boards[k])==null?void 0:N.title)??k,...te?[te]:[]]});return}Ve&&$e&&Re(!1),no(c)},onWheelCapture:no,onDragOver:c=>{Array.from(c.dataTransfer.items).some(h=>h.kind==="file")&&c.preventDefault()},onDrop:c=>{const h=Array.from(c.dataTransfer.files);if(!h.length)return;c.preventDefault();const p=c.currentTarget.getBoundingClientRect(),N=m.get(),k={x:(c.clientX-p.left-N.x)/N.zoom,y:(c.clientY-p.top-N.y)/N.zoom};rr(h,k)},children:[s.jsx(x0,{board:r,files:n.files,view:m,tool:j,setTool:E,visibleBoards:St,visibleNotes:nr,selected:x,selectedNotes:M,editFile:T,reloadKeys:po,stamps:ta,onSelect:Ka,onSelectNote:(c,h)=>{if(!c)return z([]);z(p=>h?p.includes(c)?p.filter(N=>N!==c):[...p,c]:[c]),h||(w([]),ga([]))},onMarquee:(c,h)=>{w(p=>h?[...new Set([...p,...c.boards])]:c.boards),z(p=>h?[...new Set([...p,...c.notes])]:c.notes),ga(p=>h?[...new Set([...p,...c.shapes])]:c.shapes)},onMoveBoards:(c,h)=>bn(p=>{const N=Object.entries(c),k=N.length>0&&N.every(([,_e])=>_e.w==null&&_e.h==null&&_e.x!=null&&_e.y!=null),[$,L]=N[0]??[],te=k&&$&&p.boards[$]?L.x-p.boards[$].x:0,Ae=k&&$&&p.boards[$]?L.y-p.boards[$].y:0,Ee=k&&M.length&&N.every(([_e])=>x.includes(_e))?Qn(p,te,Ae,[],M):p;return{...Ee,boards:{...Ee.boards,...Object.fromEntries(N.map(([_e,yt])=>[_e,{...Ee.boards[_e],...yt,autoPlaced:void 0}]))}}},h?Object.values(c).some(p=>p.w!=null)?d.history.resizeBoard:d.history.moveBoard:void 0),onMoveNote:(c,h,p)=>bn(N=>{const k=N.notes[c],$=h.x!=null?h.x-k.x:0,L=h.y!=null?h.y-k.y:0,Ae=($||L)&&!("text"in h)&&M.includes(c)?Qn(N,$,L,x,M.filter(Ee=>Ee!==c)):N;return{...Ae,notes:{...Ae.notes,[c]:{...k,...h}}}},p?"text"in h?d.history.editNote:d.history.moveNote:void 0),onDeleteNote:c=>wo([c]),onPlay:c=>xe===c?$n():Ze(c),onBoardAction:gr,hasTweaks:mf,playing:xe,typing:I,onPickElement:(c,h,p)=>{const N=ct.current.get(c),k=N==null?void 0:N.contentDocument;if(N&&(!(k!=null&&k.body)||k.readyState==="loading")){const $={clientX:h.clientX,clientY:h.clientY};return N.addEventListener("load",()=>Qc.current(c,$,p),{once:!0})}Ll(c,h,p)},onHoverElement:(c,h)=>{const p=c&&h?Ld(ct.current.get(c),h.clientX,h.clientY):null;ee(N=>!p||!c?null:(N==null?void 0:N.file)===c&&N.path===p.path?N:{file:c,path:p.path,rect:As(p.el)})},onElementMarquee:(c,h,p)=>{const N=ct.current.get(c),k=N==null?void 0:N.contentDocument;if(!N||!k||!h)return le(null);const $=N.getBoundingClientRect(),L=$.width/(N.offsetWidth||$.width)||1,te={x:(h.x-$.left)/L,y:(h.y-$.top)/L,w:h.w/L,h:h.h/L};if(!p)return le({file:c,rect:te});le(null);const Ae=T===c?we.state.paths:[],Ee=d0(k,te);tn(c,[...Ae,...Ee.filter(_e=>!Ae.includes(_e))])},onElementContext:(c,h)=>{const p=Ld(ct.current.get(c),h.clientX,h.clientY);return p?(T===c&&we.state.paths.includes(p.path)||tn(c,[p.path]),window.setTimeout(()=>{var N;return(N=Vs.current)==null?void 0:N.call(Vs,p.path,h)},0),!0):!1},onRename:c=>void Fi(c),onCreateBoard:c=>void El(c),onCreateNote:Ji,onContext:gf,onSize:$s,renderBoardOverlay:Mo,renderBoardPins:Ws,frameInfo:bi,renderBoardTags:c=>{var L,te,Ae;const h=zt.tagsOf(c),p=jt.host?Gy(en,c):0;if(!h.length&&!((L=ul[c])!=null&&L.length)&&!p)return null;const N=(Kt==null?void 0:Kt.file)===c?Kt.key:null,k=JSON.stringify([ul[c],cl,N,p,h.map(Ee=>[Ee.key,Ee.by,Ee.person,Ee.outside,Ee.count,Ee.newBoard,d.activity.ago(zt.now-Ee.at),zt.stateOf(Ee)])]),$=p||(te=ul[c])!=null&&te.length?s.jsxs(s.Fragment,{children:[s.jsx(w1,{n:p}),(Ae=ul[c])!=null&&Ae.length?s.jsx($1,{list:ul[c]}):null]}):null;return Pc(`tags:${c}`,k,()=>s.jsx(_x,{file:c,act:zt,me:cl,onOpen:qu,open:N,lead:$}))},renderBoardButtons:(c,h)=>{const p=Gd(r,c);if(!p)return null;const N=R1(ul,p),k=(dl==null?void 0:dl.file)===c;return Pc(`use:${c}`,JSON.stringify([p,N,h,k]),()=>s.jsx(B1,{file:c,group:p,busy:N,compact:h,open:k,onOpen:()=>Ya($=>($==null?void 0:$.file)===c?null:{file:c,busy:!1})}))},boardRing:c=>$b(ul,c).length?"var(--line-strong)":null,underLayer:df,worldLayer:c=>s.jsx(s.Fragment,{children:s.jsx(t0,{shapes:Ml,ids:cr,zoom:c,selected:un,interactive:j==="select",onSelect:(h,p)=>{ga(N=>p?N.includes(h)?N.filter(k=>k!==h):[...N,h]:N.includes(h)?N:[h]),p||(w([]),z([]))},onChange:(h,p,N)=>bn(k=>{var _e;const $=(_e=k.shapes)==null?void 0:_e[h];if(!$)return k;const L=p.x!=null?p.x-$.x:0,te=p.y!=null?p.y-$.y:0,Ee=(L||te)&&p.w==null&&un.includes(h)?Qn(k,L,te,x,M,un.filter(yt=>yt!==h)):k;return{...Ee,shapes:{...Ee.shapes??{},[h]:{...$,...p}}}},N?p.w!=null?d.history.resizeShape:d.history.moveShape:void 0),onContext:(h,p)=>Nt({x:p.clientX,y:p.clientY,title:d.menu.shape,items:[{label:d.menu.front,shortcut:`${ut}]`,run:()=>jo(h,"front")},{label:d.menu.back,shortcut:`${ut}[`,run:()=>jo(h,"back")},"sep",{label:d.menu.delete,shortcut:"⌫",danger:!0,run:()=>Al([h])}]})})}),iframeRef:(c,h)=>{h&&ct.current.get(c)!==h&&(ct.current.set(c,h),(c===T||c===xe||c===xn||c===ot||en.some(N=>N.file===c&&!N.resolved)||zt.tagsOf(c).some(N=>N.paths.length))&&of(N=>N+1))}}),Tw.includes(j)&&s.jsx(Rw,{store:m,tool:j,onDone:c=>Ii(c)}),St.length===0&&nr.length===0&&cr.length===0&&s.jsxs("div",{className:"canvas-empty",children:[s.jsx(Q,{name:"board",size:32}),s.jsx("p",{children:d.app.emptyPage}),s.jsxs("button",{className:"primary",onClick:()=>E("board"),children:[d.app.drawBoard," ",s.jsx("kbd",{children:"B"})]})]})]}),!Xn&&qe?s.jsx(k1,{win:lt,bottom:Ge,room:be&&!kt?lt.w-En-vi:lt.w,onSwitch:()=>{const c=qe.target;jt.save({mode:"host",intro:!0}).then(()=>sr(c))},onKeep:()=>{const c=qe.chat;rn(null),jt.save({intro:!0}),c()}}):!Xn&&Hn&&s.jsx(zw,{win:lt,first:mc,onSize:Dn}),!Xn&&Ar&&xa&&!hc&&!Ht&&!ye&&!(P&&P.at.kind==="element"&&P.at.file===T&&P.at.path===xa.path)&&s.jsx(d1,{store:m,target:fc,bounds:gs,selection:xa,inline:(()=>{var p;const c=(p=ct.current.get(T))==null?void 0:p.contentDocument,h=c?An(c,xa.path):null;return h?vy(h):{}})(),tokens:Ye,vars:Ps,onStyle:Yi,onAskAi:()=>Za(vo(),()=>Xs(vo())),onComment:()=>{var p;const c=fc(),h=T;pl({file:h,path:xa.path,x:c?c.x+c.w:lt.w/2,y:c?c.y:80,crumbs:[((p=r.boards[h])==null?void 0:p.title)??h,...xa.label?[xa.label]:[]]})},onMore:c=>{var h;return(h=Vs.current)==null?void 0:h.call(Vs,xa.path,c)}}),Ht&&s.jsx(I0,{store:m,target:()=>Do(Ht),bounds:gs,gap:Ht.kind==="element"?Kd:8,about:Ht.about,onSend:c=>or(Ht,c),onClose:()=>za(null),onHistory:Ht.kind==="canvas"?()=>{za(null),Ra()}:void 0,initial:(Bo=Ht.target)==null?void 0:Bo.text,sendLabel:jt.host?d.requests.addForAi:void 0},`${Ht.kind}:${Ht.file??""}:${Ht.path??""}`),P&&!ye&&!Ht&&s.jsx(W0,{store:m,target:()=>Do(P.at),bounds:gs,gap:P.at.kind==="element"&&P.at.file===T&&((co=we.state.selection)==null?void 0:co.path)===P.at.path?Kd:8,onOpen:()=>Ra()},P.id),ye&&!Ht&&s.jsx(e1,{store:m,target:()=>Do(ye.at),bounds:gs,gap:ye.at.kind==="element"&&ye.at.file===T&&((Xu=we.state.selection)==null?void 0:Xu.path)===ye.at.path?Kd:8,status:ye.status,reply:ye.reply,onUndo:ye.files.length||ye.at.file?()=>{var c;return((c=ht.current)==null?void 0:c.undo(ye.id))??Promise.resolve()}:void 0,onOpen:()=>{ke(null),Ra()},onClose:()=>ke(null)},ye.id),dc&&s.jsxs("nav",{className:"oc-card oc-nav oc-nav-c",style:{left:En,bottom:Oo,width:lo},"aria-label":d.app.navigation,children:[s.jsx(F1,{store:m,className:"oc-map",w:lo,h:xi,inset:6,reserve:32,rects:Tr,selected:x,size:Tn,onJump:ff}),s.jsx(Ow,{store:m,onZoom:Ys,onPct:c=>{const h=c.currentTarget.getBoundingClientRect();oc({clientX:h.left,clientY:h.top-8},!0)},onFit:ui,over:!0})]}),s.jsxs("aside",{className:`oc-card oc-right ${kt?"is-rest":""} ${Xn?"oc-sheet":""} ${ao?"is-col":""} ${ao&&gc?"is-short":""}`,"aria-label":d.app.inspectorAside,style:Xn?{top:zr,height:lt.h-zr-8}:ao?{width:Jo,bottom:0,paddingBottom:gc}:void 0,children:[s.jsxs("div",{className:"oc-rhead",ref:Us,children:[s.jsxs("span",{className:"oc-cmts-pair",children:[s.jsxs("button",{className:`oc-abtn oc-cmts ${gl?"on":""}`,"aria-label":d.toolbar.commentsTitle(ys),"aria-pressed":gl,title:d.comments.modeTitle,onClick:uc,children:[s.jsx(Q,{name:"comment"}),ys>0&&s.jsx("span",{className:"oc-acount",children:ys})]}),s.jsx("button",{className:`oc-abtn oc-cmts-all ${ba&&!kt?"on":""}`,"aria-label":d.comments.allTitle,"aria-pressed":ba&&!kt,title:d.comments.allTitle,onClick:to,children:s.jsx(Q,{name:"chevronDown",size:14})})]}),s.jsxs("button",{className:`ask-ai ${it==="chat"&&!kt||(Ht==null?void 0:Ht.kind)==="canvas"?"on":""}`,"aria-label":d.toolbar.aiChat,"aria-pressed":it==="chat"&&!kt||(Ht==null?void 0:Ht.kind)==="canvas",title:d.toolbar.aiChatTitle(ut),onClick:()=>(Ht==null?void 0:Ht.kind)==="canvas"?za(null):it==="chat"&&!kt?Ve?Gl():yn("inspect"):Za(null,()=>Xs(null)),children:[s.jsx("span",{className:"ask-ai-label",children:d.toolbar.askAi}),s.jsx("span",{className:"ask-ai-short","aria-hidden":"true",children:"AI"}),jt.host&&s.jsx(j1,{n:Gy(en)})]}),s.jsx(rw,{pages:Je,currentPage:hn,selected:x}),!fe&&s.jsx("button",{className:`icon-btn oc-ib oc-play ${(sn=Ct==null?void 0:Ct.className)!=null&&sn.startsWith("play-menu")?"on":""}`,"aria-label":d.toolbar.playMenu,"aria-haspopup":"menu","aria-expanded":!!((yc=Ct==null?void 0:Ct.className)!=null&&yc.startsWith("play-menu")),title:d.toolbar.playMenu,disabled:!St.length,onClick:c=>{const h=c.currentTarget.closest(".oc-rhead").getBoundingClientRect();So({clientX:h.right,clientY:h.bottom+8})},children:s.jsx(Q,{name:"play"})}),fe?s.jsxs(s.Fragment,{children:[Xa>=5?s.jsx("button",{className:`icon-btn oc-ib oc-proto-more ${(Ct==null?void 0:Ct.className)==="proto-more"?"on":""}`,"aria-label":d.toolbar.protoMore,"aria-haspopup":"menu",title:d.toolbar.protoMore,onClick:c=>{const h=c.currentTarget.getBoundingClientRect();Nt({x:h.left,y:h.bottom+8,className:"proto-more",items:[{label:d.toolbar.restart,run:()=>pe(p=>p+1)},{label:d.canvas.exportBoard,run:()=>void No(fe)},{label:d.toolbar.copyLink,run:()=>void ec(Wi("play",fe))}]})},children:s.jsx(Q,{name:"more"})}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"icon-btn oc-ib oc-restart","aria-label":d.toolbar.restart,title:d.toolbar.restart,onClick:()=>pe(c=>c+1),children:s.jsx(Q,{name:"restore"})}),s.jsx("button",{className:"icon-btn oc-ib oc-export","aria-label":d.canvas.exportBoard,title:d.canvas.exportBoard,onClick:()=>void No(fe),children:s.jsx(Q,{name:"download"})}),s.jsx("button",{className:"icon-btn oc-ib oc-copylink","aria-label":d.toolbar.copyLink,title:d.toolbar.copyLink,onClick:()=>void ec(Wi("play",fe)),children:s.jsx(Q,{name:"link"})})]}),s.jsx("button",{className:"icon-btn oc-ib oc-prev","aria-label":d.toolbar.prevBoard,title:d.toolbar.prevBoard,disabled:ya.flatMap(c=>c.files)[0]===fe,onClick:()=>mi(-1),children:s.jsx(Q,{name:"chevronLeft"})}),s.jsx("button",{className:"icon-btn oc-ib oc-next","aria-label":d.toolbar.nextBoard,title:d.toolbar.nextBoard,disabled:ya.flatMap(c=>c.files).slice(-1)[0]===fe,onClick:()=>mi(1),children:s.jsx(Q,{name:"chevronRight"})}),s.jsx("div",{className:"oc-seg oc-full-mode",role:"radiogroup","aria-label":d.full.mode,children:["fill","fit"].map(c=>s.jsx("button",{role:"radio","aria-checked":R===c,className:R===c?"on":"",title:c==="fill"?d.full.fillTitle:d.full.fitTitle,onClick:()=>Y(c),children:c==="fill"?d.full.fill:d.full.fit},c))})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`icon-btn oc-ib oc-ptoggle ${kt?"":"on"}`,"aria-label":d.toolbar.panelToggle,"aria-pressed":!kt,title:d.toolbar.panelToggleTitle(ut),onClick:zo,children:s.jsx(Q,{name:"panelRight"})}),s.jsx(Aw,{store:m,expanded:!!((bc=Ct==null?void 0:Ct.className)!=null&&bc.startsWith("zoom")),onOpen:c=>{const h=c.currentTarget.getBoundingClientRect();oc({clientX:h.right,clientY:h.bottom+8})}})]})]}),!kt&&s.jsx("div",{className:"oc-col-head",children:it==="chat"?s.jsx("h2",{className:"oc-col-title",children:d.tabs.ai}):ba?s.jsx("h2",{className:"oc-col-title",children:d.comments.title}):s.jsx("div",{className:"oc-tabs oc-col-tabs",role:"tablist","aria-label":d.tabs.right,ref:ii,children:(Xn?["props","layers","code","tweaks"]:["props","code","tweaks"]).map(c=>s.jsx("button",{role:"tab","aria-selected":Rl===c,className:Rl===c?"on":"",onClick:()=>lc(c),children:c==="props"?d.tabs.properties:c==="code"?d.tabs.code:c==="tweaks"?d.tabs.tweaks:d.tabs.layers},c))})}),it==="chat"&&!kt&&jt.host&&!na&&s.jsx(S1,{req:jt,comments:en,actions:ir,compact:Ve,onOpen:c=>{pi.current=!0,window.setTimeout(()=>pi.current=!1,0),w([c.file]),pa([c.file])}}),s.jsxs("div",{className:"chat-wrap",hidden:kt||it!=="chat"||jt.host&&!na,children:[jt.host&&na&&s.jsxs("button",{className:"req-back",onClick:()=>Et(!1),children:[s.jsx(Q,{name:"parent",size:14})," ",d.requests.backToRequests]}),s.jsx(P0,{selection:T&&(($r=we.state.selection)==null?void 0:$r.file)===T?we.state.selection:null,boards:T?[T]:x,visibleCount:yl,titleOf:c=>{var h;return((h=r.boards[c])==null?void 0:h.title)??c},sizeOf:c=>r.boards[c]?{w:r.boards[c].w,h:r.boards[c].h}:null,storeKey:(n==null?void 0:n.dir)??null,confirm:la.confirm,attach:sf,setAttach:bu,draft:Os,setDraft:Kc,subscribe:Hi,onLocate:pa,inputRef:ns,open:it==="chat"&&!kt,handle:ht,onRunEnd:$u,settingsElsewhere:!0})]}),it==="inspect"&&!kt&&!ba&&Rl==="code"&&(()=>{var p;const c=T?(p=ct.current.get(T))==null?void 0:p.contentDocument:null,h=gn&&T&&c?An(c,gn.path):null;return h&&gn&&T?s.jsx(mw,{el:h,tag:gn.tag,label:gn.label,path:gn.path,onSave:async N=>{const k=await Oa(T,gn.path).catch(()=>null);return!!k&&!!await fn({op:"setStyleText",path:gn.path,hash:k,text:N},T)}},`${T}:${gn.path}`):s.jsx("div",{className:"pp inspector oc-code",children:s.jsx("p",{className:"oc-empty oc-col-empty",children:d.tabs.codeEmpty})})})(),it==="inspect"&&!kt&&!ba&&Rl==="tweaks"&&(()=>{var p;const c=T??ot,h=c?(p=ct.current.get(c))==null?void 0:p.contentDocument:null;return s.jsx("div",{className:"pp inspector oc-tweaks",children:c&&mu(h)?s.jsx("div",{className:"pp-scroll",children:s.jsx(r1,{doc:h,onSave:async N=>{try{await Te.post("/api/edit",{file:c,op:"setTweaks",values:N}),ve({tone:"ok",text:d.toast.tweaksSaved,action:kn})}catch(k){ve({tone:"error",text:String(k.message)})}}},`${c}-${ha[c]??0}-${Ga}`)}):s.jsx("p",{className:"oc-empty oc-col-empty",children:d.tabs.tweaksEmpty})})})(),it==="inspect"&&!kt&&!ba&&Rl==="layers"&&Xn&&s.jsx("div",{className:"pp inspector oc-layers-tab",children:s.jsx("div",{className:"pp-scroll",children:T??ot?s.jsx(xm,{file:T??ot,version:ha[T??ot]??0,selected:T?we.state.paths:[],onSelect:(c,h)=>{const p=T??ot,N=T?we.state.paths:[];tn(p,h?N.includes(c)?N.filter(k=>k!==c):[...N,c]:[c])},onMove:()=>{}}):s.jsx(Zy,{boards:St.map(c=>({file:c,title:r.boards[c].title??c})),versions:ha,onPickBoard:c=>Ka([c]),onPickElement:(c,h)=>tn(c,[h])})})}),it==="inspect"&&!kt&&(ba||Rl==="props"||Rl==="layers"&&!Xn)&&s.jsxs(Xy,{section:ba?"comments":"props",author:Nl||d.app.defaultAuthor,onAuthor:async()=>{const c=await la.prompt({title:d.dialog.authorTitle,label:d.dialog.name,value:Nl,ok:d.dialog.save});if(c!=null&&c.value.trim()){li(c.value.trim());try{localStorage.setItem("design-canvas:author",c.value.trim())}catch{}}},onAskAI:c=>Za(()=>Ou(c),()=>Qi(c)),host:jt.host,onAddForAi:async(c,h)=>{var p;await Te.post("/api/requests",{action:"create",file:T??ot,path:h,text:c,author:cl,attach:{kind:h?"element":"board",...h&&((p=vo())==null?void 0:p.path)===h?{label:vo().label}:{}}}),ve({tone:"ok",text:d.requests.added})},reqActions:ir,file:T??ot,selection:we.state.selection,crumbs:(()=>{var $,L;const c=we.state.selection,h=T?($=ct.current.get(T))==null?void 0:$.contentDocument:null;if(!T||!c||c.file!==T||!h)return null;const p=te=>{if(!te)return"";const{kind:Ae,label:Ee}=iu(te);if(Ae!=="container")return Ee?`${d.inspector.kindName(Ae)} "${Ee.slice(0,24)}"`:d.inspector.kindName(Ae);const _e=te.classList[0];return`${d.inspector.kindName(Ae)}${te.id?` #${te.id}`:_e?` .${_e}`:""}`},{paths:N,skipped:k}=Kx(c.path);return s.jsx(f1,{board:((L=r.boards[T])==null?void 0:L.title)??T,parents:N.map(te=>({path:te,name:p(An(h,te))})),skipped:k,current:p(An(h,c.path)),title:d.inspector.crumbElement(c.tag,c.path),onBoard:()=>_(null),onPath:te=>void we.select([te])})})(),commentRef:he,multi:we.state.paths.length,error:we.state.error,comments:en,listAll:ba&&!(T??ot)?"comments":null,titleOf:c=>{var h;return((h=r.boards[c])==null?void 0:h.title)??c},pageFiles:St,onCommentMenu:Er,focusComment:Rn,nameOf:(c,h)=>{var L;const p=(L=ct.current.get(c))==null?void 0:L.contentDocument,N=p?An(p,h):null;if(!N)return null;const{kind:k,label:$}=iu(N);return $?`${d.inspector.kindName(k)} “${$.slice(0,24)}”`:d.inspector.kindName(k)},compact:Ve,threadOnly:Mr,onOpenThread:c=>ba&&!(T??ot)?rc(c):D(c.id),onAllComments:()=>D(null),onSelectPath:c=>{const h=T??ot;h&&tn(h,[c])},onDuplicate:gn?()=>void fn({op:"duplicate",path:gn.path,hash:gn.hash}):void 0,onDelete:gn?async()=>{await fn({op:"delete",path:gn.path,hash:gn.hash})&&we.select([])}:void 0,footer:!T&&ot&&r.boards[ot]?s.jsx(K1,{onFocus:()=>hi(ot),onDuplicate:()=>void ar(ot),onFront:()=>is([ot],"front"),onBack:()=>is([ot],"back"),onDelete:()=>void Zi([ot])}):void 0,children:[hs&&s.jsx(Zy,{boards:St.map(c=>({file:c,title:r.boards[c].title??c})),versions:ha,onPickBoard:c=>Ka([c]),onPickElement:(c,h)=>tn(c,[h])}),T&&wa(),!T&&Ds&&Ml[Ds]&&s.jsx(a0,{shape:Ml[Ds],onPatch:c=>Du(Ds,c,d.history.shapeStyle),onDelete:()=>Al([Ds]),onFront:()=>jo(Ds,"front"),onBack:()=>jo(Ds,"back")}),!T&&H&&r.notes[H]&&s.jsx(l0,{note:r.notes[H],onPatch:c=>bn(h=>{const p={...h.notes[H],...c};for(const N of Object.keys(p))p[N]===void 0&&delete p[N];return{...h,notes:{...h.notes,[H]:p}}},d.history.noteStyle),onDelete:()=>wo([H])}),!T&&ot&&r.boards[ot]&&s.jsx(Y1,{file:ot,item:r.boards[ot],pages:Je,isLaunch:((Or=r.launch)==null?void 0:Or.view)==="focused"&&r.launch.file===ot,onPatch:c=>hf(ot,c),onRename:()=>void Fi(ot),onRenameFile:()=>void lr(ot),onLaunch:c=>bn(h=>({...h,launch:c?{view:"focused",file:ot}:{view:"canvas"}}),d.history.launchScreen)}),!T&&Ln,!T&&ot&&r.boards[ot]&&s.jsx(uu,{id:"guides",title:d.sections.guides,count:(((Ku=r.guides)==null?void 0:Ku[ot])??[]).length,children:s.jsx(c0,{guides:((vc=r.guides)==null?void 0:vc[ot])??[],onChange:(c,h)=>bn(p=>({...p,guides:{...p.guides??{},[ot]:c}}),h)})}),!T&&un.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.shapes.selectedN(un.length)}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":d.shapes.deleteAll,title:d.shapes.deleteAll,onClick:()=>Al(un),children:s.jsx(Q,{name:"trash"})})})]}),!T&&M.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.notes.selectedN(M.length)}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":d.notes.deleteAll,title:d.notes.deleteAll,onClick:()=>wo(M),children:s.jsx(Q,{name:"trash"})})})]}),!T&&x.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.boardOptions.selectedN(x.length)}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"icon-btn","aria-label":d.boardOptions.front,title:d.boardOptions.frontTitleMod(ut),onClick:()=>is(x,"front"),children:s.jsx(Q,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":d.boardOptions.back,title:d.boardOptions.backTitleMod(ut),onClick:()=>is(x,"back"),children:s.jsx(Q,{name:"back"})}),s.jsx("button",{className:"icon-btn","aria-label":d.boardOptions.goToSelected,title:d.boardOptions.goToSelectedTitle,onClick:()=>Cl(x),children:s.jsx(Q,{name:"fit"})}),s.jsx("button",{className:"icon-btn danger","aria-label":d.boardOptions.delete,title:d.boardOptions.deleteTitleKey,onClick:()=>void Zi(x),children:s.jsx(Q,{name:"trash"})})]})]}),T&&we.state.selection&&we.state.selection.file===T&&(()=>{var k;const c=we.state.selection,h=(k=ct.current.get(T))!=null&&k.contentDocument?An(ct.current.get(T).contentDocument,c.path):null,p={};if(h)for(const $ of Array.from(h.attributes))p[$.name]=$.value;const N=we.state.paths;return s.jsx(nw,{tokens:Ye,bg:(()=>{let $=h;const L=h==null?void 0:h.ownerDocument.defaultView;for(;$&&L;$=$.parentElement){const te=L.getComputedStyle($).backgroundColor;if(te&&!/rgba\(0, 0, 0, 0\)|transparent/.test(te))return te}return"rgb(255, 255, 255)"})(),onAlign:async $=>{var Ae;const L=(Ae=ct.current.get(T))==null?void 0:Ae.contentDocument,te=L&&y1(L,c.path,c.hash,$);if(!te)return ve({text:d.toast.blockFlow});await fn({op:"batch",ops:te})},onExport:async()=>{try{const $=await Te.blob("/api/screenshot",{file:T,path:c.path,inline:!0}),L=URL.createObjectURL($),te=document.createElement("a");te.href=L,te.download=`${Py(T).replace(/\.png$/,"")}-${c.tag}.png`,document.body.append(te),te.click(),te.remove(),setTimeout(()=>URL.revokeObjectURL(L),1e4)}catch($){const L=$;am(L.status,L.message)==="browser"?ve({tone:"error",text:d.toast.pngNeedsBrowser,code:"npx playwright install chromium",ms:1e4}):ve({tone:"error",text:d.toast.pngFailed(lm(L.message))})}},onReplaceImage:c.tag==="img"||/url\(/.test(c.styles["background-image"]??"")?()=>Gi(c.path,c.tag==="img"):null,selection:c,inline:h?vy(h):{},attrs:p,canWrap:N.length>=2,vars:Ps,onStyle:Yi,onAttr:($,L)=>void fn({op:"setAttr",path:c.path,hash:c.hash,name:$,value:L}),onWrap:async $=>{const L=[...N].sort((Ae,Ee)=>Number(Ae.split("/").pop())-Number(Ee.split("/").pop())),te=await Promise.all(L.map(Ae=>Oa(T,Ae)));await fn({op:"wrap",paths:L,hashes:te,display:$})&&we.select([L[0]])},children:Ln})})(),!T&&wa()]})]}),!Xn&&s.jsx($w,{tool:j,setTool:E,phone:_t,foldShapes:!0,win:lt,room:lt.w,hist:ll,histOpen:os,caretRef:Fn,onNewBoard:c=>di(_l(c)),onToolsMenu:c=>xr(_l(c)),onShapesMenu:c=>yi(_l(c)),onInsertImage:()=>ls(()=>c=>{ls(null),cs(c)}),onUndo:()=>void fl("undo"),onRedo:()=>void fl("redo"),onHistory:()=>os?Co():kr()}),ce&&s.jsx(P1,{board:r,file:ce,onClose:()=>ge(null),onLocate:c=>{w([c]),Cl([c])}}),Fe&&r.boards[Fe]&&s.jsx(ab,{board:r,file:Fe,mode:R,onMode:Y,onClose:nc,onExport:()=>void No(Fe)}),fe&&r.boards[fe]&&s.jsx(ab,{bare:!0,className:"is-proto",board:r,file:fe,mode:R,onMode:Y,onClose:Ba,reloadKey:ue,style:ao?{right:Jo}:void 0,onKey:c=>c==="Escape"?Ba():mi(c==="ArrowLeft"?-1:1)}),s.jsx(C0,{open:!!ai,version:zn,onClose:()=>ls(null),onPick:c=>ai==null?void 0:ai(c),onError:c=>ve({tone:"error",text:c})}),It&&s.jsx("button",{className:"icon-btn calm-handle","aria-label":d.toolbar.showTools,title:d.toolbar.showToolsTitle(ut),onClick:vn,children:s.jsx(Q,{name:"eye",size:16})}),s.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:Ce}),s.jsx(H0,{menu:Ct,onClose:()=>Nt(null)}),Kt&&!ce&&(()=>{const c=Is(Kt.file,Kt.key);return c?s.jsx(qx,{file:Kt.file,tag:c,me:cl,now:zt.now,conflict:Kt.conflict,busy:Kt.busy,onCompare:()=>_i({file:Kt.file,step:c.steps[c.steps.length-1],added:c.newBoard}),onUndo:h=>void Cn(Kt.file,c,h),onCancelConflict:()=>$a(h=>h&&{...h,conflict:null}),onClose:()=>$a(null)}):null})(),dl&&!ce&&(()=>{const c=Gd(r,dl.file);return c?s.jsx(H1,{file:dl.file,group:c,board:r,busy:dl.busy,onApply:()=>void Js(dl.file),onKeepAll:()=>void cc(dl.file),onClose:()=>Ya(null)}):null})(),Yn&&r.boards[Yn.file]&&s.jsx(yb,{before:M0(Yn.step),notBefore:d.compare.notBeforeChange,boards:[{file:Yn.file,kind:Yn.added?"added":"changed",title:r.boards[Yn.file].title??Yn.file,w:r.boards[Yn.file].w,h:r.boards[Yn.file].h}],onClose:()=>_i(null)}),os&&s.jsx(Gx,{steps:((xc=zt.data)==null?void 0:xc.steps)??[],me:cl,now:zt.now,anchor:((wc=Fn.current)==null?void 0:wc.getBoundingClientRect())??null,busy:qi,onGo:c=>void Sr(c),onClose:Co}),va&&r.boards[va.file]&&s.jsx(uw,{at:{x:va.x,y:va.y},crumbs:va.crumbs,host:jt.host,onCancel:()=>pl(null),onSubmit:async(c,h)=>{jt.host&&h?await Te.post("/api/requests",{action:"create",file:va.file,path:va.path,text:c,author:cl,attach:{kind:va.path?"element":"board"}}):await Te.post("/api/comments",{file:va.file,path:va.path,text:c,author:Nl||d.app.defaultAuthor}),pl(null)}}),mn&&kt&&en.some(c=>c.id===mn.id)&&s.jsx(dw,{at:{x:mn.x,y:mn.y},onClose:eo,children:s.jsx(Xy,{author:Nl||d.app.defaultAuthor,onAuthor:()=>{},file:en.find(c=>c.id===mn.id).file,selection:null,multi:0,error:null,comments:en,focusComment:mn.id,threadOnly:!0,section:"comments",host:jt.host,reqActions:ir,onAskAI:c=>Za(()=>Ou(c),()=>Qi(c)),onCommentMenu:Er,nameOf:(c,h)=>{var L;const p=(L=ct.current.get(c))==null?void 0:L.contentDocument,N=p?An(p,h):null;if(!N)return null;const{kind:k,label:$}=iu(N);return $?`${d.inspector.kindName(k)} “${$.slice(0,24)}”`:d.inspector.kindName(k)},onSelectPath:c=>{const h=en.find(p=>p.id===mn.id);eo(),tn(h.file,[c])}})}),s.jsx(_0,{state:la.state,onClose:la.close})]})})}function Ew(n,o,r){const f=n.split("/").map(Number),m=o===""?[]:o.split("/").map(Number),g=f.length-1;return m.length>g&&m.slice(0,g).every((v,S)=>v===f[S])&&m[g]>f[g]&&m[g]--,[...m,r].join("/")}function rm({r:n,cls:o,px:r=1}){return s.jsx("div",{className:`box ${o}`,style:{left:n.x,top:n.y,width:n.w,height:n.h,"--px":`${r}px`}})}function ib(){const n=document.querySelector(".canvas");n&&(n.tabIndex=-1,n.focus({preventScroll:!0}))}function Mw(n){return s.jsxs("div",{className:`oc-zoom ${n.over?"is-over":""}`,children:[s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.toolbar.zoomOut,title:d.toolbar.zoomOutTitle(ut),onClick:()=>n.onZoom(1/2),children:s.jsx(Q,{name:"minus"})}),s.jsxs("button",{className:"zoom","aria-haspopup":"menu","aria-label":d.toolbar.zoomMenu(Math.round(n.zoom*100)),onClick:n.onPct,children:[Math.round(n.zoom*100),"%"]}),s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.toolbar.zoomIn,title:d.toolbar.zoomInTitle(ut),onClick:()=>n.onZoom(2),children:s.jsx(Q,{name:"plus"})}),s.jsx("button",{className:"icon-btn oc-ib oc-fit","aria-label":d.toolbar.fitAll,title:d.toolbar.fitAllTitle,onClick:n.onFit,children:s.jsx(Q,{name:"fit"})})]})}function Aw({store:n,expanded:o,onOpen:r}){const f=Math.round(Id(n,m=>m.zoom)*100);return s.jsxs("button",{className:`oc-zoom-btn ${o?"on":""}`,"aria-haspopup":"menu","aria-expanded":o,"aria-label":d.toolbar.zoomMenu(f),onClick:r,children:[s.jsxs("span",{className:"zoom-pct",children:[f,"%"]}),s.jsx(Q,{name:"chevronDown",size:16})]})}function zw({win:n,first:o,onSize:r}){const f=b.useRef(null),[m,g]=b.useState(!1),[v,S]=b.useState(0);b.useLayoutEffect(()=>g(!1),[n.w,o]),b.useLayoutEffect(()=>{f.current&&(r==null||r(f.current.offsetHeight,f.current.offsetWidth))}),b.useEffect(()=>()=>r==null?void 0:r(0,0),[]),b.useLayoutEffect(()=>{var W;const z=f.current;if(!o||!z)return;const H=((W=document.querySelector(".oc-dock"))==null?void 0:W.offsetWidth)??0;H!==v&&S(H),!m&&z.scrollWidth>n.w-16&&g(!0)});const j=wb(f,n.w),E={left:j??void 0,visibility:j==null?"hidden":void 0};if(!o)return s.jsx("div",{ref:f,className:"canvas-hint","aria-hidden":"true",style:E,children:d.canvas.hint});const x=`${ut}J`,[w,M]=d.app.firstRunAi(ut).split(x);return s.jsxs("div",{ref:f,className:`canvas-hint oc-first ${m?"is-stacked":""}`,role:"status",style:{...E,minWidth:m?void 0:v||void 0},children:[s.jsxs("span",{className:"oc-fr",children:[s.jsx(Q,{name:"select"}),s.jsx("span",{children:d.app.firstRunEdit})]}),s.jsx("span",{className:"oc-fr-sep","aria-hidden":"true"}),s.jsxs("span",{className:"oc-fr",children:[s.jsx(Q,{name:"ai"}),s.jsxs("span",{children:[w,s.jsx("kbd",{children:x}),M]})]})]})}function $w(n){const o=b.useRef(null),r=wb(o,n.win.w,n.room),f=(v,S)=>s.jsx("button",{role:"radio","aria-checked":n.tool===v.id,"aria-label":d.toolbar.tool(v.label,v.key),title:S,className:`icon-btn tool ${n.tool===v.id?"on":""}`,onClick:()=>n.setTool(v.id),children:s.jsx(Q,{name:v.icon})},v.id),m=Wo.slice(0,5).find(v=>v.id===n.tool),g=Wo.slice(5).find(v=>v.id===n.tool);return s.jsxs("div",{ref:o,className:"oc-dock",role:"toolbar","aria-label":d.toolbar.aria,style:{left:r??void 0,visibility:r==null?"hidden":void 0},children:[s.jsxs("button",{className:"new-board","aria-haspopup":"menu","aria-label":n.phone?d.toolbar.newBoard:void 0,title:d.toolbar.newBoardTitle,onClick:n.onNewBoard,children:[s.jsx(Q,{name:"plus"}),!n.phone&&s.jsx("span",{children:d.toolbar.newBoard}),s.jsx(Q,{name:"chevronDown",size:16,className:"s"})]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),n.phone?s.jsxs("button",{className:`icon-btn tool oc-fold ${m?"on":""}`,"aria-label":d.toolbar.canvasTools,"aria-haspopup":"menu",title:d.toolbar.canvasTools,onClick:n.onToolsMenu,children:[s.jsx(Q,{name:(m==null?void 0:m.icon)??"select"}),s.jsx(Q,{name:"chevronDown",size:16,className:"s"})]}):s.jsxs("div",{className:"oc-group",role:"radiogroup","aria-label":d.toolbar.canvasTools,children:[Wo.slice(0,2).map(v=>f(v,d.toolbar.tool(v.hint,v.key))),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),Wo.slice(2,5).map(v=>f(v,d.toolbar.tool(v.hint,v.key)))]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),n.foldShapes?s.jsxs("button",{className:`icon-btn tool oc-fold ${g?"on":""}`,"aria-label":d.toolbar.shapes,"aria-haspopup":"menu",title:d.toolbar.shapes,onClick:n.onShapesMenu,children:[s.jsx(Q,{name:(g==null?void 0:g.icon)??"rect"}),s.jsx(Q,{name:"chevronDown",size:16,className:"s"})]}):s.jsxs("div",{className:"oc-group",role:"radiogroup","aria-label":d.toolbar.shapes,children:[Wo.slice(5).map(v=>f(v,d.toolbar.shapeToolTitle(v.hint,v.key))),s.jsx("button",{className:"icon-btn","aria-label":d.toolbar.insertImage,title:d.toolbar.insertImageTitle,onClick:n.onInsertImage,children:s.jsx(Q,{name:"image"})})]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),s.jsxs("div",{className:"oc-group undo-split",children:[s.jsx("button",{className:"icon-btn","aria-label":d.toolbar.undo,title:d.toolbar.undoTitle(n.hist.undo.length?d.activity.stepName(n.hist.undo[n.hist.undo.length-1]):void 0,ut),disabled:!n.hist.canUndo,onClick:n.onUndo,children:s.jsx(Q,{name:"undo"})}),s.jsx("button",{ref:n.caretRef,className:`icon-btn caret-btn ${n.histOpen?"on":""}`,"aria-label":d.activity.historyButton,"aria-haspopup":"menu","aria-expanded":n.histOpen,title:d.activity.historyButton,onClick:n.onHistory,children:s.jsx(Q,{name:"chevronDown",size:16})}),s.jsx("button",{className:"icon-btn","aria-label":d.toolbar.redo,title:d.toolbar.redoTitle(n.hist.redo.length?d.activity.stepName(n.hist.redo[n.hist.redo.length-1]):void 0,ut),disabled:!n.hist.canRedo,onClick:n.onRedo,children:s.jsx(Q,{name:"redo"})})]})]})}function Ow({store:n,...o}){return s.jsx(Mw,{...o,zoom:Id(n,r=>r.zoom)})}function Rw({store:n,...o}){return s.jsx(n0,{...o,view:km(n)})}function Dw(){const n=b.useRef(new Map);return b.useCallback((o,r,f)=>{const m=n.current.get(o);if(m&&m.sig===r)return m.node;const g=f();return n.current.set(o,{sig:r,node:g}),g},[])}function Bw(n,o){if(!n)return o;if(JSON.stringify(n)===JSON.stringify(o))return n;const r=(f,m)=>{if(!f||!m)return m;const g={};for(const[v,S]of Object.entries(m))g[v]=f[v]!==void 0&&JSON.stringify(f[v])===JSON.stringify(S)?f[v]:S;return g};return{...o,boards:r(n.boards,o.boards),notes:r(n.notes,o.notes),shapes:r(n.shapes,o.shapes)}}class Hw extends b.Component{constructor(){super(...arguments);cy(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?s.jsxs("div",{className:"loading",role:"alert",children:[s.jsx(Q,{name:"warn"})," ",d.app.crashed," ",this.state.error.message,s.jsx("button",{onClick:()=>location.reload(),children:d.app.reload})]}):this.props.children}}document.documentElement.lang=Jd;wx.createRoot(document.getElementById("root")).render(s.jsx(Hw,{children:s.jsx(B0,{children:s.jsx(Cw,{})})}));