Files
Gnuboard7/public/build/core/template-engine.min.js
T
2026-04-01 10:30:52 +09:00

1872 lines
1.0 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var E_=Object.defineProperty;var __=(dn,Za,es)=>Za in dn?E_(dn,Za,{enumerable:!0,configurable:!0,writable:!0,value:es}):dn[Za]=es;var H=(dn,Za,es)=>__(dn,typeof Za!="symbol"?Za+"":Za,es);(function(dn){"use strict";function Za(r,e){for(var n=0;n<e.length;n++){const a=e[n];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in r)){const o=Object.getOwnPropertyDescriptor(a,i);o&&Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function es(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ru={exports:{}},Qe={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Tp;function pS(){if(Tp)return Qe;Tp=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),d=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),y=Symbol.iterator;function w(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,k={};function A(U,q,ie){this.props=U,this.context=q,this.refs=k,this.updater=ie||v}A.prototype.isReactComponent={},A.prototype.setState=function(U,q){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,q,"setState")},A.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function R(){}R.prototype=A.prototype;function N(U,q,ie){this.props=U,this.context=q,this.refs=k,this.updater=ie||v}var D=N.prototype=new R;D.constructor=N,C(D,A.prototype),D.isPureReactComponent=!0;var M=Array.isArray;function L(){}var z={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function he(U,q,ie){var se=ie.ref;return{$$typeof:r,type:U,key:q,ref:se!==void 0?se:null,props:ie}}function be(U,q){return he(U.type,q,U.props)}function X(U){return typeof U=="object"&&U!==null&&U.$$typeof===r}function ge(U){var q={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(ie){return q[ie]})}var xe=/\/+/g;function le(U,q){return typeof U=="object"&&U!==null&&U.key!=null?ge(""+U.key):q.toString(36)}function je(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(L,L):(U.status="pending",U.then(function(q){U.status==="pending"&&(U.status="fulfilled",U.value=q)},function(q){U.status==="pending"&&(U.status="rejected",U.reason=q)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function J(U,q,ie,se,we){var Ee=typeof U;(Ee==="undefined"||Ee==="boolean")&&(U=null);var Oe=!1;if(U===null)Oe=!0;else switch(Ee){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(U.$$typeof){case r:case e:Oe=!0;break;case p:return Oe=U._init,J(Oe(U._payload),q,ie,se,we)}}if(Oe)return we=we(U),Oe=se===""?"."+le(U,0):se,M(we)?(ie="",Oe!=null&&(ie=Oe.replace(xe,"$&/")+"/"),J(we,q,ie,"",function(qe){return qe})):we!=null&&(X(we)&&(we=be(we,ie+(we.key==null||U&&U.key===we.key?"":(""+we.key).replace(xe,"$&/")+"/")+Oe)),q.push(we)),1;Oe=0;var tt=se===""?".":se+":";if(M(U))for(var Me=0;Me<U.length;Me++)se=U[Me],Ee=tt+le(se,Me),Oe+=J(se,q,ie,Ee,we);else if(Me=w(U),typeof Me=="function")for(U=Me.call(U),Me=0;!(se=U.next()).done;)se=se.value,Ee=tt+le(se,Me++),Oe+=J(se,q,ie,Ee,we);else if(Ee==="object"){if(typeof U.then=="function")return J(je(U),q,ie,se,we);throw q=String(U),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function F(U,q,ie){if(U==null)return U;var se=[],we=0;return J(U,se,"","",function(Ee){return q.call(ie,Ee,we++)}),se}function Q(U){if(U._status===-1){var q=U._result;q=q(),q.then(function(ie){(U._status===0||U._status===-1)&&(U._status=1,U._result=ie)},function(ie){(U._status===0||U._status===-1)&&(U._status=2,U._result=ie)}),U._status===-1&&(U._status=0,U._result=q)}if(U._status===1)return U._result.default;throw U._result}var pe=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},$={map:F,forEach:function(U,q,ie){F(U,function(){q.apply(this,arguments)},ie)},count:function(U){var q=0;return F(U,function(){q++}),q},toArray:function(U){return F(U,function(q){return q})||[]},only:function(U){if(!X(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Qe.Activity=x,Qe.Children=$,Qe.Component=A,Qe.Fragment=n,Qe.Profiler=i,Qe.PureComponent=N,Qe.StrictMode=a,Qe.Suspense=h,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(U){return z.H.useMemoCache(U)}},Qe.cache=function(U){return function(){return U.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(U,q,ie){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var se=C({},U.props),we=U.key;if(q!=null)for(Ee in q.key!==void 0&&(we=""+q.key),q)!Y.call(q,Ee)||Ee==="key"||Ee==="__self"||Ee==="__source"||Ee==="ref"&&q.ref===void 0||(se[Ee]=q[Ee]);var Ee=arguments.length-2;if(Ee===1)se.children=ie;else if(1<Ee){for(var Oe=Array(Ee),tt=0;tt<Ee;tt++)Oe[tt]=arguments[tt+2];se.children=Oe}return he(U.type,we,se)},Qe.createContext=function(U){return U={$$typeof:d,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},Qe.createElement=function(U,q,ie){var se,we={},Ee=null;if(q!=null)for(se in q.key!==void 0&&(Ee=""+q.key),q)Y.call(q,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(we[se]=q[se]);var Oe=arguments.length-2;if(Oe===1)we.children=ie;else if(1<Oe){for(var tt=Array(Oe),Me=0;Me<Oe;Me++)tt[Me]=arguments[Me+2];we.children=tt}if(U&&U.defaultProps)for(se in Oe=U.defaultProps,Oe)we[se]===void 0&&(we[se]=Oe[se]);return he(U,Ee,we)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(U){return{$$typeof:g,render:U}},Qe.isValidElement=X,Qe.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:Q}},Qe.memo=function(U,q){return{$$typeof:f,type:U,compare:q===void 0?null:q}},Qe.startTransition=function(U){var q=z.T,ie={};z.T=ie;try{var se=U(),we=z.S;we!==null&&we(ie,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(L,pe)}catch(Ee){pe(Ee)}finally{q!==null&&ie.types!==null&&(q.types=ie.types),z.T=q}},Qe.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Qe.use=function(U){return z.H.use(U)},Qe.useActionState=function(U,q,ie){return z.H.useActionState(U,q,ie)},Qe.useCallback=function(U,q){return z.H.useCallback(U,q)},Qe.useContext=function(U){return z.H.useContext(U)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(U,q){return z.H.useDeferredValue(U,q)},Qe.useEffect=function(U,q){return z.H.useEffect(U,q)},Qe.useEffectEvent=function(U){return z.H.useEffectEvent(U)},Qe.useId=function(){return z.H.useId()},Qe.useImperativeHandle=function(U,q,ie){return z.H.useImperativeHandle(U,q,ie)},Qe.useInsertionEffect=function(U,q){return z.H.useInsertionEffect(U,q)},Qe.useLayoutEffect=function(U,q){return z.H.useLayoutEffect(U,q)},Qe.useMemo=function(U,q){return z.H.useMemo(U,q)},Qe.useOptimistic=function(U,q){return z.H.useOptimistic(U,q)},Qe.useReducer=function(U,q,ie){return z.H.useReducer(U,q,ie)},Qe.useRef=function(U){return z.H.useRef(U)},Qe.useState=function(U){return z.H.useState(U)},Qe.useSyncExternalStore=function(U,q,ie){return z.H.useSyncExternalStore(U,q,ie)},Qe.useTransition=function(){return z.H.useTransition()},Qe.version="19.2.0",Qe}var Ap;function Ou(){return Ap||(Ap=1,Ru.exports=pS()),Ru.exports}var j=Ou();const Fe=es(j);var Lu={exports:{}},so={},Mu={exports:{}},$u={};/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Dp;function mS(){return Dp||(Dp=1,(function(r){function e(J,F){var Q=J.length;J.push(F);e:for(;0<Q;){var pe=Q-1>>>1,$=J[pe];if(0<i($,F))J[pe]=F,J[Q]=$,Q=pe;else break e}}function n(J){return J.length===0?null:J[0]}function a(J){if(J.length===0)return null;var F=J[0],Q=J.pop();if(Q!==F){J[0]=Q;e:for(var pe=0,$=J.length,U=$>>>1;pe<U;){var q=2*(pe+1)-1,ie=J[q],se=q+1,we=J[se];if(0>i(ie,Q))se<$&&0>i(we,ie)?(J[pe]=we,J[se]=Q,pe=se):(J[pe]=ie,J[q]=Q,pe=q);else if(se<$&&0>i(we,Q))J[pe]=we,J[se]=Q,pe=se;else break e}}return F}function i(J,F){var Q=J.sortIndex-F.sortIndex;return Q!==0?Q:J.id-F.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;r.unstable_now=function(){return o.now()}}else{var d=Date,g=d.now();r.unstable_now=function(){return d.now()-g}}var h=[],f=[],p=1,x=null,y=3,w=!1,v=!1,C=!1,k=!1,A=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function D(J){for(var F=n(f);F!==null;){if(F.callback===null)a(f);else if(F.startTime<=J)a(f),F.sortIndex=F.expirationTime,e(h,F);else break;F=n(f)}}function M(J){if(C=!1,D(J),!v)if(n(h)!==null)v=!0,L||(L=!0,ge());else{var F=n(f);F!==null&&je(M,F.startTime-J)}}var L=!1,z=-1,Y=5,he=-1;function be(){return k?!0:!(r.unstable_now()-he<Y)}function X(){if(k=!1,L){var J=r.unstable_now();he=J;var F=!0;try{e:{v=!1,C&&(C=!1,R(z),z=-1),w=!0;var Q=y;try{t:{for(D(J),x=n(h);x!==null&&!(x.expirationTime>J&&be());){var pe=x.callback;if(typeof pe=="function"){x.callback=null,y=x.priorityLevel;var $=pe(x.expirationTime<=J);if(J=r.unstable_now(),typeof $=="function"){x.callback=$,D(J),F=!0;break t}x===n(h)&&a(h),D(J)}else a(h);x=n(h)}if(x!==null)F=!0;else{var U=n(f);U!==null&&je(M,U.startTime-J),F=!1}}break e}finally{x=null,y=Q,w=!1}F=void 0}}finally{F?ge():L=!1}}}var ge;if(typeof N=="function")ge=function(){N(X)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,le=xe.port2;xe.port1.onmessage=X,ge=function(){le.postMessage(null)}}else ge=function(){A(X,0)};function je(J,F){z=A(function(){J(r.unstable_now())},F)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(J){J.callback=null},r.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<J?Math.floor(1e3/J):5},r.unstable_getCurrentPriorityLevel=function(){return y},r.unstable_next=function(J){switch(y){case 1:case 2:case 3:var F=3;break;default:F=y}var Q=y;y=F;try{return J()}finally{y=Q}},r.unstable_requestPaint=function(){k=!0},r.unstable_runWithPriority=function(J,F){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var Q=y;y=J;try{return F()}finally{y=Q}},r.unstable_scheduleCallback=function(J,F,Q){var pe=r.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?pe+Q:pe):Q=pe,J){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=Q+$,J={id:p++,callback:F,priorityLevel:J,startTime:Q,expirationTime:$,sortIndex:-1},Q>pe?(J.sortIndex=Q,e(f,J),n(h)===null&&J===n(f)&&(C?(R(z),z=-1):C=!0,je(M,Q-pe))):(J.sortIndex=$,e(h,J),v||w||(v=!0,L||(L=!0,ge()))),J},r.unstable_shouldYield=be,r.unstable_wrapCallback=function(J){var F=y;return function(){var Q=y;y=F;try{return J.apply(this,arguments)}finally{y=Q}}}})($u)),$u}var Rp;function yS(){return Rp||(Rp=1,Mu.exports=mS()),Mu.exports}var Iu={exports:{}},kn={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Op;function xS(){if(Op)return kn;Op=1;var r=Ou();function e(h){var f="https://react.dev/errors/"+h;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(h,f,p){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:x==null?null:""+x,children:h,containerInfo:f,implementation:p}}var d=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(h,f){if(h==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return kn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,kn.createPortal=function(h,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return o(h,f,null,p)},kn.flushSync=function(h){var f=d.T,p=a.p;try{if(d.T=null,a.p=2,h)return h()}finally{d.T=f,a.p=p,a.d.f()}},kn.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(h,f))},kn.prefetchDNS=function(h){typeof h=="string"&&a.d.D(h)},kn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var p=f.as,x=g(p,f.crossOrigin),y=typeof f.integrity=="string"?f.integrity:void 0,w=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?a.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:x,integrity:y,fetchPriority:w}):p==="script"&&a.d.X(h,{crossOrigin:x,integrity:y,fetchPriority:w,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},kn.preinitModule=function(h,f){if(typeof h=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=g(f.as,f.crossOrigin);a.d.M(h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(h)},kn.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,x=g(p,f.crossOrigin);a.d.L(h,p,{crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},kn.preloadModule=function(h,f){if(typeof h=="string")if(f){var p=g(f.as,f.crossOrigin);a.d.m(h,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(h)},kn.requestFormReset=function(h){a.d.r(h)},kn.unstable_batchedUpdates=function(h,f){return h(f)},kn.useFormState=function(h,f,p){return d.H.useFormState(h,f,p)},kn.useFormStatus=function(){return d.H.useHostTransitionStatus()},kn.version="19.2.0",kn}var Lp;function Mp(){if(Lp)return Iu.exports;Lp=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Iu.exports=xS(),Iu.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var $p;function bS(){if($p)return so;$p=1;var r=yS(),e=Ou(),n=Mp();function a(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function o(t){var s=t,c=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(c=s.return),t=s.return;while(t)}return s.tag===3?c:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function g(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function h(t){if(o(t)!==t)throw Error(a(188))}function f(t){var s=t.alternate;if(!s){if(s=o(t),s===null)throw Error(a(188));return s!==t?null:t}for(var c=t,u=s;;){var m=c.return;if(m===null)break;var b=m.alternate;if(b===null){if(u=m.return,u!==null){c=u;continue}break}if(m.child===b.child){for(b=m.child;b;){if(b===c)return h(m),t;if(b===u)return h(m),s;b=b.sibling}throw Error(a(188))}if(c.return!==u.return)c=m,u=b;else{for(var E=!1,O=m.child;O;){if(O===c){E=!0,c=m,u=b;break}if(O===u){E=!0,u=m,c=b;break}O=O.sibling}if(!E){for(O=b.child;O;){if(O===c){E=!0,c=b,u=m;break}if(O===u){E=!0,u=b,c=m;break}O=O.sibling}if(!E)throw Error(a(189))}}if(c.alternate!==u)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?t:s}function p(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=p(t),s!==null)return s;t=t.sibling}return null}var x=Object.assign,y=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),be=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function ge(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var xe=Symbol.for("react.client.reference");function le(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===xe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case A:return"Profiler";case k:return"StrictMode";case M:return"Suspense";case L:return"SuspenseList";case he:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case v:return"Portal";case N:return t.displayName||"Context";case R:return(t._context.displayName||"Context")+".Consumer";case D:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case z:return s=t.displayName||null,s!==null?s:le(t.type)||"Memo";case Y:s=t._payload,t=t._init;try{return le(t(s))}catch{}}return null}var je=Array.isArray,J=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},pe=[],$=-1;function U(t){return{current:t}}function q(t){0>$||(t.current=pe[$],pe[$]=null,$--)}function ie(t,s){$++,pe[$]=t.current,t.current=s}var se=U(null),we=U(null),Ee=U(null),Oe=U(null);function tt(t,s){switch(ie(Ee,s),ie(we,t),ie(se,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?$v(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=$v(s),t=Iv(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}q(se),ie(se,t)}function Me(){q(se),q(we),q(Ee)}function qe(t){t.memoizedState!==null&&ie(Oe,t);var s=se.current,c=Iv(s,t.type);s!==c&&(ie(we,t),ie(se,c))}function zt(t){we.current===t&&(q(se),q(we)),Oe.current===t&&(q(Oe),Wl._currentValue=Q)}var Et,$t;function kt(t){if(Et===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);Et=s&&s[1]||"",$t=-1<c.stack.indexOf(`
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Et+t+$t}var tn=!1;function Vt(t,s){if(!t||tn)return"";tn=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(oe){var ae=oe}Reflect.construct(t,[],ye)}else{try{ye.call()}catch(oe){ae=oe}t.call(ye.prototype)}}else{try{throw Error()}catch(oe){ae=oe}(ye=t())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(oe){if(oe&&ae&&typeof oe.stack=="string")return[oe.stack,ae.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=u.DetermineComponentFrameRoot(),E=b[0],O=b[1];if(E&&O){var B=E.split(`
`),te=O.split(`
`);for(m=u=0;u<B.length&&!B[u].includes("DetermineComponentFrameRoot");)u++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(u===B.length||m===te.length)for(u=B.length-1,m=te.length-1;1<=u&&0<=m&&B[u]!==te[m];)m--;for(;1<=u&&0<=m;u--,m--)if(B[u]!==te[m]){if(u!==1||m!==1)do if(u--,m--,0>m||B[u]!==te[m]){var ce=`
`+B[u].replace(" at new "," at ");return t.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",t.displayName)),ce}while(1<=u&&0<=m);break}}}finally{tn=!1,Error.prepareStackTrace=c}return(c=t?t.displayName||t.name:"")?kt(c):""}function oa(t,s){switch(t.tag){case 26:case 27:case 5:return kt(t.type);case 16:return kt("Lazy");case 13:return t.child!==s&&s!==null?kt("Suspense Fallback"):kt("Suspense");case 19:return kt("SuspenseList");case 0:case 15:return Vt(t.type,!1);case 11:return Vt(t.type.render,!1);case 1:return Vt(t.type,!0);case 31:return kt("Activity");default:return""}}function Ce(t){try{var s="",c=null;do s+=oa(t,c),c=t,t=t.return;while(t);return s}catch(u){return`
Error generating stack: `+u.message+`
`+u.stack}}var Ge=Object.prototype.hasOwnProperty,it=r.unstable_scheduleCallback,ft=r.unstable_cancelCallback,bt=r.unstable_shouldYield,Ct=r.unstable_requestPaint,ot=r.unstable_now,We=r.unstable_getCurrentPriorityLevel,nn=r.unstable_ImmediatePriority,Nt=r.unstable_UserBlockingPriority,It=r.unstable_NormalPriority,an=r.unstable_LowPriority,_a=r.unstable_IdlePriority,W=r.log,ve=r.unstable_setDisableYieldValue,me=null,ne=null;function _e(t){if(typeof W=="function"&&ve(t),ne&&typeof ne.setStrictMode=="function")try{ne.setStrictMode(me,t)}catch{}}var Ne=Math.clz32?Math.clz32:yt,$e=Math.log,Ve=Math.LN2;function yt(t){return t>>>=0,t===0?32:31-($e(t)/Ve|0)|0}var Ae=256,st=262144,He=4194304;function Pe(t){var s=t&42;if(s!==0)return s;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ye(t,s,c){var u=t.pendingLanes;if(u===0)return 0;var m=0,b=t.suspendedLanes,E=t.pingedLanes;t=t.warmLanes;var O=u&134217727;return O!==0?(u=O&~b,u!==0?m=Pe(u):(E&=O,E!==0?m=Pe(E):c||(c=O&~t,c!==0&&(m=Pe(c))))):(O=u&~b,O!==0?m=Pe(O):E!==0?m=Pe(E):c||(c=u&~t,c!==0&&(m=Pe(c)))),m===0?0:s!==0&&s!==m&&(s&b)===0&&(b=m&-m,c=s&-s,b>=c||b===32&&(c&4194048)!==0)?s:m}function De(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function Le(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Ue(){var t=He;return He<<=1,(He&62914560)===0&&(He=4194304),t}function At(t){for(var s=[],c=0;31>c;c++)s.push(t);return s}function Kt(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Ut(t,s,c,u,m,b){var E=t.pendingLanes;t.pendingLanes=c,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=c,t.entangledLanes&=c,t.errorRecoveryDisabledLanes&=c,t.shellSuspendCounter=0;var O=t.entanglements,B=t.expirationTimes,te=t.hiddenUpdates;for(c=E&~c;0<c;){var ce=31-Ne(c),ye=1<<ce;O[ce]=0,B[ce]=-1;var ae=te[ce];if(ae!==null)for(te[ce]=null,ce=0;ce<ae.length;ce++){var oe=ae[ce];oe!==null&&(oe.lane&=-536870913)}c&=~ye}u!==0&&qt(t,u,0),b!==0&&m===0&&t.tag!==0&&(t.suspendedLanes|=b&~(E&~s))}function qt(t,s,c){t.pendingLanes|=s,t.suspendedLanes&=~s;var u=31-Ne(s);t.entangledLanes|=s,t.entanglements[u]=t.entanglements[u]|1073741824|c&261930}function bn(t,s){var c=t.entangledLanes|=s;for(t=t.entanglements;c;){var u=31-Ne(c),m=1<<u;m&s|t[u]&s&&(t[u]|=s),c&=~m}}function Dn(t,s){var c=s&-s;return c=(c&42)!==0?1:Ta(c),(c&(t.suspendedLanes|s))!==0?0:c}function Ta(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Aa(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Jn(){var t=F.p;return t!==0?t:(t=window.event,t===void 0?32:iS(t.type))}function Ga(t,s){var c=F.p;try{return F.p=t,s()}finally{F.p=c}}var In=Math.random().toString(36).slice(2),gn="__reactFiber$"+In,vn="__reactProps$"+In,zn="__reactContainer$"+In,Ko="__reactEvents$"+In,mh="__reactListeners$"+In,yh="__reactHandles$"+In,bi="__reactResources$"+In,ds="__reactMarker$"+In;function Wo(t){delete t[gn],delete t[vn],delete t[Ko],delete t[mh],delete t[yh]}function Hs(t){var s=t[gn];if(s)return s;for(var c=t.parentNode;c;){if(s=c[zn]||c[gn]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(t=Gv(t);t!==null;){if(c=t[gn])return c;t=Gv(t)}return s}t=c,c=t.parentNode}return null}function Ps(t){if(t=t[gn]||t[zn]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function Tr(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(a(33))}function Fa(t){var s=t[bi];return s||(s=t[bi]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function sn(t){t[ds]=!0}var fd=new Set,pd={};function us(t,s){Us(t,s),Us(t+"Capture",s)}function Us(t,s){for(pd[t]=s,t=0;t<s.length;t++)fd.add(s[t])}var Da=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]*$"),Yo={},Va={};function Jo(t){return Ge.call(Va,t)?!0:Ge.call(Yo,t)?!1:Da.test(t)?Va[t]=!0:(Yo[t]=!0,!1)}function vi(t,s,c){if(Jo(s))if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+c)}}function Si(t,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+c)}}function Ra(t,s,c,u){if(u===null)t.removeAttribute(c);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(c);return}t.setAttributeNS(s,c,""+u)}}function Hn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wi(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function xh(t,s,c){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var m=u.get,b=u.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return m.call(this)},set:function(E){c=""+E,b.call(this,E)}}),Object.defineProperty(t,s,{enumerable:u.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Xo(t){if(!t._valueTracker){var s=wi(t)?"checked":"value";t._valueTracker=xh(t,s,""+t[s])}}function Qo(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var c=s.getValue(),u="";return t&&(u=wi(t)?t.checked?"true":"false":t.value),t=u,t!==c?(s.setValue(t),!0):!1}function gs(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Ar=/[\n"\\]/g;function Pn(t){return t.replace(Ar,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function hs(t,s,c,u,m,b,E,O){t.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?t.type=E:t.removeAttribute("type"),s!=null?E==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+Hn(s)):t.value!==""+Hn(s)&&(t.value=""+Hn(s)):E!=="submit"&&E!=="reset"||t.removeAttribute("value"),s!=null?Zo(t,E,Hn(s)):c!=null?Zo(t,E,Hn(c)):u!=null&&t.removeAttribute("value"),m==null&&b!=null&&(t.defaultChecked=!!b),m!=null&&(t.checked=m&&typeof m!="function"&&typeof m!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Hn(O):t.removeAttribute("name")}function md(t,s,c,u,m,b,E,O){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.type=b),s!=null||c!=null){if(!(b!=="submit"&&b!=="reset"||s!=null)){Xo(t);return}c=c!=null?""+Hn(c):"",s=s!=null?""+Hn(s):c,O||s===t.value||(t.value=s),t.defaultValue=s}u=u??m,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=O?t.checked:!!u,t.defaultChecked=!!u,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.name=E),Xo(t)}function Zo(t,s,c){s==="number"&&gs(t.ownerDocument)===t||t.defaultValue===""+c||(t.defaultValue=""+c)}function Bs(t,s,c,u){if(t=t.options,s){s={};for(var m=0;m<c.length;m++)s["$"+c[m]]=!0;for(c=0;c<t.length;c++)m=s.hasOwnProperty("$"+t[c].value),t[c].selected!==m&&(t[c].selected=m),m&&u&&(t[c].defaultSelected=!0)}else{for(c=""+Hn(c),s=null,m=0;m<t.length;m++){if(t[m].value===c){t[m].selected=!0,u&&(t[m].defaultSelected=!0);return}s!==null||t[m].disabled||(s=t[m])}s!==null&&(s.selected=!0)}}function yd(t,s,c){if(s!=null&&(s=""+Hn(s),s!==t.value&&(t.value=s),c==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=c!=null?""+Hn(c):""}function xd(t,s,c,u){if(s==null){if(u!=null){if(c!=null)throw Error(a(92));if(je(u)){if(1<u.length)throw Error(a(93));u=u[0]}c=u}c==null&&(c=""),s=c}c=Hn(s),t.defaultValue=c,u=t.textContent,u===c&&u!==""&&u!==null&&(t.value=u),Xo(t)}function qs(t,s){if(s){var c=t.firstChild;if(c&&c===t.lastChild&&c.nodeType===3){c.nodeValue=s;return}}t.textContent=s}var bh=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 Ci(t,s,c){var u=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?u?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":u?t.setProperty(s,c):typeof c!="number"||c===0||bh.has(s)?s==="float"?t.cssFloat=c:t[s]=(""+c).trim():t[s]=c+"px"}function Ka(t,s,c){if(s!=null&&typeof s!="object")throw Error(a(62));if(t=t.style,c!=null){for(var u in c)!c.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var m in s)u=s[m],s.hasOwnProperty(m)&&c[m]!==u&&Ci(t,m,u)}else for(var b in s)s.hasOwnProperty(b)&&Ci(t,b,s[b])}function el(t){if(t.indexOf("-")===-1)return!1;switch(t){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 vh=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"],["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"]]),Sh=/^[\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 ji(t){return Sh.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function la(){}var tl=null;function ki(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Gs=null,Fs=null;function bd(t){var s=Ps(t);if(s&&(t=s.stateNode)){var c=t[vn]||null;e:switch(t=s.stateNode,s.type){case"input":if(hs(t,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=t;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Pn(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var u=c[s];if(u!==t&&u.form===t.form){var m=u[vn]||null;if(!m)throw Error(a(90));hs(u,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<c.length;s++)u=c[s],u.form===t.form&&Qo(u)}break e;case"textarea":yd(t,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Bs(t,!!c.multiple,s,!1)}}}var nl=!1;function vd(t,s,c){if(nl)return t(s,c);nl=!0;try{var u=t(s);return u}finally{if(nl=!1,(Gs!==null||Fs!==null)&&(du(),Gs&&(s=Gs,t=Fs,Fs=Gs=null,bd(s),t)))for(s=0;s<t.length;s++)bd(t[s])}}function Dr(t,s){var c=t.stateNode;if(c===null)return null;var u=c[vn]||null;if(u===null)return null;c=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(c&&typeof c!="function")throw Error(a(231,s,typeof c));return c}var Oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),al=!1;if(Oa)try{var Rr={};Object.defineProperty(Rr,"passive",{get:function(){al=!0}}),window.addEventListener("test",Rr,Rr),window.removeEventListener("test",Rr,Rr)}catch{al=!1}var La=null,sl=null,Ni=null;function Je(){if(Ni)return Ni;var t,s=sl,c=s.length,u,m="value"in La?La.value:La.textContent,b=m.length;for(t=0;t<c&&s[t]===m[t];t++);var E=c-t;for(u=1;u<=E&&s[c-u]===m[b-u];u++);return Ni=m.slice(t,1<u?1-u:void 0)}function Vs(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function fs(){return!0}function Sd(){return!1}function En(t){function s(c,u,m,b,E){this._reactName=c,this._targetInst=m,this.type=u,this.nativeEvent=b,this.target=E,this.currentTarget=null;for(var O in t)t.hasOwnProperty(O)&&(c=t[O],this[O]=c?c(b):b[O]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?fs:Sd,this.isPropagationStopped=Sd,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=fs)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=fs)},persist:function(){},isPersistent:fs}),s}var Wa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ei=En(Wa),Or=x({},Wa,{view:0,detail:0}),wh=En(Or),rl,il,_i,Ti=x({},Or,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ll,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==_i&&(_i&&t.type==="mousemove"?(rl=t.screenX-_i.screenX,il=t.screenY-_i.screenY):il=rl=0,_i=t),rl)},movementY:function(t){return"movementY"in t?t.movementY:il}}),wd=En(Ti),Xx=x({},Ti,{dataTransfer:0}),Ch=En(Xx),jh=x({},Or,{relatedTarget:0}),ol=En(jh),kh=x({},Wa,{animationName:0,elapsedTime:0,pseudoElement:0}),Nh=En(kh),Eh=x({},Wa,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),_h=En(Eh),Th=x({},Wa,{data:0}),Cd=En(Th),Ah={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Dh={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"},Rh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Oh(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=Rh[t])?!!s[t]:!1}function ll(){return Oh}var Lh=x({},Or,{key:function(t){if(t.key){var s=Ah[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Vs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Dh[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ll,charCode:function(t){return t.type==="keypress"?Vs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Vs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),hn=En(Lh),cl=x({},Ti,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jd=En(cl),T=x({},Or,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ll}),S=En(T),_=x({},Wa,{propertyName:0,elapsedTime:0,pseudoElement:0}),I=En(_),P=x({},Ti,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),ue=En(P),ke=x({},Wa,{newState:0,oldState:0}),Ie=En(ke),Xe=[9,13,27,32],dt=Oa&&"CompositionEvent"in window,pt=null;Oa&&"documentMode"in document&&(pt=document.documentMode);var Wt=Oa&&"TextEvent"in window&&!pt,Lr=Oa&&(!dt||pt&&8<pt&&11>=pt),kd=" ",dl=!1;function Nd(t,s){switch(t){case"keyup":return Xe.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ul(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ks=!1;function Ed(t,s){switch(t){case"compositionend":return ul(s);case"keypress":return s.which!==32?null:(dl=!0,kd);case"textInput":return t=s.data,t===kd&&dl?null:t;default:return null}}function Mh(t,s){if(Ks)return t==="compositionend"||!dt&&Nd(t,s)?(t=Je(),Ni=sl=La=null,Ks=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Lr&&s.locale!=="ko"?null:s.data;default:return null}}var $h={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 gl(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!$h[t.type]:s==="textarea"}function hl(t,s,c,u){Gs?Fs?Fs.push(u):Fs=[u]:Gs=u,s=yu(s,"onChange"),0<s.length&&(c=new Ei("onChange","change",null,c,u),t.push({event:c,listeners:s}))}var Ws=null,ps=null;function fl(t){Av(t,0)}function Mr(t){var s=Tr(t);if(Qo(s))return t}function _d(t,s){if(t==="change")return s}var Td=!1;if(Oa){var pl;if(Oa){var ml="oninput"in document;if(!ml){var yl=document.createElement("div");yl.setAttribute("oninput","return;"),ml=typeof yl.oninput=="function"}pl=ml}else pl=!1;Td=pl&&(!document.documentMode||9<document.documentMode)}function Qx(){Ws&&(Ws.detachEvent("onpropertychange",Zx),ps=Ws=null)}function Zx(t){if(t.propertyName==="value"&&Mr(ps)){var s=[];hl(s,ps,t,ki(t)),vd(fl,s)}}function t1(t,s,c){t==="focusin"?(Qx(),Ws=s,ps=c,Ws.attachEvent("onpropertychange",Zx)):t==="focusout"&&Qx()}function n1(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Mr(ps)}function a1(t,s){if(t==="click")return Mr(s)}function s1(t,s){if(t==="input"||t==="change")return Mr(s)}function r1(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Xn=typeof Object.is=="function"?Object.is:r1;function xl(t,s){if(Xn(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var c=Object.keys(t),u=Object.keys(s);if(c.length!==u.length)return!1;for(u=0;u<c.length;u++){var m=c[u];if(!Ge.call(s,m)||!Xn(t[m],s[m]))return!1}return!0}function eb(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function tb(t,s){var c=eb(t);t=0;for(var u;c;){if(c.nodeType===3){if(u=t+c.textContent.length,t<=s&&u>=s)return{node:c,offset:s-t};t=u}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=eb(c)}}function nb(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?nb(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function ab(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=gs(t.document);s instanceof t.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)t=s.contentWindow;else break;s=gs(t.document)}return s}function Ih(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var i1=Oa&&"documentMode"in document&&11>=document.documentMode,Ai=null,zh=null,bl=null,Hh=!1;function sb(t,s,c){var u=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Hh||Ai==null||Ai!==gs(u)||(u=Ai,"selectionStart"in u&&Ih(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),bl&&xl(bl,u)||(bl=u,u=yu(zh,"onSelect"),0<u.length&&(s=new Ei("onSelect","select",null,s,c),t.push({event:s,listeners:u}),s.target=Ai)))}function $r(t,s){var c={};return c[t.toLowerCase()]=s.toLowerCase(),c["Webkit"+t]="webkit"+s,c["Moz"+t]="moz"+s,c}var Di={animationend:$r("Animation","AnimationEnd"),animationiteration:$r("Animation","AnimationIteration"),animationstart:$r("Animation","AnimationStart"),transitionrun:$r("Transition","TransitionRun"),transitionstart:$r("Transition","TransitionStart"),transitioncancel:$r("Transition","TransitionCancel"),transitionend:$r("Transition","TransitionEnd")},Ph={},rb={};Oa&&(rb=document.createElement("div").style,"AnimationEvent"in window||(delete Di.animationend.animation,delete Di.animationiteration.animation,delete Di.animationstart.animation),"TransitionEvent"in window||delete Di.transitionend.transition);function Ir(t){if(Ph[t])return Ph[t];if(!Di[t])return t;var s=Di[t],c;for(c in s)if(s.hasOwnProperty(c)&&c in rb)return Ph[t]=s[c];return t}var ib=Ir("animationend"),ob=Ir("animationiteration"),lb=Ir("animationstart"),o1=Ir("transitionrun"),l1=Ir("transitionstart"),c1=Ir("transitioncancel"),cb=Ir("transitionend"),db=new Map,Uh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(" ");Uh.push("scrollEnd");function Ma(t,s){db.set(t,s),us(s,[t])}var Ad=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ca=[],Ri=0,Bh=0;function Dd(){for(var t=Ri,s=Bh=Ri=0;s<t;){var c=ca[s];ca[s++]=null;var u=ca[s];ca[s++]=null;var m=ca[s];ca[s++]=null;var b=ca[s];if(ca[s++]=null,u!==null&&m!==null){var E=u.pending;E===null?m.next=m:(m.next=E.next,E.next=m),u.pending=m}b!==0&&ub(c,m,b)}}function Rd(t,s,c,u){ca[Ri++]=t,ca[Ri++]=s,ca[Ri++]=c,ca[Ri++]=u,Bh|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function qh(t,s,c,u){return Rd(t,s,c,u),Od(t)}function zr(t,s){return Rd(t,null,null,s),Od(t)}function ub(t,s,c){t.lanes|=c;var u=t.alternate;u!==null&&(u.lanes|=c);for(var m=!1,b=t.return;b!==null;)b.childLanes|=c,u=b.alternate,u!==null&&(u.childLanes|=c),b.tag===22&&(t=b.stateNode,t===null||t._visibility&1||(m=!0)),t=b,b=b.return;return t.tag===3?(b=t.stateNode,m&&s!==null&&(m=31-Ne(c),t=b.hiddenUpdates,u=t[m],u===null?t[m]=[s]:u.push(s),s.lane=c|536870912),b):null}function Od(t){if(50<Ul)throw Ul=0,Zf=null,Error(a(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var Oi={};function d1(t,s,c,u){this.tag=t,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(t,s,c,u){return new d1(t,s,c,u)}function Gh(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ms(t,s){var c=t.alternate;return c===null?(c=Qn(t.tag,s,t.key,t.mode),c.elementType=t.elementType,c.type=t.type,c.stateNode=t.stateNode,c.alternate=t,t.alternate=c):(c.pendingProps=s,c.type=t.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=t.flags&65011712,c.childLanes=t.childLanes,c.lanes=t.lanes,c.child=t.child,c.memoizedProps=t.memoizedProps,c.memoizedState=t.memoizedState,c.updateQueue=t.updateQueue,s=t.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=t.sibling,c.index=t.index,c.ref=t.ref,c.refCleanup=t.refCleanup,c}function gb(t,s){t.flags&=65011714;var c=t.alternate;return c===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=c.childLanes,t.lanes=c.lanes,t.child=c.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=c.memoizedProps,t.memoizedState=c.memoizedState,t.updateQueue=c.updateQueue,t.type=c.type,s=c.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function Ld(t,s,c,u,m,b){var E=0;if(u=t,typeof t=="function")Gh(t)&&(E=1);else if(typeof t=="string")E=p_(t,c,se.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case he:return t=Qn(31,c,s,m),t.elementType=he,t.lanes=b,t;case C:return Hr(c.children,m,b,s);case k:E=8,m|=24;break;case A:return t=Qn(12,c,s,m|2),t.elementType=A,t.lanes=b,t;case M:return t=Qn(13,c,s,m),t.elementType=M,t.lanes=b,t;case L:return t=Qn(19,c,s,m),t.elementType=L,t.lanes=b,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:E=10;break e;case R:E=9;break e;case D:E=11;break e;case z:E=14;break e;case Y:E=16,u=null;break e}E=29,c=Error(a(130,t===null?"null":typeof t,"")),u=null}return s=Qn(E,c,s,m),s.elementType=t,s.type=u,s.lanes=b,s}function Hr(t,s,c,u){return t=Qn(7,t,u,s),t.lanes=c,t}function Fh(t,s,c){return t=Qn(6,t,null,s),t.lanes=c,t}function hb(t){var s=Qn(18,null,null,0);return s.stateNode=t,s}function Vh(t,s,c){return s=Qn(4,t.children!==null?t.children:[],t.key,s),s.lanes=c,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var fb=new WeakMap;function da(t,s){if(typeof t=="object"&&t!==null){var c=fb.get(t);return c!==void 0?c:(s={value:t,source:s,stack:Ce(s)},fb.set(t,s),s)}return{value:t,source:s,stack:Ce(s)}}var Li=[],Mi=0,Md=null,vl=0,ua=[],ga=0,Ys=null,Ya=1,Ja="";function ys(t,s){Li[Mi++]=vl,Li[Mi++]=Md,Md=t,vl=s}function pb(t,s,c){ua[ga++]=Ya,ua[ga++]=Ja,ua[ga++]=Ys,Ys=t;var u=Ya;t=Ja;var m=32-Ne(u)-1;u&=~(1<<m),c+=1;var b=32-Ne(s)+m;if(30<b){var E=m-m%5;b=(u&(1<<E)-1).toString(32),u>>=E,m-=E,Ya=1<<32-Ne(s)+m|c<<m|u,Ja=b+t}else Ya=1<<b|c<<m|u,Ja=t}function Kh(t){t.return!==null&&(ys(t,1),pb(t,1,0))}function Wh(t){for(;t===Md;)Md=Li[--Mi],Li[Mi]=null,vl=Li[--Mi],Li[Mi]=null;for(;t===Ys;)Ys=ua[--ga],ua[ga]=null,Ja=ua[--ga],ua[ga]=null,Ya=ua[--ga],ua[ga]=null}function mb(t,s){ua[ga++]=Ya,ua[ga++]=Ja,ua[ga++]=Ys,Ya=s.id,Ja=s.overflow,Ys=t}var Sn=null,Ht=null,mt=!1,Js=null,ha=!1,Yh=Error(a(519));function Xs(t){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Sl(da(s,t)),Yh}function yb(t){var s=t.stateNode,c=t.type,u=t.memoizedProps;switch(s[gn]=t,s[vn]=u,c){case"dialog":ct("cancel",s),ct("close",s);break;case"iframe":case"object":case"embed":ct("load",s);break;case"video":case"audio":for(c=0;c<ql.length;c++)ct(ql[c],s);break;case"source":ct("error",s);break;case"img":case"image":case"link":ct("error",s),ct("load",s);break;case"details":ct("toggle",s);break;case"input":ct("invalid",s),md(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":ct("invalid",s);break;case"textarea":ct("invalid",s),xd(s,u.value,u.defaultValue,u.children)}c=u.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||u.suppressHydrationWarning===!0||Lv(s.textContent,c)?(u.popover!=null&&(ct("beforetoggle",s),ct("toggle",s)),u.onScroll!=null&&ct("scroll",s),u.onScrollEnd!=null&&ct("scrollend",s),u.onClick!=null&&(s.onclick=la),s=!0):s=!1,s||Xs(t,!0)}function xb(t){for(Sn=t.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:ha=!1;return;case 27:case 3:ha=!0;return;default:Sn=Sn.return}}function $i(t){if(t!==Sn)return!1;if(!mt)return xb(t),mt=!0,!1;var s=t.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=t.type,c=!(c!=="form"&&c!=="button")||fp(t.type,t.memoizedProps)),c=!c),c&&Ht&&Xs(t),xb(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ht=qv(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ht=qv(t)}else s===27?(s=Ht,ur(t.type)?(t=bp,bp=null,Ht=t):Ht=s):Ht=Sn?pa(t.stateNode.nextSibling):null;return!0}function Pr(){Ht=Sn=null,mt=!1}function Jh(){var t=Js;return t!==null&&(Gn===null?Gn=t:Gn.push.apply(Gn,t),Js=null),t}function Sl(t){Js===null?Js=[t]:Js.push(t)}var Xh=U(null),Ur=null,xs=null;function Qs(t,s,c){ie(Xh,s._currentValue),s._currentValue=c}function bs(t){t._currentValue=Xh.current,q(Xh)}function Qh(t,s,c){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===c)break;t=t.return}}function Zh(t,s,c,u){var m=t.child;for(m!==null&&(m.return=t);m!==null;){var b=m.dependencies;if(b!==null){var E=m.child;b=b.firstContext;e:for(;b!==null;){var O=b;b=m;for(var B=0;B<s.length;B++)if(O.context===s[B]){b.lanes|=c,O=b.alternate,O!==null&&(O.lanes|=c),Qh(b.return,c,t),u||(E=null);break e}b=O.next}}else if(m.tag===18){if(E=m.return,E===null)throw Error(a(341));E.lanes|=c,b=E.alternate,b!==null&&(b.lanes|=c),Qh(E,c,t),E=null}else E=m.child;if(E!==null)E.return=m;else for(E=m;E!==null;){if(E===t){E=null;break}if(m=E.sibling,m!==null){m.return=E.return,E=m;break}E=E.return}m=E}}function Ii(t,s,c,u){t=null;for(var m=s,b=!1;m!==null;){if(!b){if((m.flags&524288)!==0)b=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var E=m.alternate;if(E===null)throw Error(a(387));if(E=E.memoizedProps,E!==null){var O=m.type;Xn(m.pendingProps.value,E.value)||(t!==null?t.push(O):t=[O])}}else if(m===Oe.current){if(E=m.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(t!==null?t.push(Wl):t=[Wl])}m=m.return}t!==null&&Zh(s,t,c,u),s.flags|=262144}function $d(t){for(t=t.firstContext;t!==null;){if(!Xn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Br(t){Ur=t,xs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function wn(t){return bb(Ur,t)}function Id(t,s){return Ur===null&&Br(t),bb(t,s)}function bb(t,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},xs===null){if(t===null)throw Error(a(308));xs=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else xs=xs.next=s;return c}var u1=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(c,u){t.push(u)}};this.abort=function(){s.aborted=!0,t.forEach(function(c){return c()})}},g1=r.unstable_scheduleCallback,h1=r.unstable_NormalPriority,rn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ef(){return{controller:new u1,data:new Map,refCount:0}}function wl(t){t.refCount--,t.refCount===0&&g1(h1,function(){t.controller.abort()})}var Cl=null,tf=0,zi=0,Hi=null;function f1(t,s){if(Cl===null){var c=Cl=[];tf=0,zi=rp(),Hi={status:"pending",value:void 0,then:function(u){c.push(u)}}}return tf++,s.then(vb,vb),s}function vb(){if(--tf===0&&Cl!==null){Hi!==null&&(Hi.status="fulfilled");var t=Cl;Cl=null,zi=0,Hi=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function p1(t,s){var c=[],u={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return t.then(function(){u.status="fulfilled",u.value=s;for(var m=0;m<c.length;m++)(0,c[m])(s)},function(m){for(u.status="rejected",u.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),u}var Sb=J.S;J.S=function(t,s){sv=ot(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&f1(t,s),Sb!==null&&Sb(t,s)};var qr=U(null);function nf(){var t=qr.current;return t!==null?t:Mt.pooledCache}function zd(t,s){s===null?ie(qr,qr.current):ie(qr,s.pool)}function wb(){var t=nf();return t===null?null:{parent:rn._currentValue,pool:t}}var Pi=Error(a(460)),af=Error(a(474)),Hd=Error(a(542)),Pd={then:function(){}};function Cb(t){return t=t.status,t==="fulfilled"||t==="rejected"}function jb(t,s,c){switch(c=t[c],c===void 0?t.push(s):c!==s&&(s.then(la,la),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,Nb(t),t;default:if(typeof s.status=="string")s.then(la,la);else{if(t=Mt,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=s,t.status="pending",t.then(function(u){if(s.status==="pending"){var m=s;m.status="fulfilled",m.value=u}},function(u){if(s.status==="pending"){var m=s;m.status="rejected",m.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,Nb(t),t}throw Fr=s,Pi}}function Gr(t){try{var s=t._init;return s(t._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Fr=c,Pi):c}}var Fr=null;function kb(){if(Fr===null)throw Error(a(459));var t=Fr;return Fr=null,t}function Nb(t){if(t===Pi||t===Hd)throw Error(a(483))}var Ui=null,jl=0;function Ud(t){var s=jl;return jl+=1,Ui===null&&(Ui=[]),jb(Ui,t,s)}function kl(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function Bd(t,s){throw s.$$typeof===y?Error(a(525)):(t=Object.prototype.toString.call(s),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function Eb(t){function s(Z,K){if(t){var ee=Z.deletions;ee===null?(Z.deletions=[K],Z.flags|=16):ee.push(K)}}function c(Z,K){if(!t)return null;for(;K!==null;)s(Z,K),K=K.sibling;return null}function u(Z){for(var K=new Map;Z!==null;)Z.key!==null?K.set(Z.key,Z):K.set(Z.index,Z),Z=Z.sibling;return K}function m(Z,K){return Z=ms(Z,K),Z.index=0,Z.sibling=null,Z}function b(Z,K,ee){return Z.index=ee,t?(ee=Z.alternate,ee!==null?(ee=ee.index,ee<K?(Z.flags|=67108866,K):ee):(Z.flags|=67108866,K)):(Z.flags|=1048576,K)}function E(Z){return t&&Z.alternate===null&&(Z.flags|=67108866),Z}function O(Z,K,ee,fe){return K===null||K.tag!==6?(K=Fh(ee,Z.mode,fe),K.return=Z,K):(K=m(K,ee),K.return=Z,K)}function B(Z,K,ee,fe){var Be=ee.type;return Be===C?ce(Z,K,ee.props.children,fe,ee.key):K!==null&&(K.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===Y&&Gr(Be)===K.type)?(K=m(K,ee.props),kl(K,ee),K.return=Z,K):(K=Ld(ee.type,ee.key,ee.props,null,Z.mode,fe),kl(K,ee),K.return=Z,K)}function te(Z,K,ee,fe){return K===null||K.tag!==4||K.stateNode.containerInfo!==ee.containerInfo||K.stateNode.implementation!==ee.implementation?(K=Vh(ee,Z.mode,fe),K.return=Z,K):(K=m(K,ee.children||[]),K.return=Z,K)}function ce(Z,K,ee,fe,Be){return K===null||K.tag!==7?(K=Hr(ee,Z.mode,fe,Be),K.return=Z,K):(K=m(K,ee),K.return=Z,K)}function ye(Z,K,ee){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=Fh(""+K,Z.mode,ee),K.return=Z,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case w:return ee=Ld(K.type,K.key,K.props,null,Z.mode,ee),kl(ee,K),ee.return=Z,ee;case v:return K=Vh(K,Z.mode,ee),K.return=Z,K;case Y:return K=Gr(K),ye(Z,K,ee)}if(je(K)||ge(K))return K=Hr(K,Z.mode,ee,null),K.return=Z,K;if(typeof K.then=="function")return ye(Z,Ud(K),ee);if(K.$$typeof===N)return ye(Z,Id(Z,K),ee);Bd(Z,K)}return null}function ae(Z,K,ee,fe){var Be=K!==null?K.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Be!==null?null:O(Z,K,""+ee,fe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return ee.key===Be?B(Z,K,ee,fe):null;case v:return ee.key===Be?te(Z,K,ee,fe):null;case Y:return ee=Gr(ee),ae(Z,K,ee,fe)}if(je(ee)||ge(ee))return Be!==null?null:ce(Z,K,ee,fe,null);if(typeof ee.then=="function")return ae(Z,K,Ud(ee),fe);if(ee.$$typeof===N)return ae(Z,K,Id(Z,ee),fe);Bd(Z,ee)}return null}function oe(Z,K,ee,fe,Be){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Z=Z.get(ee)||null,O(K,Z,""+fe,Be);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return Z=Z.get(fe.key===null?ee:fe.key)||null,B(K,Z,fe,Be);case v:return Z=Z.get(fe.key===null?ee:fe.key)||null,te(K,Z,fe,Be);case Y:return fe=Gr(fe),oe(Z,K,ee,fe,Be)}if(je(fe)||ge(fe))return Z=Z.get(ee)||null,ce(K,Z,fe,Be,null);if(typeof fe.then=="function")return oe(Z,K,ee,Ud(fe),Be);if(fe.$$typeof===N)return oe(Z,K,ee,Id(K,fe),Be);Bd(K,fe)}return null}function Re(Z,K,ee,fe){for(var Be=null,St=null,ze=K,rt=K=0,gt=null;ze!==null&&rt<ee.length;rt++){ze.index>rt?(gt=ze,ze=null):gt=ze.sibling;var wt=ae(Z,ze,ee[rt],fe);if(wt===null){ze===null&&(ze=gt);break}t&&ze&&wt.alternate===null&&s(Z,ze),K=b(wt,K,rt),St===null?Be=wt:St.sibling=wt,St=wt,ze=gt}if(rt===ee.length)return c(Z,ze),mt&&ys(Z,rt),Be;if(ze===null){for(;rt<ee.length;rt++)ze=ye(Z,ee[rt],fe),ze!==null&&(K=b(ze,K,rt),St===null?Be=ze:St.sibling=ze,St=ze);return mt&&ys(Z,rt),Be}for(ze=u(ze);rt<ee.length;rt++)gt=oe(ze,Z,rt,ee[rt],fe),gt!==null&&(t&&gt.alternate!==null&&ze.delete(gt.key===null?rt:gt.key),K=b(gt,K,rt),St===null?Be=gt:St.sibling=gt,St=gt);return t&&ze.forEach(function(mr){return s(Z,mr)}),mt&&ys(Z,rt),Be}function Ke(Z,K,ee,fe){if(ee==null)throw Error(a(151));for(var Be=null,St=null,ze=K,rt=K=0,gt=null,wt=ee.next();ze!==null&&!wt.done;rt++,wt=ee.next()){ze.index>rt?(gt=ze,ze=null):gt=ze.sibling;var mr=ae(Z,ze,wt.value,fe);if(mr===null){ze===null&&(ze=gt);break}t&&ze&&mr.alternate===null&&s(Z,ze),K=b(mr,K,rt),St===null?Be=mr:St.sibling=mr,St=mr,ze=gt}if(wt.done)return c(Z,ze),mt&&ys(Z,rt),Be;if(ze===null){for(;!wt.done;rt++,wt=ee.next())wt=ye(Z,wt.value,fe),wt!==null&&(K=b(wt,K,rt),St===null?Be=wt:St.sibling=wt,St=wt);return mt&&ys(Z,rt),Be}for(ze=u(ze);!wt.done;rt++,wt=ee.next())wt=oe(ze,Z,rt,wt.value,fe),wt!==null&&(t&&wt.alternate!==null&&ze.delete(wt.key===null?rt:wt.key),K=b(wt,K,rt),St===null?Be=wt:St.sibling=wt,St=wt);return t&&ze.forEach(function(N_){return s(Z,N_)}),mt&&ys(Z,rt),Be}function Ot(Z,K,ee,fe){if(typeof ee=="object"&&ee!==null&&ee.type===C&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:e:{for(var Be=ee.key;K!==null;){if(K.key===Be){if(Be=ee.type,Be===C){if(K.tag===7){c(Z,K.sibling),fe=m(K,ee.props.children),fe.return=Z,Z=fe;break e}}else if(K.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===Y&&Gr(Be)===K.type){c(Z,K.sibling),fe=m(K,ee.props),kl(fe,ee),fe.return=Z,Z=fe;break e}c(Z,K);break}else s(Z,K);K=K.sibling}ee.type===C?(fe=Hr(ee.props.children,Z.mode,fe,ee.key),fe.return=Z,Z=fe):(fe=Ld(ee.type,ee.key,ee.props,null,Z.mode,fe),kl(fe,ee),fe.return=Z,Z=fe)}return E(Z);case v:e:{for(Be=ee.key;K!==null;){if(K.key===Be)if(K.tag===4&&K.stateNode.containerInfo===ee.containerInfo&&K.stateNode.implementation===ee.implementation){c(Z,K.sibling),fe=m(K,ee.children||[]),fe.return=Z,Z=fe;break e}else{c(Z,K);break}else s(Z,K);K=K.sibling}fe=Vh(ee,Z.mode,fe),fe.return=Z,Z=fe}return E(Z);case Y:return ee=Gr(ee),Ot(Z,K,ee,fe)}if(je(ee))return Re(Z,K,ee,fe);if(ge(ee)){if(Be=ge(ee),typeof Be!="function")throw Error(a(150));return ee=Be.call(ee),Ke(Z,K,ee,fe)}if(typeof ee.then=="function")return Ot(Z,K,Ud(ee),fe);if(ee.$$typeof===N)return Ot(Z,K,Id(Z,ee),fe);Bd(Z,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,K!==null&&K.tag===6?(c(Z,K.sibling),fe=m(K,ee),fe.return=Z,Z=fe):(c(Z,K),fe=Fh(ee,Z.mode,fe),fe.return=Z,Z=fe),E(Z)):c(Z,K)}return function(Z,K,ee,fe){try{jl=0;var Be=Ot(Z,K,ee,fe);return Ui=null,Be}catch(ze){if(ze===Pi||ze===Hd)throw ze;var St=Qn(29,ze,null,Z.mode);return St.lanes=fe,St.return=Z,St}finally{}}}var Vr=Eb(!0),_b=Eb(!1),Zs=!1;function sf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rf(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function er(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function tr(t,s,c){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(jt&2)!==0){var m=u.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),u.pending=s,s=Od(t),ub(t,null,c),s}return Rd(t,u,s,c),Od(t)}function Nl(t,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var u=s.lanes;u&=t.pendingLanes,c|=u,s.lanes=c,bn(t,c)}}function of(t,s){var c=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,c===u)){var m=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};b===null?m=b=E:b=b.next=E,c=c.next}while(c!==null);b===null?m=b=s:b=b.next=s}else m=b=s;c={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:b,shared:u.shared,callbacks:u.callbacks},t.updateQueue=c;return}t=c.lastBaseUpdate,t===null?c.firstBaseUpdate=s:t.next=s,c.lastBaseUpdate=s}var lf=!1;function El(){if(lf){var t=Hi;if(t!==null)throw t}}function _l(t,s,c,u){lf=!1;var m=t.updateQueue;Zs=!1;var b=m.firstBaseUpdate,E=m.lastBaseUpdate,O=m.shared.pending;if(O!==null){m.shared.pending=null;var B=O,te=B.next;B.next=null,E===null?b=te:E.next=te,E=B;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,O=ce.lastBaseUpdate,O!==E&&(O===null?ce.firstBaseUpdate=te:O.next=te,ce.lastBaseUpdate=B))}if(b!==null){var ye=m.baseState;E=0,ce=te=B=null,O=b;do{var ae=O.lane&-536870913,oe=ae!==O.lane;if(oe?(ut&ae)===ae:(u&ae)===ae){ae!==0&&ae===zi&&(lf=!0),ce!==null&&(ce=ce.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Re=t,Ke=O;ae=s;var Ot=c;switch(Ke.tag){case 1:if(Re=Ke.payload,typeof Re=="function"){ye=Re.call(Ot,ye,ae);break e}ye=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ke.payload,ae=typeof Re=="function"?Re.call(Ot,ye,ae):Re,ae==null)break e;ye=x({},ye,ae);break e;case 2:Zs=!0}}ae=O.callback,ae!==null&&(t.flags|=64,oe&&(t.flags|=8192),oe=m.callbacks,oe===null?m.callbacks=[ae]:oe.push(ae))}else oe={lane:ae,tag:O.tag,payload:O.payload,callback:O.callback,next:null},ce===null?(te=ce=oe,B=ye):ce=ce.next=oe,E|=ae;if(O=O.next,O===null){if(O=m.shared.pending,O===null)break;oe=O,O=oe.next,oe.next=null,m.lastBaseUpdate=oe,m.shared.pending=null}}while(!0);ce===null&&(B=ye),m.baseState=B,m.firstBaseUpdate=te,m.lastBaseUpdate=ce,b===null&&(m.shared.lanes=0),ir|=E,t.lanes=E,t.memoizedState=ye}}function Tb(t,s){if(typeof t!="function")throw Error(a(191,t));t.call(s)}function Ab(t,s){var c=t.callbacks;if(c!==null)for(t.callbacks=null,t=0;t<c.length;t++)Tb(c[t],s)}var Bi=U(null),qd=U(0);function Db(t,s){t=_s,ie(qd,t),ie(Bi,s),_s=t|s.baseLanes}function cf(){ie(qd,_s),ie(Bi,Bi.current)}function df(){_s=qd.current,q(Bi),q(qd)}var Zn=U(null),fa=null;function nr(t){var s=t.alternate;ie(Zt,Zt.current&1),ie(Zn,t),fa===null&&(s===null||Bi.current!==null||s.memoizedState!==null)&&(fa=t)}function uf(t){ie(Zt,Zt.current),ie(Zn,t),fa===null&&(fa=t)}function Rb(t){t.tag===22?(ie(Zt,Zt.current),ie(Zn,t),fa===null&&(fa=t)):ar()}function ar(){ie(Zt,Zt.current),ie(Zn,Zn.current)}function ea(t){q(Zn),fa===t&&(fa=null),q(Zt)}var Zt=U(0);function Gd(t){for(var s=t;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||yp(c)||xp(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var vs=0,nt=null,Dt=null,on=null,Fd=!1,qi=!1,Kr=!1,Vd=0,Tl=0,Gi=null,m1=0;function Yt(){throw Error(a(321))}function gf(t,s){if(s===null)return!1;for(var c=0;c<s.length&&c<t.length;c++)if(!Xn(t[c],s[c]))return!1;return!0}function hf(t,s,c,u,m,b){return vs=b,nt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,J.H=t===null||t.memoizedState===null?p0:_f,Kr=!1,b=c(u,m),Kr=!1,qi&&(b=Lb(s,c,u,m)),Ob(t),b}function Ob(t){J.H=Rl;var s=Dt!==null&&Dt.next!==null;if(vs=0,on=Dt=nt=null,Fd=!1,Tl=0,Gi=null,s)throw Error(a(300));t===null||ln||(t=t.dependencies,t!==null&&$d(t)&&(ln=!0))}function Lb(t,s,c,u){nt=t;var m=0;do{if(qi&&(Gi=null),Tl=0,qi=!1,25<=m)throw Error(a(301));if(m+=1,on=Dt=null,t.updateQueue!=null){var b=t.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}J.H=m0,b=s(c,u)}while(qi);return b}function y1(){var t=J.H,s=t.useState()[0];return s=typeof s.then=="function"?Al(s):s,t=t.useState()[0],(Dt!==null?Dt.memoizedState:null)!==t&&(nt.flags|=1024),s}function ff(){var t=Vd!==0;return Vd=0,t}function pf(t,s,c){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~c}function mf(t){if(Fd){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}Fd=!1}vs=0,on=Dt=nt=null,qi=!1,Tl=Vd=0,Gi=null}function Rn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return on===null?nt.memoizedState=on=t:on=on.next=t,on}function en(){if(Dt===null){var t=nt.alternate;t=t!==null?t.memoizedState:null}else t=Dt.next;var s=on===null?nt.memoizedState:on.next;if(s!==null)on=s,Dt=t;else{if(t===null)throw nt.alternate===null?Error(a(467)):Error(a(310));Dt=t,t={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},on===null?nt.memoizedState=on=t:on=on.next=t}return on}function Kd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Al(t){var s=Tl;return Tl+=1,Gi===null&&(Gi=[]),t=jb(Gi,t,s),s=nt,(on===null?s.memoizedState:on.next)===null&&(s=s.alternate,J.H=s===null||s.memoizedState===null?p0:_f),t}function Wd(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Al(t);if(t.$$typeof===N)return wn(t)}throw Error(a(438,String(t)))}function yf(t){var s=null,c=nt.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var u=nt.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(m){return m.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=Kd(),nt.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(t),u=0;u<t;u++)c[u]=be;return s.index++,c}function Ss(t,s){return typeof s=="function"?s(t):s}function Yd(t){var s=en();return xf(s,Dt,t)}function xf(t,s,c){var u=t.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=c;var m=t.baseQueue,b=u.pending;if(b!==null){if(m!==null){var E=m.next;m.next=b.next,b.next=E}s.baseQueue=m=b,u.pending=null}if(b=t.baseState,m===null)t.memoizedState=b;else{s=m.next;var O=E=null,B=null,te=s,ce=!1;do{var ye=te.lane&-536870913;if(ye!==te.lane?(ut&ye)===ye:(vs&ye)===ye){var ae=te.revertLane;if(ae===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),ye===zi&&(ce=!0);else if((vs&ae)===ae){te=te.next,ae===zi&&(ce=!0);continue}else ye={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},B===null?(O=B=ye,E=b):B=B.next=ye,nt.lanes|=ae,ir|=ae;ye=te.action,Kr&&c(b,ye),b=te.hasEagerState?te.eagerState:c(b,ye)}else ae={lane:ye,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},B===null?(O=B=ae,E=b):B=B.next=ae,nt.lanes|=ye,ir|=ye;te=te.next}while(te!==null&&te!==s);if(B===null?E=b:B.next=O,!Xn(b,t.memoizedState)&&(ln=!0,ce&&(c=Hi,c!==null)))throw c;t.memoizedState=b,t.baseState=E,t.baseQueue=B,u.lastRenderedState=b}return m===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function bf(t){var s=en(),c=s.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=t;var u=c.dispatch,m=c.pending,b=s.memoizedState;if(m!==null){c.pending=null;var E=m=m.next;do b=t(b,E.action),E=E.next;while(E!==m);Xn(b,s.memoizedState)||(ln=!0),s.memoizedState=b,s.baseQueue===null&&(s.baseState=b),c.lastRenderedState=b}return[b,u]}function Mb(t,s,c){var u=nt,m=en(),b=mt;if(b){if(c===void 0)throw Error(a(407));c=c()}else c=s();var E=!Xn((Dt||m).memoizedState,c);if(E&&(m.memoizedState=c,ln=!0),m=m.queue,wf(zb.bind(null,u,m,t),[t]),m.getSnapshot!==s||E||on!==null&&on.memoizedState.tag&1){if(u.flags|=2048,Fi(9,{destroy:void 0},Ib.bind(null,u,m,c,s),null),Mt===null)throw Error(a(349));b||(vs&127)!==0||$b(u,s,c)}return c}function $b(t,s,c){t.flags|=16384,t={getSnapshot:s,value:c},s=nt.updateQueue,s===null?(s=Kd(),nt.updateQueue=s,s.stores=[t]):(c=s.stores,c===null?s.stores=[t]:c.push(t))}function Ib(t,s,c,u){s.value=c,s.getSnapshot=u,Hb(s)&&Pb(t)}function zb(t,s,c){return c(function(){Hb(s)&&Pb(t)})}function Hb(t){var s=t.getSnapshot;t=t.value;try{var c=s();return!Xn(t,c)}catch{return!0}}function Pb(t){var s=zr(t,2);s!==null&&Fn(s,t,2)}function vf(t){var s=Rn();if(typeof t=="function"){var c=t;if(t=c(),Kr){_e(!0);try{c()}finally{_e(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:t},s}function Ub(t,s,c,u){return t.baseState=c,xf(t,Dt,typeof u=="function"?u:Ss)}function x1(t,s,c,u,m){if(Qd(t))throw Error(a(485));if(t=s.action,t!==null){var b={payload:m,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){b.listeners.push(E)}};J.T!==null?c(!0):b.isTransition=!1,u(b),c=s.pending,c===null?(b.next=s.pending=b,Bb(s,b)):(b.next=c.next,s.pending=c.next=b)}}function Bb(t,s){var c=s.action,u=s.payload,m=t.state;if(s.isTransition){var b=J.T,E={};J.T=E;try{var O=c(m,u),B=J.S;B!==null&&B(E,O),qb(t,s,O)}catch(te){Sf(t,s,te)}finally{b!==null&&E.types!==null&&(b.types=E.types),J.T=b}}else try{b=c(m,u),qb(t,s,b)}catch(te){Sf(t,s,te)}}function qb(t,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(u){Gb(t,s,u)},function(u){return Sf(t,s,u)}):Gb(t,s,c)}function Gb(t,s,c){s.status="fulfilled",s.value=c,Fb(s),t.state=c,s=t.pending,s!==null&&(c=s.next,c===s?t.pending=null:(c=c.next,s.next=c,Bb(t,c)))}function Sf(t,s,c){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=c,Fb(s),s=s.next;while(s!==u)}t.action=null}function Fb(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Vb(t,s){return s}function Kb(t,s){if(mt){var c=Mt.formState;if(c!==null){e:{var u=nt;if(mt){if(Ht){t:{for(var m=Ht,b=ha;m.nodeType!==8;){if(!b){m=null;break t}if(m=pa(m.nextSibling),m===null){m=null;break t}}b=m.data,m=b==="F!"||b==="F"?m:null}if(m){Ht=pa(m.nextSibling),u=m.data==="F!";break e}}Xs(u)}u=!1}u&&(s=c[0])}}return c=Rn(),c.memoizedState=c.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vb,lastRenderedState:s},c.queue=u,c=g0.bind(null,nt,u),u.dispatch=c,u=vf(!1),b=Ef.bind(null,nt,!1,u.queue),u=Rn(),m={state:s,dispatch:null,action:t,pending:null},u.queue=m,c=x1.bind(null,nt,m,b,c),m.dispatch=c,u.memoizedState=t,[s,c,!1]}function Wb(t){var s=en();return Yb(s,Dt,t)}function Yb(t,s,c){if(s=xf(t,s,Vb)[0],t=Yd(Ss)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=Al(s)}catch(E){throw E===Pi?Hd:E}else u=s;s=en();var m=s.queue,b=m.dispatch;return c!==s.memoizedState&&(nt.flags|=2048,Fi(9,{destroy:void 0},b1.bind(null,m,c),null)),[u,b,t]}function b1(t,s){t.action=s}function Jb(t){var s=en(),c=Dt;if(c!==null)return Yb(s,c,t);en(),s=s.memoizedState,c=en();var u=c.queue.dispatch;return c.memoizedState=t,[s,u,!1]}function Fi(t,s,c,u){return t={tag:t,create:c,deps:u,inst:s,next:null},s=nt.updateQueue,s===null&&(s=Kd(),nt.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=t.next=t:(u=c.next,c.next=t,t.next=u,s.lastEffect=t),t}function Xb(){return en().memoizedState}function Jd(t,s,c,u){var m=Rn();nt.flags|=t,m.memoizedState=Fi(1|s,{destroy:void 0},c,u===void 0?null:u)}function Xd(t,s,c,u){var m=en();u=u===void 0?null:u;var b=m.memoizedState.inst;Dt!==null&&u!==null&&gf(u,Dt.memoizedState.deps)?m.memoizedState=Fi(s,b,c,u):(nt.flags|=t,m.memoizedState=Fi(1|s,b,c,u))}function Qb(t,s){Jd(8390656,8,t,s)}function wf(t,s){Xd(2048,8,t,s)}function v1(t){nt.flags|=4;var s=nt.updateQueue;if(s===null)s=Kd(),nt.updateQueue=s,s.events=[t];else{var c=s.events;c===null?s.events=[t]:c.push(t)}}function Zb(t){var s=en().memoizedState;return v1({ref:s,nextImpl:t}),function(){if((jt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function e0(t,s){return Xd(4,2,t,s)}function t0(t,s){return Xd(4,4,t,s)}function n0(t,s){if(typeof s=="function"){t=t();var c=s(t);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function a0(t,s,c){c=c!=null?c.concat([t]):null,Xd(4,4,n0.bind(null,s,t),c)}function Cf(){}function s0(t,s){var c=en();s=s===void 0?null:s;var u=c.memoizedState;return s!==null&&gf(s,u[1])?u[0]:(c.memoizedState=[t,s],t)}function r0(t,s){var c=en();s=s===void 0?null:s;var u=c.memoizedState;if(s!==null&&gf(s,u[1]))return u[0];if(u=t(),Kr){_e(!0);try{t()}finally{_e(!1)}}return c.memoizedState=[u,s],u}function jf(t,s,c){return c===void 0||(vs&1073741824)!==0&&(ut&261930)===0?t.memoizedState=s:(t.memoizedState=c,t=iv(),nt.lanes|=t,ir|=t,c)}function i0(t,s,c,u){return Xn(c,s)?c:Bi.current!==null?(t=jf(t,c,u),Xn(t,s)||(ln=!0),t):(vs&42)===0||(vs&1073741824)!==0&&(ut&261930)===0?(ln=!0,t.memoizedState=c):(t=iv(),nt.lanes|=t,ir|=t,s)}function o0(t,s,c,u,m){var b=F.p;F.p=b!==0&&8>b?b:8;var E=J.T,O={};J.T=O,Ef(t,!1,s,c);try{var B=m(),te=J.S;if(te!==null&&te(O,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var ce=p1(B,u);Dl(t,s,ce,aa(t))}else Dl(t,s,u,aa(t))}catch(ye){Dl(t,s,{then:function(){},status:"rejected",reason:ye},aa())}finally{F.p=b,E!==null&&O.types!==null&&(E.types=O.types),J.T=E}}function S1(){}function kf(t,s,c,u){if(t.tag!==5)throw Error(a(476));var m=l0(t).queue;o0(t,m,s,Q,c===null?S1:function(){return c0(t),c(u)})}function l0(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:Q},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:c},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function c0(t){var s=l0(t);s.next===null&&(s=t.alternate.memoizedState),Dl(t,s.next.queue,{},aa())}function Nf(){return wn(Wl)}function d0(){return en().memoizedState}function u0(){return en().memoizedState}function w1(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var c=aa();t=er(c);var u=tr(s,t,c);u!==null&&(Fn(u,s,c),Nl(u,s,c)),s={cache:ef()},t.payload=s;return}s=s.return}}function C1(t,s,c){var u=aa();c={lane:u,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Qd(t)?h0(s,c):(c=qh(t,s,c,u),c!==null&&(Fn(c,t,u),f0(c,s,u)))}function g0(t,s,c){var u=aa();Dl(t,s,c,u)}function Dl(t,s,c,u){var m={lane:u,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Qd(t))h0(s,m);else{var b=t.alternate;if(t.lanes===0&&(b===null||b.lanes===0)&&(b=s.lastRenderedReducer,b!==null))try{var E=s.lastRenderedState,O=b(E,c);if(m.hasEagerState=!0,m.eagerState=O,Xn(O,E))return Rd(t,s,m,0),Mt===null&&Dd(),!1}catch{}finally{}if(c=qh(t,s,m,u),c!==null)return Fn(c,t,u),f0(c,s,u),!0}return!1}function Ef(t,s,c,u){if(u={lane:2,revertLane:rp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Qd(t)){if(s)throw Error(a(479))}else s=qh(t,c,u,2),s!==null&&Fn(s,t,2)}function Qd(t){var s=t.alternate;return t===nt||s!==null&&s===nt}function h0(t,s){qi=Fd=!0;var c=t.pending;c===null?s.next=s:(s.next=c.next,c.next=s),t.pending=s}function f0(t,s,c){if((c&4194048)!==0){var u=s.lanes;u&=t.pendingLanes,c|=u,s.lanes=c,bn(t,c)}}var Rl={readContext:wn,use:Wd,useCallback:Yt,useContext:Yt,useEffect:Yt,useImperativeHandle:Yt,useLayoutEffect:Yt,useInsertionEffect:Yt,useMemo:Yt,useReducer:Yt,useRef:Yt,useState:Yt,useDebugValue:Yt,useDeferredValue:Yt,useTransition:Yt,useSyncExternalStore:Yt,useId:Yt,useHostTransitionStatus:Yt,useFormState:Yt,useActionState:Yt,useOptimistic:Yt,useMemoCache:Yt,useCacheRefresh:Yt};Rl.useEffectEvent=Yt;var p0={readContext:wn,use:Wd,useCallback:function(t,s){return Rn().memoizedState=[t,s===void 0?null:s],t},useContext:wn,useEffect:Qb,useImperativeHandle:function(t,s,c){c=c!=null?c.concat([t]):null,Jd(4194308,4,n0.bind(null,s,t),c)},useLayoutEffect:function(t,s){return Jd(4194308,4,t,s)},useInsertionEffect:function(t,s){Jd(4,2,t,s)},useMemo:function(t,s){var c=Rn();s=s===void 0?null:s;var u=t();if(Kr){_e(!0);try{t()}finally{_e(!1)}}return c.memoizedState=[u,s],u},useReducer:function(t,s,c){var u=Rn();if(c!==void 0){var m=c(s);if(Kr){_e(!0);try{c(s)}finally{_e(!1)}}}else m=s;return u.memoizedState=u.baseState=m,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:m},u.queue=t,t=t.dispatch=C1.bind(null,nt,t),[u.memoizedState,t]},useRef:function(t){var s=Rn();return t={current:t},s.memoizedState=t},useState:function(t){t=vf(t);var s=t.queue,c=g0.bind(null,nt,s);return s.dispatch=c,[t.memoizedState,c]},useDebugValue:Cf,useDeferredValue:function(t,s){var c=Rn();return jf(c,t,s)},useTransition:function(){var t=vf(!1);return t=o0.bind(null,nt,t.queue,!0,!1),Rn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,c){var u=nt,m=Rn();if(mt){if(c===void 0)throw Error(a(407));c=c()}else{if(c=s(),Mt===null)throw Error(a(349));(ut&127)!==0||$b(u,s,c)}m.memoizedState=c;var b={value:c,getSnapshot:s};return m.queue=b,Qb(zb.bind(null,u,b,t),[t]),u.flags|=2048,Fi(9,{destroy:void 0},Ib.bind(null,u,b,c,s),null),c},useId:function(){var t=Rn(),s=Mt.identifierPrefix;if(mt){var c=Ja,u=Ya;c=(u&~(1<<32-Ne(u)-1)).toString(32)+c,s="_"+s+"R_"+c,c=Vd++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=m1++,s="_"+s+"r_"+c.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:Nf,useFormState:Kb,useActionState:Kb,useOptimistic:function(t){var s=Rn();s.memoizedState=s.baseState=t;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=Ef.bind(null,nt,!0,c),c.dispatch=s,[t,s]},useMemoCache:yf,useCacheRefresh:function(){return Rn().memoizedState=w1.bind(null,nt)},useEffectEvent:function(t){var s=Rn(),c={impl:t};return s.memoizedState=c,function(){if((jt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},_f={readContext:wn,use:Wd,useCallback:s0,useContext:wn,useEffect:wf,useImperativeHandle:a0,useInsertionEffect:e0,useLayoutEffect:t0,useMemo:r0,useReducer:Yd,useRef:Xb,useState:function(){return Yd(Ss)},useDebugValue:Cf,useDeferredValue:function(t,s){var c=en();return i0(c,Dt.memoizedState,t,s)},useTransition:function(){var t=Yd(Ss)[0],s=en().memoizedState;return[typeof t=="boolean"?t:Al(t),s]},useSyncExternalStore:Mb,useId:d0,useHostTransitionStatus:Nf,useFormState:Wb,useActionState:Wb,useOptimistic:function(t,s){var c=en();return Ub(c,Dt,t,s)},useMemoCache:yf,useCacheRefresh:u0};_f.useEffectEvent=Zb;var m0={readContext:wn,use:Wd,useCallback:s0,useContext:wn,useEffect:wf,useImperativeHandle:a0,useInsertionEffect:e0,useLayoutEffect:t0,useMemo:r0,useReducer:bf,useRef:Xb,useState:function(){return bf(Ss)},useDebugValue:Cf,useDeferredValue:function(t,s){var c=en();return Dt===null?jf(c,t,s):i0(c,Dt.memoizedState,t,s)},useTransition:function(){var t=bf(Ss)[0],s=en().memoizedState;return[typeof t=="boolean"?t:Al(t),s]},useSyncExternalStore:Mb,useId:d0,useHostTransitionStatus:Nf,useFormState:Jb,useActionState:Jb,useOptimistic:function(t,s){var c=en();return Dt!==null?Ub(c,Dt,t,s):(c.baseState=t,[t,c.queue.dispatch])},useMemoCache:yf,useCacheRefresh:u0};m0.useEffectEvent=Zb;function Tf(t,s,c,u){s=t.memoizedState,c=c(u,s),c=c==null?s:x({},s,c),t.memoizedState=c,t.lanes===0&&(t.updateQueue.baseState=c)}var Af={enqueueSetState:function(t,s,c){t=t._reactInternals;var u=aa(),m=er(u);m.payload=s,c!=null&&(m.callback=c),s=tr(t,m,u),s!==null&&(Fn(s,t,u),Nl(s,t,u))},enqueueReplaceState:function(t,s,c){t=t._reactInternals;var u=aa(),m=er(u);m.tag=1,m.payload=s,c!=null&&(m.callback=c),s=tr(t,m,u),s!==null&&(Fn(s,t,u),Nl(s,t,u))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var c=aa(),u=er(c);u.tag=2,s!=null&&(u.callback=s),s=tr(t,u,c),s!==null&&(Fn(s,t,c),Nl(s,t,c))}};function y0(t,s,c,u,m,b,E){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,b,E):s.prototype&&s.prototype.isPureReactComponent?!xl(c,u)||!xl(m,b):!0}function x0(t,s,c,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,u),s.state!==t&&Af.enqueueReplaceState(s,s.state,null)}function Wr(t,s){var c=s;if("ref"in s){c={};for(var u in s)u!=="ref"&&(c[u]=s[u])}if(t=t.defaultProps){c===s&&(c=x({},c));for(var m in t)c[m]===void 0&&(c[m]=t[m])}return c}function b0(t){Ad(t)}function v0(t){console.error(t)}function S0(t){Ad(t)}function Zd(t,s){try{var c=t.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function w0(t,s,c){try{var u=t.onCaughtError;u(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Df(t,s,c){return c=er(c),c.tag=3,c.payload={element:null},c.callback=function(){Zd(t,s)},c}function C0(t){return t=er(t),t.tag=3,t}function j0(t,s,c,u){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var b=u.value;t.payload=function(){return m(b)},t.callback=function(){w0(s,c,u)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(t.callback=function(){w0(s,c,u),typeof m!="function"&&(or===null?or=new Set([this]):or.add(this));var O=u.stack;this.componentDidCatch(u.value,{componentStack:O!==null?O:""})})}function j1(t,s,c,u,m){if(c.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=c.alternate,s!==null&&Ii(s,c,m,!0),c=Zn.current,c!==null){switch(c.tag){case 31:case 13:return fa===null?uu():c.alternate===null&&Jt===0&&(Jt=3),c.flags&=-257,c.flags|=65536,c.lanes=m,u===Pd?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([u]):s.add(u),np(t,u,m)),!1;case 22:return c.flags|=65536,u===Pd?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([u]):c.add(u)),np(t,u,m)),!1}throw Error(a(435,c.tag))}return np(t,u,m),uu(),!1}if(mt)return s=Zn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,u!==Yh&&(t=Error(a(422),{cause:u}),Sl(da(t,c)))):(u!==Yh&&(s=Error(a(423),{cause:u}),Sl(da(s,c))),t=t.current.alternate,t.flags|=65536,m&=-m,t.lanes|=m,u=da(u,c),m=Df(t.stateNode,u,m),of(t,m),Jt!==4&&(Jt=2)),!1;var b=Error(a(520),{cause:u});if(b=da(b,c),Pl===null?Pl=[b]:Pl.push(b),Jt!==4&&(Jt=2),s===null)return!0;u=da(u,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,t=m&-m,c.lanes|=t,t=Df(c.stateNode,u,t),of(c,t),!1;case 1:if(s=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(or===null||!or.has(b))))return c.flags|=65536,m&=-m,c.lanes|=m,m=C0(m),j0(m,t,c,u),of(c,m),!1}c=c.return}while(c!==null);return!1}var Rf=Error(a(461)),ln=!1;function Cn(t,s,c,u){s.child=t===null?_b(s,null,c,u):Vr(s,t.child,c,u)}function k0(t,s,c,u,m){c=c.render;var b=s.ref;if("ref"in u){var E={};for(var O in u)O!=="ref"&&(E[O]=u[O])}else E=u;return Br(s),u=hf(t,s,c,E,b,m),O=ff(),t!==null&&!ln?(pf(t,s,m),ws(t,s,m)):(mt&&O&&Kh(s),s.flags|=1,Cn(t,s,u,m),s.child)}function N0(t,s,c,u,m){if(t===null){var b=c.type;return typeof b=="function"&&!Gh(b)&&b.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=b,E0(t,s,b,u,m)):(t=Ld(c.type,null,u,s,s.mode,m),t.ref=s.ref,t.return=s,s.child=t)}if(b=t.child,!Pf(t,m)){var E=b.memoizedProps;if(c=c.compare,c=c!==null?c:xl,c(E,u)&&t.ref===s.ref)return ws(t,s,m)}return s.flags|=1,t=ms(b,u),t.ref=s.ref,t.return=s,s.child=t}function E0(t,s,c,u,m){if(t!==null){var b=t.memoizedProps;if(xl(b,u)&&t.ref===s.ref)if(ln=!1,s.pendingProps=u=b,Pf(t,m))(t.flags&131072)!==0&&(ln=!0);else return s.lanes=t.lanes,ws(t,s,m)}return Of(t,s,c,u,m)}function _0(t,s,c,u){var m=u.children,b=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((s.flags&128)!==0){if(b=b!==null?b.baseLanes|c:c,t!==null){for(u=s.child=t.child,m=0;u!==null;)m=m|u.lanes|u.childLanes,u=u.sibling;u=m&~b}else u=0,s.child=null;return T0(t,s,b,c,u)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&zd(s,b!==null?b.cachePool:null),b!==null?Db(s,b):cf(),Rb(s);else return u=s.lanes=536870912,T0(t,s,b!==null?b.baseLanes|c:c,c,u)}else b!==null?(zd(s,b.cachePool),Db(s,b),ar(),s.memoizedState=null):(t!==null&&zd(s,null),cf(),ar());return Cn(t,s,m,c),s.child}function Ol(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function T0(t,s,c,u,m){var b=nf();return b=b===null?null:{parent:rn._currentValue,pool:b},s.memoizedState={baseLanes:c,cachePool:b},t!==null&&zd(s,null),cf(),Rb(s),t!==null&&Ii(t,s,u,!0),s.childLanes=m,null}function eu(t,s){return s=nu({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function A0(t,s,c){return Vr(s,t.child,null,c),t=eu(s,s.pendingProps),t.flags|=2,ea(s),s.memoizedState=null,t}function k1(t,s,c){var u=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(mt){if(u.mode==="hidden")return t=eu(s,u),s.lanes=536870912,Ol(null,t);if(uf(s),(t=Ht)?(t=Bv(t,ha),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ys!==null?{id:Ya,overflow:Ja}:null,retryLane:536870912,hydrationErrors:null},c=hb(t),c.return=s,s.child=c,Sn=s,Ht=null)):t=null,t===null)throw Xs(s);return s.lanes=536870912,null}return eu(s,u)}var b=t.memoizedState;if(b!==null){var E=b.dehydrated;if(uf(s),m)if(s.flags&256)s.flags&=-257,s=A0(t,s,c);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(a(558));else if(ln||Ii(t,s,c,!1),m=(c&t.childLanes)!==0,ln||m){if(u=Mt,u!==null&&(E=Dn(u,c),E!==0&&E!==b.retryLane))throw b.retryLane=E,zr(t,E),Fn(u,t,E),Rf;uu(),s=A0(t,s,c)}else t=b.treeContext,Ht=pa(E.nextSibling),Sn=s,mt=!0,Js=null,ha=!1,t!==null&&mb(s,t),s=eu(s,u),s.flags|=4096;return s}return t=ms(t.child,{mode:u.mode,children:u.children}),t.ref=s.ref,s.child=t,t.return=s,t}function tu(t,s){var c=s.ref;if(c===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(t===null||t.ref!==c)&&(s.flags|=4194816)}}function Of(t,s,c,u,m){return Br(s),c=hf(t,s,c,u,void 0,m),u=ff(),t!==null&&!ln?(pf(t,s,m),ws(t,s,m)):(mt&&u&&Kh(s),s.flags|=1,Cn(t,s,c,m),s.child)}function D0(t,s,c,u,m,b){return Br(s),s.updateQueue=null,c=Lb(s,u,c,m),Ob(t),u=ff(),t!==null&&!ln?(pf(t,s,b),ws(t,s,b)):(mt&&u&&Kh(s),s.flags|=1,Cn(t,s,c,b),s.child)}function R0(t,s,c,u,m){if(Br(s),s.stateNode===null){var b=Oi,E=c.contextType;typeof E=="object"&&E!==null&&(b=wn(E)),b=new c(u,b),s.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=Af,s.stateNode=b,b._reactInternals=s,b=s.stateNode,b.props=u,b.state=s.memoizedState,b.refs={},sf(s),E=c.contextType,b.context=typeof E=="object"&&E!==null?wn(E):Oi,b.state=s.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(Tf(s,c,E,u),b.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(E=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),E!==b.state&&Af.enqueueReplaceState(b,b.state,null),_l(s,u,b,m),El(),b.state=s.memoizedState),typeof b.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(t===null){b=s.stateNode;var O=s.memoizedProps,B=Wr(c,O);b.props=B;var te=b.context,ce=c.contextType;E=Oi,typeof ce=="object"&&ce!==null&&(E=wn(ce));var ye=c.getDerivedStateFromProps;ce=typeof ye=="function"||typeof b.getSnapshotBeforeUpdate=="function",O=s.pendingProps!==O,ce||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(O||te!==E)&&x0(s,b,u,E),Zs=!1;var ae=s.memoizedState;b.state=ae,_l(s,u,b,m),El(),te=s.memoizedState,O||ae!==te||Zs?(typeof ye=="function"&&(Tf(s,c,ye,u),te=s.memoizedState),(B=Zs||y0(s,c,B,u,ae,te,E))?(ce||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(s.flags|=4194308)):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=te),b.props=u,b.state=te,b.context=E,u=B):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{b=s.stateNode,rf(t,s),E=s.memoizedProps,ce=Wr(c,E),b.props=ce,ye=s.pendingProps,ae=b.context,te=c.contextType,B=Oi,typeof te=="object"&&te!==null&&(B=wn(te)),O=c.getDerivedStateFromProps,(te=typeof O=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(E!==ye||ae!==B)&&x0(s,b,u,B),Zs=!1,ae=s.memoizedState,b.state=ae,_l(s,u,b,m),El();var oe=s.memoizedState;E!==ye||ae!==oe||Zs||t!==null&&t.dependencies!==null&&$d(t.dependencies)?(typeof O=="function"&&(Tf(s,c,O,u),oe=s.memoizedState),(ce=Zs||y0(s,c,ce,u,ae,oe,B)||t!==null&&t.dependencies!==null&&$d(t.dependencies))?(te||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(u,oe,B),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(u,oe,B)),typeof b.componentDidUpdate=="function"&&(s.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof b.componentDidUpdate!="function"||E===t.memoizedProps&&ae===t.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||E===t.memoizedProps&&ae===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=oe),b.props=u,b.state=oe,b.context=B,u=ce):(typeof b.componentDidUpdate!="function"||E===t.memoizedProps&&ae===t.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||E===t.memoizedProps&&ae===t.memoizedState||(s.flags|=1024),u=!1)}return b=u,tu(t,s),u=(s.flags&128)!==0,b||u?(b=s.stateNode,c=u&&typeof c.getDerivedStateFromError!="function"?null:b.render(),s.flags|=1,t!==null&&u?(s.child=Vr(s,t.child,null,m),s.child=Vr(s,null,c,m)):Cn(t,s,c,m),s.memoizedState=b.state,t=s.child):t=ws(t,s,m),t}function O0(t,s,c,u){return Pr(),s.flags|=256,Cn(t,s,c,u),s.child}var Lf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mf(t){return{baseLanes:t,cachePool:wb()}}function $f(t,s,c){return t=t!==null?t.childLanes&~c:0,s&&(t|=na),t}function L0(t,s,c){var u=s.pendingProps,m=!1,b=(s.flags&128)!==0,E;if((E=b)||(E=t!==null&&t.memoizedState===null?!1:(Zt.current&2)!==0),E&&(m=!0,s.flags&=-129),E=(s.flags&32)!==0,s.flags&=-33,t===null){if(mt){if(m?nr(s):ar(),(t=Ht)?(t=Bv(t,ha),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ys!==null?{id:Ya,overflow:Ja}:null,retryLane:536870912,hydrationErrors:null},c=hb(t),c.return=s,s.child=c,Sn=s,Ht=null)):t=null,t===null)throw Xs(s);return xp(t)?s.lanes=32:s.lanes=536870912,null}var O=u.children;return u=u.fallback,m?(ar(),m=s.mode,O=nu({mode:"hidden",children:O},m),u=Hr(u,m,c,null),O.return=s,u.return=s,O.sibling=u,s.child=O,u=s.child,u.memoizedState=Mf(c),u.childLanes=$f(t,E,c),s.memoizedState=Lf,Ol(null,u)):(nr(s),If(s,O))}var B=t.memoizedState;if(B!==null&&(O=B.dehydrated,O!==null)){if(b)s.flags&256?(nr(s),s.flags&=-257,s=zf(t,s,c)):s.memoizedState!==null?(ar(),s.child=t.child,s.flags|=128,s=null):(ar(),O=u.fallback,m=s.mode,u=nu({mode:"visible",children:u.children},m),O=Hr(O,m,c,null),O.flags|=2,u.return=s,O.return=s,u.sibling=O,s.child=u,Vr(s,t.child,null,c),u=s.child,u.memoizedState=Mf(c),u.childLanes=$f(t,E,c),s.memoizedState=Lf,s=Ol(null,u));else if(nr(s),xp(O)){if(E=O.nextSibling&&O.nextSibling.dataset,E)var te=E.dgst;E=te,u=Error(a(419)),u.stack="",u.digest=E,Sl({value:u,source:null,stack:null}),s=zf(t,s,c)}else if(ln||Ii(t,s,c,!1),E=(c&t.childLanes)!==0,ln||E){if(E=Mt,E!==null&&(u=Dn(E,c),u!==0&&u!==B.retryLane))throw B.retryLane=u,zr(t,u),Fn(E,t,u),Rf;yp(O)||uu(),s=zf(t,s,c)}else yp(O)?(s.flags|=192,s.child=t.child,s=null):(t=B.treeContext,Ht=pa(O.nextSibling),Sn=s,mt=!0,Js=null,ha=!1,t!==null&&mb(s,t),s=If(s,u.children),s.flags|=4096);return s}return m?(ar(),O=u.fallback,m=s.mode,B=t.child,te=B.sibling,u=ms(B,{mode:"hidden",children:u.children}),u.subtreeFlags=B.subtreeFlags&65011712,te!==null?O=ms(te,O):(O=Hr(O,m,c,null),O.flags|=2),O.return=s,u.return=s,u.sibling=O,s.child=u,Ol(null,u),u=s.child,O=t.child.memoizedState,O===null?O=Mf(c):(m=O.cachePool,m!==null?(B=rn._currentValue,m=m.parent!==B?{parent:B,pool:B}:m):m=wb(),O={baseLanes:O.baseLanes|c,cachePool:m}),u.memoizedState=O,u.childLanes=$f(t,E,c),s.memoizedState=Lf,Ol(t.child,u)):(nr(s),c=t.child,t=c.sibling,c=ms(c,{mode:"visible",children:u.children}),c.return=s,c.sibling=null,t!==null&&(E=s.deletions,E===null?(s.deletions=[t],s.flags|=16):E.push(t)),s.child=c,s.memoizedState=null,c)}function If(t,s){return s=nu({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function nu(t,s){return t=Qn(22,t,null,s),t.lanes=0,t}function zf(t,s,c){return Vr(s,t.child,null,c),t=If(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function M0(t,s,c){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Qh(t.return,s,c)}function Hf(t,s,c,u,m,b){var E=t.memoizedState;E===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:c,tailMode:m,treeForkCount:b}:(E.isBackwards=s,E.rendering=null,E.renderingStartTime=0,E.last=u,E.tail=c,E.tailMode=m,E.treeForkCount=b)}function $0(t,s,c){var u=s.pendingProps,m=u.revealOrder,b=u.tail;u=u.children;var E=Zt.current,O=(E&2)!==0;if(O?(E=E&1|2,s.flags|=128):E&=1,ie(Zt,E),Cn(t,s,u,c),u=mt?vl:0,!O&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&M0(t,c,s);else if(t.tag===19)M0(t,c,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(m){case"forwards":for(c=s.child,m=null;c!==null;)t=c.alternate,t!==null&&Gd(t)===null&&(m=c),c=c.sibling;c=m,c===null?(m=s.child,s.child=null):(m=c.sibling,c.sibling=null),Hf(s,!1,m,c,b,u);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=s.child,s.child=null;m!==null;){if(t=m.alternate,t!==null&&Gd(t)===null){s.child=m;break}t=m.sibling,m.sibling=c,c=m,m=t}Hf(s,!0,c,null,b,u);break;case"together":Hf(s,!1,null,null,void 0,u);break;default:s.memoizedState=null}return s.child}function ws(t,s,c){if(t!==null&&(s.dependencies=t.dependencies),ir|=s.lanes,(c&s.childLanes)===0)if(t!==null){if(Ii(t,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(a(153));if(s.child!==null){for(t=s.child,c=ms(t,t.pendingProps),s.child=c,c.return=s;t.sibling!==null;)t=t.sibling,c=c.sibling=ms(t,t.pendingProps),c.return=s;c.sibling=null}return s.child}function Pf(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&$d(t)))}function N1(t,s,c){switch(s.tag){case 3:tt(s,s.stateNode.containerInfo),Qs(s,rn,t.memoizedState.cache),Pr();break;case 27:case 5:qe(s);break;case 4:tt(s,s.stateNode.containerInfo);break;case 10:Qs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,uf(s),null;break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(nr(s),s.flags|=128,null):(c&s.child.childLanes)!==0?L0(t,s,c):(nr(s),t=ws(t,s,c),t!==null?t.sibling:null);nr(s);break;case 19:var m=(t.flags&128)!==0;if(u=(c&s.childLanes)!==0,u||(Ii(t,s,c,!1),u=(c&s.childLanes)!==0),m){if(u)return $0(t,s,c);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),ie(Zt,Zt.current),u)break;return null;case 22:return s.lanes=0,_0(t,s,c,s.pendingProps);case 24:Qs(s,rn,t.memoizedState.cache)}return ws(t,s,c)}function I0(t,s,c){if(t!==null)if(t.memoizedProps!==s.pendingProps)ln=!0;else{if(!Pf(t,c)&&(s.flags&128)===0)return ln=!1,N1(t,s,c);ln=(t.flags&131072)!==0}else ln=!1,mt&&(s.flags&1048576)!==0&&pb(s,vl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var u=s.pendingProps;if(t=Gr(s.elementType),s.type=t,typeof t=="function")Gh(t)?(u=Wr(t,u),s.tag=1,s=R0(null,s,t,u,c)):(s.tag=0,s=Of(null,s,t,u,c));else{if(t!=null){var m=t.$$typeof;if(m===D){s.tag=11,s=k0(null,s,t,u,c);break e}else if(m===z){s.tag=14,s=N0(null,s,t,u,c);break e}}throw s=le(t)||t,Error(a(306,s,""))}}return s;case 0:return Of(t,s,s.type,s.pendingProps,c);case 1:return u=s.type,m=Wr(u,s.pendingProps),R0(t,s,u,m,c);case 3:e:{if(tt(s,s.stateNode.containerInfo),t===null)throw Error(a(387));u=s.pendingProps;var b=s.memoizedState;m=b.element,rf(t,s),_l(s,u,null,c);var E=s.memoizedState;if(u=E.cache,Qs(s,rn,u),u!==b.cache&&Zh(s,[rn],c,!0),El(),u=E.element,b.isDehydrated)if(b={element:u,isDehydrated:!1,cache:E.cache},s.updateQueue.baseState=b,s.memoizedState=b,s.flags&256){s=O0(t,s,u,c);break e}else if(u!==m){m=da(Error(a(424)),s),Sl(m),s=O0(t,s,u,c);break e}else{switch(t=s.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ht=pa(t.firstChild),Sn=s,mt=!0,Js=null,ha=!0,c=_b(s,null,u,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Pr(),u===m){s=ws(t,s,c);break e}Cn(t,s,u,c)}s=s.child}return s;case 26:return tu(t,s),t===null?(c=Wv(s.type,null,s.pendingProps,null))?s.memoizedState=c:mt||(c=s.type,t=s.pendingProps,u=xu(Ee.current).createElement(c),u[gn]=s,u[vn]=t,jn(u,c,t),sn(u),s.stateNode=u):s.memoizedState=Wv(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return qe(s),t===null&&mt&&(u=s.stateNode=Fv(s.type,s.pendingProps,Ee.current),Sn=s,ha=!0,m=Ht,ur(s.type)?(bp=m,Ht=pa(u.firstChild)):Ht=m),Cn(t,s,s.pendingProps.children,c),tu(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&mt&&((m=u=Ht)&&(u=n_(u,s.type,s.pendingProps,ha),u!==null?(s.stateNode=u,Sn=s,Ht=pa(u.firstChild),ha=!1,m=!0):m=!1),m||Xs(s)),qe(s),m=s.type,b=s.pendingProps,E=t!==null?t.memoizedProps:null,u=b.children,fp(m,b)?u=null:E!==null&&fp(m,E)&&(s.flags|=32),s.memoizedState!==null&&(m=hf(t,s,y1,null,null,c),Wl._currentValue=m),tu(t,s),Cn(t,s,u,c),s.child;case 6:return t===null&&mt&&((t=c=Ht)&&(c=a_(c,s.pendingProps,ha),c!==null?(s.stateNode=c,Sn=s,Ht=null,t=!0):t=!1),t||Xs(s)),null;case 13:return L0(t,s,c);case 4:return tt(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=Vr(s,null,u,c):Cn(t,s,u,c),s.child;case 11:return k0(t,s,s.type,s.pendingProps,c);case 7:return Cn(t,s,s.pendingProps,c),s.child;case 8:return Cn(t,s,s.pendingProps.children,c),s.child;case 12:return Cn(t,s,s.pendingProps.children,c),s.child;case 10:return u=s.pendingProps,Qs(s,s.type,u.value),Cn(t,s,u.children,c),s.child;case 9:return m=s.type._context,u=s.pendingProps.children,Br(s),m=wn(m),u=u(m),s.flags|=1,Cn(t,s,u,c),s.child;case 14:return N0(t,s,s.type,s.pendingProps,c);case 15:return E0(t,s,s.type,s.pendingProps,c);case 19:return $0(t,s,c);case 31:return k1(t,s,c);case 22:return _0(t,s,c,s.pendingProps);case 24:return Br(s),u=wn(rn),t===null?(m=nf(),m===null&&(m=Mt,b=ef(),m.pooledCache=b,b.refCount++,b!==null&&(m.pooledCacheLanes|=c),m=b),s.memoizedState={parent:u,cache:m},sf(s),Qs(s,rn,m)):((t.lanes&c)!==0&&(rf(t,s),_l(s,null,null,c),El()),m=t.memoizedState,b=s.memoizedState,m.parent!==u?(m={parent:u,cache:u},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),Qs(s,rn,u)):(u=b.cache,Qs(s,rn,u),u!==m.cache&&Zh(s,[rn],c,!0))),Cn(t,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function Cs(t){t.flags|=4}function Uf(t,s,c,u,m){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(m&335544128)===m)if(t.stateNode.complete)t.flags|=8192;else if(dv())t.flags|=8192;else throw Fr=Pd,af}else t.flags&=-16777217}function z0(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Zv(s))if(dv())t.flags|=8192;else throw Fr=Pd,af}function au(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?Ue():536870912,t.lanes|=s,Yi|=s)}function Ll(t,s){if(!mt)switch(t.tailMode){case"hidden":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?t.tail=null:c.sibling=null;break;case"collapsed":c=t.tail;for(var u=null;c!==null;)c.alternate!==null&&(u=c),c=c.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Pt(t){var s=t.alternate!==null&&t.alternate.child===t.child,c=0,u=0;if(s)for(var m=t.child;m!==null;)c|=m.lanes|m.childLanes,u|=m.subtreeFlags&65011712,u|=m.flags&65011712,m.return=t,m=m.sibling;else for(m=t.child;m!==null;)c|=m.lanes|m.childLanes,u|=m.subtreeFlags,u|=m.flags,m.return=t,m=m.sibling;return t.subtreeFlags|=u,t.childLanes=c,s}function E1(t,s,c){var u=s.pendingProps;switch(Wh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(s),null;case 1:return Pt(s),null;case 3:return c=s.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),bs(rn),Me(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(t===null||t.child===null)&&($i(s)?Cs(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Jh())),Pt(s),null;case 26:var m=s.type,b=s.memoizedState;return t===null?(Cs(s),b!==null?(Pt(s),z0(s,b)):(Pt(s),Uf(s,m,null,u,c))):b?b!==t.memoizedState?(Cs(s),Pt(s),z0(s,b)):(Pt(s),s.flags&=-16777217):(t=t.memoizedProps,t!==u&&Cs(s),Pt(s),Uf(s,m,t,u,c)),null;case 27:if(zt(s),c=Ee.current,m=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&Cs(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return Pt(s),null}t=se.current,$i(s)?yb(s):(t=Fv(m,u,c),s.stateNode=t,Cs(s))}return Pt(s),null;case 5:if(zt(s),m=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&Cs(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return Pt(s),null}if(b=se.current,$i(s))yb(s);else{var E=xu(Ee.current);switch(b){case 1:b=E.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:b=E.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":b=E.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":b=E.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":b=E.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?b.multiple=!0:u.size&&(b.size=u.size);break;default:b=typeof u.is=="string"?E.createElement(m,{is:u.is}):E.createElement(m)}}b[gn]=s,b[vn]=u;e:for(E=s.child;E!==null;){if(E.tag===5||E.tag===6)b.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===s)break e;for(;E.sibling===null;){if(E.return===null||E.return===s)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}s.stateNode=b;e:switch(jn(b,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Cs(s)}}return Pt(s),Uf(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,c),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==u&&Cs(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(a(166));if(t=Ee.current,$i(s)){if(t=s.stateNode,c=s.memoizedProps,u=null,m=Sn,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}t[gn]=s,t=!!(t.nodeValue===c||u!==null&&u.suppressHydrationWarning===!0||Lv(t.nodeValue,c)),t||Xs(s,!0)}else t=xu(t).createTextNode(u),t[gn]=s,s.stateNode=t}return Pt(s),null;case 31:if(c=s.memoizedState,t===null||t.memoizedState!==null){if(u=$i(s),c!==null){if(t===null){if(!u)throw Error(a(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[gn]=s}else Pr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),t=!1}else c=Jh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=c),t=!0;if(!t)return s.flags&256?(ea(s),s):(ea(s),null);if((s.flags&128)!==0)throw Error(a(558))}return Pt(s),null;case 13:if(u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(m=$i(s),u!==null&&u.dehydrated!==null){if(t===null){if(!m)throw Error(a(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(a(317));m[gn]=s}else Pr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),m=!1}else m=Jh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(ea(s),s):(ea(s),null)}return ea(s),(s.flags&128)!==0?(s.lanes=c,s):(c=u!==null,t=t!==null&&t.memoizedState!==null,c&&(u=s.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),b=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),b!==m&&(u.flags|=2048)),c!==t&&c&&(s.child.flags|=8192),au(s,s.updateQueue),Pt(s),null);case 4:return Me(),t===null&&cp(s.stateNode.containerInfo),Pt(s),null;case 10:return bs(s.type),Pt(s),null;case 19:if(q(Zt),u=s.memoizedState,u===null)return Pt(s),null;if(m=(s.flags&128)!==0,b=u.rendering,b===null)if(m)Ll(u,!1);else{if(Jt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(b=Gd(t),b!==null){for(s.flags|=128,Ll(u,!1),t=b.updateQueue,s.updateQueue=t,au(s,t),s.subtreeFlags=0,t=c,c=s.child;c!==null;)gb(c,t),c=c.sibling;return ie(Zt,Zt.current&1|2),mt&&ys(s,u.treeForkCount),s.child}t=t.sibling}u.tail!==null&&ot()>lu&&(s.flags|=128,m=!0,Ll(u,!1),s.lanes=4194304)}else{if(!m)if(t=Gd(b),t!==null){if(s.flags|=128,m=!0,t=t.updateQueue,s.updateQueue=t,au(s,t),Ll(u,!0),u.tail===null&&u.tailMode==="hidden"&&!b.alternate&&!mt)return Pt(s),null}else 2*ot()-u.renderingStartTime>lu&&c!==536870912&&(s.flags|=128,m=!0,Ll(u,!1),s.lanes=4194304);u.isBackwards?(b.sibling=s.child,s.child=b):(t=u.last,t!==null?t.sibling=b:s.child=b,u.last=b)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ot(),t.sibling=null,c=Zt.current,ie(Zt,m?c&1|2:c&1),mt&&ys(s,u.treeForkCount),t):(Pt(s),null);case 22:case 23:return ea(s),df(),u=s.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(c&536870912)!==0&&(s.flags&128)===0&&(Pt(s),s.subtreeFlags&6&&(s.flags|=8192)):Pt(s),c=s.updateQueue,c!==null&&au(s,c.retryQueue),c=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(c=t.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==c&&(s.flags|=2048),t!==null&&q(qr),null;case 24:return c=null,t!==null&&(c=t.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),bs(rn),Pt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function _1(t,s){switch(Wh(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return bs(rn),Me(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return zt(s),null;case 31:if(s.memoizedState!==null){if(ea(s),s.alternate===null)throw Error(a(340));Pr()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(ea(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(a(340));Pr()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return q(Zt),null;case 4:return Me(),null;case 10:return bs(s.type),null;case 22:case 23:return ea(s),df(),t!==null&&q(qr),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return bs(rn),null;case 25:return null;default:return null}}function H0(t,s){switch(Wh(s),s.tag){case 3:bs(rn),Me();break;case 26:case 27:case 5:zt(s);break;case 4:Me();break;case 31:s.memoizedState!==null&&ea(s);break;case 13:ea(s);break;case 19:q(Zt);break;case 10:bs(s.type);break;case 22:case 23:ea(s),df(),t!==null&&q(qr);break;case 24:bs(rn)}}function Ml(t,s){try{var c=s.updateQueue,u=c!==null?c.lastEffect:null;if(u!==null){var m=u.next;c=m;do{if((c.tag&t)===t){u=void 0;var b=c.create,E=c.inst;u=b(),E.destroy=u}c=c.next}while(c!==m)}}catch(O){Tt(s,s.return,O)}}function sr(t,s,c){try{var u=s.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var b=m.next;u=b;do{if((u.tag&t)===t){var E=u.inst,O=E.destroy;if(O!==void 0){E.destroy=void 0,m=s;var B=c,te=O;try{te()}catch(ce){Tt(m,B,ce)}}}u=u.next}while(u!==b)}}catch(ce){Tt(s,s.return,ce)}}function P0(t){var s=t.updateQueue;if(s!==null){var c=t.stateNode;try{Ab(s,c)}catch(u){Tt(t,t.return,u)}}}function U0(t,s,c){c.props=Wr(t.type,t.memoizedProps),c.state=t.memoizedState;try{c.componentWillUnmount()}catch(u){Tt(t,s,u)}}function $l(t,s){try{var c=t.ref;if(c!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof c=="function"?t.refCleanup=c(u):c.current=u}}catch(m){Tt(t,s,m)}}function Xa(t,s){var c=t.ref,u=t.refCleanup;if(c!==null)if(typeof u=="function")try{u()}catch(m){Tt(t,s,m)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Tt(t,s,m)}else c.current=null}function B0(t){var s=t.type,c=t.memoizedProps,u=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&u.focus();break e;case"img":c.src?u.src=c.src:c.srcSet&&(u.srcset=c.srcSet)}}catch(m){Tt(t,t.return,m)}}function Bf(t,s,c){try{var u=t.stateNode;J1(u,t.type,c,s),u[vn]=s}catch(m){Tt(t,t.return,m)}}function q0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ur(t.type)||t.tag===4}function qf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||q0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ur(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Gf(t,s,c){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(t,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(t),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=la));else if(u!==4&&(u===27&&ur(t.type)&&(c=t.stateNode,s=null),t=t.child,t!==null))for(Gf(t,s,c),t=t.sibling;t!==null;)Gf(t,s,c),t=t.sibling}function su(t,s,c){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?c.insertBefore(t,s):c.appendChild(t);else if(u!==4&&(u===27&&ur(t.type)&&(c=t.stateNode),t=t.child,t!==null))for(su(t,s,c),t=t.sibling;t!==null;)su(t,s,c),t=t.sibling}function G0(t){var s=t.stateNode,c=t.memoizedProps;try{for(var u=t.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);jn(s,u,c),s[gn]=t,s[vn]=c}catch(b){Tt(t,t.return,b)}}var js=!1,cn=!1,Ff=!1,F0=typeof WeakSet=="function"?WeakSet:Set,xn=null;function T1(t,s){if(t=t.containerInfo,gp=ku,t=ab(t),Ih(t)){if("selectionStart"in t)var c={start:t.selectionStart,end:t.selectionEnd};else e:{c=(c=t.ownerDocument)&&c.defaultView||window;var u=c.getSelection&&c.getSelection();if(u&&u.rangeCount!==0){c=u.anchorNode;var m=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{c.nodeType,b.nodeType}catch{c=null;break e}var E=0,O=-1,B=-1,te=0,ce=0,ye=t,ae=null;t:for(;;){for(var oe;ye!==c||m!==0&&ye.nodeType!==3||(O=E+m),ye!==b||u!==0&&ye.nodeType!==3||(B=E+u),ye.nodeType===3&&(E+=ye.nodeValue.length),(oe=ye.firstChild)!==null;)ae=ye,ye=oe;for(;;){if(ye===t)break t;if(ae===c&&++te===m&&(O=E),ae===b&&++ce===u&&(B=E),(oe=ye.nextSibling)!==null)break;ye=ae,ae=ye.parentNode}ye=oe}c=O===-1||B===-1?null:{start:O,end:B}}else c=null}c=c||{start:0,end:0}}else c=null;for(hp={focusedElem:t,selectionRange:c},ku=!1,xn=s;xn!==null;)if(s=xn,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,xn=t;else for(;xn!==null;){switch(s=xn,b=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(c=0;c<t.length;c++)m=t[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&b!==null){t=void 0,c=s,m=b.memoizedProps,b=b.memoizedState,u=c.stateNode;try{var Re=Wr(c.type,m);t=u.getSnapshotBeforeUpdate(Re,b),u.__reactInternalSnapshotBeforeUpdate=t}catch(Ke){Tt(c,c.return,Ke)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,c=t.nodeType,c===9)mp(t);else if(c===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":mp(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=s.sibling,t!==null){t.return=s.return,xn=t;break}xn=s.return}}function V0(t,s,c){var u=c.flags;switch(c.tag){case 0:case 11:case 15:Ns(t,c),u&4&&Ml(5,c);break;case 1:if(Ns(t,c),u&4)if(t=c.stateNode,s===null)try{t.componentDidMount()}catch(E){Tt(c,c.return,E)}else{var m=Wr(c.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(m,s,t.__reactInternalSnapshotBeforeUpdate)}catch(E){Tt(c,c.return,E)}}u&64&&P0(c),u&512&&$l(c,c.return);break;case 3:if(Ns(t,c),u&64&&(t=c.updateQueue,t!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{Ab(t,s)}catch(E){Tt(c,c.return,E)}}break;case 27:s===null&&u&4&&G0(c);case 26:case 5:Ns(t,c),s===null&&u&4&&B0(c),u&512&&$l(c,c.return);break;case 12:Ns(t,c);break;case 31:Ns(t,c),u&4&&Y0(t,c);break;case 13:Ns(t,c),u&4&&J0(t,c),u&64&&(t=c.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(c=z1.bind(null,c),s_(t,c))));break;case 22:if(u=c.memoizedState!==null||js,!u){s=s!==null&&s.memoizedState!==null||cn,m=js;var b=cn;js=u,(cn=s)&&!b?Es(t,c,(c.subtreeFlags&8772)!==0):Ns(t,c),js=m,cn=b}break;case 30:break;default:Ns(t,c)}}function K0(t){var s=t.alternate;s!==null&&(t.alternate=null,K0(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&Wo(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Bt=null,Un=!1;function ks(t,s,c){for(c=c.child;c!==null;)W0(t,s,c),c=c.sibling}function W0(t,s,c){if(ne&&typeof ne.onCommitFiberUnmount=="function")try{ne.onCommitFiberUnmount(me,c)}catch{}switch(c.tag){case 26:cn||Xa(c,s),ks(t,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:cn||Xa(c,s);var u=Bt,m=Un;ur(c.type)&&(Bt=c.stateNode,Un=!1),ks(t,s,c),Fl(c.stateNode),Bt=u,Un=m;break;case 5:cn||Xa(c,s);case 6:if(u=Bt,m=Un,Bt=null,ks(t,s,c),Bt=u,Un=m,Bt!==null)if(Un)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(c.stateNode)}catch(b){Tt(c,s,b)}else try{Bt.removeChild(c.stateNode)}catch(b){Tt(c,s,b)}break;case 18:Bt!==null&&(Un?(t=Bt,Pv(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,c.stateNode),ao(t)):Pv(Bt,c.stateNode));break;case 4:u=Bt,m=Un,Bt=c.stateNode.containerInfo,Un=!0,ks(t,s,c),Bt=u,Un=m;break;case 0:case 11:case 14:case 15:sr(2,c,s),cn||sr(4,c,s),ks(t,s,c);break;case 1:cn||(Xa(c,s),u=c.stateNode,typeof u.componentWillUnmount=="function"&&U0(c,s,u)),ks(t,s,c);break;case 21:ks(t,s,c);break;case 22:cn=(u=cn)||c.memoizedState!==null,ks(t,s,c),cn=u;break;default:ks(t,s,c)}}function Y0(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ao(t)}catch(c){Tt(s,s.return,c)}}}function J0(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ao(t)}catch(c){Tt(s,s.return,c)}}function A1(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new F0),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new F0),s;default:throw Error(a(435,t.tag))}}function ru(t,s){var c=A1(t);s.forEach(function(u){if(!c.has(u)){c.add(u);var m=H1.bind(null,t,u);u.then(m,m)}})}function Bn(t,s){var c=s.deletions;if(c!==null)for(var u=0;u<c.length;u++){var m=c[u],b=t,E=s,O=E;e:for(;O!==null;){switch(O.tag){case 27:if(ur(O.type)){Bt=O.stateNode,Un=!1;break e}break;case 5:Bt=O.stateNode,Un=!1;break e;case 3:case 4:Bt=O.stateNode.containerInfo,Un=!0;break e}O=O.return}if(Bt===null)throw Error(a(160));W0(b,E,m),Bt=null,Un=!1,b=m.alternate,b!==null&&(b.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)X0(s,t),s=s.sibling}var $a=null;function X0(t,s){var c=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Bn(s,t),qn(t),u&4&&(sr(3,t,t.return),Ml(3,t),sr(5,t,t.return));break;case 1:Bn(s,t),qn(t),u&512&&(cn||c===null||Xa(c,c.return)),u&64&&js&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(c=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=c===null?u:c.concat(u))));break;case 26:var m=$a;if(Bn(s,t),qn(t),u&512&&(cn||c===null||Xa(c,c.return)),u&4){var b=c!==null?c.memoizedState:null;if(u=t.memoizedState,c===null)if(u===null)if(t.stateNode===null){e:{u=t.type,c=t.memoizedProps,m=m.ownerDocument||m;t:switch(u){case"title":b=m.getElementsByTagName("title")[0],(!b||b[ds]||b[gn]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=m.createElement(u),m.head.insertBefore(b,m.querySelector("head > title"))),jn(b,u,c),b[gn]=t,sn(b),u=b;break e;case"link":var E=Xv("link","href",m).get(u+(c.href||""));if(E){for(var O=0;O<E.length;O++)if(b=E[O],b.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&b.getAttribute("rel")===(c.rel==null?null:c.rel)&&b.getAttribute("title")===(c.title==null?null:c.title)&&b.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(O,1);break t}}b=m.createElement(u),jn(b,u,c),m.head.appendChild(b);break;case"meta":if(E=Xv("meta","content",m).get(u+(c.content||""))){for(O=0;O<E.length;O++)if(b=E[O],b.getAttribute("content")===(c.content==null?null:""+c.content)&&b.getAttribute("name")===(c.name==null?null:c.name)&&b.getAttribute("property")===(c.property==null?null:c.property)&&b.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&b.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(O,1);break t}}b=m.createElement(u),jn(b,u,c),m.head.appendChild(b);break;default:throw Error(a(468,u))}b[gn]=t,sn(b),u=b}t.stateNode=u}else Qv(m,t.type,t.stateNode);else t.stateNode=Jv(m,u,t.memoizedProps);else b!==u?(b===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):b.count--,u===null?Qv(m,t.type,t.stateNode):Jv(m,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Bf(t,t.memoizedProps,c.memoizedProps)}break;case 27:Bn(s,t),qn(t),u&512&&(cn||c===null||Xa(c,c.return)),c!==null&&u&4&&Bf(t,t.memoizedProps,c.memoizedProps);break;case 5:if(Bn(s,t),qn(t),u&512&&(cn||c===null||Xa(c,c.return)),t.flags&32){m=t.stateNode;try{qs(m,"")}catch(Re){Tt(t,t.return,Re)}}u&4&&t.stateNode!=null&&(m=t.memoizedProps,Bf(t,m,c!==null?c.memoizedProps:m)),u&1024&&(Ff=!0);break;case 6:if(Bn(s,t),qn(t),u&4){if(t.stateNode===null)throw Error(a(162));u=t.memoizedProps,c=t.stateNode;try{c.nodeValue=u}catch(Re){Tt(t,t.return,Re)}}break;case 3:if(Su=null,m=$a,$a=bu(s.containerInfo),Bn(s,t),$a=m,qn(t),u&4&&c!==null&&c.memoizedState.isDehydrated)try{ao(s.containerInfo)}catch(Re){Tt(t,t.return,Re)}Ff&&(Ff=!1,Q0(t));break;case 4:u=$a,$a=bu(t.stateNode.containerInfo),Bn(s,t),qn(t),$a=u;break;case 12:Bn(s,t),qn(t);break;case 31:Bn(s,t),qn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ru(t,u)));break;case 13:Bn(s,t),qn(t),t.child.flags&8192&&t.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ou=ot()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ru(t,u)));break;case 22:m=t.memoizedState!==null;var B=c!==null&&c.memoizedState!==null,te=js,ce=cn;if(js=te||m,cn=ce||B,Bn(s,t),cn=ce,js=te,qn(t),u&8192)e:for(s=t.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(c===null||B||js||cn||Yr(t)),c=null,s=t;;){if(s.tag===5||s.tag===26){if(c===null){B=c=s;try{if(b=B.stateNode,m)E=b.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{O=B.stateNode;var ye=B.memoizedProps.style,ae=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;O.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Re){Tt(B,B.return,Re)}}}else if(s.tag===6){if(c===null){B=s;try{B.stateNode.nodeValue=m?"":B.memoizedProps}catch(Re){Tt(B,B.return,Re)}}}else if(s.tag===18){if(c===null){B=s;try{var oe=B.stateNode;m?Uv(oe,!0):Uv(B.stateNode,!1)}catch(Re){Tt(B,B.return,Re)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=t.updateQueue,u!==null&&(c=u.retryQueue,c!==null&&(u.retryQueue=null,ru(t,c))));break;case 19:Bn(s,t),qn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ru(t,u)));break;case 30:break;case 21:break;default:Bn(s,t),qn(t)}}function qn(t){var s=t.flags;if(s&2){try{for(var c,u=t.return;u!==null;){if(q0(u)){c=u;break}u=u.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var m=c.stateNode,b=qf(t);su(t,b,m);break;case 5:var E=c.stateNode;c.flags&32&&(qs(E,""),c.flags&=-33);var O=qf(t);su(t,O,E);break;case 3:case 4:var B=c.stateNode.containerInfo,te=qf(t);Gf(t,te,B);break;default:throw Error(a(161))}}catch(ce){Tt(t,t.return,ce)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Q0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Q0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function Ns(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)V0(t,s.alternate,s),s=s.sibling}function Yr(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:sr(4,s,s.return),Yr(s);break;case 1:Xa(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&U0(s,s.return,c),Yr(s);break;case 27:Fl(s.stateNode);case 26:case 5:Xa(s,s.return),Yr(s);break;case 22:s.memoizedState===null&&Yr(s);break;case 30:Yr(s);break;default:Yr(s)}t=t.sibling}}function Es(t,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,m=t,b=s,E=b.flags;switch(b.tag){case 0:case 11:case 15:Es(m,b,c),Ml(4,b);break;case 1:if(Es(m,b,c),u=b,m=u.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){Tt(u,u.return,te)}if(u=b,m=u.updateQueue,m!==null){var O=u.stateNode;try{var B=m.shared.hiddenCallbacks;if(B!==null)for(m.shared.hiddenCallbacks=null,m=0;m<B.length;m++)Tb(B[m],O)}catch(te){Tt(u,u.return,te)}}c&&E&64&&P0(b),$l(b,b.return);break;case 27:G0(b);case 26:case 5:Es(m,b,c),c&&u===null&&E&4&&B0(b),$l(b,b.return);break;case 12:Es(m,b,c);break;case 31:Es(m,b,c),c&&E&4&&Y0(m,b);break;case 13:Es(m,b,c),c&&E&4&&J0(m,b);break;case 22:b.memoizedState===null&&Es(m,b,c),$l(b,b.return);break;case 30:break;default:Es(m,b,c)}s=s.sibling}}function Vf(t,s){var c=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(c=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==c&&(t!=null&&t.refCount++,c!=null&&wl(c))}function Kf(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&wl(t))}function Ia(t,s,c,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Z0(t,s,c,u),s=s.sibling}function Z0(t,s,c,u){var m=s.flags;switch(s.tag){case 0:case 11:case 15:Ia(t,s,c,u),m&2048&&Ml(9,s);break;case 1:Ia(t,s,c,u);break;case 3:Ia(t,s,c,u),m&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&wl(t)));break;case 12:if(m&2048){Ia(t,s,c,u),t=s.stateNode;try{var b=s.memoizedProps,E=b.id,O=b.onPostCommit;typeof O=="function"&&O(E,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(B){Tt(s,s.return,B)}}else Ia(t,s,c,u);break;case 31:Ia(t,s,c,u);break;case 13:Ia(t,s,c,u);break;case 23:break;case 22:b=s.stateNode,E=s.alternate,s.memoizedState!==null?b._visibility&2?Ia(t,s,c,u):Il(t,s):b._visibility&2?Ia(t,s,c,u):(b._visibility|=2,Vi(t,s,c,u,(s.subtreeFlags&10256)!==0||!1)),m&2048&&Vf(E,s);break;case 24:Ia(t,s,c,u),m&2048&&Kf(s.alternate,s);break;default:Ia(t,s,c,u)}}function Vi(t,s,c,u,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var b=t,E=s,O=c,B=u,te=E.flags;switch(E.tag){case 0:case 11:case 15:Vi(b,E,O,B,m),Ml(8,E);break;case 23:break;case 22:var ce=E.stateNode;E.memoizedState!==null?ce._visibility&2?Vi(b,E,O,B,m):Il(b,E):(ce._visibility|=2,Vi(b,E,O,B,m)),m&&te&2048&&Vf(E.alternate,E);break;case 24:Vi(b,E,O,B,m),m&&te&2048&&Kf(E.alternate,E);break;default:Vi(b,E,O,B,m)}s=s.sibling}}function Il(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=t,u=s,m=u.flags;switch(u.tag){case 22:Il(c,u),m&2048&&Vf(u.alternate,u);break;case 24:Il(c,u),m&2048&&Kf(u.alternate,u);break;default:Il(c,u)}s=s.sibling}}var zl=8192;function Ki(t,s,c){if(t.subtreeFlags&zl)for(t=t.child;t!==null;)ev(t,s,c),t=t.sibling}function ev(t,s,c){switch(t.tag){case 26:Ki(t,s,c),t.flags&zl&&t.memoizedState!==null&&m_(c,$a,t.memoizedState,t.memoizedProps);break;case 5:Ki(t,s,c);break;case 3:case 4:var u=$a;$a=bu(t.stateNode.containerInfo),Ki(t,s,c),$a=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=zl,zl=16777216,Ki(t,s,c),zl=u):Ki(t,s,c));break;default:Ki(t,s,c)}}function tv(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Hl(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var u=s[c];xn=u,av(u,t)}tv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)nv(t),t=t.sibling}function nv(t){switch(t.tag){case 0:case 11:case 15:Hl(t),t.flags&2048&&sr(9,t,t.return);break;case 3:Hl(t);break;case 12:Hl(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,iu(t)):Hl(t);break;default:Hl(t)}}function iu(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var u=s[c];xn=u,av(u,t)}tv(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:sr(8,s,s.return),iu(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,iu(s));break;default:iu(s)}t=t.sibling}}function av(t,s){for(;xn!==null;){var c=xn;switch(c.tag){case 0:case 11:case 15:sr(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var u=c.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:wl(c.memoizedState.cache)}if(u=c.child,u!==null)u.return=c,xn=u;else e:for(c=t;xn!==null;){u=xn;var m=u.sibling,b=u.return;if(K0(u),u===c){xn=null;break e}if(m!==null){m.return=b,xn=m;break e}xn=b}}}var D1={getCacheForType:function(t){var s=wn(rn),c=s.data.get(t);return c===void 0&&(c=t(),s.data.set(t,c)),c},cacheSignal:function(){return wn(rn).controller.signal}},R1=typeof WeakMap=="function"?WeakMap:Map,jt=0,Mt=null,lt=null,ut=0,_t=0,ta=null,rr=!1,Wi=!1,Wf=!1,_s=0,Jt=0,ir=0,Jr=0,Yf=0,na=0,Yi=0,Pl=null,Gn=null,Jf=!1,ou=0,sv=0,lu=1/0,cu=null,or=null,fn=0,lr=null,Ji=null,Ts=0,Xf=0,Qf=null,rv=null,Ul=0,Zf=null;function aa(){return(jt&2)!==0&&ut!==0?ut&-ut:J.T!==null?rp():Jn()}function iv(){if(na===0)if((ut&536870912)===0||mt){var t=st;st<<=1,(st&3932160)===0&&(st=262144),na=t}else na=536870912;return t=Zn.current,t!==null&&(t.flags|=32),na}function Fn(t,s,c){(t===Mt&&(_t===2||_t===9)||t.cancelPendingCommit!==null)&&(Xi(t,0),cr(t,ut,na,!1)),Kt(t,c),((jt&2)===0||t!==Mt)&&(t===Mt&&((jt&2)===0&&(Jr|=c),Jt===4&&cr(t,ut,na,!1)),Qa(t))}function ov(t,s,c){if((jt&6)!==0)throw Error(a(327));var u=!c&&(s&127)===0&&(s&t.expiredLanes)===0||De(t,s),m=u?M1(t,s):tp(t,s,!0),b=u;do{if(m===0){Wi&&!u&&cr(t,s,0,!1);break}else{if(c=t.current.alternate,b&&!O1(c)){m=tp(t,s,!1),b=!1;continue}if(m===2){if(b=s,t.errorRecoveryDisabledLanes&b)var E=0;else E=t.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){s=E;e:{var O=t;m=Pl;var B=O.current.memoizedState.isDehydrated;if(B&&(Xi(O,E).flags|=256),E=tp(O,E,!1),E!==2){if(Wf&&!B){O.errorRecoveryDisabledLanes|=b,Jr|=b,m=4;break e}b=Gn,Gn=m,b!==null&&(Gn===null?Gn=b:Gn.push.apply(Gn,b))}m=E}if(b=!1,m!==2)continue}}if(m===1){Xi(t,0),cr(t,s,0,!0);break}e:{switch(u=t,b=m,b){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:cr(u,s,na,!rr);break e;case 2:Gn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(m=ou+300-ot(),10<m)){if(cr(u,s,na,!rr),Ye(u,0,!0)!==0)break e;Ts=s,u.timeoutHandle=zv(lv.bind(null,u,c,Gn,cu,Jf,s,na,Jr,Yi,rr,b,"Throttled",-0,0),m);break e}lv(u,c,Gn,cu,Jf,s,na,Jr,Yi,rr,b,null,-0,0)}}break}while(!0);Qa(t)}function lv(t,s,c,u,m,b,E,O,B,te,ce,ye,ae,oe){if(t.timeoutHandle=-1,ye=s.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:la},ev(s,b,ye);var Re=(b&62914560)===b?ou-ot():(b&4194048)===b?sv-ot():0;if(Re=y_(ye,Re),Re!==null){Ts=b,t.cancelPendingCommit=Re(mv.bind(null,t,s,b,c,u,m,E,O,B,ce,ye,null,ae,oe)),cr(t,b,E,!te);return}}mv(t,s,b,c,u,m,E,O,B)}function O1(t){for(var s=t;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var u=0;u<c.length;u++){var m=c[u],b=m.getSnapshot;m=m.value;try{if(!Xn(b(),m))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function cr(t,s,c,u){s&=~Yf,s&=~Jr,t.suspendedLanes|=s,t.pingedLanes&=~s,u&&(t.warmLanes|=s),u=t.expirationTimes;for(var m=s;0<m;){var b=31-Ne(m),E=1<<b;u[b]=-1,m&=~E}c!==0&&qt(t,c,s)}function du(){return(jt&6)===0?(Bl(0),!1):!0}function ep(){if(lt!==null){if(_t===0)var t=lt.return;else t=lt,xs=Ur=null,mf(t),Ui=null,jl=0,t=lt;for(;t!==null;)H0(t.alternate,t),t=t.return;lt=null}}function Xi(t,s){var c=t.timeoutHandle;c!==-1&&(t.timeoutHandle=-1,Z1(c)),c=t.cancelPendingCommit,c!==null&&(t.cancelPendingCommit=null,c()),Ts=0,ep(),Mt=t,lt=c=ms(t.current,null),ut=s,_t=0,ta=null,rr=!1,Wi=De(t,s),Wf=!1,Yi=na=Yf=Jr=ir=Jt=0,Gn=Pl=null,Jf=!1,(s&8)!==0&&(s|=s&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=s;0<u;){var m=31-Ne(u),b=1<<m;s|=t[m],u&=~b}return _s=s,Dd(),c}function cv(t,s){nt=null,J.H=Rl,s===Pi||s===Hd?(s=kb(),_t=3):s===af?(s=kb(),_t=4):_t=s===Rf?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ta=s,lt===null&&(Jt=1,Zd(t,da(s,t.current)))}function dv(){var t=Zn.current;return t===null?!0:(ut&4194048)===ut?fa===null:(ut&62914560)===ut||(ut&536870912)!==0?t===fa:!1}function uv(){var t=J.H;return J.H=Rl,t===null?Rl:t}function gv(){var t=J.A;return J.A=D1,t}function uu(){Jt=4,rr||(ut&4194048)!==ut&&Zn.current!==null||(Wi=!0),(ir&134217727)===0&&(Jr&134217727)===0||Mt===null||cr(Mt,ut,na,!1)}function tp(t,s,c){var u=jt;jt|=2;var m=uv(),b=gv();(Mt!==t||ut!==s)&&(cu=null,Xi(t,s)),s=!1;var E=Jt;e:do try{if(_t!==0&&lt!==null){var O=lt,B=ta;switch(_t){case 8:ep(),E=6;break e;case 3:case 2:case 9:case 6:Zn.current===null&&(s=!0);var te=_t;if(_t=0,ta=null,Qi(t,O,B,te),c&&Wi){E=0;break e}break;default:te=_t,_t=0,ta=null,Qi(t,O,B,te)}}L1(),E=Jt;break}catch(ce){cv(t,ce)}while(!0);return s&&t.shellSuspendCounter++,xs=Ur=null,jt=u,J.H=m,J.A=b,lt===null&&(Mt=null,ut=0,Dd()),E}function L1(){for(;lt!==null;)hv(lt)}function M1(t,s){var c=jt;jt|=2;var u=uv(),m=gv();Mt!==t||ut!==s?(cu=null,lu=ot()+500,Xi(t,s)):Wi=De(t,s);e:do try{if(_t!==0&&lt!==null){s=lt;var b=ta;t:switch(_t){case 1:_t=0,ta=null,Qi(t,s,b,1);break;case 2:case 9:if(Cb(b)){_t=0,ta=null,fv(s);break}s=function(){_t!==2&&_t!==9||Mt!==t||(_t=7),Qa(t)},b.then(s,s);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:Cb(b)?(_t=0,ta=null,fv(s)):(_t=0,ta=null,Qi(t,s,b,7));break;case 5:var E=null;switch(lt.tag){case 26:E=lt.memoizedState;case 5:case 27:var O=lt;if(E?Zv(E):O.stateNode.complete){_t=0,ta=null;var B=O.sibling;if(B!==null)lt=B;else{var te=O.return;te!==null?(lt=te,gu(te)):lt=null}break t}}_t=0,ta=null,Qi(t,s,b,5);break;case 6:_t=0,ta=null,Qi(t,s,b,6);break;case 8:ep(),Jt=6;break e;default:throw Error(a(462))}}$1();break}catch(ce){cv(t,ce)}while(!0);return xs=Ur=null,J.H=u,J.A=m,jt=c,lt!==null?0:(Mt=null,ut=0,Dd(),Jt)}function $1(){for(;lt!==null&&!bt();)hv(lt)}function hv(t){var s=I0(t.alternate,t,_s);t.memoizedProps=t.pendingProps,s===null?gu(t):lt=s}function fv(t){var s=t,c=s.alternate;switch(s.tag){case 15:case 0:s=D0(c,s,s.pendingProps,s.type,void 0,ut);break;case 11:s=D0(c,s,s.pendingProps,s.type.render,s.ref,ut);break;case 5:mf(s);default:H0(c,s),s=lt=gb(s,_s),s=I0(c,s,_s)}t.memoizedProps=t.pendingProps,s===null?gu(t):lt=s}function Qi(t,s,c,u){xs=Ur=null,mf(s),Ui=null,jl=0;var m=s.return;try{if(j1(t,m,s,c,ut)){Jt=1,Zd(t,da(c,t.current)),lt=null;return}}catch(b){if(m!==null)throw lt=m,b;Jt=1,Zd(t,da(c,t.current)),lt=null;return}s.flags&32768?(mt||u===1?t=!0:Wi||(ut&536870912)!==0?t=!1:(rr=t=!0,(u===2||u===9||u===3||u===6)&&(u=Zn.current,u!==null&&u.tag===13&&(u.flags|=16384))),pv(s,t)):gu(s)}function gu(t){var s=t;do{if((s.flags&32768)!==0){pv(s,rr);return}t=s.return;var c=E1(s.alternate,s,_s);if(c!==null){lt=c;return}if(s=s.sibling,s!==null){lt=s;return}lt=s=t}while(s!==null);Jt===0&&(Jt=5)}function pv(t,s){do{var c=_1(t.alternate,t);if(c!==null){c.flags&=32767,lt=c;return}if(c=t.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(t=t.sibling,t!==null)){lt=t;return}lt=t=c}while(t!==null);Jt=6,lt=null}function mv(t,s,c,u,m,b,E,O,B){t.cancelPendingCommit=null;do hu();while(fn!==0);if((jt&6)!==0)throw Error(a(327));if(s!==null){if(s===t.current)throw Error(a(177));if(b=s.lanes|s.childLanes,b|=Bh,Ut(t,c,b,E,O,B),t===Mt&&(lt=Mt=null,ut=0),Ji=s,lr=t,Ts=c,Xf=b,Qf=m,rv=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,P1(It,function(){return Sv(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=J.T,J.T=null,m=F.p,F.p=2,E=jt,jt|=4;try{T1(t,s,c)}finally{jt=E,F.p=m,J.T=u}}fn=1,yv(),xv(),bv()}}function yv(){if(fn===1){fn=0;var t=lr,s=Ji,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=J.T,J.T=null;var u=F.p;F.p=2;var m=jt;jt|=4;try{X0(s,t);var b=hp,E=ab(t.containerInfo),O=b.focusedElem,B=b.selectionRange;if(E!==O&&O&&O.ownerDocument&&nb(O.ownerDocument.documentElement,O)){if(B!==null&&Ih(O)){var te=B.start,ce=B.end;if(ce===void 0&&(ce=te),"selectionStart"in O)O.selectionStart=te,O.selectionEnd=Math.min(ce,O.value.length);else{var ye=O.ownerDocument||document,ae=ye&&ye.defaultView||window;if(ae.getSelection){var oe=ae.getSelection(),Re=O.textContent.length,Ke=Math.min(B.start,Re),Ot=B.end===void 0?Ke:Math.min(B.end,Re);!oe.extend&&Ke>Ot&&(E=Ot,Ot=Ke,Ke=E);var Z=tb(O,Ke),K=tb(O,Ot);if(Z&&K&&(oe.rangeCount!==1||oe.anchorNode!==Z.node||oe.anchorOffset!==Z.offset||oe.focusNode!==K.node||oe.focusOffset!==K.offset)){var ee=ye.createRange();ee.setStart(Z.node,Z.offset),oe.removeAllRanges(),Ke>Ot?(oe.addRange(ee),oe.extend(K.node,K.offset)):(ee.setEnd(K.node,K.offset),oe.addRange(ee))}}}}for(ye=[],oe=O;oe=oe.parentNode;)oe.nodeType===1&&ye.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ye.length;O++){var fe=ye[O];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}ku=!!gp,hp=gp=null}finally{jt=m,F.p=u,J.T=c}}t.current=s,fn=2}}function xv(){if(fn===2){fn=0;var t=lr,s=Ji,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=J.T,J.T=null;var u=F.p;F.p=2;var m=jt;jt|=4;try{V0(t,s.alternate,s)}finally{jt=m,F.p=u,J.T=c}}fn=3}}function bv(){if(fn===4||fn===3){fn=0,Ct();var t=lr,s=Ji,c=Ts,u=rv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?fn=5:(fn=0,Ji=lr=null,vv(t,t.pendingLanes));var m=t.pendingLanes;if(m===0&&(or=null),Aa(c),s=s.stateNode,ne&&typeof ne.onCommitFiberRoot=="function")try{ne.onCommitFiberRoot(me,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=J.T,m=F.p,F.p=2,J.T=null;try{for(var b=t.onRecoverableError,E=0;E<u.length;E++){var O=u[E];b(O.value,{componentStack:O.stack})}}finally{J.T=s,F.p=m}}(Ts&3)!==0&&hu(),Qa(t),m=t.pendingLanes,(c&261930)!==0&&(m&42)!==0?t===Zf?Ul++:(Ul=0,Zf=t):Ul=0,Bl(0)}}function vv(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,wl(s)))}function hu(){return yv(),xv(),bv(),Sv()}function Sv(){if(fn!==5)return!1;var t=lr,s=Xf;Xf=0;var c=Aa(Ts),u=J.T,m=F.p;try{F.p=32>c?32:c,J.T=null,c=Qf,Qf=null;var b=lr,E=Ts;if(fn=0,Ji=lr=null,Ts=0,(jt&6)!==0)throw Error(a(331));var O=jt;if(jt|=4,nv(b.current),Z0(b,b.current,E,c),jt=O,Bl(0,!1),ne&&typeof ne.onPostCommitFiberRoot=="function")try{ne.onPostCommitFiberRoot(me,b)}catch{}return!0}finally{F.p=m,J.T=u,vv(t,s)}}function wv(t,s,c){s=da(c,s),s=Df(t.stateNode,s,2),t=tr(t,s,2),t!==null&&(Kt(t,2),Qa(t))}function Tt(t,s,c){if(t.tag===3)wv(t,t,c);else for(;s!==null;){if(s.tag===3){wv(s,t,c);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(or===null||!or.has(u))){t=da(c,t),c=C0(2),u=tr(s,c,2),u!==null&&(j0(c,u,s,t),Kt(u,2),Qa(u));break}}s=s.return}}function np(t,s,c){var u=t.pingCache;if(u===null){u=t.pingCache=new R1;var m=new Set;u.set(s,m)}else m=u.get(s),m===void 0&&(m=new Set,u.set(s,m));m.has(c)||(Wf=!0,m.add(c),t=I1.bind(null,t,s,c),s.then(t,t))}function I1(t,s,c){var u=t.pingCache;u!==null&&u.delete(s),t.pingedLanes|=t.suspendedLanes&c,t.warmLanes&=~c,Mt===t&&(ut&c)===c&&(Jt===4||Jt===3&&(ut&62914560)===ut&&300>ot()-ou?(jt&2)===0&&Xi(t,0):Yf|=c,Yi===ut&&(Yi=0)),Qa(t)}function Cv(t,s){s===0&&(s=Ue()),t=zr(t,s),t!==null&&(Kt(t,s),Qa(t))}function z1(t){var s=t.memoizedState,c=0;s!==null&&(c=s.retryLane),Cv(t,c)}function H1(t,s){var c=0;switch(t.tag){case 31:case 13:var u=t.stateNode,m=t.memoizedState;m!==null&&(c=m.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(a(314))}u!==null&&u.delete(s),Cv(t,c)}function P1(t,s){return it(t,s)}var fu=null,Zi=null,ap=!1,pu=!1,sp=!1,dr=0;function Qa(t){t!==Zi&&t.next===null&&(Zi===null?fu=Zi=t:Zi=Zi.next=t),pu=!0,ap||(ap=!0,B1())}function Bl(t,s){if(!sp&&pu){sp=!0;do for(var c=!1,u=fu;u!==null;){if(t!==0){var m=u.pendingLanes;if(m===0)var b=0;else{var E=u.suspendedLanes,O=u.pingedLanes;b=(1<<31-Ne(42|t)+1)-1,b&=m&~(E&~O),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,Ev(u,b))}else b=ut,b=Ye(u,u===Mt?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(b&3)===0||De(u,b)||(c=!0,Ev(u,b));u=u.next}while(c);sp=!1}}function U1(){jv()}function jv(){pu=ap=!1;var t=0;dr!==0&&Q1()&&(t=dr);for(var s=ot(),c=null,u=fu;u!==null;){var m=u.next,b=kv(u,s);b===0?(u.next=null,c===null?fu=m:c.next=m,m===null&&(Zi=c)):(c=u,(t!==0||(b&3)!==0)&&(pu=!0)),u=m}fn!==0&&fn!==5||Bl(t),dr!==0&&(dr=0)}function kv(t,s){for(var c=t.suspendedLanes,u=t.pingedLanes,m=t.expirationTimes,b=t.pendingLanes&-62914561;0<b;){var E=31-Ne(b),O=1<<E,B=m[E];B===-1?((O&c)===0||(O&u)!==0)&&(m[E]=Le(O,s)):B<=s&&(t.expiredLanes|=O),b&=~O}if(s=Mt,c=ut,c=Ye(t,t===s?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,c===0||t===s&&(_t===2||_t===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&ft(u),t.callbackNode=null,t.callbackPriority=0;if((c&3)===0||De(t,c)){if(s=c&-c,s===t.callbackPriority)return s;switch(u!==null&&ft(u),Aa(c)){case 2:case 8:c=Nt;break;case 32:c=It;break;case 268435456:c=_a;break;default:c=It}return u=Nv.bind(null,t),c=it(c,u),t.callbackPriority=s,t.callbackNode=c,s}return u!==null&&u!==null&&ft(u),t.callbackPriority=2,t.callbackNode=null,2}function Nv(t,s){if(fn!==0&&fn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var c=t.callbackNode;if(hu()&&t.callbackNode!==c)return null;var u=ut;return u=Ye(t,t===Mt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(ov(t,u,s),kv(t,ot()),t.callbackNode!=null&&t.callbackNode===c?Nv.bind(null,t):null)}function Ev(t,s){if(hu())return null;ov(t,s,!0)}function B1(){e_(function(){(jt&6)!==0?it(nn,U1):jv()})}function rp(){if(dr===0){var t=zi;t===0&&(t=Ae,Ae<<=1,(Ae&261888)===0&&(Ae=256)),dr=t}return dr}function _v(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ji(""+t)}function Tv(t,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,t.id&&c.setAttribute("form",t.id),s.parentNode.insertBefore(c,s),t=new FormData(t),c.parentNode.removeChild(c),t}function q1(t,s,c,u,m){if(s==="submit"&&c&&c.stateNode===m){var b=_v((m[vn]||null).action),E=u.submitter;E&&(s=(s=E[vn]||null)?_v(s.formAction):E.getAttribute("formAction"),s!==null&&(b=s,E=null));var O=new Ei("action","action",null,u,m);t.push({event:O,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(dr!==0){var B=E?Tv(m,E):new FormData(m);kf(c,{pending:!0,data:B,method:m.method,action:b},null,B)}}else typeof b=="function"&&(O.preventDefault(),B=E?Tv(m,E):new FormData(m),kf(c,{pending:!0,data:B,method:m.method,action:b},b,B))},currentTarget:m}]})}}for(var ip=0;ip<Uh.length;ip++){var op=Uh[ip],G1=op.toLowerCase(),F1=op[0].toUpperCase()+op.slice(1);Ma(G1,"on"+F1)}Ma(ib,"onAnimationEnd"),Ma(ob,"onAnimationIteration"),Ma(lb,"onAnimationStart"),Ma("dblclick","onDoubleClick"),Ma("focusin","onFocus"),Ma("focusout","onBlur"),Ma(o1,"onTransitionRun"),Ma(l1,"onTransitionStart"),Ma(c1,"onTransitionCancel"),Ma(cb,"onTransitionEnd"),Us("onMouseEnter",["mouseout","mouseover"]),Us("onMouseLeave",["mouseout","mouseover"]),Us("onPointerEnter",["pointerout","pointerover"]),Us("onPointerLeave",["pointerout","pointerover"]),us("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),us("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),us("onBeforeInput",["compositionend","keypress","textInput","paste"]),us("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),us("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),us("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ql="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(" "),V1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ql));function Av(t,s){s=(s&4)!==0;for(var c=0;c<t.length;c++){var u=t[c],m=u.event;u=u.listeners;e:{var b=void 0;if(s)for(var E=u.length-1;0<=E;E--){var O=u[E],B=O.instance,te=O.currentTarget;if(O=O.listener,B!==b&&m.isPropagationStopped())break e;b=O,m.currentTarget=te;try{b(m)}catch(ce){Ad(ce)}m.currentTarget=null,b=B}else for(E=0;E<u.length;E++){if(O=u[E],B=O.instance,te=O.currentTarget,O=O.listener,B!==b&&m.isPropagationStopped())break e;b=O,m.currentTarget=te;try{b(m)}catch(ce){Ad(ce)}m.currentTarget=null,b=B}}}}function ct(t,s){var c=s[Ko];c===void 0&&(c=s[Ko]=new Set);var u=t+"__bubble";c.has(u)||(Dv(s,t,2,!1),c.add(u))}function lp(t,s,c){var u=0;s&&(u|=4),Dv(c,t,u,s)}var mu="_reactListening"+Math.random().toString(36).slice(2);function cp(t){if(!t[mu]){t[mu]=!0,fd.forEach(function(c){c!=="selectionchange"&&(V1.has(c)||lp(c,!1,t),lp(c,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[mu]||(s[mu]=!0,lp("selectionchange",!1,s))}}function Dv(t,s,c,u){switch(iS(s)){case 2:var m=v_;break;case 8:m=S_;break;default:m=jp}c=m.bind(null,s,c,t),m=void 0,!al||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),u?m!==void 0?t.addEventListener(s,c,{capture:!0,passive:m}):t.addEventListener(s,c,!0):m!==void 0?t.addEventListener(s,c,{passive:m}):t.addEventListener(s,c,!1)}function dp(t,s,c,u,m){var b=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var E=u.tag;if(E===3||E===4){var O=u.stateNode.containerInfo;if(O===m)break;if(E===4)for(E=u.return;E!==null;){var B=E.tag;if((B===3||B===4)&&E.stateNode.containerInfo===m)return;E=E.return}for(;O!==null;){if(E=Hs(O),E===null)return;if(B=E.tag,B===5||B===6||B===26||B===27){u=b=E;continue e}O=O.parentNode}}u=u.return}vd(function(){var te=b,ce=ki(c),ye=[];e:{var ae=db.get(t);if(ae!==void 0){var oe=Ei,Re=t;switch(t){case"keypress":if(Vs(c)===0)break e;case"keydown":case"keyup":oe=hn;break;case"focusin":Re="focus",oe=ol;break;case"focusout":Re="blur",oe=ol;break;case"beforeblur":case"afterblur":oe=ol;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=wd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=Ch;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=S;break;case ib:case ob:case lb:oe=Nh;break;case cb:oe=I;break;case"scroll":case"scrollend":oe=wh;break;case"wheel":oe=ue;break;case"copy":case"cut":case"paste":oe=_h;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=jd;break;case"toggle":case"beforetoggle":oe=Ie}var Ke=(s&4)!==0,Ot=!Ke&&(t==="scroll"||t==="scrollend"),Z=Ke?ae!==null?ae+"Capture":null:ae;Ke=[];for(var K=te,ee;K!==null;){var fe=K;if(ee=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ee===null||Z===null||(fe=Dr(K,Z),fe!=null&&Ke.push(Gl(K,fe,ee))),Ot)break;K=K.return}0<Ke.length&&(ae=new oe(ae,Re,null,c,ce),ye.push({event:ae,listeners:Ke}))}}if((s&7)===0){e:{if(ae=t==="mouseover"||t==="pointerover",oe=t==="mouseout"||t==="pointerout",ae&&c!==tl&&(Re=c.relatedTarget||c.fromElement)&&(Hs(Re)||Re[zn]))break e;if((oe||ae)&&(ae=ce.window===ce?ce:(ae=ce.ownerDocument)?ae.defaultView||ae.parentWindow:window,oe?(Re=c.relatedTarget||c.toElement,oe=te,Re=Re?Hs(Re):null,Re!==null&&(Ot=o(Re),Ke=Re.tag,Re!==Ot||Ke!==5&&Ke!==27&&Ke!==6)&&(Re=null)):(oe=null,Re=te),oe!==Re)){if(Ke=wd,fe="onMouseLeave",Z="onMouseEnter",K="mouse",(t==="pointerout"||t==="pointerover")&&(Ke=jd,fe="onPointerLeave",Z="onPointerEnter",K="pointer"),Ot=oe==null?ae:Tr(oe),ee=Re==null?ae:Tr(Re),ae=new Ke(fe,K+"leave",oe,c,ce),ae.target=Ot,ae.relatedTarget=ee,fe=null,Hs(ce)===te&&(Ke=new Ke(Z,K+"enter",Re,c,ce),Ke.target=ee,Ke.relatedTarget=Ot,fe=Ke),Ot=fe,oe&&Re)t:{for(Ke=K1,Z=oe,K=Re,ee=0,fe=Z;fe;fe=Ke(fe))ee++;fe=0;for(var Be=K;Be;Be=Ke(Be))fe++;for(;0<ee-fe;)Z=Ke(Z),ee--;for(;0<fe-ee;)K=Ke(K),fe--;for(;ee--;){if(Z===K||K!==null&&Z===K.alternate){Ke=Z;break t}Z=Ke(Z),K=Ke(K)}Ke=null}else Ke=null;oe!==null&&Rv(ye,ae,oe,Ke,!1),Re!==null&&Ot!==null&&Rv(ye,Ot,Re,Ke,!0)}}e:{if(ae=te?Tr(te):window,oe=ae.nodeName&&ae.nodeName.toLowerCase(),oe==="select"||oe==="input"&&ae.type==="file")var St=_d;else if(gl(ae))if(Td)St=s1;else{St=n1;var ze=t1}else oe=ae.nodeName,!oe||oe.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?te&&el(te.elementType)&&(St=_d):St=a1;if(St&&(St=St(t,te))){hl(ye,St,c,ce);break e}ze&&ze(t,ae,te),t==="focusout"&&te&&ae.type==="number"&&te.memoizedProps.value!=null&&Zo(ae,"number",ae.value)}switch(ze=te?Tr(te):window,t){case"focusin":(gl(ze)||ze.contentEditable==="true")&&(Ai=ze,zh=te,bl=null);break;case"focusout":bl=zh=Ai=null;break;case"mousedown":Hh=!0;break;case"contextmenu":case"mouseup":case"dragend":Hh=!1,sb(ye,c,ce);break;case"selectionchange":if(i1)break;case"keydown":case"keyup":sb(ye,c,ce)}var rt;if(dt)e:{switch(t){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else Ks?Nd(t,c)&&(gt="onCompositionEnd"):t==="keydown"&&c.keyCode===229&&(gt="onCompositionStart");gt&&(Lr&&c.locale!=="ko"&&(Ks||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&Ks&&(rt=Je()):(La=ce,sl="value"in La?La.value:La.textContent,Ks=!0)),ze=yu(te,gt),0<ze.length&&(gt=new Cd(gt,t,null,c,ce),ye.push({event:gt,listeners:ze}),rt?gt.data=rt:(rt=ul(c),rt!==null&&(gt.data=rt)))),(rt=Wt?Ed(t,c):Mh(t,c))&&(gt=yu(te,"onBeforeInput"),0<gt.length&&(ze=new Cd("onBeforeInput","beforeinput",null,c,ce),ye.push({event:ze,listeners:gt}),ze.data=rt)),q1(ye,t,te,c,ce)}Av(ye,s)})}function Gl(t,s,c){return{instance:t,listener:s,currentTarget:c}}function yu(t,s){for(var c=s+"Capture",u=[];t!==null;){var m=t,b=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||b===null||(m=Dr(t,c),m!=null&&u.unshift(Gl(t,m,b)),m=Dr(t,s),m!=null&&u.push(Gl(t,m,b))),t.tag===3)return u;t=t.return}return[]}function K1(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Rv(t,s,c,u,m){for(var b=s._reactName,E=[];c!==null&&c!==u;){var O=c,B=O.alternate,te=O.stateNode;if(O=O.tag,B!==null&&B===u)break;O!==5&&O!==26&&O!==27||te===null||(B=te,m?(te=Dr(c,b),te!=null&&E.unshift(Gl(c,te,B))):m||(te=Dr(c,b),te!=null&&E.push(Gl(c,te,B)))),c=c.return}E.length!==0&&t.push({event:s,listeners:E})}var W1=/\r\n?/g,Y1=/\u0000|\uFFFD/g;function Ov(t){return(typeof t=="string"?t:""+t).replace(W1,`
`).replace(Y1,"")}function Lv(t,s){return s=Ov(s),Ov(t)===s}function Rt(t,s,c,u,m,b){switch(c){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||qs(t,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&qs(t,""+u);break;case"className":Si(t,"class",u);break;case"tabIndex":Si(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Si(t,c,u);break;case"style":Ka(t,u,b);break;case"data":if(s!=="object"){Si(t,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||c!=="href")){t.removeAttribute(c);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(c);break}u=ji(""+u),t.setAttribute(c,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(c,"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 b=="function"&&(c==="formAction"?(s!=="input"&&Rt(t,s,"name",m.name,m,null),Rt(t,s,"formEncType",m.formEncType,m,null),Rt(t,s,"formMethod",m.formMethod,m,null),Rt(t,s,"formTarget",m.formTarget,m,null)):(Rt(t,s,"encType",m.encType,m,null),Rt(t,s,"method",m.method,m,null),Rt(t,s,"target",m.target,m,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(c);break}u=ji(""+u),t.setAttribute(c,u);break;case"onClick":u!=null&&(t.onclick=la);break;case"onScroll":u!=null&&ct("scroll",t);break;case"onScrollEnd":u!=null&&ct("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(c=u.__html,c!=null){if(m.children!=null)throw Error(a(60));t.innerHTML=c}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}c=ji(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(c,""+u):t.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(c,""):t.removeAttribute(c);break;case"capture":case"download":u===!0?t.setAttribute(c,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(c,u):t.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(c,u):t.removeAttribute(c);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(c):t.setAttribute(c,u);break;case"popover":ct("beforetoggle",t),ct("toggle",t),vi(t,"popover",u);break;case"xlinkActuate":Ra(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Ra(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Ra(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Ra(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Ra(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Ra(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":vi(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=vh.get(c)||c,vi(t,c,u))}}function up(t,s,c,u,m,b){switch(c){case"style":Ka(t,u,b);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(c=u.__html,c!=null){if(m.children!=null)throw Error(a(60));t.innerHTML=c}}break;case"children":typeof u=="string"?qs(t,u):(typeof u=="number"||typeof u=="bigint")&&qs(t,""+u);break;case"onScroll":u!=null&&ct("scroll",t);break;case"onScrollEnd":u!=null&&ct("scrollend",t);break;case"onClick":u!=null&&(t.onclick=la);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pd.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),s=c.slice(2,m?c.length-7:void 0),b=t[vn]||null,b=b!=null?b[c]:null,typeof b=="function"&&t.removeEventListener(s,b,m),typeof u=="function")){typeof b!="function"&&b!==null&&(c in t?t[c]=null:t.hasAttribute(c)&&t.removeAttribute(c)),t.addEventListener(s,u,m);break e}c in t?t[c]=u:u===!0?t.setAttribute(c,""):vi(t,c,u)}}}function jn(t,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",t),ct("load",t);var u=!1,m=!1,b;for(b in c)if(c.hasOwnProperty(b)){var E=c[b];if(E!=null)switch(b){case"src":u=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Rt(t,s,b,E,c,null)}}m&&Rt(t,s,"srcSet",c.srcSet,c,null),u&&Rt(t,s,"src",c.src,c,null);return;case"input":ct("invalid",t);var O=b=E=m=null,B=null,te=null;for(u in c)if(c.hasOwnProperty(u)){var ce=c[u];if(ce!=null)switch(u){case"name":m=ce;break;case"type":E=ce;break;case"checked":B=ce;break;case"defaultChecked":te=ce;break;case"value":b=ce;break;case"defaultValue":O=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,s));break;default:Rt(t,s,u,ce,c,null)}}md(t,b,O,B,te,E,m,!1);return;case"select":ct("invalid",t),u=E=b=null;for(m in c)if(c.hasOwnProperty(m)&&(O=c[m],O!=null))switch(m){case"value":b=O;break;case"defaultValue":E=O;break;case"multiple":u=O;default:Rt(t,s,m,O,c,null)}s=b,c=E,t.multiple=!!u,s!=null?Bs(t,!!u,s,!1):c!=null&&Bs(t,!!u,c,!0);return;case"textarea":ct("invalid",t),b=m=u=null;for(E in c)if(c.hasOwnProperty(E)&&(O=c[E],O!=null))switch(E){case"value":u=O;break;case"defaultValue":m=O;break;case"children":b=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(a(91));break;default:Rt(t,s,E,O,c,null)}xd(t,u,m,b);return;case"option":for(B in c)if(c.hasOwnProperty(B)&&(u=c[B],u!=null))switch(B){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Rt(t,s,B,u,c,null)}return;case"dialog":ct("beforetoggle",t),ct("toggle",t),ct("cancel",t),ct("close",t);break;case"iframe":case"object":ct("load",t);break;case"video":case"audio":for(u=0;u<ql.length;u++)ct(ql[u],t);break;case"image":ct("error",t),ct("load",t);break;case"details":ct("toggle",t);break;case"embed":case"source":case"link":ct("error",t),ct("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in c)if(c.hasOwnProperty(te)&&(u=c[te],u!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Rt(t,s,te,u,c,null)}return;default:if(el(s)){for(ce in c)c.hasOwnProperty(ce)&&(u=c[ce],u!==void 0&&up(t,s,ce,u,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(u=c[O],u!=null&&Rt(t,s,O,u,c,null))}function J1(t,s,c,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,b=null,E=null,O=null,B=null,te=null,ce=null;for(oe in c){var ye=c[oe];if(c.hasOwnProperty(oe)&&ye!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":B=ye;default:u.hasOwnProperty(oe)||Rt(t,s,oe,null,u,ye)}}for(var ae in u){var oe=u[ae];if(ye=c[ae],u.hasOwnProperty(ae)&&(oe!=null||ye!=null))switch(ae){case"type":b=oe;break;case"name":m=oe;break;case"checked":te=oe;break;case"defaultChecked":ce=oe;break;case"value":E=oe;break;case"defaultValue":O=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,s));break;default:oe!==ye&&Rt(t,s,ae,oe,u,ye)}}hs(t,E,O,B,te,ce,b,m);return;case"select":oe=E=O=ae=null;for(b in c)if(B=c[b],c.hasOwnProperty(b)&&B!=null)switch(b){case"value":break;case"multiple":oe=B;default:u.hasOwnProperty(b)||Rt(t,s,b,null,u,B)}for(m in u)if(b=u[m],B=c[m],u.hasOwnProperty(m)&&(b!=null||B!=null))switch(m){case"value":ae=b;break;case"defaultValue":O=b;break;case"multiple":E=b;default:b!==B&&Rt(t,s,m,b,u,B)}s=O,c=E,u=oe,ae!=null?Bs(t,!!c,ae,!1):!!u!=!!c&&(s!=null?Bs(t,!!c,s,!0):Bs(t,!!c,c?[]:"",!1));return;case"textarea":oe=ae=null;for(O in c)if(m=c[O],c.hasOwnProperty(O)&&m!=null&&!u.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:Rt(t,s,O,null,u,m)}for(E in u)if(m=u[E],b=c[E],u.hasOwnProperty(E)&&(m!=null||b!=null))switch(E){case"value":ae=m;break;case"defaultValue":oe=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(a(91));break;default:m!==b&&Rt(t,s,E,m,u,b)}yd(t,ae,oe);return;case"option":for(var Re in c)if(ae=c[Re],c.hasOwnProperty(Re)&&ae!=null&&!u.hasOwnProperty(Re))switch(Re){case"selected":t.selected=!1;break;default:Rt(t,s,Re,null,u,ae)}for(B in u)if(ae=u[B],oe=c[B],u.hasOwnProperty(B)&&ae!==oe&&(ae!=null||oe!=null))switch(B){case"selected":t.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:Rt(t,s,B,ae,u,oe)}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 Ke in c)ae=c[Ke],c.hasOwnProperty(Ke)&&ae!=null&&!u.hasOwnProperty(Ke)&&Rt(t,s,Ke,null,u,ae);for(te in u)if(ae=u[te],oe=c[te],u.hasOwnProperty(te)&&ae!==oe&&(ae!=null||oe!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,s));break;default:Rt(t,s,te,ae,u,oe)}return;default:if(el(s)){for(var Ot in c)ae=c[Ot],c.hasOwnProperty(Ot)&&ae!==void 0&&!u.hasOwnProperty(Ot)&&up(t,s,Ot,void 0,u,ae);for(ce in u)ae=u[ce],oe=c[ce],!u.hasOwnProperty(ce)||ae===oe||ae===void 0&&oe===void 0||up(t,s,ce,ae,u,oe);return}}for(var Z in c)ae=c[Z],c.hasOwnProperty(Z)&&ae!=null&&!u.hasOwnProperty(Z)&&Rt(t,s,Z,null,u,ae);for(ye in u)ae=u[ye],oe=c[ye],!u.hasOwnProperty(ye)||ae===oe||ae==null&&oe==null||Rt(t,s,ye,ae,u,oe)}function Mv(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function X1(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,c=performance.getEntriesByType("resource"),u=0;u<c.length;u++){var m=c[u],b=m.transferSize,E=m.initiatorType,O=m.duration;if(b&&O&&Mv(E)){for(E=0,O=m.responseEnd,u+=1;u<c.length;u++){var B=c[u],te=B.startTime;if(te>O)break;var ce=B.transferSize,ye=B.initiatorType;ce&&Mv(ye)&&(B=B.responseEnd,E+=ce*(B<O?1:(O-te)/(B-te)))}if(--u,s+=8*(b+E)/(m.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var gp=null,hp=null;function xu(t){return t.nodeType===9?t:t.ownerDocument}function $v(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Iv(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function fp(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var pp=null;function Q1(){var t=window.event;return t&&t.type==="popstate"?t===pp?!1:(pp=t,!0):(pp=null,!1)}var zv=typeof setTimeout=="function"?setTimeout:void 0,Z1=typeof clearTimeout=="function"?clearTimeout:void 0,Hv=typeof Promise=="function"?Promise:void 0,e_=typeof queueMicrotask=="function"?queueMicrotask:typeof Hv<"u"?function(t){return Hv.resolve(null).then(t).catch(t_)}:zv;function t_(t){setTimeout(function(){throw t})}function ur(t){return t==="head"}function Pv(t,s){var c=s,u=0;do{var m=c.nextSibling;if(t.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(u===0){t.removeChild(m),ao(s);return}u--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")u++;else if(c==="html")Fl(t.ownerDocument.documentElement);else if(c==="head"){c=t.ownerDocument.head,Fl(c);for(var b=c.firstChild;b;){var E=b.nextSibling,O=b.nodeName;b[ds]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&b.rel.toLowerCase()==="stylesheet"||c.removeChild(b),b=E}}else c==="body"&&Fl(t.ownerDocument.body);c=m}while(c);ao(s)}function Uv(t,s){var c=t;t=0;do{var u=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),u&&u.nodeType===8)if(c=u.data,c==="/$"){if(t===0)break;t--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||t++;c=u}while(c)}function mp(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":mp(c),Wo(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}t.removeChild(c)}}function n_(t,s,c,u){for(;t.nodeType===1;){var m=c;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[ds])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(b=t.getAttribute("rel"),b==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(b!==m.rel||t.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||t.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||t.getAttribute("title")!==(m.title==null?null:m.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(b=t.getAttribute("src"),(b!==(m.src==null?null:m.src)||t.getAttribute("type")!==(m.type==null?null:m.type)||t.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&b&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var b=m.name==null?null:""+m.name;if(m.type==="hidden"&&t.getAttribute("name")===b)return t}else return t;if(t=pa(t.nextSibling),t===null)break}return null}function a_(t,s,c){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!c||(t=pa(t.nextSibling),t===null))return null;return t}function Bv(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=pa(t.nextSibling),t===null))return null;return t}function yp(t){return t.data==="$?"||t.data==="$~"}function xp(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function s_(t,s){var c=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||c.readyState!=="loading")s();else{var u=function(){s(),c.removeEventListener("DOMContentLoaded",u)};c.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function pa(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var bp=null;function qv(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var c=t.data;if(c==="/$"||c==="/&"){if(s===0)return pa(t.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}t=t.nextSibling}return null}function Gv(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var c=t.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return t;s--}else c!=="/$"&&c!=="/&"||s++}t=t.previousSibling}return null}function Fv(t,s,c){switch(s=xu(c),t){case"html":if(t=s.documentElement,!t)throw Error(a(452));return t;case"head":if(t=s.head,!t)throw Error(a(453));return t;case"body":if(t=s.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Fl(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Wo(t)}var ma=new Map,Vv=new Set;function bu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var As=F.d;F.d={f:r_,r:i_,D:o_,C:l_,L:c_,m:d_,X:g_,S:u_,M:h_};function r_(){var t=As.f(),s=du();return t||s}function i_(t){var s=Ps(t);s!==null&&s.tag===5&&s.type==="form"?c0(s):As.r(t)}var eo=typeof document>"u"?null:document;function Kv(t,s,c){var u=eo;if(u&&typeof s=="string"&&s){var m=Pn(s);m='link[rel="'+t+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),Vv.has(m)||(Vv.add(m),t={rel:t,crossOrigin:c,href:s},u.querySelector(m)===null&&(s=u.createElement("link"),jn(s,"link",t),sn(s),u.head.appendChild(s)))}}function o_(t){As.D(t),Kv("dns-prefetch",t,null)}function l_(t,s){As.C(t,s),Kv("preconnect",t,s)}function c_(t,s,c){As.L(t,s,c);var u=eo;if(u&&t&&s){var m='link[rel="preload"][as="'+Pn(s)+'"]';s==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+Pn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+Pn(c.imageSizes)+'"]')):m+='[href="'+Pn(t)+'"]';var b=m;switch(s){case"style":b=to(t);break;case"script":b=no(t)}ma.has(b)||(t=x({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:t,as:s},c),ma.set(b,t),u.querySelector(m)!==null||s==="style"&&u.querySelector(Vl(b))||s==="script"&&u.querySelector(Kl(b))||(s=u.createElement("link"),jn(s,"link",t),sn(s),u.head.appendChild(s)))}}function d_(t,s){As.m(t,s);var c=eo;if(c&&t){var u=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+Pn(u)+'"][href="'+Pn(t)+'"]',b=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=no(t)}if(!ma.has(b)&&(t=x({rel:"modulepreload",href:t},s),ma.set(b,t),c.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Kl(b)))return}u=c.createElement("link"),jn(u,"link",t),sn(u),c.head.appendChild(u)}}}function u_(t,s,c){As.S(t,s,c);var u=eo;if(u&&t){var m=Fa(u).hoistableStyles,b=to(t);s=s||"default";var E=m.get(b);if(!E){var O={loading:0,preload:null};if(E=u.querySelector(Vl(b)))O.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":s},c),(c=ma.get(b))&&vp(t,c);var B=E=u.createElement("link");sn(B),jn(B,"link",t),B._p=new Promise(function(te,ce){B.onload=te,B.onerror=ce}),B.addEventListener("load",function(){O.loading|=1}),B.addEventListener("error",function(){O.loading|=2}),O.loading|=4,vu(E,s,u)}E={type:"stylesheet",instance:E,count:1,state:O},m.set(b,E)}}}function g_(t,s){As.X(t,s);var c=eo;if(c&&t){var u=Fa(c).hoistableScripts,m=no(t),b=u.get(m);b||(b=c.querySelector(Kl(m)),b||(t=x({src:t,async:!0},s),(s=ma.get(m))&&Sp(t,s),b=c.createElement("script"),sn(b),jn(b,"link",t),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(m,b))}}function h_(t,s){As.M(t,s);var c=eo;if(c&&t){var u=Fa(c).hoistableScripts,m=no(t),b=u.get(m);b||(b=c.querySelector(Kl(m)),b||(t=x({src:t,async:!0,type:"module"},s),(s=ma.get(m))&&Sp(t,s),b=c.createElement("script"),sn(b),jn(b,"link",t),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(m,b))}}function Wv(t,s,c,u){var m=(m=Ee.current)?bu(m):null;if(!m)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=to(c.href),c=Fa(m).hoistableStyles,u=c.get(s),u||(u={type:"style",instance:null,count:0,state:null},c.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){t=to(c.href);var b=Fa(m).hoistableStyles,E=b.get(t);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(t,E),(b=m.querySelector(Vl(t)))&&!b._p&&(E.instance=b,E.state.loading=5),ma.has(t)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ma.set(t,c),b||f_(m,t,c,E.state))),s&&u===null)throw Error(a(528,""));return E}if(s&&u!==null)throw Error(a(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=no(c),c=Fa(m).hoistableScripts,u=c.get(s),u||(u={type:"script",instance:null,count:0,state:null},c.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function to(t){return'href="'+Pn(t)+'"'}function Vl(t){return'link[rel="stylesheet"]['+t+"]"}function Yv(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function f_(t,s,c,u){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=t.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),jn(s,"link",c),sn(s),t.head.appendChild(s))}function no(t){return'[src="'+Pn(t)+'"]'}function Kl(t){return"script[async]"+t}function Jv(t,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var u=t.querySelector('style[data-href~="'+Pn(c.href)+'"]');if(u)return s.instance=u,sn(u),u;var m=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),sn(u),jn(u,"style",m),vu(u,c.precedence,t),s.instance=u;case"stylesheet":m=to(c.href);var b=t.querySelector(Vl(m));if(b)return s.state.loading|=4,s.instance=b,sn(b),b;u=Yv(c),(m=ma.get(m))&&vp(u,m),b=(t.ownerDocument||t).createElement("link"),sn(b);var E=b;return E._p=new Promise(function(O,B){E.onload=O,E.onerror=B}),jn(b,"link",u),s.state.loading|=4,vu(b,c.precedence,t),s.instance=b;case"script":return b=no(c.src),(m=t.querySelector(Kl(b)))?(s.instance=m,sn(m),m):(u=c,(m=ma.get(b))&&(u=x({},c),Sp(u,m)),t=t.ownerDocument||t,m=t.createElement("script"),sn(m),jn(m,"link",u),t.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,vu(u,c.precedence,t));return s.instance}function vu(t,s,c){for(var u=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,b=m,E=0;E<u.length;E++){var O=u[E];if(O.dataset.precedence===s)b=O;else if(b!==m)break}b?b.parentNode.insertBefore(t,b.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(t,s.firstChild))}function vp(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Sp(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Su=null;function Xv(t,s,c){if(Su===null){var u=new Map,m=Su=new Map;m.set(c,u)}else m=Su,u=m.get(c),u||(u=new Map,m.set(c,u));if(u.has(t))return u;for(u.set(t,null),c=c.getElementsByTagName(t),m=0;m<c.length;m++){var b=c[m];if(!(b[ds]||b[gn]||t==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var E=b.getAttribute(s)||"";E=t+E;var O=u.get(E);O?O.push(b):u.set(E,[b])}}return u}function Qv(t,s,c){t=t.ownerDocument||t,t.head.insertBefore(c,s==="title"?t.querySelector("head > title"):null)}function p_(t,s,c){if(c===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return t=s.disabled,typeof s.precedence=="string"&&t==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Zv(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function m_(t,s,c,u){if(c.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=to(u.href),b=s.querySelector(Vl(m));if(b){s=b._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=wu.bind(t),s.then(t,t)),c.state.loading|=4,c.instance=b,sn(b);return}b=s.ownerDocument||s,u=Yv(u),(m=ma.get(m))&&vp(u,m),b=b.createElement("link"),sn(b);var E=b;E._p=new Promise(function(O,B){E.onload=O,E.onerror=B}),jn(b,"link",u),c.instance=b}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(t.count++,c=wu.bind(t),s.addEventListener("load",c),s.addEventListener("error",c))}}var wp=0;function y_(t,s){return t.stylesheets&&t.count===0&&ju(t,t.stylesheets),0<t.count||0<t.imgCount?function(c){var u=setTimeout(function(){if(t.stylesheets&&ju(t,t.stylesheets),t.unsuspend){var b=t.unsuspend;t.unsuspend=null,b()}},6e4+s);0<t.imgBytes&&wp===0&&(wp=62500*X1());var m=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ju(t,t.stylesheets),t.unsuspend)){var b=t.unsuspend;t.unsuspend=null,b()}},(t.imgBytes>wp?50:800)+s);return t.unsuspend=c,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function wu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ju(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cu=null;function ju(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cu=new Map,s.forEach(x_,t),Cu=null,wu.call(t))}function x_(t,s){if(!(s.state.loading&4)){var c=Cu.get(t);if(c)var u=c.get(null);else{c=new Map,Cu.set(t,c);for(var m=t.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<m.length;b++){var E=m[b];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),u=E)}u&&c.set(null,u)}m=s.instance,E=m.getAttribute("data-precedence"),b=c.get(E)||u,b===u&&c.set(null,m),c.set(E,m),this.count++,u=wu.bind(this),m.addEventListener("load",u),m.addEventListener("error",u),b?b.parentNode.insertBefore(m,b.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(m,t.firstChild)),s.state.loading|=4}}var Wl={$$typeof:N,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function b_(t,s,c,u,m,b,E,O,B){this.tag=1,this.containerInfo=t,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=At(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.hiddenUpdates=At(null),this.identifierPrefix=u,this.onUncaughtError=m,this.onCaughtError=b,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.incompleteTransitions=new Map}function eS(t,s,c,u,m,b,E,O,B,te,ce,ye){return t=new b_(t,s,c,E,B,te,ce,ye,O),s=1,b===!0&&(s|=24),b=Qn(3,null,null,s),t.current=b,b.stateNode=t,s=ef(),s.refCount++,t.pooledCache=s,s.refCount++,b.memoizedState={element:u,isDehydrated:c,cache:s},sf(b),t}function tS(t){return t?(t=Oi,t):Oi}function nS(t,s,c,u,m,b){m=tS(m),u.context===null?u.context=m:u.pendingContext=m,u=er(s),u.payload={element:c},b=b===void 0?null:b,b!==null&&(u.callback=b),c=tr(t,u,s),c!==null&&(Fn(c,t,s),Nl(c,t,s))}function aS(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var c=t.retryLane;t.retryLane=c!==0&&c<s?c:s}}function Cp(t,s){aS(t,s),(t=t.alternate)&&aS(t,s)}function sS(t){if(t.tag===13||t.tag===31){var s=zr(t,67108864);s!==null&&Fn(s,t,67108864),Cp(t,67108864)}}function rS(t){if(t.tag===13||t.tag===31){var s=aa();s=Ta(s);var c=zr(t,s);c!==null&&Fn(c,t,s),Cp(t,s)}}var ku=!0;function v_(t,s,c,u){var m=J.T;J.T=null;var b=F.p;try{F.p=2,jp(t,s,c,u)}finally{F.p=b,J.T=m}}function S_(t,s,c,u){var m=J.T;J.T=null;var b=F.p;try{F.p=8,jp(t,s,c,u)}finally{F.p=b,J.T=m}}function jp(t,s,c,u){if(ku){var m=kp(u);if(m===null)dp(t,s,u,Nu,c),oS(t,u);else if(C_(m,t,s,c,u))u.stopPropagation();else if(oS(t,u),s&4&&-1<w_.indexOf(t)){for(;m!==null;){var b=Ps(m);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var E=Pe(b.pendingLanes);if(E!==0){var O=b;for(O.pendingLanes|=2,O.entangledLanes|=2;E;){var B=1<<31-Ne(E);O.entanglements[1]|=B,E&=~B}Qa(b),(jt&6)===0&&(lu=ot()+500,Bl(0))}}break;case 31:case 13:O=zr(b,2),O!==null&&Fn(O,b,2),du(),Cp(b,2)}if(b=kp(u),b===null&&dp(t,s,u,Nu,c),b===m)break;m=b}m!==null&&u.stopPropagation()}else dp(t,s,u,null,c)}}function kp(t){return t=ki(t),Np(t)}var Nu=null;function Np(t){if(Nu=null,t=Hs(t),t!==null){var s=o(t);if(s===null)t=null;else{var c=s.tag;if(c===13){if(t=d(s),t!==null)return t;t=null}else if(c===31){if(t=g(s),t!==null)return t;t=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Nu=t,null}function iS(t){switch(t){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"resize":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"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"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(We()){case nn:return 2;case Nt:return 8;case It:case an:return 32;case _a:return 268435456;default:return 32}default:return 32}}var Ep=!1,gr=null,hr=null,fr=null,Yl=new Map,Jl=new Map,pr=[],w_="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 oS(t,s){switch(t){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":hr=null;break;case"mouseover":case"mouseout":fr=null;break;case"pointerover":case"pointerout":Yl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Jl.delete(s.pointerId)}}function Xl(t,s,c,u,m,b){return t===null||t.nativeEvent!==b?(t={blockedOn:s,domEventName:c,eventSystemFlags:u,nativeEvent:b,targetContainers:[m]},s!==null&&(s=Ps(s),s!==null&&sS(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),t)}function C_(t,s,c,u,m){switch(s){case"focusin":return gr=Xl(gr,t,s,c,u,m),!0;case"dragenter":return hr=Xl(hr,t,s,c,u,m),!0;case"mouseover":return fr=Xl(fr,t,s,c,u,m),!0;case"pointerover":var b=m.pointerId;return Yl.set(b,Xl(Yl.get(b)||null,t,s,c,u,m)),!0;case"gotpointercapture":return b=m.pointerId,Jl.set(b,Xl(Jl.get(b)||null,t,s,c,u,m)),!0}return!1}function lS(t){var s=Hs(t.target);if(s!==null){var c=o(s);if(c!==null){if(s=c.tag,s===13){if(s=d(c),s!==null){t.blockedOn=s,Ga(t.priority,function(){rS(c)});return}}else if(s===31){if(s=g(c),s!==null){t.blockedOn=s,Ga(t.priority,function(){rS(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){t.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Eu(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var c=kp(t.nativeEvent);if(c===null){c=t.nativeEvent;var u=new c.constructor(c.type,c);tl=u,c.target.dispatchEvent(u),tl=null}else return s=Ps(c),s!==null&&sS(s),t.blockedOn=c,!1;s.shift()}return!0}function cS(t,s,c){Eu(t)&&c.delete(s)}function j_(){Ep=!1,gr!==null&&Eu(gr)&&(gr=null),hr!==null&&Eu(hr)&&(hr=null),fr!==null&&Eu(fr)&&(fr=null),Yl.forEach(cS),Jl.forEach(cS)}function _u(t,s){t.blockedOn===s&&(t.blockedOn=null,Ep||(Ep=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,j_)))}var Tu=null;function dS(t){Tu!==t&&(Tu=t,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Tu===t&&(Tu=null);for(var s=0;s<t.length;s+=3){var c=t[s],u=t[s+1],m=t[s+2];if(typeof u!="function"){if(Np(u||c)===null)continue;break}var b=Ps(c);b!==null&&(t.splice(s,3),s-=3,kf(b,{pending:!0,data:m,method:c.method,action:u},u,m))}}))}function ao(t){function s(B){return _u(B,t)}gr!==null&&_u(gr,t),hr!==null&&_u(hr,t),fr!==null&&_u(fr,t),Yl.forEach(s),Jl.forEach(s);for(var c=0;c<pr.length;c++){var u=pr[c];u.blockedOn===t&&(u.blockedOn=null)}for(;0<pr.length&&(c=pr[0],c.blockedOn===null);)lS(c),c.blockedOn===null&&pr.shift();if(c=(t.ownerDocument||t).$$reactFormReplay,c!=null)for(u=0;u<c.length;u+=3){var m=c[u],b=c[u+1],E=m[vn]||null;if(typeof b=="function")E||dS(c);else if(E){var O=null;if(b&&b.hasAttribute("formAction")){if(m=b,E=b[vn]||null)O=E.formAction;else if(Np(m)!==null)continue}else O=E.action;typeof O=="function"?c[u+1]=O:(c.splice(u,3),u-=3),dS(c)}}}function uS(){function t(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(E){return m=E})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),u||setTimeout(c,20)}function c(){if(!u&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,m=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(c,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function _p(t){this._internalRoot=t}Au.prototype.render=_p.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(a(409));var c=s.current,u=aa();nS(c,u,t,s,null,null)},Au.prototype.unmount=_p.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;nS(t.current,2,null,t,null,null),du(),s[zn]=null}};function Au(t){this._internalRoot=t}Au.prototype.unstable_scheduleHydration=function(t){if(t){var s=Jn();t={blockedOn:null,target:t,priority:s};for(var c=0;c<pr.length&&s!==0&&s<pr[c].priority;c++);pr.splice(c,0,t),c===0&&lS(t)}};var gS=e.version;if(gS!=="19.2.0")throw Error(a(527,gS,"19.2.0"));F.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=f(s),t=t!==null?p(t):null,t=t===null?null:t.stateNode,t};var k_={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:J,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Du=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Du.isDisabled&&Du.supportsFiber)try{me=Du.inject(k_),ne=Du}catch{}}return so.createRoot=function(t,s){if(!i(t))throw Error(a(299));var c=!1,u="",m=b0,b=v0,E=S0;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(b=s.onCaughtError),s.onRecoverableError!==void 0&&(E=s.onRecoverableError)),s=eS(t,1,!1,null,null,c,u,null,m,b,E,uS),t[zn]=s.current,cp(t),new _p(s)},so.hydrateRoot=function(t,s,c){if(!i(t))throw Error(a(299));var u=!1,m="",b=b0,E=v0,O=S0,B=null;return c!=null&&(c.unstable_strictMode===!0&&(u=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(b=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(B=c.formState)),s=eS(t,1,!0,s,c??null,u,m,B,b,E,O,uS),s.context=tS(null),c=s.current,u=aa(),u=Ta(u),m=er(u),m.callback=null,tr(c,m,u),c=u,s.current.lanes=c,Kt(s,c),Qa(s),t[zn]=s.current,cp(t),new Au(s)},so.version="19.2.0",so}var Ip;function vS(){if(Ip)return Lu.exports;Ip=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Lu.exports=bS(),Lu.exports}var zu=vS();const Hu=es(zu),ro=[],SS=50;let Pu=!1;function zp(){try{return window.G7Core?.devTools}catch{return}}function Xr(r,e,n){const a=zp();if(Pu&&a?.isEnabled?.()){a.trackLog?.(r,e,n);return}Pu||(r==="error"||r==="warn")&&ro.length<SS&&ro.push({level:r,prefix:e,args:n,timestamp:Date.now()})}function Hp(){Pu=!0;const r=zp();if(!r?.isEnabled?.()){ro.length=0;return}for(const e of ro)r.trackLog?.(e.level,e.prefix,e.args);ro.length=0}const kr=class kr{constructor(){H(this,"debug");H(this,"prefix","[TemplateEngine]");this.debug=!1}static getInstance(){return kr.instance||(kr.instance=new kr),kr.instance}setDebug(e){this.debug=e}isDebugEnabled(){return this.debug}log(...e){this.debug&&console.log(this.prefix,...e),Xr("log","TemplateEngine",e)}error(...e){this.debug&&console.error(this.prefix,...e),Xr("error","TemplateEngine",e)}warn(...e){this.debug&&console.warn(this.prefix,...e),Xr("warn","TemplateEngine",e)}};H(kr,"instance");let io=kr;function at(r){const e=`[${r}]`,n=io.getInstance();return{log:(...a)=>{n.isDebugEnabled()&&console.log(e,...a),Xr("log",r,a)},warn:(...a)=>{n.isDebugEnabled()&&console.warn(e,...a),Xr("warn",r,a)},error:(...a)=>{n.isDebugEnabled()&&console.error(e,...a),Xr("error",r,a)}}}io.getInstance();const za=at("ComponentRegistry");class pn extends Error{constructor(e,n,a){super(e),this.code=n,this.details=a,this.name="ComponentRegistryError"}}const ia=class ia{constructor(){H(this,"registry",{});H(this,"manifest",null);H(this,"loadingState","idle");H(this,"error",null);H(this,"templateId",null);H(this,"templateType",null)}static getInstance(){return ia.instance||(ia.instance=new ia),ia.instance}static resetInstance(){ia.instance=null}async loadComponents(e,n){if(this.loadingState==="loading")throw new pn("Components are already being loaded","LOADING_IN_PROGRESS");if(this.loadingState==="loaded"&&this.templateId===e&&this.templateType===n){za.log("Components already loaded for template:",e,n);return}this.loadingState="loading",this.templateId=e,this.templateType=n,this.error=null;try{await this.loadManifest(),await this.loadComponentBundle(),this.loadingState="loaded",za.log("Successfully loaded components:",Object.keys(this.registry).length)}catch(a){throw this.loadingState="error",this.error=a instanceof Error?a:new Error(String(a)),new pn(`Failed to load components: ${this.error.message}`,"LOAD_FAILED",{originalError:this.error})}}async loadManifest(){try{if(!this.templateId)throw new pn("Template ID not set","TEMPLATE_ID_NOT_SET");const e=`${this.templateId}:${this.templateType}`;if(ia.manifestCache.has(e)){this.manifest=ia.manifestCache.get(e),za.log("Manifest loaded from cache:",this.manifest.templateId);return}const n=`/api/templates/${this.templateId}/components.json`,a=await fetch(n);if(!a.ok)throw new pn(`Failed to fetch manifest: ${a.status} ${a.statusText}`,"MANIFEST_FETCH_FAILED",{status:a.status,statusText:a.statusText});const i=await a.json();this.validateManifest(i),this.manifest=i,ia.manifestCache.set(e,i),za.log("Manifest loaded and cached:",i.templateId)}catch(e){throw e instanceof pn?e:new pn("Failed to load component manifest","MANIFEST_LOAD_FAILED",{originalError:e})}}validateManifest(e){if(!e.version)throw new pn("Manifest missing required field: version","MANIFEST_INVALID",{field:"version"});if(!e.templateId)throw new pn("Manifest missing required field: templateId","MANIFEST_INVALID",{field:"templateId"});if(!e.components||typeof e.components!="object")throw new pn("Manifest missing required field: components","MANIFEST_INVALID",{field:"components"});const n=["basic","composite","layout"];for(const a of n){if(!Array.isArray(e.components[a]))throw new pn(`Manifest field 'components.${a}' must be an array`,"MANIFEST_INVALID",{field:`components.${a}`,value:e.components[a]});e.components[a].forEach((i,o)=>{if(!i.name||typeof i.name!="string")throw new pn(`Invalid component metadata at ${a}[${o}]: missing or invalid 'name'`,"MANIFEST_INVALID",{type:a,index:o,metadata:i});if(!i.type||typeof i.type!="string")throw new pn(`Invalid component metadata at ${a}[${o}]: missing or invalid 'type'`,"MANIFEST_INVALID",{type:a,index:o,metadata:i})})}za.log("Manifest validation passed")}async loadComponentBundle(){try{if(!this.templateId)throw new pn("Template ID not set","TEMPLATE_ID_NOT_SET");const e=this.getGlobalVariableName(),n=window[e];if(!n||typeof n!="object")throw new pn(`Component bundle not loaded. Expected global variable: ${e}. Ensure admin.blade.php includes the IIFE bundle script.`,"BUNDLE_NOT_LOADED",{expectedVariable:e});await this.registerComponentsFromManifest(n),za.log("Component bundle loaded from global variable:",e)}catch(e){throw e instanceof pn?e:new pn("Failed to load component bundle","BUNDLE_LOAD_FAILED",{originalError:e})}}getGlobalVariableName(){if(!this.templateId)throw new pn("Template ID not set","TEMPLATE_ID_NOT_SET");return this.templateId.split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")}async registerComponentsFromManifest(e){if(!this.manifest)throw new pn("Manifest not loaded","MANIFEST_NOT_LOADED");const n=["basic","composite","layout"];for(const a of n){const i=this.manifest.components[a]||[];for(const o of i){const d=o.name,g=e[d];if(!g){za.warn(`Component '${d}' not found in bundle`);continue}this.registerComponent(d,g,o)}}}registerComponent(e,n,a){this.registry[e]&&za.warn(`Component '${e}' already registered, overwriting`),this.registry[e]={component:n,metadata:a},za.log(`[ComponentRegistry] Registered component: ${e} (${a.type})`)}getComponent(e){const n=this.registry[e];return n?n.component:null}getMetadata(e){const n=this.registry[e];return n?n.metadata:null}hasComponent(e){return e in this.registry}getComponentsByType(e){return Object.entries(this.registry).filter(([n,a])=>a.metadata.type===e).map(([n,a])=>n)}getAllComponents(){return Object.keys(this.registry)}getComponentMap(){const e={};for(const[n,a]of Object.entries(this.registry))e[n]=a.component;return e}getLoadingState(){return this.loadingState}getError(){return this.error}getTemplateId(){return this.templateId}getManifest(){return this.manifest}clear(){this.registry={},this.manifest=null,this.loadingState="idle",this.error=null,this.templateId=null,this.templateType=null,za.log("Registry cleared")}};H(ia,"instance",null),H(ia,"manifestCache",new Map);let ya=ia;const Pp=at("TranslationEngine");class Uu extends Error{constructor(e,n,a){super(e),this.key=n,this.locale=a,this.name="TranslationError"}}const $n=class $n{constructor(e={}){H(this,"cache",new Map);H(this,"translations",new Map);H(this,"options");H(this,"cacheVersion",0);this.options={defaultLocale:e.defaultLocale||"ko",fallbackLocale:e.fallbackLocale||"en",cacheTTL:e.cacheTTL||3e5}}static getInstance(e={}){return $n.instance||($n.instance=new $n(e)),$n.instance}static resetInstance(){$n.instance=null}setCacheVersion(e){this.cacheVersion!==e&&(Pp.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.clearCache())}getCacheVersion(){return this.cacheVersion}async loadTranslations(e,n,a="/api",i=!1){const o=`${e}:${n}`;if(!i){const d=this.getFromCache(o);if(d)return this.translations.set(o,d),d}try{let d=`${a}/templates/${e}/lang/${n}.json`;const g=[];this.cacheVersion>0&&g.push(`v=${this.cacheVersion}`),i&&g.push(`_=${Date.now()}`),g.length>0&&(d+=`?${g.join("&")}`);const h=await fetch(d);if(!h.ok)throw new Uu(`Failed to load translations: ${h.statusText}`,void 0,n);const p=await h.json();return this.saveToCache(o,p),this.translations.set(o,p),p}catch(d){throw new Uu(`Failed to fetch translations for ${n}: ${d instanceof Error?d.message:String(d)}`,void 0,n)}}resolveTranslations(e,n,a){let i=e;const o=5;let d=0;for(;d<o&&i.includes("=$t:");){const g=i;if(i=i.replace($n.NESTED_TRANSLATION_PARAM_PATTERN,(h,f,p)=>"="+this.translate(p,n,void 0,a)),i===g)break;d++}return i.replace($n.TRANSLATION_PATTERN,(g,h,f)=>{const{cleanedParams:p,trailing:x}=this.separateTrailingText(f);return this.translate(h,n,p,a)+x})}translate(e,n,a,i){const o=this.getTranslation(e,n),d=a&&this.cleanParamsStr(a);if(d){const g=this.parseParams(d,i);return this.replaceParams(o,g)}return o}getTranslation(e,n){const{templateId:a,locale:i}=n,o=`${a}:${i}`,d=this.translations.get(o);if(d){const g=this.getNestedValue(d,e);if(g!==null)return g}if(i!==this.options.fallbackLocale){const g=`${a}:${this.options.fallbackLocale}`,h=this.translations.get(g);if(h){const f=this.getNestedValue(h,e);if(f!==null)return f}}return e}getNestedValue(e,n){const a=n.split(".");let i=e;for(const o of a){if(i==null||typeof i!="object")return null;i=i[o]}return typeof i=="string"?i:null}parseParams(e,n){const a={},i=e.startsWith("|")?e.slice(1):e,o=[],g=i.replace(/\{\{(?:[^}]|\}(?!\}))*\}\}/g,h=>(o.push(h),`__PLACEHOLDER_${o.length-1}__`)).matchAll($n.PARAM_PATTERN);for(const h of g){const[,f,p]=h,x=p.replace(/__PLACEHOLDER_(\d+)__/g,(y,w)=>o[parseInt(w,10)]);a[f.trim()]=this.resolveParamValue(x.trim(),n)}return a}resolveParamValue(e,n){if(e.startsWith("{{")&&e.endsWith("}}")){const a=e.slice(2,-2).trim();if(/[|&()[\]!?:+\-*/%<>=\s]/.test(a)&&n)try{const d=new Function(...Object.keys(n),`return ${a}`)(...Object.values(n));return String(d??"")}catch(o){return Pp.error("Expression evaluation failed:",a,o),""}else{const o=this.getNestedDataValue(n,a);return String(o??"")}}return e}separateTrailingText(e){if(!e)return{cleanedParams:void 0,trailing:""};if(e.trimEnd().endsWith("}}"))return{cleanedParams:e,trailing:""};if(!(e.startsWith("|")?e.slice(1):e).includes("="))return{cleanedParams:void 0,trailing:e};const a=e.match(/(\s+[^\p{L}\w=|&\s][^\p{L}\w=]*\s*)$/u);return a?{cleanedParams:e.slice(0,-a[1].length),trailing:a[1]}:{cleanedParams:e,trailing:""}}cleanParamsStr(e){return this.separateTrailingText(e).cleanedParams||""}getNestedDataValue(e,n){if(!e)return;const a=n.split(".");let i=e;for(const o of a){if(i==null)return;i=i[o]}return i}replaceParams(e,n){let a=e;for(const[i,o]of Object.entries(n)){const d=new RegExp(`\\{\\{${i}\\}\\}`,"g");a=a.replace(d,String(o));const g=new RegExp(`\\{${i}\\}`,"g");a=a.replace(g,String(o))}return a}getFromCache(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.options.cacheTTL?(this.cache.delete(e),null):n.data:null}saveToCache(e,n){this.cache.set(e,{data:n,timestamp:Date.now()})}clearCache(){this.cache.clear(),this.translations.clear()}pruneCache(){const e=Date.now(),n=[];for(const[a,i]of this.cache.entries())e-i.timestamp>this.options.cacheTTL&&n.push(a);for(const a of n)this.cache.delete(a)}getCacheStats(){const e=Date.now();let n=0;for(const a of this.cache.values())e-a.timestamp>this.options.cacheTTL&&n++;return{size:this.cache.size,expired:n}}};H($n,"instance",null),H($n,"TRANSLATION_PATTERN",/\$t:([a-zA-Z0-9._-]+)(\|(?:(?!\$t:).)+)?/g),H($n,"NESTED_TRANSLATION_PARAM_PATTERN",/=(\$t:([a-zA-Z0-9._-]+))(?=[|&\s]|$)/g),H($n,"PARAM_PATTERN",/([^=|&]+)=([^|&]+)/g);let yr=$n;const Up=Object.freeze(Object.defineProperty({__proto__:null,TranslationEngine:yr,TranslationError:Uu},Symbol.toStringTag,{value:"Module"})),Qr=at("PipeRegistry");function Bp(r,e){const n=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),i=String(r.getDate()).padStart(2,"0"),o=String(r.getHours()).padStart(2,"0"),d=String(r.getMinutes()).padStart(2,"0"),g=String(r.getSeconds()).padStart(2,"0");return e.replace("YYYY",String(n)).replace("YY",String(n).slice(-2)).replace("MM",a).replace("M",String(r.getMonth()+1)).replace("DD",i).replace("D",String(r.getDate())).replace("HH",o).replace("H",String(r.getHours())).replace("mm",d).replace("m",String(r.getMinutes())).replace("ss",g).replace("s",String(r.getSeconds()))}function wS(r,e="ko"){const a=new Date().getTime()-r.getTime(),i=Math.floor(a/1e3),o=Math.floor(i/60),d=Math.floor(o/60),g=Math.floor(d/24),h=Math.floor(g/7),f=Math.floor(g/30),p=Math.floor(g/365);return e==="ko"?i<60?"방금 전":o<60?`${o}분 전`:d<24?`${d}시간 전`:g<7?`${g}일 전`:h<4?`${h}주 전`:f<12?`${f}개월 전`:`${p}년 전`:i<60?"just now":o<60?`${o} minute${o===1?"":"s"} ago`:d<24?`${d} hour${d===1?"":"s"} ago`:g<7?`${g} day${g===1?"":"s"} ago`:h<4?`${h} week${h===1?"":"s"} ago`:f<12?`${f} month${f===1?"":"s"} ago`:`${p} year${p===1?"":"s"} ago`}function Bu(r){if(r==null)return null;if(r instanceof Date)return r;if(typeof r=="number")return new Date(r);if(typeof r=="string"){const e=new Date(r);return isNaN(e.getTime())?null:e}return null}const oo={date:{fn:(r,e="YYYY-MM-DD")=>{const n=Bu(r);return n?Bp(n,e):""},description:"날짜 포맷 (기본: YYYY-MM-DD)"},datetime:{fn:(r,e="YYYY-MM-DD HH:mm")=>{const n=Bu(r);return n?Bp(n,e):""},description:"날짜+시간 포맷 (기본: YYYY-MM-DD HH:mm)"},relativeTime:{fn:(r,e="ko")=>{const n=Bu(r);return n?wS(n,e):""},description:'상대 시간 표시 (예: "3분 전")'},number:{fn:(r,e)=>{const n=Number(r);if(isNaN(n))return String(r??"");const a={};return e!==void 0&&(a.minimumFractionDigits=e,a.maximumFractionDigits=e),n.toLocaleString(void 0,a)},description:"숫자 포맷 (천단위 구분, 선택적 소수점)"},truncate:{fn:(r,e=100,n="...")=>typeof r!="string"?String(r??""):r.length<=e?r:r.slice(0,e)+n,description:'문자열 자르기 (기본: 100자, 접미사: "...")'},uppercase:{fn:r=>typeof r!="string"?String(r??""):r.toUpperCase(),description:"대문자 변환"},lowercase:{fn:r=>typeof r!="string"?String(r??""):r.toLowerCase(),description:"소문자 변환"},stripHtml:{fn:r=>typeof r!="string"?String(r??""):r.replace(/<[^>]*>/g,""),description:"HTML 태그 제거"},default:{fn:(r,e="")=>r==null||r===""?e:r,description:"기본값 설정 (null, undefined, 빈문자열 시)"},fallback:{fn:(r,e)=>r??e,description:"폴백 값 설정 (null, undefined 시만)"},first:{fn:r=>{if(Array.isArray(r))return r[0]},description:"배열의 첫 번째 요소"},last:{fn:r=>{if(Array.isArray(r))return r[r.length-1]},description:"배열의 마지막 요소"},join:{fn:(r,e=", ")=>Array.isArray(r)?r.join(e):"",description:'배열을 문자열로 결합 (기본 구분자: ", ")'},length:{fn:r=>Array.isArray(r)||typeof r=="string"?r.length:0,description:"배열/문자열 길이"},filterBy:{fn:(r,e,n)=>Array.isArray(r)?Array.isArray(e)?r.filter(a=>{const i=n?a?.[n]:a;return e.includes(i)}):r:[],description:"배열 필터링 (allowList에 포함된 항목만 반환)"},keys:{fn:r=>r==null||typeof r!="object"?[]:Object.keys(r),description:"객체의 키 배열"},values:{fn:r=>r==null||typeof r!="object"?[]:Object.values(r),description:"객체의 값 배열"},json:{fn:(r,e)=>{try{return JSON.stringify(r,null,e)}catch{return""}},description:"JSON 문자열로 변환"},localized:{fn:(r,e)=>r==null?"":typeof r=="string"?r:typeof r!="object"?String(r):r[e||"ko"]||r.ko||r.en||Object.values(r)[0]||"",description:"다국어 객체에서 로케일에 맞는 값 추출"}},Zr=new Map,Nr=class Nr{static getInstance(){return Nr.instance||(Nr.instance=new Nr),Nr.instance}register(e,n,a){if(oo[e]){Qr.warn(`[PipeRegistry] 내장 파이프를 덮어쓸 수 없습니다: ${e}`);return}Zr.set(e,{fn:n,description:a}),Qr.log(`[PipeRegistry] 커스텀 파이프 등록됨: ${e}`)}unregister(e){if(oo[e])return Qr.warn(`[PipeRegistry] 내장 파이프는 해제할 수 없습니다: ${e}`),!1;const n=Zr.delete(e);return n&&Qr.log(`[PipeRegistry] 커스텀 파이프 해제됨: ${e}`),n}get(e){const n=oo[e];return n?n.fn:Zr.get(e)?.fn}has(e){return!!oo[e]||Zr.has(e)}execute(e,n,a=[]){const i=this.get(e);if(!i)return Qr.warn(`[PipeRegistry] 알 수 없는 파이프: ${e}`),n;try{return i(n,...a)}catch(o){return Qr.error(`[PipeRegistry] 파이프 실행 오류 (${e}):`,o),n}}list(){const e=[];for(const[n,a]of Object.entries(oo))e.push({name:n,description:a.description,type:"built-in"});for(const[n,a]of Zr.entries())e.push({name:n,description:a.description,type:"custom"});return e.sort((n,a)=>n.name.localeCompare(a.name))}clearCustomPipes(){Zr.clear()}};H(Nr,"instance",null);let Ql=Nr;Ql.getInstance();function CS(r){const e=r.trim(),n=e.indexOf("(");if(n===-1)return{name:e,args:[]};const a=e.slice(0,n).trim(),i=e.slice(n+1,-1);if(!i.trim())return{name:a,args:[]};const o=[];let d="",g=null,h=0;for(let f=0;f<i.length;f++){const p=i[f];if((f>0?i[f-1]:"")==="\\"){d+=p;continue}if((p==='"'||p==="'")&&!g){g=p;continue}if(p===g){g=null;continue}if(g){d+=p;continue}if(p==="("||p==="["||p==="{"){h++,d+=p;continue}if(p===")"||p==="]"||p==="}"){h--,d+=p;continue}if(p===","&&h===0){o.push(qp(d.trim())),d="";continue}d+=p}return d.trim()&&o.push(qp(d.trim())),{name:a,args:o}}function qp(r){if(r==="null")return null;if(r==="undefined")return;if(r==="true")return!0;if(r==="false")return!1;const e=Number(r);return!isNaN(e)&&r!==""?e:r}function jS(r){const e=[];let n="",a=null,i=0;for(let o=0;o<r.length;o++){const d=r[o],g=o>0?r[o-1]:"",h=o<r.length-1?r[o+1]:"";if(g==="\\"){n+=d;continue}if((d==='"'||d==="'")&&!a){a=d,n+=d;continue}if(d===a){a=null,n+=d;continue}if(a){n+=d;continue}if(d==="("||d==="["||d==="{"){i++,n+=d;continue}if(d===")"||d==="]"||d==="}"){i--,n+=d;continue}if(d==="|"&&h!=="|"&&g!=="|"&&i===0){e.push(n.trim()),n="";continue}n+=d}return n.trim()&&e.push(n.trim()),e.length===0?[r,[]]:[e[0],e.slice(1)]}function Gp(r){let e=null,n=0;for(let a=0;a<r.length;a++){const i=r[a],o=a>0?r[a-1]:"",d=a<r.length-1?r[a+1]:"";if(o!=="\\"){if((i==='"'||i==="'")&&!e){e=i;continue}if(i===e){e=null;continue}if(!e){if(i==="("||i==="["||i==="{"){n++;continue}if(i===")"||i==="]"||i==="}"){n--;continue}if(i==="|"&&d!=="|"&&o!=="|"&&n===0)return!0}}}return!1}function kS(r,e){const n=Ql.getInstance();let a=r;for(const i of e){const o=CS(i);a=n.execute(o.name,a,o.args)}return a}const Ds="raw:",Zl="﷐",lo="﷑",Rs="﷒";function co(r){return Zl+r+lo}function Fp(r){return r.length>=2&&r.charCodeAt(0)===64976&&r.charCodeAt(r.length-1)===64977}function Vp(r){return r.includes(Zl)}function Kp(r){return r.slice(1,-1)}function uo(r){if(typeof r=="string")return co(r);if(Array.isArray(r))return r.map(uo);if(r&&typeof r=="object"){const e={};for(const[n,a]of Object.entries(r))e[n]=uo(a);return e}return r}const go=at("DataBindingEngine");function ec(){try{return window.G7Core?.devTools}catch{return}}class qu extends Error{constructor(e,n,a){super(e),this.path=n,this.context=a,this.name="DataBindingError"}}const ka=class ka{constructor(e){H(this,"cache",new Map);H(this,"expressionFnCache",new Map);H(this,"renderCycleCache",new Map);H(this,"currentRenderCycleId",0);H(this,"defaultOptions",{defaultValue:void 0,nullSafe:!0,detectCircular:!0,maxDepth:10});e&&(this.defaultOptions={...this.defaultOptions,...e})}startRenderCycle(){this.currentRenderCycleId++,this.renderCycleCache.clear()}isRenderCycleCacheActive(){return this.currentRenderCycleId>0}getFromRenderCycleCache(e){if(this.isRenderCycleCacheActive())return this.renderCycleCache.get(e)}saveToRenderCycleCache(e,n){this.isRenderCycleCacheActive()&&this.renderCycleCache.set(e,n)}resolveBindings(e,n,a,i){const o={...this.defaultOptions,...a},d=ec(),g=n._computed&&!n.$computed?{...n,$computed:n._computed}:n;return e.replace(ka.BINDING_PATTERN,(h,f)=>{const p=f.trim();let x=!1,y=p;if(p.startsWith(Ds)&&(x=!0,y=p.slice(Ds.length)),Gp(y)){const N=d?.isEnabled()?performance.now():0;try{const[D,M]=jS(y);let L,z=!1;const Y=/[?:|&!+\-*/<>=()]/.test(D)||/\[['"]/.test(D),he=D.startsWith("_global")||D.startsWith("_local")||D.startsWith("_isolated")||D.startsWith("$parent");if(o.skipCache)Y?L=this.evaluateExpression(D,g):L=this.resolvePath(D,g,o);else if(Y){const ge=this.getFromRenderCycleCache(`expr:${D}`);ge!==void 0?(L=ge,z=!0):(L=this.evaluateExpression(D,g),this.saveToRenderCycleCache(`expr:${D}`,L))}else if(he){const ge=this.getFromRenderCycleCache(D);ge!==void 0?(L=ge,z=!0):(L=this.resolvePath(D,g,o),this.saveToRenderCycleCache(D,L))}else{const ge=this.getFromCache(D);ge!==void 0?(L=ge,z=!0):(L=this.resolvePath(D,g,o),this.saveToCache(D,L))}const be=kS(L,M);if(d?.isEnabled()){const ge=performance.now()-N;d.trackExpressionEval({expression:`{{${p}}}`,result:this.sanitizeResultForTracking(be),resultType:this.getResultType(be),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:z,duration:ge,method:"resolveBindings",skipCache:o.skipCache})}const X=this.formatValue(be);return x?co(X):X}catch(D){return go.error("Pipe expression evaluation failed:",y,D),h}}if(/[?:&!+\-*/<>=()]/.test(y)||/\|\|/.test(y)||/\[['"]/.test(y)){const N=d?.isEnabled()?performance.now():0;try{let D,M=!1;if(o.skipCache)D=this.evaluateExpression(y,g);else{const z=`expr:${y}`,Y=this.getFromRenderCycleCache(z);Y!==void 0?(D=Y,M=!0):(D=this.evaluateExpression(y,g),this.saveToRenderCycleCache(z,D))}if(d?.isEnabled()){const z=performance.now()-N;d.trackExpressionEval({expression:`{{${p}}}`,result:this.sanitizeResultForTracking(D),resultType:this.getResultType(D),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:M,duration:z,method:"resolveBindings",skipCache:o.skipCache})}const L=this.formatValue(D);return x?co(L):L}catch(D){return go.error("Expression evaluation failed:",y,D),h}}if(o.skipCache){const N=d?.isEnabled()?performance.now():0,D=this.resolvePath(y,g,o);if(d?.isEnabled()){const L=performance.now()-N;d.trackExpressionEval({expression:`{{${p}}}`,result:this.sanitizeResultForTracking(D),resultType:this.getResultType(D),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:L,method:"resolveBindings",skipCache:!0})}const M=this.formatValue(D);return x?co(M):M}const v=y.startsWith("_global")||y.startsWith("_local")||y.startsWith("_isolated")||y.startsWith("$parent"),C=d?.isEnabled()?performance.now():0;let k,A=!1;if(v){const N=this.getFromRenderCycleCache(y);N!==void 0?(k=N,A=!0):(k=this.resolvePath(y,g,o),this.saveToRenderCycleCache(y,k))}else{const N=this.getFromCache(y);N!==void 0?(k=N,A=!0):(k=this.resolvePath(y,g,o),this.saveToCache(y,k))}if(d?.isEnabled()){const N=performance.now()-C;d.trackExpressionEval({expression:`{{${p}}}`,result:this.sanitizeResultForTracking(k),resultType:this.getResultType(k),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:A,duration:N,method:"resolveBindings",skipCache:o.skipCache})}const R=this.formatValue(k);return x?co(R):R})}resolve(e,n,a,i){const o={...this.defaultOptions,...a},d=ec(),g=d?.isEnabled()?performance.now():0;if(o.skipCache){const x=this.resolvePath(e,n,o);return d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(x),resultType:this.getResultType(x),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:performance.now()-g,method:"resolve",skipCache:!0}),x}const h=e.startsWith("_global")||e.startsWith("_local")||e.startsWith("_isolated")||e.startsWith("$parent");let f=!1;if(h){const x=this.getFromRenderCycleCache(e);if(x!==void 0)return f=!0,d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(x),resultType:this.getResultType(x),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-g,method:"resolve",skipCache:o.skipCache}),x}else{const x=this.getFromCache(e);if(x!==void 0)return f=!0,d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(x),resultType:this.getResultType(x),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-g,method:"resolve",skipCache:o.skipCache}),x}const p=this.resolvePath(e,n,o);return h?this.saveToRenderCycleCache(e,p):this.saveToCache(e,p),d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(p),resultType:this.getResultType(p),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:f,duration:performance.now()-g,method:"resolve",skipCache:o.skipCache}),p}resolvePath(e,n,a,i=0,o=new WeakSet){if(a.maxDepth&&i>a.maxDepth){if(a.detectCircular)throw new qu(`Maximum depth exceeded (${a.maxDepth}). Possible circular reference.`,e,n);return a.defaultValue}const d=this.parsePath(e);let g=n;for(let h=0;h<d.length;h++){const f=d[h];if(g==null){if(a.nullSafe)return a.defaultValue;throw new qu(`Cannot read property '${f}' of ${g}`,e,n)}if(a.detectCircular&&typeof g=="object"){if(o.has(g))throw new qu(`Circular reference detected at path: ${d.slice(0,h+1).join(".")}`,e,n);o.add(g)}g=g[f],e==="_global.toasts"&&go.log(`[DataBindingEngine] segment: ${f}, current:`,g)}return g!==void 0?g:a.defaultValue}parsePath(e){const n=[];let a;for(ka.PATH_SEGMENT_PATTERN.lastIndex=0;(a=ka.PATH_SEGMENT_PATTERN.exec(e))!==null;){const i=a[1]||a[2];i&&n.push(i)}return n}formatValue(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return"[Object]"}return String(e)}getFromCache(e){const n=this.cache.get(e),a=ec();if(!n){a?.isEnabled()&&a.recordCacheMiss();return}if(Date.now()-n.timestamp>ka.CACHE_EXPIRY){this.cache.delete(e),a?.isEnabled()&&a.recordCacheMiss();return}return a?.isEnabled()&&a.recordCacheHit(),n.value}saveToCache(e,n){this.cache.set(e,{value:n,timestamp:Date.now()})}isActionDefinition(e){return typeof e.handler!="string"?!1:e.params!==void 0||Array.isArray(e.actions)||typeof e.target=="string"||e.onSuccess!==void 0||e.onError!==void 0}resolveObject(e,n,a){if(this.isSwitchExpression(e)){const g=e;return this.resolveSwitch(g,n,a)}if(this.isActionDefinition(e))return{...e};if("iteration"in e)return{...e};const i={},d=[...["cellChildren","expandChildren","expandContext","render"],...a?.skipBindingKeys||[]];for(const[g,h]of Object.entries(e)){if(d.includes(g)){i[g]=h;continue}if(typeof h=="string"){const f=h.match(/^\{\{([^}]+)\}\}$/);if(f){const p=f[1].trim();let x=!1,y=p;p.startsWith(Ds)&&(x=!0,y=p.slice(Ds.length));const v=/[?:|&!+\-*/<>=()]/.test(y)||/\[['"]/.test(y)?this.evaluateExpression(y,n,a):this.resolve(y,n,a);i[g]=x&&v!=null?uo(v):v}else i[g]=this.resolveBindings(h,n,a)}else Array.isArray(h)?i[g]=h.map(f=>typeof f=="string"?this.resolveBindings(f,n,a):typeof f=="object"&&f!==null?this.resolveObject(f,n,a):f):h&&typeof h=="object"?i[g]=this.resolveObject(h,n,a):i[g]=h}return i}clearCache(){this.cache.clear(),this.expressionFnCache.clear()}invalidateCacheByKeys(e){for(const n of this.cache.keys())for(const a of e)if(n===a||n.startsWith(`${a}.`)||n.startsWith(`${a}[`)){this.cache.delete(n);break}}pruneCache(){const e=Date.now();for(const[n,a]of this.cache.entries())e-a.timestamp>ka.CACHE_EXPIRY&&this.cache.delete(n)}getCacheStats(){const e=Date.now();let n=0;for(const a of this.cache.values())e-a.timestamp>ka.CACHE_EXPIRY&&n++;return{size:this.cache.size,expired:n}}evaluateExpression(e,n,a){const i=ec(),o=i?.isEnabled()?performance.now():0;i?.isEnabled()&&i.trackBindingEval();try{let d=this.preprocessOptionalChaining(e);d=this.preprocessTranslationTokens(d);const g=this.extractVariablesFromExpression(d),h={...n};for(const N of g)N in h||(h[N]=void 0);n._computed&&!h.$computed&&(h.$computed=n._computed);const f=n.$locale||"ko";h.$localized=N=>N==null?"":typeof N=="string"?N:typeof N=="object"?N[f]||N.ko||N.en||Object.values(N)[0]||"":String(N);const p=typeof window<"u"?window.G7Core:void 0;h.$uuid=()=>p?.uuid?p.uuid():typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,N=>{const D=Math.random()*16|0;return(N==="x"?D:D&3|8).toString(16)});const y={templateId:n.$templateId||"",locale:f};h.$t=N=>{if(!N||typeof N!="string")return"";try{return yr.getInstance().translate(N,y)}catch(D){return go.warn("$t() translation failed for key:",N,D),N}},h.$get=(N,D,M=void 0)=>{if(N==null)return M;const L=Array.isArray(D)?D:[D];if(L.length===0)return N;let z=N;for(const Y of L){if(z==null||Y==null)return M;z=z[Y]}return z??M};const w=Object.keys(h),v=Object.values(h),C=`${d}|${w.join(",")}`;let k=this.expressionFnCache.get(C);const A=!!k;k||(k=new Function(...w,`return (${d});`),this.expressionFnCache.set(C,k));const R=k(...v);if(i?.isEnabled()){const N=performance.now()-o;i.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(R),resultType:this.getResultType(R),componentId:a?.componentId,componentName:a?.componentName,propName:a?.propName,fromCache:A,duration:N,method:"evaluateExpression",skipCache:a?.skipCache})}return R}catch(d){throw new Error(`Failed to evaluate expression "${e}": ${d instanceof Error?d.message:String(d)}`)}}getResultType(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}sanitizeResultForTracking(e){if(e==null||typeof e!="object")return e;try{if(Array.isArray(e))return e.length>10?`[Array(${e.length})]`:e.slice(0,10);const n=Object.keys(e);return n.length>20?`{Object(${n.length} keys)}`:(JSON.stringify(e),e)}catch{return"[Complex Object]"}}preprocessTranslationTokens(e){return e=e.replace(/(['"])(\$t:([a-zA-Z_][a-zA-Z0-9_.\-]*))\1/g,(n,a,i,o)=>`$t('${o}')`),e.replace(/(?<!['"]\s*)(\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*)(?!\s*['"])/g,'"$1"')}preprocessOptionalChaining(e){const n=[];let a=e.replace(/(['"])(?:(?!\1|\\).|\\.)*\1/g,o=>(n.push(o),`__STRING_LITERAL_${n.length-1}__`));const i=[];return a=a.replace(/\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*(?:\|[^'"\s,)]+)?/g,o=>(i.push(o),`__TRANSLATION_TOKEN_${i.length-1}__`)),a=a.replace(/([a-zA-Z_$][a-zA-Z0-9_$]*)\.(?!\?)/g,"$1?."),a=a.replace(/__TRANSLATION_TOKEN_(\d+)__/g,(o,d)=>i[parseInt(d,10)]),a=a.replace(/__STRING_LITERAL_(\d+)__/g,(o,d)=>n[parseInt(d,10)]),a}extractVariablesFromExpression(e){const n=new Set(["true","false","null","undefined","NaN","Infinity","if","else","for","while","do","switch","case","break","continue","return","function","class","const","let","var","new","delete","typeof","instanceof","this","super","import","export","default","try","catch","finally","throw","Math","Date","JSON","Array","Object","String","Number","Boolean","RegExp","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]),a=/(?<![.\w$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,i=new Set;let o;for(;(o=a.exec(e))!==null;){const d=o[1];n.has(d)||i.add(d)}return Array.from(i)}isSwitchExpression(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}resolveSwitch(e,n,a){const i={...a,skipCache:!0};let o;try{o=this.resolveBindings(e.$switch,n,i)?.toString()?.trim()??""}catch(g){go.warn("resolveSwitch: $switch 키 평가 실패:",e.$switch,g),o=""}let d;if(o&&e.$cases&&o in e.$cases)d=e.$cases[o];else if("$default"in e)d=e.$default;else return;return typeof d=="string"?d.includes("{{")?this.resolveBindings(d,n,i):d:d!==null&&typeof d=="object"?this.resolveObject(d,n,i):d}};H(ka,"BINDING_PATTERN",/\{\{([^}]+)\}\}/g),H(ka,"PATH_SEGMENT_PATTERN",/([^.[\]]+)|\[(\d+)\]/g),H(ka,"CACHE_EXPIRY",3e4);let _n=ka;new _n;const Gu={mobile:{min:0,max:767},tablet:{min:768,max:1023},desktop:{min:1024,max:1/0},portable:{min:0,max:1023}},tc=new Map;function NS(r,e){let n=null;return((...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{r(...a)},e)})}class ES{constructor(){H(this,"subscribers",new Set);H(this,"currentWidth",1024);H(this,"debouncedHandler",null);H(this,"isInitialized",!1);this.initialize()}initialize(){typeof window>"u"||(this.currentWidth=window.innerWidth,this.isInitialized=!0,this.debouncedHandler=NS(()=>{this.currentWidth=window.innerWidth,this.notifySubscribers()},150),window.addEventListener("resize",this.debouncedHandler))}notifySubscribers(){this.subscribers.forEach(e=>{e(this.currentWidth)})}subscribe(e){return this.subscribers.add(e),e(this.currentWidth),()=>{this.subscribers.delete(e)}}getWidth(){return this.currentWidth}parseRange(e){if(tc.has(e))return tc.get(e)??null;let n=null;if(Gu[e])n={...Gu[e]};else{const a=e.match(/^(-?\d*)-(-?\d*)$/);if(a){const[,i,o]=a,d=i===""?0:parseInt(i,10),g=o===""?1/0:parseInt(o,10);!isNaN(d)&&!isNaN(g)&&d<=g&&(n={min:d,max:g})}}return tc.set(e,n),n}getMatchingKey(e,n){const a=[];for(const i of Object.keys(e)){const o=this.parseRange(i);o&&n>=o.min&&n<=o.max&&a.push({key:i,range:o,isPreset:!!Gu[i]})}return a.length===0?null:(a.sort((i,o)=>{if(i.isPreset!==o.isPreset)return i.isPreset?1:-1;const d=i.range.max-i.range.min,g=o.range.max-o.range.min;return d-g}),a[0].key)}matches(e){const n=this.parseRange(e);return n?this.currentWidth>=n.min&&this.currentWidth<=n.max:!1}clearSubscribers(){this.subscribers.clear()}destroy(){this.debouncedHandler&&typeof window<"u"&&window.removeEventListener("resize",this.debouncedHandler),this.clearSubscribers(),tc.clear()}_setWidthForTesting(e){this.currentWidth=e,this.notifySubscribers()}}const ei=new ES,nc=at("ConditionEvaluator");function _S(r){switch(r){case"true":return{value:!0};case"false":return{value:!1};case"null":return{value:null};case"undefined":return{value:void 0};default:return}}function TS(r){return/[?:|&!+\-*/<>=()]/.test(r)}function AS(r){if(!r.startsWith("{{")||!r.endsWith("}}"))return null;const e=r.slice(2,-2);let n=null,a=0;for(let i=0;i<e.length;i++){const o=e[i];if((i>0?e[i-1]:"")!=="\\"&&((o==='"'||o==="'")&&!n?n=o:o===n&&(n=null),!n&&(o==="{"&&a++,o==="}"&&a--,a<0)))return null}return a===0?e.trim():null}function DS(r,e,n){if(!r)return!0;try{const a=AS(r);let i;if(a!==null){const o=_S(a);o!==void 0?i=o.value:TS(a)?i=n.evaluateExpression(a,e):i=n.resolve(a,e,{skipCache:!0})}else i=n.resolveBindings(r,e,{skipCache:!0});if(typeof i=="string"){const o=i.toLowerCase().trim();if(o==="false"||o==="0"||o===""||o==="null"||o==="undefined")return!1}return!!i}catch(a){return nc.warn(`evaluateStringCondition: 조건 평가 실패: ${r}`,a),!1}}function ac(r,e,n){if(typeof r=="string")return DS(r,e,n);if("and"in r){if(!Array.isArray(r.and)||r.and.length===0)return nc.warn("evaluateConditionExpression: AND 그룹이 비어있습니다"),!0;for(const a of r.and)if(!ac(a,e,n))return!1;return!0}if("or"in r){if(!Array.isArray(r.or)||r.or.length===0)return nc.warn("evaluateConditionExpression: OR 그룹이 비어있습니다"),!1;for(const a of r.or)if(ac(a,e,n))return!0;return!1}return nc.warn("evaluateConditionExpression: 알 수 없는 조건 형식",r),!1}function Wp(r,e,n){if(!Array.isArray(r)||r.length===0)return{matched:!1,branchIndex:-1};for(let a=0;a<r.length;a++){const i=r[a];if(i.if===void 0)return{matched:!0,branchIndex:a};if(ac(i.if,e,n))return{matched:!0,branchIndex:a}}return{matched:!1,branchIndex:-1}}function RS(r){return typeof r=="string"?!0:r&&typeof r=="object"?"and"in r||"or"in r:!1}function OS(r){if(!Array.isArray(r)||r.length===0)return!1;const e=r[0];return!e||typeof e!="object"?!1:"if"in e||"then"in e}const ts=at("RenderHelpers"),LS=new Map([["true",!0],["false",!1],["null",null]]);function Yp(){try{return window.G7Core?.devTools}catch{return}}const Jp=new _n;function Fu(r){return/[?:|&!+\-*/<>=()]/.test(r)}function Xp(r){if(!r.startsWith("{{")||!r.endsWith("}}"))return null;const e=r.slice(2,-2);let n=null,a=0;for(let i=0;i<e.length;i++){const o=e[i];if((i>0?e[i-1]:"")!=="\\"&&((o==='"'||o==="'")&&!n?n=o:o===n&&(n=null),!n&&(o==="{"&&a++,o==="}"&&a--,a<0)))return null}return a===0?e.trim():null}function Vu(r,e,n){let a=r;if(r.startsWith("{{")&&r.endsWith("}}")&&(a=r.slice(2,-2).trim()),Fu(a))try{return n.evaluateExpression(a,e)}catch(i){ts.warn(`resolveIterationSource: 표현식 평가 실패: ${r}`,i);return}return n.resolve(a,e,{skipCache:!0})}function MS(r,e){const n={...r};if(e?.parentDataContext)for(const[a,i]of Object.entries(e.parentDataContext))a in n||(n[a]=i);if(e?.state){const a=n._local||{};n._local={...a,...e.state}}return e?.isolatedContext?.state&&(n._isolated=e.isolatedContext.state),n}function Ku(r,e,n,a){if(!e||!Array.isArray(e)||e.length===0)return r;const i=a?.actionDispatcher??Fm(),o={...r,actions:e},d=i.bindActionsToProps(o,n,a?.componentContext);return delete d.actions,d}function Qp(r,e,n,a){if(typeof r=="boolean")return r;if(!r)return!0;try{const i=Xp(r);let o;if(i!==null){const d=LS.get(i);d!==void 0?o=d:Fu(i)?o=n.evaluateExpression(i,e):o=n.resolve(i,e,{skipCache:!0})}else o=n.resolveBindings(r,e,{skipCache:!0});if(typeof o=="string"){const d=o.toLowerCase().trim();if(d==="false"||d==="0"||d===""||d==="null"||d==="undefined")return!1}return!!o}catch(i){return ts.warn(`evaluateIfCondition: 조건 평가 실패 (컴포넌트: ${a||"unknown"}):`,i),!1}}function ti(r,e,n,a){if(r.if!==void 0)return Qp(r.if,e,n,a);if(r.condition!==void 0)return Qp(r.condition,e,n,a);if(r.conditions===void 0)return!0;const i=r.conditions;try{return RS(i)?ac(i,e,n):OS(i)?Wp(i,e,n).matched:(ts.warn(`evaluateRenderCondition: 알 수 없는 conditions 형식 (컴포넌트: ${a||"unknown"})`),!0)}catch(o){return ts.warn(`evaluateRenderCondition: conditions 평가 실패 (컴포넌트: ${a||"unknown"}):`,o),!1}}function Zp(r){if(!r.responsive)return r;const e=ei.getWidth(),n=ei.getMatchingKey(r.responsive,e);if(!n)return r;const a=r.responsive[n];return{...r,props:{...r.props,...a.props},children:a.children??r.children,text:a.text??r.text,if:a.if??r.if,iteration:a.iteration??r.iteration}}function ho(r,e,n,a,i){if(!r||r.length===0)return[];const o=i?.bindingEngine??new _n,d=i?.translationEngine??yr.getInstance(),g=i?.translationContext??{templateId:"",locale:"ko"},h=MS(e,i?.componentContext),f=(y,w)=>{if(typeof y=="string"){if(Fp(y))return Kp(y);if(Vp(y)){const C=[],k=y.replace(new RegExp(`${Zl}([^${lo}]*)${lo}`,"g"),(R,N)=>(C.push(N),`${Rs}${C.length-1}${Rs}`));let A=k;return/\$t:[a-zA-Z0-9._-]+/.test(k)&&(A=d.resolveTranslations(k,g,w)),A.replace(new RegExp(`${Rs}(\\d+)${Rs}`,"g"),(R,N)=>C[parseInt(N)])}if(y.startsWith("$t:defer:")){const C="$t:"+y.slice(9);return d.resolveTranslations(C,g,w)}if(y.startsWith("$t:"))return d.resolveTranslations(y,g,w);const v=Xp(y);if(v!==null){let C=!1,k=v;v.startsWith(Ds)&&(C=!0,k=v.slice(Ds.length));let A;if(Fu(k))try{A=o.evaluateExpression(k,w)}catch(R){ts.warn("renderItemChildren: 표현식 평가 실패:",R);return}else A=o.resolve(k,w,{skipCache:!0});return!C&&typeof A=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(A)&&(A=d.resolveTranslations(A,g,w)),C&&A!=null?uo(A):A}if(y.includes("{{")){const C=o.resolveBindings(y,w,{skipCache:!0});return typeof C=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(C)?d.resolveTranslations(C,g,w):C}return y}if(Array.isArray(y))return y.map(v=>f(v,w));if(y&&typeof y=="object"){const v={};for(const[C,k]of Object.entries(y))v[C]=f(k,w);return v}return y},p=(y,w)=>{if(!y)return{};const v={};for(const[C,k]of Object.entries(y))v[C]=f(k,w);return v},x=(y,w,v)=>{const C=Zp(y),k=C.iteration;if(!k)return[];const A=Vu(k.source,v,o);if(!Array.isArray(A))return ts.warn(`renderItemChildren: iteration.source가 배열이 아닙니다: ${k.source}`),[];const R=Yp();if(R?.isEnabled()){const D=`${w}-iteration`;R.trackIteration(D,k.source,k.item_var,k.index_var,A.length)}const N=n[C.name];return N?A.flatMap((D,M)=>{const L={...v,[k.item_var]:D,[`${k.item_var}_index`]:M,...k.index_var?{[k.index_var]:M}:{}},z=ti({if:C.if,condition:C.condition,conditions:C.conditions},L,o,C.id);if(C.if&&R?.isEnabled()){const le=`${w}-iter-${M}-if`;R.trackIfCondition(le,C.if,z,C.name)}if(!z)return[];const Y=C.id?String(f(C.id,L)):void 0,he=`${w}-iter-${M}`,be=i?.getRemountKey?i.getRemountKey(Y,he):he,X=p(C.props,L),ge=Ku(X,C.actions,L,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let xe=null;return C.text!==void 0?xe=f(C.text,L):C.children&&C.children.length>0&&(xe=ho(C.children,L,n,be,i)),R?.isEnabled()&&R.trackRender(C.name),[Fe.createElement(N,{key:be,...ge},xe)]}):(ts.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${C.name}`),[])};return r.flatMap((y,w)=>{const v=Zp(y),C=v.id?String(f(v.id,h)):void 0,k=a?`${a}-${C||w}`:C||`child-${w}`,A=i?.getRemountKey?i.getRemountKey(C,k):k;if(v.iteration)return x(v,A,h);const R=ti({if:v.if,condition:v.condition,conditions:v.conditions},h,o,v.id),N=Yp();if(v.if&&N?.isEnabled()){const Y=`${A}-if`;N.trackIfCondition(Y,v.if,R,v.name)}if(!R)return[];const D=n[v.name];if(!D)return ts.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${v.name}`),[];const M=p(v.props,h),L=Ku(M,v.actions,h,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let z=null;return v.text!==void 0?z=f(v.text,h):v.children&&v.children.length>0&&(z=ho(v.children,h,n,A,i)),N?.isEnabled()&&N.trackRender(v.name),[Fe.createElement(D,{key:A,...L},z)]})}function sc(r,e,n,a){let i,o;return n instanceof _n?(i=n,o=a):(i=Jp,o=n),i.resolveBindings(r,e,o)}function $S(r,e,n,a){const i=n??Jp,o={skipCache:!0,...a};let d;try{d=i.resolveBindings(r.key,e,{skipCache:o.skipCache})?.toString()?.trim()??""}catch(f){ts.warn("resolveClassMap: key 평가 실패:",r.key,f),d=""}let g="";d&&r.variants&&d in r.variants?g=r.variants[d]:r.default&&(g=r.default);const h=[];return r.base?.trim()&&h.push(r.base.trim()),g?.trim()&&h.push(g.trim()),h.join(" ")}function em(r,e){return function(){return r.apply(e,arguments)}}const{toString:IS}=Object.prototype,{getPrototypeOf:Wu}=Object,{iterator:rc,toStringTag:tm}=Symbol,ic=(r=>e=>{const n=IS.call(e);return r[n]||(r[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),xa=r=>(r=r.toLowerCase(),e=>ic(e)===r),oc=r=>e=>typeof e===r,{isArray:ni}=Array,ai=oc("undefined");function fo(r){return r!==null&&!ai(r)&&r.constructor!==null&&!ai(r.constructor)&&On(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const nm=xa("ArrayBuffer");function zS(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&nm(r.buffer),e}const HS=oc("string"),On=oc("function"),am=oc("number"),po=r=>r!==null&&typeof r=="object",PS=r=>r===!0||r===!1,lc=r=>{if(ic(r)!=="object")return!1;const e=Wu(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(tm in r)&&!(rc in r)},US=r=>{if(!po(r)||fo(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},BS=xa("Date"),qS=xa("File"),GS=xa("Blob"),FS=xa("FileList"),VS=r=>po(r)&&On(r.pipe),KS=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||On(r.append)&&((e=ic(r))==="formdata"||e==="object"&&On(r.toString)&&r.toString()==="[object FormData]"))},WS=xa("URLSearchParams"),[YS,JS,XS,QS]=["ReadableStream","Request","Response","Headers"].map(xa),ZS=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mo(r,e,{allOwnKeys:n=!1}={}){if(r===null||typeof r>"u")return;let a,i;if(typeof r!="object"&&(r=[r]),ni(r))for(a=0,i=r.length;a<i;a++)e.call(null,r[a],a,r);else{if(fo(r))return;const o=n?Object.getOwnPropertyNames(r):Object.keys(r),d=o.length;let g;for(a=0;a<d;a++)g=o[a],e.call(null,r[g],g,r)}}function sm(r,e){if(fo(r))return null;e=e.toLowerCase();const n=Object.keys(r);let a=n.length,i;for(;a-- >0;)if(i=n[a],e===i.toLowerCase())return i;return null}const xr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,rm=r=>!ai(r)&&r!==xr;function Yu(){const{caseless:r,skipUndefined:e}=rm(this)&&this||{},n={},a=(i,o)=>{const d=r&&sm(n,o)||o;lc(n[d])&&lc(i)?n[d]=Yu(n[d],i):lc(i)?n[d]=Yu({},i):ni(i)?n[d]=i.slice():(!e||!ai(i))&&(n[d]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&mo(arguments[i],a);return n}const ew=(r,e,n,{allOwnKeys:a}={})=>(mo(e,(i,o)=>{n&&On(i)?r[o]=em(i,n):r[o]=i},{allOwnKeys:a}),r),tw=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),nw=(r,e,n,a)=>{r.prototype=Object.create(e.prototype,a),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),n&&Object.assign(r.prototype,n)},aw=(r,e,n,a)=>{let i,o,d;const g={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),o=i.length;o-- >0;)d=i[o],(!a||a(d,r,e))&&!g[d]&&(e[d]=r[d],g[d]=!0);r=n!==!1&&Wu(r)}while(r&&(!n||n(r,e))&&r!==Object.prototype);return e},sw=(r,e,n)=>{r=String(r),(n===void 0||n>r.length)&&(n=r.length),n-=e.length;const a=r.indexOf(e,n);return a!==-1&&a===n},rw=r=>{if(!r)return null;if(ni(r))return r;let e=r.length;if(!am(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=r[e];return n},iw=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Wu(Uint8Array)),ow=(r,e)=>{const a=(r&&r[rc]).call(r);let i;for(;(i=a.next())&&!i.done;){const o=i.value;e.call(r,o[0],o[1])}},lw=(r,e)=>{let n;const a=[];for(;(n=r.exec(e))!==null;)a.push(n);return a},cw=xa("HTMLFormElement"),dw=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,a,i){return a.toUpperCase()+i}),im=(({hasOwnProperty:r})=>(e,n)=>r.call(e,n))(Object.prototype),uw=xa("RegExp"),om=(r,e)=>{const n=Object.getOwnPropertyDescriptors(r),a={};mo(n,(i,o)=>{let d;(d=e(i,o,r))!==!1&&(a[o]=d||i)}),Object.defineProperties(r,a)},gw=r=>{om(r,(e,n)=>{if(On(r)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const a=r[n];if(On(a)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},hw=(r,e)=>{const n={},a=i=>{i.forEach(o=>{n[o]=!0})};return ni(r)?a(r):a(String(r).split(e)),n},fw=()=>{},pw=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function mw(r){return!!(r&&On(r.append)&&r[tm]==="FormData"&&r[rc])}const yw=r=>{const e=new Array(10),n=(a,i)=>{if(po(a)){if(e.indexOf(a)>=0)return;if(fo(a))return a;if(!("toJSON"in a)){e[i]=a;const o=ni(a)?[]:{};return mo(a,(d,g)=>{const h=n(d,i+1);!ai(h)&&(o[g]=h)}),e[i]=void 0,o}}return a};return n(r,0)},xw=xa("AsyncFunction"),bw=r=>r&&(po(r)||On(r))&&On(r.then)&&On(r.catch),lm=((r,e)=>r?setImmediate:e?((n,a)=>(xr.addEventListener("message",({source:i,data:o})=>{i===xr&&o===n&&a.length&&a.shift()()},!1),i=>{a.push(i),xr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",On(xr.postMessage)),vw=typeof queueMicrotask<"u"?queueMicrotask.bind(xr):typeof process<"u"&&process.nextTick||lm,re={isArray:ni,isArrayBuffer:nm,isBuffer:fo,isFormData:KS,isArrayBufferView:zS,isString:HS,isNumber:am,isBoolean:PS,isObject:po,isPlainObject:lc,isEmptyObject:US,isReadableStream:YS,isRequest:JS,isResponse:XS,isHeaders:QS,isUndefined:ai,isDate:BS,isFile:qS,isBlob:GS,isRegExp:uw,isFunction:On,isStream:VS,isURLSearchParams:WS,isTypedArray:iw,isFileList:FS,forEach:mo,merge:Yu,extend:ew,trim:ZS,stripBOM:tw,inherits:nw,toFlatObject:aw,kindOf:ic,kindOfTest:xa,endsWith:sw,toArray:rw,forEachEntry:ow,matchAll:lw,isHTMLForm:cw,hasOwnProperty:im,hasOwnProp:im,reduceDescriptors:om,freezeMethods:gw,toObjectSet:hw,toCamelCase:dw,noop:fw,toFiniteNumber:pw,findKey:sm,global:xr,isContextDefined:rm,isSpecCompliantForm:mw,toJSONObject:yw,isAsyncFn:xw,isThenable:bw,setImmediate:lm,asap:vw,isIterable:r=>r!=null&&On(r[rc])};function et(r,e,n,a,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),a&&(this.request=a),i&&(this.response=i,this.status=i.status?i.status:null)}re.inherits(et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const cm=et.prototype,dm={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{dm[r]={value:r}}),Object.defineProperties(et,dm),Object.defineProperty(cm,"isAxiosError",{value:!0}),et.from=(r,e,n,a,i,o)=>{const d=Object.create(cm);re.toFlatObject(r,d,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const g=r&&r.message?r.message:"Error",h=e==null&&r?r.code:e;return et.call(d,g,h,n,a,i),r&&d.cause==null&&Object.defineProperty(d,"cause",{value:r,configurable:!0}),d.name=r&&r.name||"Error",o&&Object.assign(d,o),d};const Sw=null;function Ju(r){return re.isPlainObject(r)||re.isArray(r)}function um(r){return re.endsWith(r,"[]")?r.slice(0,-2):r}function gm(r,e,n){return r?r.concat(e).map(function(i,o){return i=um(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function ww(r){return re.isArray(r)&&!r.some(Ju)}const Cw=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function cc(r,e,n){if(!re.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,n=re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,k){return!re.isUndefined(k[C])});const a=n.metaTokens,i=n.visitor||p,o=n.dots,d=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(re.isDate(v))return v.toISOString();if(re.isBoolean(v))return v.toString();if(!h&&re.isBlob(v))throw new et("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(v)||re.isTypedArray(v)?h&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function p(v,C,k){let A=v;if(v&&!k&&typeof v=="object"){if(re.endsWith(C,"{}"))C=a?C:C.slice(0,-2),v=JSON.stringify(v);else if(re.isArray(v)&&ww(v)||(re.isFileList(v)||re.endsWith(C,"[]"))&&(A=re.toArray(v)))return C=um(C),A.forEach(function(N,D){!(re.isUndefined(N)||N===null)&&e.append(d===!0?gm([C],D,o):d===null?C:C+"[]",f(N))}),!1}return Ju(v)?!0:(e.append(gm(k,C,o),f(v)),!1)}const x=[],y=Object.assign(Cw,{defaultVisitor:p,convertValue:f,isVisitable:Ju});function w(v,C){if(!re.isUndefined(v)){if(x.indexOf(v)!==-1)throw Error("Circular reference detected in "+C.join("."));x.push(v),re.forEach(v,function(A,R){(!(re.isUndefined(A)||A===null)&&i.call(e,A,re.isString(R)?R.trim():R,C,y))===!0&&w(A,C?C.concat(R):[R])}),x.pop()}}if(!re.isObject(r))throw new TypeError("data must be an object");return w(r),e}function hm(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(a){return e[a]})}function Xu(r,e){this._pairs=[],r&&cc(r,this,e)}const fm=Xu.prototype;fm.append=function(e,n){this._pairs.push([e,n])},fm.toString=function(e){const n=e?function(a){return e.call(this,a,hm)}:hm;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function jw(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function pm(r,e,n){if(!e)return r;const a=n&&n.encode||jw;re.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=re.isURLSearchParams(e)?e.toString():new Xu(e,n).toString(a),o){const d=r.indexOf("#");d!==-1&&(r=r.slice(0,d)),r+=(r.indexOf("?")===-1?"?":"&")+o}return r}class mm{constructor(){this.handlers=[]}use(e,n,a){return this.handlers.push({fulfilled:e,rejected:n,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(a){a!==null&&e(a)})}}const ym={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},kw={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Xu,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Qu=typeof window<"u"&&typeof document<"u",Zu=typeof navigator=="object"&&navigator||void 0,Nw=Qu&&(!Zu||["ReactNative","NativeScript","NS"].indexOf(Zu.product)<0),Ew=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_w=Qu&&window.location.href||"http://localhost",Nn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Qu,hasStandardBrowserEnv:Nw,hasStandardBrowserWebWorkerEnv:Ew,navigator:Zu,origin:_w},Symbol.toStringTag,{value:"Module"})),...kw};function Tw(r,e){return cc(r,new Nn.classes.URLSearchParams,{visitor:function(n,a,i,o){return Nn.isNode&&re.isBuffer(n)?(this.append(a,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Aw(r){return re.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Dw(r){const e={},n=Object.keys(r);let a;const i=n.length;let o;for(a=0;a<i;a++)o=n[a],e[o]=r[o];return e}function xm(r){function e(n,a,i,o){let d=n[o++];if(d==="__proto__")return!0;const g=Number.isFinite(+d),h=o>=n.length;return d=!d&&re.isArray(i)?i.length:d,h?(re.hasOwnProp(i,d)?i[d]=[i[d],a]:i[d]=a,!g):((!i[d]||!re.isObject(i[d]))&&(i[d]=[]),e(n,a,i[d],o)&&re.isArray(i[d])&&(i[d]=Dw(i[d])),!g)}if(re.isFormData(r)&&re.isFunction(r.entries)){const n={};return re.forEachEntry(r,(a,i)=>{e(Aw(a),i,n,0)}),n}return null}function Rw(r,e,n){if(re.isString(r))try{return(e||JSON.parse)(r),re.trim(r)}catch(a){if(a.name!=="SyntaxError")throw a}return(n||JSON.stringify)(r)}const yo={transitional:ym,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const a=n.getContentType()||"",i=a.indexOf("application/json")>-1,o=re.isObject(e);if(o&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(xm(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let g;if(o){if(a.indexOf("application/x-www-form-urlencoded")>-1)return Tw(e,this.formSerializer).toString();if((g=re.isFileList(e))||a.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return cc(g?{"files[]":e}:e,h&&new h,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),Rw(e)):e}],transformResponse:[function(e){const n=this.transitional||yo.transitional,a=n&&n.forcedJSONParsing,i=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(a&&!this.responseType||i)){const d=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(g){if(d)throw g.name==="SyntaxError"?et.from(g,et.ERR_BAD_RESPONSE,this,null,this.response):g}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Nn.classes.FormData,Blob:Nn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],r=>{yo.headers[r]={}});const Ow=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Lw=r=>{const e={};let n,a,i;return r&&r.split(`
`).forEach(function(d){i=d.indexOf(":"),n=d.substring(0,i).trim().toLowerCase(),a=d.substring(i+1).trim(),!(!n||e[n]&&Ow[n])&&(n==="set-cookie"?e[n]?e[n].push(a):e[n]=[a]:e[n]=e[n]?e[n]+", "+a:a)}),e},bm=Symbol("internals");function xo(r){return r&&String(r).trim().toLowerCase()}function dc(r){return r===!1||r==null?r:re.isArray(r)?r.map(dc):String(r)}function Mw(r){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(r);)e[a[1]]=a[2];return e}const $w=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function eg(r,e,n,a,i){if(re.isFunction(a))return a.call(this,e,n);if(i&&(e=n),!!re.isString(e)){if(re.isString(a))return e.indexOf(a)!==-1;if(re.isRegExp(a))return a.test(e)}}function Iw(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,a)=>n.toUpperCase()+a)}function zw(r,e){const n=re.toCamelCase(" "+e);["get","set","has"].forEach(a=>{Object.defineProperty(r,a+n,{value:function(i,o,d){return this[a].call(this,e,i,o,d)},configurable:!0})})}let Ln=class{constructor(e){e&&this.set(e)}set(e,n,a){const i=this;function o(g,h,f){const p=xo(h);if(!p)throw new Error("header name must be a non-empty string");const x=re.findKey(i,p);(!x||i[x]===void 0||f===!0||f===void 0&&i[x]!==!1)&&(i[x||h]=dc(g))}const d=(g,h)=>re.forEach(g,(f,p)=>o(f,p,h));if(re.isPlainObject(e)||e instanceof this.constructor)d(e,n);else if(re.isString(e)&&(e=e.trim())&&!$w(e))d(Lw(e),n);else if(re.isObject(e)&&re.isIterable(e)){let g={},h,f;for(const p of e){if(!re.isArray(p))throw TypeError("Object iterator must return a key-value pair");g[f=p[0]]=(h=g[f])?re.isArray(h)?[...h,p[1]]:[h,p[1]]:p[1]}d(g,n)}else e!=null&&o(n,e,a);return this}get(e,n){if(e=xo(e),e){const a=re.findKey(this,e);if(a){const i=this[a];if(!n)return i;if(n===!0)return Mw(i);if(re.isFunction(n))return n.call(this,i,a);if(re.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=xo(e),e){const a=re.findKey(this,e);return!!(a&&this[a]!==void 0&&(!n||eg(this,this[a],a,n)))}return!1}delete(e,n){const a=this;let i=!1;function o(d){if(d=xo(d),d){const g=re.findKey(a,d);g&&(!n||eg(a,a[g],g,n))&&(delete a[g],i=!0)}}return re.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let a=n.length,i=!1;for(;a--;){const o=n[a];(!e||eg(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,a={};return re.forEach(this,(i,o)=>{const d=re.findKey(a,o);if(d){n[d]=dc(i),delete n[o];return}const g=e?Iw(o):String(o).trim();g!==o&&delete n[o],n[g]=dc(i),a[g]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return re.forEach(this,(a,i)=>{a!=null&&a!==!1&&(n[i]=e&&re.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const a=new this(e);return n.forEach(i=>a.set(i)),a}static accessor(e){const a=(this[bm]=this[bm]={accessors:{}}).accessors,i=this.prototype;function o(d){const g=xo(d);a[g]||(zw(i,d),a[g]=!0)}return re.isArray(e)?e.forEach(o):o(e),this}};Ln.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(Ln.prototype,({value:r},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(a){this[n]=a}}}),re.freezeMethods(Ln);function tg(r,e){const n=this||yo,a=e||n,i=Ln.from(a.headers);let o=a.data;return re.forEach(r,function(g){o=g.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function vm(r){return!!(r&&r.__CANCEL__)}function si(r,e,n){et.call(this,r??"canceled",et.ERR_CANCELED,e,n),this.name="CanceledError"}re.inherits(si,et,{__CANCEL__:!0});function Sm(r,e,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?r(n):e(new et("Request failed with status code "+n.status,[et.ERR_BAD_REQUEST,et.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Hw(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function Pw(r,e){r=r||10;const n=new Array(r),a=new Array(r);let i=0,o=0,d;return e=e!==void 0?e:1e3,function(h){const f=Date.now(),p=a[o];d||(d=f),n[i]=h,a[i]=f;let x=o,y=0;for(;x!==i;)y+=n[x++],x=x%r;if(i=(i+1)%r,i===o&&(o=(o+1)%r),f-d<e)return;const w=p&&f-p;return w?Math.round(y*1e3/w):void 0}}function Uw(r,e){let n=0,a=1e3/e,i,o;const d=(f,p=Date.now())=>{n=p,i=null,o&&(clearTimeout(o),o=null),r(...f)};return[(...f)=>{const p=Date.now(),x=p-n;x>=a?d(f,p):(i=f,o||(o=setTimeout(()=>{o=null,d(i)},a-x)))},()=>i&&d(i)]}const uc=(r,e,n=3)=>{let a=0;const i=Pw(50,250);return Uw(o=>{const d=o.loaded,g=o.lengthComputable?o.total:void 0,h=d-a,f=i(h),p=d<=g;a=d;const x={loaded:d,total:g,progress:g?d/g:void 0,bytes:h,rate:f||void 0,estimated:f&&g&&p?(g-d)/f:void 0,event:o,lengthComputable:g!=null,[e?"download":"upload"]:!0};r(x)},n)},wm=(r,e)=>{const n=r!=null;return[a=>e[0]({lengthComputable:n,total:r,loaded:a}),e[1]]},Cm=r=>(...e)=>re.asap(()=>r(...e)),Bw=Nn.hasStandardBrowserEnv?((r,e)=>n=>(n=new URL(n,Nn.origin),r.protocol===n.protocol&&r.host===n.host&&(e||r.port===n.port)))(new URL(Nn.origin),Nn.navigator&&/(msie|trident)/i.test(Nn.navigator.userAgent)):()=>!0,qw=Nn.hasStandardBrowserEnv?{write(r,e,n,a,i,o){const d=[r+"="+encodeURIComponent(e)];re.isNumber(n)&&d.push("expires="+new Date(n).toGMTString()),re.isString(a)&&d.push("path="+a),re.isString(i)&&d.push("domain="+i),o===!0&&d.push("secure"),document.cookie=d.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Gw(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Fw(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function jm(r,e,n){let a=!Gw(e);return r&&(a||n==!1)?Fw(r,e):e}const km=r=>r instanceof Ln?{...r}:r;function br(r,e){e=e||{};const n={};function a(f,p,x,y){return re.isPlainObject(f)&&re.isPlainObject(p)?re.merge.call({caseless:y},f,p):re.isPlainObject(p)?re.merge({},p):re.isArray(p)?p.slice():p}function i(f,p,x,y){if(re.isUndefined(p)){if(!re.isUndefined(f))return a(void 0,f,x,y)}else return a(f,p,x,y)}function o(f,p){if(!re.isUndefined(p))return a(void 0,p)}function d(f,p){if(re.isUndefined(p)){if(!re.isUndefined(f))return a(void 0,f)}else return a(void 0,p)}function g(f,p,x){if(x in e)return a(f,p);if(x in r)return a(void 0,f)}const h={url:o,method:o,data:o,baseURL:d,transformRequest:d,transformResponse:d,paramsSerializer:d,timeout:d,timeoutMessage:d,withCredentials:d,withXSRFToken:d,adapter:d,responseType:d,xsrfCookieName:d,xsrfHeaderName:d,onUploadProgress:d,onDownloadProgress:d,decompress:d,maxContentLength:d,maxBodyLength:d,beforeRedirect:d,transport:d,httpAgent:d,httpsAgent:d,cancelToken:d,socketPath:d,responseEncoding:d,validateStatus:g,headers:(f,p,x)=>i(km(f),km(p),x,!0)};return re.forEach(Object.keys({...r,...e}),function(p){const x=h[p]||i,y=x(r[p],e[p],p);re.isUndefined(y)&&x!==g||(n[p]=y)}),n}const Nm=r=>{const e=br({},r);let{data:n,withXSRFToken:a,xsrfHeaderName:i,xsrfCookieName:o,headers:d,auth:g}=e;if(e.headers=d=Ln.from(d),e.url=pm(jm(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),g&&d.set("Authorization","Basic "+btoa((g.username||"")+":"+(g.password?unescape(encodeURIComponent(g.password)):""))),re.isFormData(n)){if(Nn.hasStandardBrowserEnv||Nn.hasStandardBrowserWebWorkerEnv)d.setContentType(void 0);else if(re.isFunction(n.getHeaders)){const h=n.getHeaders(),f=["content-type","content-length"];Object.entries(h).forEach(([p,x])=>{f.includes(p.toLowerCase())&&d.set(p,x)})}}if(Nn.hasStandardBrowserEnv&&(a&&re.isFunction(a)&&(a=a(e)),a||a!==!1&&Bw(e.url))){const h=i&&o&&qw.read(o);h&&d.set(i,h)}return e},Vw=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(n,a){const i=Nm(r);let o=i.data;const d=Ln.from(i.headers).normalize();let{responseType:g,onUploadProgress:h,onDownloadProgress:f}=i,p,x,y,w,v;function C(){w&&w(),v&&v(),i.cancelToken&&i.cancelToken.unsubscribe(p),i.signal&&i.signal.removeEventListener("abort",p)}let k=new XMLHttpRequest;k.open(i.method.toUpperCase(),i.url,!0),k.timeout=i.timeout;function A(){if(!k)return;const N=Ln.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),M={data:!g||g==="text"||g==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:N,config:r,request:k};Sm(function(z){n(z),C()},function(z){a(z),C()},M),k=null}"onloadend"in k?k.onloadend=A:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(A)},k.onabort=function(){k&&(a(new et("Request aborted",et.ECONNABORTED,r,k)),k=null)},k.onerror=function(D){const M=D&&D.message?D.message:"Network Error",L=new et(M,et.ERR_NETWORK,r,k);L.event=D||null,a(L),k=null},k.ontimeout=function(){let D=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const M=i.transitional||ym;i.timeoutErrorMessage&&(D=i.timeoutErrorMessage),a(new et(D,M.clarifyTimeoutError?et.ETIMEDOUT:et.ECONNABORTED,r,k)),k=null},o===void 0&&d.setContentType(null),"setRequestHeader"in k&&re.forEach(d.toJSON(),function(D,M){k.setRequestHeader(M,D)}),re.isUndefined(i.withCredentials)||(k.withCredentials=!!i.withCredentials),g&&g!=="json"&&(k.responseType=i.responseType),f&&([y,v]=uc(f,!0),k.addEventListener("progress",y)),h&&k.upload&&([x,w]=uc(h),k.upload.addEventListener("progress",x),k.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(p=N=>{k&&(a(!N||N.type?new si(null,r,k):N),k.abort(),k=null)},i.cancelToken&&i.cancelToken.subscribe(p),i.signal&&(i.signal.aborted?p():i.signal.addEventListener("abort",p)));const R=Hw(i.url);if(R&&Nn.protocols.indexOf(R)===-1){a(new et("Unsupported protocol "+R+":",et.ERR_BAD_REQUEST,r));return}k.send(o||null)})},Kw=(r,e)=>{const{length:n}=r=r?r.filter(Boolean):[];if(e||n){let a=new AbortController,i;const o=function(f){if(!i){i=!0,g();const p=f instanceof Error?f:this.reason;a.abort(p instanceof et?p:new si(p instanceof Error?p.message:p))}};let d=e&&setTimeout(()=>{d=null,o(new et(`timeout ${e} of ms exceeded`,et.ETIMEDOUT))},e);const g=()=>{r&&(d&&clearTimeout(d),d=null,r.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),r=null)};r.forEach(f=>f.addEventListener("abort",o));const{signal:h}=a;return h.unsubscribe=()=>re.asap(g),h}},Ww=function*(r,e){let n=r.byteLength;if(n<e){yield r;return}let a=0,i;for(;a<n;)i=a+e,yield r.slice(a,i),a=i},Yw=async function*(r,e){for await(const n of Jw(r))yield*Ww(n,e)},Jw=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:n,value:a}=await e.read();if(n)break;yield a}}finally{await e.cancel()}},Em=(r,e,n,a)=>{const i=Yw(r,e);let o=0,d,g=h=>{d||(d=!0,a&&a(h))};return new ReadableStream({async pull(h){try{const{done:f,value:p}=await i.next();if(f){g(),h.close();return}let x=p.byteLength;if(n){let y=o+=x;n(y)}h.enqueue(new Uint8Array(p))}catch(f){throw g(f),f}},cancel(h){return g(h),i.return()}},{highWaterMark:2})},_m=64*1024,{isFunction:gc}=re,Xw=(({Request:r,Response:e})=>({Request:r,Response:e}))(re.global),{ReadableStream:Tm,TextEncoder:Am}=re.global,Dm=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Qw=r=>{r=re.merge.call({skipUndefined:!0},Xw,r);const{fetch:e,Request:n,Response:a}=r,i=e?gc(e):typeof fetch=="function",o=gc(n),d=gc(a);if(!i)return!1;const g=i&&gc(Tm),h=i&&(typeof Am=="function"?(v=>C=>v.encode(C))(new Am):async v=>new Uint8Array(await new n(v).arrayBuffer())),f=o&&g&&Dm(()=>{let v=!1;const C=new n(Nn.origin,{body:new Tm,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!C}),p=d&&g&&Dm(()=>re.isReadableStream(new a("").body)),x={stream:p&&(v=>v.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!x[v]&&(x[v]=(C,k)=>{let A=C&&C[v];if(A)return A.call(C);throw new et(`Response type '${v}' is not supported`,et.ERR_NOT_SUPPORT,k)})});const y=async v=>{if(v==null)return 0;if(re.isBlob(v))return v.size;if(re.isSpecCompliantForm(v))return(await new n(Nn.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(re.isArrayBufferView(v)||re.isArrayBuffer(v))return v.byteLength;if(re.isURLSearchParams(v)&&(v=v+""),re.isString(v))return(await h(v)).byteLength},w=async(v,C)=>{const k=re.toFiniteNumber(v.getContentLength());return k??y(C)};return async v=>{let{url:C,method:k,data:A,signal:R,cancelToken:N,timeout:D,onDownloadProgress:M,onUploadProgress:L,responseType:z,headers:Y,withCredentials:he="same-origin",fetchOptions:be}=Nm(v),X=e||fetch;z=z?(z+"").toLowerCase():"text";let ge=Kw([R,N&&N.toAbortSignal()],D),xe=null;const le=ge&&ge.unsubscribe&&(()=>{ge.unsubscribe()});let je;try{if(L&&f&&k!=="get"&&k!=="head"&&(je=await w(Y,A))!==0){let U=new n(C,{method:"POST",body:A,duplex:"half"}),q;if(re.isFormData(A)&&(q=U.headers.get("content-type"))&&Y.setContentType(q),U.body){const[ie,se]=wm(je,uc(Cm(L)));A=Em(U.body,_m,ie,se)}}re.isString(he)||(he=he?"include":"omit");const J=o&&"credentials"in n.prototype,F={...be,signal:ge,method:k.toUpperCase(),headers:Y.normalize().toJSON(),body:A,duplex:"half",credentials:J?he:void 0};xe=o&&new n(C,F);let Q=await(o?X(xe,be):X(C,F));const pe=p&&(z==="stream"||z==="response");if(p&&(M||pe&&le)){const U={};["status","statusText","headers"].forEach(we=>{U[we]=Q[we]});const q=re.toFiniteNumber(Q.headers.get("content-length")),[ie,se]=M&&wm(q,uc(Cm(M),!0))||[];Q=new a(Em(Q.body,_m,ie,()=>{se&&se(),le&&le()}),U)}z=z||"text";let $=await x[re.findKey(x,z)||"text"](Q,v);return!pe&&le&&le(),await new Promise((U,q)=>{Sm(U,q,{data:$,headers:Ln.from(Q.headers),status:Q.status,statusText:Q.statusText,config:v,request:xe})})}catch(J){throw le&&le(),J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new et("Network Error",et.ERR_NETWORK,v,xe),{cause:J.cause||J}):et.from(J,J&&J.code,v,xe)}}},Zw=new Map,Rm=r=>{let e=r?r.env:{};const{fetch:n,Request:a,Response:i}=e,o=[a,i,n];let d=o.length,g=d,h,f,p=Zw;for(;g--;)h=o[g],f=p.get(h),f===void 0&&p.set(h,f=g?new Map:Qw(e)),p=f;return f};Rm();const ng={http:Sw,xhr:Vw,fetch:{get:Rm}};re.forEach(ng,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const Om=r=>`- ${r}`,e7=r=>re.isFunction(r)||r===null||r===!1,Lm={getAdapter:(r,e)=>{r=re.isArray(r)?r:[r];const{length:n}=r;let a,i;const o={};for(let d=0;d<n;d++){a=r[d];let g;if(i=a,!e7(a)&&(i=ng[(g=String(a)).toLowerCase()],i===void 0))throw new et(`Unknown adapter '${g}'`);if(i&&(re.isFunction(i)||(i=i.get(e))))break;o[g||"#"+d]=i}if(!i){const d=Object.entries(o).map(([h,f])=>`adapter ${h} `+(f===!1?"is not supported by the environment":"is not available in the build"));let g=n?d.length>1?`since :
`+d.map(Om).join(`
`):" "+Om(d[0]):"as no adapter specified";throw new et("There is no suitable adapter to dispatch the request "+g,"ERR_NOT_SUPPORT")}return i},adapters:ng};function ag(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new si(null,r)}function Mm(r){return ag(r),r.headers=Ln.from(r.headers),r.data=tg.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Lm.getAdapter(r.adapter||yo.adapter,r)(r).then(function(a){return ag(r),a.data=tg.call(r,r.transformResponse,a),a.headers=Ln.from(a.headers),a},function(a){return vm(a)||(ag(r),a&&a.response&&(a.response.data=tg.call(r,r.transformResponse,a.response),a.response.headers=Ln.from(a.response.headers))),Promise.reject(a)})}const $m="1.12.2",hc={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{hc[r]=function(a){return typeof a===r||"a"+(e<1?"n ":" ")+r}});const Im={};hc.transitional=function(e,n,a){function i(o,d){return"[Axios v"+$m+"] Transitional option '"+o+"'"+d+(a?". "+a:"")}return(o,d,g)=>{if(e===!1)throw new et(i(d," has been removed"+(n?" in "+n:"")),et.ERR_DEPRECATED);return n&&!Im[d]&&(Im[d]=!0,console.warn(i(d," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,d,g):!0}},hc.spelling=function(e){return(n,a)=>(console.warn(`${a} is likely a misspelling of ${e}`),!0)};function t7(r,e,n){if(typeof r!="object")throw new et("options must be an object",et.ERR_BAD_OPTION_VALUE);const a=Object.keys(r);let i=a.length;for(;i-- >0;){const o=a[i],d=e[o];if(d){const g=r[o],h=g===void 0||d(g,o,r);if(h!==!0)throw new et("option "+o+" must be "+h,et.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new et("Unknown option "+o,et.ERR_BAD_OPTION)}}const fc={assertOptions:t7,validators:hc},Ha=fc.validators;let vr=class{constructor(e){this.defaults=e||{},this.interceptors={request:new mm,response:new mm}}async request(e,n){try{return await this._request(e,n)}catch(a){if(a instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{a.stack?o&&!String(a.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(a.stack+=`
`+o):a.stack=o}catch{}}throw a}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=br(this.defaults,n);const{transitional:a,paramsSerializer:i,headers:o}=n;a!==void 0&&fc.assertOptions(a,{silentJSONParsing:Ha.transitional(Ha.boolean),forcedJSONParsing:Ha.transitional(Ha.boolean),clarifyTimeoutError:Ha.transitional(Ha.boolean)},!1),i!=null&&(re.isFunction(i)?n.paramsSerializer={serialize:i}:fc.assertOptions(i,{encode:Ha.function,serialize:Ha.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),fc.assertOptions(n,{baseUrl:Ha.spelling("baseURL"),withXsrfToken:Ha.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let d=o&&re.merge(o.common,o[n.method]);o&&re.forEach(["delete","get","head","post","put","patch","common"],v=>{delete o[v]}),n.headers=Ln.concat(d,o);const g=[];let h=!0;this.interceptors.request.forEach(function(C){typeof C.runWhen=="function"&&C.runWhen(n)===!1||(h=h&&C.synchronous,g.unshift(C.fulfilled,C.rejected))});const f=[];this.interceptors.response.forEach(function(C){f.push(C.fulfilled,C.rejected)});let p,x=0,y;if(!h){const v=[Mm.bind(this),void 0];for(v.unshift(...g),v.push(...f),y=v.length,p=Promise.resolve(n);x<y;)p=p.then(v[x++],v[x++]);return p}y=g.length;let w=n;for(;x<y;){const v=g[x++],C=g[x++];try{w=v(w)}catch(k){C.call(this,k);break}}try{p=Mm.call(this,w)}catch(v){return Promise.reject(v)}for(x=0,y=f.length;x<y;)p=p.then(f[x++],f[x++]);return p}getUri(e){e=br(this.defaults,e);const n=jm(e.baseURL,e.url,e.allowAbsoluteUrls);return pm(n,e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){vr.prototype[e]=function(n,a){return this.request(br(a||{},{method:e,url:n,data:(a||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function n(a){return function(o,d,g){return this.request(br(g||{},{method:e,headers:a?{"Content-Type":"multipart/form-data"}:{},url:o,data:d}))}}vr.prototype[e]=n(),vr.prototype[e+"Form"]=n(!0)});let n7=class hS{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const a=this;this.promise.then(i=>{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](i);a._listeners=null}),this.promise.then=i=>{let o;const d=new Promise(g=>{a.subscribe(g),o=g}).then(i);return d.cancel=function(){a.unsubscribe(o)},d},e(function(o,d,g){a.reason||(a.reason=new si(o,d,g),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=a=>{e.abort(a)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new hS(function(i){e=i}),cancel:e}}};function a7(r){return function(n){return r.apply(null,n)}}function s7(r){return re.isObject(r)&&r.isAxiosError===!0}const sg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(sg).forEach(([r,e])=>{sg[e]=r});function zm(r){const e=new vr(r),n=em(vr.prototype.request,e);return re.extend(n,vr.prototype,e,{allOwnKeys:!0}),re.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return zm(br(r,i))},n}const Xt=zm(yo);Xt.Axios=vr,Xt.CanceledError=si,Xt.CancelToken=n7,Xt.isCancel=vm,Xt.VERSION=$m,Xt.toFormData=cc,Xt.AxiosError=et,Xt.Cancel=Xt.CanceledError,Xt.all=function(e){return Promise.all(e)},Xt.spread=a7,Xt.isAxiosError=s7,Xt.mergeConfig=br,Xt.AxiosHeaders=Ln,Xt.formToJSON=r=>xm(re.isHTMLForm(r)?new FormData(r):r),Xt.getAdapter=Lm.getAdapter,Xt.HttpStatusCode=sg,Xt.default=Xt;const{Axios:M_,AxiosError:$_,CanceledError:I_,isCancel:z_,CancelToken:H_,VERSION:P_,all:U_,Cancel:B_,isAxiosError:q_,spread:G_,toFormData:F_,AxiosHeaders:V_,HttpStatusCode:K_,formToJSON:W_,getAdapter:Y_,mergeConfig:J_}=Xt,r7=at("ApiClient");function rg(){return typeof window<"u"&&window.__G7_DEVTOOLS__?window.__G7_DEVTOOLS__:null}class i7{constructor(e={}){H(this,"client");H(this,"config");H(this,"TOKEN_KEY","auth_token");this.config={baseURL:e.baseURL||"/api",timeout:e.timeout||3e4,onTokenExpired:e.onTokenExpired,onUnauthorized:e.onUnauthorized,onError:e.onError},this.client=Xt.create({baseURL:this.config.baseURL,timeout:this.config.timeout,headers:{"Content-Type":"application/json",Accept:"application/json"},paramsSerializer:{serialize:n=>{const a=[];for(const[i,o]of Object.entries(n))if(o!=null)if(Array.isArray(o)){const d=i.endsWith("[]")?i:`${i}[]`;for(const g of o)a.push(`${encodeURIComponent(d)}=${encodeURIComponent(String(g))}`)}else a.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(o))}`);return a.join("&")}}}),this.setupInterceptors()}setToken(e){typeof window<"u"&&localStorage.setItem(this.TOKEN_KEY,e)}getToken(){return typeof window<"u"?localStorage.getItem(this.TOKEN_KEY):null}removeToken(){typeof window<"u"&&localStorage.removeItem(this.TOKEN_KEY)}setupInterceptors(){this.client.interceptors.request.use(e=>{e.url?.startsWith("/api")&&e.baseURL==="/api"&&(e.baseURL="");const n=this.getToken();if(n&&e.headers&&(e.headers.Authorization=`Bearer ${n}`),typeof window<"u"&&e.headers){const i=localStorage.getItem("g7_locale");i&&(e.headers["Accept-Language"]=i)}const a=rg();if(a?.isEnabled()){const i=this.buildFullUrl(e),o=(e.method||"GET").toUpperCase(),d=a.trackRequest(i,o,{requestBody:e.data});e._devToolsRequestId=d}return e},e=>Promise.reject(e)),this.client.interceptors.response.use(e=>{const n=e.config,a=n._devToolsRequestId;if(a){const i=rg();i?.isEnabled()&&i.completeRequest(a,e.status,e.data),n._devToolsRequestId=null}return e},async e=>{const n=e.config,a=n?.url||"",o=["/auth/","/layouts/"].some(d=>a.includes(d));if(e.response?.status===401&&!n?._retry&&!o){if(n._retry=!0,await as.getInstance().refreshToken()){const h=this.getToken();return h&&(n.headers.Authorization=`Bearer ${h}`),n._devToolsRequestId=null,this.client(n)}return this.completeDevToolsRequest(n,e),this.removeToken(),this.config.onUnauthorized&&this.config.onUnauthorized(),Promise.reject(e)}return e.response?.status===401&&o?(this.completeDevToolsRequest(n,e),Promise.reject(e)):e.response?.status===403?(this.completeDevToolsRequest(n,e),this.callOnError(e),Promise.reject(e)):(this.completeDevToolsRequest(n,e),e.response&&this.callOnError(e),Promise.reject(e))})}async get(e,n){return(await this.client.get(e,n)).data}async post(e,n,a){return(await this.client.post(e,n,a)).data}async put(e,n,a){return(await this.client.put(e,n,a)).data}async patch(e,n,a){return(await this.client.patch(e,n,a)).data}async delete(e,n){return(await this.client.delete(e,n)).data}getInstance(){return this.client}setOnUnauthorized(e){this.config.onUnauthorized=e}setOnError(e){this.config.onError=e}completeDevToolsRequest(e,n){if(!e?._devToolsRequestId)return;const a=rg();if(!a?.isEnabled())return;const i=e._devToolsRequestId;e._devToolsRequestId=null,n.response?a.completeRequest(i,n.response.status,n.response.data):n.request?a.failRequest(i,n.message||"Network error"):a.failRequest(i,n.message||"Request error")}buildFullUrl(e){let n=e.url||"";if(e.baseURL&&!n.startsWith("http")&&(n=`${e.baseURL}${n.startsWith("/")?"":"/"}${n}`),e.params&&typeof e.params=="object"){const a=e.params,i=[];for(const[o,d]of Object.entries(a))if(d!=null)if(Array.isArray(d)){const g=o.endsWith("[]")?o:`${o}[]`;for(const h of d)i.push(`${encodeURIComponent(g)}=${encodeURIComponent(String(h))}`)}else i.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(d))}`);i.length>0&&(n+=(n.includes("?")?"&":"?")+i.join("&"))}return n}callOnError(e){if(!this.config.onError)return;const n={status:e.response?.status||0,message:e.response?.data?.message||e.message||"Unknown error",data:e.response?.data,statusText:e.response?.statusText};try{this.config.onError(n)}catch(a){r7.error("Error in onError handler:",a)}}}let ig=null;function ns(){return ig||(ig=new i7),ig}const bo=at("AuthManager");function ri(r,e,n,a){try{window.G7Core?.devTools?.trackAuthEvent?.(r,e,n,a)}catch{}}const pc={admin:{type:"admin",loginPath:"/admin/login",defaultPath:"/admin",userEndpoint:"/admin/auth/user",loginEndpoint:"/auth/admin/login",logoutEndpoint:"/admin/auth/logout",refreshEndpoint:"/admin/auth/refresh"},user:{type:"user",loginPath:"/login",defaultPath:"/",userEndpoint:"/auth/user",loginEndpoint:"/auth/login",logoutEndpoint:"/auth/logout",refreshEndpoint:"/auth/refresh"}},Na=class Na{constructor(){H(this,"state");H(this,"config");H(this,"isRefreshing",!1);H(this,"refreshPromise",null);H(this,"eventHandlers",new Map);this.state={isAuthenticated:!1,user:null,type:null},this.config=new Map,this.config.set("admin",pc.admin),this.config.set("user",pc.user)}static getInstance(){return Na.instance||(Na.instance=new Na),Na.instance}on(e,n){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(n)}emit(e,...n){const a=this.eventHandlers.get(e);a&&a.forEach(i=>i(...n))}isAuthenticated(){return this.state.isAuthenticated}getUser(){return this.state.user}getAuthType(){return this.state.type}async checkAuth(e){const n=ns();if(!n.getToken())return this.clearState(),!1;const i=this.config.get(e);if(!i)return bo.error(`Unknown auth type: ${e}`),!1;try{const o=await n.get(i.userEndpoint);return o.success&&o.data?(this.state={isAuthenticated:!0,user:o.data,type:e},this.emit("authStateChange",this.state),!0):(this.clearState(),!1)}catch(o){return o.response?.status===401&&await this.refreshToken()?this.checkAuth(e):(this.clearState(),!1)}}async preloadAuth(e){try{return await this.checkAuth(e)}catch(n){return bo.warn(`Preload auth failed for type ${e}:`,n),!1}}async login(e,n,a){const i=ns();if(!this.config.get(e))throw new Error(`Unknown auth type: ${e}`);const d=e==="admin"?pc.admin.loginEndpoint:pc.user.loginEndpoint;try{const g=a?.headers?{headers:a.headers}:void 0,h=await i.post(d,n,g);if(h.success&&h.data){i.setToken(h.data.token);const f=h.data.user.language,p=localStorage.getItem(Na.LOCALE_STORAGE_KEY),x=f&&f!==p;if(f)try{localStorage.setItem(Na.LOCALE_STORAGE_KEY,f)}catch(y){bo.warn("Failed to save user language to localStorage:",y)}return this.state={isAuthenticated:!0,user:h.data.user,type:e},this.emit("login",this.state),this.emit("authStateChange",this.state),ri("login",!0,void 0,{userId:h.data.user.uuid,email:h.data.user.email,type:e}),x&&window.__templateApp&&window.__templateApp.changeLocale(f),h.data.user}throw new Error("Login failed")}catch(g){this.clearState();const h=g.response?.data?.message,f=new Error(h||g.message||"Login failed");throw f.response=g.response,f.status=g.response?.status,ri("login",!1,f.message,{type:e,status:g.response?.status}),f}}async logout(){const e=ns(),n=this.state.type?this.config.get(this.state.type):null;try{n&&await e.post(n.logoutEndpoint)}catch(a){bo.warn("Logout API call failed:",a)}finally{e.removeToken();const a={...this.state};if(this.clearState(),this.emit("logout",a),this.emit("authStateChange",this.state),ri("logout",!0,void 0,{previousType:a.type}),n&&a.type){const i=window.location.pathname+window.location.search;window.location.href=this.getLoginRedirectUrl(a.type,i)}}}async refreshToken(){if(this.isRefreshing&&this.refreshPromise)return this.refreshPromise;this.isRefreshing=!0,this.refreshPromise=this.doRefreshToken();try{return await this.refreshPromise}finally{this.isRefreshing=!1,this.refreshPromise=null}}async doRefreshToken(){const e=this.state.type;if(!e)return!1;const n=this.config.get(e);if(!n)return!1;const a=ns();try{const i=await a.post(n.refreshEndpoint);return i.success&&i.data?.token?(a.setToken(i.data.token),this.emit("tokenRefreshed"),ri("token-refresh",!0,void 0,{type:e}),!0):(ri("token-refresh",!1,"No token in response",{type:e}),!1)}catch(i){return bo.error("Token refresh failed:",i),ri("token-refresh",!1,i instanceof Error?i.message:"Unknown error",{type:e}),!1}}getLoginRedirectUrl(e,n){const a=this.config.get(e);if(!a)return"/login";const i=encodeURIComponent(n);return`${a.loginPath}?redirect=${i}`}getRedirectUrl(e){const a=this.config.get(e)?.defaultPath||"/",o=new URLSearchParams(window.location.search).get("redirect");if(o)try{const d=decodeURIComponent(o);if(d.startsWith("/"))return d}catch{}return a}getConfig(e){return this.config.get(e)}clearState(){this.state={isAuthenticated:!1,user:null,type:null}}static resetInstance(){Na.instance=null}};H(Na,"instance"),H(Na,"LOCALE_STORAGE_KEY","g7_locale");let as=Na;const Hm={401:{handler:"navigate",params:{path:"{{auth.loginPath}}"}},403:{handler:"toast",params:{type:"error",message:"{{error.message}}"}},404:{handler:"toast",params:{type:"error",message:"{{error.message}}"}},422:{handler:"toast",params:{type:"error",message:"{{error.message}}"}},default:{handler:"toast",params:{type:"error",message:"{{error.message}}"}}},ss={findHandler(r,e){if(r){if(r[e])return r[e];if(r[String(e)])return r[String(e)];if(r.default)return r.default}},normalizeOnError(r){return r?Array.isArray(r)?r:[r]:[]},injectErrorCode(r,e,n){if(r.handler!=="showErrorPage"||r.params?.errorCode!==void 0)return r;const a=typeof e=="string"?parseInt(e,10):e,i=isNaN(a)?n:a;return i===void 0?r:{...r,params:{...r.params,errorCode:i}}}},ba=at("ErrorHandlingResolver"),zs=class zs{constructor(){H(this,"templateErrorHandling",null);H(this,"layoutErrorHandling",null);H(this,"executeAction",null)}static getInstance(){return zs.instance||(zs.instance=new zs),zs.instance}static resetInstance(){zs.instance=null}setTemplateConfig(e){this.templateErrorHandling=e,ba.log("Template config set:",e)}setLayoutConfig(e){this.layoutErrorHandling=e,ba.log("Layout config set:",e)}setActionExecutor(e){this.executeAction=e}resolve(e,n={}){const{errorHandling:a,onError:i}=n;ba.log("Resolving error:",e,{hasActionErrorHandling:!!a,hasActionOnError:!!i,hasLayoutConfig:!!this.layoutErrorHandling,hasTemplateConfig:!!this.templateErrorHandling});let o=ss.findHandler(a,e);if(o){const d=this.getMatchedKey(a,e);return{handler:ss.injectErrorCode(o,d,e),level:"action",matchedKey:d}}if(i){const d=ss.normalizeOnError(i);if(d.length>0)return{handler:d.length===1?d[0]:{handler:"sequence",actions:d},level:"action",matchedKey:"onError"}}if(o=ss.findHandler(this.layoutErrorHandling||void 0,e),o){const d=this.getMatchedKey(this.layoutErrorHandling,e);return{handler:ss.injectErrorCode(o,d,e),level:"layout",matchedKey:d}}if(o=ss.findHandler(this.templateErrorHandling||void 0,e),o){const d=this.getMatchedKey(this.templateErrorHandling,e);return{handler:ss.injectErrorCode(o,d,e),level:"template",matchedKey:d}}if(o=ss.findHandler(Hm,e),o){const d=this.getMatchedKey(Hm,e);return{handler:ss.injectErrorCode(o,d,e),level:"system",matchedKey:d}}return{handler:null,level:null,matchedKey:null}}async execute(e,n){if(!this.executeAction){ba.error("Action executor is not set");return}ba.log("Executing handler:",e.handler,{errorContext:n});try{return await this.executeAction(e,{error:n})}catch(a){throw ba.error("Failed to execute handler:",a),a}}async resolveAndExecute(e,n,a={}){const i=this.resolve(e,a);if(ba.log("Resolve result:",{errorCode:e,handler:i.handler?.handler,level:i.level,matchedKey:i.matchedKey}),!i.handler)return ba.warn("No handler found for error:",e),{handled:!1};try{return{handled:!0,result:await this.execute(i.handler,n)}}catch(o){return ba.error("Handler execution failed:",o),{handled:!1}}}getMatchedKey(e,n){return e[n]?n:e[String(n)]?String(n):"default"}clearLayoutConfig(){this.layoutErrorHandling=null,ba.log("Layout config cleared")}clearAllConfig(){this.templateErrorHandling=null,this.layoutErrorHandling=null,ba.log("All config cleared")}getConfigStatus(){return{hasTemplate:this.templateErrorHandling!==null,hasLayout:this.layoutErrorHandling!==null,hasExecutor:this.executeAction!==null}}};H(zs,"instance",null);let og=zs;function va(){return og.getInstance()}var lg={exports:{}},vo={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Pm;function o7(){if(Pm)return vo;Pm=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(a,i,o){var d=null;if(o!==void 0&&(d=""+o),i.key!==void 0&&(d=""+i.key),"key"in i){o={};for(var g in i)g!=="key"&&(o[g]=i[g])}else o=i;return i=o.ref,{$$typeof:r,type:a,key:d,ref:i!==void 0?i:null,props:o}}return vo.Fragment=e,vo.jsx=n,vo.jsxs=n,vo}var Um;function l7(){return Um||(Um=1,lg.exports=o7()),lg.exports}var l=l7();const c7=Za({__proto__:null,default:es(l)},[l]),cg=at("ParentContextProvider"),Bm=j.createContext(null);let mc=null;function dg(){mc?(cg.log("[triggerModalParentUpdate] 모달 부모 컨텍스트 업데이트 트리거"),mc()):cg.warn("[triggerModalParentUpdate] Provider가 아직 마운트되지 않음")}const qm=({children:r})=>{const[e,n]=j.useState(0),a=j.useRef(!0),i=j.useCallback(()=>{const d=window.__g7LayoutContextStack||[];return d[d.length-1]?.dataContext},[]);j.useEffect(()=>(a.current=!0,mc=()=>{a.current&&(n(d=>d+1),cg.log("[ParentContextProvider] 버전 업데이트됨"))},()=>{a.current=!1,mc=null}),[]);const o={version:e,getParentDataContext:i};return l.jsx(Bm.Provider,{value:o,children:r})};function d7(){return j.useContext(Bm)}const G=at("ActionDispatcher"),Gm=new Set(["navigate","navigateBack","navigateForward","replaceUrl","refresh","logout"]),u7=new Set(["redirect"]);function Vn(){try{return window.G7Core?.devTools}catch{return}}class Gt extends Error{constructor(e,n,a){super(e),this.action=n,this.originalError=a,this.name="ActionError"}}const xi=class xi{constructor(e={},n,a){H(this,"bindingEngine");H(this,"translationEngine");H(this,"translationContext");H(this,"customHandlers",new Map);H(this,"defaultContext");H(this,"globalStateUpdater");H(this,"errorHandlingSetup",!1);H(this,"debounceTimers",new Map);H(this,"pendingDebounceFlushers",new Map);H(this,"debounceAccumulatedValues",new Map);H(this,"globalHeaders",[]);H(this,"namedActions",{});H(this,"previewMode",!1);this.bindingEngine=new _n,this.translationEngine=n,this.translationContext=a,this.defaultContext=e,this.registerDefaultHandlers(),this.setupErrorHandling()}setGlobalHeaders(e){this.globalHeaders=e||[]}setNamedActions(e){this.namedActions=e||{};const n=Vn();n?.isEnabled?.()&&n.setNamedActionDefinitions?.(this.namedActions),G.log("[setNamedActions] registered:",Object.keys(this.namedActions))}getNamedActions(){return this.namedActions}setPreviewMode(e){this.previewMode=e,G.log("Preview mode:",e?"enabled":"disabled")}isPreviewMode(){return this.previewMode}static getPreviewSuppressedHandlers(){return Gm}static getPreviewSuppressedLayoutFeatures(){return u7}resolveActionRef(e){if(!e.actionRef)return e;const n=this.namedActions[e.actionRef];if(!n)return G.warn(`[resolveActionRef] named action not found: "${e.actionRef}"`),e;const a=Vn();a?.isEnabled?.()&&a.trackNamedActionRef?.({actionRefName:e.actionRef,resolvedHandler:n.handler,timestamp:Date.now()});const{actionRef:i,type:o,key:d,event:g,...h}=e,f={...n,...Object.fromEntries(Object.entries(h).filter(([,p])=>p!==void 0)),type:o??n.type};return d!==void 0&&(f.key=d),g!==void 0&&(f.event=g),f}matchesPattern(e,n){if(n==="*")return!0;const a=n.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${a}$`).test(e)}getMatchingGlobalHeaders(e,n){const a={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([o,d])=>{const g=sc(d,n,{skipCache:!0});g!=null&&g!==""&&(a[o]=String(g))});return a}setupErrorHandling(){if(this.errorHandlingSetup)return;va().setActionExecutor(async(n,a)=>{const i={type:"click",handler:n.handler,target:n.target,params:n.params,actions:n.actions},o={data:{...this.defaultContext.data,error:a.error}};return await this.dispatchAction(i,o)}),this.errorHandlingSetup=!0}registerDefaultHandlers(){this.registerHandler("refetchDataSource",async(n,a)=>{const i=n.params?.dataSourceId,o=n.params?.sync;if(!i){G.warn("refetchDataSource: dataSourceId is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.refetch){const d=window.G7Core?.state?.get?.()||{},g={...a.state?._global,...d},h=window.G7Core?.state?.getLocal?.()||{},f=a.data?._local||a.state||{},p={...h,...f},x=a.isolatedContext?.state;G.log("[refetchDataSource] localStateOverride:",p),await window.G7Core.dataSource.refetch(i,{...o?{sync:!0}:{},...g?{globalStateOverride:g}:{},...p?{localStateOverride:p}:{},...x?{isolatedStateOverride:x}:{}})}else G.warn("refetchDataSource: G7Core.dataSource.refetch is not available")}),this.registerHandler("appendDataSource",async(n,a)=>{const{dataSourceId:i,dataPath:o,newData:d}=n.params||{};if(!i){G.warn("appendDataSource: dataSourceId is required");return}if(d===void 0){G.warn("appendDataSource: newData is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.updateData){if(!Array.isArray(d)){G.warn("appendDataSource: newData must be an array, got:",typeof d,d);return}await window.G7Core.dataSource.updateData(i,o||null,d,"append")}else G.warn("appendDataSource: G7Core.dataSource.updateData is not available")}),this.registerHandler("updateDataSource",async(n,a)=>{const{dataSourceId:i,data:o,merge:d=!1}=n.params||{};if(!i){G.warn("updateDataSource: dataSourceId is required");return}if(o===void 0){G.warn("updateDataSource: data is required");return}typeof window<"u"&&window.G7Core?.dataSource?.set?(G.log(`[updateDataSource] Updating dataSource '${i}' with:`,o),window.G7Core.dataSource.set(i,o,{merge:d})):G.warn("updateDataSource: G7Core.dataSource.set is not available")}),this.registerHandler("scrollIntoView",async(n,a)=>{const{selector:i,behavior:o="smooth",block:d="nearest",inline:g="nearest",waitForElement:h=!1,timeout:f=2e3,delay:p=0,retryCount:x=0,retryInterval:y=50,scrollContainer:w}=n.params||{};if(!i){G.warn("scrollIntoView: selector is required");return}if(typeof window>"u"||typeof document>"u"){G.warn("scrollIntoView: window/document is not available");return}let v=null;if(h){if(v=await new Promise(C=>{const k=document.querySelector(i);if(k){C(k);return}const A=setTimeout(()=>{R.disconnect(),C(null)},f),R=new MutationObserver(()=>{const N=document.querySelector(i);N&&(clearTimeout(A),R.disconnect(),C(N))});R.observe(document.body,{childList:!0,subtree:!0})}),!v){G.warn(`scrollIntoView: element not found for selector "${i}" after ${f}ms timeout`);return}}else{p>0&&await new Promise(k=>setTimeout(k,p)),v=document.querySelector(i);let C=0;for(;!v&&C<x;)await new Promise(k=>setTimeout(k,y)),v=document.querySelector(i),C++;if(!v){G.warn(`scrollIntoView: element not found for selector "${i}" after ${C+1} attempts`);return}}if(w){const C=document.querySelector(w);if(!C){G.warn(`scrollIntoView: container not found for selector "${w}"`);return}const k=v.getBoundingClientRect(),A=C.getBoundingClientRect(),R=k.top-A.top+C.scrollTop,N=R+k.height;let D;switch(d){case"start":D=R;break;case"center":D=R-C.clientHeight/2+k.height/2;break;case"end":D=N-C.clientHeight;break;case"nearest":default:const M=k.top<A.top,L=k.bottom>A.bottom;if(M)D=R;else if(L)D=N-C.clientHeight;else return;break}C.scrollTo({top:Math.max(0,D),behavior:o});return}v.scrollIntoView({behavior:o,block:d,inline:g})}),this.registerHandler("reloadRoutes",async(n,a)=>{if(typeof window>"u"){G.warn("reloadRoutes: window is not available");return}const i=window.__templateApp;if(!i){G.warn("reloadRoutes: TemplateApp not initialized");return}const o=i.getRouter?.();if(!o){G.warn("reloadRoutes: Router not available");return}try{await o.loadRoutes(),G.log("reloadRoutes: Routes reloaded successfully")}catch(d){throw G.error("reloadRoutes: Failed to reload routes",d),d}}),this.registerHandler("refresh",async(n,a)=>{if(typeof window>"u"){G.warn("refresh: window is not available");return}window.location.reload()}),this.registerHandler("remount",async(n,a)=>{const{componentId:i}=n.params||{};if(!i){G.warn("remount: componentId parameter is required");return}if(!this.globalStateUpdater){G.warn("remount: globalStateUpdater is not set");return}const g=(window.G7Core?.state?.get()||{})._global?._remountKeys||{},h=g[i]||0;this.globalStateUpdater({_remountKeys:{...g,[i]:h+1}}),G.log(`remount: ${i} key incremented to ${h+1}`)}),this.registerHandler("reloadTranslations",async(n,a)=>{if(typeof window>"u"){G.warn("reloadTranslations: window is not available");return}const{TranslationEngine:i}=await Promise.resolve().then(()=>Up),o=i.getInstance(),d=window.__templateApp;if(!d){G.warn("reloadTranslations: TemplateApp not initialized");return}const g=d.getConfig?.();if(!g?.templateId){G.warn("reloadTranslations: templateId not available");return}const h=g.locale||"ko",f="en";try{const p=await fetch(`/api/templates/${g.templateId}/config.json?_=${Date.now()}`);if(p.ok){const y=(await p.json())?.data?.cache_version;if(y!==void 0){const w=o.getCacheVersion();w!==y&&(G.log("reloadTranslations: Cache version changed",w,"->",y),o.setCacheVersion(y))}}typeof o.clearCache=="function"&&o.clearCache(),await o.loadTranslations(g.templateId,h,"/api",!0),h!==f&&await o.loadTranslations(g.templateId,f,"/api",!0),G.log("reloadTranslations: Translations reloaded successfully")}catch(p){throw G.error("reloadTranslations: Failed to reload translations",p),p}}),this.registerHandler("reloadModuleHandlers",async(n,a)=>{if(typeof window>"u"){G.warn("reloadModuleHandlers: window is not available");return}const{moduleInfo:i,action:o}=n.params||{};if(!i){G.warn("reloadModuleHandlers: moduleInfo is required");return}const d=i.data||i;if(!d.identifier){G.warn("reloadModuleHandlers: moduleInfo with identifier is required");return}if(!o||o!=="add"&&o!=="remove"){G.warn('reloadModuleHandlers: action must be "add" or "remove"');return}const g=window.G7Config;if(!g){G.warn("reloadModuleHandlers: G7Config not available");return}const h=d.identifier;try{if(o==="add"){if(d.assets&&(g.moduleAssets=g.moduleAssets||{},g.moduleAssets[h]=d.assets,G.log(`reloadModuleHandlers: Added assets for ${h}`),d.assets.js)){const f=d.assets.js,p=`module-${h}`;if(document.getElementById(p)){G.warn(`reloadModuleHandlers: Script ${p} already loaded`);return}const x=document.createElement("script");if(x.id=p,x.src=f,x.async=!0,await new Promise((y,w)=>{x.onload=()=>{G.log(`reloadModuleHandlers: Script loaded successfully for ${h}`),y()},x.onerror=()=>{G.error(`reloadModuleHandlers: Failed to load script for ${h}`),w(new Error(`Failed to load module script: ${f}`))},document.head.appendChild(x)}),d.assets.css){const y=d.assets.css,w=`module-css-${h}`;if(!document.getElementById(w)){const v=document.createElement("link");v.id=w,v.rel="stylesheet",v.href=y,document.head.appendChild(v),G.log(`reloadModuleHandlers: CSS loaded for ${h}`)}}}}else if(o==="remove"){g.moduleAssets&&g.moduleAssets[h]&&(delete g.moduleAssets[h],G.log(`reloadModuleHandlers: Removed assets for ${h}`));const f=`module-${h}`,p=document.getElementById(f);p&&(p.remove(),G.log(`reloadModuleHandlers: Removed script for ${h}`));const x=`module-css-${h}`,y=document.getElementById(x);y&&(y.remove(),G.log(`reloadModuleHandlers: Removed CSS for ${h}`))}}catch(f){throw G.error(`reloadModuleHandlers: Failed to ${o} module assets`,f),f}}),this.registerHandler("reloadPluginHandlers",async(n,a)=>{if(typeof window>"u"){G.warn("reloadPluginHandlers: window is not available");return}const{pluginInfo:i,action:o}=n.params||{};if(!i){G.warn("reloadPluginHandlers: pluginInfo is required");return}const d=i.data||i;if(!d.identifier){G.warn("reloadPluginHandlers: pluginInfo with identifier is required");return}if(!o||o!=="add"&&o!=="remove"){G.warn('reloadPluginHandlers: action must be "add" or "remove"');return}const g=window.G7Config;if(!g){G.warn("reloadPluginHandlers: G7Config not available");return}const h=d.identifier;try{if(o==="add"){if(d.assets&&(g.pluginAssets=g.pluginAssets||{},g.pluginAssets[h]=d.assets,G.log(`reloadPluginHandlers: Added assets for ${h}`),d.assets.js)){const f=d.assets.js,p=`plugin-${h}`;if(document.getElementById(p)){G.warn(`reloadPluginHandlers: Script ${p} already loaded`);return}const x=document.createElement("script");if(x.id=p,x.src=f,x.async=!0,await new Promise((y,w)=>{x.onload=()=>{G.log(`reloadPluginHandlers: Script loaded successfully for ${h}`),y()},x.onerror=()=>{G.error(`reloadPluginHandlers: Failed to load script for ${h}`),w(new Error(`Failed to load plugin script: ${f}`))},document.head.appendChild(x)}),d.assets.css){const y=d.assets.css,w=`plugin-css-${h}`;if(!document.getElementById(w)){const v=document.createElement("link");v.id=w,v.rel="stylesheet",v.href=y,document.head.appendChild(v),G.log(`reloadPluginHandlers: CSS loaded for ${h}`)}}}}else if(o==="remove"){g.pluginAssets&&g.pluginAssets[h]&&(delete g.pluginAssets[h],G.log(`reloadPluginHandlers: Removed assets for ${h}`));const f=`plugin-${h}`,p=document.getElementById(f);p&&(p.remove(),G.log(`reloadPluginHandlers: Removed script for ${h}`));const x=`plugin-css-${h}`,y=document.getElementById(x);y&&(y.remove(),G.log(`reloadPluginHandlers: Removed CSS for ${h}`))}}catch(f){throw G.error(`reloadPluginHandlers: Failed to ${o} plugin assets`,f),f}});let e=!1;this.registerHandler("showErrorPage",async(n,a)=>{if(e){G.log("showErrorPage: Already active, skipping duplicate call");return}if(e=!0,typeof window>"u"){e=!1,G.warn("showErrorPage: window is not available");return}const i=window.__templateApp;if(!i){e=!1,G.warn("showErrorPage: TemplateApp not initialized");return}const o=i.getErrorPageHandler?.();if(!o){e=!1,G.warn("showErrorPage: ErrorPageHandler not available");return}const d=n.params?.errorCode||500,g=n.params?.target||"content";let h=n.params?.containerId;h||(h=g==="full"?"app":"main_content"),G.log("showErrorPage:",{errorCode:d,target:g,containerId:h});const f=(p,x=6e4)=>new Promise((y,w)=>{const v=document.getElementById(p);if(v){y(v);return}G.log(`showErrorPage: Waiting for container #${p}...`);let C;const k=new MutationObserver((A,R)=>{const N=document.getElementById(p);N&&(G.log(`showErrorPage: Container #${p} found`),R.disconnect(),clearTimeout(C),y(N))});k.observe(document.body,{childList:!0,subtree:!0}),C=setTimeout(()=>{k.disconnect(),w(new Error(`Container #${p} not found within ${x}ms`))},x)});try{await f(h);const p=va(),x=p.layoutErrorHandling;p.clearLayoutConfig();try{await o.renderError(d,h)||G.warn(`showErrorPage: Failed to render error page for code ${d}`)}finally{p.setLayoutConfig(x)}}catch(p){throw G.error("showErrorPage: Error rendering error page:",p),p}finally{e=!1}}),this.registerHandler("emitEvent",async(n,a)=>{const i=n.params?.event,o=n.params?.data;if(!i){G.warn("emitEvent: event parameter is required");return}if(typeof window>"u"){G.warn("emitEvent: window is not available");return}const d=window.G7Core;if(!d?.componentEvent?.emit){G.warn("emitEvent: G7Core.componentEvent is not available");return}try{G.log(`emitEvent: Emitting "${i}"`,o);const g={...o,_context:{data:a.data,state:a.state}},h=await d.componentEvent.emit(i,g);if(!h||h.length===0?G.warn(`emitEvent: No listeners found for "${i}"`):G.log(`emitEvent: Event "${i}" completed with ${h.length} listener(s)`,h),this.globalStateUpdater){const f=d?.state?.get()||{};this.globalStateUpdater({_local:{...f._local,_eventResult:{event:i,success:!0,data:h.length===1?h[0]:h,listeners:h.length}}})}}catch(g){if(G.error(`emitEvent: Event "${i}" failed`,g),this.globalStateUpdater){const h=d?.state?.get()||{};this.globalStateUpdater({_local:{...h._local,_eventResult:{event:i,success:!1,error:g instanceof Error?g.message:String(g)}}})}throw g}}),this.registerHandler("updateProductField",async(n,a)=>{const{productId:i,field:o,value:d}=n.params||{};if(!i||!o){G.warn("updateProductField: productId and field are required");return}if(typeof window>"u"){G.warn("updateProductField: window is not available");return}const g=window.G7Core;if(!g?.state?.get||!this.globalStateUpdater){G.warn("updateProductField: G7Core.state or globalStateUpdater is not available");return}try{const h=g.state.get()||{},p=(h.products?.data?.data||[]).map(y=>y.id===i?{...y,[o]:d,_modified:!0}:y),x=new Set(h._local?.modifiedProductIds||[]);x.add(i),this.globalStateUpdater({products:{...h.products,data:{...h.products?.data,data:p}},_local:{...h._local,modifiedProductIds:Array.from(x)}}),G.log(`updateProductField: Updated product ${i}, field: ${o}, value:`,d)}catch(h){throw G.error("updateProductField: Error updating product field",h),h}}),this.registerHandler("updateOptionField",async(n,a)=>{const{productId:i,optionId:o,field:d,value:g}=n.params||{};if(!i||!o||!d){G.warn("updateOptionField: productId, optionId and field are required");return}if(typeof window>"u"){G.warn("updateOptionField: window is not available");return}const h=window.G7Core;if(!h?.state?.get||!this.globalStateUpdater){G.warn("updateOptionField: G7Core.state or globalStateUpdater is not available");return}try{const f=h.state.get()||{},x=(f.products?.data?.data||[]).map(w=>{if(w.id===i&&w.options){const v=w.options.map(C=>C.id===o?{...C,[d]:g,_modified:!0}:C);return{...w,options:v,_modified:!0}}return w}),y=new Set(f._local?.modifiedProductIds||[]);y.add(i),this.globalStateUpdater({products:{...f.products,data:{...f.products?.data,data:x}},_local:{...f._local,modifiedProductIds:Array.from(y)}}),G.log(`updateOptionField: Updated product ${i} option ${o}, field: ${d}, value:`,g)}catch(f){throw G.error("updateOptionField: Error updating option field",f),f}}),this.registerHandler("setLocale",async(n,a)=>{const i=n.target;if(!i||typeof i!="string"){G.warn("setLocale: Invalid locale:",i);return}const o=window.__templateApp;if(o&&typeof o.changeLocale=="function")try{await o.changeLocale(i),G.log("setLocale: Locale changed to",i)}catch(d){G.error("setLocale: Failed to change locale:",d),window.location.reload()}else{G.warn("setLocale: TemplateApp not found, falling back to page reload");try{localStorage.setItem("g7_locale",i)}catch{}window.location.reload()}}),this.registerHandler("suppress",async()=>{G.log("suppress: Error intentionally suppressed")}),this.registerBuiltInHandlerMetadata()}registerBuiltInHandlerMetadata(){const e=Vn();if(!e?.isEnabled())return;const n=[{name:"refetchDataSource",description:"데이터 소스를 다시 fetch합니다"},{name:"appendDataSource",description:"데이터 소스에 새 데이터를 병합합니다 (무한 스크롤용)"},{name:"updateDataSource",description:"API 응답으로 데이터 소스를 직접 업데이트합니다 (refetch 대체)"},{name:"reloadRoutes",description:"라우트를 다시 로드합니다"},{name:"refresh",description:"현재 페이지를 새로고침합니다"},{name:"remount",description:"컴포넌트를 리마운트합니다"},{name:"reloadTranslations",description:"다국어 파일을 다시 로드합니다"},{name:"showErrorPage",description:"에러 페이지를 표시합니다"},{name:"emitEvent",description:"이벤트를 발생시킵니다"},{name:"updateProductField",description:"상품 필드를 인라인 수정합니다"},{name:"updateOptionField",description:"상품 옵션 필드를 인라인 수정합니다"},{name:"setLocale",description:"언어를 변경합니다 (DB 저장 + UI 리렌더링)"}];for(const a of n)e.trackHandlerRegistration(a.name,"built-in",a.description)}createHandler(e,n,a){G.log("createHandler called for:",e.handler,e.type);const i=window.__g7DevTools,o=Date.now(),d=a?.state?{...a.state}:null,g=`handler_${e.handler}_${o}`;return async h=>{if(G.log("Handler invoked for:",e.handler,"event:",h.type),i?.isEnabled?.()&&d){const p=window.G7Core?.state?.getLocal?.()??a?.state??{},x=Date.now()-o;for(const y of Object.keys(d)){const w=d[y],v=p[y];w!==v&&x>100&&(i.trackStaleClosureWarning?.({type:"event-handler-stale",location:`createHandler(${e.handler})`,capturedPath:`_local.${y}`,capturedValue:w,capturedAt:o,currentValue:v,actionId:g,stackTrace:new Error().stack}),G.warn(`[Stale Closure] _local.${y} changed after handler creation:`,`captured="${w}" → current="${v}" (${x}ms ago)`))}}try{h.type!=="change"&&h.preventDefault();let f={};if(h.type==="submit"&&h.target instanceof HTMLFormElement){const y=h.target;new FormData(y).forEach((v,C)=>{f[C]=v})}const p={...this.defaultContext,data:{...n,form:f,_local:a?.state||{},$event:h},event:h,...a&&{state:a.state,setState:a.setState},isolatedContext:a?.isolatedContext};if(e.confirm){let y=this.resolveValue(e.confirm,p.data);if(this.translationEngine&&this.translationContext&&y.startsWith("$t:")&&(y=this.translationEngine.resolveTranslations(y,this.translationContext,p.data)),!confirm(y))return}const x=window.__g7ActionContext;window.__g7ActionContext={...a,data:p.data};try{await this.executeAction(e,p)}finally{window.__g7ActionContext=x}}catch(f){if(G.error("Action execution failed:",f),e.onError){const p=f instanceof Gt&&f.originalError?f.originalError:f,x={...this.defaultContext,data:{...n,error:p,_local:a?.state||{},$event:h},event:h,...a&&{state:a.state,setState:a.setState}},y=Array.isArray(e.onError)?e.onError:[e.onError];for(const w of y)await this.executeAction(w,x)}}}}generateActionId(e,n){const a=e.handler,i=n||"no-target",o=Date.now(),d=Math.random().toString(36).substring(2,9);return`${a}_${i.replace(/[^a-zA-Z0-9]/g,"_")}_${o}_${d}`}async executeAction(e,n){e=this.resolveActionRef(e);const a=Vn(),i=a?.isEnabled()?`action_${Date.now()}_${Math.random().toString(36).substring(2,11)}`:void 0,o=performance.now();let d;if(i&&a&&a.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),context:this.sanitizeForDevTools({hasState:!!n.state,hasSetState:!!n.setState,dataKeys:n.data?Object.keys(n.data):[]}),startTime:o,status:"started"}),e.if!==void 0)try{const h=this.resolveValue(e.if,n.data),f=h===!0||h==="true"||h&&h!=="false"&&h!=="0"&&h!==!1;if(G.log("[executeAction] if condition result:",e.handler,f),!f)return i&&a&&a.logAction({id:i,type:e.handler,startTime:o,endTime:performance.now(),duration:performance.now()-o,status:"success",result:{skipped:!0,reason:"if condition false"}}),{success:!0,data:void 0}}catch(h){return G.error("[executeAction] if condition error:",e.handler,h),i&&a&&a.logAction({id:i,type:e.handler,startTime:o,endTime:performance.now(),duration:performance.now()-o,status:"error",error:{name:"ConditionEvaluationError",message:h instanceof Error?h.message:String(h),stack:h instanceof Error?h.stack:void 0}}),{success:!0,data:void 0}}let g;try{const h=this.resolveParams(e.params,n.data);i&&(d=this.sanitizeForDevTools(h));const f=e.target?this.resolveValue(e.target,n.data):void 0;if(e.handler==="apiCall"&&n.setState){g=this.generateActionId(e,f);const x=n.state?.loadingActions||{};n.setState({loadingActions:{...x,[g]:!0}})}if(this.previewMode&&Gm.has(e.handler))return G.warn(`Preview mode: "${e.handler}" suppressed`,f||h),i&&a&&a.logAction({id:i,type:e.handler,startTime:o,endTime:performance.now(),duration:performance.now()-o,status:"skipped",metadata:{reason:"preview_mode_suppressed"}}),{success:!0,data:void 0};let p;switch(e.handler){case"navigate":const x=h.path||f;p=await this.handleNavigate(x,h,n);break;case"navigateBack":p=await this.handleNavigateBack();break;case"navigateForward":p=await this.handleNavigateForward();break;case"openWindow":{const w=h.path||f;p=await this.handleOpenWindow(w,h);break}case"replaceUrl":{const w=h.path||f||window.location.pathname;p=await this.handleReplaceUrl(w,h);break}case"apiCall":if(e.onSuccess&&a?.isEnabled()&&i){const w=window.G7Core,v={};if(w?.state?.get){const C=w.state.get();v._global=C}n.state&&(v._local=n.state),a.registerStateCaptureForHandler?.(i,["_global","_local"],v)}const y=e.auth_mode??(e.auth_required?"required":"none");p=await this.handleApiCall(f,h,n,y);break;case"login":p=await this.handleLogin(f,h,n);break;case"logout":p=await this.handleLogout(f,n);break;case"setState":G.log("[executeAction] setState resolvedParams:",h),p=await this.handleSetState(h,n);break;case"setError":p=await this.handleSetError(f,h,n);break;case"openModal":p=await this.handleOpenModal(f,n);break;case"closeModal":p=await this.handleCloseModal(n);break;case"showAlert":p=await this.handleShowAlert(f,n);break;case"toast":p=await this.handleToast(h,n);break;case"switch":p=await this.handleSwitch(e,n);break;case"conditions":p=await this.handleConditions(e,n);break;case"sequence":p=await this.handleSequence(e,n);break;case"parallel":p=await this.handleParallel(e,n);break;case"loadScript":p=await this.handleLoadScript(h,e,n);break;case"callExternal":p=await this.handleCallExternal(h,e,n);break;case"callExternalEmbed":p=await this.handleCallExternalEmbed(h,e,n);break;case"saveToLocalStorage":p=await this.handleSaveToLocalStorage(h,n);break;case"loadFromLocalStorage":p=await this.handleLoadFromLocalStorage(h,n);break;default:p=await this.handleCustomAction({...e,target:f,params:h},n);break}if(e.resultTo&&p!==void 0){const{target:x,key:y,merge:w}=e.resultTo,v=this.resolveValue(y,n.data),C=w==="replace"?"replace":w==="shallow"?"shallow":"deep";if(x==="_local"&&n.setState){const k=this.buildNestedUpdate(v,p),A=C!=="deep"?{...k,__mergeMode:C}:k;n.setState(A),G.log(`[resultTo] Saved to _local.${v} (merge=${C}):`,p)}else if(x==="_local"&&this.globalStateUpdater){const R=(window.G7Core?.state?.get()||{})._local||{},N=this.buildNestedUpdate(v,p);let D;C==="replace"?D=N:C==="shallow"?D={...R,...N}:D=this.deepMergeWithState(N,R),this.globalStateUpdater({_local:D}),G.log(`[resultTo] Saved to _local.${v} via globalStateUpdater (merge=${C}):`,p)}else if(x==="_global"&&this.globalStateUpdater){const k=this.buildNestedUpdate(v,p);this.globalStateUpdater(k),G.log(`[resultTo] Saved to _global.${v}:`,p)}else if(x==="_isolated"&&n.isolatedContext){const k=this.buildNestedUpdate(v,p);n.isolatedContext.mergeState(k,C),G.log(`[resultTo] Saved to _isolated.${v} (merge=${C}):`,p)}else G.warn(`[resultTo] Cannot save result: target=${x}, setState=${!!n.setState}, globalStateUpdater=${!!this.globalStateUpdater}, isolatedContext=${!!n.isolatedContext}`)}if(e.onSuccess){if(a?.isEnabled()&&i&&e.handler==="apiCall"){const w=window.G7Core,v={};w?.state?.get&&(v._global=w.state.get()),n.state&&(v._local=n.state),a.detectStaleClosure?.(i,`${e.handler} → onSuccess`,v,"callback-state-capture",i)}const x={...n,data:{...n.data,result:p,response:p}},y=Array.isArray(e.onSuccess)?e.onSuccess:[e.onSuccess];y.length>1?await this.handleSequence({handler:"sequence",type:"click",actions:y},x):y.length===1&&await this.executeAction(y[0],x)}return i&&a&&a.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),resolvedParams:d,startTime:o,endTime:performance.now(),duration:performance.now()-o,status:"success",result:this.sanitizeForDevTools(p)}),{success:!0,data:p}}catch(h){const f=h instanceof Gt?h:new Gt(`Failed to execute action: ${e.handler}`,e,h instanceof Error?h:void 0),p=f.originalError?.response||{},x=p.data||{},y=f.originalError?.status||p.status||500,w=x.message||f.message,v={status:y,message:w,errors:x.errors||p.errors,data:x,statusText:f.originalError?.statusText},k=va().resolve(y,{errorHandling:e.errorHandling,onError:e.onError});if(k.handler){if(a?.isEnabled()&&i&&e.handler==="apiCall"){const R=window.G7Core,N={};R?.state?.get&&(N._global=R.state.get()),n.state&&(N._local=n.state),a.detectStaleClosure?.(i,`${e.handler} → onError`,N,"callback-state-capture",i)}const A={...n,data:{...n.data,error:v}};try{const R={type:"click",handler:k.handler.handler,target:k.handler.target,params:k.handler.params,actions:k.handler.actions};return await this.executeAction(R,A),{success:!1,error:f}}catch(R){return G.error("Error executing error handler:",R),{success:!1,error:f}}}throw i&&a&&a.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),resolvedParams:d,startTime:o,endTime:performance.now(),duration:performance.now()-o,status:"error",error:{name:f.name,message:f.message,stack:f.stack}}),f}finally{if(e.handler==="apiCall"&&n.setState&&g){const h=n.state?.loadingActions||{},{[g]:f,...p}=h;n.setState({loadingActions:p})}}}async handleNavigate(e,n,a){let i=e;if(n.query)if(n.mergeQuery===!0)i=this.buildMergedQueryPath(e,n.query);else{const o=new URLSearchParams;for(const[g,h]of Object.entries(n.query))if(h!=null&&h!=="")if(Array.isArray(h)){const f=g.endsWith("[]")?g:`${g}[]`;for(const p of h)p!=null&&p!==""&&o.append(f,String(p))}else o.set(g,String(h));const d=o.toString();d&&(i=`${e}?${d}`)}if(G.log("handleNavigate:",{target:e,params:n,finalPath:i,replace:n.replace,windowLocationSearch:window.location.search}),n.replace===!0){const o=window.G7Core;if(o?.updateQueryParams){await o.updateQueryParams(i),G.log("handleNavigate: Used updateQueryParams for replace mode");return}G.warn("handleNavigate: G7Core.updateQueryParams not available, falling back to React Router")}if(!a.navigate)throw new Gt("Navigate function is not provided in context");a.navigate(i,{replace:n.replace===!0})}async handleOpenWindow(e,n){let a=e;if(n.query){const i=new URLSearchParams;for(const[d,g]of Object.entries(n.query))g!=null&&g!==""&&i.set(d,String(g));const o=i.toString();o&&(a=`${e}?${o}`)}G.log("handleOpenWindow:",{target:e,params:n,finalPath:a}),window.open(a,"_blank")}async handleNavigateBack(){G.log("handleNavigateBack"),window.history.back()}async handleNavigateForward(){G.log("handleNavigateForward"),window.history.forward()}async handleReplaceUrl(e,n){let a=e;if(n.query)if(n.mergeQuery===!0)a=this.buildMergedQueryPath(e,n.query);else{const i=new URLSearchParams;for(const[d,g]of Object.entries(n.query))if(g!=null&&g!=="")if(Array.isArray(g)){const h=d.endsWith("[]")?d:`${d}[]`;for(const f of g)f!=null&&f!==""&&i.append(h,String(f))}else i.set(d,String(g));const o=i.toString();o&&(a=`${e}?${o}`)}G.log("handleReplaceUrl:",{target:e,params:n,finalPath:a}),window.history.replaceState(null,"",a)}buildMergedQueryPath(e,n){const a=new URLSearchParams(window.location.search);for(const[d,g]of Object.entries(n))if(g==null||g==="")a.delete(d);else if(Array.isArray(g)){const h=d.endsWith("[]")?d:`${d}[]`;a.delete(d),a.delete(h);for(const f of g)f!=null&&f!==""&&a.append(h,String(f))}else a.set(d,String(g));const i=a.toString(),o=e.split("?")[0];return i?`${o}?${i}`:o}async ensureCsrfToken(){try{await fetch("/sanctum/csrf-cookie",{credentials:"include"})}catch(e){throw new Gt("Failed to fetch CSRF token",void 0,e instanceof Error?e:void 0)}}getCsrfTokenFromCookie(){const a=`; ${document.cookie}`.split("; XSRF-TOKEN=");if(a.length===2){const i=a.pop()?.split(";").shift();return i?decodeURIComponent(i):null}return null}buildQueryString(e){const n=new URLSearchParams;for(const[a,i]of Object.entries(e))if(!(i==null||i===""))if(Array.isArray(i))for(const o of i)o!=null&&o!==""&&n.append(`${a}[]`,String(o));else typeof i=="object"?n.append(a,JSON.stringify(i)):n.append(a,String(i));return n.toString()}async handleApiCall(e,n,a,i="none"){const{method:o="GET",body:d,headers:g,contentType:h}=n;o!=="GET"&&o!=="HEAD"&&await this.ensureCsrfToken();const f=this.getCsrfTokenFromCookie();let p={};if(i==="required"||i==="optional"){const z=ns().getToken();z&&(p={Authorization:`Bearer ${z}`})}let x=e;const y=n.query||(o==="GET"?d:null);if(y&&typeof y=="object"){const L=this.buildQueryString(y);if(L){const z=e.includes("?")?"&":"?";x=`${e}${z}${L}`}}const w=window.G7Core?.state?.getGlobal?.()||a.state?._global||{},v=window.G7Core?.state?.getLocal?.()||a.state?._local||{},C={_global:w,_local:v},k=this.getMatchingGlobalHeaders(e,C),A={};if(typeof window<"u"){const L=localStorage.getItem("g7_locale");L&&(A["Accept-Language"]=L)}const R=h==="multipart/form-data",N={method:o,headers:{...R?{}:{"Content-Type":"application/json"},Accept:"application/json",...A,...f&&{"X-XSRF-TOKEN":f},...p,...k,...g},credentials:"include"};if(d&&o!=="GET")if(R){const L=new FormData;for(const[z,Y]of Object.entries(d))Y instanceof File||Y instanceof Blob?L.append(z,Y):Y!=null&&L.append(z,typeof Y=="object"?JSON.stringify(Y):String(Y));N.body=L}else N.body=JSON.stringify(d);const D=Vn();let M=null;D?.isEnabled()&&(M=D.trackRequest(x,o));try{const L=await fetch(x,N);let z;try{z=await L.json()}catch{z=null}if(M&&D?.isEnabled()&&(D.completeRequest(M,L.status,z),M=null),!L.ok){const Y=z||{},he=new Error(Y.message||`API call failed: ${L.statusText}`);throw he.response=Y,he.status=L.status,he.statusText=L.statusText,new Gt(Y.message||`API call failed: ${L.statusText}`,void 0,he)}return z}catch(L){throw M&&D?.isEnabled()&&D.failRequest(M,L instanceof Error?L.message:String(L)),L}}async handleLogin(e,n,a){const{body:i}=n;if(!i||!i.email||!i.password)throw new Gt("Login requires email and password in body params");const o=e==="user"?"user":"admin",d=o==="admin"?"/api/auth/admin/login":"/api/auth/login",g=window.G7Core?.state?.getGlobal?.()||a.state?._global||{},h=window.G7Core?.state?.getLocal?.()||a.state?._local||{},f={_global:g,_local:h},p=this.getMatchingGlobalHeaders(d,f),x=as.getInstance();try{const y=Object.keys(p).length>0?{headers:p}:void 0;return{user:await x.login(o,{email:i.email,password:i.password},y)}}catch(y){const w=y.message||"Login failed",v=new Error(w);throw v.response=y.response?.data||{},v.status=y.status||y.response?.status||500,new Gt(w,void 0,v)}}async handleLogout(e,n){await as.getInstance().logout()}async handleSetState(e,n){G.log("[handleSetState] START, params:",e);const{target:a="component",scope:i,merge:o,...d}=e,g=Vn(),h=window.G7Core;if(typeof a=="string"&&(a.startsWith("$parent.")||a.startsWith("$root.")))return this.handleParentScopeSetState(a,d,o,n);const f=n.state&&Object.keys(n.state).length>0?n.state:h?.state?.get()||{},p=a==="global"?"_global":a.startsWith("_local.")?a:"_local",x=p==="_global"?f._global:p.startsWith("_local.")?this.getNestedProperty(f._local||{},p.slice(7)):f._local,y=g?.isEnabled()?g.startStateChange(p,x,d,{actionId:n.actionId,handlerType:"setState",source:`target=${a}`}):void 0,w=o==="replace"?"replace":o==="shallow"?"shallow":"deep",v=w!=="deep"?{...d,__mergeMode:w,...y?{__setStateId:y}:{}}:{...d,...y?{__setStateId:y}:{}};if(a==="global"){if(!this.globalStateUpdater){G.warn("Global state updater is not set"),y&&g&&g.completeStateChange(y);return}const C=h?.state?.get()||{},{__setStateId:k,__mergeMode:A,...R}=v,N=w==="deep"?this.deepMergeWithState(R,C):R,D={...N,...y?{__setStateId:y}:{},...w!=="deep"?{__mergeMode:w}:{}};return G.log("setState global:",D),this.globalStateUpdater(D),y&&g&&setTimeout(()=>g.completeStateChange(y),0),{__target:"global",...w!=="deep"?{__mergeMode:w}:{},...N}}else if(a==="isolated"){const C=n.isolatedContext;if(C){const{__mergeMode:k,__setStateId:A,...R}=v;return C.mergeState(R,w),G.log("[handleSetState] isolated state updated:",R,"mergeMode:",w),y&&g&&setTimeout(()=>g.completeStateChange(y),0),{__target:"isolated",...R}}else if(G.warn('[handleSetState] isolated target used but no IsolatedStateContext found. Make sure the component has "isolatedState" attribute. Falling back to local state.'),n.setState){const A=window.__g7PendingLocalState||n.state||{},R=w==="deep"?this.deepMergeWithState(v,A):v;return n.setState(R),y&&g&&setTimeout(()=>g.completeStateChange(y),0),R}else throw y&&g&&g.completeStateChange(y),new Gt("isolated target used but no IsolatedStateContext found and no setState function in context")}else if(a==="local"||a==="component"||a==="_local"){if(i==="parent"||i==="root"){const k=window.__g7LayoutContextStack||[];if(k.length>0){const A=i==="parent"?k[k.length-1]:k[0];if(A?.setState){const{__mergeMode:R,__setStateId:N,...D}=v,M=w==="deep"?this.deepMergeWithState(D,A.state||{}):D;return G.log(`[handleSetState] scope=${i}: 타겟 컨텍스트에 상태 업데이트`,M),A.setState(M),y&&g&&setTimeout(()=>g.completeStateChange(y),0),M}}G.warn(`[handleSetState] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const C=n.setState&&!n._isDispatchFallbackContext;if(G.log("[handleSetState] isRealComponentContext:",C,"context.setState:",!!n.setState,"_isDispatchFallbackContext:",n._isDispatchFallbackContext),C){G.log("[handleSetState] Using COMPONENT setState path"),G.log("[handleSetState] resolvedPayload:",v),G.log("[handleSetState] context.state:",n.state),G.log("[handleSetState] mergeMode:",w);const A=window.__g7PendingLocalState||n.state||{},R=w==="deep"?this.deepMergeWithState(v,{}):v;G.log("[handleSetState] convertedPayload (변경 필드만, dot notation 변환):",R),n.setState(R);const N=w==="deep"?this.deepMergeWithState(v,A):w==="shallow"?{...n.state||{},...v}:v,{__mergeMode:D,__setStateId:M,...L}=N;window.__g7PendingLocalState=L,G.log("[handleSetState] __g7PendingLocalState updated:",L);const{__mergeMode:z,__setStateId:Y,...he}=v;if(w==="replace")window.__g7ForcedLocalFields=he;else{const be=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=this.deepMergeWithState(he,be)}return G.log("[handleSetState] __g7ForcedLocalFields updated:",he),y&&g&&setTimeout(()=>g.completeStateChange(y),0),{__target:"local",...N}}else if(this.globalStateUpdater){G.log("[handleSetState] Using GLOBAL STATE UPDATER path for _local");const A=window.__g7PendingLocalState||f._local||{};G.log("[handleSetState] currentLocal (with pending):",A);const R=w==="deep"?this.deepMergeWithState(v,A):v;return G.log("[handleSetState] finalLocal (merged):",R),this.globalStateUpdater({_local:R}),window.__g7PendingLocalState=R,G.log("[handleSetState] __g7PendingLocalState updated for globalStateUpdater path"),y&&g&&setTimeout(()=>g.completeStateChange(y),0),{__target:"local",...R}}else throw y&&g&&g.completeStateChange(y),new Gt("setState function is not provided in context and globalStateUpdater is not set")}else if(a.startsWith("_local.")){const C=a.slice(7),{__mergeMode:k,__setStateId:A,...R}=v,N=R.value!==void 0?R.value:Object.values(R)[0];if(n.setState){const M=window.__g7PendingLocalState||n.state||{},L=this.createNestedUpdate(C,N,M),z={...M,...L};return n.setState(L),y&&g&&setTimeout(()=>g.completeStateChange(y),0),z}else throw y&&g&&g.completeStateChange(y),new Gt("setState function is not provided in context")}else{if(!n.setState)throw y&&g&&g.completeStateChange(y),new Gt("setState function is not provided in context");const k=window.__g7PendingLocalState||n.state||{},A=w==="deep"?this.deepMergeWithState(v,k):v;return n.setState(A),y&&g&&setTimeout(()=>g.completeStateChange(y),0),A}}async handleParentScopeSetState(e,n,a,i){const o=Vn(),d=window.G7Core,g=a==="replace"?"replace":a==="shallow"?"shallow":"deep",h=e.startsWith("$parent."),f=h?"$parent.":"$root.",p=e.slice(f.length);let x,y;if(p==="_local"||p==="_global")x=p,y=void 0;else if(p.startsWith("_local."))x="_local",y=p.slice(7);else if(p.startsWith("_global."))x="_global",y=p.slice(8);else{G.warn(`[handleParentScopeSetState] 지원하지 않는 타겟 형식: ${e}. _local 또는 _global으로 시작해야 합니다.`);return}const w=window.__g7LayoutContextStack||[];if(w.length===0){G.warn(`[handleParentScopeSetState] 레이아웃 컨텍스트 스택이 비어있습니다. target=${e}`);return}const v=h?w[w.length-1]:w[0];if(!v){G.warn(`[handleParentScopeSetState] 타겟 컨텍스트를 찾을 수 없습니다. target=${e}`);return}const C=x==="_global"?v.state?._global:v.state?._local,k=o?.isEnabled()?o.startStateChange(e,C,n,{actionId:i.actionId,handlerType:"setState",source:`target=${e}`}):void 0,{__mergeMode:A,__setStateId:R,...N}=n;if(x==="_global"){if(!this.globalStateUpdater){G.warn("[handleParentScopeSetState] globalStateUpdater가 설정되지 않았습니다."),k&&o&&o.completeStateChange(k);return}const D=d?.state?.get()||{};if(y){const M=N.value!==void 0?N.value:Object.values(N)[0],L=this.createNestedUpdate(y,M,D),z={...D,...L};G.log(`[handleParentScopeSetState] ${e}: 전역 상태 중첩 경로 업데이트`,z),this.globalStateUpdater(z)}else{const M=g==="deep"?this.deepMergeWithState(N,D):N;G.log(`[handleParentScopeSetState] ${e}: 전역 상태 업데이트 (mergeMode=${g})`,M),this.globalStateUpdater(g!=="deep"?{...M,__mergeMode:g}:M)}return k&&o&&setTimeout(()=>o.completeStateChange(k),0),{__target:e,...N}}else{if(!v.setState){G.warn(`[handleParentScopeSetState] 타겟 컨텍스트에 setState가 없습니다. target=${e}`),k&&o&&o.completeStateChange(k);return}const D=v.state||{};if(y){const M=N.value!==void 0?N.value:Object.values(N)[0],L=this.createNestedUpdate(y,M,D),z={...D,...L};return G.log(`[handleParentScopeSetState] ${e}: 로컬 상태 중첩 경로 업데이트`,L),v.setState(L),v.state=z,v.dataContext&&(v.dataContext._local=z),dg(),k&&o&&setTimeout(()=>o.completeStateChange(k),0),z}else{const M=g!=="deep"?{...N,__mergeMode:g}:N,L=g==="replace"?N:g==="shallow"?{...D,...N}:this.deepMergeWithState(N,D);return G.log(`[handleParentScopeSetState] ${e}: 로컬 상태 업데이트 (mergeMode=${g})`,L),v.setState(M),v.state=L,v.dataContext&&(v.dataContext._local=L),dg(),k&&o&&setTimeout(()=>o.completeStateChange(k),0),L}}}deepMergeWithState(e,n){const a=["errors"];let i=e;if("..."in e){const d=e["..."];if(d&&typeof d=="object"&&!Array.isArray(d)){const{"...":g,...h}=e;i={...d,...h}}else{const{"...":g,...h}=e;i=h}}const o={...n};for(const[d,g]of Object.entries(i)){if(a.includes(d)){o[d]=g;continue}if(d.includes(".")&&d!=="..."){const h=this.createNestedUpdate(d,g,o);this.deepMergeInto(o,h,o);continue}if(g!==null&&typeof g=="object"&&!Array.isArray(g)&&Object.getPrototypeOf(g)!==Object.prototype&&Object.getPrototypeOf(g)!==null){o[d]=g;continue}g!==null&&typeof g=="object"&&!Array.isArray(g)&&n[d]!==null&&typeof n[d]=="object"&&!Array.isArray(n[d])?o[d]=this.deepMergeWithState(g,n[d]):o[d]=g}return o}deepMergeInto(e,n,a){for(const[i,o]of Object.entries(n)){if(o===null){e[i]=o;continue}if(e[i]===null){e[i]=o;continue}typeof o=="object"&&!Array.isArray(o)&&e[i]!==void 0&&e[i]!==null&&typeof e[i]=="object"&&!Array.isArray(e[i])?(e[i]===a[i]&&(e[i]={...e[i]}),this.deepMergeInto(e[i],o,a[i]||{})):typeof o=="object"&&!Array.isArray(o)&&e[i]===void 0&&a[i]!==null&&typeof a[i]=="object"&&!Array.isArray(a[i])?e[i]={...a[i],...o}:e[i]=o}}createNestedUpdate(e,n,a){const i=e.split(".");if(i.length===1)return{[i[0]]:n};const o={};let d=o,g=a;for(let h=0;h<i.length-1;h++){const f=i[h],p=g?.[f],x=p!=null&&typeof p=="object"&&!Array.isArray(p);x?d[f]={...p}:d[f]={},d=d[f],g=x?p:{}}return d[i[i.length-1]]=n,o}buildNestedUpdate(e,n){const a=e.split(".");if(a.length===1)return{[a[0]]:n};const i={};let o=i;for(let d=0;d<a.length-1;d++)o[a[d]]={},o=o[a[d]];return o[a[a.length-1]]=n,i}async handleSetError(e,n,a){let i=e;i=this.resolveValue(i,a.data),this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,a.data));const o=n?.stateTarget||"local";o==="isolated"&&a.isolatedContext?(a.isolatedContext.mergeState({apiError:i}),G.log("[handleSetError] Error set to isolated state:",i)):o==="global"&&this.globalStateUpdater?(this.globalStateUpdater({apiError:i}),G.log("[handleSetError] Error set to global state:",i)):a.setState?(a.setState({apiError:i}),G.log("[handleSetError] Error set to local state:",i)):G.warn("[handleSetError] Cannot set error: no state updater available")}async handleOpenModal(e,n){if(!this.globalStateUpdater){G.warn("Global state updater is not set for openModal");return}const a=n.data?._global?.modalStack||[];if(a.includes(e)){G.warn(`Modal "${e}" is already open`);return}const i=window.G7Core,o=n.setState&&n.state!==void 0,d=o?void 0:i?.state?.getLocal?.()||{},g=!o&&d!==void 0&&this.globalStateUpdater;if(o||g){const p=window.__g7LayoutContextStack||[],x=o?n.state:d,y=o?n.setState:w=>{this.globalStateUpdater({_local:w})};p.push({state:x,setState:y,dataContext:{_local:x||n.data?._local,_global:o?n.data?._global:n.data?._global||i?.state?.get?.(),_computed:n.data?._computed}}),window.__g7LayoutContextStack=p,G.log(`[handleOpenModal] 레이아웃 컨텍스트 스택에 push, 스택 크기: ${p.length}, state:`,x,o?"(direct)":"(fallback via G7Core)")}else G.warn(`[handleOpenModal] 컨텍스트 스택에 push 실패 - setState: ${!!n.setState}, state: ${n.state!==void 0}, G7Core: ${!!i?.state?.getLocal}`);const h=[...a,e];this.globalStateUpdater({modalStack:h,activeModal:e});const f=Vn();if(f?.isEnabled()){const p=a.length>0?a[a.length-1]:void 0;f.trackModalOpen?.({modalId:e,modalName:e,scopeType:"isolated",parentModalId:p,initialState:n.state?{...n.state}:{}})}}async handleCloseModal(e){if(!this.globalStateUpdater){G.warn("Global state updater is not set for closeModal");return}const n=e?.data?._global?.modalStack||[],a=n.length>0?n[n.length-1]:null,i=n.slice(0,-1),o=i.length>0?i[i.length-1]:null,d=window.__g7LayoutContextStack||[];if(d.length>0){const g=d[d.length-1];g&&(g.dataContext=void 0),d.pop(),window.__g7LayoutContextStack=d,G.log(`[handleCloseModal] 레이아웃 컨텍스트 스택에서 pop, 스택 크기: ${d.length}`)}if(a){const g=Vn();g?.isEnabled()&&g.trackModalClose?.(a,e?.state)}this.globalStateUpdater({modalStack:i,activeModal:o})}async handleShowAlert(e,n){let a=e;this.translationEngine&&this.translationContext&&e.startsWith("$t:")&&(a=this.translationEngine.resolveTranslations(e,this.translationContext,n.data)),alert(a)}async handleToast(e,n){const{type:a="info",message:i,icon:o,duration:d}=e;let g=i;if(this.translationEngine&&this.translationContext&&i?.startsWith("$t:")&&(g=this.translationEngine.resolveTranslations(i,this.translationContext,n.data)),this.globalStateUpdater){const f={id:`toast_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,type:a,message:g,...o&&{icon:o},...d&&{duration:d}},w=[...window.G7Core?.state?.get()?.toasts||[],f];this.globalStateUpdater({toasts:w})}else G.log(`[Toast ${a}] ${g}`)}async handleSwitch(e,n){const{cases:a}=e;if(!a){G.warn("switch handler requires cases property");return}const i=this.resolveParams(e.params,n.data);let o;if(i?.value!==void 0?(o=i.value,G.log("switch handler: using params.value as case key:",o)):(o=n.data?.$args?.[0],G.log("switch handler: using $args[0] as case key:",o)),o==null){if(a.default)return G.log("switch handler: case key is undefined, using default case"),await this.executeAction(a.default,n);G.warn("switch handler: case key is not defined and no default case");return}const d=String(o);let g=a[d];if(!g&&a.default&&(G.log(`switch handler: no case found for key "${d}", using default case`),g=a.default),!g){G.warn(`switch handler: no case found for key "${d}" and no default case`);return}return await this.executeAction(g,n)}async handleConditions(e,n){const{conditions:a}=e;if(!a||!Array.isArray(a)){G.warn("conditions handler requires conditions array");return}const i=n.data||{},o=Wp(a,i,this.bindingEngine);if(!o.matched){G.log("conditions handler: no matching branch found");return}const d=a[o.branchIndex];if(G.log(`conditions handler: matched branch ${o.branchIndex}`),!d.then){G.warn('conditions handler: matched branch has no "then" action');return}return Array.isArray(d.then)?await this.handleSequence({...e,actions:d.then},n):await this.executeAction(d.then,n)}async handleSequence(e,n){const a=e.actions||e.params?.actions;if(!a||!Array.isArray(a)||a.length===0)return G.warn("sequence handler requires non-empty actions array"),[];const i=Vn(),o=i?.isEnabled()&&i.startSequenceExecution?.({eventType:e.type})||"";window.__g7SequenceLocalSync=void 0;const d=[];let g,h=n.state?{...n.state}:{},f=n.isolatedContext?.state?{...n.isolatedContext.state}:{},p=n.data?._computed||{};const x=window.G7Core,y=()=>({_global:x?.state?.get()||{},_local:{...h},_isolated:Object.keys(f).length>0?{...f}:void 0});for(let w=0;w<a.length;w++){const v=a[w],C=Date.now();o&&i?.isEnabled()&&i.captureSequenceActionBefore?.(o,w,v.handler||"unknown",v.params||{},y());const k={...n,state:h,data:{...n.data,_local:h,_computed:p,$computed:p,$prev:g,$results:[...d],_isolated:f},isolatedContext:n.isolatedContext?{...n.isolatedContext,state:f}:null};try{const A=await this.executeAction(v,k);if(g=A.data,d.push(A.data),v.handler==="setState"&&A.data!==void 0){if(A.data.__target==="global"){const{__target:N,__mergeMode:D,...M}=A.data;D==="replace"?h={...h,_global:M}:h={...h,_global:{...h._global||{},...M}},G.log("[handleSequence] global state synchronized (mergeMode=%s):",D||"deep",h._global)}else if(A.data.__target==="isolated"){const{__target:N,__mergeMode:D,...M}=A.data;D==="replace"?f=M:f={...f,...M},G.log("[handleSequence] isolated state synchronized (mergeMode=%s):",D||"deep",f)}else if(A.data.__target==="local"){const{__target:N,__mergeMode:D,__setStateId:M,...L}=A.data;D==="replace"?h=L:h={...h,...L},G.log("[handleSequence] local state synchronized (mergeMode=%s):",D||"deep",h)}else h=A.data,G.log("[handleSequence] state synchronized (legacy):",h);const R=n.data?._computedDefinitions;if(R&&Object.keys(R).length>0){const N={},D={...n.data,_local:h,_computed:N,$computed:N,_isolated:f};for(const[M,L]of Object.entries(R))if(typeof L=="string"){const z=L.trim();if(z.startsWith("{{")&&z.endsWith("}}"))try{const Y=z.slice(2,-2).trim();N[M]=this.bindingEngine.evaluateExpression(Y,D,{skipCache:!0})}catch{N[M]=p[M]}}p=N,G.log("[handleSequence] _computed recalculated after setState:",p)}}if(v.handler!=="setState"){const R=window.__g7SequenceLocalSync;if(R&&R!==h){h=R,window.__g7SequenceLocalSync=void 0,G.log("[handleSequence] currentState synchronized from __g7SequenceLocalSync after custom handler:",v.handler);const N=n.data?._computedDefinitions;if(N&&Object.keys(N).length>0){const D={},M={...n.data,_local:h,_computed:D,$computed:D,_isolated:f};for(const[L,z]of Object.entries(N))if(typeof z=="string"){const Y=z.trim();if(Y.startsWith("{{")&&Y.endsWith("}}"))try{const he=Y.slice(2,-2).trim();D[L]=this.bindingEngine.evaluateExpression(he,M,{skipCache:!0})}catch{D[L]=p[L]}}p=D,G.log("[handleSequence] _computed recalculated after custom handler:",p)}}}o&&i?.isEnabled()&&i.captureSequenceActionAfter?.(o,w,y(),Date.now()-C,A.data)}catch(A){throw o&&i?.isEnabled()&&(i.captureSequenceActionAfter?.(o,w,y(),Date.now()-C,void 0,A),i.endSequenceExecution?.(o,A)),G.error(`sequence handler: action[${w}] failed:`,A),A}}return window.__g7SequenceLocalSync=void 0,o&&i?.isEnabled()&&i.endSequenceExecution?.(o),d}async handleParallel(e,n){const a=e.actions||e.params?.actions;if(!a||!Array.isArray(a)||a.length===0)return G.warn("parallel handler requires non-empty actions array"),[];G.log(`parallel handler: executing ${a.length} actions in parallel`);const i=n.isolatedContext?{...n.isolatedContext,state:{...n.isolatedContext.state}}:null,o=a.map((h,f)=>{const p={...n,isolatedContext:i};return this.executeAction(h,p).catch(x=>{throw G.error(`parallel handler: action[${f}] failed:`,x),x})}),d=await Promise.allSettled(o),g=d.filter(h=>h.status==="rejected").length;return g>0&&G.warn(`parallel handler: ${g}/${a.length} actions failed`),d}async handleLoadScript(e,n,a){const{src:i,id:o,async:d=!0,defer:g=!1}=e;if(!i)throw new Gt('loadScript handler requires "src" parameter',n);const h=o||`script_${i.replace(/[^a-zA-Z0-9]/g,"_")}`;return xi.loadedScripts.has(h)?(G.log(`loadScript: script already loaded, skipping: ${h}`),n.onLoad&&await this.executeAction(n.onLoad,a),!0):document.getElementById(h)?(G.log(`loadScript: script element already exists: ${h}`),xi.loadedScripts.add(h),n.onLoad&&await this.executeAction(n.onLoad,a),!0):(G.log(`loadScript: loading script: ${i}`),new Promise((p,x)=>{const y=document.createElement("script");y.id=h,y.src=i,y.async=d,y.defer=g,y.onload=async()=>{if(G.log(`loadScript: script loaded successfully: ${h}`),xi.loadedScripts.add(h),n.onLoad)try{await this.executeAction(n.onLoad,a)}catch(w){G.error("loadScript: onLoad action failed:",w)}p(!0)},y.onerror=w=>{G.error(`loadScript: failed to load script: ${i}`,w),x(new Gt(`Failed to load script: ${i}`,n))},document.head.appendChild(y)}))}async handleCallExternal(e,n,a){const i=e.constructor,o=e.args||{},d=e.method,g=e.methodArgs||[],h=e.callbackEvent,f=e.embedTarget,p=e.callbackSetState,x=e.callbackAction;if(!i)throw new Gt('callExternal handler requires "constructor" parameter',n);const y=this.getNestedProperty(window,i);if(!y||typeof y!="function")throw new Gt(`Constructor not found or not a function: ${i}. Make sure the script is loaded first using loadScript handler.`,n);G.log(`callExternal: calling constructor ${i}`);const w={...o};for(const[C,k]of Object.entries(o))k===!0&&(w[C]=A=>{if(G.log(`callExternal: callback triggered for ${C}`,A),h&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(h,A),p&&a.setState){const R=M=>{const L={};for(const[z,Y]of Object.entries(M))typeof Y=="string"?L[z]=this.getNestedProperty(A,Y):typeof Y=="object"&&Y!==null&&(L[z]=R(Y));return L},N=R(p);G.log("callExternal: callbackSetState mapping result",N);const D=this.deepMergeWithState(N,a.state||{});G.log("callExternal: merged with existing state",D),a.setState(D)}else h&&a.setState&&a.setState({[`${h.replace(/:/g,"_")}_result`]:A});if(x){const R={...a,data:{...a.data,$event:A}},N=Array.isArray(x)?x:[x];for(const D of N)try{this.executeAction(D,R)}catch(M){G.error("callExternal: callbackAction failed:",M)}}});const v=new y(w);if(d&&typeof v[d]=="function"){if(G.log(`callExternal: calling method ${d}`),d==="embed"&&f){const C=document.querySelector(f);if(C)return v[d](C,...g);throw new Gt(`Embed target element not found: ${f}`,n)}return v[d](...g)}return v}async handleCallExternalEmbed(e,n,a){const i=e.constructor,o=e.args||{},d=e.callbackSetState,g=e.callbackEvent,h=e.layerClassName,f=e.callbackAction;if(!i)throw new Gt('callExternalEmbed handler requires "constructor" parameter',n);const p=this.getNestedProperty(window,i);if(!p||typeof p!="function")throw new Gt(`Constructor not found or not a function: ${i}. Make sure the script is loaded first.`,n);G.log(`callExternalEmbed: creating layer for ${i}`);const{layer:x,closeLayer:y}=this.createEmbedLayer(h),w={...o};for(const[C,k]of Object.entries(o))k===!0&&(w[C]=A=>{if(G.log(`callExternalEmbed: callback triggered for ${C}`,A),y(),g&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(g,A),d&&a.setState){const R=M=>{const L={};for(const[z,Y]of Object.entries(M))typeof Y=="string"?L[z]=this.getNestedProperty(A,Y):typeof Y=="object"&&Y!==null&&(L[z]=R(Y));return L},N=R(d);G.log("callExternalEmbed: callbackSetState mapping result",N);const D=this.deepMergeWithState(N,a.state||{});G.log("callExternalEmbed: merged with existing state",D),a.setState(D)}if(f){const R={...a,data:{...a.data,$event:A}},N=Array.isArray(f)?f:[f];for(const D of N)try{this.executeAction(D,R)}catch(M){G.error("callExternalEmbed: callbackAction failed:",M)}}});const v=new p(w);if(typeof v.embed=="function")v.embed(x),G.log("callExternalEmbed: embedded in layer");else throw y(),new Gt(`Constructor ${i} does not have embed method`,n);return v}createEmbedLayer(e){const n=document.createElement("div");n.id="g7-embed-overlay",n.style.cssText=`
position: fixed;
inset: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
`;const a=document.createElement("div");a.id="g7-embed-layer",a.style.cssText=`
position: relative;
background: white;
border-radius: 8px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
max-width: 90vw;
max-height: 90vh;
overflow: hidden;
`,e&&(a.className=e);const i=document.createElement("button");i.type="button",i.innerHTML="×",i.style.cssText=`
position: absolute;
top: 8px;
right: 8px;
width: 32px;
height: 32px;
border: none;
background: rgba(0, 0, 0, 0.1);
border-radius: 50%;
font-size: 20px;
cursor: pointer;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
color: #666;
transition: background-color 0.2s;
`,i.onmouseenter=()=>{i.style.backgroundColor="rgba(0, 0, 0, 0.2)"},i.onmouseleave=()=>{i.style.backgroundColor="rgba(0, 0, 0, 0.1)"};const o=()=>{n.parentNode&&n.parentNode.removeChild(n)};i.onclick=o;const d=g=>{g.key==="Escape"&&(o(),document.removeEventListener("keydown",d))};return document.addEventListener("keydown",d),n.onclick=g=>{g.target===n&&o()},a.appendChild(i),n.appendChild(a),document.body.appendChild(n),{overlay:n,layer:a,closeLayer:o}}getNestedProperty(e,n){return n.split(".").reduce((a,i)=>a&&a[i]!==void 0?a[i]:void 0,e)}async handleSaveToLocalStorage(e,n){const{key:a,value:i}=e;if(!a)return G.error("saveToLocalStorage: key parameter is required"),!1;try{const o=typeof i=="string"?i:JSON.stringify(i);return localStorage.setItem(a,o),G.log(`saveToLocalStorage: saved ${a}`,i),!0}catch(o){return G.error("saveToLocalStorage: failed to save",{key:a,error:o}),!1}}async handleLoadFromLocalStorage(e,n){const{key:a,target:i,stateKey:o,defaultValue:d}=e;if(!a)return G.error("loadFromLocalStorage: key parameter is required"),d;try{const g=localStorage.getItem(a);if(g===null)return G.log(`loadFromLocalStorage: no value found for ${a}, using default`),o&&n.setState&&n.setState({[o]:d}),d;let h;try{h=JSON.parse(g)}catch{h=g}return G.log(`loadFromLocalStorage: loaded ${a}`,h),o&&n.setState&&n.setState({[o]:h}),h}catch(g){return G.error("loadFromLocalStorage: failed to load",{key:a,error:g}),d}}async handleCustomAction(e,n){const a=this.customHandlers.get(e.handler);if(!a)throw new Gt(`Unknown action handler: ${e.handler}`,e);return await a(e,n)}resolveParams(e,n){if(!e)return{};const a={};for(const[i,o]of Object.entries(e))i.includes("{{")&&G.warn(`[resolveParams] setState params의 키에 표현식이 포함되어 있습니다: "${i}". 키는 해석되지 않습니다. 배열 항목 수정은 .map()/.filter() 패턴을 사용하세요.`),typeof o=="string"&&o.includes("{{")?a[i]=this.evaluateExpression(o,n):typeof o=="string"?a[i]=o:Array.isArray(o)?a[i]=o.map(d=>typeof d=="string"&&d.includes("{{")?this.evaluateExpression(d,n):d):typeof o=="object"&&o!==null&&!Array.isArray(o)&&Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null?a[i]=o:typeof o=="object"&&o!==null?a[i]=this.resolveParams(o,n):a[i]=o;return a}resolveValue(e,n){return n?this.bindingEngine.resolveBindings(e,n,{skipCache:!0}):e}evaluateExpressions(e,n){let a={};for(const[i,o]of Object.entries(e))if(i==="..."){let d=o;typeof o=="string"&&o.includes("{{")&&(d=this.evaluateExpression(o,n)),d&&typeof d=="object"&&!Array.isArray(d)&&(a={...a,...d})}else typeof o=="string"&&o.includes("{{")?a[i]=this.evaluateExpression(o,n):typeof o=="object"&&o!==null&&!Array.isArray(o)?a[i]=this.evaluateExpressions(o,n):a[i]=o;return a}evaluateExpressionsIfNeeded(e,n){const a={};for(const[i,o]of Object.entries(e))typeof o=="string"&&o.includes("{{")?a[i]=this.evaluateExpression(o,n):a[i]=o;return a}evaluateExpression(e,n){if(!n)return e;const a=e.match(/^\{\{(.+)\}\}$/);if(!(a&&!a[1].includes("}}")&&!a[1].includes("{{"))){let g=n;if(e.includes("_global")){const f=window.G7Core?.state?.get()?._global;f&&(g={...n,_global:f})}if(e.includes("_computed")||e.includes("$computed")){const f=window.__g7ActionContext?.computedRef?.current;f&&Object.keys(f).length>0&&(g={...g,_computed:f,$computed:f})}return this.bindingEngine.resolveBindings(e,g,{skipCache:!0})}let o=a[1].trim();o=o.replace(/\$args\.(\d+)/g,"$args[$1]");let d=n;if(o.includes("_global")){const h=window.G7Core?.state?.get()?._global;h&&(d={...n,_global:h})}if(o.includes("_computed")||o.includes("$computed")){const h=window.__g7ActionContext?.computedRef?.current;h&&Object.keys(h).length>0&&(d={...d,_computed:h,$computed:h})}o.includes("_global.modules")&&(G.log("[evaluateExpression] expression:",o),G.log("[evaluateExpression] dataContext._global:",d._global),G.log("[evaluateExpression] dataContext._global?.modules:",d._global?.modules));try{const g=this.bindingEngine.evaluateExpression(o,d);return o.includes("_global.modules")&&G.log("[evaluateExpression] result:",g),typeof g=="string"&&g.startsWith("$t:")&&this.translationEngine&&this.translationContext?this.translationEngine.resolveTranslations(g,this.translationContext,n):g}catch(g){return G.error("Expression evaluation failed:",e,g),e}}setDefaultContext(e){this.defaultContext={...this.defaultContext,...e}}setGlobalStateUpdater(e){this.globalStateUpdater=e}getGlobalStateUpdater(){return this.globalStateUpdater}async dispatchAction(e,n){const a={...this.defaultContext,...n,data:{...this.defaultContext.data,...n?.data}};if(e.confirm){let i=this.resolveValue(e.confirm,a.data);if(this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,a.data)),!confirm(i))return{success:!1}}try{return await this.executeAction(e,a)}catch(i){if(G.error("dispatchAction failed:",i),e.onError){const o=i instanceof Gt&&i.originalError?{message:i.originalError.message,response:i.originalError.response}:{message:i instanceof Error?i.message:String(i)},d={...a,data:{...a.data,error:o}},g=Array.isArray(e.onError)?e.onError:[e.onError];for(const h of g)await this.executeAction(h,d)}return{success:!1,error:i instanceof Error?i:new Error(String(i))}}}registerHandler(e,n,a){this.customHandlers.set(e,n);const i=Vn();i?.isEnabled()&&i.trackHandlerRegistration(e,a?.category??"custom",a?.description,a?.source)}unregisterHandler(e){this.customHandlers.delete(e);const n=Vn();n?.isEnabled()&&n.trackHandlerUnregistration(e)}getRegisteredHandlers(){return Array.from(this.customHandlers.keys())}normalizeDebounceConfig(e){return typeof e=="number"?{delay:e,leading:!1,trailing:!0}:{delay:e.delay,leading:e.leading??!1,trailing:e.trailing??!0}}extractEventData(e){const n=e.target;if(n&&!("tagName"in n)){const o={type:e.type??"custom",target:{value:n.value,name:n.name??""}};return e._changedKeys&&(o._changedKeys=e._changedKeys),o}const i=n?{value:n.value,name:n.name??"",checked:n.checked??!1,type:n.type??"",tagName:n.tagName}:{};if(e.type==="scroll"&&n){const o=n;i.scrollHeight=o.scrollHeight??0,i.scrollTop=o.scrollTop??0,i.clientHeight=o.clientHeight??0,i.scrollLeft=o.scrollLeft??0,i.clientWidth=o.clientWidth??0,i.scrollWidth=o.scrollWidth??0}return{type:e.type,target:n?i:null}}executeDebouncedAction(e,n,a,i,o){const d={...a,$event:n,$args:o},g={type:n.type,target:n.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(e,d,i)(g)}handleDebouncedAction(e,n,a,i,o,d){const g=this.normalizeDebounceConfig(e.debounce),h=o||`default-${e.handler}-${Date.now()}`,f=this.extractEventData(n),p=f._changedKeys;if(p&&Array.isArray(p)&&f?.target?.value&&typeof f.target.value=="object"&&!Array.isArray(f.target.value)){const v=this.debounceAccumulatedValues.get(h);if(v){const C={...v};for(const k of p)C[k]=f.target.value[k];f.target.value=C}this.debounceAccumulatedValues.set(h,f.target.value)}const x=this.debounceTimers.get(h);x&&(clearTimeout(x),this.debounceTimers.delete(h));const y=Vn();y?.isEnabled()&&y.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"pending",params:e.params,debounce:{delay:g.delay,status:"pending",scheduledAt:Date.now()}});const w=!this.debounceTimers.has(h+"_leading");if(g.leading&&w&&(this.debounceTimers.set(h+"_leading",setTimeout(()=>{},0)),this.executeDebouncedAction(e,f,a,i,d),y?.isEnabled()&&y.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"success",params:e.params,debounce:{delay:g.delay,status:"executed",executedAt:Date.now(),mode:"leading"}})),g.trailing){const v=()=>{this.executeDebouncedAction(e,f,a,i,d),y?.isEnabled()&&y.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"success",params:e.params,debounce:{delay:g.delay,status:"executed",executedAt:Date.now(),mode:"trailing"}})},C=setTimeout(()=>{this.debounceTimers.delete(h),this.debounceTimers.delete(h+"_leading"),this.pendingDebounceFlushers.delete(h),this.debounceAccumulatedValues.delete(h),v()},g.delay);this.debounceTimers.set(h,C),this.pendingDebounceFlushers.set(h,v)}}clearDebounceTimers(e){if(e)for(const[n,a]of this.debounceTimers)n.startsWith(e+"-")&&(clearTimeout(a),this.debounceTimers.delete(n),this.pendingDebounceFlushers.delete(n),this.debounceAccumulatedValues.delete(n));else{for(const n of this.debounceTimers.values())clearTimeout(n);this.debounceTimers.clear(),this.pendingDebounceFlushers.clear(),this.debounceAccumulatedValues.clear()}}flushPendingDebounceTimers(){if(this.pendingDebounceFlushers.size===0)return;const e=new Map(this.pendingDebounceFlushers);for(const[n,a]of e){const i=this.debounceTimers.get(n);i&&(clearTimeout(i),this.debounceTimers.delete(n)),this.debounceTimers.delete(n+"_leading"),this.pendingDebounceFlushers.delete(n),a()}}bindActionsToProps(e,n,a){const i={...e};if(e.actions&&Array.isArray(e.actions)){const o=new Map;for(const p of e.actions){const x=this.resolveActionRef(p),y=x.event||this.getEventHandlerName(x.type);o.has(y)||o.set(y,[]),o.get(y).push(x)}const d=e.name||e.id||"unknown",g=o.has("onDrop"),h=o.has("onDragOver"),f=o.has("onDragEnter");g&&!h&&(i.onDragOver=p=>{p.preventDefault()}),g&&!f&&(i.onDragEnter=p=>{p.preventDefault()});for(const[p,x]of o)i[p]=(...y)=>{for(const w of x){const v=y[0],C=v&&typeof v=="object"&&"preventDefault"in v;if(C&&(p==="onDragOver"||p==="onDrop")&&v.preventDefault(),C&&w.key&&"key"in v){if(v.key!==w.key){G.log("Key filter not matched:",w.key,"actual:",v.key);continue}G.log("Key filter matched:",w.key)}if(w.debounce){const k=`${d}-${w.handler}-${p}`,A=v&&typeof v=="object"&&!("preventDefault"in v)&&"target"in v&&v.target!==null;let R;if(C)R=v;else if(A){const D={type:"custom",target:v.target,preventDefault:()=>{},stopPropagation:()=>{}};v._changedKeys&&(D._changedKeys=v._changedKeys),R=D}else R=new Event("custom");const N=w.event?{...n,$args:y}:n;this.handleDebouncedAction(w,R,N,a,k,y)}else if(this.flushPendingDebounceTimers(),w.event){const k={...n,$args:y},A=C?v:new Event("custom");this.createHandler(w,k,a)(A)}else if(C)this.createHandler(w,n,a)(v);else if(v&&typeof v=="object"&&!("preventDefault"in v)&&"target"in v&&v.target!==null){const A={type:"custom",target:v.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(w,n,a)(A)}}}}return i}getEventHandlerName(e){return{click:"onClick",change:"onChange",input:"onInput",submit:"onSubmit",focus:"onFocus",blur:"onBlur",keydown:"onKeyDown",keyup:"onKeyUp",keypress:"onKeyPress",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",scroll:"onScroll",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",dragenter:"onDragEnter",dragover:"onDragOver",dragleave:"onDragLeave",drop:"onDrop"}[e]||`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}sanitizeForDevTools(e,n=5){const a=new WeakSet,i=(o,d)=>{if(o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o;if(d>n)return"[Max Depth Exceeded]";if(typeof o=="function")return`[Function: ${o.name||"anonymous"}]`;if(o instanceof Element)return`[Element: ${o.tagName}${o.className?"."+o.className.split(" ").join("."):""}]`;if(o instanceof Event)return`[Event: ${o.type}]`;if(Array.isArray(o)){if(a.has(o))return"[Circular Array]";a.add(o);const g=o.slice(0,10).map(h=>i(h,d+1));return o.length>10&&g.push(`... ${o.length-10} more items`),g}if(typeof o=="object"){if(a.has(o))return"[Circular Reference]";a.add(o);const g={},h=Object.keys(o),f=h.slice(0,20);for(const p of f)try{g[p]=i(o[p],d+1)}catch{g[p]="[Error accessing property]"}return h.length>20&&(g["..."]=`${h.length-20} more properties`),g}return String(o)};return i(e,0)}};H(xi,"loadedScripts",new Set);let So=xi,yc=null;function Fm(r){return yc||(yc=new So(r)),yc}function g7(r){yc=r}const Vm=at("TransitionManager");class h7{constructor(){H(this,"isPending",!1);H(this,"subscribers",new Set)}setPending(e){this.isPending!==e&&(Vm.log("setPending:",{from:this.isPending,to:e,stack:new Error().stack}),this.isPending=e,this.notifySubscribers())}getIsPending(){return this.isPending}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}notifySubscribers(){Vm.log("notifySubscribers:",{isPending:this.isPending,subscriberCount:this.subscribers.size}),this.subscribers.forEach(e=>{e(this.isPending)})}clearSubscribers(){this.subscribers.clear()}}const Pa=new h7,xc=at("TransitionContext"),Km=j.createContext({isTransitioning:!1}),ug=({children:r})=>{const[e,n]=j.useState(()=>{const i=Pa.getIsPending();return xc.log("Initial state:",i),i});j.useEffect(()=>{xc.log("Subscribing to TransitionManager");const i=Pa.subscribe(o=>{xc.log("Received isPending update:",o),n(o)});return()=>{xc.log("Unsubscribing from TransitionManager"),i()}},[]);const a=j.useMemo(()=>({isTransitioning:e}),[e]);return l.jsx(Km.Provider,{value:a,children:r})},Wm=()=>j.useContext(Km);function f7(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function Ym(r){const e=f7(r);return{width:r,isMobile:e==="mobile",isTablet:e==="tablet",isDesktop:e==="desktop",matchedPreset:e}}const Jm=j.createContext(Ym(1024)),gg=({children:r,overrideWidth:e})=>{const[n,a]=j.useState(()=>ei.getWidth());j.useEffect(()=>{const d=ei.subscribe(g=>{a(g)});return()=>{d()}},[]);const i=e??n,o=j.useMemo(()=>Ym(i),[i]);return l.jsx(Jm.Provider,{value:o,children:r})},Xm=()=>j.useContext(Jm),Qm=j.createContext({}),p7=({children:r,value:e})=>l.jsx(Qm.Provider,{value:e,children:r}),m7=()=>j.useContext(Qm),y7=(r,e)=>{if(!r)return;const n=e.split(".");let a=r;for(const i of n){if(a==null)return;a=a[i]}return a},x7=(r,e,n)=>{const a=e.split(".");if(a.length===1)return{...r,[a[0]]:n};const i={...r};let o=i;for(let d=0;d<a.length-1;d++){const g=a[d],h=a[d+1],f=/^\d+$/.test(h);Array.isArray(o[g])&&!f?o[g]={...o[g]}:Array.isArray(o[g])?o[g]=[...o[g]]:f?o[g]=Array.isArray(o[g])?[...o[g]]:[]:o[g]={...o[g]||{}},o=o[g]}return o[a[a.length-1]]=n,i},ii=at("IsolatedStateContext"),b7={state:{},setState:()=>{ii.warn("IsolatedStateContext not available: setState called outside IsolatedStateProvider")},getState:()=>{},mergeState:()=>{ii.warn("IsolatedStateContext not available: mergeState called outside IsolatedStateProvider")},stateRef:{current:{}},scopeId:""},Zm=j.createContext(b7);let v7=0;function S7(){return`isolated-${++v7}-${Date.now().toString(36)}`}function ey(r,e){if(e==null)return r;if(typeof e!="object"||Array.isArray(e))return e;const n={...r};for(const a of Object.keys(e)){const i=e[a],o=r?.[a];i!==null&&typeof i=="object"&&!Array.isArray(i)&&o!==null&&typeof o=="object"&&!Array.isArray(o)?n[a]=ey(o,i):n[a]=i}return n}function w7(r,e){return e?e.split(".").reduce((n,a)=>n?.[a],r):r}function C7(r,e,n){const a=e.split("."),i={...r};let o=i;for(let d=0;d<a.length-1;d++){const g=a[d];o[g]={...o[g]},o=o[g]}return o[a[a.length-1]]=n,i}const j7=({initialState:r={},scopeId:e,children:n})=>{const i=j.useRef(e||S7()).current,[o,d]=j.useState(r),g=j.useRef(o);g.current=o;const h=j.useCallback(w=>w7(g.current,w),[]),f=j.useCallback((w,v)=>{d(C=>{const k=C7(C,w,v);return ii.log(`[${i}] setState: ${w} =`,v),k})},[i]),p=j.useCallback((w,v="deep")=>{d(C=>{let k;return v==="replace"?k=w:v==="shallow"?k={...C,...w}:k=ey(C,w),ii.log(`[${i}] mergeState (${v}):`,w),k})},[i]),x=j.useMemo(()=>({state:o,setState:f,getState:h,mergeState:p,stateRef:g,scopeId:i}),[o,f,h,p,i]),y=j.useMemo(()=>({state:g.current,setState:f,getState:h,mergeState:p}),[f,h,p]);return j.useEffect(()=>{const w=window.G7Core,v=window.__g7IsolatedStates||{};return window.__g7IsolatedStates||(window.__g7IsolatedStates=v),v[i]=y,w&&(w._isolatedStates||(w._isolatedStates={}),w._isolatedStates[i]=o),w?.devTools?.isEnabled?.()&&w.devTools.emit?.("isolated:created",{id:i,state:o}),ii.log(`[${i}] IsolatedStateProvider mounted with initial state:`,o),()=>{delete v[i],w?._isolatedStates&&delete w._isolatedStates[i],w?.devTools?.isEnabled?.()&&w.devTools.emit?.("isolated:destroyed",{id:i}),ii.log(`[${i}] IsolatedStateProvider unmounted`)}},[i,y]),j.useEffect(()=>{const w=window.G7Core,v=window.__g7IsolatedStates;v?.[i]&&(v[i].state=o),w?._isolatedStates&&(w._isolatedStates[i]=o),w?.devTools?.isEnabled?.()&&w.devTools.emit?.("isolated:updated",{id:i,state:o})},[o,i]),l.jsx(Zm.Provider,{value:x,children:n})},k7=()=>{const r=j.useContext(Zm);return r.scopeId?r:null};var Os=Mp();function N7(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return j.useMemo(()=>a=>{e.forEach(i=>i(a))},e)}const bc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function oi(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function hg(r){return"nodeType"in r}function Mn(r){var e,n;return r?oi(r)?r:hg(r)&&(e=(n=r.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function fg(r){const{Document:e}=Mn(r);return r instanceof e}function wo(r){return oi(r)?!1:r instanceof Mn(r).HTMLElement}function ty(r){return r instanceof Mn(r).SVGElement}function li(r){return r?oi(r)?r.document:hg(r)?fg(r)?r:wo(r)||ty(r)?r.ownerDocument:document:document:document}const Ua=bc?j.useLayoutEffect:j.useEffect;function pg(r){const e=j.useRef(r);return Ua(()=>{e.current=r}),j.useCallback(function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return e.current==null?void 0:e.current(...a)},[])}function E7(){const r=j.useRef(null),e=j.useCallback((a,i)=>{r.current=setInterval(a,i)},[]),n=j.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,n]}function Co(r,e){e===void 0&&(e=[r]);const n=j.useRef(r);return Ua(()=>{n.current!==r&&(n.current=r)},e),n}function jo(r,e){const n=j.useRef();return j.useMemo(()=>{const a=r(n.current);return n.current=a,a},[...e])}function vc(r){const e=pg(r),n=j.useRef(null),a=j.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,a]}function mg(r){const e=j.useRef();return j.useEffect(()=>{e.current=r},[r]),e.current}let yg={};function ko(r,e){return j.useMemo(()=>{if(e)return e;const n=yg[r]==null?0:yg[r]+1;return yg[r]=n,r+"-"+n},[r,e])}function ny(r){return function(e){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return a.reduce((o,d)=>{const g=Object.entries(d);for(const[h,f]of g){const p=o[h];p!=null&&(o[h]=p+r*f)}return o},{...e})}}const ci=ny(1),No=ny(-1);function _7(r){return"clientX"in r&&"clientY"in r}function xg(r){if(!r)return!1;const{KeyboardEvent:e}=Mn(r.target);return e&&r instanceof e}function T7(r){if(!r)return!1;const{TouchEvent:e}=Mn(r.target);return e&&r instanceof e}function bg(r){if(T7(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:n}=r.touches[0];return{x:e,y:n}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:n}=r.changedTouches[0];return{x:e,y:n}}}return _7(r)?{x:r.clientX,y:r.clientY}:null}const Eo=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:n}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:n}=r;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(r){if(r)return[Eo.Translate.toString(r),Eo.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:n,easing:a}=r;return e+" "+n+"ms "+a}}}),ay="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function A7(r){return r.matches(ay)?r:r.querySelector(ay)}const D7={display:"none"};function R7(r){let{id:e,value:n}=r;return Fe.createElement("div",{id:e,style:D7},n)}function O7(r){let{id:e,announcement:n,ariaLiveType:a="assertive"}=r;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Fe.createElement("div",{id:e,style:i,role:"status","aria-live":a,"aria-atomic":!0},n)}function L7(){const[r,e]=j.useState("");return{announce:j.useCallback(a=>{a!=null&&e(a)},[]),announcement:r}}const sy=j.createContext(null);function M7(r){const e=j.useContext(sy);j.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function $7(){const[r]=j.useState(()=>new Set),e=j.useCallback(a=>(r.add(a),()=>r.delete(a)),[r]);return[j.useCallback(a=>{let{type:i,event:o}=a;r.forEach(d=>{var g;return(g=d[i])==null?void 0:g.call(d,o)})},[r]),e]}const I7={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},z7={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function H7(r){let{announcements:e=z7,container:n,hiddenTextDescribedById:a,screenReaderInstructions:i=I7}=r;const{announce:o,announcement:d}=L7(),g=ko("DndLiveRegion"),[h,f]=j.useState(!1);if(j.useEffect(()=>{f(!0)},[]),M7(j.useMemo(()=>({onDragStart(x){let{active:y}=x;o(e.onDragStart({active:y}))},onDragMove(x){let{active:y,over:w}=x;e.onDragMove&&o(e.onDragMove({active:y,over:w}))},onDragOver(x){let{active:y,over:w}=x;o(e.onDragOver({active:y,over:w}))},onDragEnd(x){let{active:y,over:w}=x;o(e.onDragEnd({active:y,over:w}))},onDragCancel(x){let{active:y,over:w}=x;o(e.onDragCancel({active:y,over:w}))}}),[o,e])),!h)return null;const p=Fe.createElement(Fe.Fragment,null,Fe.createElement(R7,{id:a,value:i.draggable}),Fe.createElement(O7,{id:g,announcement:d}));return n?Os.createPortal(p,n):p}var un;(function(r){r.DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable"})(un||(un={}));function Sc(){}function ry(r,e){return j.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function P7(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return j.useMemo(()=>[...e].filter(a=>a!=null),[...e])}const Sa=Object.freeze({x:0,y:0});function iy(r,e){return Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2))}function oy(r,e){let{data:{value:n}}=r,{data:{value:a}}=e;return n-a}function U7(r,e){let{data:{value:n}}=r,{data:{value:a}}=e;return a-n}function ly(r){let{left:e,top:n,height:a,width:i}=r;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+a},{x:e+i,y:n+a}]}function cy(r,e){if(!r||r.length===0)return null;const[n]=r;return n[e]}function dy(r,e,n){return e===void 0&&(e=r.left),n===void 0&&(n=r.top),{x:e+r.width*.5,y:n+r.height*.5}}const B7=r=>{let{collisionRect:e,droppableRects:n,droppableContainers:a}=r;const i=dy(e,e.left,e.top),o=[];for(const d of a){const{id:g}=d,h=n.get(g);if(h){const f=iy(dy(h),i);o.push({id:g,data:{droppableContainer:d,value:f}})}}return o.sort(oy)},q7=r=>{let{collisionRect:e,droppableRects:n,droppableContainers:a}=r;const i=ly(e),o=[];for(const d of a){const{id:g}=d,h=n.get(g);if(h){const f=ly(h),p=i.reduce((y,w,v)=>y+iy(f[v],w),0),x=Number((p/4).toFixed(4));o.push({id:g,data:{droppableContainer:d,value:x}})}}return o.sort(oy)};function G7(r,e){const n=Math.max(e.top,r.top),a=Math.max(e.left,r.left),i=Math.min(e.left+e.width,r.left+r.width),o=Math.min(e.top+e.height,r.top+r.height),d=i-a,g=o-n;if(a<i&&n<o){const h=e.width*e.height,f=r.width*r.height,p=d*g,x=p/(h+f-p);return Number(x.toFixed(4))}return 0}const F7=r=>{let{collisionRect:e,droppableRects:n,droppableContainers:a}=r;const i=[];for(const o of a){const{id:d}=o,g=n.get(d);if(g){const h=G7(g,e);h>0&&i.push({id:d,data:{droppableContainer:o,value:h}})}}return i.sort(U7)};function V7(r,e,n){return{...r,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function uy(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:Sa}function K7(r){return function(n){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return i.reduce((d,g)=>({...d,top:d.top+r*g.y,bottom:d.bottom+r*g.y,left:d.left+r*g.x,right:d.right+r*g.x}),{...n})}}const W7=K7(1);function Y7(r){if(r.startsWith("matrix3d(")){const e=r.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(r.startsWith("matrix(")){const e=r.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function J7(r,e,n){const a=Y7(e);if(!a)return r;const{scaleX:i,scaleY:o,x:d,y:g}=a,h=r.left-d-(1-i)*parseFloat(n),f=r.top-g-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),p=i?r.width/i:r.width,x=o?r.height/o:r.height;return{width:p,height:x,top:f,right:h+p,bottom:f+x,left:h}}const X7={ignoreTransform:!1};function di(r,e){e===void 0&&(e=X7);let n=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:f,transformOrigin:p}=Mn(r).getComputedStyle(r);f&&(n=J7(n,f,p))}const{top:a,left:i,width:o,height:d,bottom:g,right:h}=n;return{top:a,left:i,width:o,height:d,bottom:g,right:h}}function gy(r){return di(r,{ignoreTransform:!0})}function Q7(r){const e=r.innerWidth,n=r.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Z7(r,e){return e===void 0&&(e=Mn(r).getComputedStyle(r)),e.position==="fixed"}function eC(r,e){e===void 0&&(e=Mn(r).getComputedStyle(r));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=e[i];return typeof o=="string"?n.test(o):!1})}function wc(r,e){const n=[];function a(i){if(e!=null&&n.length>=e||!i)return n;if(fg(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!wo(i)||ty(i)||n.includes(i))return n;const o=Mn(r).getComputedStyle(i);return i!==r&&eC(i,o)&&n.push(i),Z7(i,o)?n:a(i.parentNode)}return r?a(r):n}function hy(r){const[e]=wc(r,1);return e??null}function vg(r){return!bc||!r?null:oi(r)?r:hg(r)?fg(r)||r===li(r).scrollingElement?window:wo(r)?r:null:null}function fy(r){return oi(r)?r.scrollX:r.scrollLeft}function py(r){return oi(r)?r.scrollY:r.scrollTop}function Sg(r){return{x:fy(r),y:py(r)}}var mn;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(mn||(mn={}));function my(r){return!bc||!r?!1:r===document.scrollingElement}function yy(r){const e={x:0,y:0},n=my(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},a={x:r.scrollWidth-n.width,y:r.scrollHeight-n.height},i=r.scrollTop<=e.y,o=r.scrollLeft<=e.x,d=r.scrollTop>=a.y,g=r.scrollLeft>=a.x;return{isTop:i,isLeft:o,isBottom:d,isRight:g,maxScroll:a,minScroll:e}}const tC={x:.2,y:.2};function nC(r,e,n,a,i){let{top:o,left:d,right:g,bottom:h}=n;a===void 0&&(a=10),i===void 0&&(i=tC);const{isTop:f,isBottom:p,isLeft:x,isRight:y}=yy(r),w={x:0,y:0},v={x:0,y:0},C={height:e.height*i.y,width:e.width*i.x};return!f&&o<=e.top+C.height?(w.y=mn.Backward,v.y=a*Math.abs((e.top+C.height-o)/C.height)):!p&&h>=e.bottom-C.height&&(w.y=mn.Forward,v.y=a*Math.abs((e.bottom-C.height-h)/C.height)),!y&&g>=e.right-C.width?(w.x=mn.Forward,v.x=a*Math.abs((e.right-C.width-g)/C.width)):!x&&d<=e.left+C.width&&(w.x=mn.Backward,v.x=a*Math.abs((e.left+C.width-d)/C.width)),{direction:w,speed:v}}function aC(r){if(r===document.scrollingElement){const{innerWidth:o,innerHeight:d}=window;return{top:0,left:0,right:o,bottom:d,width:o,height:d}}const{top:e,left:n,right:a,bottom:i}=r.getBoundingClientRect();return{top:e,left:n,right:a,bottom:i,width:r.clientWidth,height:r.clientHeight}}function xy(r){return r.reduce((e,n)=>ci(e,Sg(n)),Sa)}function sC(r){return r.reduce((e,n)=>e+fy(n),0)}function rC(r){return r.reduce((e,n)=>e+py(n),0)}function iC(r,e){if(e===void 0&&(e=di),!r)return;const{top:n,left:a,bottom:i,right:o}=e(r);hy(r)&&(i<=0||o<=0||n>=window.innerHeight||a>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const oC=[["x",["left","right"],sC],["y",["top","bottom"],rC]];class wg{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=wc(n),i=xy(a);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,d,g]of oC)for(const h of d)Object.defineProperty(this,h,{get:()=>{const f=g(a),p=i[o]-f;return this.rect[h]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class _o{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=e}add(e,n,a){var i;(i=this.target)==null||i.addEventListener(e,n,a),this.listeners.push([e,n,a])}}function lC(r){const{EventTarget:e}=Mn(r);return r instanceof e?r:li(r)}function Cg(r,e){const n=Math.abs(r.x),a=Math.abs(r.y);return typeof e=="number"?Math.sqrt(n**2+a**2)>e:"x"in e&&"y"in e?n>e.x&&a>e.y:"x"in e?n>e.x:"y"in e?a>e.y:!1}var sa;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(sa||(sa={}));function by(r){r.preventDefault()}function cC(r){r.stopPropagation()}var ht;(function(r){r.Space="Space",r.Down="ArrowDown",r.Right="ArrowRight",r.Left="ArrowLeft",r.Up="ArrowUp",r.Esc="Escape",r.Enter="Enter",r.Tab="Tab"})(ht||(ht={}));const vy={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},dC=(r,e)=>{let{currentCoordinates:n}=e;switch(r.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class jg{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new _o(li(n)),this.windowListeners=new _o(Mn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sa.Resize,this.handleCancel),this.windowListeners.add(sa.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sa.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,a=e.node.current;a&&iC(a),n(Sa)}handleKeyDown(e){if(xg(e)){const{active:n,context:a,options:i}=this.props,{keyboardCodes:o=vy,coordinateGetter:d=dC,scrollBehavior:g="smooth"}=i,{code:h}=e;if(o.end.includes(h)){this.handleEnd(e);return}if(o.cancel.includes(h)){this.handleCancel(e);return}const{collisionRect:f}=a.current,p=f?{x:f.left,y:f.top}:Sa;this.referenceCoordinates||(this.referenceCoordinates=p);const x=d(e,{active:n,context:a.current,currentCoordinates:p});if(x){const y=No(x,p),w={x:0,y:0},{scrollableAncestors:v}=a.current;for(const C of v){const k=e.code,{isTop:A,isRight:R,isLeft:N,isBottom:D,maxScroll:M,minScroll:L}=yy(C),z=aC(C),Y={x:Math.min(k===ht.Right?z.right-z.width/2:z.right,Math.max(k===ht.Right?z.left:z.left+z.width/2,x.x)),y:Math.min(k===ht.Down?z.bottom-z.height/2:z.bottom,Math.max(k===ht.Down?z.top:z.top+z.height/2,x.y))},he=k===ht.Right&&!R||k===ht.Left&&!N,be=k===ht.Down&&!D||k===ht.Up&&!A;if(he&&Y.x!==x.x){const X=C.scrollLeft+y.x,ge=k===ht.Right&&X<=M.x||k===ht.Left&&X>=L.x;if(ge&&!y.y){C.scrollTo({left:X,behavior:g});return}ge?w.x=C.scrollLeft-X:w.x=k===ht.Right?C.scrollLeft-M.x:C.scrollLeft-L.x,w.x&&C.scrollBy({left:-w.x,behavior:g});break}else if(be&&Y.y!==x.y){const X=C.scrollTop+y.y,ge=k===ht.Down&&X<=M.y||k===ht.Up&&X>=L.y;if(ge&&!y.x){C.scrollTo({top:X,behavior:g});return}ge?w.y=C.scrollTop-X:w.y=k===ht.Down?C.scrollTop-M.y:C.scrollTop-L.y,w.y&&C.scrollBy({top:-w.y,behavior:g});break}}this.handleMove(e,ci(No(x,this.referenceCoordinates),w))}}}handleMove(e,n){const{onMove:a}=this.props;e.preventDefault(),a(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jg.activators=[{eventName:"onKeyDown",handler:(r,e,n)=>{let{keyboardCodes:a=vy,onActivation:i}=e,{active:o}=n;const{code:d}=r.nativeEvent;if(a.start.includes(d)){const g=o.activatorNode.current;return g&&r.target!==g?!1:(r.preventDefault(),i?.({event:r.nativeEvent}),!0)}return!1}}];function Sy(r){return!!(r&&"distance"in r)}function wy(r){return!!(r&&"delay"in r)}class kg{constructor(e,n,a){var i;a===void 0&&(a=lC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:o}=e,{target:d}=o;this.props=e,this.events=n,this.document=li(d),this.documentListeners=new _o(this.document),this.listeners=new _o(a),this.windowListeners=new _o(Mn(d)),this.initialCoordinates=(i=bg(o))!=null?i:Sa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(sa.Resize,this.handleCancel),this.windowListeners.add(sa.DragStart,by),this.windowListeners.add(sa.VisibilityChange,this.handleCancel),this.windowListeners.add(sa.ContextMenu,by),this.documentListeners.add(sa.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(wy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Sy(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:a,onPending:i}=this.props;i(a,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(sa.Click,cC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sa.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:a,initialCoordinates:i,props:o}=this,{onMove:d,options:{activationConstraint:g}}=o;if(!i)return;const h=(n=bg(e))!=null?n:Sa,f=No(i,h);if(!a&&g){if(Sy(g)){if(g.tolerance!=null&&Cg(f,g.tolerance))return this.handleCancel();if(Cg(f,g.distance))return this.handleStart()}if(wy(g)&&Cg(f,g.tolerance))return this.handleCancel();this.handlePending(g,f);return}e.cancelable&&e.preventDefault(),d(h)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const uC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ng extends kg{constructor(e){const{event:n}=e,a=li(n.target);super(e,uC,a)}}Ng.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:a}=e;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const gC={move:{name:"mousemove"},end:{name:"mouseup"}};var Eg;(function(r){r[r.RightClick=2]="RightClick"})(Eg||(Eg={}));class hC extends kg{constructor(e){super(e,gC,li(e.event.target))}}hC.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:a}=e;return n.button===Eg.RightClick?!1:(a?.({event:n}),!0)}}];const _g={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class fC extends kg{constructor(e){super(e,_g)}static setup(){return window.addEventListener(_g.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(_g.move.name,e)};function e(){}}}fC.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:a}=e;const{touches:i}=n;return i.length>1?!1:(a?.({event:n}),!0)}}];var To;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(To||(To={}));var Cc;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(Cc||(Cc={}));function pC(r){let{acceleration:e,activator:n=To.Pointer,canScroll:a,draggingRect:i,enabled:o,interval:d=5,order:g=Cc.TreeOrder,pointerCoordinates:h,scrollableAncestors:f,scrollableAncestorRects:p,delta:x,threshold:y}=r;const w=yC({delta:x,disabled:!o}),[v,C]=E7(),k=j.useRef({x:0,y:0}),A=j.useRef({x:0,y:0}),R=j.useMemo(()=>{switch(n){case To.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case To.DraggableRect:return i}},[n,i,h]),N=j.useRef(null),D=j.useCallback(()=>{const L=N.current;if(!L)return;const z=k.current.x*A.current.x,Y=k.current.y*A.current.y;L.scrollBy(z,Y)},[]),M=j.useMemo(()=>g===Cc.TreeOrder?[...f].reverse():f,[g,f]);j.useEffect(()=>{if(!o||!f.length||!R){C();return}for(const L of M){if(a?.(L)===!1)continue;const z=f.indexOf(L),Y=p[z];if(!Y)continue;const{direction:he,speed:be}=nC(L,Y,R,e,y);for(const X of["x","y"])w[X][he[X]]||(be[X]=0,he[X]=0);if(be.x>0||be.y>0){C(),N.current=L,v(D,d),k.current=be,A.current=he;return}}k.current={x:0,y:0},A.current={x:0,y:0},C()},[e,D,a,C,o,d,JSON.stringify(R),JSON.stringify(w),v,f,M,p,JSON.stringify(y)])}const mC={x:{[mn.Backward]:!1,[mn.Forward]:!1},y:{[mn.Backward]:!1,[mn.Forward]:!1}};function yC(r){let{delta:e,disabled:n}=r;const a=mg(e);return jo(i=>{if(n||!a||!i)return mC;const o={x:Math.sign(e.x-a.x),y:Math.sign(e.y-a.y)};return{x:{[mn.Backward]:i.x[mn.Backward]||o.x===-1,[mn.Forward]:i.x[mn.Forward]||o.x===1},y:{[mn.Backward]:i.y[mn.Backward]||o.y===-1,[mn.Forward]:i.y[mn.Forward]||o.y===1}}},[n,e,a])}function xC(r,e){const n=e!=null?r.get(e):void 0,a=n?n.node.current:null;return jo(i=>{var o;return e==null?null:(o=a??i)!=null?o:null},[a,e])}function bC(r,e){return j.useMemo(()=>r.reduce((n,a)=>{const{sensor:i}=a,o=i.activators.map(d=>({eventName:d.eventName,handler:e(d.handler,a)}));return[...n,...o]},[]),[r,e])}var Ao;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Ao||(Ao={}));var Tg;(function(r){r.Optimized="optimized"})(Tg||(Tg={}));const Cy=new Map;function vC(r,e){let{dragging:n,dependencies:a,config:i}=e;const[o,d]=j.useState(null),{frequency:g,measure:h,strategy:f}=i,p=j.useRef(r),x=k(),y=Co(x),w=j.useCallback(function(A){A===void 0&&(A=[]),!y.current&&d(R=>R===null?A:R.concat(A.filter(N=>!R.includes(N))))},[y]),v=j.useRef(null),C=jo(A=>{if(x&&!n)return Cy;if(!A||A===Cy||p.current!==r||o!=null){const R=new Map;for(let N of r){if(!N)continue;if(o&&o.length>0&&!o.includes(N.id)&&N.rect.current){R.set(N.id,N.rect.current);continue}const D=N.node.current,M=D?new wg(h(D),D):null;N.rect.current=M,M&&R.set(N.id,M)}return R}return A},[r,o,n,x,h]);return j.useEffect(()=>{p.current=r},[r]),j.useEffect(()=>{x||w()},[n,x]),j.useEffect(()=>{o&&o.length>0&&d(null)},[JSON.stringify(o)]),j.useEffect(()=>{x||typeof g!="number"||v.current!==null||(v.current=setTimeout(()=>{w(),v.current=null},g))},[g,x,w,...a]),{droppableRects:C,measureDroppableContainers:w,measuringScheduled:o!=null};function k(){switch(f){case Ao.Always:return!1;case Ao.BeforeDragging:return n;default:return!n}}}function jy(r,e){return jo(n=>r?n||(typeof e=="function"?e(r):r):null,[e,r])}function SC(r,e){return jy(r,e)}function wC(r){let{callback:e,disabled:n}=r;const a=pg(e),i=j.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(a)},[a,n]);return j.useEffect(()=>()=>i?.disconnect(),[i]),i}function jc(r){let{callback:e,disabled:n}=r;const a=pg(e),i=j.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(a)},[n]);return j.useEffect(()=>()=>i?.disconnect(),[i]),i}function CC(r){return new wg(di(r),r)}function ky(r,e,n){e===void 0&&(e=CC);const[a,i]=j.useState(null);function o(){i(h=>{if(!r)return null;if(r.isConnected===!1){var f;return(f=h??n)!=null?f:null}const p=e(r);return JSON.stringify(h)===JSON.stringify(p)?h:p})}const d=wC({callback(h){if(r)for(const f of h){const{type:p,target:x}=f;if(p==="childList"&&x instanceof HTMLElement&&x.contains(r)){o();break}}}}),g=jc({callback:o});return Ua(()=>{o(),r?(g?.observe(r),d?.observe(document.body,{childList:!0,subtree:!0})):(g?.disconnect(),d?.disconnect())},[r]),a}function jC(r){const e=jy(r);return uy(r,e)}const Ny=[];function kC(r){const e=j.useRef(r),n=jo(a=>r?a&&a!==Ny&&r&&e.current&&r.parentNode===e.current.parentNode?a:wc(r):Ny,[r]);return j.useEffect(()=>{e.current=r},[r]),n}function NC(r){const[e,n]=j.useState(null),a=j.useRef(r),i=j.useCallback(o=>{const d=vg(o.target);d&&n(g=>g?(g.set(d,Sg(d)),new Map(g)):null)},[]);return j.useEffect(()=>{const o=a.current;if(r!==o){d(o);const g=r.map(h=>{const f=vg(h);return f?(f.addEventListener("scroll",i,{passive:!0}),[f,Sg(f)]):null}).filter(h=>h!=null);n(g.length?new Map(g):null),a.current=r}return()=>{d(r),d(o)};function d(g){g.forEach(h=>{const f=vg(h);f?.removeEventListener("scroll",i)})}},[i,r]),j.useMemo(()=>r.length?e?Array.from(e.values()).reduce((o,d)=>ci(o,d),Sa):xy(r):Sa,[r,e])}function Ey(r,e){e===void 0&&(e=[]);const n=j.useRef(null);return j.useEffect(()=>{n.current=null},e),j.useEffect(()=>{const a=r!==Sa;a&&!n.current&&(n.current=r),!a&&n.current&&(n.current=null)},[r]),n.current?No(r,n.current):Sa}function EC(r){j.useEffect(()=>{if(!bc)return;const e=r.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of e)n?.()}},r.map(e=>{let{sensor:n}=e;return n}))}function _C(r,e){return j.useMemo(()=>r.reduce((n,a)=>{let{eventName:i,handler:o}=a;return n[i]=d=>{o(d,e)},n},{}),[r,e])}function _y(r){return j.useMemo(()=>r?Q7(r):null,[r])}const Ty=[];function TC(r,e){e===void 0&&(e=di);const[n]=r,a=_y(n?Mn(n):null),[i,o]=j.useState(Ty);function d(){o(()=>r.length?r.map(h=>my(h)?a:new wg(e(h),h)):Ty)}const g=jc({callback:d});return Ua(()=>{g?.disconnect(),d(),r.forEach(h=>g?.observe(h))},[r]),i}function AC(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return wo(e)?e:r}function DC(r){let{measure:e}=r;const[n,a]=j.useState(null),i=j.useCallback(f=>{for(const{target:p}of f)if(wo(p)){a(x=>{const y=e(p);return x?{...x,width:y.width,height:y.height}:y});break}},[e]),o=jc({callback:i}),d=j.useCallback(f=>{const p=AC(f);o?.disconnect(),p&&o?.observe(p),a(p?e(p):null)},[e,o]),[g,h]=vc(d);return j.useMemo(()=>({nodeRef:g,rect:n,setRef:h}),[n,g,h])}const RC=[{sensor:Ng,options:{}},{sensor:jg,options:{}}],OC={current:{}},kc={draggable:{measure:gy},droppable:{measure:gy,strategy:Ao.WhileDragging,frequency:Tg.Optimized},dragOverlay:{measure:di}};class Do extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,a;return(n=(a=this.get(e))==null?void 0:a.node.current)!=null?n:void 0}}const LC={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Do,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Sc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:kc,measureDroppableContainers:Sc,windowRect:null,measuringScheduled:!1},MC={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Sc,draggableNodes:new Map,over:null,measureDroppableContainers:Sc},Nc=j.createContext(MC),Ay=j.createContext(LC);function $C(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Do}}}function IC(r,e){switch(e.type){case un.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case un.DragMove:return r.draggable.active==null?r:{...r,draggable:{...r.draggable,translate:{x:e.coordinates.x-r.draggable.initialCoordinates.x,y:e.coordinates.y-r.draggable.initialCoordinates.y}}};case un.DragEnd:case un.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case un.RegisterDroppable:{const{element:n}=e,{id:a}=n,i=new Do(r.droppable.containers);return i.set(a,n),{...r,droppable:{...r.droppable,containers:i}}}case un.SetDroppableDisabled:{const{id:n,key:a,disabled:i}=e,o=r.droppable.containers.get(n);if(!o||a!==o.key)return r;const d=new Do(r.droppable.containers);return d.set(n,{...o,disabled:i}),{...r,droppable:{...r.droppable,containers:d}}}case un.UnregisterDroppable:{const{id:n,key:a}=e,i=r.droppable.containers.get(n);if(!i||a!==i.key)return r;const o=new Do(r.droppable.containers);return o.delete(n),{...r,droppable:{...r.droppable,containers:o}}}default:return r}}function zC(r){let{disabled:e}=r;const{active:n,activatorEvent:a,draggableNodes:i}=j.useContext(Nc),o=mg(a),d=mg(n?.id);return j.useEffect(()=>{if(!e&&!a&&o&&d!=null){if(!xg(o)||document.activeElement===o.target)return;const g=i.get(d);if(!g)return;const{activatorNode:h,node:f}=g;if(!h.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[h.current,f.current]){if(!p)continue;const x=A7(p);if(x){x.focus();break}}})}},[a,e,i,d,o]),null}function HC(r,e){let{transform:n,...a}=e;return r!=null&&r.length?r.reduce((i,o)=>o({transform:i,...a}),n):n}function PC(r){return j.useMemo(()=>({draggable:{...kc.draggable,...r?.draggable},droppable:{...kc.droppable,...r?.droppable},dragOverlay:{...kc.dragOverlay,...r?.dragOverlay}}),[r?.draggable,r?.droppable,r?.dragOverlay])}function UC(r){let{activeNode:e,measure:n,initialRect:a,config:i=!0}=r;const o=j.useRef(!1),{x:d,y:g}=typeof i=="boolean"?{x:i,y:i}:i;Ua(()=>{if(!d&&!g||!e){o.current=!1;return}if(o.current||!a)return;const f=e?.node.current;if(!f||f.isConnected===!1)return;const p=n(f),x=uy(p,a);if(d||(x.x=0),g||(x.y=0),o.current=!0,Math.abs(x.x)>0||Math.abs(x.y)>0){const y=hy(f);y&&y.scrollBy({top:x.y,left:x.x})}},[e,d,g,a,n])}const Dy=j.createContext({...Sa,scaleX:1,scaleY:1});var Ls;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})(Ls||(Ls={}));const BC=j.memo(function(e){var n,a,i,o;let{id:d,accessibility:g,autoScroll:h=!0,children:f,sensors:p=RC,collisionDetection:x=F7,measuring:y,modifiers:w,...v}=e;const C=j.useReducer(IC,void 0,$C),[k,A]=C,[R,N]=$7(),[D,M]=j.useState(Ls.Uninitialized),L=D===Ls.Initialized,{draggable:{active:z,nodes:Y,translate:he},droppable:{containers:be}}=k,X=z!=null?Y.get(z):null,ge=j.useRef({initial:null,translated:null}),xe=j.useMemo(()=>{var He;return z!=null?{id:z,data:(He=X?.data)!=null?He:OC,rect:ge}:null},[z,X]),le=j.useRef(null),[je,J]=j.useState(null),[F,Q]=j.useState(null),pe=Co(v,Object.values(v)),$=ko("DndDescribedBy",d),U=j.useMemo(()=>be.getEnabled(),[be]),q=PC(y),{droppableRects:ie,measureDroppableContainers:se,measuringScheduled:we}=vC(U,{dragging:L,dependencies:[he.x,he.y],config:q.droppable}),Ee=xC(Y,z),Oe=j.useMemo(()=>F?bg(F):null,[F]),tt=st(),Me=SC(Ee,q.draggable.measure);UC({activeNode:z!=null?Y.get(z):null,config:tt.layoutShiftCompensation,initialRect:Me,measure:q.draggable.measure});const qe=ky(Ee,q.draggable.measure,Me),zt=ky(Ee?Ee.parentElement:null),Et=j.useRef({activatorEvent:null,active:null,activeNode:Ee,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:Y,draggingNode:null,draggingNodeRect:null,droppableContainers:be,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),$t=be.getNodeFor((n=Et.current.over)==null?void 0:n.id),kt=DC({measure:q.dragOverlay.measure}),tn=(a=kt.nodeRef.current)!=null?a:Ee,Vt=L?(i=kt.rect)!=null?i:qe:null,oa=!!(kt.nodeRef.current&&kt.rect),Ce=jC(oa?null:qe),Ge=_y(tn?Mn(tn):null),it=kC(L?$t??Ee:null),ft=TC(it),bt=HC(w,{transform:{x:he.x-Ce.x,y:he.y-Ce.y,scaleX:1,scaleY:1},activatorEvent:F,active:xe,activeNodeRect:qe,containerNodeRect:zt,draggingNodeRect:Vt,over:Et.current.over,overlayNodeRect:kt.rect,scrollableAncestors:it,scrollableAncestorRects:ft,windowRect:Ge}),Ct=Oe?ci(Oe,he):null,ot=NC(it),We=Ey(ot),nn=Ey(ot,[qe]),Nt=ci(bt,We),It=Vt?W7(Vt,bt):null,an=xe&&It?x({active:xe,collisionRect:It,droppableRects:ie,droppableContainers:U,pointerCoordinates:Ct}):null,_a=cy(an,"id"),[W,ve]=j.useState(null),me=oa?bt:ci(bt,nn),ne=V7(me,(o=W?.rect)!=null?o:null,qe),_e=j.useRef(null),Ne=j.useCallback((He,Pe)=>{let{sensor:Ye,options:De}=Pe;if(le.current==null)return;const Le=Y.get(le.current);if(!Le)return;const Ue=He.nativeEvent,At=new Ye({active:le.current,activeNode:Le,event:Ue,options:De,context:Et,onAbort(Ut){if(!Y.get(Ut))return;const{onDragAbort:bn}=pe.current,Dn={id:Ut};bn?.(Dn),R({type:"onDragAbort",event:Dn})},onPending(Ut,qt,bn,Dn){if(!Y.get(Ut))return;const{onDragPending:Aa}=pe.current,Jn={id:Ut,constraint:qt,initialCoordinates:bn,offset:Dn};Aa?.(Jn),R({type:"onDragPending",event:Jn})},onStart(Ut){const qt=le.current;if(qt==null)return;const bn=Y.get(qt);if(!bn)return;const{onDragStart:Dn}=pe.current,Ta={activatorEvent:Ue,active:{id:qt,data:bn.data,rect:ge}};Os.unstable_batchedUpdates(()=>{Dn?.(Ta),M(Ls.Initializing),A({type:un.DragStart,initialCoordinates:Ut,active:qt}),R({type:"onDragStart",event:Ta}),J(_e.current),Q(Ue)})},onMove(Ut){A({type:un.DragMove,coordinates:Ut})},onEnd:Kt(un.DragEnd),onCancel:Kt(un.DragCancel)});_e.current=At;function Kt(Ut){return async function(){const{active:bn,collisions:Dn,over:Ta,scrollAdjustedTranslate:Aa}=Et.current;let Jn=null;if(bn&&Aa){const{cancelDrop:Ga}=pe.current;Jn={activatorEvent:Ue,active:bn,collisions:Dn,delta:Aa,over:Ta},Ut===un.DragEnd&&typeof Ga=="function"&&await Promise.resolve(Ga(Jn))&&(Ut=un.DragCancel)}le.current=null,Os.unstable_batchedUpdates(()=>{A({type:Ut}),M(Ls.Uninitialized),ve(null),J(null),Q(null),_e.current=null;const Ga=Ut===un.DragEnd?"onDragEnd":"onDragCancel";if(Jn){const In=pe.current[Ga];In?.(Jn),R({type:Ga,event:Jn})}})}}},[Y]),$e=j.useCallback((He,Pe)=>(Ye,De)=>{const Le=Ye.nativeEvent,Ue=Y.get(De);if(le.current!==null||!Ue||Le.dndKit||Le.defaultPrevented)return;const At={active:Ue};He(Ye,Pe.options,At)===!0&&(Le.dndKit={capturedBy:Pe.sensor},le.current=De,Ne(Ye,Pe))},[Y,Ne]),Ve=bC(p,$e);EC(p),Ua(()=>{qe&&D===Ls.Initializing&&M(Ls.Initialized)},[qe,D]),j.useEffect(()=>{const{onDragMove:He}=pe.current,{active:Pe,activatorEvent:Ye,collisions:De,over:Le}=Et.current;if(!Pe||!Ye)return;const Ue={active:Pe,activatorEvent:Ye,collisions:De,delta:{x:Nt.x,y:Nt.y},over:Le};Os.unstable_batchedUpdates(()=>{He?.(Ue),R({type:"onDragMove",event:Ue})})},[Nt.x,Nt.y]),j.useEffect(()=>{const{active:He,activatorEvent:Pe,collisions:Ye,droppableContainers:De,scrollAdjustedTranslate:Le}=Et.current;if(!He||le.current==null||!Pe||!Le)return;const{onDragOver:Ue}=pe.current,At=De.get(_a),Kt=At&&At.rect.current?{id:At.id,rect:At.rect.current,data:At.data,disabled:At.disabled}:null,Ut={active:He,activatorEvent:Pe,collisions:Ye,delta:{x:Le.x,y:Le.y},over:Kt};Os.unstable_batchedUpdates(()=>{ve(Kt),Ue?.(Ut),R({type:"onDragOver",event:Ut})})},[_a]),Ua(()=>{Et.current={activatorEvent:F,active:xe,activeNode:Ee,collisionRect:It,collisions:an,droppableRects:ie,draggableNodes:Y,draggingNode:tn,draggingNodeRect:Vt,droppableContainers:be,over:W,scrollableAncestors:it,scrollAdjustedTranslate:Nt},ge.current={initial:Vt,translated:It}},[xe,Ee,an,It,Y,tn,Vt,ie,be,W,it,Nt]),pC({...tt,delta:he,draggingRect:It,pointerCoordinates:Ct,scrollableAncestors:it,scrollableAncestorRects:ft});const yt=j.useMemo(()=>({active:xe,activeNode:Ee,activeNodeRect:qe,activatorEvent:F,collisions:an,containerNodeRect:zt,dragOverlay:kt,draggableNodes:Y,droppableContainers:be,droppableRects:ie,over:W,measureDroppableContainers:se,scrollableAncestors:it,scrollableAncestorRects:ft,measuringConfiguration:q,measuringScheduled:we,windowRect:Ge}),[xe,Ee,qe,F,an,zt,kt,Y,be,ie,W,se,it,ft,q,we,Ge]),Ae=j.useMemo(()=>({activatorEvent:F,activators:Ve,active:xe,activeNodeRect:qe,ariaDescribedById:{draggable:$},dispatch:A,draggableNodes:Y,over:W,measureDroppableContainers:se}),[F,Ve,xe,qe,A,$,Y,W,se]);return Fe.createElement(sy.Provider,{value:N},Fe.createElement(Nc.Provider,{value:Ae},Fe.createElement(Ay.Provider,{value:yt},Fe.createElement(Dy.Provider,{value:ne},f)),Fe.createElement(zC,{disabled:g?.restoreFocus===!1})),Fe.createElement(H7,{...g,hiddenTextDescribedById:$}));function st(){const He=je?.autoScrollEnabled===!1,Pe=typeof h=="object"?h.enabled===!1:h===!1,Ye=L&&!He&&!Pe;return typeof h=="object"?{...h,enabled:Ye}:{enabled:Ye}}}),qC=j.createContext(null),Ry="button",GC="Draggable";function FC(r){let{id:e,data:n,disabled:a=!1,attributes:i}=r;const o=ko(GC),{activators:d,activatorEvent:g,active:h,activeNodeRect:f,ariaDescribedById:p,draggableNodes:x,over:y}=j.useContext(Nc),{role:w=Ry,roleDescription:v="draggable",tabIndex:C=0}=i??{},k=h?.id===e,A=j.useContext(k?Dy:qC),[R,N]=vc(),[D,M]=vc(),L=_C(d,e),z=Co(n);Ua(()=>(x.set(e,{id:e,key:o,node:R,activatorNode:D,data:z}),()=>{const he=x.get(e);he&&he.key===o&&x.delete(e)}),[x,e]);const Y=j.useMemo(()=>({role:w,tabIndex:C,"aria-disabled":a,"aria-pressed":k&&w===Ry?!0:void 0,"aria-roledescription":v,"aria-describedby":p.draggable}),[a,w,C,k,v,p.draggable]);return{active:h,activatorEvent:g,activeNodeRect:f,attributes:Y,isDragging:k,listeners:a?void 0:L,node:R,over:y,setNodeRef:N,setActivatorNodeRef:M,transform:A}}function VC(){return j.useContext(Ay)}const KC="Droppable",WC={timeout:25};function YC(r){let{data:e,disabled:n=!1,id:a,resizeObserverConfig:i}=r;const o=ko(KC),{active:d,dispatch:g,over:h,measureDroppableContainers:f}=j.useContext(Nc),p=j.useRef({disabled:n}),x=j.useRef(!1),y=j.useRef(null),w=j.useRef(null),{disabled:v,updateMeasurementsFor:C,timeout:k}={...WC,...i},A=Co(C??a),R=j.useCallback(()=>{if(!x.current){x.current=!0;return}w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{f(Array.isArray(A.current)?A.current:[A.current]),w.current=null},k)},[k]),N=jc({callback:R,disabled:v||!d}),D=j.useCallback((Y,he)=>{N&&(he&&(N.unobserve(he),x.current=!1),Y&&N.observe(Y))},[N]),[M,L]=vc(D),z=Co(e);return j.useEffect(()=>{!N||!M.current||(N.disconnect(),x.current=!1,N.observe(M.current))},[M,N]),j.useEffect(()=>(g({type:un.RegisterDroppable,element:{id:a,key:o,disabled:n,node:M,rect:y,data:z}}),()=>g({type:un.UnregisterDroppable,key:o,id:a})),[a]),j.useEffect(()=>{n!==p.current.disabled&&(g({type:un.SetDroppableDisabled,id:a,key:o,disabled:n}),p.current.disabled=n)},[a,o,n,g]),{active:d,rect:y,isOver:h?.id===a,node:M,over:h,setNodeRef:L}}function Ag(r,e,n){const a=r.slice();return a.splice(n<0?a.length+n:n,0,a.splice(e,1)[0]),a}function JC(r,e){return r.reduce((n,a,i)=>{const o=e.get(a);return o&&(n[i]=o),n},Array(r.length))}function Ec(r){return r!==null&&r>=0}function XC(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(r[n]!==e[n])return!1;return!0}function QC(r){return typeof r=="boolean"?{draggable:r,droppable:r}:r}const _c={scaleX:1,scaleY:1},ZC=r=>{var e;let{rects:n,activeNodeRect:a,activeIndex:i,overIndex:o,index:d}=r;const g=(e=n[i])!=null?e:a;if(!g)return null;const h=ej(n,d,i);if(d===i){const f=n[o];return f?{x:i<o?f.left+f.width-(g.left+g.width):f.left-g.left,y:0,..._c}:null}return d>i&&d<=o?{x:-g.width-h,y:0,..._c}:d<i&&d>=o?{x:g.width+h,y:0,..._c}:{x:0,y:0,..._c}};function ej(r,e,n){const a=r[e],i=r[e-1],o=r[e+1];return!a||!i&&!o?0:n<e?i?a.left-(i.left+i.width):o.left-(a.left+a.width):o?o.left-(a.left+a.width):a.left-(i.left+i.width)}const Dg=r=>{let{rects:e,activeIndex:n,overIndex:a,index:i}=r;const o=Ag(e,a,n),d=e[i],g=o[i];return!g||!d?null:{x:g.left-d.left,y:g.top-d.top,scaleX:g.width/d.width,scaleY:g.height/d.height}},Tc={scaleX:1,scaleY:1},tj=r=>{var e;let{activeIndex:n,activeNodeRect:a,index:i,rects:o,overIndex:d}=r;const g=(e=o[n])!=null?e:a;if(!g)return null;if(i===n){const f=o[d];return f?{x:0,y:n<d?f.top+f.height-(g.top+g.height):f.top-g.top,...Tc}:null}const h=nj(o,i,n);return i>n&&i<=d?{x:0,y:-g.height-h,...Tc}:i<n&&i>=d?{x:0,y:g.height+h,...Tc}:{x:0,y:0,...Tc}};function nj(r,e,n){const a=r[e],i=r[e-1],o=r[e+1];return a?n<e?i?a.top-(i.top+i.height):o?o.top-(a.top+a.height):0:o?o.top-(a.top+a.height):i?a.top-(i.top+i.height):0:0}const Oy="Sortable",Ly=Fe.createContext({activeIndex:-1,containerId:Oy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Dg,disabled:{draggable:!1,droppable:!1}});function aj(r){let{children:e,id:n,items:a,strategy:i=Dg,disabled:o=!1}=r;const{active:d,dragOverlay:g,droppableRects:h,over:f,measureDroppableContainers:p}=VC(),x=ko(Oy,n),y=g.rect!==null,w=j.useMemo(()=>a.map(L=>typeof L=="object"&&"id"in L?L.id:L),[a]),v=d!=null,C=d?w.indexOf(d.id):-1,k=f?w.indexOf(f.id):-1,A=j.useRef(w),R=!XC(w,A.current),N=k!==-1&&C===-1||R,D=QC(o);Ua(()=>{R&&v&&p(w)},[R,w,v,p]),j.useEffect(()=>{A.current=w},[w]);const M=j.useMemo(()=>({activeIndex:C,containerId:x,disabled:D,disableTransforms:N,items:w,overIndex:k,useDragOverlay:y,sortedRects:JC(w,h),strategy:i}),[C,x,D.draggable,D.droppable,N,w,k,h,y,i]);return Fe.createElement(Ly.Provider,{value:M},e)}const sj=r=>{let{id:e,items:n,activeIndex:a,overIndex:i}=r;return Ag(n,a,i).indexOf(e)},rj=r=>{let{containerId:e,isSorting:n,wasDragging:a,index:i,items:o,newIndex:d,previousItems:g,previousContainerId:h,transition:f}=r;return!f||!a||g!==o&&i===d?!1:n?!0:d!==i&&e===h},ij={duration:200,easing:"ease"},My="transform",oj=Eo.Transition.toString({property:My,duration:0,easing:"linear"}),lj={roleDescription:"sortable"};function cj(r){let{disabled:e,index:n,node:a,rect:i}=r;const[o,d]=j.useState(null),g=j.useRef(n);return Ua(()=>{if(!e&&n!==g.current&&a.current){const h=i.current;if(h){const f=di(a.current,{ignoreTransform:!0}),p={x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height};(p.x||p.y)&&d(p)}}n!==g.current&&(g.current=n)},[e,n,a,i]),j.useEffect(()=>{o&&d(null)},[o]),o}function dj(r){let{animateLayoutChanges:e=rj,attributes:n,disabled:a,data:i,getNewIndex:o=sj,id:d,strategy:g,resizeObserverConfig:h,transition:f=ij}=r;const{items:p,containerId:x,activeIndex:y,disabled:w,disableTransforms:v,sortedRects:C,overIndex:k,useDragOverlay:A,strategy:R}=j.useContext(Ly),N=uj(a,w),D=p.indexOf(d),M=j.useMemo(()=>({sortable:{containerId:x,index:D,items:p},...i}),[x,i,D,p]),L=j.useMemo(()=>p.slice(p.indexOf(d)),[p,d]),{rect:z,node:Y,isOver:he,setNodeRef:be}=YC({id:d,data:M,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:L,...h}}),{active:X,activatorEvent:ge,activeNodeRect:xe,attributes:le,setNodeRef:je,listeners:J,isDragging:F,over:Q,setActivatorNodeRef:pe,transform:$}=FC({id:d,data:M,attributes:{...lj,...n},disabled:N.draggable}),U=N7(be,je),q=!!X,ie=q&&!v&&Ec(y)&&Ec(k),se=!A&&F,we=se&&ie?$:null,Oe=ie?we??(g??R)({rects:C,activeNodeRect:xe,activeIndex:y,overIndex:k,index:D}):null,tt=Ec(y)&&Ec(k)?o({id:d,items:p,activeIndex:y,overIndex:k}):D,Me=X?.id,qe=j.useRef({activeId:Me,items:p,newIndex:tt,containerId:x}),zt=p!==qe.current.items,Et=e({active:X,containerId:x,isDragging:F,isSorting:q,id:d,index:D,items:p,newIndex:qe.current.newIndex,previousItems:qe.current.items,previousContainerId:qe.current.containerId,transition:f,wasDragging:qe.current.activeId!=null}),$t=cj({disabled:!Et,index:D,node:Y,rect:z});return j.useEffect(()=>{q&&qe.current.newIndex!==tt&&(qe.current.newIndex=tt),x!==qe.current.containerId&&(qe.current.containerId=x),p!==qe.current.items&&(qe.current.items=p)},[q,tt,x,p]),j.useEffect(()=>{if(Me===qe.current.activeId)return;if(Me!=null&&qe.current.activeId==null){qe.current.activeId=Me;return}const tn=setTimeout(()=>{qe.current.activeId=Me},50);return()=>clearTimeout(tn)},[Me]),{active:X,activeIndex:y,attributes:le,data:M,rect:z,index:D,newIndex:tt,items:p,isOver:he,isSorting:q,isDragging:F,listeners:J,node:Y,overIndex:k,over:Q,setNodeRef:U,setActivatorNodeRef:pe,setDroppableNodeRef:be,setDraggableNodeRef:je,transform:$t??Oe,transition:kt()};function kt(){if($t||zt&&qe.current.newIndex===D)return oj;if(!(se&&!xg(ge)||!f)&&(q||Et))return Eo.Transition.toString({...f,property:My})}}function uj(r,e){var n,a;return typeof r=="boolean"?{draggable:r,droppable:!1}:{draggable:(n=r?.draggable)!=null?n:e.draggable,droppable:(a=r?.droppable)!=null?a:e.droppable}}function Ac(r){if(!r)return!1;const e=r.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const gj=[ht.Down,ht.Right,ht.Up,ht.Left],hj=(r,e)=>{let{context:{active:n,collisionRect:a,droppableRects:i,droppableContainers:o,over:d,scrollableAncestors:g}}=e;if(gj.includes(r.code)){if(r.preventDefault(),!n||!a)return;const h=[];o.getEnabled().forEach(x=>{if(!x||x!=null&&x.disabled)return;const y=i.get(x.id);if(y)switch(r.code){case ht.Down:a.top<y.top&&h.push(x);break;case ht.Up:a.top>y.top&&h.push(x);break;case ht.Left:a.left>y.left&&h.push(x);break;case ht.Right:a.left<y.left&&h.push(x);break}});const f=q7({collisionRect:a,droppableRects:i,droppableContainers:h});let p=cy(f,"id");if(p===d?.id&&f.length>1&&(p=f[1].id),p!=null){const x=o.get(n.id),y=o.get(p),w=y?i.get(y.id):null,v=y?.node.current;if(v&&w&&x&&y){const k=wc(v).some((L,z)=>g[z]!==L),A=$y(x,y),R=fj(x,y),N=k||!A?{x:0,y:0}:{x:R?a.width-w.width:0,y:R?a.height-w.height:0},D={x:w.left,y:w.top};return N.x&&N.y?D:No(D,N)}}}};function $y(r,e){return!Ac(r)||!Ac(e)?!1:r.data.current.sortable.containerId===e.data.current.sortable.containerId}function fj(r,e){return!Ac(r)||!Ac(e)||!$y(r,e)?!1:r.data.current.sortable.index<e.data.current.sortable.index}const pj={verticalList:tj,horizontalList:ZC,rectSorting:Dg},mj=({items:r,itemKey:e,strategy:n,children:a,onSortEnd:i,onSortStart:o,sortVersion:d})=>{const g=j.useId(),h=j.useRef({inProgress:!1,lastSortTime:0,lastActiveId:null}),f=P7(ry(Ng,{activationConstraint:{distance:5}}),ry(jg,{coordinateGetter:hj})),p=j.useCallback(w=>{h.current={inProgress:!0,lastSortTime:Date.now(),lastActiveId:w.active.id},o?.({activeId:w.active.id})},[o]),x=j.useCallback(w=>{const{active:v,over:C}=w,k=Date.now();if(!C||v.id===C.id){h.current.inProgress=!1;return}const{lastSortTime:A,lastActiveId:R,inProgress:N}=h.current;if(R===v.id&&k-A<500&&!N)return;h.current={inProgress:!1,lastSortTime:k,lastActiveId:v.id};const D=r.findIndex(L=>String(L[e])===String(v.id)),M=r.findIndex(L=>String(L[e])===String(C.id));if(D!==-1&&M!==-1&&D!==M){const L=Ag(r,D,M);i?.(L,{oldIndex:D,newIndex:M})}},[r,e,i]),y=r.map(w=>String(w[e]));return l.jsx(BC,{id:g,sensors:f,collisionDetection:B7,onDragStart:p,onDragEnd:x,children:l.jsx(aj,{items:y,strategy:pj[n],children:a})},d!==void 0?`${g}-v${d}`:g)},Iy=j.createContext(null),yj=({value:r,children:e})=>l.jsx(Iy.Provider,{value:r,children:e}),xj=()=>j.useContext(Iy),bj=({id:r,handle:e,children:n})=>{const{attributes:a,listeners:i,setNodeRef:o,transform:d,transition:g,isDragging:h}=dj({id:r}),f={transform:Eo.Transform.toString(d),transition:g,opacity:h?.5:1,position:"relative"};return l.jsx("div",{ref:o,style:f,...a,...e?{}:i,"data-sortable-item":!0,"data-sortable-id":String(r),"data-dragging":h,children:l.jsx(yj,{value:{listeners:i,handle:e,isDragging:h},children:n})})},xt=at("DynamicRenderer");function rs(){try{return window.G7Core?.devTools}catch{return}}function vj(r){const e=Object.keys(r);return e.length>0&&e.every(n=>/^\d+$/.test(n))}const wa=(r,e)=>{const n=["errors"],a={...r};for(const i of Object.keys(e)){const o=e[i],d=r[i];if(o===null){a[i]=null;continue}if(n.includes(i)){a[i]=o;continue}if(Array.isArray(o)){a[i]=o;continue}if(Array.isArray(d)&&o!==null&&typeof o=="object"&&!Array.isArray(o)&&vj(o)){const g=Object.keys(o).map(f=>parseInt(f,10));if((g.length>0?Math.max(...g):0)>=d.length+g.length+10)a[i]={...o};else{const f=[...d];for(const[p,x]of Object.entries(o)){const y=parseInt(p,10);y>=0&&y<f.length?x!==null&&typeof x=="object"&&!Array.isArray(x)&&f[y]!==null&&typeof f[y]=="object"?f[y]=wa(f[y],x):f[y]=x:y>=f.length&&(f[y]=x)}a[i]=f}}else o!==null&&typeof o=="object"&&d!==null&&typeof d=="object"&&!Array.isArray(d)?a[i]=wa(d,o):a[i]=o}return a},zy=(r,e)=>{const n={...r};for(const a of Object.keys(e)){if(!(a in n))continue;const i=e[a],o=n[a];if(i!==null&&typeof i=="object"&&!Array.isArray(i)&&o!==null&&typeof o=="object"&&!Array.isArray(o)){const d=zy(o,i);Object.keys(d).length===0?delete n[a]:n[a]=d}else delete n[a]}return n},Sj=r=>{const e={},n=r.split(";").filter(a=>a.trim());for(const a of n){const i=a.indexOf(":");if(i===-1)continue;const o=a.substring(0,i).trim(),d=a.substring(i+1).trim();if(o&&d){const g=o.replace(/-([a-z])/g,(h,f)=>f.toUpperCase());e[g]=d}}return e};class wj extends j.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){xt.error(`컴포넌트 렌더링 에러 (ID: ${this.props.componentId}, Name: ${this.props.componentName}):`,e,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:l.jsxs("div",{className:"p-4 my-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg text-red-800 dark:text-red-400",children:[l.jsx("div",{className:"font-semibold mb-1",children:"컴포넌트 로드 실패"}),l.jsxs("div",{className:"text-xs opacity-80",children:[this.props.componentName&&`[${this.props.componentName}] `,"데이터를 표시할 수 없습니다."]}),this.state.error&&l.jsxs("details",{className:"mt-2",children:[l.jsx("summary",{className:"cursor-pointer text-xs opacity-70 hover:opacity-100",children:"상세 정보"}),l.jsx("div",{className:"mt-1 p-2 bg-red-100 dark:bg-red-900/30 rounded text-xs font-mono whitespace-pre-wrap break-all",children:this.state.error.message})]})]}):this.props.children}}const Ba=j.memo(({componentDef:r,dataContext:e,translationContext:n,registry:a,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:g,parentFormContextProp:h,parentDataContext:f,isRootRenderer:p=!1,isInsideIteration:x=!1,isEditMode:y=!1,onComponentSelect:w,onComponentHover:v,onDragStart:C,onDragEnd:k,componentPath:A,layoutKey:R})=>{const[N,D]=j.useState({loadingActions:{}});j.useLayoutEffect(()=>{g||(i.startRenderCycle(),window.__g7SetLocalOverrideKeys||(window.__g7ForcedLocalFields=void 0),window.__g7PendingLocalState=null)});const M=j.useRef(null);j.useLayoutEffect(()=>{if(!g&&e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:W,_merge:ve,...me}=e._localInit,ne=`${JSON.stringify(me)}:${W||"no-force"}`;if(M.current!==ne){M.current=ne;const _e=ve||"shallow",Ne=window.__g7PendingLocalState||{};_e==="replace"?window.__g7PendingLocalState={loadingActions:Ne.loadingActions||{},...me,hasChanges:!1}:_e==="deep"?window.__g7PendingLocalState=wa(Ne,{...me,hasChanges:!1}):window.__g7PendingLocalState={...Ne,...me,hasChanges:!1};const $e=window.__g7SetLocalOverrideKeys;$e&&typeof $e=="object"&&(_e==="replace"?window.__g7SetLocalOverrideKeys={...me,hasChanges:!1}:window.__g7SetLocalOverrideKeys=wa($e,{...me,hasChanges:!1}))}}}),j.useLayoutEffect(()=>{if(!g){const W=window.__g7SetLocalOverrideKeys;if(W){D(_e=>zy(_e,W));const ve=W,me=window.__g7ForcedLocalFields,ne=window.__g7LastSetLocalSnapshot;queueMicrotask(()=>{window.__g7SetLocalOverrideKeys===ve&&(window.__g7SetLocalOverrideKeys=void 0),window.__g7ForcedLocalFields===me&&(window.__g7ForcedLocalFields=void 0),window.__g7LastSetLocalSnapshot===ne&&(window.__g7LastSetLocalSnapshot=void 0)})}}},[e._local]);const L=j.useRef(R);j.useEffect(()=>{r._fromBase&&R&&L.current!==R&&(L.current=R,D({loadingActions:{}}))},[R,r._fromBase]);const z=j.useRef(""),Y=j.useRef(!1),he=j.useRef({}),be=j.useRef({}),X=j.useRef(f),ge=k7(),xe=d7(),le=xe?.getParentDataContext()??f;j.useEffect(()=>{if(e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:W,...ve}=e._localInit,me=JSON.stringify(ve),ne=W!==void 0,_e="__g7LocalInitTracking";window[_e]||(window[_e]={hash:"",timestamp:void 0});const Ne=window[_e],$e=`${me}:${W||"no-force"}`;if(Ne.hash!==$e){Ne.hash=$e,Ne.timestamp=W,z.current=me,ne&&(Y.current=!0);const{_merge:Ae,...st}=ve,He=Ae||"shallow";if(D(Pe=>He==="replace"?{loadingActions:Pe.loadingActions||{},...st,hasChanges:!1}:He==="deep"?wa(Pe,{...st,hasChanges:!1}):{...Pe,...st,hasChanges:!1}),e._globalSetState){const Pe=e._global?._local||{};let Ye;He==="replace"?Ye={...st,hasChanges:!1}:He==="deep"?Ye=wa(Pe,{...st,hasChanges:!1}):Ye={...Pe,...st,hasChanges:!1},e._globalSetState({_local:Ye})}i.invalidateCacheByKeys(["_local"]),xt.log("_localInit applied (data changed):",Object.keys(ve))}}},[e._localInit,f,i]);const{isTransitioning:je}=Wm(),J=m7(),F=h??J,{width:Q}=Xm(),pe=xj(),$=j.useMemo(()=>{let W=r;if(r.type==="iterator"&&r.data){const{data:ne,itemName:_e,indexName:Ne,...$e}=r;W={...$e,iteration:{source:ne,item_var:_e||"item",index_var:Ne}}}if(!W.responsive)return W;const ve=ei.getMatchingKey(W.responsive,Q);if(!ve)return W;const me=W.responsive[ve];return{...W,props:{...W.props,...me.props},children:me.children??W.children,text:me.text??W.text,if:me.if??W.if,iteration:me.iteration??W.iteration}},[r,Q]),U=j.useCallback(W=>{const ve=W?.__setStateId;if(D(me=>{const ne=window.__g7PendingLocalState,Ne=window.__g7SetLocalOverrideKeys||ne,$e=Ne?wa(me,Ne):me;if(typeof W=="function"){const He=W($e);return wa($e,He)}const{__mergeMode:Ve,__setStateId:yt,...Ae}=W;let st;if(Ve==="replace"?st=Ae:Ve==="shallow"?st={...$e,...Ae}:st=wa($e,Ae),Ve!==void 0){const He=window.__g7ForcedLocalFields;He&&(window.__g7ForcedLocalFields={...He,...Ae})}return st}),ve){const me=rs();if(me?.isEnabled()){const ne=$.id||"unknown",_e=$.name||"Unknown";setTimeout(()=>{me.trackComponentRender?.(ne,_e,0,["_local"],[]),me.completeStateChange?.(ve)},0)}}},[$.id,$.name]),q=g?.state??N,ie=g?.setState??U,se=j.useMemo(()=>{let W=e._local?wa(e._local,q):q;const ve=window.__g7ForcedLocalFields;ve&&(W=wa(W,ve));const me={...e,_local:W},ne=e._computedDefinitions;if(ne&&Object.keys(ne).length>0){const _e=new _n,Ne={...me,...ge?{_isolated:ge.state}:{}},$e={},Ve=rs(),yt=Ve?.isEnabled()??!1;for(const[Ae,st]of Object.entries(ne)){const He=yt?Date.now():0,Pe=yt?e._computed?.[Ae]:void 0;let Ye;try{if(typeof st=="string")if(st.startsWith("{{")&&st.endsWith("}}")){const De=st.slice(2,-2).trim(),Le=_e.evaluateExpression(De,Ne,{skipCache:!0});$e[Ae]=Le}else $e[Ae]=st;else if(st&&typeof st=="object"&&"$switch"in st){const De=_e.resolveSwitch(st,Ne,{skipCache:!0});$e[Ae]=De}}catch(De){xt.warn(`Failed to recalculate computed value: ${Ae}`,De),$e[Ae]=e._computed?.[Ae],Ye=De instanceof Error?De.message:String(De)}if(yt&&(Ye||Pe!==$e[Ae])){const Le=Date.now()-He;Ve.trackComputedProperty?.(Ae,typeof st=="string"?st:JSON.stringify(st),[{type:"_local",path:"_local",value:me._local}],$e[Ae],Le,$.id,Ye),Pe!==$e[Ae]&&Ve.trackComputedRecalc?.(Ae,"dependency-change",Pe,$e[Ae],Le,{type:"_local",path:"_local"},$.id)}}me._computed=$e}return ge&&(me._isolated=ge.state),le&&(me.$parent=le),r.extensionPointProps&&(me.extensionPointProps=r.extensionPointProps),me},[e,q,ge?.state,le,xe?.version,r.extensionPointProps]);he.current=se._local,be.current=se._computed||{},X.current=le,j.useEffect(()=>{const W=rs();if(!W?.isEnabled())return;const ve=se._local;ve&&W.updateLocalState(ve);const me=se._computed;me&&W.updateComputedState(me),le&&W.updateParentContext?.(le);const ne=$.id||`comp-${Date.now()}`,_e=$.name||"Unknown",Ne={global:Object.keys(e._global||{}),local:Object.keys(ve||{}),context:g?Object.keys(g.state||{}):[]},$e={type:g?"componentContext":"dynamicState",hasComponentContext:!!g,parentId:g?"parent":void 0};W.trackComponentStateSource?.(ne,_e,Ne,$e),q&&Object.keys(q).length>0&&W.trackDynamicState?.(ne,q);const Ve=!!($.expandChildren||$.props?.expandChildren);W.trackContextFlow?.(ne,_e,!!g,Ve,!0)},[se._local,e,$.id,$.name,g,q,$.expandChildren,$.props?.expandChildren,le]);const we=j.useMemo(()=>({state:{...se._local},setState:ie,stateRef:he,computedRef:be,isolatedContext:ge,parentDataContext:se}),[se._local,ie,N,ge,se]),Ee=j.useMemo(()=>{const W=ti({if:$.if,condition:$.condition,conditions:$.conditions},se,i,$.id);if($.if||$.condition!==void 0||$.conditions){const me=rs();me?.isEnabled()&&$.if&&me.trackIfCondition($.id||`if-${Date.now()}`,$.if,W)}return W},[$.if,$.conditions,se,i,$.id]),Oe=j.useMemo(()=>{if(!$.slot)return null;const W=$.slot;if(W.startsWith("{{")&&W.endsWith("}}")){const ve=W.slice(2,-2).trim();try{const me={componentId:$.id,componentName:$.name,propName:"slot"},ne=i.evaluateExpression(ve,se,me);return xt.log(`[Slot] 표현식 평가: "${ve}" => "${ne}" (컴포넌트: ${$.id})`),typeof ne=="string"?ne:null}catch(me){return xt.warn(`slot 표현식 평가 실패 (컴포넌트: ${$.id}):`,me),null}}return xt.log(`[Slot] 정적 슬롯 ID: "${W}" (컴포넌트: ${$.id})`),W},[$.slot,$.id,se,i]),tt=j.useMemo(()=>!Oe||!$.id?"":`${$.id}-${Oe}-${JSON.stringify($.slotOrder??0)}`,[Oe,$.id,$.slotOrder]),Me=j.useRef(null);j.useEffect(()=>{const W=window.__slotContextValue,ve=W?.isEnabled??!1;if($.slot&&xt.log(`[Slot Registration] 컴포넌트: ${$.id}, isSlotEnabled: ${ve}, shouldRender: ${Ee}, resolvedSlotId: ${Oe}`),!ve||!Ee){$.slot&&xt.log(`[Slot Registration] 등록 스킵 - isSlotEnabled: ${ve}, shouldRender: ${Ee}`),Me.current&&$.id&&W&&(W.unregisterFromSlot(Me.current,$.id),Me.current=null);return}if(!Oe||!$.id){$.slot&&xt.log(`[Slot Registration] 등록 스킵 - resolvedSlotId: ${Oe}, id: ${$.id}`),Me.current&&$.id&&W&&(W.unregisterFromSlot(Me.current,$.id),Me.current=null);return}Me.current&&Me.current!==Oe&&W.unregisterFromSlot(Me.current,$.id);const me={...$,slot:void 0,slotOrder:void 0};return W.registerToSlot(Oe,$.id,{componentDef:me,dataContext:e,order:$.slotOrder??0,parentFormContext:h??null,getParentComponentContext:()=>we,translationContext:n,registrationKey:tt}),Me.current=Oe,()=>{const ne=window.__slotContextValue;Oe&&$.id&&ne&&ne.unregisterFromSlot(Oe,$.id)}},[Ee,Oe,$,e,h,we,n,tt]);const qe=j.useCallback(W=>{if(typeof W=="string"){if(Fp(W))return Kp(W);if(Vp(W)){const ve=[],me=W.replace(new RegExp(`${Zl}([^${lo}]*)${lo}`,"g"),(_e,Ne)=>(ve.push(Ne),`${Rs}${ve.length-1}${Rs}`));let ne=me;return/\$t:[a-zA-Z0-9._-]+/.test(me)&&(ne=o.resolveTranslations(me,n,se)),ne.replace(new RegExp(`${Rs}(\\d+)${Rs}`,"g"),(_e,Ne)=>ve[parseInt(Ne)])}if(W.startsWith("$t:defer:"))return W;if(/\$t:[a-zA-Z0-9._-]+/.test(W)){const ve=W.trim();return ve.startsWith("{")&&ve.endsWith("}")||ve.startsWith("[")&&ve.endsWith("]")?W:o.resolveTranslations(W,n,se)}return W}if(Array.isArray(W))return W.map(ve=>qe(ve));if(W&&typeof W=="object"){const ve={};for(const[me,ne]of Object.entries(W))ve[me]=qe(ne);return ve}return W},[o,n,se]),zt=j.useCallback(W=>/[?:|&!+\-*/<>=()]/.test(W),[]),Et=j.useCallback(W=>{if(!W.startsWith("{{")||!W.endsWith("}}"))return null;const ve=W.slice(2,-2);let me=null,ne=0;for(let _e=0;_e<ve.length;_e++){const Ne=ve[_e];if((_e>0?ve[_e-1]:"")!=="\\"&&((Ne==='"'||Ne==="'")&&!me?me=Ne:Ne===me&&(me=null),!me&&(Ne==="{"&&ne++,Ne==="}"&&ne--,ne<0)))return null}return ne===0?ve.trim():null},[]),$t=j.useMemo(()=>{let W={...$.props||{}};const ve=["cellChildren","expandChildren","expandContext","render"],ne=a.getMetadata($.name)?.skipBindingKeys||[],_e=[...new Set([...ve,...ne])],Ne=x?{skipCache:!0}:void 0,$e=De=>{if(Ne)return Ne;if(De.startsWith("_computed")||De.startsWith("$computed"))return{skipCache:!0}};for(const[De,Le]of Object.entries(W))if(!_e.includes(De))if(typeof Le=="string"){const Ue=Et(Le);if(Ue!==null){let At=!1,Kt=Ue;Ue.startsWith(Ds)&&(At=!0,Kt=Ue.slice(Ds.length));const Ut={componentId:$.id,componentName:$.name,propName:De};let qt;if(zt(Kt))try{qt=i.evaluateExpression(Kt,se,Ut)}catch(bn){xt.warn(`표현식 평가 실패 (컴포넌트: ${$.id}, prop: ${De}):`,bn),qt=void 0}else qt=i.resolve(Kt,se,$e(Kt),Ut);W[De]=At&&qt!=null?uo(qt):qt}else{const At={componentId:$.id,componentName:$.name,propName:De};W[De]=i.resolveBindings(Le,se,Ne,At)}}else Array.isArray(Le)?W[De]=Le.map(Ue=>typeof Ue=="string"?i.resolveBindings(Ue,se,Ne):typeof Ue=="object"&&Ue!==null?i.resolveObject(Ue,se,Ne):Ue):Le&&typeof Le=="object"&&(W[De]=i.resolveObject(Le,se,Ne));for(const[De,Le]of Object.entries(W))W[De]=qe(Le);if(typeof W.style=="string"&&(W.style=Sj(W.style)),W=Ku(W,$.actions,se,{componentContext:we,actionDispatcher:d}),$.classMap){const De=$S($.classMap,se,i,{skipCache:!0});if(De){const Le=W.className||"";W.className=Le?`${Le} ${De}`:De}}$.style&&(W.style=$.style),$.actions&&$.actions.length>0&&$.type==="composite"&&Object.assign(W,q),$.component_layout&&(W.__componentLayoutDefs=$.component_layout);const Ve=$.expandChildren||$.props?.expandChildren,yt=$.props?.cellChildren,Ae=$.children&&$.children.length>0,st=$.component_layout,He=$.slot,Pe=$.props?.modalId,Ye=$.type==="composite";return(Ve||yt||Ae||st||He||Pe||Ye)&&(W.__componentContext=we),W},[$.props,$.actions,$.style,$.classMap,$.id,se,n,i,o,we,q,qe,zt,Et,x]),kt=j.useMemo(()=>{const W=$.dataKey,ve=$.trackChanges,me=$.debounce;if(W){const ne=W.startsWith("_global."),_e=ne?W.slice(8):W,Ne=ne?e._global:se._local;return{dataKey:_e,trackChanges:ve??!1,debounce:me,setState:ne?Ve=>{e._globalSetState?e._globalSetState(Ve):xt.warn("_global.formData 사용 시 _globalSetState가 필요합니다.")}:ie,state:Ne??{},_isGlobal:ne}}if(F.dataKey)return F},[$.dataKey,$.trackChanges,$.debounce,$.id,ie,se._local,e._global,e._globalSetState,F]),tn=j.useRef(new Set);j.useEffect(()=>{tn.current.clear()},[e._global?._remountKeys]);const Vt=j.useCallback((W,ve)=>{const me=e._global?._remountKeys;return W&&me?.[W]&&!tn.current.has(W)?(tn.current.add(W),`${W}-remount-${me[W]}`):W||ve},[e._global?._remountKeys]),oa=j.useMemo(()=>{if($.text!==void 0){if(typeof $.text=="string"){const W=$.text;let ve=W;const me={componentId:$.id,componentName:$.name,propName:"text",skipCache:!0},ne=Et(W);if(ne!==null)if(Gp(ne))ve=i.resolveBindings(W,se,{skipCache:!0},me);else if(zt(ne))try{ve=i.evaluateExpression(ne,se,me)}catch(_e){xt.warn(`text 표현식 평가 실패 (컴포넌트: ${$.id}):`,_e),ve=""}else ve=i.resolve(ne,se,{skipCache:!0},me);else W.includes("{{")&&(ve=i.resolveBindings(W,se,{skipCache:!0},me));return ve=qe(ve),ve??""}return $.text}return!$.children||$.children.length===0?null:$.children.map((W,ve)=>{if(typeof W=="string")return W;const me=A?`${A}.children.${ve}`:`${ve}`,ne=W._fromBase?W.id||`child-${ve}`:Vt(W.id,`child-${ve}`),_e=!W._fromBase&&R?`${ne}_${R}`:ne;return l.jsx(Ba,{componentDef:W,dataContext:se,translationContext:n,registry:a,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:we,parentFormContextProp:kt,isInsideIteration:x,isEditMode:y,onComponentSelect:w,onComponentHover:v,componentPath:me,onDragStart:C,onDragEnd:k,layoutKey:R},_e)})},[$.text,$.children,$.id,e,se,n,a,i,o,d,we,kt,Et,zt,qe,Vt,x,y,w,v,A,C,k,R]),Ce=j.useMemo(()=>{if(!$.iteration)return null;try{const W=Vu($.iteration.source,se,i);if(!Array.isArray(W))return xt.warn(`iteration source가 배열이 아닙니다 (컴포넌트: ${$.id}):`,W),null;const ve=rs();return ve?.isEnabled()&&ve.trackIteration($.id||`iteration-${Date.now()}`,$.iteration.source,$.iteration.item_var,$.iteration.index_var,W.length),W.map((me,ne)=>{const _e={...se,[$.iteration.item_var]:me};$.iteration.index_var&&(_e[$.iteration.index_var]=ne);const Ne=ne===0||ne===W.length-1;ve?.isEnabled()&&Ne&&ve.trackNestedContext?.({componentId:`${$.id||"unknown"}-iter-${ne}`,componentType:"iteration",parentContext:{available:Object.keys(se),values:{}},ownContext:{added:[$.iteration.item_var,...$.iteration.index_var?[$.iteration.index_var]:[]],values:{[$.iteration.item_var]:me,...$.iteration.index_var?{[$.iteration.index_var]:ne}:{}}},depth:1});const $e={...$,iteration:void 0},Ve=A?`${A}.iteration.${ne}`:`iteration.${ne}`,yt=`${Vt($.id,"item")}-${ne}`;return l.jsx(Ba,{componentDef:$e,dataContext:_e,translationContext:n,registry:a,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:we,parentFormContextProp:kt,isInsideIteration:!0,isEditMode:y,onComponentSelect:w,onComponentHover:v,componentPath:Ve,onDragStart:C,onDragEnd:k,layoutKey:R},yt)})}catch(W){return xt.error(`iteration 렌더링 실패 (컴포넌트: ${$.id}):`,W),null}},[$.iteration,$.children,$.id,e,se,n,a,i,o,d,we,kt,Vt,y,w,v,A,C,k,R]),[Ge,it]=j.useState(0),ft=j.useMemo(()=>{if(!$.sortable||!$.itemTemplate)return null;const{sortable:W,itemTemplate:ve}=$;try{const me=Vu(W.source,se,i);if(!Array.isArray(me))return xt.warn(`sortable source가 배열이 아닙니다 (컴포넌트: ${$.id}):`,me),null;if(me.length===0)return null;const ne=W.itemKey||"id",_e=W.strategy||"verticalList",Ne=W.itemVar||"$item",$e=W.indexVar||"$index",Ve=W.handle,yt=(He,Pe)=>{const Ye=$.actions?.filter(De=>De.event==="onSortEnd"||De.type==="onSortEnd");if(it(De=>De+1),Ye&&Ye.length>0&&d){const De={...se,$sortedItems:He,$sortEvent:Pe};Ye.forEach(Le=>{try{const Ue=d.createHandler(Le,De,we),At=new Event("sortend");Ue(At)}catch(Ue){xt.error(`onSortEnd action failed: ${Le.handler}`,Ue)}})}},Ae=He=>{const Pe=$.actions?.filter(Ye=>Ye.event==="onSortStart"||Ye.type==="onSortStart");if(Pe&&Pe.length>0&&d){const Ye={...se,$activeId:He.activeId};Pe.forEach(De=>{try{const Le=d.createHandler(De,Ye,we),Ue=new Event("sortstart");Le(Ue)}catch(Le){xt.error(`onSortStart action failed: ${De.handler}`,Le)}})}},st=me.map((He,Pe)=>{const Ye=String(He[ne]),De={...se,[Ne]:He,[$e]:Pe},Le=A?`${A}.sortable.${Pe}`:`sortable.${Pe}`,Ue=`${Vt($.id,"sortable-item")}-v${Ge}-${Ye}`;return l.jsx(bj,{id:Ye,handle:Ve,children:l.jsx(Ba,{componentDef:ve,dataContext:De,translationContext:n,registry:a,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:we,parentFormContextProp:void 0,isInsideIteration:!0,isEditMode:y,onComponentSelect:w,onComponentHover:v,componentPath:Le,onDragStart:C,onDragEnd:k,layoutKey:R})},Ue)});return l.jsx(mj,{items:me,itemKey:ne,strategy:_e,onSortEnd:yt,onSortStart:Ae,sortVersion:Ge,children:st})}catch(me){return xt.error(`sortable 렌더링 실패 (컴포넌트: ${$.id}):`,me),null}},[$.sortable,$.itemTemplate,$.actions,$.id,e,se,n,a,i,o,d,we,Vt,y,w,v,A,C,k,Ge,R]),bt=j.useRef(!1);j.useEffect(()=>{if(bt.current)return;bt.current=!0;const W=rs();if(W?.isEnabled()&&W.trackMount(r.id,{name:r.name,type:r.type||"component",props:$t}),r.lifecycle?.onMount&&r.lifecycle.onMount.length>0)for(const me of r.lifecycle.onMount)try{const ne=d.createHandler(me,se,we),_e=new Event("mount");ne(_e),xt.log(`Lifecycle onMount executed: ${me.handler} (Component: ${r.id})`)}catch(ne){xt.error(`Lifecycle onMount failed: ${me.handler} (Component: ${r.id})`,ne)}const ve=[];if(r.onComponentEvent&&r.onComponentEvent.length>0){const me=window.G7Core;if(me?.componentEvent?.on)for(const ne of r.onComponentEvent){if(!ne.event){xt.warn(`onComponentEvent: event name is required (Component: ${r.id})`);continue}const _e=async $e=>{try{const Ve={...se,_eventData:$e},Ae=await d.createHandler({handler:ne.handler,params:ne.params,onSuccess:ne.onSuccess,onError:ne.onError},Ve,we)(new CustomEvent(ne.event,{detail:$e}));return xt.log(`onComponentEvent "${ne.event}" handled: ${ne.handler} (Component: ${r.id})`,{eventData:$e,result:Ae}),Ae}catch(Ve){throw xt.error(`onComponentEvent "${ne.event}" failed: ${ne.handler} (Component: ${r.id})`,Ve),Ve}},Ne=me.componentEvent.on(ne.event,_e);ve.push(Ne),xt.log(`onComponentEvent: Subscribed to "${ne.event}" (Component: ${r.id})`)}else xt.warn(`onComponentEvent: G7Core.componentEvent is not available (Component: ${r.id})`)}return()=>{const me=rs();me?.isEnabled()&&me.trackUnmount(r.id);for(const ne of ve)try{ne()}catch(_e){xt.error(`onComponentEvent: Failed to unsubscribe (Component: ${r.id})`,_e)}if(ve.length>0&&xt.log(`onComponentEvent: Unsubscribed ${ve.length} event(s) (Component: ${r.id})`),r.lifecycle?.onUnmount&&r.lifecycle.onUnmount.length>0)for(const ne of r.lifecycle.onUnmount)try{const _e=d.createHandler(ne,se,we),Ne=new Event("unmount");_e(Ne),xt.log(`Lifecycle onUnmount executed: ${ne.handler} (Component: ${r.id})`)}catch(_e){xt.error(`Lifecycle onUnmount failed: ${ne.handler} (Component: ${r.id})`,_e)}}},[]);const Ct=j.useMemo(()=>{const W=$t.dataKey,ve=$t.trackChanges,me=$t.debounce;return W?{dataKey:W,trackChanges:ve??!1,debounce:me,setState:ie,state:q}:null},[$t.dataKey,$t.trackChanges,$t.debounce,ie,q]);j.useEffect(()=>{const W=$.dataKey||$t.dataKey;if(!W)return;const ve=rs();if(!ve?.isEnabled())return;const me=[],ne=Ne=>{if(Ne)for(const $e of Ne){const Ve=$e?.props?.name;if(Ve&&me.push({name:Ve,type:$e.name||$e.type||"unknown"}),$e?.children&&ne($e.children),$e?.slots)for(const yt of Object.values($e.slots))Array.isArray(yt)&&ne(yt)}};if(r.children&&ne(r.children),r.slots)for(const Ne of Object.values(r.slots))Array.isArray(Ne)&&ne(Ne);const _e=r.id||`form-${W}`;return ve.trackForm(_e,W,me),()=>{ve.untrackForm(_e)}},[$,$t.dataKey,r.id,r.children]);const ot=j.useRef(null),We=j.useRef(void 0),nn=j.useMemo(()=>{const{dataKey:W,trackChanges:ve,debounce:me,...ne}=$t,_e=ne.name;if(!_e||!F.dataKey||!F.setState)return ne;if(ne.autoBinding===!1){const{autoBinding:De,...Le}=ne;return Le}const Ne=`${F.dataKey}.${_e}`,$e=y7(F.state,Ne),Ve=$e!==void 0?$e:ne.value,Ae=a.getMetadata(r.name)?.bindingType,st=typeof Ve=="boolean"&&(Ae==="checked"||Ae==="checkable"&&["checkbox","radio"].includes(ne?.type)),He=F.debounce,Pe=De=>{const Le=F.state||{},Ue=x7(Le,Ne,De);F.trackChanges&&(Ue.hasChanges=!0),window.__g7PendingLocalState=Ue,F.setState(Ue)},Ye=(De,Le)=>{He&&He>0?(ot.current&&clearTimeout(ot.current),ot.current=setTimeout(()=>{Pe(De),ot.current=null,Le&&(Le(),window.__g7PendingLocalState=null)},He)):(Pe(De),Le&&(Le(),window.__g7PendingLocalState=null))};if(st)return{...ne,checked:Ve,onChange:Le=>{const Ue=Le.target.checked;Pe(Ue),ne.onChange&&ne.onChange(Le)}};{const De=Ue=>{const At=Ue?.target?.value!==void 0?Ue.target.value:Ue;He&&He>0&&(We.current=At);const Kt=Ue?.target?{target:{value:At,name:Ue.target.name,type:Ue.target.type,checked:Ue.target.checked},currentTarget:Ue.currentTarget?{value:At,name:Ue.currentTarget.name}:void 0}:Ue;Ye(At,()=>{ne.onChange&&ne.onChange(Kt)})};let Le;return We.current!==void 0?ot.current!==null?Le=We.current:String(Ve??"")===String(We.current)?(We.current=void 0,Le=Ve??""):Le=We.current:Le=Ve??"",{...ne,value:Le,onChange:De}}},[$t,F,F.state,F.debounce]),Nt=j.useMemo(()=>{const W=rs();if(W?.isEnabled()&&W.trackRender(r.name),!Ee)return null;if($.sortable&&$.itemTemplate)return ft;if($.iteration)return Ce;if($.type==="extension_point"){const{layout:Ve,columns:yt,gap:Ae,className:st,...He}=$.props||{};let Pe=st||"";return Ve==="grid"&&yt?Pe=`${Pe} grid grid-cols-${yt} gap-${Ae||4}`.trim():Ve==="flex"&&(Pe=`${Pe} flex flex-col gap-${Ae||4}`.trim()),l.jsx("div",{id:$.id,className:Pe||void 0,...He,children:oa})}const ve=a.getComponent($.name);if(!ve)return xt.error(`컴포넌트를 찾을 수 없습니다: ${$.name} (ID: ${$.id})`,"componentDef:",JSON.stringify($,null,2)),null;const me=e._global?._remountKeys,ne={...nn,id:nn.id??$.id,...me&&Object.keys(me).length>0&&{__remountTrigger:JSON.stringify(me)}};if(pe?.listeners&&pe.handle&&nn["data-drag-handle"]!==void 0&&(Object.assign(ne,pe.listeners),ne.style={...ne.style,cursor:pe.isDragging?"grabbing":"grab"}),y){const Ve=$.id||`auto_${$.name||$.type||"unknown"}_${Math.random().toString(36).substring(2,8)}`;ne["data-editor-id"]=Ve,ne["data-editor-name"]=$.name,ne["data-editor-type"]=$.type,A&&(ne["data-editor-path"]=A);const yt=ne.onClick;ne.onClick=Ae=>{w&&(Ae.stopPropagation(),w(Ve,Ae)),typeof yt=="function"&&yt(Ae)},v&&(ne.onMouseMove=Ae=>{Ae.stopPropagation(),v(Ve,Ae)},ne.onMouseLeave=Ae=>{v(null,Ae)}),ne.draggable=!0,C&&(ne.onDragStart=Ae=>{Ae.stopPropagation(),C(Ve,Ae)}),k&&(ne.onDragEnd=Ae=>{k(Ae)})}const Ne=$.type==="basic"||$.type==="layout"?(()=>{const{__componentContext:Ve,__componentLayoutDefs:yt,...Ae}=ne;return Ae})():ne;let $e=l.jsx(ve,{...Ne,children:oa});if(kt&&($e=l.jsx(p7,{value:kt,children:$e})),$.isolatedState){const Ve=typeof $.isolatedState=="object"?$.isolatedState:{},yt=e?._isolatedInit,Ae=yt?{...Ve,...yt}:Ve;$e=l.jsx(j7,{initialState:Ae,scopeId:$.isolatedScopeId,children:$e})}return $e},[Ee,$.iteration,$.sortable,$.itemTemplate,$.type,$.name,$.id,$.props,$.isolatedState,$.isolatedScopeId,a,nn,oa,Ce,ft,pe,Ct,y,w,v,C,k,A,e._global?._remountKeys]),It=j.useMemo(()=>{const W=$.blur_until_loaded;if(!W||e?._global?.__isPreview)return!1;if(typeof W=="string"){const ne=Et(W);if(ne!==null)try{const _e={componentId:$.id,componentName:$.name,propName:"blur_until_loaded"};return!!i.evaluateExpression(ne,se,_e)}catch(_e){return xt.warn(`blur_until_loaded 표현식 평가 실패 (컴포넌트: ${$.id}):`,_e),!1}return!1}if(typeof W=="object"&&W!==null){if(!W.enabled)return!1;if(W.data_sources)return(Array.isArray(W.data_sources)?W.data_sources:[W.data_sources]).some($e=>e[$e]===void 0);if(je)return!0;const ne=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(Ne=>!ne.includes(Ne)&&!Ne.startsWith("_")).some(Ne=>e[Ne]===void 0)}if(je)return!0;const ve=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(ne=>!ve.includes(ne)&&!ne.startsWith("_")).some(ne=>e[ne]===void 0)},[$.blur_until_loaded,$.id,je,e,se,i,Et]);if(It){const W=$.blur_until_loaded;if(typeof W=="object"&&W?.data_sources){const me=(Array.isArray(W.data_sources)?W.data_sources:[W.data_sources]).reduce((_e,Ne)=>(_e[Ne]=e[Ne]===void 0?"UNDEFINED":"LOADED",_e),{}),ne=Object.keys(e).filter(_e=>!_e.startsWith("_"));xt.log(`[BLUR APPLIED] Component: ${$.id}, data_sources status:`,me,"Available keys:",ne)}else xt.log(`[BLUR APPLIED] Component: ${$.id}, blur_until_loaded:`,W)}const an=window.__slotContextValue;return Oe&&an?.isEnabled?null:l.jsx(wj,{componentId:r.id,componentName:r.name,children:$.blur_until_loaded?l.jsx("div",{className:It?"opacity-50 blur-sm transition-all duration-300 pointer-events-none":void 0,children:Nt}):Nt})});Ba.displayName="DynamicRenderer",typeof window<"u"&&(window.__DynamicRenderer=Ba);function Cj(r){const e={};try{const a=new URL(r,typeof window<"u"?window.location.origin:"http://localhost").searchParams,i=new Set;for(const o of a.keys()){if(i.has(o))continue;i.add(o);const d=a.getAll(o);d.length>1||o.endsWith("[]")?e[o]=d:e[o]=d[0]}}catch{}return e}function jj(r){try{return new URL(r,typeof window<"u"?window.location.origin:"http://localhost").pathname}catch{return r.split("?")[0]}}const Er=class Er{constructor(){H(this,"config",{enabled:!1,maxHistorySize:100,logLevel:"info",serverEndpoint:"/_boost/g7-debug/dump-state",autoCapture:!0});H(this,"stateHistory",[]);H(this,"snapshotIdCounter",0);H(this,"stateWatchers",new Map);H(this,"currentLocalState",{});H(this,"currentComputedState",{});H(this,"currentParentContext");H(this,"actionHistory",[]);H(this,"actionWatchers",new Set);H(this,"cacheStats",{hits:0,misses:0,entries:0});H(this,"cacheDecisions",[]);H(this,"cacheDecisionIdCounter",0);H(this,"maxCacheDecisions",200);H(this,"currentRenderCycleId",null);H(this,"isInActionExecution",!1);H(this,"isInIteration",!1);H(this,"mountedComponents",new Map);H(this,"eventListeners",new Map);H(this,"mountWatchers",new Set);H(this,"unmountWatchers",new Set);H(this,"renderCounts",new Map);H(this,"bindingEvalCount",0);H(this,"profilingData",[]);H(this,"isProfiling",!1);H(this,"profilingStartTime",0);H(this,"activeRequests",new Map);H(this,"requestHistory",[]);H(this,"pendingDataSources",new Set);H(this,"requestWatchers",new Set);H(this,"wsConnections",new Map);H(this,"wsMessageHistory",[]);H(this,"wsMessageWatchers",new Set);H(this,"ifConditions",new Map);H(this,"iterations",new Map);H(this,"conditionWatchers",new Set);H(this,"forms",new Map);H(this,"formWatchers",new Set);H(this,"expressionHistory",[]);H(this,"expressionWatchers",new Set);H(this,"expressionIdCounter",0);H(this,"dataSources",new Map);H(this,"dataPathTransforms",[]);H(this,"maxDataPathTransforms",100);H(this,"nestedContexts",[]);H(this,"nestedContextIdCounter",0);H(this,"maxNestedContexts",100);H(this,"formBindingIssues",[]);H(this,"formBindingValidations",[]);H(this,"formBindingIssueIdCounter",0);H(this,"maxFormBindingIssues",100);H(this,"computedProperties",new Map);H(this,"computedRecalcLogs",[]);H(this,"computedRecalcIdCounter",0);H(this,"maxComputedRecalcLogs",100);H(this,"handlers",new Map);H(this,"componentEventSubscriptions",new Map);H(this,"componentEventEmitHistory",[]);H(this,"componentEventIdCounter",0);H(this,"maxComponentEventHistory",100);H(this,"stateRenderingLogs",[]);H(this,"currentStateChangeContext",null);H(this,"stateRenderingIdCounter",0);H(this,"componentRenderCounts",new Map);H(this,"stateToComponentMap",new Map);H(this,"maxStateRenderingLogs",100);H(this,"componentStateSources",new Map);H(this,"contextFlowNodes",new Map);H(this,"dynamicStates",new Map);H(this,"styleIssues",[]);H(this,"componentStyles",new Map);H(this,"authEvents",[]);H(this,"authHeaderHistory",[]);H(this,"authEventIdCounter",0);H(this,"maxAuthEventHistory",50);H(this,"logHistory",[]);H(this,"logIdCounter",0);H(this,"maxLogHistory",500);H(this,"currentLayout",null);H(this,"layoutHistory",[]);H(this,"layoutIdCounter",0);H(this,"layoutStats",{totalLoads:0,cacheHits:0,apiLoads:0});H(this,"maxLayoutHistory",50);H(this,"executionDetails",new Map);H(this,"stateChangeHistory",[]);H(this,"dataSourceChangeHistory",[]);H(this,"changeAlerts",[]);H(this,"changeExpectations",new Map);H(this,"executionIdCounter",0);H(this,"stateChangeIdCounter",0);H(this,"alertIdCounter",0);H(this,"maxExecutionDetails",100);H(this,"maxStateChangeHistory",200);H(this,"maxChangeAlerts",100);H(this,"sequenceExecutions",[]);H(this,"sequenceExecutionStack",[]);H(this,"sequenceIdCounter",0);H(this,"maxSequenceExecutions",50);H(this,"staleClosureWarnings",[]);H(this,"staleClosureIdCounter",0);H(this,"maxStaleClosureWarnings",100);H(this,"stateCaptureRegistry",new Map);H(this,"modalStates",new Map);H(this,"modalStateIssues",[]);H(this,"modalStateRelations",[]);H(this,"modalStateChangeLogs",[]);H(this,"modalStateIssueIdCounter",0);H(this,"modalStateChangeLogIdCounter",0);H(this,"maxModalStateIssues",100);H(this,"maxModalStateChangeLogs",200);H(this,"namedActionDefinitions",{});H(this,"namedActionRefLogs",[]);H(this,"namedActionRefIdCounter",0);H(this,"maxNamedActionRefLogs",200);H(this,"debounceActionHistory",[]);H(this,"dataSourceUpdateHistory",[]);H(this,"debounceActionIdCounter",0);H(this,"dataSourceUpdateIdCounter",0)}static getInstance(){return Er.instance||(Er.instance=new Er),Er.instance}initialize(){if(this.config.enabled=this.checkDebugMode(),!this.config.enabled){console.log("[G7DevTools] 비활성화됨 (환경설정 > 고급 설정 > 디버그 모드를 켜세요)");return}console.log("[G7DevTools] 활성화됨"),this.setupGlobalErrorHandler()}checkDebugMode(){try{if(window.G7Config?.debug===!0)return!0;const a=window.G7Core?.state?.get?.();return a?.settings?.advanced?.debug_mode===!0||a?._global?.settings?.advanced?.debug_mode===!0}catch{return!1}}isEnabled(){return this.config.enabled}setupGlobalErrorHandler(){window.addEventListener("error",e=>{this.config.enabled&&this.logAction({id:this.generateId(),type:"globalError",startTime:Date.now(),status:"error",error:{name:"Error",message:e.message,stack:e.error?.stack}})}),window.addEventListener("unhandledrejection",e=>{this.config.enabled&&this.logAction({id:this.generateId(),type:"unhandledRejection",startTime:Date.now(),status:"error",error:{name:"UnhandledRejection",message:String(e.reason)}})})}captureStateSnapshot(e){if(!this.config.enabled)return;const n={id:++this.snapshotIdCounter,timestamp:Date.now(),source:e.source,prev:this.sanitizeObject(e.prev),next:this.sanitizeObject(e.next),diff:e.diff};this.stateHistory.push(n),this.stateHistory.length>this.config.maxHistorySize&&this.stateHistory.shift(),this.notifyStateWatchers(n)}getState(){try{const e=window.G7Core,n=e?.state?.get?.()||{},a={};if(e?._isolatedStates&&typeof e._isolatedStates=="object")for(const[i,o]of Object.entries(e._isolatedStates))a[i]=this.sanitizeObject(o);return{_global:n._global||n,_local:this.currentLocalState,_computed:this.currentComputedState,_isolated:Object.keys(a).length>0?a:void 0,$parent:this.currentParentContext}}catch{return{_global:{},_local:this.currentLocalState,_computed:this.currentComputedState}}}updateLocalState(e){this.config.enabled&&(this.currentLocalState=this.sanitizeObject(e))}updateComputedState(e){this.config.enabled&&(this.currentComputedState=this.sanitizeObject(e))}updateParentContext(e){this.config.enabled&&(this.currentParentContext=e?this.sanitizeObject(e):void 0)}getStateHistory(){return[...this.stateHistory]}watchState(e,n){return this.stateWatchers.has(e)||this.stateWatchers.set(e,new Set),this.stateWatchers.get(e).add(n),()=>{this.stateWatchers.get(e)?.delete(n)}}notifyStateWatchers(e){if(this.stateWatchers.get("*")?.forEach(n=>{try{n(e.next,e.prev,"*")}catch(a){console.error("[G7DevTools] State watcher error:",a)}}),e.diff)for(const n of e.diff.changed)this.stateWatchers.get(n.path)?.forEach(a=>{try{a(n.newValue,n.oldValue,n.path)}catch(i){console.error("[G7DevTools] State watcher error:",i)}})}diffSnapshots(e,n){const a=this.stateHistory.find(o=>o.id===e),i=this.stateHistory.find(o=>o.id===n);return!a||!i?null:this.calculateDiff(a.next,i.next)}calculateDiff(e,n,a=""){const i={added:[],removed:[],changed:[]},o=new Set(Object.keys(e)),d=new Set(Object.keys(n));for(const g of d){const h=a?`${a}.${g}`:g;o.has(g)?JSON.stringify(e[g])!==JSON.stringify(n[g])&&i.changed.push({path:h,oldValue:e[g],newValue:n[g]}):i.added.push(h)}for(const g of o){const h=a?`${a}.${g}`:g;d.has(g)||i.removed.push(h)}return i}logAction(e){if(!this.config.enabled)return;const n=this.actionHistory.findIndex(a=>a.id===e.id);n>=0?this.actionHistory[n]={...this.actionHistory[n],...e}:(this.actionHistory.push(e),this.actionHistory.length>this.config.maxHistorySize&&this.actionHistory.shift()),this.isProfiling&&this.profilingData.push({type:"action",action:e.type,timestamp:performance.now(),duration:e.duration}),this.notifyActionWatchers(e)}getActionHistory(){return[...this.actionHistory]}watchActions(e){return this.actionWatchers.add(e),()=>{this.actionWatchers.delete(e)}}notifyActionWatchers(e){this.actionWatchers.forEach(n=>{try{n(e)}catch(a){console.error("[G7DevTools] Action watcher error:",a)}})}getActionMetrics(){const e=this.actionHistory.filter(o=>o.status==="success"),n=this.actionHistory.filter(o=>o.status==="error"),a={};for(const o of this.actionHistory)a[o.type]=(a[o.type]||0)+1;const i=e.reduce((o,d)=>o+(d.duration||0),0);return{totalActions:this.actionHistory.length,successCount:e.length,errorCount:n.length,averageDuration:e.length>0?i/e.length:0,actionsByType:a}}recordCacheHit(){this.config.enabled&&this.cacheStats.hits++}recordCacheMiss(){this.config.enabled&&this.cacheStats.misses++}updateCacheEntries(e){this.config.enabled&&(this.cacheStats.entries=e)}getCacheStats(){const e=this.cacheStats.hits+this.cacheStats.misses;return{...this.cacheStats,hitRate:e>0?this.cacheStats.hits/e:0}}resetCacheStats(){this.cacheStats={hits:0,misses:0,entries:0}}trackCacheDecision(e){if(!this.config.enabled)return;const n={id:`cache-${++this.cacheDecisionIdCounter}`,timestamp:Date.now(),expression:e.expression,decision:e.decision,reason:e.reason,context:{isInIteration:this.isInIteration,isInAction:this.isInActionExecution,renderCycleId:this.currentRenderCycleId||void 0,componentId:e.componentId,skipCacheOption:e.skipCacheOption},cachedValue:e.cachedValue!==void 0?this.safeClone(e.cachedValue):void 0,freshValue:e.freshValue!==void 0?this.safeClone(e.freshValue):void 0,valueMatch:e.cachedValue!==void 0&&e.freshValue!==void 0?JSON.stringify(e.cachedValue)===JSON.stringify(e.freshValue):void 0,duration:e.duration};this.cacheDecisions.push(n),this.cacheDecisions.length>this.maxCacheDecisions&&this.cacheDecisions.shift(),e.decision==="cache_hit"?this.cacheStats.hits++:(e.decision==="cache_miss"||e.decision==="skip_cache")&&this.cacheStats.misses++}startRenderCycle(e){return this.currentRenderCycleId=`render-${Date.now()}-${e||"root"}`,this.currentRenderCycleId}endRenderCycle(){this.currentRenderCycleId=null}startActionContext(){this.isInActionExecution=!0}endActionContext(){this.isInActionExecution=!1}startIterationContext(){this.isInIteration=!0}endIterationContext(){this.isInIteration=!1}getCacheDecisionTrackingInfo(){const e=this.getCacheDecisionStats();return{decisions:[...this.cacheDecisions],stats:e,timestamp:Date.now()}}getCacheDecisionStats(){const e=this.cacheDecisions;let n=0,a=0,i=0,o=0;const d={},g={};for(const f of e)f.decision==="cache_hit"?n++:f.decision==="cache_miss"?a++:f.decision==="skip_cache"?i++:f.decision==="invalidate"&&o++,d[f.reason]=(d[f.reason]||0)+1,f.context.componentId&&(g[f.context.componentId]=(g[f.context.componentId]||0)+1);const h=n+a+i;return{totalDecisions:e.length,cacheHits:n,cacheMisses:a,skipCacheCount:i,invalidateCount:o,byReason:d,byComponent:g,avgHitRate:h>0?n/h:0}}getRecentCacheDecisions(e=20,n){let a=[...this.cacheDecisions];return n&&(a=a.filter(i=>i.decision===n)),a.slice(-e)}clearCacheDecisionData(){this.cacheDecisions=[],this.cacheDecisionIdCounter=0}summarizePropsForLifecycle(e){if(!e||typeof e!="object")return e;const n={},a=["children","ref","key"];for(const[i,o]of Object.entries(e))if(!a.includes(i))if(o==null)n[i]=o;else if(Array.isArray(o))n[i]=`[Array(${o.length})]`;else if(typeof o=="object"){const d=Object.keys(o);d.length<=3?n[i]=`{${d.join(", ")}}`:n[i]=`{${d.slice(0,3).join(", ")}, ... +${d.length-3}}`}else typeof o=="string"&&o.length>50?n[i]=o.substring(0,50)+"...":typeof o=="function"?n[i]="[Function]":n[i]=o;return n}trackMount(e,n){if(!this.config.enabled)return;const a=this.summarizePropsForLifecycle(n.props),i={...n,props:a,id:e,mountTime:Date.now()};this.mountedComponents.set(e,i),this.mountWatchers.forEach(o=>{try{o({componentId:e,componentName:n.name,timestamp:i.mountTime})}catch(d){console.error("[G7DevTools] Mount watcher error:",d)}})}trackUnmount(e){if(!this.config.enabled)return;const n=this.mountedComponents.get(e),a=this.eventListeners.get(e)||[];a.length>0&&console.warn(`[G7DevTools] 컴포넌트 ${e} 언마운트 시 ${a.length}개 리스너 미정리`),n&&this.unmountWatchers.forEach(i=>{try{i({componentId:e,componentName:n.name,timestamp:Date.now(),orphanedListeners:a.length})}catch(o){console.error("[G7DevTools] Unmount watcher error:",o)}}),this.mountedComponents.delete(e)}trackListener(e,n,a){if(!this.config.enabled)return;const i=this.eventListeners.get(e)||[];i.push({type:n,target:a,addedAt:Date.now()}),this.eventListeners.set(e,i)}removeListener(e,n){if(!this.config.enabled)return;const a=this.eventListeners.get(e)||[],i=a.findIndex(o=>o.type===n);i>=0&&a.splice(i,1)}getMountedComponents(){return Array.from(this.mountedComponents.values())}getOrphanedListeners(){const e=[];for(const[n,a]of this.eventListeners)this.mountedComponents.has(n)||e.push(...a.map(i=>({...i,componentId:n})));return e}watchMount(e){return this.mountWatchers.add(e),()=>{this.mountWatchers.delete(e)}}watchUnmount(e){return this.unmountWatchers.add(e),()=>{this.unmountWatchers.delete(e)}}trackRender(e){if(!this.config.enabled)return;const n=this.renderCounts.get(e)||0;this.renderCounts.set(e,n+1),this.isProfiling&&this.profilingData.push({type:"render",component:e,timestamp:performance.now()})}trackBindingEval(e){this.config.enabled&&(this.bindingEvalCount++,this.isProfiling&&e&&this.profilingData.push({type:"binding",expression:e,timestamp:performance.now()}))}getRenderCount(){return new Map(this.renderCounts)}getBindingEvalCount(){return this.bindingEvalCount}getMemoryWarnings(){const e=[];try{const i=this.getState(),o=JSON.stringify(i).length;o>1e6&&e.push({type:"large-state",message:`상태 크기가 ${(o/1024/1024).toFixed(2)}MB입니다`,suggestion:"불필요한 데이터 정리 필요",severity:o>5e6?"error":"warning"})}catch{}this.stateHistory.length>this.config.maxHistorySize*.8&&e.push({type:"large-history",message:`상태 이력이 ${this.stateHistory.length}개입니다`,suggestion:"maxHistory 설정 조정 필요",severity:"warning"});const n=this.getOrphanedListeners().length;n>0&&e.push({type:"orphaned-listeners",message:`${n}개의 정리되지 않은 이벤트 리스너`,suggestion:"useEffect cleanup 또는 removeEventListener 확인",severity:n>10?"error":"warning"});const a=Array.from(this.renderCounts.entries()).filter(([,i])=>i>50);return a.length>0&&e.push({type:"excessive-renders",message:`${a.length}개 컴포넌트가 50회 이상 렌더링`,suggestion:"React.memo, useMemo, useCallback 사용 고려",severity:"warning"}),e}startProfiling(){this.config.enabled&&(this.isProfiling=!0,this.profilingData=[],this.profilingStartTime=performance.now(),console.log("[G7DevTools] 프로파일링 시작"))}stopProfiling(){this.isProfiling=!1;const e=performance.now()-this.profilingStartTime,n=this.analyzeProfile(e);return console.log("[G7DevTools] 프로파일링 완료",n),n}analyzeProfile(e){const n=this.profilingData.filter(f=>f.type==="render"),a=this.profilingData.filter(f=>f.type==="binding"),i=this.profilingData.filter(f=>f.type==="action"),o={};for(const f of n)f.component&&(o[f.component]||(o[f.component]={count:0,durations:[]}),o[f.component].count++,f.duration&&o[f.component].durations.push(f.duration));const d=Object.entries(o).map(([f,p])=>({name:f,renderCount:p.count,avgDuration:p.durations.length>0?p.durations.reduce((x,y)=>x+y,0)/p.durations.length:0})).sort((f,p)=>p.renderCount-f.renderCount).slice(0,10),g={};for(const f of a)f.expression&&(g[f.expression]=(g[f.expression]||0)+1);const h=Object.entries(g).sort(([,f],[,p])=>p-f).slice(0,10).map(([f])=>f);return{duration:e,entries:this.profilingData,summary:{totalRenders:n.length,totalBindings:a.length,totalActions:i.length,slowestComponents:d,hotPaths:h}}}resetPerformanceStats(){this.renderCounts.clear(),this.bindingEvalCount=0,this.profilingData=[]}trackRequest(e,n,a){if(!this.config.enabled)return"";const i=this.generateId(),o=jj(e),d=Cj(e);return this.activeRequests.set(i,{id:i,url:o,fullUrl:e,queryParams:d,method:n,startTime:Date.now(),status:"pending",requestBody:a?.requestBody?this.sanitizeObject(a.requestBody):void 0,dataSourceId:a?.dataSourceId}),this.isProfiling&&this.profilingData.push({type:"network",timestamp:performance.now()}),i}completeRequest(e,n,a){if(!this.config.enabled)return;const i=this.activeRequests.get(e);if(!i)return;const o={...i,status:n>=200&&n<300?"success":"error",statusCode:n,duration:Date.now()-i.startTime,endTime:Date.now(),response:this.sanitizeObject(a)};this.requestHistory.push(o),this.activeRequests.delete(e),this.requestHistory.length>this.config.maxHistorySize&&this.requestHistory.shift(),this.notifyRequestWatchers(o)}failRequest(e,n){if(!this.config.enabled)return;const a=this.activeRequests.get(e);if(!a)return;const i={...a,status:"error",error:n,duration:Date.now()-a.startTime,endTime:Date.now()};this.requestHistory.push(i),this.activeRequests.delete(e),this.notifyRequestWatchers(i)}trackDataSource(e){this.config.enabled&&this.pendingDataSources.add(e)}completeDataSource(e){this.config.enabled&&this.pendingDataSources.delete(e)}getActiveRequests(){return Array.from(this.activeRequests.values())}getRequestHistory(){return[...this.requestHistory]}getPendingDataSources(){return Array.from(this.pendingDataSources)}watchRequest(e){return this.requestWatchers.add(e),()=>{this.requestWatchers.delete(e)}}notifyRequestWatchers(e){this.requestWatchers.forEach(n=>{try{n(e)}catch(a){console.error("[G7DevTools] Request watcher error:",a)}})}trackWebSocketConnection(e,n,a){this.config.enabled&&this.wsConnections.set(e,{id:e,url:n,state:a,connectedAt:a==="open"?Date.now():void 0})}trackWebSocketMessage(e,n,a,i){if(!this.config.enabled)return;const o={id:this.generateId(),connectionId:e,direction:n,type:a,payload:this.sanitizeObject(i),timestamp:Date.now(),sequence:this.wsMessageHistory.length};this.wsMessageHistory.push(o),this.wsMessageHistory.length>this.config.maxHistorySize&&this.wsMessageHistory.shift(),this.notifyWebSocketWatchers(o)}getWebSocketConnections(){return Array.from(this.wsConnections.values())}getWebSocketMessageHistory(){return[...this.wsMessageHistory]}getWebSocketConnectionState(){const e=Array.from(this.wsConnections.values());return e.some(n=>n.state==="open")?"connected":e.some(n=>n.state==="connecting")?"reconnecting":"disconnected"}watchWebSocketMessage(e){return this.wsMessageWatchers.add(e),()=>{this.wsMessageWatchers.delete(e)}}notifyWebSocketWatchers(e){this.wsMessageWatchers.forEach(n=>{try{n(e)}catch(a){console.error("[G7DevTools] WebSocket watcher error:",a)}})}trackIfCondition(e,n,a){if(!this.config.enabled)return;const i=this.ifConditions.get(e),o=i?.evaluatedValue;this.ifConditions.set(e,{id:e,expression:n,evaluatedValue:a,evaluationCount:(i?.evaluationCount||0)+1,lastEvaluated:Date.now()}),i&&o!==a&&this.notifyConditionWatchers({id:e,expression:n,oldValue:o,newValue:a,timestamp:Date.now()})}trackIteration(e,n){this.config.enabled&&this.iterations.set(e,{id:e,...n,lastRendered:Date.now()})}getIfConditions(){return Array.from(this.ifConditions.values())}getIterations(){return Array.from(this.iterations.values())}getScopeChain(e){const n=[],a=this.getState();return n.push({name:"_global",value:a._global,source:"global"}),n.push({name:"_local",value:a._local,source:"local"}),n.push({name:"_computed",value:a._computed,source:"computed"}),n}watchConditionChange(e){return this.conditionWatchers.add(e),()=>{this.conditionWatchers.delete(e)}}notifyConditionWatchers(e){this.conditionWatchers.forEach(n=>{try{n(e)}catch(a){console.error("[G7DevTools] Condition watcher error:",a)}})}trackForm(e,n,a){this.config.enabled&&this.forms.set(e,{id:e,dataKey:n,inputs:a,trackedAt:Date.now()})}trackFormChange(e,n,a){if(!this.config.enabled)return;const i={formId:e,inputName:n,value:a,timestamp:Date.now()};this.notifyFormWatchers(i)}untrackForm(e){this.forms.delete(e)}getForms(){return Array.from(this.forms.values())}getFormState(e){const n=this.getState();return this.getNestedValue(n,e)||{}}getBindingPath(e,n){return`${e}.${n}`}watchFormChange(e){return this.formWatchers.add(e),()=>{this.formWatchers.delete(e)}}notifyFormWatchers(e){this.formWatchers.forEach(n=>{try{n(e)}catch(a){console.error("[G7DevTools] Form watcher error:",a)}})}trackFormBindingIssue(e,n,a){if(!this.config.enabled)return;const i={id:`form-issue-${++this.formBindingIssueIdCounter}`,timestamp:Date.now(),type:e,severity:n,formId:a.formId,formDataKey:a.formDataKey,inputInfo:a.inputInfo,contextInfo:a.contextInfo,description:a.description,suggestion:a.suggestion,docLink:a.docLink};this.formBindingIssues.push(i),this.formBindingIssues.length>this.maxFormBindingIssues&&this.formBindingIssues.shift()}validateFormBinding(e,n,a,i){const o=a.map(h=>{const f=[];let p=!0;return h.name||(f.push("Input에 name 속성이 없습니다"),p=!1,this.trackFormBindingIssue("missing-input-name","error",{formId:e,formDataKey:n,inputInfo:{name:h.name,type:h.type},description:"Input에 name 속성이 없어 자동 바인딩이 동작하지 않습니다",suggestion:"Input에 name 속성을 추가하세요",docLink:"troubleshooting-components-form.md"})),n||(f.push("Form에 dataKey가 없습니다"),p=!1),{inputName:h.name||"(unnamed)",inputType:h.type,bindingPath:n&&h.name?`${n}.${h.name}`:"-",isValid:p,currentValue:h.value,issues:f}});if(n||this.trackFormBindingIssue("missing-datakey","error",{formId:e,description:"Form에 dataKey가 설정되지 않아 자동 바인딩이 동작하지 않습니다",suggestion:"Form 컴포넌트에 dataKey props를 설정하세요",docLink:"troubleshooting-components-form.md"}),i.isContextBroken){const h=i.breakReason?.includes("sortable")?"sortable-context-break":i.breakReason?.includes("modal")?"modal-context-isolation":"context-not-propagated";this.trackFormBindingIssue(h,"warning",{formId:e,formDataKey:n,contextInfo:{hasParentFormContext:i.hasParentContext,parentFormContextProp:i.parentContextProp,isInsideSortable:i.breakReason?.includes("sortable")||!1,isInsideModal:i.breakReason?.includes("modal")||!1,depth:0},description:i.breakReason||"Form 컨텍스트가 제대로 전파되지 않았습니다",suggestion:"parentFormContextProp={undefined}를 확인하거나 중첩 구조를 검토하세요",docLink:"troubleshooting-components-form.md"})}const d={formId:e,dataKey:n,timestamp:Date.now(),contextPropagation:i,inputBindings:o,isValid:o.every(h=>h.isValid)&&!!n&&!i.isContextBroken,issueCount:o.filter(h=>!h.isValid).length+(n?0:1)+(i.isContextBroken?1:0)},g=this.formBindingValidations.findIndex(h=>h.formId===e);return g>=0?this.formBindingValidations[g]=d:this.formBindingValidations.push(d),d}getFormBindingValidationTrackingInfo(){const e=this.getFormBindingValidationStats();return{issues:[...this.formBindingIssues],validations:[...this.formBindingValidations],stats:e,timestamp:Date.now()}}getFormBindingValidationStats(){const e={"missing-datakey":0,"missing-input-name":0,"context-not-propagated":0,"sortable-context-break":0,"modal-context-isolation":0,"duplicate-input-name":0,"value-type-mismatch":0,"binding-path-invalid":0},n={info:0,warning:0,error:0};for(const i of this.formBindingIssues)e[i.type]++,n[i.severity]++;const a=Object.entries(e).filter(([,i])=>i>0).sort((i,o)=>o[1]-i[1]).slice(0,5).map(([i,o])=>({type:i,count:o,description:this.getIssueTypeDescription(i)}));return{totalFormsValidated:this.formBindingValidations.length,validForms:this.formBindingValidations.filter(i=>i.isValid).length,formsWithIssues:this.formBindingValidations.filter(i=>!i.isValid).length,totalIssues:this.formBindingIssues.length,byIssueType:e,bySeverity:n,topIssues:a}}getIssueTypeDescription(e){return{"missing-datakey":"Form에 dataKey 누락","missing-input-name":"Input에 name 속성 누락","context-not-propagated":"Form 컨텍스트 전파 실패","sortable-context-break":"Sortable 컨테이너에서 컨텍스트 단절","modal-context-isolation":"모달에서 부모 Form 컨텍스트 격리","duplicate-input-name":"동일 Form 내 중복 Input name","value-type-mismatch":"값 타입과 Input 타입 불일치","binding-path-invalid":"바인딩 경로 유효하지 않음"}[e]||e}clearFormBindingIssues(){this.formBindingIssues=[],this.formBindingValidations=[],this.formBindingIssueIdCounter=0}trackComputedProperty(e,n,a,i,o,d,g){if(!this.config.enabled)return;const h=`computed-${e}-${d||"global"}`,f={id:h,name:e,expression:n,componentId:d,dependencies:a,currentValue:this.safeClone(i),lastComputedAt:Date.now(),computationTime:o,error:g};this.computedProperties.set(h,f)}trackComputedRecalc(e,n,a,i,o,d,g){if(!this.config.enabled)return;const h=`computed-${e}-${g||"global"}`,f=JSON.stringify(a)!==JSON.stringify(i),p={id:`recalc-${++this.computedRecalcIdCounter}`,computedId:h,computedName:e,timestamp:Date.now(),trigger:n,triggeredBy:d,previousValue:this.safeClone(a),newValue:this.safeClone(i),valueChanged:f,computationTime:o,cascadeCount:0};this.computedRecalcLogs.push(p),this.computedRecalcLogs.length>this.maxComputedRecalcLogs&&this.computedRecalcLogs.shift();const x=this.computedProperties.get(h);x&&(x.currentValue=this.safeClone(i),x.lastComputedAt=Date.now(),x.computationTime=o)}analyzeComputedDependencyChain(e,n){const a=new Set,i=[];let o=!1,d,g=0;const h=(p,x)=>{if(g=Math.max(g,x),a.has(p))return o=!0,d=[...i,p],{name:p,type:"computed",children:[],depth:x};a.add(p),i.push(p);const y=this.computedProperties.get(`computed-${p}-${n||"global"}`),w=[];if(y)for(const v of y.dependencies)v.type==="computed"?w.push(h(v.path,x+1)):w.push({name:v.path,type:v.type,children:[],depth:x+1});return i.pop(),a.delete(p),{name:p,type:"computed",children:w,depth:x}},f=h(e,0);return{root:e,tree:f,hasCycle:o,cyclePath:d,maxDepth:g}}getComputedDependencyTrackingInfo(){const e=Array.from(this.computedProperties.values()),n=this.getComputedDependencyStats(),a=[];for(const i of e){const o=this.analyzeComputedDependencyChain(i.name,i.componentId);a.push(o)}return{properties:e,recalcLogs:[...this.computedRecalcLogs],dependencyChains:a,stats:n,timestamp:Date.now()}}getComputedDependencyStats(){const e={"state-change":0,"datasource-update":0,"dependency-change":0,manual:0,initial:0},n={},a={};let i=0,o=0;for(const f of this.computedRecalcLogs)e[f.trigger]++,f.valueChanged||o++,n[f.computedName]=(n[f.computedName]||0)+1,a[f.computedName]||(a[f.computedName]=[]),a[f.computedName].push(f.computationTime),i+=f.computationTime;const d=Object.entries(n).sort((f,p)=>p[1]-f[1]).slice(0,5).map(([f,p])=>({name:f,count:p})),g=Object.entries(a).map(([f,p])=>({name:f,avgTime:p.reduce((x,y)=>x+y,0)/p.length})).sort((f,p)=>p.avgTime-f.avgTime).slice(0,5);let h=0;for(const f of this.computedProperties.values())this.analyzeComputedDependencyChain(f.name,f.componentId).hasCycle&&h++;return{totalComputed:this.computedProperties.size,totalRecalculations:this.computedRecalcLogs.length,unnecessaryRecalculations:o,avgComputationTime:this.computedRecalcLogs.length>0?i/this.computedRecalcLogs.length:0,topRecalculated:d,slowestComputed:g,cycleDetectionCount:h,byTrigger:e}}clearComputedTracking(){this.computedProperties.clear(),this.computedRecalcLogs=[],this.computedRecalcIdCounter=0}trackModalOpen(e){if(!this.config.enabled)return;const n={modalId:e.modalId,modalName:e.modalName,openedAt:Date.now(),closedAt:null,scopeType:e.scopeType||"isolated",parentModalId:e.parentModalId,componentId:e.componentId,initialState:e.initialState?{...e.initialState}:{},currentState:e.initialState?{...e.initialState}:{},stateChangeCount:0,isolatedStateKeys:e.isolatedStateKeys||[],sharedStateKeys:e.sharedStateKeys||[]};this.modalStates.set(e.modalId,n),this.validateModalDefinitionExists(e.modalId,e.modalName),e.parentModalId&&(this.modalStateRelations.find(i=>i.parentModalId===e.parentModalId&&i.childModalId===e.modalId)||this.modalStateRelations.push({parentModalId:e.parentModalId,childModalId:e.modalId,sharedKeys:e.sharedStateKeys||[],isolatedKeys:e.isolatedStateKeys||[],relationType:"parent-child"}))}trackModalClose(e,n){if(!this.config.enabled)return;const a=this.modalStates.get(e);a&&(a.closedAt=Date.now(),n&&(a.currentState={...n}),this.detectStateLeakage(a))}validateModalDefinitionExists(e,n){const a=this.currentLayout;if(!a?.layoutJson)return;const i=a.layoutJson.modals;if(!i){this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:n,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 현재 레이아웃에 modals 섹션이 없습니다. 레이아웃 경로: ${a.layoutPath}`,affectedStateKeys:[],expectedValue:`modals 섹션에 id="${e}" 정의 존재`,actualValue:"modals 섹션 없음"});return}const o=Array.isArray(i)?i:Object.values(i);o.some(g=>g?.id===e||g?.props?.id===e)||this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:n,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 렌더링된 레이아웃의 modals 섹션에 해당 ID의 정의가 없습니다. partial 로딩 실패, 레이아웃 병합 문제, extends 상속 누락 등을 확인하세요. 레이아웃 경로: ${a.layoutPath}`,affectedStateKeys:[],expectedValue:`modals 배열에 id="${e}" 항목 존재`,actualValue:`modals 배열에 ${o.length}개 모달 정의 (${o.map(g=>g?.id||"unknown").join(", ")})`})}trackModalStateChange(e){if(!this.config.enabled)return;const n=this.modalStates.get(e.modalId);if(!n)return;n.stateChangeCount++,n.currentState[e.stateKey]=e.newValue;const a=this.checkIsolationViolation(n,e.stateKey),i={id:`modal-change-${++this.modalStateChangeLogIdCounter}`,modalId:e.modalId,modalName:n.modalName,timestamp:Date.now(),stateKey:e.stateKey,previousValue:e.previousValue,newValue:e.newValue,changeSource:e.changeSource||"user-action",violatesIsolation:a};this.modalStateChangeLogs.push(i),this.modalStateChangeLogs.length>this.maxModalStateChangeLogs&&this.modalStateChangeLogs.shift(),a&&this.recordModalStateIssue({type:"isolation-violation",modalId:e.modalId,modalName:n.modalName,severity:"warning",description:`모달 '${n.modalName}'에서 격리된 상태 키 '${e.stateKey}'가 변경됨`,affectedStateKeys:[e.stateKey]})}detectStateLeakage(e){if(e.scopeType==="isolated")for(const n of e.isolatedStateKeys){const a=e.initialState[n],i=e.currentState[n];if(a!==i&&e.parentModalId){const o=this.modalStates.get(e.parentModalId);o&&o.currentState.hasOwnProperty(n)&&this.recordModalStateIssue({type:"state-leakage",modalId:e.modalId,modalName:e.modalName,severity:"error",description:`모달 닫힘 후 상태 '${n}'가 부모 모달로 유출될 수 있음`,affectedStateKeys:[n],leakedValue:i,expectedValue:a})}}}checkIsolationViolation(e,n){return e.scopeType==="isolated",!1}recordModalStateIssue(e){const n={id:`modal-issue-${++this.modalStateIssueIdCounter}`,type:e.type,modalId:e.modalId,modalName:e.modalName,timestamp:Date.now(),severity:e.severity,description:e.description,affectedStateKeys:e.affectedStateKeys,leakedValue:e.leakedValue,expectedValue:e.expectedValue,actualValue:e.actualValue,stackInfo:e.stackInfo};this.modalStateIssues.push(n),this.modalStateIssues.length>this.maxModalStateIssues&&this.modalStateIssues.shift()}getModalStateScopeTrackingInfo(){const e=Array.from(this.modalStates.values()),n=this.getModalStateScopeStats();return{modals:e,issues:[...this.modalStateIssues],relations:[...this.modalStateRelations],changeLogs:[...this.modalStateChangeLogs],stats:n,timestamp:Date.now()}}getModalStateScopeStats(){const e=Array.from(this.modalStates.values()),n={warning:0,error:0},a={"state-leakage":0,"isolation-violation":0,"parent-mutation":0,"orphaned-state":0,"scope-mismatch":0,"cleanup-failure":0,"missing-definition":0};for(const o of this.modalStateIssues)n[o.severity]++,a[o.type]++;const i={isolated:0,shared:0,inherited:0};for(const o of e)i[o.scopeType]++;return{totalModals:e.length,openModals:e.filter(o=>o.closedAt===null).length,nestedModals:e.filter(o=>o.parentModalId!==void 0).length,totalIssues:this.modalStateIssues.length,issuesBySeverity:n,issuesByType:a,byScope:i,leakageDetectionCount:a["state-leakage"],cleanupFailureCount:a["cleanup-failure"]}}clearModalStateScopeTracking(){this.modalStates.clear(),this.modalStateIssues=[],this.modalStateRelations=[],this.modalStateChangeLogs=[],this.modalStateIssueIdCounter=0,this.modalStateChangeLogIdCounter=0}setNamedActionDefinitions(e){this.config.enabled&&(this.namedActionDefinitions=e||{})}trackNamedActionRef(e){if(!this.config.enabled)return;const n={...e,id:`named_action_ref_${++this.namedActionRefIdCounter}`};this.namedActionRefLogs.push(n),this.namedActionRefLogs.length>this.maxNamedActionRefLogs&&(this.namedActionRefLogs=this.namedActionRefLogs.slice(-this.maxNamedActionRefLogs))}getNamedActionTrackingInfo(){const e={};for(const a of this.namedActionRefLogs)e[a.actionRefName]=(e[a.actionRefName]||0)+1;const n=Object.keys(this.namedActionDefinitions).filter(a=>!e[a]);return{definitions:this.namedActionDefinitions,refLogs:[...this.namedActionRefLogs],stats:{totalDefinitions:Object.keys(this.namedActionDefinitions).length,totalRefs:this.namedActionRefLogs.length,refCountByName:e,unusedDefinitions:n},timestamp:Date.now()}}clearNamedActionTracking(){this.namedActionDefinitions={},this.namedActionRefLogs=[],this.namedActionRefIdCounter=0}trackExpressionEval(e){if(!this.config.enabled)return;const n={...e,id:`expr-${++this.expressionIdCounter}`,timestamp:Date.now(),warning:this.detectExpressionWarning(e)};this.expressionHistory.push(n),this.expressionHistory.length>500&&this.expressionHistory.shift(),this.isProfiling&&this.profilingData.push({type:"binding",expression:e.expression,timestamp:performance.now(),duration:e.duration}),this.notifyExpressionWatchers(n)}detectExpressionWarning(e){const{expression:n,result:a,resultType:i,method:o,duration:d}=e;if(i==="undefined"&&!n.includes("??")&&!n.includes("||")&&/^[a-zA-Z_$][a-zA-Z0-9_$.]*$/.test(n.replace(/{{|}}/g,"").trim()))return{type:"undefined-result",message:"표현식 결과가 undefined입니다",suggestion:`데이터가 로드되었는지 확인하거나 fallback 값을 추가하세요: ${n} ?? ''`};if(i==="null")return{type:"null-result",message:"표현식 결과가 null입니다",suggestion:`nullish coalescing 연산자를 사용하세요: ${n} ?? ''`};if(o==="resolveBindings"&&i==="string"){const g=String(a);if(g.includes("[object Object]")||/^\[.*\]$/.test(g))return{type:"array-to-string",message:"배열/객체가 문자열로 변환되었습니다",suggestion:"evaluateExpression()을 사용하여 원본 타입을 유지하세요"}}if(o==="resolveBindings"&&i==="string"&&String(a).includes("[object Object]"))return{type:"object-to-string",message:"객체가 [object Object]로 변환되었습니다",suggestion:"evaluateExpression()을 사용하거나 특정 속성에 접근하세요"};if(i==="undefined"&&n.includes(".")&&!n.includes("?.")){const g=n.replace(/{{|}}/g,"").trim().split(".");if(g.length>=2)return{type:"missing-optional-chain",message:"Optional chaining(?.) 누락 가능성",suggestion:`안전한 접근을 위해 ?. 사용을 고려하세요: ${g.join("?.")}`}}if((n.includes("{{item.")||n.includes("{{index}}"))&&Array.from(this.iterations.values()).some(f=>f.itemVar!=="item"))return{type:"wrong-iteration-var",message:"'item'/'index' 대신 iteration에서 정의한 변수명을 사용해야 합니다",suggestion:"iteration의 item_var/index_var에 정의된 변수명을 확인하세요"};if(d&&d>10)return{type:"slow-evaluation",message:`표현식 평가에 ${d.toFixed(2)}ms 소요됨`,suggestion:"복잡한 표현식을 단순화하거나 computed 값으로 분리하세요"}}getExpressions(){return[...this.expressionHistory]}getExpressionWarnings(){return this.expressionHistory.filter(e=>e.warning!=null)}searchExpressions(e){const n=e.toLowerCase();return this.expressionHistory.filter(a=>a.expression.toLowerCase().includes(n)||a.componentName?.toLowerCase().includes(n)||a.propName?.toLowerCase().includes(n))}getExpressionStats(){const e=this.expressionHistory,n=new Set(e.map(h=>h.expression)),a=e.filter(h=>h.warning!=null),i=e.filter(h=>h.fromCache),o=e.filter(h=>h.duration!=null).map(h=>h.duration),d={};for(const h of e)d[h.resultType]=(d[h.resultType]||0)+1;const g={};for(const h of a)h.warning&&(g[h.warning.type]=(g[h.warning.type]||0)+1);return{totalEvaluations:e.length,uniqueExpressions:n.size,warningCount:a.length,cacheHitRate:e.length>0?i.length/e.length:0,averageDuration:o.length>0?o.reduce((h,f)=>h+f,0)/o.length:0,byType:d,byWarning:g}}clearExpressions(){this.expressionHistory=[],this.expressionIdCounter=0}watchExpressions(e){return this.expressionWatchers.add(e),()=>{this.expressionWatchers.delete(e)}}notifyExpressionWatchers(e){this.expressionWatchers.forEach(n=>{try{n(e)}catch(a){console.error("[G7DevTools] Expression watcher error:",a)}})}setLogLevel(e){this.config.logLevel=e}setMaxHistory(e){this.config.maxHistorySize=Math.max(10,Math.min(1e3,e))}setServerEndpoint(e){this.config.serverEndpoint=e}getConfig(){return{...this.config}}generateId(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}sanitizeObject(e,n=new WeakSet){if(e===null||typeof e!="object")return e;if(n.has(e))return"[Circular]";if(n.add(e),Array.isArray(e))return e.map(i=>this.sanitizeObject(i,n));const a={};for(const i of Object.keys(e))try{a[i]=this.sanitizeObject(e[i],n)}catch{a[i]="[Unable to serialize]"}return a}getNestedValue(e,n){if(!n)return e;const a=n.split(".");let i=e;for(const o of a){if(i==null)return;i=i[o]}return i}getLifecycleInfo(){return{mountedComponents:Array.from(this.mountedComponents.values()),orphanedListeners:this.getOrphanedListeners()}}getPerformanceInfo(){return{renderCounts:this.renderCounts,bindingEvalCount:this.bindingEvalCount,memoryWarnings:this.getMemoryWarnings()}}getNetworkInfo(){return{activeRequests:Array.from(this.activeRequests.values()),requestHistory:[...this.requestHistory],pendingDataSources:Array.from(this.pendingDataSources)}}getConditionalInfo(){return{ifConditions:Array.from(this.ifConditions.values()),iterations:Array.from(this.iterations.values())}}getFormInfo(){return Array.from(this.forms.values())}getWebSocketInfo(){return{connections:Array.from(this.wsConnections.values()),messageHistory:[...this.wsMessageHistory],connectionState:this.getWebSocketConnectionState()}}getStateAtTime(e){const n=[...this.stateHistory].reverse().find(a=>a.timestamp<=e);if(n)return{_global:n.next,_local:{}}}reset(){this.stateHistory=[],this.actionHistory=[],this.cacheStats={hits:0,misses:0,entries:0},this.cacheDecisions=[],this.cacheDecisionIdCounter=0,this.currentRenderCycleId=null,this.isInActionExecution=!1,this.isInIteration=!1,this.mountedComponents.clear(),this.eventListeners.clear(),this.renderCounts.clear(),this.bindingEvalCount=0,this.profilingData=[],this.activeRequests.clear(),this.requestHistory=[],this.pendingDataSources.clear(),this.wsConnections.clear(),this.wsMessageHistory=[],this.ifConditions.clear(),this.iterations.clear(),this.forms.clear(),this.expressionHistory=[],this.expressionIdCounter=0,this.dataSources.clear(),this.dataPathTransforms=[],this.nestedContexts=[],this.nestedContextIdCounter=0,this.formBindingIssues=[],this.formBindingValidations=[],this.formBindingIssueIdCounter=0,this.computedProperties.clear(),this.computedRecalcLogs=[],this.computedRecalcIdCounter=0,this.modalStates.clear(),this.modalStateIssues=[],this.modalStateRelations=[],this.modalStateChangeLogs=[],this.modalStateIssueIdCounter=0,this.modalStateChangeLogIdCounter=0,this.logHistory=[],this.logIdCounter=0}getExpressionInfo(){return{expressions:this.getExpressions(),stats:this.getExpressionStats()}}trackLog(e,n,a){if(!this.config.enabled)return;const i=a.map(d=>{if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d)}}).join(" "),o={id:`log-${++this.logIdCounter}`,level:e,prefix:n,message:i,args:this.sanitizeObject(a),timestamp:Date.now(),stack:e==="error"?new Error().stack:void 0};this.logHistory.push(o),this.logHistory.length>this.maxLogHistory&&this.logHistory.shift()}trackAction(e){if(!this.config.enabled)return;const n={id:`debounce-action-${++this.debounceActionIdCounter}`,...e,timestamp:Date.now()};this.debounceActionHistory.push(n),this.debounceActionHistory.length>100&&this.debounceActionHistory.shift()}trackDataSourceUpdate(e){if(!this.config.enabled)return;const n={id:`ds-update-${++this.dataSourceUpdateIdCounter}`,...e};this.dataSourceUpdateHistory.push(n),this.dataSourceUpdateHistory.length>100&&this.dataSourceUpdateHistory.shift()}getDebounceActionHistory(e){let n=[...this.debounceActionHistory];return e?.handler&&(n=n.filter(a=>a.handler.includes(e.handler))),e?.status&&(n=n.filter(a=>a.status===e.status)),e?.limit&&(n=n.slice(-e.limit)),n}getDataSourceUpdateHistory(e){let n=[...this.dataSourceUpdateHistory];return e?.dataSourceId&&(n=n.filter(a=>a.dataSourceId===e.dataSourceId)),e?.updateType&&(n=n.filter(a=>a.updateType===e.updateType)),e?.limit&&(n=n.slice(-e.limit)),n}getLogs(e){let n=[...this.logHistory];if(e?.level){const a=Array.isArray(e.level)?e.level:[e.level];n=n.filter(i=>a.includes(i.level))}if(e?.prefix){const a=e.prefix.toLowerCase();n=n.filter(i=>i.prefix.toLowerCase().includes(a))}if(e?.search){const a=e.search.toLowerCase();n=n.filter(i=>i.message.toLowerCase().includes(a))}return e?.since&&(n=n.filter(a=>a.timestamp>=e.since)),e?.limit&&(n=n.slice(-e.limit)),n}getLogStats(){const n=Date.now()-6e4,a={log:0,warn:0,error:0,debug:0,info:0},i={};let o=0,d=0;for(const g of this.logHistory)a[g.level]++,i[g.prefix]=(i[g.prefix]||0)+1,g.timestamp>=n&&(g.level==="error"&&o++,g.level==="warn"&&d++);return{totalLogs:this.logHistory.length,byLevel:a,byPrefix:i,recentErrors:o,recentWarnings:d}}clearLogs(){this.logHistory=[],this.logIdCounter=0}getLogInfo(){return{entries:this.getLogs(),stats:this.getLogStats()}}trackDataSourceDefinition(e){this.config.enabled&&this.dataSources.set(e.id,{...e,status:"idle"})}trackDataSourceLoading(e){if(!this.config.enabled)return;const n=this.dataSources.get(e);n&&this.dataSources.set(e,{...n,status:"loading"})}trackDataSourceLoaded(e,n,a){if(!this.config.enabled)return;const i=this.dataSources.get(e);if(!i)return;let o,d,g=a;n&&(Array.isArray(n)?(o=n.length,d=n.length>0&&typeof n[0]=="object"?Object.keys(n[0]):void 0):typeof n=="object"&&(Array.isArray(n.data)?(g=g||"data",o=n.data.length,d=n.data.length>0&&typeof n.data[0]=="object"?Object.keys(n.data[0]):void 0):Array.isArray(n.items)?(g=g||"items",o=n.items.length,d=n.items.length>0&&typeof n.items[0]=="object"?Object.keys(n.items[0]):void 0):d=Object.keys(n))),this.dataSources.set(e,{...i,status:"loaded",dataPath:g,itemCount:o,keys:d,lastLoadedAt:Date.now(),error:void 0})}trackDataSourceError(e,n){if(!this.config.enabled)return;const a=this.dataSources.get(e);a&&this.dataSources.set(e,{...a,status:"error",error:n,lastLoadedAt:Date.now()})}untrackDataSource(e){this.dataSources.delete(e)}getDataSources(){return Array.from(this.dataSources.values())}getDataSource(e){return this.dataSources.get(e)}clearDataSources(){this.dataSources.clear()}trackDataPathTransform(e){if(!this.config.enabled)return;let n=this.dataPathTransforms.find(a=>a.dataSourceId===e.dataSourceId);n||(n={dataSourceId:e.dataSourceId,timestamp:Date.now(),transformSteps:[],warnings:[]},this.dataPathTransforms.push(n),this.dataPathTransforms.length>this.maxDataPathTransforms&&this.dataPathTransforms.shift()),n.transformSteps.push({step:e.step,inputPath:e.inputPath,inputValue:this.safeClone(e.inputValue),outputPath:e.outputPath,outputValue:this.safeClone(e.outputValue),config:e.config}),e.warning&&n.warnings.push(e.warning)}setDataPathFinalBinding(e,n){if(!this.config.enabled)return;const a=this.dataPathTransforms.find(i=>i.dataSourceId===e);a&&(a.finalBinding={expression:n.expression,resolvedPath:n.resolvedPath,value:this.safeClone(n.value)})}getDataPathTransformTrackingInfo(){const e=this.getDataPathTransformStats();return{transforms:[...this.dataPathTransforms],stats:e,timestamp:Date.now()}}getDataPathTransformStats(){const e=this.dataPathTransforms,n={};let a=0;const i={};for(const d of e){n[d.dataSourceId]=(n[d.dataSourceId]||0)+1,a+=d.warnings.length;for(const g of d.warnings)i[g]=(i[g]||0)+1}const o=Object.entries(i).map(([d,g])=>({warning:d,count:g})).sort((d,g)=>g.count-d.count).slice(0,10);return{totalTransforms:e.length,byDataSource:n,warningsCount:a,commonWarnings:o}}getDataPathTransformForDataSource(e){return this.dataPathTransforms.find(n=>n.dataSourceId===e)}clearDataPathTransforms(){this.dataPathTransforms=[]}trackNestedContext(e){if(!this.config.enabled)return"";const n=`nested-${++this.nestedContextIdCounter}`,a=[...new Set([...e.parentContext.available,...e.ownContext.added])],i={...e.parentContext.values,...e.ownContext.values},o={id:n,timestamp:Date.now(),componentId:e.componentId,componentType:e.componentType,parentContext:{available:e.parentContext.available,values:this.safeClone(e.parentContext.values)},ownContext:{added:e.ownContext.added,values:this.safeClone(e.ownContext.values)},mergedContext:{all:a,values:this.safeClone(i)},accessAttempts:[],depth:e.depth,parentId:e.parentId};return this.nestedContexts.push(o),this.nestedContexts.length>this.maxNestedContexts&&this.nestedContexts.shift(),n}trackNestedContextAccess(e,n){if(!this.config.enabled)return;const a=this.nestedContexts.find(i=>i.id===e);a&&a.accessAttempts.push({path:n.path,found:n.found,value:n.found?this.safeClone(n.value):void 0,error:n.error})}getNestedContextTrackingInfo(){const e=this.getNestedContextStats();return{contexts:[...this.nestedContexts],stats:e,timestamp:Date.now()}}getNestedContextStats(){const e=this.nestedContexts,n={expandChildren:0,cellChildren:0,iteration:0,modal:0,slot:0};let a=0,i=0;const o={};for(const g of e){n[g.componentType]++,g.depth>a&&(a=g.depth);for(const h of g.accessAttempts)h.found||(i++,o[h.path]=(o[h.path]||0)+1)}const d=Object.entries(o).map(([g,h])=>({path:g,count:h})).sort((g,h)=>h.count-g.count).slice(0,10);return{totalContexts:e.length,byType:n,maxDepth:a,failedAccessCount:i,commonFailedPaths:d}}getNestedContextForComponent(e){return this.nestedContexts.find(n=>n.componentId===e)}clearNestedContexts(){this.nestedContexts=[],this.nestedContextIdCounter=0}trackHandlerRegistration(e,n="custom",a,i){this.isEnabled&&this.handlers.set(e,{name:e,category:n,description:a,registeredAt:Date.now(),source:i})}trackHandlerUnregistration(e){this.isEnabled&&this.handlers.delete(e)}getHandlers(){return Array.from(this.handlers.values())}getHandler(e){return this.handlers.get(e)}getHandlersByCategory(e){return Array.from(this.handlers.values()).filter(n=>n.category===e)}clearHandlers(){this.handlers.clear()}trackEventSubscribe(e){if(!this.isEnabled)return;const n=this.componentEventSubscriptions.get(e),a=Date.now();n?(n.subscriberCount++,n.lastSubscribedAt=a):this.componentEventSubscriptions.set(e,{eventName:e,subscriberCount:1,firstSubscribedAt:a,lastSubscribedAt:a})}trackEventUnsubscribe(e){if(!this.isEnabled)return;const n=this.componentEventSubscriptions.get(e);n&&(n.subscriberCount--,n.subscriberCount<=0&&this.componentEventSubscriptions.delete(e))}trackEventEmit(e,n,a,i,o){if(!this.isEnabled)return;const d={id:`evt_${++this.componentEventIdCounter}`,eventName:e,data:this.sanitizeForLogging(n),timestamp:Date.now(),listenerCount:a,results:i?this.sanitizeForLogging(i):void 0,hasError:!!o,errorMessage:o?.message};this.componentEventEmitHistory.push(d),this.componentEventEmitHistory.length>this.maxComponentEventHistory&&(this.componentEventEmitHistory=this.componentEventEmitHistory.slice(-this.maxComponentEventHistory))}trackEventOff(e){this.isEnabled&&this.componentEventSubscriptions.delete(e)}trackEventClear(){this.isEnabled&&this.componentEventSubscriptions.clear()}getComponentEventInfo(){const e=Array.from(this.componentEventSubscriptions.values());return{subscriptions:e,emitHistory:[...this.componentEventEmitHistory],totalSubscribers:e.reduce((n,a)=>n+a.subscriberCount,0),totalEmits:this.componentEventEmitHistory.length}}getEventEmitHistory(){return[...this.componentEventEmitHistory]}getEventSubscriptions(){return Array.from(this.componentEventSubscriptions.values())}clearComponentEvents(){this.componentEventSubscriptions.clear(),this.componentEventEmitHistory=[],this.componentEventIdCounter=0}sanitizeForLogging(e){if(e==null||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return"[Circular or Non-serializable]"}}startStateChange(e,n,a,i){if(!this.config.enabled)return"";const o=`setState_${++this.stateRenderingIdCounter}`;this.currentStateChangeContext={setStateId:o,startTime:performance.now(),changedPath:e,trigger:i||{},renderedComponents:[]};const d={id:`sr_${this.stateRenderingIdCounter}`,setStateId:o,statePath:e,oldValue:this.sanitizeForLogging(n),newValue:this.sanitizeForLogging(a),timestamp:Date.now(),triggeredBy:i||{},renderedComponents:[],totalRenderDuration:0,affectedBindingsCount:0};return this.stateRenderingLogs.push(d),this.stateRenderingLogs.length>this.maxStateRenderingLogs&&this.stateRenderingLogs.shift(),o}trackComponentRender(e,n,a,i=[],o=[],d){if(!this.config.enabled)return;const g=this.componentRenderCounts.get(n)||0;this.componentRenderCounts.set(n,g+1);for(const h of i)this.stateToComponentMap.has(h)||this.stateToComponentMap.set(h,new Set),this.stateToComponentMap.get(h).add(n);if(this.currentStateChangeContext){const h={componentId:e,componentName:n,renderDuration:a,accessedStatePaths:i,evaluatedBindings:o,renderOrder:this.currentStateChangeContext.renderedComponents.length,parentId:d};this.currentStateChangeContext.renderedComponents.push(h)}this.trackRender(n)}completeStateChange(e){if(!this.config.enabled||!this.currentStateChangeContext||this.currentStateChangeContext.setStateId!==e)return;const n=this.currentStateChangeContext,i=performance.now()-n.startTime,o=this.stateRenderingLogs.findIndex(d=>d.setStateId===e);if(o>=0){const d=this.stateRenderingLogs[o];d.renderedComponents=n.renderedComponents,d.totalRenderDuration=i,d.affectedBindingsCount=n.renderedComponents.reduce((g,h)=>g+h.evaluatedBindings.length,0)}this.currentStateChangeContext=null}getCurrentStateChangeContext(){return this.currentStateChangeContext}getStateRenderingLogs(){return[...this.stateRenderingLogs]}getStateRenderingInfo(){const e=this.stateRenderingLogs,n=Object.fromEntries(this.componentRenderCounts),a={};for(const[i,o]of this.stateToComponentMap)a[i]=Array.from(o);return{logs:e,componentRenderCounts:n,stateToComponentMap:a,stats:this.calculateStateRenderingStats()}}calculateStateRenderingStats(){const e=this.stateRenderingLogs;if(e.length===0)return{totalStateChanges:0,totalRenders:0,avgRenderDuration:0,avgComponentsPerChange:0,topRenderedComponents:[],topInfluentialPaths:[]};const n=e.reduce((g,h)=>g+h.renderedComponents.length,0),a=e.reduce((g,h)=>g+h.totalRenderDuration,0)/e.length,i=n/e.length,o=Array.from(this.componentRenderCounts.entries()).sort((g,h)=>h[1]-g[1]).slice(0,5).map(([g,h])=>({name:g,count:h})),d=Array.from(this.stateToComponentMap.entries()).sort((g,h)=>h[1].size-g[1].size).slice(0,5).map(([g,h])=>({path:g,affectedComponents:h.size}));return{totalStateChanges:e.length,totalRenders:n,avgRenderDuration:a,avgComponentsPerChange:i,topRenderedComponents:o,topInfluentialPaths:d}}getComponentsAffectedByState(e){const n=this.stateToComponentMap.get(e);return n?Array.from(n):[]}getComponentRenderHistory(e){return this.stateRenderingLogs.filter(n=>n.renderedComponents.some(a=>a.componentName===e))}clearStateRenderingLogs(){this.stateRenderingLogs=[],this.componentRenderCounts.clear(),this.stateToComponentMap.clear(),this.currentStateChangeContext=null,this.stateRenderingIdCounter=0}trackComponentStateSource(e,n,a,i){this.config.enabled&&this.componentStateSources.set(e,{componentId:e,componentName:n,stateSource:a,stateProvider:i})}trackDynamicState(e,n){this.config.enabled&&this.dynamicStates.set(e,n)}trackContextFlow(e,n,a,i,o,d){if(!this.config.enabled)return;const g={component:n,componentId:e,contextReceived:a,passedToChildren:i,usedInRender:o};if(this.contextFlowNodes.set(e,g),d){const h=this.contextFlowNodes.get(d);h&&(h.children||(h.children=[]),h.children.push(g))}}getStateHierarchyInfo(e=!0){const n=this.buildStateHierarchyLayers(),a=this.detectStateConflicts(n),i=Array.from(this.componentStateSources.values());return{layers:e?n.map(d=>({...d,values:this.summarizeValues(d.values,2)})):n,conflicts:a,componentStateSources:i,timestamp:Date.now()}}summarizeValues(e,n,a=0){if(e==null)return e;if(typeof e!="object")return typeof e=="string"&&e.length>100?e.substring(0,100)+`... (${e.length}자)`:e;if(a>=n){if(Array.isArray(e))return`[Array(${e.length})]`;const d=Object.keys(e);return`{${d.slice(0,5).join(", ")}${d.length>5?`, ... +${d.length-5}`:""}}`}if(Array.isArray(e))return e.length<=3?e.map(d=>this.summarizeValues(d,n,a+1)):{__type:"array",__length:e.length,__preview:e.slice(0,3).map(d=>this.summarizeValues(d,n,a+1))};const i={},o=Object.keys(e);for(const d of o)i[d]=this.summarizeValues(e[d],n,a+1);return i}buildStateHierarchyLayers(){const e=[];try{const a=window.G7Core?.state?.get?.();if(!a)return e;a._local&&e.push({name:"Global _local",type:"global",path:"_local",values:a._local,priority:1}),a._global&&e.push({name:"Global _global",type:"global",path:"_global",values:a._global,priority:1});for(const[o,d]of this.dynamicStates)d&&Object.keys(d).length>0&&e.push({name:`DynamicState (${o})`,type:"dynamicState",componentId:o,values:d,priority:2});const i=this.computeEffectiveState(a._local||{});e.push({name:"Effective _local (merged)",type:"effective",values:i,priority:3})}catch(n){console.warn("[G7DevTools] 상태 계층 빌드 실패:",n)}return e}computeEffectiveState(e){const n={...e};for(const[,a]of this.dynamicStates)a._local&&Object.assign(n,a._local);return n}detectStateConflicts(e){const n=[],a=e.find(o=>o.type==="global"&&o.path==="_local");if(!a)return n;const i=e.filter(o=>o.type==="dynamicState");for(const o of i){const d=o.values._local||o.values;for(const[g,h]of Object.entries(d)){const f=a.values[g];if(JSON.stringify(f)!==JSON.stringify(h)){const p=[],x=[];for(const y of this.componentStateSources.values())y.stateSource.local.some(v=>v===`_local.${g}`||v===g)&&(y.stateProvider.type==="dynamicState"?p.push(y.componentName):y.stateProvider.type==="globalState"&&x.push(y.componentName));n.push({path:`_local.${g}`,globalValue:f,dynamicStateValue:h,effectiveValue:h,usedBy:p,notUsedBy:x,severity:x.length>0?"warning":"info",description:x.length>0?`${x.join(", ")}은(는) globalState._local을 읽어 dynamicState 값을 사용하지 못함`:"dynamicState 값이 globalState와 다르지만 모든 컴포넌트가 dynamicState를 사용"})}}}return n}getContextFlowInfo(){const e=[],n=new Set(this.contextFlowNodes.keys());for(const a of this.contextFlowNodes.values())if(a.children)for(const i of a.children)n.delete(i.componentId);for(const a of n){const i=this.contextFlowNodes.get(a);i&&e.push(i)}return{rootComponent:e.length>0?e[0].component:"Unknown",contextFlow:e,timestamp:Date.now()}}clearStateHierarchyData(){this.componentStateSources.clear(),this.contextFlowNodes.clear(),this.dynamicStates.clear()}trackComponentStyle(e,n,a,i){if(!this.config.enabled)return;const o=this.analyzeTailwindClasses(a),d={componentId:e,componentName:n,classes:a,computedStyles:i,tailwindAnalysis:o};this.componentStyles.set(e,d),this.detectStyleIssues(d)}analyzeTailwindClasses(e){const n=[],a=[],i=[],o=[],d=["sm:","md:","lg:","xl:","2xl:"],g=[/bg-\w+-\d+/,/text-\w+-\d+/,/border-\w+-\d+/];for(const h of e){o.push(h),h.startsWith("dark:")&&n.push(h);for(const f of d)if(h.startsWith(f)){a.push(h);break}for(const f of g)if(f.test(h)){i.push(h);break}}return{usedClasses:o,darkClasses:n,responsiveClasses:a,dynamicClasses:i}}detectStyleIssues(e){const{componentId:n,componentName:a,computedStyles:i,tailwindAnalysis:o}=e;(i.opacity==="0"||i.visibility==="hidden"||i.display==="none"||i.width==="0px"&&i.height==="0px")&&this.addStyleIssue({id:this.generateId(),type:"invisible-element",componentId:n,componentName:a,property:i.opacity==="0"?"opacity":i.visibility==="hidden"?"visibility":i.display==="none"?"display":"width/height",currentValue:i.opacity==="0"?"0":i.visibility==="hidden"?"hidden":i.display==="none"?"none":"0px",severity:"warning",description:"요소가 화면에 보이지 않습니다.",suggestion:"opacity, visibility, display, width/height 값을 확인하세요."});const d=o.usedClasses.filter(h=>h.startsWith("bg-")&&!h.startsWith("dark:")),g=o.darkClasses.filter(h=>h.includes("bg-"));d.length>0&&g.length===0&&this.addStyleIssue({id:this.generateId(),type:"dark-mode-missing",componentId:n,componentName:a,property:"background-color",currentValue:d.join(", "),expectedValue:"dark:bg-* 클래스 필요",severity:"info",description:"다크 모드 배경색 클래스가 누락되었습니다.",suggestion:`${d[0]}에 대응하는 dark: 클래스를 추가하세요.`}),o.dynamicClasses.length>0&&this.addStyleIssue({id:this.generateId(),type:"tailwind-purging",componentId:n,componentName:a,property:"class",currentValue:o.dynamicClasses.join(", "),severity:"info",description:"동적으로 생성된 Tailwind 클래스가 있습니다.",suggestion:"tailwind.config.js의 safelist에 추가하거나 전체 클래스명을 상수로 정의하세요."})}addStyleIssue(e){this.styleIssues.some(a=>a.componentId===e.componentId&&a.type===e.type&&a.property===e.property)||this.styleIssues.push(e)}getStyleValidationInfo(){const e=Array.from(this.componentStyles.values());return{issues:[...this.styleIssues],componentStyles:e,stats:{totalComponents:e.length,invisibleCount:this.styleIssues.filter(n=>n.type==="invisible-element").length,tailwindIssueCount:this.styleIssues.filter(n=>n.type==="tailwind-purging").length,darkModeIssueCount:this.styleIssues.filter(n=>n.type==="dark-mode-missing").length},timestamp:Date.now()}}clearStyleValidationData(){this.styleIssues=[],this.componentStyles.clear()}trackAuthEvent(e,n,a,i){if(!this.config.enabled)return;const o={id:`auth_${++this.authEventIdCounter}`,type:e,timestamp:Date.now(),success:n,error:a,details:i};this.authEvents.push(o),this.authEvents.length>this.maxAuthEventHistory&&(this.authEvents=this.authEvents.slice(-this.maxAuthEventHistory))}trackAuthHeader(e,n,a,i,o){if(!this.config.enabled)return;const d={url:e,hasAuthHeader:n,headerType:a,tokenValid:i??!1,responseStatus:o,timestamp:Date.now()};this.authHeaderHistory.push(d),this.authHeaderHistory.length>this.maxAuthEventHistory&&(this.authHeaderHistory=this.authHeaderHistory.slice(-this.maxAuthEventHistory)),o===401&&this.trackAuthEvent("api-unauthorized",!1,`401 Unauthorized: ${e}`,{url:e})}getAuthState(){try{const e=window.G7Core,n=e?.api;let a=e?.auth;!a&&e?.AuthManager?.getInstance&&(a=e.AuthManager.getInstance());const i=n?.getToken?.()||a?.getAccessToken?.()||localStorage.getItem("auth_token")||localStorage.getItem("access_token"),o=a?.getRefreshToken?.()||localStorage.getItem("refresh_token");let d="unknown",g=a?.getUser?.();if(g&&(d="AuthManager"),!g){const w=e?.state?.get?.();g=w?._global?.user||w?._global?.currentUser||w?.user||w?.currentUser,g&&(d="G7Core.state")}const h=a?.isAuthenticated?.()??!1;let f="memory";localStorage.getItem("auth_token")||localStorage.getItem("access_token")?f="localStorage":(sessionStorage.getItem("auth_token")||sessionStorage.getItem("access_token"))&&(f="sessionStorage");const p=!!i&&(!!g||h);let x;i&&typeof i=="string"&&i.length>20?x=`${i.substring(0,10)}...${i.substring(i.length-6)}`:i&&(x="***");const y=g?{id:g.id,email:g.email,name:g.name,roles:g.roles?.map(w=>typeof w=="string"?{name:w}:{id:w.id,name:w.name,guard_name:w.guard_name}),permissions:g.permissions?.map(w=>typeof w=="string"?{name:w}:{id:w.id,name:w.name,guard_name:w.guard_name}),avatar:g.avatar||g.profile_photo_url||g.profile_image,created_at:g.created_at,updated_at:g.updated_at,last_login_at:g.last_login_at,email_verified_at:g.email_verified_at,...g.phone&&{phone:g.phone},...g.nickname&&{nickname:g.nickname},...g.status&&{status:g.status},...g.locale&&{locale:g.locale}}:void 0;return{isAuthenticated:p,user:y,tokens:{hasAccessToken:!!i,hasRefreshToken:!!o,storage:f,accessTokenPreview:x},lastActivity:Date.now(),source:d}}catch{return{isAuthenticated:!1,tokens:{hasAccessToken:!1,hasRefreshToken:!1,storage:"memory"},source:"unknown"}}}getAuthDebugInfo(){const e=[...this.authEvents];return{state:this.getAuthState(),events:e,headerAnalysis:[...this.authHeaderHistory],stats:{loginAttempts:e.filter(n=>n.type==="login").length,successfulLogins:e.filter(n=>n.type==="login"&&n.success).length,failedLogins:e.filter(n=>n.type==="login"&&!n.success).length,tokenRefreshes:e.filter(n=>n.type==="token-refresh").length,unauthorizedResponses:e.filter(n=>n.type==="api-unauthorized").length},timestamp:Date.now()}}clearAuthData(){this.authEvents=[],this.authHeaderHistory=[],this.authEventIdCounter=0}trackLayoutLoad(e,n,a,i="api"){if(!this.config.enabled)return;const o=Date.now();this.currentLayout={layoutPath:e,templateId:n,layoutJson:this.sanitizeObject(a),loadedAt:o,version:a.version,layoutName:a.layout_name,source:i};const d={id:`layout-${++this.layoutIdCounter}`,layoutPath:e,templateId:n,loadedAt:o,source:i,version:a.version};this.layoutHistory.push(d),this.layoutHistory.length>this.maxLayoutHistory&&this.layoutHistory.shift(),this.layoutStats.totalLoads++,i==="cache"?this.layoutStats.cacheHits++:this.layoutStats.apiLoads++}getCurrentLayout(){return this.currentLayout}getLayoutHistory(){return[...this.layoutHistory]}getLayoutDebugInfo(){return{current:this.currentLayout,history:[...this.layoutHistory],stats:{...this.layoutStats}}}clearLayoutData(){this.currentLayout=null,this.layoutHistory=[],this.layoutIdCounter=0,this.layoutStats={totalLoads:0,cacheHits:0,apiLoads:0}}startHandlerExecution(e){if(!this.config.enabled)return"";const n=`exec_${++this.executionIdCounter}_${Date.now()}`,a={handlerName:e,executionId:n,startTime:Date.now(),stateChanges:[],dataSourceChanges:[],alerts:[]};if(this.executionDetails.set(n,a),this.executionDetails.size>this.maxExecutionDetails){const i=Array.from(this.executionDetails.keys());i.slice(0,i.length-this.maxExecutionDetails).forEach(d=>this.executionDetails.delete(d))}return n}endHandlerExecution(e,n,a,i){if(!this.config.enabled||!e)return;const o=this.executionDetails.get(e);if(!o)return;o.endTime=Date.now(),o.duration=o.endTime-o.startTime,o.exitReason=n,o.exitLocation=a,o.exitDescription=i;const d=this.changeExpectations.get(e);d&&(o.expectedChanges=d,this.checkExpectations(e,o,d),this.changeExpectations.delete(e)),n==="normal"&&o.stateChanges.length===0&&o.dataSourceChanges.length===0&&this.addChangeAlert(e,{type:"no-state-change",severity:"warning",message:`핸들러 "${o.handlerName}"이(가) 상태 변경 없이 완료됨`,description:"핸들러가 성공적으로 완료되었지만 상태나 데이터소스 변경이 없습니다. 의도한 동작인지 확인하세요.",handlerName:o.handlerName,suggestion:'핸들러 내부 조건문을 확인하거나 DevTools의 "변경감지" 탭에서 exitLocation을 확인하세요.',docLink:".claude/docs/frontend/troubleshooting-state.md"}),(n==="early-return-condition"||n==="early-return-validation")&&this.addChangeAlert(e,{type:"early-return-detected",severity:"info",message:`핸들러 "${o.handlerName}"이(가) early return으로 종료됨`,description:i||`종료 위치: ${a||"알 수 없음"}`,handlerName:o.handlerName,suggestion:n==="early-return-validation"?"검증 실패로 인한 early return입니다. 입력 데이터를 확인하세요.":"조건부 early return입니다. 조건문의 평가 결과를 확인하세요."})}recordExitReason(e,n,a,i){if(!this.config.enabled||!e)return;const o=this.executionDetails.get(e);o&&(o.exitReason=n,o.exitLocation=a,o.exitDescription=i)}recordStateChange(e,n,a,i,o){if(!this.config.enabled)return;const d={id:`sc_${++this.stateChangeIdCounter}`,path:n,changeType:a,oldValue:this.safeClone(i),newValue:this.safeClone(o),timestamp:Date.now(),comparison:this.compareValues(i,o),executionId:e};if(this.stateChangeHistory.push(d),e){const g=this.executionDetails.get(e);g&&g.stateChanges.push(d)}this.stateChangeHistory.length>this.maxStateChangeHistory&&this.stateChangeHistory.splice(0,this.stateChangeHistory.length-this.maxStateChangeHistory),d.comparison.isDeepEqual&&typeof i=="object"&&i!==null&&this.addChangeAlert(e||"",{type:"object-reference-same",severity:"warning",message:`상태 "${n}"가 변경되었으나 값이 동일함`,description:"객체 참조가 동일하거나 깊은 비교 결과 변경이 없습니다. 변경 감지가 실패할 수 있습니다.",handlerName:e&&this.executionDetails.get(e)?.handlerName||"unknown",statePath:n,suggestion:"불변성을 유지하여 새 객체를 생성하세요. 예: { ...oldObject, newField: value }",docLink:".claude/docs/frontend/troubleshooting-state.md#object-mutation"})}recordDataSourceChange(e,n,a,i,o){if(!this.config.enabled)return;const d={dataSourceId:n,changeType:a,timestamp:Date.now(),previousStatus:i,newStatus:o,executionId:e};if(this.dataSourceChangeHistory.push(d),e){const g=this.executionDetails.get(e);g&&g.dataSourceChanges.push(d)}this.dataSourceChangeHistory.length>this.maxStateChangeHistory&&this.dataSourceChangeHistory.splice(0,this.dataSourceChangeHistory.length-this.maxStateChangeHistory)}expectChange(e,n,a){if(!this.config.enabled||!e)return;const i=this.executionDetails.get(e);if(!i)return;const o={expectedStatePaths:n,expectedDataSources:a,setAt:Date.now(),source:i.handlerName};this.changeExpectations.set(e,o)}checkExpectations(e,n,a){const i=new Set(n.stateChanges.map(d=>d.path)),o=new Set(n.dataSourceChanges.map(d=>d.dataSourceId));for(const d of a.expectedStatePaths)i.has(d)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 상태 변경 "${d}"가 발생하지 않음`,description:`핸들러 "${n.handlerName}"이(가) "${d}" 변경을 예고했지만 실제로 변경되지 않았습니다.`,handlerName:n.handlerName,statePath:d,suggestion:"핸들러 내부 로직을 확인하세요. early return이나 조건부 분기로 인해 변경이 생략되었을 수 있습니다.",docLink:".claude/docs/frontend/troubleshooting-state.md"});for(const d of a.expectedDataSources)o.has(d)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 데이터소스 갱신 "${d}"가 발생하지 않음`,description:`핸들러 "${n.handlerName}"이(가) "${d}" 갱신을 예고했지만 실제로 갱신되지 않았습니다.`,handlerName:n.handlerName,dataSourceId:d,suggestion:"refetchDataSource 호출이 실행되었는지 확인하세요.",docLink:".claude/docs/frontend/data-sources.md"})}addChangeAlert(e,n){const a={...n,id:`alert_${++this.alertIdCounter}`,timestamp:Date.now()};if(this.changeAlerts.push(a),e){const i=this.executionDetails.get(e);i&&i.alerts.push(a)}this.changeAlerts.length>this.maxChangeAlerts&&this.changeAlerts.splice(0,this.changeAlerts.length-this.maxChangeAlerts)}compareValues(e,n){const a=this.getValueType(e),i=this.getValueType(n),o=a!==i;let d=!1,g;return!o&&(a==="object"||a==="array")?(d=this.deepEqual(e,n),!d&&a==="object"&&(g=this.getChangedKeys(e,n))):d=e===n,{typeChanged:o,oldType:a,newType:i,isDeepEqual:d,changedKeys:g}}getValueType(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}deepEqual(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(e===null||n===null||typeof e!="object")return e===n;if(Array.isArray(e)!==Array.isArray(n))return!1;const a=Object.keys(e),i=Object.keys(n);if(a.length!==i.length)return!1;for(const o of a)if(!i.includes(o)||!this.deepEqual(e[o],n[o]))return!1;return!0}getChangedKeys(e,n){const a=[],i=new Set([...Object.keys(e),...Object.keys(n)]);for(const o of i)this.deepEqual(e[o],n[o])||a.push(o);return a}getChangeDetectionInfo(){const e=Array.from(this.executionDetails.values()),n={totalExecutions:e.length,executionsWithStateChange:e.filter(a=>a.stateChanges.length>0).length,executionsWithoutStateChange:e.filter(a=>a.stateChanges.length===0&&a.exitReason==="normal").length,earlyReturnCount:e.filter(a=>a.exitReason==="early-return-condition"||a.exitReason==="early-return-validation").length,alertCount:this.changeAlerts.length,alertsByType:this.getAlertsByType()};return{executionDetails:e,stateChangeHistory:[...this.stateChangeHistory],dataSourceChangeHistory:[...this.dataSourceChangeHistory],alerts:[...this.changeAlerts],stats:n,timestamp:Date.now()}}getAlertsByType(){const e={"no-state-change":0,"no-datasource-change":0,"expected-not-fulfilled":0,"object-reference-same":0,"early-return-detected":0,"async-timing-issue":0};for(const n of this.changeAlerts)e[n.type]++;return e}clearChangeDetectionData(){this.executionDetails.clear(),this.stateChangeHistory=[],this.dataSourceChangeHistory=[],this.changeAlerts=[],this.changeExpectations.clear(),this.executionIdCounter=0,this.stateChangeIdCounter=0,this.alertIdCounter=0}getRecentAlerts(e=10,n){let a=[...this.changeAlerts];return n&&(a=a.filter(i=>i.severity===n)),a.slice(-e)}getHandlerExecutions(e,n=10){return Array.from(this.executionDetails.values()).filter(i=>i.handlerName===e).slice(-n)}findExecutionInStack(e){return this.sequenceExecutionStack.find(n=>n.sequenceId===e)}startSequenceExecution(e){if(!this.config.enabled)return"";const n=`seq_${++this.sequenceIdCounter}_${Date.now()}`,a={sequenceId:n,startTime:Date.now(),totalDuration:0,trigger:e,actions:[],status:"running"};return this.sequenceExecutionStack.push(a),n}captureSequenceActionBefore(e,n,a,i,o){if(!this.config.enabled)return;const d=this.findExecutionInStack(e);if(!d)return;const g={index:n,handler:a,params:this.safeClone(i),stateBeforeAction:{_global:this.safeClone(o._global),_local:this.safeClone(o._local),_isolated:o._isolated?this.safeClone(o._isolated):void 0},stateAfterAction:{_global:{},_local:{}},duration:0,status:"success"};d.actions.push(g)}captureSequenceActionAfter(e,n,a,i,o,d){if(!this.config.enabled)return;const g=this.findExecutionInStack(e);if(!g)return;const h=g.actions.find(p=>p.index===n);if(!h)return;h.stateAfterAction={_global:this.safeClone(a._global),_local:this.safeClone(a._local),_isolated:a._isolated?this.safeClone(a._isolated):void 0},h.duration=i,h.result=this.safeClone(o),h.stateDiff={global:this.computeStateDiff(h.stateBeforeAction._global,h.stateAfterAction._global),local:this.computeStateDiff(h.stateBeforeAction._local,h.stateAfterAction._local)},h.stateBeforeAction._isolated&&h.stateAfterAction._isolated&&(h.stateDiff.isolated=this.computeStateDiff(h.stateBeforeAction._isolated,h.stateAfterAction._isolated));const f=window.__g7PendingLocalState;f&&(h.pendingState=this.safeClone(f)),d&&(h.status="error",h.error={name:d.name,message:d.message,stack:d.stack})}endSequenceExecution(e,n){if(!this.config.enabled)return;const a=this.sequenceExecutionStack.findIndex(o=>o.sequenceId===e);if(a===-1)return;const i=this.sequenceExecutionStack[a];if(i.endTime=Date.now(),i.totalDuration=i.endTime-i.startTime,n){i.status="error",i.error={name:n.name,message:n.message,stack:n.stack};const o=i.actions.find(d=>d.status==="error");o&&(i.failedAtIndex=o.index)}else i.status="success";this.sequenceExecutions.push(i),this.sequenceExecutions.length>this.maxSequenceExecutions&&this.sequenceExecutions.shift(),this.sequenceExecutionStack.splice(a,1)}computeStateDiff(e,n){const a=[],i=[],o=[],d=new Set(Object.keys(e)),g=new Set(Object.keys(n));for(const h of g)d.has(h)||a.push(h);for(const h of d)g.has(h)||i.push(h);for(const h of d)if(g.has(h)){const f=e[h],p=n[h];JSON.stringify(f)!==JSON.stringify(p)&&o.push({path:h,oldValue:f,newValue:p})}return{added:a,removed:i,changed:o}}getSequenceTrackingInfo(){const e=this.getSequenceStats(),n=this.sequenceExecutionStack.length>0?this.sequenceExecutionStack[this.sequenceExecutionStack.length-1]:void 0;return{executions:[...this.sequenceExecutions],currentExecution:n,stats:e}}getSequenceStats(){const e=this.sequenceExecutions,n=e.length,a=e.filter(f=>f.status==="success").length,i=e.filter(f=>f.status==="error").length,o=e.reduce((f,p)=>f+p.actions.length,0),d=n>0?e.reduce((f,p)=>f+p.totalDuration,0)/n:0,g={};for(const f of e)for(const p of f.actions)g[p.handler]=(g[p.handler]||0)+1;const h=Object.entries(g).sort(([,f],[,p])=>p-f).slice(0,5).map(([f,p])=>({handler:f,count:p}));return{totalExecutions:n,successCount:a,errorCount:i,totalActions:o,avgDuration:d,topHandlers:h}}clearSequenceData(){this.sequenceExecutions=[],this.sequenceExecutionStack=[],this.sequenceIdCounter=0}getSequenceExecution(e){const n=this.findExecutionInStack(e);return n||this.sequenceExecutions.find(a=>a.sequenceId===e)}getRecentSequences(e=10){return this.sequenceExecutions.slice(-e)}registerStateCaptureForHandler(e,n,a){if(!this.config.enabled)return;const i=new Map,o=Date.now();for(const d of n)i.set(d,{value:this.safeClone(a[d]),capturedAt:o});this.stateCaptureRegistry.set(e,i)}detectStaleClosure(e,n,a,i,o){if(!this.config.enabled)return[];const d=this.stateCaptureRegistry.get(e);if(!d)return[];const g=Date.now(),h=[];for(const[f,p]of d){const x=this.getValueByPath(a,f),y=g-p.capturedAt;if(!this.isDeepEqual(p.value,x)&&y>0){const w=this.createStaleClosureWarning(i,n,f,p.value,p.capturedAt,x,g,y,o);h.push(w),this.addStaleClosureWarning(w)}}return this.stateCaptureRegistry.delete(e),h}trackStaleClosureWarning(e){if(!this.config.enabled)return;const n=Date.now(),a=this.createStaleClosureWarning(e.type,e.location,e.capturedPath,e.capturedValue,e.capturedAt,e.currentValue,n,n-e.capturedAt,e.actionId,e.stackTrace);this.addStaleClosureWarning(a)}createStaleClosureWarning(e,n,a,i,o,d,g,h,f,p){const x=this.getStaleClosureSeverity(e,h),{description:y,suggestion:w,docLink:v}=this.getStaleClosureMessages(e,a,h);return{id:`stale_${++this.staleClosureIdCounter}_${Date.now()}`,timestamp:Date.now(),type:e,location:n,capturedState:{path:a,capturedValue:this.safeClone(i),capturedAt:o},currentState:{path:a,currentValue:this.safeClone(d),retrievedAt:g},timeDiff:h,severity:x,description:y,suggestion:w,docLink:v,actionId:f,stackTrace:p}}getStaleClosureSeverity(e,n){if(n>5e3)return"error";if(n>1e3)return"warning";switch(e){case"async-state-capture":case"sequence-state-mismatch":return"warning";case"callback-state-capture":case"timeout-state-capture":return"info";case"event-handler-stale":return"warning";default:return"info"}}getStaleClosureMessages(e,n,a){const i=a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`;switch(e){case"async-state-capture":return{description:`await 후 ${i} 경과 시점에 '${n}' 상태가 변경됨. 캡처된 상태 대신 최신 상태를 사용해야 함`,suggestion:"await 이후에는 G7Core.state.get()으로 최신 상태를 다시 조회하거나, useRef + getter 패턴을 사용하세요",docLink:"troubleshooting-state-closure.md"};case"callback-state-capture":return{description:`콜백에서 ${i} 전에 캡처된 '${n}' 상태를 사용 중. 최신 상태와 다름`,suggestion:"콜백에서 상태를 참조할 때는 stateRef.current 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};case"timeout-state-capture":return{description:`setTimeout/setInterval 콜백에서 '${n}' 상태가 ${i} 전 값 사용 중`,suggestion:"타이머 콜백 내에서는 G7Core.state.get()으로 최신 상태를 조회하세요",docLink:"troubleshooting-state-closure.md"};case"sequence-state-mismatch":return{description:`sequence 내 '${n}' 상태가 이전 액션 결과와 불일치. context.state 대신 캡처된 값 사용 의심`,suggestion:"sequence 내에서는 context.state 또는 $prev를 사용하여 최신 상태를 참조하세요",docLink:"troubleshooting-state-setstate.md"};case"event-handler-stale":return{description:`이벤트 핸들러에서 ${i} 전에 바인딩된 '${n}' 상태 사용 중`,suggestion:"이벤트 핸들러에서 상태를 참조할 때는 useRef 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};default:return{description:`'${n}' 상태에서 stale closure 감지됨 (${i} 경과)`,suggestion:"상태 참조 시 최신 값을 사용하는지 확인하세요"}}}addStaleClosureWarning(e){this.staleClosureWarnings.push(e),this.staleClosureWarnings.length>this.maxStaleClosureWarnings&&this.staleClosureWarnings.shift()}getValueByPath(e,n){const a=n.split(".");let i=e;for(const o of a){if(i==null)return;i=i[o]}return i}isDeepEqual(e,n){if(e===n)return!0;if(e===null||n===null)return e===n;if(typeof e!=typeof n)return!1;if(typeof e!="object")return e===n;try{return JSON.stringify(e)===JSON.stringify(n)}catch{return!1}}getStaleClosureTrackingInfo(){const e=this.getStaleClosureStats();return{warnings:[...this.staleClosureWarnings],stats:e,timestamp:Date.now()}}getStaleClosureStats(){const e=this.staleClosureWarnings,n={"async-state-capture":0,"callback-state-capture":0,"timeout-state-capture":0,"sequence-state-mismatch":0,"event-handler-stale":0};for(const h of e)n[h.type]++;const a={info:0,warning:0,error:0};for(const h of e)a[h.severity]++;const i={};for(const h of e)i[h.location]=(i[h.location]||0)+1;const o=Object.entries(i).sort(([,h],[,f])=>f-h).slice(0,5).map(([h,f])=>({location:h,count:f})),d={};for(const h of e)d[h.capturedState.path]=(d[h.capturedState.path]||0)+1;const g=Object.entries(d).sort(([,h],[,f])=>f-h).slice(0,5).map(([h,f])=>({path:h,count:f}));return{totalWarnings:e.length,warningsByType:n,warningsBySeverity:a,topLocations:o,topAffectedPaths:g}}clearStaleClosureData(){this.staleClosureWarnings=[],this.staleClosureIdCounter=0,this.stateCaptureRegistry.clear()}getRecentStaleClosureWarnings(e=10,n){let a=[...this.staleClosureWarnings];return n&&(a=a.filter(i=>i.severity===n)),a.slice(-e)}safeClone(e){if(e==null||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{if(Array.isArray(e))return e.map(a=>{try{return JSON.parse(JSON.stringify(a))}catch{return"[Unserializable]"}});const n={};for(const a of Object.keys(e))try{n[a]=JSON.parse(JSON.stringify(e[a]))}catch{n[a]="[Unserializable]"}return n}}};H(Er,"instance");let Ca=Er;const Kn=at("LayoutLoader");class Ms extends Error{constructor(e,n,a){super(e),this.code=n,this.details=a,this.name="LayoutLoaderError"}}class Rg{constructor(e){H(this,"componentRegistry");H(this,"currentLayout",null);H(this,"layoutCache",new Map);H(this,"cacheVersion",0);this.componentRegistry=e}setCacheVersion(e){this.cacheVersion!==e&&(Kn.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.layoutCache.clear())}getCacheVersion(){return this.cacheVersion}async loadLayout(e,n){const a=`${e}:${n}`;if(this.layoutCache.has(a)){Kn.log("Loading layout from cache:",n);const o=await this.layoutCache.get(a),d=JSON.parse(JSON.stringify(o));return this.currentLayout=d,Ca.getInstance().trackLayoutLoad(n,e,d,"cache"),d}const i=this.fetchLayout(e,n);return this.layoutCache.set(a,i),i}async fetchLayout(e,n,a=!1){try{let i;n.startsWith("__preview__/")?i=`/api/layouts/preview/${n.replace("__preview__/","")}.json`:i=`/api/layouts/${e}/${n}.json`;const o=this.cacheVersion>0?`${i}?v=${this.cacheVersion}`:i;Kn.log("Fetching layout from API:",o);const d=ns(),g=a?null:d.getToken(),h={Accept:"application/json"};g&&(h.Authorization=`Bearer ${g}`);const f=await fetch(o,{headers:h});let p;try{p=await f.json()}catch{p=null}if(!f.ok){if(f.status===401&&!a&&g)return Kn.log("Token invalid, removing and retrying without token"),d.removeToken(),this.fetchLayout(e,n,!0);const y=p?.message||p?.error;throw new Ms(`Failed to fetch layout: ${f.status} ${f.statusText}`,"FETCH_FAILED",{status:f.status,statusText:f.statusText,url:o,apiMessage:y})}const x=p.data||p;return this.validateLayoutData(x),this.currentLayout=x,Ca.getInstance().trackLayoutLoad(n,e,x,"api"),Kn.log("Layout fetched and cached successfully:",x.layout_name),x}catch(i){const o=`${e}:${n}`;throw this.layoutCache.delete(o),i instanceof Ms?i:new Ms("Failed to load layout","LOAD_FAILED",{originalError:i})}}prefetchLayout(e,n){return this.loadLayout(e,n)}validateLayoutData(e){if(!e.version)throw new Ms("Layout data missing required field: version","VALIDATION_FAILED",{field:"version"});if(!e.layout_name)throw new Ms("Layout data missing required field: layout_name","VALIDATION_FAILED",{field:"layout_name"});if(!Array.isArray(e.components))throw new Ms('Layout data field "components" must be an array',"VALIDATION_FAILED",{field:"components",value:e.components});Kn.log("Layout data validation passed")}renderLayout(e,n){try{const a=n||this.currentLayout;if(!a)throw new Ms("No layout data to render","NO_LAYOUT_DATA");Kn.log("Rendering layout:",a.layout_name),e.innerHTML="",this.renderComponents(e,a.components),Kn.log("Layout rendered successfully")}catch(a){Kn.error("Render error:",a),this.renderErrorState(e,a)}}renderComponents(e,n){for(const a of n){const i=this.renderComponent(a);i&&e.appendChild(i)}}renderComponent(e){try{if(!this.componentRegistry.getComponent(e.type))return Kn.warn(`Component not found: ${e.type}`),this.createPlaceholderElement(e.type);const a=document.createElement("div");return a.setAttribute("data-component",e.type),e.props&&Object.entries(e.props).forEach(([i,o])=>{a.setAttribute(`data-prop-${i}`,JSON.stringify(o))}),e.children&&e.children.length>0?this.renderComponents(a,e.children):e.text&&(a.textContent=e.text),a}catch(n){return Kn.error(`Error rendering component ${e.type}:`,n),this.createErrorElement(e.type,n)}}createPlaceholderElement(e){const n=document.createElement("div");return n.className="component-placeholder",n.setAttribute("data-component-type",e),n.innerHTML=`
<div style="padding: 1rem; border: 2px dashed #ccc; background: #f9f9f9; text-align: center;">
<p style="margin: 0; color: #666;">Component not found: <strong>${e}</strong></p>
</div>
`,n}createErrorElement(e,n){const a=document.createElement("div");return a.className="component-error",a.setAttribute("data-component-type",e),a.innerHTML=`
<div style="padding: 1rem; border: 2px solid #f44336; background: #ffebee; border-radius: 4px;">
<p style="margin: 0 0 0.5rem 0; color: #c62828; font-weight: bold;">Component Error: ${e}</p>
<p style="margin: 0; color: #666; font-size: 0.875rem;">${n?.message||"Unknown error"}</p>
</div>
`,a}renderErrorState(e,n){const a=n instanceof Error?n.message:String(n),i=n instanceof Ms?n.code:"UNKNOWN_ERROR";e.innerHTML=`
<div class="layout-error" data-error-code="${i}" style="
padding: 2rem;
text-align: center;
background: #ffebee;
border: 2px solid #f44336;
border-radius: 8px;
margin: 2rem auto;
max-width: 600px;
">
<h2 style="
margin: 0 0 1rem 0;
color: #c62828;
font-size: 1.5rem;
">레이아웃 로드 실패</h2>
<p style="
margin: 0 0 1rem 0;
color: #666;
font-size: 1rem;
">${a}</p>
<p style="
margin: 0;
color: #999;
font-size: 0.875rem;
">오류 코드: ${i}</p>
<button
onclick="window.location.reload()"
style="
margin-top: 1.5rem;
padding: 0.75rem 1.5rem;
background: #f44336;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
"
>페이지 새로고침</button>
</div>
`,Kn.error("Error state rendered:",i,a)}getCurrentLayout(){return this.currentLayout}clear(){this.currentLayout=null,this.layoutCache.clear(),Kn.log("Layout data and cache cleared")}}const kj=at("TranslationContext"),Hy=j.createContext(null),Dc=({children:r,translationEngine:e,translationContext:n})=>{const a=j.useMemo(()=>(o,d)=>{if(d){const g="|"+Object.entries(d).map(([h,f])=>`${h}=${f}`).join("|");return e.translate(o,n,g)}return e.translate(o,n)},[e,n]),i=j.useMemo(()=>({translationEngine:e,translationContext:n,t:a}),[e,n,a]);return l.jsx(Hy.Provider,{value:i,children:r})},Nj=()=>{const r=j.useContext(Hy);return r||(kj.warn("TranslationProvider 외부에서 호출되었습니다. 키를 그대로 반환합니다."),{t:e=>e,translationEngine:null,translationContext:null})},$s=at("SlotContext"),Ej={registerToSlot:()=>{$s.warn("SlotContext not available: registerToSlot called outside SlotProvider")},unregisterFromSlot:()=>{$s.warn("SlotContext not available: unregisterFromSlot called outside SlotProvider")},getSlotComponents:()=>[],subscribeToSlot:()=>()=>{},clearAllSlots:()=>{},isEnabled:!1},_j=j.createContext(Ej),Og=({children:r})=>{const e=j.useRef(new Map),n=j.useRef(new Map),a=j.useCallback(p=>{const x=n.current.get(p);x&&x.forEach(y=>{try{y()}catch(w){$s.error(`Slot subscriber error (slotId: ${p}):`,w)}})},[]),i=j.useCallback((p,x,y)=>{if(!p||!x){$s.warn("registerToSlot: slotId and componentId are required");return}e.current.has(p)||e.current.set(p,new Map);const w=e.current.get(p),v=w.get(x);v&&v.registrationKey===y.registrationKey||(w.set(x,y),$s.log(`Component registered to slot: ${x} -> ${p} (order: ${y.order})`),a(p))},[a]),o=j.useCallback((p,x)=>{const y=e.current.get(p);y&&y.has(x)&&(y.delete(x),$s.log(`Component unregistered from slot: ${x} <- ${p}`),y.size===0&&e.current.delete(p),a(p))},[a]),d=j.useCallback(p=>{const x=e.current.get(p);return x?Array.from(x.values()).sort((y,w)=>y.order-w.order):[]},[]),g=j.useCallback((p,x)=>{n.current.has(p)||n.current.set(p,new Set);const y=n.current.get(p);return y.add(x),()=>{y.delete(x),y.size===0&&n.current.delete(p)}},[]),h=j.useCallback(()=>{e.current.forEach((p,x)=>{a(x)}),e.current.clear(),n.current.clear(),$s.log("All slots cleared")},[a]),f=j.useMemo(()=>({registerToSlot:i,unregisterFromSlot:o,getSlotComponents:d,subscribeToSlot:g,clearAllSlots:h,isEnabled:!0}),[i,o,d,g,h]);return j.useLayoutEffect(()=>{typeof window<"u"&&(window.__slotContextValue=f,$s.log("SlotContext exposed to window.__slotContextValue"))},[f]),l.jsx(_j.Provider,{value:f,children:r})};class Lg{constructor(){this.notificationCreatedEvent=".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"}listenForWhisper(e,n){return this.listen(".client-"+e,n)}notification(e){return this.listen(this.notificationCreatedEvent,e)}stopListeningForNotification(e){return this.stopListening(this.notificationCreatedEvent,e)}stopListeningForWhisper(e,n){return this.stopListening(".client-"+e,n)}}class Py{constructor(e){this.namespace=e}format(e){return[".","\\"].includes(e.charAt(0))?e.substring(1):(this.namespace&&(e=this.namespace+"."+e),e.replace(/\./g,"\\"))}setNamespace(e){this.namespace=e}}function Tj(r){try{new r}catch(e){if(e instanceof Error&&e.message.includes("is not a constructor"))return!1}return!0}class Mg extends Lg{constructor(e,n,a){super(),this.name=n,this.pusher=e,this.options=a,this.eventFormatter=new Py(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(e,n){return this.on(this.eventFormatter.format(e),n),this}listenToAll(e){return this.subscription.bind_global((n,a)=>{if(n.startsWith("pusher:"))return;let i=String(this.options.namespace??"").replace(/\./g,"\\"),o=n.startsWith(i)?n.substring(i.length+1):"."+n;e(o,a)}),this}stopListening(e,n){return n?this.subscription.unbind(this.eventFormatter.format(e),n):this.subscription.unbind(this.eventFormatter.format(e)),this}stopListeningToAll(e){return e?this.subscription.unbind_global(e):this.subscription.unbind_global(),this}subscribed(e){return this.on("pusher:subscription_succeeded",()=>{e()}),this}error(e){return this.on("pusher:subscription_error",n=>{e(n)}),this}on(e,n){return this.subscription.bind(e,n),this}}class Uy extends Mg{whisper(e,n){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,n),this}}class Aj extends Mg{whisper(e,n){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,n),this}}class Dj extends Uy{here(e){return this.on("pusher:subscription_succeeded",n=>{e(Object.keys(n.members).map(a=>n.members[a]))}),this}joining(e){return this.on("pusher:member_added",n=>{e(n.info)}),this}whisper(e,n){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,n),this}leaving(e){return this.on("pusher:member_removed",n=>{e(n.info)}),this}}class By extends Lg{constructor(e,n,a){super(),this.events={},this.listeners={},this.name=n,this.socket=e,this.options=a,this.eventFormatter=new Py(this.options.namespace),this.subscribe()}subscribe(){this.socket.emit("subscribe",{channel:this.name,auth:this.options.auth||{}})}unsubscribe(){this.unbind(),this.socket.emit("unsubscribe",{channel:this.name,auth:this.options.auth||{}})}listen(e,n){return this.on(this.eventFormatter.format(e),n),this}stopListening(e,n){return this.unbindEvent(this.eventFormatter.format(e),n),this}subscribed(e){return this.on("connect",n=>{e(n)}),this}error(e){return this}on(e,n){return this.listeners[e]=this.listeners[e]||[],this.events[e]||(this.events[e]=(a,i)=>{this.name===a&&this.listeners[e]&&this.listeners[e].forEach(o=>o(i))},this.socket.on(e,this.events[e])),this.listeners[e].push(n),this}unbind(){Object.keys(this.events).forEach(e=>{this.unbindEvent(e)})}unbindEvent(e,n){this.listeners[e]=this.listeners[e]||[],n&&(this.listeners[e]=this.listeners[e].filter(a=>a!==n)),(!n||this.listeners[e].length===0)&&(this.events[e]&&(this.socket.removeListener(e,this.events[e]),delete this.events[e]),delete this.listeners[e])}}class qy extends By{whisper(e,n){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:n}),this}}class Rj extends qy{here(e){return this.on("presence:subscribed",n=>{e(n.map(a=>a.user_info))}),this}joining(e){return this.on("presence:joining",n=>e(n.user_info)),this}whisper(e,n){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:n}),this}leaving(e){return this.on("presence:leaving",n=>e(n.user_info)),this}}class Rc extends Lg{subscribe(){}unsubscribe(){}listen(e,n){return this}listenToAll(e){return this}stopListening(e,n){return this}subscribed(e){return this}error(e){return this}on(e,n){return this}}class Gy extends Rc{whisper(e,n){return this}}class Oj extends Rc{whisper(e,n){return this}}class Lj extends Gy{here(e){return this}joining(e){return this}whisper(e,n){return this}leaving(e){return this}}const Fy=class fS{constructor(e){this.setOptions(e),this.connect()}setOptions(e){this.options={...fS._defaultOptions,...e,broadcaster:e.broadcaster};let n=this.csrfToken();n&&(this.options.auth.headers["X-CSRF-TOKEN"]=n,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=n),n=this.options.bearerToken,n&&(this.options.auth.headers.Authorization="Bearer "+n,this.options.userAuthentication.headers.Authorization="Bearer "+n)}csrfToken(){var e,n;return typeof window<"u"&&(e=window.Laravel)!=null&&e.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<"u"&&typeof document.querySelector=="function"?((n=document.querySelector('meta[name="csrf-token"]'))==null?void 0:n.getAttribute("content"))??null:null}};Fy._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let $g=Fy;class Oc extends $g{constructor(){super(...arguments),this.channels={}}connect(){if(typeof this.options.client<"u")this.pusher=this.options.client;else if(this.options.Pusher)this.pusher=new this.options.Pusher(this.options.key,this.options);else if(typeof window<"u"&&typeof window.Pusher<"u")this.pusher=new window.Pusher(this.options.key,this.options);else throw new Error("Pusher client not found. Should be globally available or passed via options.client")}signin(){this.pusher.signin()}listen(e,n,a){return this.channel(e).listen(n,a)}channel(e){return this.channels[e]||(this.channels[e]=new Mg(this.pusher,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new Uy(this.pusher,"private-"+e,this.options)),this.channels["private-"+e]}encryptedPrivateChannel(e){return this.channels["private-encrypted-"+e]||(this.channels["private-encrypted-"+e]=new Aj(this.pusher,"private-encrypted-"+e,this.options)),this.channels["private-encrypted-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new Dj(this.pusher,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"private-encrypted-"+e,"presence-"+e].forEach(n=>{this.leaveChannel(n)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.pusher.connection.socket_id}disconnect(){this.pusher.disconnect()}}class Mj extends $g{constructor(){super(...arguments),this.channels={}}connect(){let e=this.getSocketIO();this.socket=e(this.options.host??void 0,this.options),this.socket.io.on("reconnect",()=>{Object.values(this.channels).forEach(n=>{n.subscribe()})})}getSocketIO(){if(typeof this.options.client<"u")return this.options.client;if(typeof window<"u"&&typeof window.io<"u")return window.io;throw new Error("Socket.io client not found. Should be globally available or passed via options.client")}listen(e,n,a){return this.channel(e).listen(n,a)}channel(e){return this.channels[e]||(this.channels[e]=new By(this.socket,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new qy(this.socket,"private-"+e,this.options)),this.channels["private-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new Rj(this.socket,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"presence-"+e].forEach(n=>{this.leaveChannel(n)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.socket.id}disconnect(){this.socket.disconnect()}}class Vy extends $g{constructor(){super(...arguments),this.channels={}}connect(){}listen(e,n,a){return new Rc}channel(e){return new Rc}privateChannel(e){return new Gy}encryptedPrivateChannel(e){return new Oj}presenceChannel(e){return new Lj}leave(e){}leaveChannel(e){}socketId(){return"fake-socket-id"}disconnect(){}}class $j{constructor(e){this.options=e,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}channel(e){return this.connector.channel(e)}connect(){if(this.options.broadcaster==="reverb")this.connector=new Oc({...this.options,cluster:""});else if(this.options.broadcaster==="pusher")this.connector=new Oc(this.options);else if(this.options.broadcaster==="ably")this.connector=new Oc({...this.options,cluster:"",broadcaster:"pusher"});else if(this.options.broadcaster==="socket.io")this.connector=new Mj(this.options);else if(this.options.broadcaster==="null")this.connector=new Vy(this.options);else if(typeof this.options.broadcaster=="function"&&Tj(this.options.broadcaster))this.connector=new this.options.broadcaster(this.options);else throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.`)}disconnect(){this.connector.disconnect()}join(e){return this.connector.presenceChannel(e)}leave(e){this.connector.leave(e)}leaveChannel(e){this.connector.leaveChannel(e)}leaveAllChannels(){for(const e in this.connector.channels)this.leaveChannel(e)}listen(e,n,a){return this.connector.listen(e,n,a)}private(e){return this.connector.privateChannel(e)}encryptedPrivate(e){if(this.connectorSupportsEncryptedPrivateChannels(this.connector))return this.connector.encryptedPrivateChannel(e);throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} does not support encrypted private channels.`)}connectorSupportsEncryptedPrivateChannels(e){return e instanceof Oc||e instanceof Vy}socketId(){return this.connector.socketId()}registerInterceptors(){typeof Vue<"u"&&Vue!=null&&Vue.http&&this.registerVueRequestInterceptor(),typeof axios=="function"&&this.registerAxiosRequestInterceptor(),typeof jQuery=="function"&&this.registerjQueryAjaxSetup(),typeof Turbo=="object"&&this.registerTurboRequestInterceptor()}registerVueRequestInterceptor(){Vue.http.interceptors.push((e,n)=>{this.socketId()&&e.headers.set("X-Socket-ID",this.socketId()),n()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(e=>(this.socketId()&&(e.headers["X-Socket-Id"]=this.socketId()),e))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((e,n,a)=>{this.socketId()&&a.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",e=>{e.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}var Ig={exports:{}};/*!
* Pusher JavaScript Library v8.4.0
* https://pusher.com/
*
* Copyright 2020, Pusher
* Released under the MIT licence.
*/var Ky;function Ij(){return Ky||(Ky=1,(function(r,e){(function(a,i){r.exports=i()})(window,function(){return(function(n){var a={};function i(o){if(a[o])return a[o].exports;var d=a[o]={i:o,l:!1,exports:{}};return n[o].call(d.exports,d,d.exports,i),d.l=!0,d.exports}return i.m=n,i.c=a,i.d=function(o,d,g){i.o(o,d)||Object.defineProperty(o,d,{enumerable:!0,get:g})},i.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,d){if(d&1&&(o=i(o)),d&8||d&4&&typeof o=="object"&&o&&o.__esModule)return o;var g=Object.create(null);if(i.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:o}),d&2&&typeof o!="string")for(var h in o)i.d(g,h,function(f){return o[f]}.bind(null,h));return g},i.n=function(o){var d=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(d,"a",d),d},i.o=function(o,d){return Object.prototype.hasOwnProperty.call(o,d)},i.p="",i(i.s=2)})([(function(n,a,i){var o=this&&this.__extends||(function(){var C=function(k,A){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,N){R.__proto__=N}||function(R,N){for(var D in N)N.hasOwnProperty(D)&&(R[D]=N[D])},C(k,A)};return function(k,A){C(k,A);function R(){this.constructor=k}k.prototype=A===null?Object.create(A):(R.prototype=A.prototype,new R)}})();Object.defineProperty(a,"__esModule",{value:!0});var d=256,g=(function(){function C(k){k===void 0&&(k="="),this._paddingCharacter=k}return C.prototype.encodedLength=function(k){return this._paddingCharacter?(k+2)/3*4|0:(k*8+5)/6|0},C.prototype.encode=function(k){for(var A="",R=0;R<k.length-2;R+=3){var N=k[R]<<16|k[R+1]<<8|k[R+2];A+=this._encodeByte(N>>>18&63),A+=this._encodeByte(N>>>12&63),A+=this._encodeByte(N>>>6&63),A+=this._encodeByte(N>>>0&63)}var D=k.length-R;if(D>0){var N=k[R]<<16|(D===2?k[R+1]<<8:0);A+=this._encodeByte(N>>>18&63),A+=this._encodeByte(N>>>12&63),D===2?A+=this._encodeByte(N>>>6&63):A+=this._paddingCharacter||"",A+=this._paddingCharacter||""}return A},C.prototype.maxDecodedLength=function(k){return this._paddingCharacter?k/4*3|0:(k*6+7)/8|0},C.prototype.decodedLength=function(k){return this.maxDecodedLength(k.length-this._getPaddingLength(k))},C.prototype.decode=function(k){if(k.length===0)return new Uint8Array(0);for(var A=this._getPaddingLength(k),R=k.length-A,N=new Uint8Array(this.maxDecodedLength(R)),D=0,M=0,L=0,z=0,Y=0,he=0,be=0;M<R-4;M+=4)z=this._decodeChar(k.charCodeAt(M+0)),Y=this._decodeChar(k.charCodeAt(M+1)),he=this._decodeChar(k.charCodeAt(M+2)),be=this._decodeChar(k.charCodeAt(M+3)),N[D++]=z<<2|Y>>>4,N[D++]=Y<<4|he>>>2,N[D++]=he<<6|be,L|=z&d,L|=Y&d,L|=he&d,L|=be&d;if(M<R-1&&(z=this._decodeChar(k.charCodeAt(M)),Y=this._decodeChar(k.charCodeAt(M+1)),N[D++]=z<<2|Y>>>4,L|=z&d,L|=Y&d),M<R-2&&(he=this._decodeChar(k.charCodeAt(M+2)),N[D++]=Y<<4|he>>>2,L|=he&d),M<R-3&&(be=this._decodeChar(k.charCodeAt(M+3)),N[D++]=he<<6|be,L|=be&d),L!==0)throw new Error("Base64Coder: incorrect characters for decoding");return N},C.prototype._encodeByte=function(k){var A=k;return A+=65,A+=25-k>>>8&6,A+=51-k>>>8&-75,A+=61-k>>>8&-15,A+=62-k>>>8&3,String.fromCharCode(A)},C.prototype._decodeChar=function(k){var A=d;return A+=(42-k&k-44)>>>8&-d+k-43+62,A+=(46-k&k-48)>>>8&-d+k-47+63,A+=(47-k&k-58)>>>8&-d+k-48+52,A+=(64-k&k-91)>>>8&-d+k-65+0,A+=(96-k&k-123)>>>8&-d+k-97+26,A},C.prototype._getPaddingLength=function(k){var A=0;if(this._paddingCharacter){for(var R=k.length-1;R>=0&&k[R]===this._paddingCharacter;R--)A++;if(k.length<4||A>2)throw new Error("Base64Coder: incorrect padding")}return A},C})();a.Coder=g;var h=new g;function f(C){return h.encode(C)}a.encode=f;function p(C){return h.decode(C)}a.decode=p;var x=(function(C){o(k,C);function k(){return C!==null&&C.apply(this,arguments)||this}return k.prototype._encodeByte=function(A){var R=A;return R+=65,R+=25-A>>>8&6,R+=51-A>>>8&-75,R+=61-A>>>8&-13,R+=62-A>>>8&49,String.fromCharCode(R)},k.prototype._decodeChar=function(A){var R=d;return R+=(44-A&A-46)>>>8&-d+A-45+62,R+=(94-A&A-96)>>>8&-d+A-95+63,R+=(47-A&A-58)>>>8&-d+A-48+52,R+=(64-A&A-91)>>>8&-d+A-65+0,R+=(96-A&A-123)>>>8&-d+A-97+26,R},k})(g);a.URLSafeCoder=x;var y=new x;function w(C){return y.encode(C)}a.encodeURLSafe=w;function v(C){return y.decode(C)}a.decodeURLSafe=v,a.encodedLength=function(C){return h.encodedLength(C)},a.maxDecodedLength=function(C){return h.maxDecodedLength(C)},a.decodedLength=function(C){return h.decodedLength(C)}}),(function(n,a,i){Object.defineProperty(a,"__esModule",{value:!0});var o="utf8: invalid string",d="utf8: invalid source encoding";function g(p){for(var x=new Uint8Array(h(p)),y=0,w=0;w<p.length;w++){var v=p.charCodeAt(w);v<128?x[y++]=v:v<2048?(x[y++]=192|v>>6,x[y++]=128|v&63):v<55296?(x[y++]=224|v>>12,x[y++]=128|v>>6&63,x[y++]=128|v&63):(w++,v=(v&1023)<<10,v|=p.charCodeAt(w)&1023,v+=65536,x[y++]=240|v>>18,x[y++]=128|v>>12&63,x[y++]=128|v>>6&63,x[y++]=128|v&63)}return x}a.encode=g;function h(p){for(var x=0,y=0;y<p.length;y++){var w=p.charCodeAt(y);if(w<128)x+=1;else if(w<2048)x+=2;else if(w<55296)x+=3;else if(w<=57343){if(y>=p.length-1)throw new Error(o);y++,x+=4}else throw new Error(o)}return x}a.encodedLength=h;function f(p){for(var x=[],y=0;y<p.length;y++){var w=p[y];if(w&128){var v=void 0;if(w<224){if(y>=p.length)throw new Error(d);var C=p[++y];if((C&192)!==128)throw new Error(d);w=(w&31)<<6|C&63,v=128}else if(w<240){if(y>=p.length-1)throw new Error(d);var C=p[++y],k=p[++y];if((C&192)!==128||(k&192)!==128)throw new Error(d);w=(w&15)<<12|(C&63)<<6|k&63,v=2048}else if(w<248){if(y>=p.length-2)throw new Error(d);var C=p[++y],k=p[++y],A=p[++y];if((C&192)!==128||(k&192)!==128||(A&192)!==128)throw new Error(d);w=(w&15)<<18|(C&63)<<12|(k&63)<<6|A&63,v=65536}else throw new Error(d);if(w<v||w>=55296&&w<=57343)throw new Error(d);if(w>=65536){if(w>1114111)throw new Error(d);w-=65536,x.push(String.fromCharCode(55296|w>>10)),w=56320|w&1023}}x.push(String.fromCharCode(w))}return x.join("")}a.decode=f}),(function(n,a,i){n.exports=i(3).default}),(function(n,a,i){i.r(a);class o{constructor(S,_){this.lastId=0,this.prefix=S,this.name=_}create(S){this.lastId++;var _=this.lastId,I=this.prefix+_,P=this.name+"["+_+"]",ue=!1,ke=function(){ue||(S.apply(null,arguments),ue=!0)};return this[_]=ke,{number:_,id:I,name:P,callback:ke}}remove(S){delete this[S.number]}}var d=new o("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},h=g;class f{constructor(S){this.options=S,this.receivers=S.receivers||d,this.loading={}}load(S,_,I){var P=this;if(P.loading[S]&&P.loading[S].length>0)P.loading[S].push(I);else{P.loading[S]=[I];var ue=Je.createScriptRequest(P.getPath(S,_)),ke=P.receivers.create(function(Ie){if(P.receivers.remove(ke),P.loading[S]){var Xe=P.loading[S];delete P.loading[S];for(var dt=function(Wt){Wt||ue.cleanup()},pt=0;pt<Xe.length;pt++)Xe[pt](Ie,dt)}});ue.send(ke)}}getRoot(S){var _,I=Je.getDocument().location.protocol;return S&&S.useTLS||I==="https:"?_=this.options.cdn_https:_=this.options.cdn_http,_.replace(/\/*$/,"")+"/"+this.options.version}getPath(S,_){return this.getRoot(_)+"/"+S+this.options.suffix+".js"}}var p=new o("_pusher_dependencies","Pusher.DependenciesReceivers"),x=new f({cdn_http:h.cdn_http,cdn_https:h.cdn_https,version:h.VERSION,suffix:h.dependency_suffix,receivers:p});const y={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var v={buildLogSuffix:function(T){const S="See:",_=y.urls[T];if(!_)return"";let I;return _.fullUrl?I=_.fullUrl:_.path&&(I=y.baseUrl+_.path),I?`${S} ${I}`:""}},C;(function(T){T.UserAuthentication="user-authentication",T.ChannelAuthorization="channel-authorization"})(C||(C={}));class k extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class L extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class z extends Error{constructor(S){super(S),Object.setPrototypeOf(this,new.target.prototype)}}class Y extends Error{constructor(S,_){super(_),this.status=S,Object.setPrototypeOf(this,new.target.prototype)}}var be=function(T,S,_,I,P){const ue=Je.createXHR();ue.open("POST",_.endpoint,!0),ue.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var ke in _.headers)ue.setRequestHeader(ke,_.headers[ke]);if(_.headersProvider!=null){let Ie=_.headersProvider();for(var ke in Ie)ue.setRequestHeader(ke,Ie[ke])}return ue.onreadystatechange=function(){if(ue.readyState===4)if(ue.status===200){let Ie,Xe=!1;try{Ie=JSON.parse(ue.responseText),Xe=!0}catch{P(new Y(200,`JSON returned from ${I.toString()} endpoint was invalid, yet status code was 200. Data was: ${ue.responseText}`),null)}Xe&&P(null,Ie)}else{let Ie="";switch(I){case C.UserAuthentication:Ie=v.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:Ie=`Clients must be authorized to join private or presence channels. ${v.buildLogSuffix("authorizationEndpoint")}`;break}P(new Y(ue.status,`Unable to retrieve auth string from ${I.toString()} endpoint - received status: ${ue.status} from ${_.endpoint}. ${Ie}`),null)}},ue.send(S),ue};function X(T){return F(je(T))}var ge=String.fromCharCode,xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",le=function(T){var S=T.charCodeAt(0);return S<128?T:S<2048?ge(192|S>>>6)+ge(128|S&63):ge(224|S>>>12&15)+ge(128|S>>>6&63)+ge(128|S&63)},je=function(T){return T.replace(/[^\x00-\x7F]/g,le)},J=function(T){var S=[0,2,1][T.length%3],_=T.charCodeAt(0)<<16|(T.length>1?T.charCodeAt(1):0)<<8|(T.length>2?T.charCodeAt(2):0),I=[xe.charAt(_>>>18),xe.charAt(_>>>12&63),S>=2?"=":xe.charAt(_>>>6&63),S>=1?"=":xe.charAt(_&63)];return I.join("")},F=window.btoa||function(T){return T.replace(/[\s\S]{1,3}/g,J)};class Q{constructor(S,_,I,P){this.clear=_,this.timer=S(()=>{this.timer&&(this.timer=P(this.timer))},I)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var pe=Q;function $(T){window.clearTimeout(T)}function U(T){window.clearInterval(T)}class q extends pe{constructor(S,_){super(setTimeout,$,S,function(I){return _(),null})}}class ie extends pe{constructor(S,_){super(setInterval,U,S,function(I){return _(),I})}}var se={now(){return Date.now?Date.now():new Date().valueOf()},defer(T){return new q(0,T)},method(T,...S){var _=Array.prototype.slice.call(arguments,1);return function(I){return I[T].apply(I,_.concat(arguments))}}},we=se;function Ee(T,...S){for(var _=0;_<S.length;_++){var I=S[_];for(var P in I)I[P]&&I[P].constructor&&I[P].constructor===Object?T[P]=Ee(T[P]||{},I[P]):T[P]=I[P]}return T}function Oe(){for(var T=["Pusher"],S=0;S<arguments.length;S++)typeof arguments[S]=="string"?T.push(arguments[S]):T.push(Ct(arguments[S]));return T.join(" : ")}function tt(T,S){var _=Array.prototype.indexOf;if(T===null)return-1;if(_&&T.indexOf===_)return T.indexOf(S);for(var I=0,P=T.length;I<P;I++)if(T[I]===S)return I;return-1}function Me(T,S){for(var _ in T)Object.prototype.hasOwnProperty.call(T,_)&&S(T[_],_,T)}function qe(T){var S=[];return Me(T,function(_,I){S.push(I)}),S}function zt(T){var S=[];return Me(T,function(_){S.push(_)}),S}function Et(T,S,_){for(var I=0;I<T.length;I++)S.call(_||window,T[I],I,T)}function $t(T,S){for(var _=[],I=0;I<T.length;I++)_.push(S(T[I],I,T,_));return _}function kt(T,S){var _={};return Me(T,function(I,P){_[P]=S(I)}),_}function tn(T,S){S=S||function(P){return!!P};for(var _=[],I=0;I<T.length;I++)S(T[I],I,T,_)&&_.push(T[I]);return _}function Vt(T,S){var _={};return Me(T,function(I,P){(S&&S(I,P,T,_)||I)&&(_[P]=I)}),_}function oa(T){var S=[];return Me(T,function(_,I){S.push([I,_])}),S}function Ce(T,S){for(var _=0;_<T.length;_++)if(S(T[_],_,T))return!0;return!1}function Ge(T,S){for(var _=0;_<T.length;_++)if(!S(T[_],_,T))return!1;return!0}function it(T){return kt(T,function(S){return typeof S=="object"&&(S=Ct(S)),encodeURIComponent(X(S.toString()))})}function ft(T){var S=Vt(T,function(I){return I!==void 0}),_=$t(oa(it(S)),we.method("join","=")).join("&");return _}function bt(T){var S=[],_=[];return(function I(P,ue){var ke,Ie,Xe;switch(typeof P){case"object":if(!P)return null;for(ke=0;ke<S.length;ke+=1)if(S[ke]===P)return{$ref:_[ke]};if(S.push(P),_.push(ue),Object.prototype.toString.apply(P)==="[object Array]")for(Xe=[],ke=0;ke<P.length;ke+=1)Xe[ke]=I(P[ke],ue+"["+ke+"]");else{Xe={};for(Ie in P)Object.prototype.hasOwnProperty.call(P,Ie)&&(Xe[Ie]=I(P[Ie],ue+"["+JSON.stringify(Ie)+"]"))}return Xe;case"number":case"string":case"boolean":return P}})(T,"$")}function Ct(T){try{return JSON.stringify(T)}catch{return JSON.stringify(bt(T))}}class ot{constructor(){this.globalLog=S=>{window.console&&window.console.log&&window.console.log(S)}}debug(...S){this.log(this.globalLog,S)}warn(...S){this.log(this.globalLogWarn,S)}error(...S){this.log(this.globalLogError,S)}globalLogWarn(S){window.console&&window.console.warn?window.console.warn(S):this.globalLog(S)}globalLogError(S){window.console&&window.console.error?window.console.error(S):this.globalLogWarn(S)}log(S,..._){var I=Oe.apply(this,arguments);cl.log?cl.log(I):cl.logToConsole&&S.bind(this)(I)}}var We=new ot,nn=function(T,S,_,I,P){(_.headers!==void 0||_.headersProvider!=null)&&We.warn(`To send headers with the ${I.toString()} request, you must use AJAX, rather than JSONP.`);var ue=T.nextAuthCallbackID.toString();T.nextAuthCallbackID++;var ke=T.getDocument(),Ie=ke.createElement("script");T.auth_callbacks[ue]=function(pt){P(null,pt)};var Xe="Pusher.auth_callbacks['"+ue+"']";Ie.src=_.endpoint+"?callback="+encodeURIComponent(Xe)+"&"+S;var dt=ke.getElementsByTagName("head")[0]||ke.documentElement;dt.insertBefore(Ie,dt.firstChild)},Nt=nn;class It{constructor(S){this.src=S}send(S){var _=this,I="Error loading "+_.src;_.script=document.createElement("script"),_.script.id=S.id,_.script.src=_.src,_.script.type="text/javascript",_.script.charset="UTF-8",_.script.addEventListener?(_.script.onerror=function(){S.callback(I)},_.script.onload=function(){S.callback(null)}):_.script.onreadystatechange=function(){(_.script.readyState==="loaded"||_.script.readyState==="complete")&&S.callback(null)},_.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(_.errorScript=document.createElement("script"),_.errorScript.id=S.id+"_error",_.errorScript.text=S.name+"('"+I+"');",_.script.async=_.errorScript.async=!1):_.script.async=!0;var P=document.getElementsByTagName("head")[0];P.insertBefore(_.script,P.firstChild),_.errorScript&&P.insertBefore(_.errorScript,_.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class an{constructor(S,_){this.url=S,this.data=_}send(S){if(!this.request){var _=ft(this.data),I=this.url+"/"+S.number+"?"+_;this.request=Je.createScriptRequest(I),this.request.send(S)}}cleanup(){this.request&&this.request.cleanup()}}var _a=function(T,S){return function(_,I){var P="http"+(S?"s":"")+"://",ue=P+(T.host||T.options.host)+T.options.path,ke=Je.createJSONPRequest(ue,_),Ie=Je.ScriptReceivers.create(function(Xe,dt){d.remove(Ie),ke.cleanup(),dt&&dt.host&&(T.host=dt.host),I&&I(Xe,dt)});ke.send(Ie)}},W={name:"jsonp",getAgent:_a},ve=W;function me(T,S,_){var I=T+(S.useTLS?"s":""),P=S.useTLS?S.hostTLS:S.hostNonTLS;return I+"://"+P+_}function ne(T,S){var _="/app/"+T,I="?protocol="+h.PROTOCOL+"&client=js&version="+h.VERSION+(S?"&"+S:"");return _+I}var _e={getInitial:function(T,S){var _=(S.httpPath||"")+ne(T,"flash=false");return me("ws",S,_)}},Ne={getInitial:function(T,S){var _=(S.httpPath||"/pusher")+ne(T);return me("http",S,_)}},$e={getInitial:function(T,S){return me("http",S,S.httpPath||"/pusher")},getPath:function(T,S){return ne(T)}};class Ve{constructor(){this._callbacks={}}get(S){return this._callbacks[yt(S)]}add(S,_,I){var P=yt(S);this._callbacks[P]=this._callbacks[P]||[],this._callbacks[P].push({fn:_,context:I})}remove(S,_,I){if(!S&&!_&&!I){this._callbacks={};return}var P=S?[yt(S)]:qe(this._callbacks);_||I?this.removeCallback(P,_,I):this.removeAllCallbacks(P)}removeCallback(S,_,I){Et(S,function(P){this._callbacks[P]=tn(this._callbacks[P]||[],function(ue){return _&&_!==ue.fn||I&&I!==ue.context}),this._callbacks[P].length===0&&delete this._callbacks[P]},this)}removeAllCallbacks(S){Et(S,function(_){delete this._callbacks[_]},this)}}function yt(T){return"_"+T}class Ae{constructor(S){this.callbacks=new Ve,this.global_callbacks=[],this.failThrough=S}bind(S,_,I){return this.callbacks.add(S,_,I),this}bind_global(S){return this.global_callbacks.push(S),this}unbind(S,_,I){return this.callbacks.remove(S,_,I),this}unbind_global(S){return S?(this.global_callbacks=tn(this.global_callbacks||[],_=>_!==S),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(S,_,I){for(var P=0;P<this.global_callbacks.length;P++)this.global_callbacks[P](S,_);var ue=this.callbacks.get(S),ke=[];if(I?ke.push(_,I):_&&ke.push(_),ue&&ue.length>0)for(var P=0;P<ue.length;P++)ue[P].fn.apply(ue[P].context||window,ke);else this.failThrough&&this.failThrough(S,_);return this}}class st extends Ae{constructor(S,_,I,P,ue){super(),this.initialize=Je.transportConnectionInitializer,this.hooks=S,this.name=_,this.priority=I,this.key=P,this.options=ue,this.state="new",this.timeline=ue.timeline,this.activityTimeout=ue.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var S=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(S,this.options)}catch(_){return we.defer(()=>{this.onError(_),this.changeState("closed")}),!1}return this.bindListeners(),We.debug("Connecting",{transport:this.name,url:S}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(S){return this.state==="open"?(we.defer(()=>{this.socket&&this.socket.send(S)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(S){this.emit("error",{type:"WebSocketError",error:S}),this.timeline.error(this.buildTimelineMessage({error:S.toString()}))}onClose(S){S?this.changeState("closed",{code:S.code,reason:S.reason,wasClean:S.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(S){this.emit("message",S)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=S=>{this.onError(S)},this.socket.onclose=S=>{this.onClose(S)},this.socket.onmessage=S=>{this.onMessage(S)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(S,_){this.state=S,this.timeline.info(this.buildTimelineMessage({state:S,params:_})),this.emit(S,_)}buildTimelineMessage(S){return Ee({cid:this.id},S)}}class He{constructor(S){this.hooks=S}isSupported(S){return this.hooks.isSupported(S)}createConnection(S,_,I,P){return new st(this.hooks,S,_,I,P)}}var Pe=new He({urls:_e,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!Je.getWebSocketAPI()},isSupported:function(){return!!Je.getWebSocketAPI()},getSocket:function(T){return Je.createWebSocket(T)}}),Ye={urls:Ne,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},De=Ee({getSocket:function(T){return Je.HTTPFactory.createStreamingSocket(T)}},Ye),Le=Ee({getSocket:function(T){return Je.HTTPFactory.createPollingSocket(T)}},Ye),Ue={isSupported:function(){return Je.isXHRSupported()}},At=new He(Ee({},De,Ue)),Kt=new He(Ee({},Le,Ue)),Ut={ws:Pe,xhr_streaming:At,xhr_polling:Kt},qt=Ut,bn=new He({file:"sockjs",urls:$e,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(T,S){return new window.SockJS(T,null,{js_path:x.getPath("sockjs",{useTLS:S.useTLS}),ignore_null_origin:S.ignoreNullOrigin})},beforeOpen:function(T,S){T.send(JSON.stringify({path:S}))}}),Dn={isSupported:function(T){var S=Je.isXDRSupported(T.useTLS);return S}},Ta=new He(Ee({},De,Dn)),Aa=new He(Ee({},Le,Dn));qt.xdr_streaming=Ta,qt.xdr_polling=Aa,qt.sockjs=bn;var Jn=qt;class Ga extends Ae{constructor(){super();var S=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){S.emit("online")},!1),window.addEventListener("offline",function(){S.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var In=new Ga;class gn{constructor(S,_,I){this.manager=S,this.transport=_,this.minPingDelay=I.minPingDelay,this.maxPingDelay=I.maxPingDelay,this.pingDelay=void 0}createConnection(S,_,I,P){P=Ee({},P,{activityTimeout:this.pingDelay});var ue=this.transport.createConnection(S,_,I,P),ke=null,Ie=function(){ue.unbind("open",Ie),ue.bind("closed",Xe),ke=we.now()},Xe=dt=>{if(ue.unbind("closed",Xe),dt.code===1002||dt.code===1003)this.manager.reportDeath();else if(!dt.wasClean&&ke){var pt=we.now()-ke;pt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(pt/2,this.minPingDelay))}};return ue.bind("open",Ie),ue}isSupported(S){return this.manager.isAlive()&&this.transport.isSupported(S)}}const vn={decodeMessage:function(T){try{var S=JSON.parse(T.data),_=S.data;if(typeof _=="string")try{_=JSON.parse(S.data)}catch{}var I={event:S.event,channel:S.channel,data:_};return S.user_id&&(I.user_id=S.user_id),I}catch(P){throw{type:"MessageParseError",error:P,data:T.data}}},encodeMessage:function(T){return JSON.stringify(T)},processHandshake:function(T){var S=vn.decodeMessage(T);if(S.event==="pusher:connection_established"){if(!S.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:S.data.socket_id,activityTimeout:S.data.activity_timeout*1e3}}else{if(S.event==="pusher:error")return{action:this.getCloseAction(S.data),error:this.getCloseError(S.data)};throw"Invalid handshake"}},getCloseAction:function(T){return T.code<4e3?T.code>=1002&&T.code<=1004?"backoff":null:T.code===4e3?"tls_only":T.code<4100?"refused":T.code<4200?"backoff":T.code<4300?"retry":"refused"},getCloseError:function(T){return T.code!==1e3&&T.code!==1001?{type:"PusherError",data:{code:T.code,message:T.reason||T.message}}:null}};var zn=vn;class Ko extends Ae{constructor(S,_){super(),this.id=S,this.transport=_,this.activityTimeout=_.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(S){return this.transport.send(S)}send_event(S,_,I){var P={event:S,data:_};return I&&(P.channel=I),We.debug("Event sent",P),this.send(zn.encodeMessage(P))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var S={message:I=>{var P;try{P=zn.decodeMessage(I)}catch(ue){this.emit("error",{type:"MessageParseError",error:ue,data:I.data})}if(P!==void 0){switch(We.debug("Event recd",P),P.event){case"pusher:error":this.emit("error",{type:"PusherError",data:P.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",P)}},activity:()=>{this.emit("activity")},error:I=>{this.emit("error",I)},closed:I=>{_(),I&&I.code&&this.handleCloseEvent(I),this.transport=null,this.emit("closed")}},_=()=>{Me(S,(I,P)=>{this.transport.unbind(P,I)})};Me(S,(I,P)=>{this.transport.bind(P,I)})}handleCloseEvent(S){var _=zn.getCloseAction(S),I=zn.getCloseError(S);I&&this.emit("error",I),_&&this.emit(_,{action:_,error:I})}}class mh{constructor(S,_){this.transport=S,this.callback=_,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=S=>{this.unbindListeners();var _;try{_=zn.processHandshake(S)}catch(I){this.finish("error",{error:I}),this.transport.close();return}_.action==="connected"?this.finish("connected",{connection:new Ko(_.id,this.transport),activityTimeout:_.activityTimeout}):(this.finish(_.action,{error:_.error}),this.transport.close())},this.onClosed=S=>{this.unbindListeners();var _=zn.getCloseAction(S)||"backoff",I=zn.getCloseError(S);this.finish(_,{error:I})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(S,_){this.callback(Ee({transport:this.transport,action:S},_))}}class yh{constructor(S,_){this.timeline=S,this.options=_||{}}send(S,_){this.timeline.isEmpty()||this.timeline.send(Je.TimelineTransport.getAgent(this,S),_)}}class bi extends Ae{constructor(S,_){super(function(I,P){We.debug("No callbacks on "+S+" for "+I)}),this.name=S,this.pusher=_,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(S,_){return _(null,{auth:""})}trigger(S,_){if(S.indexOf("client-")!==0)throw new k("Event '"+S+"' does not start with 'client-'");if(!this.subscribed){var I=v.buildLogSuffix("triggeringClientEvents");We.warn(`Client event triggered before channel 'subscription_succeeded' event . ${I}`)}return this.pusher.send_event(S,_,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(S){var _=S.event,I=S.data;if(_==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(S);else if(_==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(S);else if(_.indexOf("pusher_internal:")!==0){var P={};this.emit(_,I,P)}}handleSubscriptionSucceededEvent(S){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",S.data)}handleSubscriptionCountEvent(S){S.data.subscription_count&&(this.subscriptionCount=S.data.subscription_count),this.emit("pusher:subscription_count",S.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(S,_)=>{S?(this.subscriptionPending=!1,We.error(S.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:S.message},S instanceof Y?{status:S.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:_.auth,channel_data:_.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ds extends bi{authorize(S,_){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:S},_)}}class Wo{constructor(){this.reset()}get(S){return Object.prototype.hasOwnProperty.call(this.members,S)?{id:S,info:this.members[S]}:null}each(S){Me(this.members,(_,I)=>{S(this.get(I))})}setMyID(S){this.myID=S}onSubscription(S){this.members=S.presence.hash,this.count=S.presence.count,this.me=this.get(this.myID)}addMember(S){return this.get(S.user_id)===null&&this.count++,this.members[S.user_id]=S.user_info,this.get(S.user_id)}removeMember(S){var _=this.get(S.user_id);return _&&(delete this.members[S.user_id],this.count--),_}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Hs=function(T,S,_,I){function P(ue){return ue instanceof _?ue:new _(function(ke){ke(ue)})}return new(_||(_=Promise))(function(ue,ke){function Ie(pt){try{dt(I.next(pt))}catch(Wt){ke(Wt)}}function Xe(pt){try{dt(I.throw(pt))}catch(Wt){ke(Wt)}}function dt(pt){pt.done?ue(pt.value):P(pt.value).then(Ie,Xe)}dt((I=I.apply(T,S||[])).next())})};class Ps extends ds{constructor(S,_){super(S,_),this.members=new Wo}authorize(S,_){super.authorize(S,(I,P)=>Hs(this,void 0,void 0,function*(){if(!I)if(P=P,P.channel_data!=null){var ue=JSON.parse(P.channel_data);this.members.setMyID(ue.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let ke=v.buildLogSuffix("authorizationEndpoint");We.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${ke}, or the user should be signed in.`),_("Invalid auth response");return}_(I,P)}))}handleEvent(S){var _=S.event;if(_.indexOf("pusher_internal:")===0)this.handleInternalEvent(S);else{var I=S.data,P={};S.user_id&&(P.user_id=S.user_id),this.emit(_,I,P)}}handleInternalEvent(S){var _=S.event,I=S.data;switch(_){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(S);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(S);break;case"pusher_internal:member_added":var P=this.members.addMember(I);this.emit("pusher:member_added",P);break;case"pusher_internal:member_removed":var ue=this.members.removeMember(I);ue&&this.emit("pusher:member_removed",ue);break}}handleSubscriptionSucceededEvent(S){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(S.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Tr=i(1),Fa=i(0);class sn extends ds{constructor(S,_,I){super(S,_),this.key=null,this.nacl=I}authorize(S,_){super.authorize(S,(I,P)=>{if(I){_(I,P);return}let ue=P.shared_secret;if(!ue){_(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(Fa.decode)(ue),delete P.shared_secret,_(null,P)})}trigger(S,_){throw new M("Client events are not currently supported for encrypted channels")}handleEvent(S){var _=S.event,I=S.data;if(_.indexOf("pusher_internal:")===0||_.indexOf("pusher:")===0){super.handleEvent(S);return}this.handleEncryptedEvent(_,I)}handleEncryptedEvent(S,_){if(!this.key){We.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!_.ciphertext||!_.nonce){We.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+_);return}let I=Object(Fa.decode)(_.ciphertext);if(I.length<this.nacl.secretbox.overheadLength){We.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${I.length}`);return}let P=Object(Fa.decode)(_.nonce);if(P.length<this.nacl.secretbox.nonceLength){We.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${P.length}`);return}let ue=this.nacl.secretbox.open(I,P,this.key);if(ue===null){We.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(ke,Ie)=>{if(ke){We.error(`Failed to make a request to the authEndpoint: ${Ie}. Unable to fetch new key, so dropping encrypted event`);return}if(ue=this.nacl.secretbox.open(I,P,this.key),ue===null){We.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(S,this.getDataToEmit(ue))});return}this.emit(S,this.getDataToEmit(ue))}getDataToEmit(S){let _=Object(Tr.decode)(S);try{return JSON.parse(_)}catch{return _}}}class fd extends Ae{constructor(S,_){super(),this.state="initialized",this.connection=null,this.key=S,this.options=_,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var I=Je.getNetwork();I.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),I.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(S){return this.connection?this.connection.send(S):!1}send_event(S,_,I){return this.connection?this.connection.send_event(S,_,I):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var S=(_,I)=>{_?this.runner=this.strategy.connect(0,S):I.action==="error"?(this.emit("error",{type:"HandshakeError",error:I.error}),this.timeline.error({handshakeError:I.error})):(this.abortConnecting(),this.handshakeCallbacks[I.action](I))};this.runner=this.strategy.connect(0,S)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var S=this.abandonConnection();S.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(S){this.timeline.info({action:"retry",delay:S}),S>0&&this.emit("connecting_in",Math.round(S/1e3)),this.retryTimer=new q(S||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new q(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new q(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new q(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(S){return Ee({},S,{message:_=>{this.resetActivityCheck(),this.emit("message",_)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:_=>{this.emit("error",_)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(S){return Ee({},S,{connected:_=>{this.activityTimeout=Math.min(this.options.activityTimeout,_.activityTimeout,_.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(_.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let S=_=>I=>{I.error&&this.emit("error",{type:"WebSocketError",error:I.error}),_(I)};return{tls_only:S(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:S(()=>{this.disconnect()}),backoff:S(()=>{this.retryIn(1e3)}),retry:S(()=>{this.retryIn(0)})}}setConnection(S){this.connection=S;for(var _ in this.connectionCallbacks)this.connection.bind(_,this.connectionCallbacks[_]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var S in this.connectionCallbacks)this.connection.unbind(S,this.connectionCallbacks[S]);var _=this.connection;return this.connection=null,_}}updateState(S,_){var I=this.state;if(this.state=S,I!==S){var P=S;P==="connected"&&(P+=" with new socket ID "+_.socket_id),We.debug("State changed",I+" -> "+P),this.timeline.info({state:S,params:_}),this.emit("state_change",{previous:I,current:S}),this.emit(S,_)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class pd{constructor(){this.channels={}}add(S,_){return this.channels[S]||(this.channels[S]=us(S,_)),this.channels[S]}all(){return zt(this.channels)}find(S){return this.channels[S]}remove(S){var _=this.channels[S];return delete this.channels[S],_}disconnect(){Me(this.channels,function(S){S.disconnect()})}}function us(T,S){if(T.indexOf("private-encrypted-")===0){if(S.config.nacl)return Da.createEncryptedChannel(T,S,S.config.nacl);let _="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",I=v.buildLogSuffix("encryptedChannelSupport");throw new M(`${_}. ${I}`)}else{if(T.indexOf("private-")===0)return Da.createPrivateChannel(T,S);if(T.indexOf("presence-")===0)return Da.createPresenceChannel(T,S);if(T.indexOf("#")===0)throw new A('Cannot create a channel with name "'+T+'".');return Da.createChannel(T,S)}}var Us={createChannels(){return new pd},createConnectionManager(T,S){return new fd(T,S)},createChannel(T,S){return new bi(T,S)},createPrivateChannel(T,S){return new ds(T,S)},createPresenceChannel(T,S){return new Ps(T,S)},createEncryptedChannel(T,S,_){return new sn(T,S,_)},createTimelineSender(T,S){return new yh(T,S)},createHandshake(T,S){return new mh(T,S)},createAssistantToTheTransportManager(T,S,_){return new gn(T,S,_)}},Da=Us;class Yo{constructor(S){this.options=S||{},this.livesLeft=this.options.lives||1/0}getAssistant(S){return Da.createAssistantToTheTransportManager(this,S,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Va{constructor(S,_){this.strategies=S,this.loop=!!_.loop,this.failFast=!!_.failFast,this.timeout=_.timeout,this.timeoutLimit=_.timeoutLimit}isSupported(){return Ce(this.strategies,we.method("isSupported"))}connect(S,_){var I=this.strategies,P=0,ue=this.timeout,ke=null,Ie=(Xe,dt)=>{dt?_(null,dt):(P=P+1,this.loop&&(P=P%I.length),P<I.length?(ue&&(ue=ue*2,this.timeoutLimit&&(ue=Math.min(ue,this.timeoutLimit))),ke=this.tryStrategy(I[P],S,{timeout:ue,failFast:this.failFast},Ie)):_(!0))};return ke=this.tryStrategy(I[P],S,{timeout:ue,failFast:this.failFast},Ie),{abort:function(){ke.abort()},forceMinPriority:function(Xe){S=Xe,ke&&ke.forceMinPriority(Xe)}}}tryStrategy(S,_,I,P){var ue=null,ke=null;return I.timeout>0&&(ue=new q(I.timeout,function(){ke.abort(),P(!0)})),ke=S.connect(_,function(Ie,Xe){Ie&&ue&&ue.isRunning()&&!I.failFast||(ue&&ue.ensureAborted(),P(Ie,Xe))}),{abort:function(){ue&&ue.ensureAborted(),ke.abort()},forceMinPriority:function(Ie){ke.forceMinPriority(Ie)}}}}class Jo{constructor(S){this.strategies=S}isSupported(){return Ce(this.strategies,we.method("isSupported"))}connect(S,_){return vi(this.strategies,S,function(I,P){return function(ue,ke){if(P[I].error=ue,ue){Si(P)&&_(!0);return}Et(P,function(Ie){Ie.forceMinPriority(ke.transport.priority)}),_(null,ke)}})}}function vi(T,S,_){var I=$t(T,function(P,ue,ke,Ie){return P.connect(S,_(ue,Ie))});return{abort:function(){Et(I,Ra)},forceMinPriority:function(P){Et(I,function(ue){ue.forceMinPriority(P)})}}}function Si(T){return Ge(T,function(S){return!!S.error})}function Ra(T){!T.error&&!T.aborted&&(T.abort(),T.aborted=!0)}class Hn{constructor(S,_,I){this.strategy=S,this.transports=_,this.ttl=I.ttl||1800*1e3,this.usingTLS=I.useTLS,this.timeline=I.timeline}isSupported(){return this.strategy.isSupported()}connect(S,_){var I=this.usingTLS,P=xh(I),ue=P&&P.cacheSkipCount?P.cacheSkipCount:0,ke=[this.strategy];if(P&&P.timestamp+this.ttl>=we.now()){var Ie=this.transports[P.transport];Ie&&(["ws","wss"].includes(P.transport)||ue>3?(this.timeline.info({cached:!0,transport:P.transport,latency:P.latency}),ke.push(new Va([Ie],{timeout:P.latency*2+1e3,failFast:!0}))):ue++)}var Xe=we.now(),dt=ke.pop().connect(S,function pt(Wt,Lr){Wt?(Qo(I),ke.length>0?(Xe=we.now(),dt=ke.pop().connect(S,pt)):_(Wt)):(Xo(I,Lr.transport.name,we.now()-Xe,ue),_(null,Lr))});return{abort:function(){dt.abort()},forceMinPriority:function(pt){S=pt,dt&&dt.forceMinPriority(pt)}}}}function wi(T){return"pusherTransport"+(T?"TLS":"NonTLS")}function xh(T){var S=Je.getLocalStorage();if(S)try{var _=S[wi(T)];if(_)return JSON.parse(_)}catch{Qo(T)}return null}function Xo(T,S,_,I){var P=Je.getLocalStorage();if(P)try{P[wi(T)]=Ct({timestamp:we.now(),transport:S,latency:_,cacheSkipCount:I})}catch{}}function Qo(T){var S=Je.getLocalStorage();if(S)try{delete S[wi(T)]}catch{}}class gs{constructor(S,{delay:_}){this.strategy=S,this.options={delay:_}}isSupported(){return this.strategy.isSupported()}connect(S,_){var I=this.strategy,P,ue=new q(this.options.delay,function(){P=I.connect(S,_)});return{abort:function(){ue.ensureAborted(),P&&P.abort()},forceMinPriority:function(ke){S=ke,P&&P.forceMinPriority(ke)}}}}class Ar{constructor(S,_,I){this.test=S,this.trueBranch=_,this.falseBranch=I}isSupported(){var S=this.test()?this.trueBranch:this.falseBranch;return S.isSupported()}connect(S,_){var I=this.test()?this.trueBranch:this.falseBranch;return I.connect(S,_)}}class Pn{constructor(S){this.strategy=S}isSupported(){return this.strategy.isSupported()}connect(S,_){var I=this.strategy.connect(S,function(P,ue){ue&&I.abort(),_(P,ue)});return I}}function hs(T){return function(){return T.isSupported()}}var md=function(T,S,_){var I={};function P(Mr,_d,Td,pl,ml){var yl=_(T,Mr,_d,Td,pl,ml);return I[Mr]=yl,yl}var ue=Object.assign({},S,{hostNonTLS:T.wsHost+":"+T.wsPort,hostTLS:T.wsHost+":"+T.wssPort,httpPath:T.wsPath}),ke=Object.assign({},ue,{useTLS:!0}),Ie=Object.assign({},S,{hostNonTLS:T.httpHost+":"+T.httpPort,hostTLS:T.httpHost+":"+T.httpsPort,httpPath:T.httpPath}),Xe={loop:!0,timeout:15e3,timeoutLimit:6e4},dt=new Yo({minPingDelay:1e4,maxPingDelay:T.activityTimeout}),pt=new Yo({lives:2,minPingDelay:1e4,maxPingDelay:T.activityTimeout}),Wt=P("ws","ws",3,ue,dt),Lr=P("wss","ws",3,ke,dt),kd=P("sockjs","sockjs",1,Ie),dl=P("xhr_streaming","xhr_streaming",1,Ie,pt),Nd=P("xdr_streaming","xdr_streaming",1,Ie,pt),ul=P("xhr_polling","xhr_polling",1,Ie),Ks=P("xdr_polling","xdr_polling",1,Ie),Ed=new Va([Wt],Xe),Mh=new Va([Lr],Xe),$h=new Va([kd],Xe),gl=new Va([new Ar(hs(dl),dl,Nd)],Xe),hl=new Va([new Ar(hs(ul),ul,Ks)],Xe),Ws=new Va([new Ar(hs(gl),new Jo([gl,new gs(hl,{delay:4e3})]),hl)],Xe),ps=new Ar(hs(Ws),Ws,$h),fl;return S.useTLS?fl=new Jo([Ed,new gs(ps,{delay:2e3})]):fl=new Jo([Ed,new gs(Mh,{delay:2e3}),new gs(ps,{delay:5e3})]),new Hn(new Pn(new Ar(hs(Wt),fl,ps)),I,{ttl:18e5,timeline:S.timeline,useTLS:S.useTLS})},Zo=md,Bs=(function(){var T=this;T.timeline.info(T.buildTimelineMessage({transport:T.name+(T.options.useTLS?"s":"")})),T.hooks.isInitialized()?T.changeState("initialized"):T.hooks.file?(T.changeState("initializing"),x.load(T.hooks.file,{useTLS:T.options.useTLS},function(S,_){T.hooks.isInitialized()?(T.changeState("initialized"),_(!0)):(S&&T.onError(S),T.onClose(),_(!1))})):T.onClose()}),yd={getRequest:function(T){var S=new window.XDomainRequest;return S.ontimeout=function(){T.emit("error",new R),T.close()},S.onerror=function(_){T.emit("error",_),T.close()},S.onprogress=function(){S.responseText&&S.responseText.length>0&&T.onChunk(200,S.responseText)},S.onload=function(){S.responseText&&S.responseText.length>0&&T.onChunk(200,S.responseText),T.emit("finished",200),T.close()},S},abortRequest:function(T){T.ontimeout=T.onerror=T.onprogress=T.onload=null,T.abort()}},xd=yd;const qs=256*1024;class bh extends Ae{constructor(S,_,I){super(),this.hooks=S,this.method=_,this.url=I}start(S){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},Je.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(S)}close(){this.unloader&&(Je.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(S,_){for(;;){var I=this.advanceBuffer(_);if(I)this.emit("chunk",{status:S,data:I});else break}this.isBufferTooLong(_)&&this.emit("buffer_too_long")}advanceBuffer(S){var _=S.slice(this.position),I=_.indexOf(`
`);return I!==-1?(this.position+=I+1,_.slice(0,I)):null}isBufferTooLong(S){return this.position===S.length&&S.length>qs}}var Ci;(function(T){T[T.CONNECTING=0]="CONNECTING",T[T.OPEN=1]="OPEN",T[T.CLOSED=3]="CLOSED"})(Ci||(Ci={}));var Ka=Ci,el=1;class vh{constructor(S,_){this.hooks=S,this.session=ki(1e3)+"/"+Gs(8),this.location=Sh(_),this.readyState=Ka.CONNECTING,this.openStream()}send(S){return this.sendRaw(JSON.stringify([S]))}ping(){this.hooks.sendHeartbeat(this)}close(S,_){this.onClose(S,_,!0)}sendRaw(S){if(this.readyState===Ka.OPEN)try{return Je.createSocketRequest("POST",la(ji(this.location,this.session))).start(S),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(S,_,I){this.closeStream(),this.readyState=Ka.CLOSED,this.onclose&&this.onclose({code:S,reason:_,wasClean:I})}onChunk(S){if(S.status===200){this.readyState===Ka.OPEN&&this.onActivity();var _,I=S.data.slice(0,1);switch(I){case"o":_=JSON.parse(S.data.slice(1)||"{}"),this.onOpen(_);break;case"a":_=JSON.parse(S.data.slice(1)||"[]");for(var P=0;P<_.length;P++)this.onEvent(_[P]);break;case"m":_=JSON.parse(S.data.slice(1)||"null"),this.onEvent(_);break;case"h":this.hooks.onHeartbeat(this);break;case"c":_=JSON.parse(S.data.slice(1)||"[]"),this.onClose(_[0],_[1],!0);break}}}onOpen(S){this.readyState===Ka.CONNECTING?(S&&S.hostname&&(this.location.base=tl(this.location.base,S.hostname)),this.readyState=Ka.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(S){this.readyState===Ka.OPEN&&this.onmessage&&this.onmessage({data:S})}onActivity(){this.onactivity&&this.onactivity()}onError(S){this.onerror&&this.onerror(S)}openStream(){this.stream=Je.createSocketRequest("POST",la(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",S=>{this.onChunk(S)}),this.stream.bind("finished",S=>{this.hooks.onFinished(this,S)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(S){we.defer(()=>{this.onError(S),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Sh(T){var S=/([^\?]*)\/*(\??.*)/.exec(T);return{base:S[1],queryString:S[2]}}function ji(T,S){return T.base+"/"+S+"/xhr_send"}function la(T){var S=T.indexOf("?")===-1?"?":"&";return T+S+"t="+ +new Date+"&n="+el++}function tl(T,S){var _=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(T);return _[1]+S+_[3]}function ki(T){return Je.randomInt(T)}function Gs(T){for(var S=[],_=0;_<T;_++)S.push(ki(32).toString(32));return S.join("")}var Fs=vh,bd={getReceiveURL:function(T,S){return T.base+"/"+S+"/xhr_streaming"+T.queryString},onHeartbeat:function(T){T.sendRaw("[]")},sendHeartbeat:function(T){T.sendRaw("[]")},onFinished:function(T,S){T.onClose(1006,"Connection interrupted ("+S+")",!1)}},nl=bd,vd={getReceiveURL:function(T,S){return T.base+"/"+S+"/xhr"+T.queryString},onHeartbeat:function(){},sendHeartbeat:function(T){T.sendRaw("[]")},onFinished:function(T,S){S===200?T.reconnect():T.onClose(1006,"Connection interrupted ("+S+")",!1)}},Dr=vd,Oa={getRequest:function(T){var S=Je.getXHRAPI(),_=new S;return _.onreadystatechange=_.onprogress=function(){switch(_.readyState){case 3:_.responseText&&_.responseText.length>0&&T.onChunk(_.status,_.responseText);break;case 4:_.responseText&&_.responseText.length>0&&T.onChunk(_.status,_.responseText),T.emit("finished",_.status),T.close();break}},_},abortRequest:function(T){T.onreadystatechange=null,T.abort()}},al=Oa,Rr={createStreamingSocket(T){return this.createSocket(nl,T)},createPollingSocket(T){return this.createSocket(Dr,T)},createSocket(T,S){return new Fs(T,S)},createXHR(T,S){return this.createRequest(al,T,S)},createRequest(T,S,_){return new bh(T,S,_)}},La=Rr;La.createXDR=function(T,S){return this.createRequest(xd,T,S)};var sl=La,Ni={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:d,DependenciesReceivers:p,getDefaultStrategy:Zo,Transports:Jn,transportConnectionInitializer:Bs,HTTPFactory:sl,TimelineTransport:ve,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(T){window.Pusher=T;var S=()=>{this.onDocumentBody(T.ready)};window.JSON?S():x.load("json2",{},S)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:be,jsonp:Nt}},onDocumentBody(T){document.body?T():setTimeout(()=>{this.onDocumentBody(T)},0)},createJSONPRequest(T,S){return new an(T,S)},createScriptRequest(T){return new It(T)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var T=this.getXHRAPI();return new T},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return In},createWebSocket(T){var S=this.getWebSocketAPI();return new S(T)},createSocketRequest(T,S){if(this.isXHRSupported())return this.HTTPFactory.createXHR(T,S);if(this.isXDRSupported(S.indexOf("https:")===0))return this.HTTPFactory.createXDR(T,S);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var T=this.getXHRAPI();return!!T&&new T().withCredentials!==void 0},isXDRSupported(T){var S=T?"https:":"http:",_=this.getProtocol();return!!window.XDomainRequest&&_===S},addUnloadListener(T){window.addEventListener!==void 0?window.addEventListener("unload",T,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",T)},removeUnloadListener(T){window.addEventListener!==void 0?window.removeEventListener("unload",T,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",T)},randomInt(T){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*T)}},Je=Ni,Vs;(function(T){T[T.ERROR=3]="ERROR",T[T.INFO=6]="INFO",T[T.DEBUG=7]="DEBUG"})(Vs||(Vs={}));var fs=Vs;class Sd{constructor(S,_,I){this.key=S,this.session=_,this.events=[],this.options=I||{},this.sent=0,this.uniqueID=0}log(S,_){S<=this.options.level&&(this.events.push(Ee({},_,{timestamp:we.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(S){this.log(fs.ERROR,S)}info(S){this.log(fs.INFO,S)}debug(S){this.log(fs.DEBUG,S)}isEmpty(){return this.events.length===0}send(S,_){var I=Ee({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],S(I,(P,ue)=>{P||this.sent++,_&&_(P,ue)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class En{constructor(S,_,I,P){this.name=S,this.priority=_,this.transport=I,this.options=P||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(S,_){if(this.isSupported()){if(this.priority<S)return Wa(new N,_)}else return Wa(new z,_);var I=!1,P=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),ue=null,ke=function(){P.unbind("initialized",ke),P.connect()},Ie=function(){ue=Da.createHandshake(P,function(Wt){I=!0,pt(),_(null,Wt)})},Xe=function(Wt){pt(),_(Wt)},dt=function(){pt();var Wt;Wt=Ct(P),_(new D(Wt))},pt=function(){P.unbind("initialized",ke),P.unbind("open",Ie),P.unbind("error",Xe),P.unbind("closed",dt)};return P.bind("initialized",ke),P.bind("open",Ie),P.bind("error",Xe),P.bind("closed",dt),P.initialize(),{abort:()=>{I||(pt(),ue?ue.close():P.close())},forceMinPriority:Wt=>{I||this.priority<Wt&&(ue?ue.close():P.close())}}}}function Wa(T,S){return we.defer(function(){S(T)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Ei}=Je;var Or=function(T,S,_,I,P,ue){var ke=Ei[_];if(!ke)throw new L(_);var Ie=(!T.enabledTransports||tt(T.enabledTransports,S)!==-1)&&(!T.disabledTransports||tt(T.disabledTransports,S)===-1),Xe;return Ie?(P=Object.assign({ignoreNullOrigin:T.ignoreNullOrigin},P),Xe=new En(S,I,ue?ue.getAssistant(ke):ke,P)):Xe=wh,Xe},wh={isSupported:function(){return!1},connect:function(T,S){var _=we.defer(function(){S(new z)});return{abort:function(){_.ensureAborted()},forceMinPriority:function(){}}}};function rl(T){if(T==null)throw"You must pass an options object";if(T.cluster==null)throw"Options object must provide a cluster";"disableStats"in T&&We.warn("The disableStats option is deprecated in favor of enableStats")}const il=(T,S)=>{var _="socket_id="+encodeURIComponent(T.socketId);for(var I in S.params)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(S.params[I]);if(S.paramsProvider!=null){let P=S.paramsProvider();for(var I in P)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(P[I])}return _};var Ti=T=>{if(typeof Je.getAuthorizers()[T.transport]>"u")throw`'${T.transport}' is not a recognized auth transport`;return(S,_)=>{const I=il(S,T);Je.getAuthorizers()[T.transport](Je,I,T,C.UserAuthentication,_)}};const wd=(T,S)=>{var _="socket_id="+encodeURIComponent(T.socketId);_+="&channel_name="+encodeURIComponent(T.channelName);for(var I in S.params)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(S.params[I]);if(S.paramsProvider!=null){let P=S.paramsProvider();for(var I in P)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(P[I])}return _};var Ch=T=>{if(typeof Je.getAuthorizers()[T.transport]>"u")throw`'${T.transport}' is not a recognized auth transport`;return(S,_)=>{const I=wd(S,T);Je.getAuthorizers()[T.transport](Je,I,T,C.ChannelAuthorization,_)}};const jh=(T,S,_)=>{const I={authTransport:S.transport,authEndpoint:S.endpoint,auth:{params:S.params,headers:S.headers}};return(P,ue)=>{const ke=T.channel(P.channelName);_(ke,I).authorize(P.socketId,ue)}};function ol(T,S){let _={activityTimeout:T.activityTimeout||h.activityTimeout,cluster:T.cluster,httpPath:T.httpPath||h.httpPath,httpPort:T.httpPort||h.httpPort,httpsPort:T.httpsPort||h.httpsPort,pongTimeout:T.pongTimeout||h.pongTimeout,statsHost:T.statsHost||h.stats_host,unavailableTimeout:T.unavailableTimeout||h.unavailableTimeout,wsPath:T.wsPath||h.wsPath,wsPort:T.wsPort||h.wsPort,wssPort:T.wssPort||h.wssPort,enableStats:Th(T),httpHost:kh(T),useTLS:_h(T),wsHost:Nh(T),userAuthenticator:Cd(T),channelAuthorizer:Dh(T,S)};return"disabledTransports"in T&&(_.disabledTransports=T.disabledTransports),"enabledTransports"in T&&(_.enabledTransports=T.enabledTransports),"ignoreNullOrigin"in T&&(_.ignoreNullOrigin=T.ignoreNullOrigin),"timelineParams"in T&&(_.timelineParams=T.timelineParams),"nacl"in T&&(_.nacl=T.nacl),_}function kh(T){return T.httpHost?T.httpHost:T.cluster?`sockjs-${T.cluster}.pusher.com`:h.httpHost}function Nh(T){return T.wsHost?T.wsHost:Eh(T.cluster)}function Eh(T){return`ws-${T}.pusher.com`}function _h(T){return Je.getProtocol()==="https:"?!0:T.forceTLS!==!1}function Th(T){return"enableStats"in T?T.enableStats:"disableStats"in T?!T.disableStats:!1}function Cd(T){const S=Object.assign(Object.assign({},h.userAuthentication),T.userAuthentication);return"customHandler"in S&&S.customHandler!=null?S.customHandler:Ti(S)}function Ah(T,S){let _;return"channelAuthorization"in T?_=Object.assign(Object.assign({},h.channelAuthorization),T.channelAuthorization):(_={transport:T.authTransport||h.authTransport,endpoint:T.authEndpoint||h.authEndpoint},"auth"in T&&("params"in T.auth&&(_.params=T.auth.params),"headers"in T.auth&&(_.headers=T.auth.headers)),"authorizer"in T&&(_.customHandler=jh(S,_,T.authorizer))),_}function Dh(T,S){const _=Ah(T,S);return"customHandler"in _&&_.customHandler!=null?_.customHandler:Ch(_)}class Rh extends Ae{constructor(S){super(function(_,I){We.debug(`No callbacks on watchlist events for ${_}`)}),this.pusher=S,this.bindWatchlistInternalEvent()}handleEvent(S){S.data.events.forEach(_=>{this.emit(_.name,_)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",S=>{var _=S.event;_==="pusher_internal:watchlist_events"&&this.handleEvent(S)})}}function Oh(){let T,S;return{promise:new Promise((I,P)=>{T=I,S=P}),resolve:T,reject:S}}var ll=Oh;class Lh extends Ae{constructor(S){super(function(_,I){We.debug("No callbacks on user for "+_)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(_,I)=>{if(_){We.warn(`Error during signin: ${_}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:I.auth,user_data:I.user_data})},this.pusher=S,this.pusher.connection.bind("state_change",({previous:_,current:I})=>{_!=="connected"&&I==="connected"&&this._signin(),_==="connected"&&I!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Rh(S),this.pusher.connection.bind("message",_=>{var I=_.event;I==="pusher:signin_success"&&this._onSigninSuccess(_.data),this.serverToUserChannel&&this.serverToUserChannel.name===_.channel&&this.serverToUserChannel.handleEvent(_)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(S){try{this.user_data=JSON.parse(S.user_data)}catch{We.error(`Failed parsing user data after signin: ${S.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){We.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const S=_=>{_.subscriptionPending&&_.subscriptionCancelled?_.reinstateSubscription():!_.subscriptionPending&&this.pusher.connection.state==="connected"&&_.subscribe()};this.serverToUserChannel=new bi(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((_,I)=>{_.indexOf("pusher_internal:")===0||_.indexOf("pusher:")===0||this.emit(_,I)}),S(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:S,resolve:_}=ll();S.done=!1;const I=()=>{S.done=!0};S.then(I).catch(I),this.signinDonePromise=S,this._signinDoneResolve=_}}class hn{static ready(){hn.isReady=!0;for(var S=0,_=hn.instances.length;S<_;S++)hn.instances[S].connect()}static getClientFeatures(){return qe(Vt({ws:Je.Transports.ws},function(S){return S.isSupported({})}))}constructor(S,_){jd(S),rl(_),this.key=S,this.config=ol(_,this),this.channels=Da.createChannels(),this.global_emitter=new Ae,this.sessionID=Je.randomInt(1e9),this.timeline=new Sd(this.key,this.sessionID,{cluster:this.config.cluster,features:hn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:fs.INFO,version:h.VERSION}),this.config.enableStats&&(this.timelineSender=Da.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+Je.TimelineTransport.name}));var I=P=>Je.getDefaultStrategy(this.config,P,Or);this.connection=Da.createConnectionManager(this.key,{getStrategy:I,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",P=>{var ue=P.event,ke=ue.indexOf("pusher_internal:")===0;if(P.channel){var Ie=this.channel(P.channel);Ie&&Ie.handleEvent(P)}ke||this.global_emitter.emit(P.event,P.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",P=>{We.warn(P)}),hn.instances.push(this),this.timeline.info({instances:hn.instances.length}),this.user=new Lh(this),hn.isReady&&this.connect()}channel(S){return this.channels.find(S)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var S=this.connection.isUsingTLS(),_=this.timelineSender;this.timelineSenderTimer=new ie(6e4,function(){_.send(S)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(S,_,I){return this.global_emitter.bind(S,_,I),this}unbind(S,_,I){return this.global_emitter.unbind(S,_,I),this}bind_global(S){return this.global_emitter.bind_global(S),this}unbind_global(S){return this.global_emitter.unbind_global(S),this}unbind_all(S){return this.global_emitter.unbind_all(),this}subscribeAll(){var S;for(S in this.channels.channels)this.channels.channels.hasOwnProperty(S)&&this.subscribe(S)}subscribe(S){var _=this.channels.add(S,this);return _.subscriptionPending&&_.subscriptionCancelled?_.reinstateSubscription():!_.subscriptionPending&&this.connection.state==="connected"&&_.subscribe(),_}unsubscribe(S){var _=this.channels.find(S);_&&_.subscriptionPending?_.cancelSubscription():(_=this.channels.remove(S),_&&_.subscribed&&_.unsubscribe())}send_event(S,_,I){return this.connection.send_event(S,_,I)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}hn.instances=[],hn.isReady=!1,hn.logToConsole=!1,hn.Runtime=Je,hn.ScriptReceivers=Je.ScriptReceivers,hn.DependenciesReceivers=Je.DependenciesReceivers,hn.auth_callbacks=Je.auth_callbacks;var cl=a.default=hn;function jd(T){if(T==null)throw"You must pass your app key when you instantiate Pusher."}Je.setup(hn)})])})})(Ig)),Ig.exports}var zj=Ij();const Wy=es(zj),Qt=at("WebSocketManager");class Hj{constructor(){H(this,"echo",null);H(this,"subscriptions",new Map);H(this,"initialized",!1);H(this,"config",null)}configure(e){if(this.initialized){Qt.warn("[WebSocketManager] 이미 초기화되어 설정을 변경할 수 없습니다.");return}this.config=e,Qt.log("[WebSocketManager] 설정 완료:",{appKey:e.appKey?"***":"(없음)",host:e.host,port:e.port,scheme:e.scheme})}initialize(){if(this.initialized)return;if(!this.config||!this.config.appKey){Qt.warn("[WebSocketManager] WebSocket 설정이 없습니다. initTemplateApp에서 websocket 옵션을 전달해주세요.");return}const{appKey:e,host:n="localhost",port:a=80,scheme:i="https",authEndpoint:o="/api/broadcasting/auth"}=this.config,d=Number(a)||80,g=i==="https";Qt.log("[WebSocketManager] 연결 설정:",{host:n,port:d,scheme:i,useTLS:g,authEndpoint:o}),window.Pusher=Wy;const h=localStorage.getItem("auth_token"),f={wsHost:n,wsPort:d,wssPort:d,forceTLS:g,disableStats:!0,enabledTransports:["ws","wss"],cluster:"mt1",authEndpoint:o,auth:{headers:{Authorization:h?`Bearer ${h}`:"",Accept:"application/json"}}};Qt.log("[WebSocketManager] Pusher 옵션:",f);const p=new Wy(e,f);p.connection.bind("connecting",()=>{Qt.log("[WebSocketManager] 연결 시도 중...")}),p.connection.bind("connected",()=>{Qt.log("[WebSocketManager] 연결 성공! Socket ID:",p.connection.socket_id)}),p.connection.bind("failed",()=>{Qt.error("[WebSocketManager] 연결 실패 - WebSocket을 사용할 수 없습니다.")}),p.connection.bind("error",x=>{Qt.error("[WebSocketManager] 연결 오류:",x)}),p.connection.bind("state_change",x=>{Qt.log(`[WebSocketManager] 상태 변경: ${x.previous} → ${x.current}`)}),p.connection.bind("unavailable",()=>{Qt.error("[WebSocketManager] WebSocket 사용 불가 - 연결할 수 없습니다.")}),p.connection.bind("disconnected",()=>{Qt.warn("[WebSocketManager] 연결이 끊어졌습니다.")}),Qt.log("[WebSocketManager] 초기 연결 상태:",p.connection.state),this.echo=new $j({broadcaster:"reverb",client:p}),Qt.log("[WebSocketManager] 연결 시작 시도..."),p.connect(),window.Echo=this.echo,this.initialized=!0,Qt.log("[WebSocketManager] Echo 초기화 완료")}subscribe(e,n,a,i={}){if(this.initialize(),!this.echo)return Qt.warn("[WebSocketManager] Echo가 초기화되지 않았습니다."),"";const{channelType:o="private"}=i,d=`${e}:${n}`;if(this.subscriptions.has(d))return Qt.log(`[WebSocketManager] 이미 구독 중: ${d}`),d;let g;switch(o){case"public":g=this.echo.channel(e);break;case"presence":g=this.echo.join(e);break;default:g=this.echo.private(e)}return g.listen(`.${n}`,a),this.subscriptions.set(d,g),Qt.log(`[WebSocketManager] 구독 완료: ${d} (${o})`),d}unsubscribe(e){this.subscriptions.has(e)&&(this.subscriptions.delete(e),Qt.log(`[WebSocketManager] 구독 해제: ${e}`))}leaveChannel(e){if(!this.echo)return;this.echo.leave(e);const n=[];this.subscriptions.forEach((a,i)=>{i.startsWith(`${e}:`)&&n.push(i)}),n.forEach(a=>this.subscriptions.delete(a)),Qt.log(`[WebSocketManager] 채널 구독 해제: ${e}`)}disconnect(){this.echo&&(this.echo.disconnect(),this.subscriptions.clear(),this.initialized=!1,Qt.log("[WebSocketManager] 연결 종료"))}getEcho(){return this.echo}isInitialized(){return this.initialized}isConfigured(){return this.config!==null&&!!this.config.appKey}getSubscriptionCount(){return this.subscriptions.size}}const Lc=new Hj,Lt=at("DataSourceManager"),Pj=new _n;function Mc(r,e){const n=r.match(/^\{\{(.+)\}\}$/);if(n){const a=n[1].trim();try{return Pj.evaluateExpression(a,e)}catch(i){return Lt.error("Failed to evaluate param expression:",a,i),r}}return sc(r,e,{skipCache:!0})}function Yy(r){const e={};for(const n of r.keys()){if(n in e)continue;const a=r.getAll(n);a.length>1?e[n]=a:a.length===1&&(n.endsWith("[]")?e[n]=a:e[n]=a[0])}return e}function Uj(){try{return window.G7Core?.devTools}catch{return}}const hd=class hd{constructor(e={}){H(this,"options");H(this,"dataCache",new Map);H(this,"bindingEngine");H(this,"globalHeaders",[]);this.options=e,this.bindingEngine=new _n}setGlobalHeaders(e){this.globalHeaders=e||[]}matchesPattern(e,n){if(n==="*")return!0;const a=n.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${a}$`).test(e)}toFormData(e){const n=new FormData;for(const[a,i]of Object.entries(e))i instanceof File||i instanceof Blob?n.append(a,i):i!=null&&n.append(a,typeof i=="object"?JSON.stringify(i):String(i));return n}getMatchingGlobalHeaders(e,n){const a={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([o,d])=>{const g=Mc(d,n);g!=null&&g!==""&&(a[o]=String(g))});return a}filterByCondition(e,n={}){const a=new Set,i=[];for(const o of e){if(a.has(o.id))continue;if(!o.if&&!o.conditions){a.add(o.id),i.push(o);continue}ti({if:o.if,conditions:o.conditions},n,this.bindingEngine,`data_source:${o.id}`)&&(a.add(o.id),i.push(o))}return i}checkErrorCondition(e,n){if(!e.errorCondition?.if||e.errorCondition?.errorCode===void 0)return null;try{const a={response:n};if(ti({if:e.errorCondition.if},a,this.bindingEngine,`errorCondition:${e.id}`))return Lt.log(`errorCondition matched for ${e.id}, triggering error ${e.errorCondition.errorCode}`),e.errorCondition.errorCode}catch(a){Lt.error(`Failed to evaluate errorCondition for ${e.id}:`,a)}return null}async fetchDataSources(e,n={},a=new URLSearchParams,i,o){const d={},g=e.filter(h=>h.auto_fetch!==!1&&h.type!=="websocket");return await Promise.all(g.map(async h=>{try{const f=await this.fetchDataSource(h,n,a,i,o);d[h.id]=f,this.dataCache.set(h.id,{data:f,timestamp:Date.now()});const p=this.checkErrorCondition(h,f);if(p!==null){const x={status:p,message:`Error condition matched for ${h.id}`,data:f},y=va(),w=y.resolve(p,{errorHandling:h.errorHandling,onError:h.onError});if(w.handler)try{await y.execute(w.handler,x)}catch(v){Lt.error(`Error executing errorCondition handler for ${h.id}:`,v)}h.fallback!==void 0&&(d[h.id]=h.fallback,this.dataCache.set(h.id,{data:h.fallback,timestamp:Date.now()}),Lt.log(`Using fallback data for ${h.id} (errorCondition)`));return}if(h.onSuccess)try{const x={data:f,sourceId:h.id};await this.executeOnSuccessHandler(h.onSuccess,x)}catch(x){Lt.error(`Error executing onSuccess handler for ${h.id}:`,x)}}catch(f){Lt.error(`Failed to fetch data source: ${h.id}`,f);const p=f?.response?.status||f?.status||500,x=f?.response?.data,y=x?.message||f.message||"Unknown error",w={status:p,message:y,errors:x?.errors,data:x,statusText:f?.response?.statusText},v=va(),C=v.resolve(p,{errorHandling:h.errorHandling,onError:h.onError});if(C.handler)try{await v.execute(C.handler,w)}catch(k){Lt.error(`Error executing error handler for ${h.id}:`,k)}h.fallback!==void 0&&(d[h.id]=h.fallback,this.dataCache.set(h.id,{data:h.fallback,timestamp:Date.now()}),Lt.log(`Using fallback data for ${h.id}`)),this.options.onError&&this.options.onError(f,h)}})),d}async fetchDataSourcesWithResults(e,n={},a=new URLSearchParams,i,o,d){const g=d?.ignoreAutoFetch?e.filter(f=>f.type!=="websocket"):e.filter(f=>f.auto_fetch!==!1&&f.type!=="websocket");return await Promise.all(g.map(async f=>{try{const p=await this.fetchDataSource(f,n,a,i,o);this.dataCache.set(f.id,{data:p,timestamp:Date.now()});const x=this.checkErrorCondition(f,p);if(x!==null){const y={status:x,message:`Error condition matched for ${f.id}`,data:p},w=va(),v=w.resolve(x,{errorHandling:f.errorHandling,onError:f.onError});let C=!1;if(v.handler)if(f.loading_strategy==="blocking")w.execute(v.handler,y).catch(k=>{Lt.error(`Error executing errorCondition handler for ${f.id}:`,k)}),C=!0;else try{await w.execute(v.handler,y),C=!0}catch(k){Lt.error(`Error executing errorCondition handler for ${f.id}:`,k)}return f.fallback!==void 0?(this.dataCache.set(f.id,{data:f.fallback,timestamp:Date.now()}),Lt.log(`Using fallback data for ${f.id} (errorCondition)`),{id:f.id,state:"success",data:f.fallback}):{id:f.id,state:"error",error:new Error(`Error condition matched: ${x}`),errorCode:x,errorHandled:C}}if(f.onSuccess)try{const y={data:p,sourceId:f.id};await this.executeOnSuccessHandler(f.onSuccess,y)}catch(y){Lt.error(`Error executing onSuccess handler for ${f.id}:`,y)}return{id:f.id,state:"success",data:p}}catch(p){Lt.error(`Failed to fetch data source: ${f.id}`,p);const x=p?.response?.status||p?.status||500,y=p?.response?.data,w=y?.message||p.message||"Unknown error",v={status:x,message:w,errors:y?.errors,data:y,statusText:p?.response?.statusText},C=va(),k=C.resolve(x,{errorHandling:f.errorHandling,onError:f.onError});let A=!1;if(k.handler)if(f.loading_strategy==="blocking")C.execute(k.handler,v).catch(R=>{Lt.error(`Error executing error handler for ${f.id}:`,R)}),A=!0;else try{await C.execute(k.handler,v),A=!0}catch(R){Lt.error(`Error executing error handler for ${f.id}:`,R)}return f.fallback!==void 0?(this.dataCache.set(f.id,{data:f.fallback,timestamp:Date.now()}),Lt.log(`Using fallback data for ${f.id}`),{id:f.id,state:"success",data:f.fallback}):(this.options.onError&&this.options.onError(p,f),{id:f.id,state:"error",error:p,errorCode:x,errorHandled:A})}}))}fetchDataSourcesInBackground(e,n={},a=new URLSearchParams,i){e.filter(d=>d.auto_fetch!==!1&&d.loading_strategy==="background"&&d.type!=="websocket").forEach(d=>{this.fetchDataSource(d,n,a).then(async g=>{this.dataCache.set(d.id,{data:g,timestamp:Date.now()});const h=this.checkErrorCondition(d,g);if(h!==null){const f={status:h,message:`Error condition matched for ${d.id}`,data:g},p=va(),x=p.resolve(h,{errorHandling:d.errorHandling,onError:d.onError});if(x.handler)try{await p.execute(x.handler,f)}catch(y){Lt.error(`Error executing errorCondition handler for ${d.id}:`,y)}d.fallback!==void 0&&(this.dataCache.set(d.id,{data:d.fallback,timestamp:Date.now()}),Lt.log(`Using fallback data for ${d.id} (errorCondition)`),i&&i(d.id,d.fallback));return}if(d.onSuccess)try{const f={data:g,sourceId:d.id};await this.executeOnSuccessHandler(d.onSuccess,f)}catch(f){Lt.error(`Error executing onSuccess handler for ${d.id}:`,f)}i&&i(d.id,g)}).catch(async g=>{Lt.error(`Background fetch failed: ${d.id}`,g);const h=g?.response?.status||g?.status||500,f=g?.response?.data,p=f?.message||g.message||"Unknown error",x={status:h,message:p,errors:f?.errors,data:f,statusText:g?.response?.statusText},y=va(),w=y.resolve(h,{errorHandling:d.errorHandling,onError:d.onError});if(w.handler)try{await y.execute(w.handler,x)}catch(v){Lt.error(`Error executing error handler for ${d.id}:`,v)}if(d.fallback!==void 0){this.dataCache.set(d.id,{data:d.fallback,timestamp:Date.now()}),Lt.log(`Using fallback data for ${d.id}`),i&&i(d.id,d.fallback);return}this.options.onError&&this.options.onError(g,d)})})}async fetchDataSource(e,n,a,i,o){switch(e.type){case"api":return this.fetchApiDataSource(e,n,a,i,o);case"static":return e.data;case"route_params":return n;case"query_params":return Yy(a);default:throw new Error(`Unknown data source type: ${e.type}`)}}async fetchApiDataSource(e,n,a,i,o){if(!e.endpoint)throw new Error(`API data source ${e.id} has no endpoint`);const d={route:n,query:Yy(a)};i&&(d._global=i),o&&(d._local=o);let g=sc(e.endpoint,d,{skipCache:!0});const h=e.method||"GET",p=(e.contentType?typeof e.contentType=="string"&&e.contentType.includes("{{")?sc(e.contentType,d,{skipCache:!0}):e.contentType:"application/json")==="multipart/form-data";let x=p?{...e.params||{}}:JSON.parse(JSON.stringify(e.params||{}));Object.entries(x).forEach(([v,C])=>{typeof C=="string"&&(x[v]=Mc(C,d))}),Object.keys(x).forEach(v=>{x[v]===""&&delete x[v]});const y=Uj();let w=null;if(y?.isEnabled()){y.trackDataSourceDefinition({id:e.id,type:e.type,endpoint:g,method:h,autoFetch:e.auto_fetch,initLocal:e.initLocal,initGlobal:e.initGlobal});let v=g;if(h==="GET"&&Object.keys(x).length>0){const C=new URLSearchParams;Object.entries(x).forEach(([A,R])=>{Array.isArray(R)?R.forEach(N=>C.append(A,String(N))):R!=null&&C.append(A,String(R))});const k=C.toString();v=k?`${g}?${k}`:g}w=y.trackRequest(v,h,{requestBody:h!=="GET"?x:void 0,dataSourceId:e.id}),y.trackDataSourceLoading(e.id)}try{let v;const C=e.auth_mode??(e.auth_required===!0?"required":"none"),k=as.getInstance().isAuthenticated(),A=C==="required"||C==="optional"&&k;if(A){const R=ns(),N=g.startsWith("/api/")?g.substring(4):g.startsWith("/api")?g.substring(4)||"/":g;this.options.onError&&Lt.log(`[DataSourceManager] Normalized endpoint: ${g} -> ${N}`);const D=this.getMatchingGlobalHeaders(g,d),M={};e.headers&&Object.entries(e.headers).forEach(([he,be])=>{const X=Mc(be,d);X!=null&&X!==""&&(M[he]=String(X))});const L={...D,...M},z=Object.keys(L).length>0,Y=p?this.toFormData(x):x;switch(h){case"GET":v=await R.get(N,{params:x,...z&&{headers:L}});break;case"POST":z?v=await R.post(N,Y,{headers:L}):v=await R.post(N,Y);break;case"PUT":z?v=await R.put(N,Y,{headers:L}):v=await R.put(N,Y);break;case"PATCH":z?v=await R.patch(N,Y,{headers:L}):v=await R.patch(N,Y);break;case"DELETE":v=await R.delete(N,{params:x,...z&&{headers:L}});break;default:throw new Error(`Unsupported HTTP method: ${h}`)}}else{let R=g;if(h==="GET"){const Y=new URLSearchParams(x).toString();R=Y?`${g}?${Y}`:g}const N={...p?{}:{"Content-Type":"application/json"},Accept:"application/json"};if(typeof window<"u"){const Y=localStorage.getItem("g7_locale");Y&&(N["Accept-Language"]=Y)}const D=this.getMatchingGlobalHeaders(g,d);Object.assign(N,D),e.headers&&Object.entries(e.headers).forEach(([Y,he])=>{const be=Mc(he,d);be!=null&&be!==""&&(N[Y]=String(be))});let M;h!=="GET"&&(p?(M=this.toFormData(x),delete N["Content-Type"]):M=JSON.stringify(x));const L=await fetch(R,{method:h,headers:N,body:M});let z;try{z=await L.json()}catch{z=null}if(w&&y?.isEnabled()&&(y.completeRequest(w,L.status,z),w=null),!L.ok){y?.isEnabled()&&y.trackDataSourceError(e.id,`HTTP ${L.status}: ${L.statusText}`);const Y=new Error(`HTTP error! status: ${L.status}`);throw Y.response={status:L.status,statusText:L.statusText,data:z},Y.status=L.status,Y}v=z,y?.isEnabled()&&y.trackDataSourceLoaded(e.id,v)}return A&&w&&y?.isEnabled()&&(y.completeRequest(w,200,v),y.trackDataSourceLoaded(e.id,v)),v}catch(v){if(w&&y?.isEnabled()){const C=v;C?.response?y.completeRequest(w,C.response.status,C.response.data):y.failRequest(w,v instanceof Error?v.message:String(v)),y.trackDataSourceError(e.id,v instanceof Error?v.message:String(v))}throw v}}getCachedData(e){const n=this.dataCache.get(e);if(!n)return;if(Date.now()-n.timestamp>hd.DATA_CACHE_TTL){this.dataCache.delete(e);return}return n.data}clearCache(){this.dataCache.clear()}subscribeWebSockets(e,n){const a=[],i=e.filter(o=>o.type==="websocket");return i.length===0||i.forEach(o=>{if(!o.channel||!o.event){Lt.warn(`WebSocket source ${o.id} missing channel or event`);return}const d=Lc.subscribe(o.channel,o.event,g=>{const h=o.target_source||o.id;this.dataCache.set(h,{data:g,timestamp:Date.now()}),n(h,g)},{channelType:o.channel_type||"private"});d&&a.push(d)}),a}unsubscribeWebSockets(e){e.length!==0&&e.forEach(n=>{Lc.unsubscribe(n)})}async executeOnSuccessHandler(e,n){const a=Fm();if(!a){Lt.warn("ActionDispatcher not available, skipping onSuccess handler");return}const i=Array.isArray(e)?e:[e];for(const o of i)try{await a.dispatchAction({type:"click",...o},{data:{response:n}})}catch(d){throw Lt.error("Failed to execute onSuccess handler:",d),d}}};H(hd,"DATA_CACHE_TTL",3e5);let is=hd;new is;const Sr=at("ModalDataSourceWrapper");function Bj(r,e){if(!r||!e)return r;const a=e.replace(/\?\./g,".").split(/\.(?![^\[]*\])/).flatMap(o=>{const d=o.match(/^([^\[]*)((?:\[\d+\])*)$/);if(d){const[,g,h]=d,f=[];g&&f.push(g);const p=h.match(/\[\d+\]/g);return p&&f.push(...p),f}return[o]}).filter(o=>o!=="");let i=r;for(const o of a){if(i==null)return;if(o.startsWith("[")&&o.endsWith("]")){const d=parseInt(o.slice(1,-1),10);i=i[d]}else i=i[o]}return i}const Jy=({isOpen:r,modalId:e,dataSources:n,dataContext:a,globalStateUpdater:i,bindingEngine:o,debug:d=!1,children:g})=>{const[h,f]=j.useState(!1),[p,x]=j.useState(!1),y=j.useRef(!1),w=j.useRef(null);w.current||(w.current=new is);const v=j.useCallback(async()=>{if(!(!n||n.length===0)&&w.current){f(!0);try{const C=a.route||{},k=new URLSearchParams(window.location.search),A=n.map(N=>{let D={...N};if(N.endpoint&&o){const M=o.resolveBindings(N.endpoint,a,{skipCache:!0});D.endpoint=M}if(N.params&&o){const M={};Object.entries(N.params).forEach(([L,z])=>{typeof z=="string"?M[L]=o.resolveBindings(z,a,{skipCache:!0}):M[L]=z}),D.params=M}return D});d&&Sr.log(`[ModalDataSourceWrapper] Modal "${e}" fetching data sources:`,A.map(N=>({id:N.id,endpoint:N.endpoint})));const R=await w.current.fetchDataSourcesWithResults(A,C,k);i&&R.forEach(N=>{if(N.state==="success"&&N.data!==void 0){const D=A.find(M=>M.id===N.id);if(D?.initGlobal){const M=N.data?.data??N.data,L=Array.isArray(D.initGlobal)?D.initGlobal:[D.initGlobal];for(const z of L)if(typeof z=="string")i({[z]:M}),d&&Sr.log(`[ModalDataSourceWrapper] Modal "${e}" initGlobal: ${N.id}.data -> _global.${z}`);else if(typeof z=="object"&&z.key){const{key:Y,path:he}=z,be=he?Bj(M,he):M;i({[Y]:be}),d&&Sr.log(`Modal "${e}" initGlobal: ${N.id}.data${he?"."+he:""} -> _global.${Y}`)}}}else N.state==="error"&&Sr.error(`Modal "${e}" data source error:`,N.id,N.error)}),d&&Sr.log(`Modal "${e}" data sources fetched successfully`)}catch(C){Sr.error(`Modal "${e}" data source fetch error:`,C)}finally{f(!1),x(!0)}}},[n,a,i,o,e,d]);return j.useEffect(()=>{if(!n||n.length===0)return;const C=window.__templateApp;return C?.registerModalDataSources&&C.registerModalDataSources(e,n),()=>{C?.unregisterModalDataSources&&C.unregisterModalDataSources(e)}},[e,n]),j.useEffect(()=>{!r&&y.current&&(x(!1),d&&Sr.log(`[ModalDataSourceWrapper] Modal "${e}" closed, reset fetch state`)),r&&!y.current&&n&&n.length>0&&!p&&v(),y.current=r},[r,n,p,v,e,d]),l.jsx(l.Fragment,{children:g})};class $c extends Error{constructor(n,a,i={}){super(a);H(this,"code");H(this,"userMessageKey");H(this,"showStack");H(this,"icon");H(this,"recoverable");this.name="TemplateEngineError",this.code=n,this.userMessageKey=a,this.showStack=i.showStack??!0,this.icon=i.icon??"fa-circle-exclamation",this.recoverable=i.recoverable??!0,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}getUserMessage(n,a){if(!a||!n)return this.userMessageKey;try{return a.translate(this.userMessageKey,n)}catch{return this.userMessageKey}}}class qj extends $c{constructor(){super("TEMPLATE_NOT_FOUND","$t:core.errors.template_not_found",{showStack:!1,icon:"fa-paint-brush",recoverable:!1}),this.name="TemplateNotFoundError"}}function Xy(r){if(r instanceof $c)return r;if(r instanceof Error){const e=new $c("TEMPLATE_INIT_ERROR",r.message||"$t:core.errors.template_init_error",{showStack:!0,icon:"fa-circle-exclamation",recoverable:!0});return e.stack=r.stack,e}return new $c("TEMPLATE_INIT_ERROR","$t:core.errors.template_init_error",{showStack:!1,icon:"fa-circle-exclamation",recoverable:!0})}const ui=at("Router");class Gj{constructor(e){H(this,"routes",[]);H(this,"templateIdentifier");H(this,"eventHandlers",new Map);H(this,"pendingNavigation",null);H(this,"isNavigating",!1);H(this,"handlePopState",()=>{this.navigateToCurrentPath()});this.templateIdentifier=e,this.initPopstateListener()}initPopstateListener(){window.addEventListener("popstate",this.handlePopState)}on(e,n){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(n)}async emit(e,...n){const a=this.eventHandlers.get(e);a&&await Promise.all(a.map(i=>i(...n)))}async loadRoutes(){try{const e=await fetch(`/api/templates/${this.templateIdentifier}/routes.json`);if(!e.ok)throw new Error(`Failed to load routes: ${e.statusText}`);const n=await e.json();if(!n.success)throw new Error("Failed to load routes from API");if(n.data&&Array.isArray(n.data.routes))this.routes=n.data.routes,ui.log(`Loaded ${this.routes.length} routes`);else throw new Error("Invalid routes data format")}catch(e){throw ui.error("Error loading routes:",e),e}}setRoutes(e){this.routes=e,ui.log(`Set ${this.routes.length} routes`)}match(e){for(const n of this.routes){const a=this.matchPattern(n.path,e);if(a!==null)return{route:n,params:a}}return null}matchPattern(e,n){const a=[];let i=e.replace(/:([^/]+)/g,(h,f)=>(a.push(f),"([^/]+)"));i.startsWith("*/")&&(i="(?:/[^/]+)?"+i.slice(1)),i=i.replace(/\//g,"\\/");const o=new RegExp(`^${i}$`),d=n.match(o);if(!d)return null;const g={};return a.forEach((h,f)=>{g[h]=d[f+1]}),g}getRoutes(){return[...this.routes]}getAuthType(e,n){return e.auth_type?e.auth_type:n.startsWith("/admin")?"admin":"user"}async navigateToCurrentPath(){const e=window.location.pathname,n=window.location.search,a=this.match(e);if(!a){ui.warn(`No route matched for path: ${e}`),this.emit("routeNotFound",e);return}if(a.route.redirect){ui.log(`Redirecting from ${e} to ${a.route.redirect}`),this.navigate(a.route.redirect);return}if(a.route.auth_required){const d=this.getAuthType(a.route,e),g=as.getInstance();let h=g.isAuthenticated()&&g.getAuthType()===d;if(h||(h=await g.checkAuth(d)),!h){const f=g.getLoginRedirectUrl(d,e+n);ui.log(`Not authenticated, redirecting to: ${f}`),window.location.href=f;return}}const i=new URLSearchParams(n),o={};for(const d of i.keys()){if(d in o)continue;const g=i.getAll(d);g.length>1?o[d]=g:g.length===1&&(d.endsWith("[]")?o[d]=g:o[d]=g[0])}await this.emit("routeChange",{path:e,layout:a.route.layout,endpoint:a.route.endpoint,params:{...a.route.params||{},...a.params},query:o,auth_required:a.route.auth_required,auth_type:a.route.auth_type,meta:a.route.meta})}navigate(e){if(this.isNavigating){this.pendingNavigation=e;return}this.executeNavigation(e)}async executeNavigation(e){this.isNavigating=!0,this.pendingNavigation=null;try{window.history.pushState({},"",e),await this.navigateToCurrentPath()}finally{if(this.isNavigating=!1,this.pendingNavigation){const n=this.pendingNavigation;this.executeNavigation(n)}}}}const Fj=at("ErrorDisplay");class Qy{static render(e,n){const a=document.getElementById(e);if(!a){Fj.error(`Container #${e} not found`);return}const i=n.debug&&n.showStack&&n.stackTrace,o=window.matchMedia("(prefers-color-scheme: dark)").matches,d={container:`
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: ${o?"#111827":"#f9fafb"};
padding: 1rem;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
`,card:`
max-width: 28rem;
width: 100%;
background-color: ${o?"#1f2937":"#ffffff"};
border-radius: 0.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
padding: 2rem;
text-align: center;
`,iconContainer:`
margin-bottom: 1.5rem;
`,icon:`
font-size: 4rem;
color: #ef4444;
`,title:`
font-size: 1.5rem;
font-weight: 700;
color: ${o?"#ffffff":"#111827"};
margin-bottom: 1rem;
`,message:`
color: ${o?"#d1d5db":"#4b5563"};
margin-bottom: 0.5rem;
line-height: 1.625;
`,detailMessage:`
font-size: 0.875rem;
color: ${o?"#9ca3af":"#6b7280"};
margin-bottom: 1.5rem;
background-color: ${o?"#374151":"#f3f4f6"};
padding: 0.5rem 0.75rem;
border-radius: 0.25rem;
`,spacer:`
margin-bottom: 1.5rem;
`,stackContainer:`
margin-top: 1.5rem;
padding: 1rem;
background-color: ${o?"#374151":"#f3f4f6"};
border-radius: 0.375rem;
text-align: left;
`,stackTitle:`
font-size: 0.875rem;
font-weight: 600;
color: ${o?"#e5e7eb":"#374151"};
margin-bottom: 0.5rem;
`,stackTrace:`
font-size: 0.75rem;
color: ${o?"#d1d5db":"#4b5563"};
overflow-x: auto;
white-space: pre-wrap;
word-break: break-word;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
`,buttonContainer:`
margin-top: 1.5rem;
`,button:`
display: inline-flex;
align-items: center;
padding: 0.75rem 1.5rem;
background-color: #2563eb;
color: #ffffff;
font-weight: 500;
border-radius: 0.375rem;
border: none;
cursor: pointer;
transition: background-color 0.2s;
`};a.innerHTML=`
<div style="${d.container}">
<div style="${d.card}">
<!-- 아이콘 -->
<div style="${d.iconContainer}">
<i class="fa-solid ${n.icon}" style="${d.icon}"></i>
</div>
<!-- 제목 -->
<h1 style="${d.title}">
${this.escapeHtml(n.title)}
</h1>
<!-- 사용자 메시지 -->
<p style="${d.message}">
${this.escapeHtml(n.message)}
</p>
<!-- 상세 메시지 (API 응답 등) -->
${n.detailMessage?`
<p style="${d.detailMessage}">
${this.escapeHtml(n.detailMessage)}
</p>
`:`<div style="${d.spacer}"></div>`}
<!-- Stack Trace (디버그 모드일 때만) -->
${i?`
<div style="${d.stackContainer}">
<p style="${d.stackTitle}">
Stack Trace:
</p>
<pre style="${d.stackTrace}">${this.escapeHtml(n.stackTrace)}</pre>
</div>
`:""}
<!-- 새로고침 버튼 (복구 가능할 때만) -->
${n.showReloadButton?`
<div style="${d.buttonContainer}">
<button
onclick="window.location.reload()"
style="${d.button}"
onmouseover="this.style.backgroundColor='#1d4ed8'"
onmouseout="this.style.backgroundColor='#2563eb'"
>
<i class="fa-solid fa-rotate-right" style="margin-right: 0.5rem;"></i>
새로고침
</button>
</div>
`:""}
</div>
</div>
`}static renderFromError(e,n,a,i=!1,o,d,g){let h,f;if(n.userMessageKey.startsWith("$t:"))if(d&&o)try{h=d.translate(n.userMessageKey,o)}catch{h=n.userMessageKey.replace("$t:","")}else h=n.userMessageKey.replace("$t:","");else h=n.userMessageKey;if(g){const p=g;p.details?.apiMessage?f=p.details.apiMessage:p.response?.data?.message&&(f=p.response.data.message)}this.render(e,{title:a,message:h,detailMessage:f,icon:n.icon,showStack:n.showStack,stackTrace:n.stack,showReloadButton:n.recoverable,debug:i})}static escapeHtml(e){if(!e)return"";const n=document.createElement("div");return n.textContent=e,n.innerHTML}}const Ft=at("ErrorPageHandler");class Vj{constructor(e){H(this,"templateId");H(this,"layoutLoader");H(this,"locale");H(this,"debug");H(this,"renderFunction");H(this,"dataSourceManager");H(this,"globalState");H(this,"errorConfig",null);H(this,"configLoaded",!1);this.templateId=e.templateId,this.layoutLoader=e.layoutLoader,this.locale=e.locale,this.debug=e.debug,this.renderFunction=e.renderFunction,this.dataSourceManager=e.dataSourceManager,this.globalState=e.globalState||{}}async loadConfig(){if(this.configLoaded)return this.errorConfig;try{const e=await fetch(`/api/templates/${this.templateId}/config.json`);if(!e.ok)return this.debug&&Ft.warn("Failed to load template config:",e.statusText),this.configLoaded=!0,null;const n=await e.json();if(!n.success||!n.data)return this.debug&&Ft.warn("Invalid template config response"),this.configLoaded=!0,null;const a=n.data;return!a.error_config||!a.error_config.layouts?(this.debug&&Ft.warn("No error_config found in template.json"),this.configLoaded=!0,null):(this.errorConfig=a.error_config,this.configLoaded=!0,this.debug&&Ft.log("Error config loaded:",this.errorConfig),this.errorConfig)}catch(e){return Ft.error("Failed to load error config:",e),this.configLoaded=!0,null}}async renderError(e,n="app"){try{const a=await this.loadConfig();if(!a)return this.debug&&Ft.warn("No error config available, cannot render error page"),!1;const i=a.layouts[e]||a.layouts[String(e)];if(!i)return this.debug&&Ft.warn(`No layout defined for error code: ${e}`),!1;this.debug&&Ft.log(`Loading error layout: ${i} for code: ${e}`);const o=await this.layoutLoader.loadLayout(this.templateId,i);if(!o)return this.debug&&Ft.error(`Failed to load error layout: ${i}`),!1;this.debug&&Ft.log("Error layout loaded:",o);let d={};const g=o.data_sources||[];if(g.length>0){this.debug&&Ft.log("Fetching data sources:",g.map(w=>w.id));const p=g.filter(w=>w.loading_strategy==="blocking"),x=g.filter(w=>!w.loading_strategy||w.loading_strategy==="progressive"),y=[...p,...x];if(y.length>0)try{d=await this.dataSourceManager.fetchDataSources(y,{},new URLSearchParams),this.debug&&Ft.log("Data sources fetched:",Object.keys(d))}catch(w){Ft.error("Failed to fetch data sources:",w)}}const h={};g.length>0&&(this.processInitOptions(g,d,h),this.debug&&Ft.log("initOptions processed:",{globalKeys:Object.keys(this.globalState),localKeys:Object.keys(h)}));const f={...d,errorCode:e,_global:{...this.globalState},_local:{...h}};return await this.renderFunction({containerId:n,layoutJson:o,dataContext:f,translationContext:{templateId:this.templateId,locale:this.locale}}),this.debug&&Ft.log(`Error page ${e} rendered successfully`),!0}catch(a){return Ft.error(`Failed to render error page ${e}:`,a),!1}}processInitOptions(e,n,a){for(const i of e){const o=n[i.id];if(!o)continue;const d=o?.data??o;if(i.initLocal){if(typeof i.initLocal=="string")a[i.initLocal]=d,Ft.log(`initLocal: ${i.id}.data -> _local.${i.initLocal}`);else if(typeof i.initLocal=="object"&&"key"in i.initLocal){const{key:g,path:h}=i.initLocal;a[g]=h?this.getValueByPath(d,h):d,Ft.log(`initLocal: ${i.id}.data${h?"."+h:""} -> _local.${g}`)}}if(i.initGlobal){const g=Array.isArray(i.initGlobal)?i.initGlobal:[i.initGlobal];for(const h of g)if(typeof h=="string")this.globalState[h]=d,Ft.log(`initGlobal: ${i.id}.data -> _global.${h}`);else if(typeof h=="object"&&h!==null&&"key"in h){const{key:f,path:p}=h;this.globalState[f]=p?this.getValueByPath(d,p):d,Ft.log(`initGlobal: ${i.id}.data${p?"."+p:""} -> _global.${f}`)}}}}getValueByPath(e,n){return n.split(".").reduce((a,i)=>a?.[i],e)}updateGlobalState(e){this.globalState={...this.globalState,...e}}updateLocale(e){this.locale=e,this.debug&&Ft.log("Locale updated:",e)}isConfigLoaded(){return this.configLoaded}async hasErrorLayout(e){const n=await this.loadConfig();return n?!!(n.layouts[e]||n.layouts[String(e)]):!1}clearConfigCache(){this.errorConfig=null,this.configLoaded=!1,this.debug&&Ft.log("Config cache cleared")}}const Tn=at("ModuleAssetLoader");class Kj{constructor(){H(this,"loadedAssets",new Map);H(this,"loadingPromises",new Map)}async loadActiveExtensionAssets(e){if(!e||e.length===0){Tn.log("No module assets to load");return}const n=[...e].sort((i,o)=>i.priority-o.priority);Tn.log("Loading module assets:",n.map(i=>i.identifier));const a=n.filter(i=>i.css).map(i=>this.loadCSS(i.identifier,i.css));await Promise.all(a),Tn.log("All CSS assets loaded");for(const i of n)i.js&&await this.loadJS(i.identifier,i.js);Tn.log("All module assets loaded successfully")}async loadCSS(e,n){const a=`module-css-${e}`;if(document.getElementById(a)){Tn.log(`CSS already loaded: ${e}`);return}return new Promise((i,o)=>{const d=document.createElement("link");d.rel="stylesheet",d.href=n,d.id=a,d.onload=()=>{Tn.log(`CSS loaded: ${e}`),this.registerLoadedAsset(e,{type:"css",element:d}),i()},d.onerror=()=>{Tn.warn(`Failed to load CSS: ${e} (${n})`),i()},document.head.appendChild(d)})}async loadJS(e,n){const a=`module-js-${e}`;if(document.getElementById(a)){Tn.log(`JS already loaded: ${e}`);return}const i=this.loadingPromises.get(e);if(i)return Tn.log(`JS already loading: ${e}`),i;const o=new Promise((d,g)=>{const h=document.createElement("script");h.src=n,h.id=a,h.async=!1,h.onload=()=>{Tn.log(`JS loaded: ${e}`),this.registerLoadedAsset(e,{type:"js",element:h}),this.loadingPromises.delete(e),d()},h.onerror=()=>{Tn.warn(`Failed to load JS: ${e} (${n})`),this.loadingPromises.delete(e),d()},document.head.appendChild(h)});return this.loadingPromises.set(e,o),o}registerLoadedAsset(e,n){const a=this.loadedAssets.get(e)||[];a.push(n),this.loadedAssets.set(e,a)}unloadExtensionAsset(e){const n=this.loadedAssets.get(e);if(!n||n.length===0){Tn.log(`No assets to unload for: ${e}`);return}n.forEach(a=>{a.element.parentNode&&(a.element.parentNode.removeChild(a.element),Tn.log(`${a.type.toUpperCase()} unloaded: ${e}`))}),this.loadedAssets.delete(e),Tn.log(`All assets unloaded for: ${e}`)}unloadAllAssets(){Array.from(this.loadedAssets.keys()).forEach(n=>{this.unloadExtensionAsset(n)}),Tn.log("All module assets unloaded")}isLoaded(e){return this.loadedAssets.has(e)}getLoadedModules(){return Array.from(this.loadedAssets.keys())}}let zg=null;function Wj(){return zg||(zg=new Kj),zg}function Yj(){if(typeof window>"u")return[];const r=window.G7Config;if(!r?.moduleAssets)return[];const e=[];for(const[n,a]of Object.entries(r.moduleAssets)){const i=a;e.push({identifier:n,js:i.js,css:i.css,priority:i.priority,external:i.external})}return e}function Jj(){if(typeof window>"u")return[];const r=window.G7Config;if(!r?.pluginAssets)return[];const e=[];for(const[n,a]of Object.entries(r.pluginAssets)){const i=a;e.push({identifier:n,js:i.js,css:i.css,priority:i.priority,external:i.external})}return e}const Hg=at("SystemBannerManager");class Ic{static show(e){this.banners.set(e.id,e),this.render(),Hg.log(`Banner shown: ${e.id}`)}static hide(e){this.banners.delete(e)&&(this.render(),Hg.log(`Banner hidden: ${e}`))}static hideAll(){this.banners.clear(),this.render(),Hg.log("All banners hidden")}static detectLocale(){try{const n=window.G7Core;if(n?.locale?.current)return n.locale.current()}catch{}return(navigator.language||"ko").split("-")[0]}static resolveMessage(e,n){return typeof e=="string"?e:e[n]||e.en||e.ko||Object.values(e)[0]||""}static render(){if(typeof document>"u")return;let e=document.getElementById(this.containerId);if(this.banners.size===0){e&&(e.remove(),this.adjustAppPadding(0));return}e||(e=document.createElement("div"),e.id=this.containerId,e.style.cssText="position:fixed;top:0;left:0;right:0;z-index:99999;",document.body.prepend(e));const n=Array.from(this.banners.values()).sort((i,o)=>(i.order??0)-(o.order??0)),a=this.detectLocale();e.innerHTML=n.map(i=>{const o=this.resolveMessage(i.message,a),d=i.background||"#f59e0b",g=i.color||"white";return`<div data-banner-id="${i.id}" style="background:${d};color:${g};text-align:center;padding:8px 16px;font-size:14px;font-weight:500;">${o}</div>`}).join(""),requestAnimationFrame(()=>{e&&this.adjustAppPadding(e.offsetHeight)})}static adjustAppPadding(e){const n=document.getElementById("app");n&&(n.style.paddingTop=e>0?`${e}px`:"")}}H(Ic,"banners",new Map),H(Ic,"containerId","g7-system-banners");const V=at("TemplateApp");function Xj(r){const e={};for(const n of r.keys()){if(n in e)continue;const a=r.getAll(n);a.length>1?e[n]=a:a.length===1&&(n.endsWith("[]")?e[n]=a:e[n]=a[0])}return e}const Ea=class Ea{constructor(e){H(this,"router",null);H(this,"layoutLoader",null);H(this,"errorPageHandler",null);H(this,"config");H(this,"globalState");H(this,"globalStateListeners",new Set);H(this,"currentRouteChangeId",0);H(this,"currentDataSources",[]);H(this,"currentRouteParams",{});H(this,"currentQueryParams",new URLSearchParams);H(this,"currentFetchedData",{});H(this,"currentLayoutName","");H(this,"templateErrorHandling",null);H(this,"currentWebSocketSubscriptions",[]);H(this,"extensionCacheVersion",0);H(this,"currentGlobalHeaders",[]);H(this,"transitionOverlayEl",null);H(this,"skeletonOverlayRoot",null);H(this,"skeletonOverlayContainer",null);H(this,"_spinnerState",null);H(this,"modalDataSources",new Map);this.globalState={sidebarOpen:!1},this.loadG7Config(),this.migrateLocaleStorage();const n=this.loadLocaleFromStorage(),a=n||e.locale||"ko";this.config={...e,locale:a},!n&&e.locale&&this.saveLocaleToStorage(e.locale)}loadG7Config(){if(typeof window<"u"&&window.G7Config){const e=window.G7Config;e.settings&&(this.globalState.settings=e.settings,V.log("Loaded settings from G7Config:",Object.keys(e.settings)),e.settings.upload&&(this.globalState.uploadSettings=e.settings.upload)),e.plugins&&(this.globalState.plugins=e.plugins,V.log("Loaded plugin settings from G7Config:",Object.keys(e.plugins))),e.modules&&(this.globalState.modules=e.modules,V.log("Loaded module settings from G7Config:",Object.keys(e.modules))),e.appConfig&&(this.globalState.appConfig=e.appConfig,V.log("Loaded appConfig from G7Config:",Object.keys(e.appConfig)))}}resolveRouteExpressions(e){const n=new _n,a={_global:this.globalState};return e.map(i=>{const o={...i};if(o.path&&o.path.includes("{{")){const d=o.path;o.path=n.resolveBindings(o.path,a),o.path=o.path.replace(/\/\/+/g,"/")||"/",o.path.includes("{{")&&(V.warn("Route expression resolution failed, using fallback:",d),o.path=d.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/")}if(o.redirect&&o.redirect.includes("{{")){const d=o.redirect;o.redirect=n.resolveBindings(o.redirect,a),o.redirect=o.redirect.replace(/\/\/+/g,"/")||"/",o.redirect.includes("{{")&&(V.warn("Route redirect expression resolution failed:",d),o.redirect=d.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/")}return o})}migrateLocaleStorage(){const e=["locale","g7_template_locale"];for(const n of e)try{const a=localStorage.getItem(n);a&&a!==localStorage.getItem(Ea.LOCALE_STORAGE_KEY)&&(localStorage.setItem(Ea.LOCALE_STORAGE_KEY,a),V.log(`Migrated locale from '${n}' to '${Ea.LOCALE_STORAGE_KEY}'`)),localStorage.removeItem(n)}catch(a){V.warn(`Failed to migrate locale key '${n}':`,a)}}async init(){try{io.getInstance().setDebug(this.config.debug),V.log("Initializing with config:",this.config);const e=ya.getInstance(),n=as.getInstance(),a=this.loadCacheVersionFromStorage()||0,[i,o,d,g,h]=await Promise.all([Lo({templateId:this.config.templateId,templateType:this.config.templateType,locale:this.config.locale,debug:this.config.debug,cacheVersion:a}),e.loadComponents(this.config.templateId,this.config.templateType),fetch(`/api/templates/${this.config.templateId}/routes.json${a>0?`?v=${a}`:""}`).then(C=>{if(!C.ok)throw new Error(`Failed to load routes: ${C.statusText}`);return C.json()}).then(C=>{if(!C.success)throw new Error("Failed to load routes from API");return C.data}).catch(C=>{throw V.error("Error loading routes:",C),C}),n.preloadAuth(this.config.templateType==="admin"?"admin":"user"),fetch(`/api/templates/${this.config.templateId}/config.json`).then(C=>C.ok?C.json():null).then(C=>!C?.success||!C?.data?null:C.data).catch(C=>(V.warn("Error loading template config:",C),null))]);if(V.log("Template Engine initialized"),V.log("ComponentRegistry loaded"),V.log("Routes data loaded"),V.log("User info preloaded"),V.log("Template config loaded:",h),h?.cache_version!==void 0){const C=this.loadCacheVersionFromStorage();if(this.extensionCacheVersion=h.cache_version,this.saveCacheVersionToStorage(this.extensionCacheVersion),V.log("Extension cache version:",this.extensionCacheVersion),C!==null&&C!==this.extensionCacheVersion){V.log("Cache version changed, reloading routes...");const k=await fetch(`/api/templates/${this.config.templateId}/routes.json?v=${this.extensionCacheVersion}`).then(A=>{if(!A.ok)throw new Error(`Failed to reload routes: ${A.statusText}`);return A.json()}).then(A=>{if(!A.success)throw new Error("Failed to reload routes from API");return A.data});Array.isArray(k.routes)&&(k.routes=this.resolveRouteExpressions(k.routes),Object.assign(d,k),V.log("Routes reloaded with new cache version"));try{const{TranslationEngine:A}=await Promise.resolve().then(()=>Up),R=A.getInstance();R.setCacheVersion(this.extensionCacheVersion);const N=this.config.locale||"ko",D="en";await R.loadTranslations(this.config.templateId,N,"/api",!0),N!==D&&await R.loadTranslations(this.config.templateId,D,"/api",!0),V.log("Translations reloaded with new cache version")}catch(A){V.error("Failed to reload translations:",A)}}}h?.errorHandling&&(this.templateErrorHandling=h.errorHandling,va().setTemplateConfig(this.templateErrorHandling),V.log("Template errorHandling registered:",this.templateErrorHandling)),n.on("logout",()=>{V.log("User logged out")}),n.on("authStateChange",C=>{V.log("Auth state changed:",C)}),V.log("AuthManager event handlers registered");const f=ns(),p=this.config.templateType==="admin"?"admin":"user",x=n.getConfig(p);f.setOnUnauthorized(()=>{V.log("Unauthorized - redirecting to login page"),f.removeToken();const C=window.location.pathname+window.location.search,k=n.getLoginRedirectUrl(p,C);window.location.href=k}),V.log("ApiClient onUnauthorized callback registered"),this.layoutLoader=new Rg(e),this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),V.log("LayoutLoader initialized:",this.layoutLoader);const y=new is({onUnauthorized:()=>{V.warn("Unauthorized request in error page")}});if(this.errorPageHandler=new Vj({templateId:this.config.templateId,layoutLoader:this.layoutLoader,locale:this.config.locale,debug:this.config.debug,renderFunction:Mo,dataSourceManager:y,globalState:this.globalState}),V.log("ErrorPageHandler initialized with DataSourceManager"),await this.handleServerError()){V.log("Server error handled, skipping normal initialization");return}if(this.router=new Gj(this.config.templateId),Array.isArray(d.routes)){const C=this.resolveRouteExpressions(d.routes);this.router.setRoutes(C)}else throw new Error("Invalid routes data format");V.log("Router initialized:",this.router),V.log("Routes set:",this.router.getRoutes());const{getActionDispatcher:w}=await Promise.resolve().then(()=>qa),v=w();v&&(v.setDefaultContext({navigate:C=>this.router?.navigate(C)}),v.setGlobalStateUpdater(C=>this.setGlobalState(C)),V.log("Navigate function and setGlobalState injected to ActionDispatcher")),await this.loadExtensionAssets(),this.reinitializeTemplateHandlers(),this.router.on("routeChange",C=>this.handleRouteChange(C)),this.router.on("routeNotFound",C=>this.handleRouteNotFound(C)),this.router.navigateToCurrentPath(),V.log("Template App initialized successfully")}catch(e){V.error("Initialization failed:",e),this.showInitError(e)}}async loadExtensionAssets(){try{const e=Wj(),n=Yj();n.length>0&&(V.log("Loading module assets:",n.map(i=>i.identifier)),await e.loadActiveExtensionAssets(n));const a=Jj();a.length>0&&(V.log("Loading plugin assets:",a.map(i=>i.identifier)),await e.loadActiveExtensionAssets(a)),(n.length>0||a.length>0)&&V.log("Extension assets loaded successfully")}catch(e){V.warn("Failed to load extension assets:",e)}}async handleRouteChange(e){const n=++this.currentRouteChangeId;window.__g7ForcedLocalFields=void 0,window.__g7ActionContext=void 0,window.__g7PendingLocalState=void 0,window.__g7LastSetLocalSnapshot=void 0,window.__g7SetLocalOverrideKeys=void 0,window.__g7SequenceLocalSync=void 0;try{if(V.log("Route changed:",e,"requestId:",n),!this.layoutLoader)throw new Error("LayoutLoader is not initialized");if(!e.layout)throw new Error("Route layout is not defined");let a=e.layout;const i=a==="__preview__";i&&e.params?.token&&(a=`__preview__/${e.params.token}`);const o=await this.layoutLoader.loadLayout(this.config.templateId,a);if(n!==this.currentRouteChangeId){V.log("Route change cancelled (newer request exists):",n);return}V.log("Layout loaded:",o);const d=va();o.errorHandling?(d.setLayoutConfig(o.errorHandling),V.log("Layout errorHandling registered:",o.errorHandling)):d.clearLayoutConfig();const g=o.data_sources||[],h=e.query||{},f=new URLSearchParams;for(const[F,Q]of Object.entries(h))if(Array.isArray(Q))for(const pe of Q)f.append(F,pe);else f.set(F,Q);const p={route:e.params||{},query:h,_global:this.globalState};o.scripts&&Array.isArray(o.scripts)&&await this.loadLayoutScripts(o.scripts,p);const{DataSourceManager:x,getActionDispatcher:y}=await Promise.resolve().then(()=>qa),w=new x;if(i){const F=y();F&&F.setPreviewMode(!0),this.setGlobalState({__isPreview:!0}),Ic.show({id:"preview-mode",message:{ko:"⚠ 미리보기 모드 — 페이지 이동이 비활성화됩니다",en:"⚠ Preview Mode — Navigation is disabled"},background:"linear-gradient(90deg, #f59e0b, #d97706)",color:"white"}),V.log("Preview mode activated")}else{const F=y();F?.isPreviewMode()&&(F.setPreviewMode(!1),Ic.hide("preview-mode"))}if(this.currentGlobalHeaders=o.globalHeaders||[],this.currentGlobalHeaders.length>0){w.setGlobalHeaders(this.currentGlobalHeaders);const F=y();F&&F.setGlobalHeaders(this.currentGlobalHeaders),V.log("globalHeaders set:",this.currentGlobalHeaders.map(Q=>Q.pattern))}if(o.named_actions&&Object.keys(o.named_actions).length>0){const F=y();F&&F.setNamedActions(o.named_actions)}const v=w.filterByCondition(g,p);g.length!==v.length&&V.log("Data sources filtered by condition:",{before:g.map(F=>F.id),after:v.map(F=>F.id)});const C=v.filter(F=>F.loading_strategy==="blocking"),k=v.filter(F=>(F.loading_strategy||"progressive")!=="blocking");if(C.length>0&&o.transition_overlay){const F=typeof o.transition_overlay=="boolean"?{enabled:o.transition_overlay,style:"opaque"}:o.transition_overlay;F.enabled&&F.style==="skeleton"&&F.skeleton?.component&&F.target?this.renderSkeletonOverlay(F.target,F.skeleton,o,F.fallback_target):F.enabled&&F.style==="spinner"&&F.target&&this.renderSpinnerOverlay(F.target,F.spinner,F.fallback_target)}let A={},R={},N={},D={};this.currentWebSocketSubscriptions.length>0&&(V.log("Unsubscribing previous WebSocket subscriptions:",this.currentWebSocketSubscriptions),w.unsubscribeWebSockets(this.currentWebSocketSubscriptions),this.currentWebSocketSubscriptions=[]),this.currentDataSources=v,this.currentRouteParams=e.params||{},this.currentQueryParams=f,V.log(`handleRouteChange #${n} - queryObject:`,h),V.log(`handleRouteChange #${n} - queryParams:`,f.toString()),C.length>0&&(V.log("Fetching blocking data sources:",C.map(Q=>Q.id)),(await w.fetchDataSourcesWithResults(C,e.params||{},f)).forEach(Q=>{if(Q.state==="success"&&Q.data!==void 0)A[Q.id]=Q.data;else if(Q.state==="error"&&Q.error){const pe=Q.error,$=pe.response?.data?.message;R[Q.id]={message:$||Q.error.message,status:pe.response?.status||pe.status}}}),this.processInitOptions(C,A,N,D),this.currentFetchedData={...A},V.log("Blocking data loaded:",Object.keys(A)),Object.keys(R).length>0&&V.log("Data source errors:",R),Object.keys(N).length>0&&V.log("Local state init (blocking):",Object.keys(N)),Object.keys(D).length>0&&V.log("Isolated state init (blocking):",Object.keys(D)));const M=k.length>0;if(M&&(Pa.setPending(!0),V.log("Transition started before rendering")),n!==this.currentRouteChangeId){V.log("Route change cancelled after blocking data (newer request exists):",n);return}const{getState:L}=await Promise.resolve().then(()=>qa),z=L().currentDataContext||{},Y=k.map(F=>F.id),he={};if(M){Y.forEach(Q=>{z[Q]!==void 0?he[Q]=z[Q]:he[Q]=void 0});const F=Object.keys(he).filter(Q=>he[Q]!==void 0);F.length>0&&V.log("Preserving previous progressive data:",F),V.log("Progressive data sources initialized:",Y)}const be=o.defines||{},X={...he,...e.params,...A,route:{...e.params||{},path:e.path},query:h,_global:{...this.globalState},_globalSetState:F=>this.setGlobalState(F),_dataSourceErrors:Object.keys(R).length>0?R:void 0,_localInit:Object.keys(N).length>0?N:void 0,_isolatedInit:Object.keys(D).length>0?D:void 0,_defines:Object.keys(be).length>0?be:void 0};if(o.computed&&Object.keys(o.computed).length>0){const F=this.calculateComputed(o.computed,X);Object.keys(F).length>0&&(X._computed=F,this.globalState._computed=F,V.log("Computed values calculated:",Object.keys(F))),X._computedDefinitions=o.computed}const ge=o.layout_name||e.layout;this.currentLayoutName!==""&&this.currentLayoutName!==ge&&(V.log("_local reset due to layout change:",{from:this.currentLayoutName,to:ge}),this.globalState._local={}),this.currentLayoutName=ge;const le=o.initLocal||o.state;if(le&&Object.keys(le).length>0){this.globalState._local||(this.globalState._local={});for(const[F,Q]of Object.entries(le))this.globalState._local[F]===void 0&&(this.globalState._local[F]=JSON.parse(JSON.stringify(Q)));X._local={...this.globalState._local},V.log("initLocal applied to _local:",Object.keys(le))}if(o.initGlobal&&Object.keys(o.initGlobal).length>0){for(const[F,Q]of Object.entries(o.initGlobal))this.globalState[F]===void 0&&(this.globalState[F]=JSON.parse(JSON.stringify(Q)));V.log("initGlobal applied to _global:",Object.keys(o.initGlobal))}if(o.initIsolated&&Object.keys(o.initIsolated).length>0){for(const[F,Q]of Object.entries(o.initIsolated))D[F]===void 0&&(D[F]=JSON.parse(JSON.stringify(Q)));V.log("initIsolated applied:",Object.keys(o.initIsolated))}X._global={...this.globalState,layoutWarnings:o.warnings||[]};const je=o.initActions||o.init_actions;if(je&&je.length>0){await this.executeInitActions(je,X),V.log("initActions executed before render");const F=this.globalState;if(F._local){if(Object.keys(N).length>0){for(const[Q,pe]of Object.entries(N))F._local[Q]!==void 0?F._local[Q]=this.deepMerge(F._local[Q],pe):F._local[Q]=pe;V.log("localInit merged into _local after initActions:",Object.keys(N))}X._local=F._local,V.log("_local merged into dataContext:",F._local)}if(X._global={...this.globalState,layoutWarnings:o.warnings||[]},V.log("_global merged into dataContext after initActions"),o.computed&&Object.keys(o.computed).length>0){const Q=this.calculateComputed(o.computed,X);Object.keys(Q).length>0&&(X._computed=Q,this.globalState._computed=Q,V.log("Computed values recalculated after init_actions:",Object.keys(Q)))}if(Object.keys(this.currentFetchedData).length>0){for(const[Q,pe]of Object.entries(this.currentFetchedData))X[Q]=pe;V.log("Fetched data sources merged into dataContext after initActions:",Object.keys(this.currentFetchedData))}}o.transition_overlay&&!this.skeletonOverlayContainer&&this.showTransitionOverlay(o.transition_overlay,o),await Mo({containerId:"app",layoutJson:o,dataContext:X,translationContext:{templateId:this.config.templateId,locale:this.config.locale}}),V.log("Initial render complete with blocking data"),this.reattachSpinnerOverlay();const J=v.filter(F=>F.type==="websocket");if(J.length>0){V.log("Subscribing WebSocket data sources:",J.map(pe=>pe.id));const{updateTemplateData:F,getState:Q}=await Promise.resolve().then(()=>qa);this.currentWebSocketSubscriptions=w.subscribeWebSockets(v,(pe,$)=>{V.log(`WebSocket data received for: ${pe}`,$),this.currentFetchedData[pe]=$;const U=v.find(ie=>ie.id===pe),q=Q();if(q.bindingEngine){const ie=[pe];U?.initGlobal&&ie.push("_global"),U?.initLocal&&ie.push("_local"),q.bindingEngine.invalidateCacheByKeys(ie)}F({[pe]:$})}),V.log("WebSocket subscriptions established:",this.currentWebSocketSubscriptions)}if(k.length>0){if(n!==this.currentRouteChangeId){V.log("Route change cancelled before progressive fetch (newer request exists):",n),Pa.setPending(!1),this.hideTransitionOverlay();return}V.log("Fetching progressive/background data sources:",k.map(pe=>pe.id));const{updateTemplateData:F,getState:Q}=await Promise.resolve().then(()=>qa);try{const pe=k.map(async $=>{try{const q=(await w.fetchDataSourcesWithResults([$],e.params||{},f,this.globalState))[0];if(!q){V.log(`Data source ${$.id} skipped (no fetch result)`);return}if(n!==this.currentRouteChangeId){V.log(`Data source ${$.id} fetch cancelled (newer request exists)`);return}if(q.state==="success"&&q.data!==void 0){V.log(`Progressive data source loaded: ${$.id}`),this.currentFetchedData[$.id]=q.data;const ie={};this.processInitOptions([$],{[$.id]:q.data},ie);const se=Q();if(se.bindingEngine){const Ee=[$.id];$.initGlobal&&Ee.push("_global"),$.initLocal&&Ee.push("_local"),se.bindingEngine.invalidateCacheByKeys(Ee)}const we={[$.id]:q.data};Object.keys(ie).length>0&&(we._localInit=ie,Object.assign(N,ie)),$.initGlobal&&(we._global={...this.globalState}),F(we)}else if(q.state==="error"&&q.error){const ie=q.error,se=ie.response?.data?.message;R[$.id]={message:se||q.error.message,status:ie.response?.status||ie.status},V.log(`Progressive data source error: ${$.id}`,R[$.id]),F({[$.id]:null,_dataSourceErrors:{...R}})}}catch(U){V.error(`Failed to fetch data source: ${$.id}`,U)}});if(await Promise.all(pe),n!==this.currentRouteChangeId){V.log("Route change cancelled after progressive fetch (newer request exists):",n);return}V.log("All progressive data sources loaded")}finally{Pa.setPending(!1),this.hideTransitionOverlay()}}else this.hideTransitionOverlay();V.log("Layout rendered successfully")}catch(a){V.error("Route change handling failed:",a),this.hideTransitionOverlay(),this.showRouteError(a)}}processInitOptions(e,n,a,i){e.some(d=>d.refetchOnMount===!0&&d.initLocal)&&(a._forceLocalInit=Date.now(),V.log("refetchOnMount detected, forcing local state init")),e.forEach(d=>{const g=n[d.id];if(!g)return;const h=g.data??g;if(d.initLocal){if(typeof d.initLocal=="string"){let f=h;if(d.initLocalDefaults&&typeof d.initLocalDefaults=="object"){const x=this.evaluateDefaults(d.initLocalDefaults,n);f={...x,...h},V.log(`initLocalDefaults applied for ${d.initLocal}:`,Object.keys(x))}const p=this.globalState._local?.[d.initLocal];p!==void 0&&typeof p=="object"&&typeof f=="object"?(a[d.initLocal]=this.deepMerge(p,f),V.log(`initLocal (merged): ${d.id}.data -> _local.${d.initLocal}`)):(a[d.initLocal]=f,V.log(`initLocal: ${d.id}.data -> _local.${d.initLocal}`))}else if(typeof d.initLocal=="object"&&d.initLocal.key){const{key:f,path:p}=d.initLocal;let x=p?this.extractValueByPathOrExpression(h,p,d.id):h;if(d.initLocalDefaults&&typeof d.initLocalDefaults=="object"){const w=this.evaluateDefaults(d.initLocalDefaults,n);x={...w,...x},V.log(`initLocalDefaults applied for ${f}:`,Object.keys(w))}const y=this.globalState._local?.[f];y!==void 0&&typeof y=="object"&&typeof x=="object"?(a[f]=this.deepMerge(y,x),V.log(`initLocal (merged): ${d.id}.data${p?"."+p:""} -> _local.${f}`)):(a[f]=x,V.log(`initLocal: ${d.id}.data${p?"."+p:""} -> _local.${f}`))}else if(typeof d.initLocal=="object"){const f=d.initLocal._merge||"deep",p=this.flattenNestedObjectToMappings(d.initLocal);for(const{targetPath:x,sourcePath:y}of p){const w=this.extractValueByPathOrExpression(h,y,d.id);if(x.includes(".")){const v=x.split(".")[0];a[v]===void 0&&this.globalState._local?.[v]!==void 0&&(a[v]=JSON.parse(JSON.stringify(this.globalState._local[v]))),this.setValueAtPath(a,x,w,f),V.log(`initLocal map (${f}): ${d.id} ${y} -> _local.${x}`)}else{const v=this.globalState._local?.[x];f==="replace"?(a[x]=w,V.log(`initLocal map (replace): ${d.id} ${y} -> _local.${x}`)):f==="shallow"?v!==void 0&&typeof v=="object"&&typeof w=="object"?(a[x]={...v,...w},V.log(`initLocal map (shallow): ${d.id} ${y} -> _local.${x}`)):(a[x]=w,V.log(`initLocal map: ${d.id} ${y} -> _local.${x}`)):v!==void 0&&typeof v=="object"&&typeof w=="object"?(a[x]=this.deepMerge(v,w),V.log(`initLocal map (deep): ${d.id} ${y} -> _local.${x}`)):(a[x]=w,V.log(`initLocal map: ${d.id} ${y} -> _local.${x}`))}}}}if(d.initGlobal)if(typeof d.initGlobal=="object"&&!Array.isArray(d.initGlobal)&&!("key"in d.initGlobal))for(const[p,x]of Object.entries(d.initGlobal)){if(typeof x!="string"){V.warn(`initGlobal map value must be string, got ${typeof x} for key ${p}`);continue}const y=this.extractValueByPathOrExpression(h,x,d.id),w=this.globalState[p];w!==void 0&&typeof w=="object"&&typeof y=="object"?(this.globalState[p]=this.deepMerge(w,y),V.log(`initGlobal map (merged): ${d.id} ${x} -> _global.${p}`)):(this.globalState[p]=y,V.log(`initGlobal map: ${d.id} ${x} -> _global.${p}`))}else{const p=Array.isArray(d.initGlobal)?d.initGlobal:[d.initGlobal];for(const x of p)if(typeof x=="string"){const y=this.globalState[x];y!==void 0&&typeof y=="object"&&typeof h=="object"?(this.globalState[x]=this.deepMerge(y,h),V.log(`initGlobal (merged): ${d.id}.data -> _global.${x}`)):(this.globalState[x]=h,V.log(`initGlobal: ${d.id}.data -> _global.${x}`))}else if(typeof x=="object"&&x.key){const{key:y,path:w}=x,v=w?this.extractValueByPathOrExpression(h,w,d.id):h,C=this.globalState[y];C!==void 0&&typeof C=="object"&&typeof v=="object"?(this.globalState[y]=this.deepMerge(C,v),V.log(`initGlobal (merged): ${d.id}.data${w?"."+w:""} -> _global.${y}`)):(this.globalState[y]=v,V.log(`initGlobal: ${d.id}.data${w?"."+w:""} -> _global.${y}`))}}if(i&&d.initIsolated){if(typeof d.initIsolated=="string"){const f=i[d.initIsolated];f!==void 0&&typeof f=="object"&&typeof h=="object"?(i[d.initIsolated]=this.deepMerge(f,h),V.log(`initIsolated (merged): ${d.id}.data -> _isolated.${d.initIsolated}`)):(i[d.initIsolated]=h,V.log(`initIsolated: ${d.id}.data -> _isolated.${d.initIsolated}`))}else if(typeof d.initIsolated=="object"&&d.initIsolated.key){const{key:f,path:p}=d.initIsolated,x=p?this.extractValueByPathOrExpression(h,p,d.id):h,y=i[f];y!==void 0&&typeof y=="object"&&typeof x=="object"?(i[f]=this.deepMerge(y,x),V.log(`initIsolated (merged): ${d.id}.data${p?"."+p:""} -> _isolated.${f}`)):(i[f]=x,V.log(`initIsolated: ${d.id}.data${p?"."+p:""} -> _isolated.${f}`))}else if(typeof d.initIsolated=="object")for(const[f,p]of Object.entries(d.initIsolated)){if(typeof p!="string"){V.warn(`initIsolated map value must be string, got ${typeof p} for key ${f}`);continue}const x=this.extractValueByPathOrExpression(h,p,d.id),y=i[f];y!==void 0&&typeof y=="object"&&typeof x=="object"?(i[f]=this.deepMerge(y,x),V.log(`initIsolated map (merged): ${d.id} ${p} -> _isolated.${f}`)):(i[f]=x,V.log(`initIsolated map: ${d.id} ${p} -> _isolated.${f}`))}}})}evaluateDefaults(e,n){const a={};for(const[i,o]of Object.entries(e))if(typeof o=="string"&&o.startsWith("{{")&&o.endsWith("}}")){const d=o.slice(2,-2).trim();a[i]=this.evaluateExpression(d,n)}else a[i]=o;return a}evaluateExpression(e,n){try{const a=e.split("??").map(i=>i.trim());for(const i of a){if(/^['"].*['"]$/.test(i))return i.slice(1,-1);if(i==="true")return!0;if(i==="false")return!1;if(/^-?\d+(\.\d+)?$/.test(i))return Number(i);const o=this.getNestedValue(n,i);if(o!=null)return o}return}catch(a){V.warn(`Expression evaluation failed: ${e}`,a);return}}getNestedValue(e,n){const a=n.replace(/\?\./g,".");let i=e;const o=a.split(/\.(?![^\[]*\])/).flatMap(d=>{const g=d.match(/^([^\[]*)((?:\[\d+\])*)$/);if(g){const[,h,f]=g,p=[];h&&p.push(h);const x=f.match(/\[\d+\]/g);return x&&p.push(...x),p}return[d]}).filter(d=>d!=="");for(const d of o){if(i==null)return;if(d.startsWith("[")&&d.endsWith("]")){const g=parseInt(d.slice(1,-1),10);i=i[g]}else i=i[d]}return i}extractValueByPathOrExpression(e,n,a){const i=n.match(/^\{\{(.+)\}\}$/);if(i){const o=i[1].trim(),d=new _n,g={data:e,_global:this.globalState,_local:this.globalState._local||{}};try{const h=d.evaluateExpression(o,g);return V.log(`initLocal/initGlobal expression evaluated: ${n} -> `,h),h}catch(h){V.warn(`initLocal/initGlobal expression evaluation failed for ${a}:`,n,h);return}}return this.getNestedValue(e,n)}async loadLayoutScripts(e,n){const a=[];for(const i of e){if((i.if!==void 0||i.conditions!==void 0)&&!ti({if:i.if,conditions:i.conditions},n,this.bindingEngine,`script:${i.id}`)){V.log(`Script skipped (condition not met): ${i.id}`);continue}if(document.getElementById(i.id)){V.log(`Script already loaded: ${i.id}`);continue}const d=new Promise((g,h)=>{const f=document.createElement("script");f.src=i.src,f.id=i.id,f.async=i.async??!0,f.onload=()=>{V.log(`Script loaded successfully: ${i.id}`),g()},f.onerror=()=>{V.warn(`Failed to load script: ${i.id} (${i.src})`),g()},document.head.appendChild(f)});a.push(d)}a.length>0&&(await Promise.all(a),V.log(`All scripts loaded: ${e.filter(i=>!document.getElementById(i.id)||a.length>0).map(i=>i.id).join(", ")}`))}evaluateScriptCondition(e,n){try{if(e.startsWith("{{")&&e.endsWith("}}")){const a=e.slice(2,-2).trim();return new Function("ctx",`
with(ctx) {
try {
return Boolean(${a});
} catch (e) {
return false;
}
}
`)(n)}return!!e}catch(a){return V.warn(`Failed to evaluate script condition: ${e}`,a),!1}}showInitError(e){const n=Xy(e);Qy.renderFromError("app",n,"초기화 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}showTransitionOverlay(e,n){const a=typeof e=="boolean"?{enabled:e,style:"opaque",target:void 0,skeleton:void 0,spinner:void 0}:{enabled:e.enabled,style:e.style||"opaque",target:e.target,skeleton:e.skeleton,spinner:e.spinner,fallback_target:e.fallback_target};if(!a.enabled)return;if(this.hideTransitionOverlay(),a.style==="skeleton"&&a.skeleton?.component&&a.target&&n){this.renderSkeletonOverlay(a.target,a.skeleton,n,a.fallback_target);return}if(a.style==="spinner"&&a.target){this.renderSpinnerOverlay(a.target,a.spinner,a.fallback_target);return}const i=document.documentElement.classList.contains("dark");let o,d="";switch(a.style){case"blur":o=i?"rgba(17,24,39,0.3)":"rgba(255,255,255,0.3)",d="backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);";break;case"fade":o=i?"rgba(17,24,39,0.8)":"rgba(255,255,255,0.8)";break;case"skeleton":o=i?"rgb(17,24,39)":"rgb(249,250,251)";break;case"opaque":default:o=i?"rgb(17,24,39)":"rgb(249,250,251)";break}if(a.target){const g=`#${CSS.escape(a.target)}`,h=document.createElement("style");h.id="g7-transition-overlay",h.textContent=`${g}{position:relative;z-index:0;}${g}::after{content:'';position:absolute;inset:0;background:${o};${d}z-index:2147483647;pointer-events:none;}`,document.head.appendChild(h),this.transitionOverlayEl=h}else{const g=document.createElement("div");g.id="g7-transition-overlay",g.setAttribute("aria-hidden","true"),g.style.cssText=`position:fixed;inset:0;z-index:9999;pointer-events:none;background:${o};${d}`,document.body.appendChild(g),this.transitionOverlayEl=g}}hideTransitionOverlay(){this.transitionOverlayEl&&(this.transitionOverlayEl.remove(),this.transitionOverlayEl=null),this.hideSkeletonOverlay()}renderSkeletonOverlay(e,n,a,i){const d=ya.getInstance().getComponent(n.component);if(!d){V.log(`Skeleton component "${n.component}" not found in registry, falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}let g=document.getElementById(e),h="target";if(!g&&i&&(g=document.getElementById(i),h="fallback"),g||(g=document.getElementById("app"),h="fullpage"),!g){V.log(`Skeleton overlay: no target found (target="#${e}", fallback="${i||"none"}"), falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}this.hideSkeletonOverlay();const p=document.documentElement.classList.contains("dark")?"rgb(17,24,39)":"rgb(249,250,251)",x=h==="fullpage"?"app":h==="fallback"?i:e,y=`#${CSS.escape(x)}`,w=document.createElement("style");w.id="g7-skeleton-overlay-style",w.textContent=`${y}{position:relative;z-index:0;}${y}::after{content:'';position:absolute;inset:0;background:${p};z-index:2147483646;pointer-events:none;}`,document.head.appendChild(w),this.transitionOverlayEl=w;const v=document.createElement("div");if(v.id="g7-skeleton-overlay",v.setAttribute("role","status"),v.setAttribute("aria-busy","true"),v.setAttribute("aria-label","Loading..."),h==="fullpage")v.style.cssText=["position:fixed","inset:0","z-index:20","overflow:hidden","pointer-events:none",`background:${p}`].join(";")+";";else{const N=g.getBoundingClientRect(),D=window.scrollX||document.documentElement.scrollLeft,M=window.scrollY||document.documentElement.scrollTop;v.style.cssText=["position:absolute",`top:${N.top+M}px`,`left:${N.left+D}px`,`width:${N.width}px`,`height:${N.height}px`,"z-index:20","overflow:hidden","pointer-events:none",`background:${p}`].join(";")+";"}document.body.appendChild(v),this.skeletonOverlayContainer=v;const C=a.components||[];let k;if(h==="fullpage")k=C;else{const N=h==="fallback"?i:e;k=this.findComponentChildrenById(C,N)}const A=zu.createRoot(v);this.skeletonOverlayRoot=A,Os.flushSync(()=>{A.render(Fe.createElement(d,{components:k,options:{animation:n.animation||"pulse",iteration_count:n.iteration_count||5}}))});const R=h==="fullpage"?"fullpage (#app)":h==="fallback"?`fallback (#${i})`:`target (#${e})`;V.log(`Skeleton overlay rendered [${R}] with "${n.component}" (${k.length} components)`)}findComponentChildrenById(e,n){const a=i=>{for(const o of i){if(o.id===n)return o.children||[];if(o.children&&Array.isArray(o.children)){const d=a(o.children);if(d!==null)return d}}return null};return a(e)||e}renderSpinnerOverlay(e,n,a){let i=document.getElementById(e),o="target";if(!i&&a&&(i=document.getElementById(a),o="fallback"),i||(i=document.getElementById("app"),o="fullpage"),!i){V.log(`Spinner overlay: no target found (target="#${e}", fallback="${a||"none"}"), falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}this.hideSkeletonOverlay();const d=o==="fullpage"?"app":o==="fallback"?a:e,g=`#${CSS.escape(d)}`,h=document.createElement("style");h.id="g7-skeleton-overlay-style",h.textContent=[`${g}{position:relative;}`,"@keyframes g7-spin{to{transform:rotate(360deg)}}"].join(""),document.head.appendChild(h),this.transitionOverlayEl=h;const f=n?.text||window.G7Core?.t?.("nav.loading")||"";this._spinnerState={target:e,fallbackTarget:a,spinnerConfig:n,resolvedText:f},this._mountSpinnerInTarget(i);const p=o==="fullpage"?"fullpage (#app)":o==="fallback"?`fallback (#${a})`:`target (#${e})`,x=n?.component||"default spinner";V.log(`Spinner overlay rendered [${p}] with "${x}"`)}_mountSpinnerInTarget(e){if(!this._spinnerState)return;const{spinnerConfig:n,resolvedText:a}=this._spinnerState;if(this.skeletonOverlayRoot){try{this.skeletonOverlayRoot.unmount()}catch{}this.skeletonOverlayRoot=null}if(this.skeletonOverlayContainer){try{this.skeletonOverlayContainer.remove()}catch{}this.skeletonOverlayContainer=null}const i=document.createElement("div");if(i.id="g7-skeleton-overlay",i.setAttribute("role","status"),i.setAttribute("aria-busy","true"),e.appendChild(i),this.skeletonOverlayContainer=i,n?.component){const d=ya.getInstance().getComponent(n.component);if(d){const g=zu.createRoot(i);this.skeletonOverlayRoot=g,Os.flushSync(()=>{g.render(Fe.createElement(d,{options:{text:a}}))});return}V.log(`Spinner component "${n.component}" not found in registry, using default spinner`)}i.innerHTML='<div style="position:absolute;inset:0;z-index:2147483647;overflow:hidden;background:var(--g7-overlay-bg, rgb(249,250,251));display:flex;align-items:center;justify-content:center;"><div style="width:32px;height:32px;border:3px solid var(--g7-spinner-color, #9ca3af);border-top-color:transparent;border-radius:50%;animation:g7-spin 0.8s linear infinite;"></div></div>'}reattachSpinnerOverlay(){if(!this._spinnerState)return;const{target:e,fallbackTarget:n}=this._spinnerState;let a=document.getElementById(e);!a&&n&&(a=document.getElementById(n)),a||(a=document.getElementById("app")),a&&(this._mountSpinnerInTarget(a),V.log("Spinner overlay reattached to new DOM target"))}hideSkeletonOverlay(){if(this.skeletonOverlayRoot){try{this.skeletonOverlayRoot.unmount()}catch{}this.skeletonOverlayRoot=null}if(this.skeletonOverlayContainer){try{this.skeletonOverlayContainer.parentNode&&this.skeletonOverlayContainer.remove()}catch{}this.skeletonOverlayContainer=null}const e=document.getElementById("g7-skeleton-overlay-style");e&&e.remove(),this._spinnerState=null}showRouteError(e){const n=Xy(e);Qy.renderFromError("app",n,"페이지 로딩 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}async handleServerError(){const e=window.G7Error;if(!e)return!1;V.warn("Server error detected:",e);try{return this.errorPageHandler&&(e.data&&(this.globalState.errorData=e.data),this.errorPageHandler.updateGlobalState(this.globalState),this.errorPageHandler.updateLocale(this.config.locale),await this.errorPageHandler.renderError(e.code,"app"))?(V.log(`${e.code} error page rendered successfully`),!0):(V.log(`Falling back to ErrorDisplay for ${e.code}`),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0)}catch(n){return V.error(`Failed to render ${e.code} page:`,n),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0}}async handleRouteNotFound(e){V.warn("Route not found:",e);try{if(this.errorPageHandler&&(this.errorPageHandler.updateGlobalState(this.globalState),this.errorPageHandler.updateLocale(this.config.locale),await this.errorPageHandler.renderError(404,"app"))){V.log("404 error page rendered successfully");return}V.log("Falling back to ErrorDisplay for 404"),this.showRouteError(new Error(`Page not found: ${e}`))}catch(n){V.error("Failed to render 404 page:",n),this.showRouteError(new Error(`Page not found: ${e}`))}}getRouter(){return this.router}getConfig(){return this.config}getLayoutLoader(){return this.layoutLoader}getActionDispatcher(){return wr().actionDispatcher}async changeLocale(e){try{if(V.log("Changing locale to:",e),this.config.locale===e){V.log("Locale is already",e);return}this.config.locale=e,this.saveLocaleToStorage(e),await this.saveLocaleToDatabase(e),this.layoutLoader&&(this.layoutLoader.clear(),V.log("Layout cache cleared")),this.errorPageHandler&&(this.errorPageHandler.updateLocale(e),V.log("ErrorPageHandler locale updated")),Uc(),await Lo({templateId:this.config.templateId,templateType:this.config.templateType,locale:e,debug:this.config.debug,cacheVersion:this.extensionCacheVersion}),V.log("Template Engine re-initialized with new locale");const{getActionDispatcher:n}=await Promise.resolve().then(()=>qa),a=n();a&&(a.setDefaultContext({navigate:i=>this.router?.navigate(i)}),a.setGlobalStateUpdater(i=>this.setGlobalState(i)),V.log("Navigate function and setGlobalState re-injected to ActionDispatcher")),this.reinitializeModuleHandlers(),V.log("Module handlers re-initialized"),this.reinitializeTemplateHandlers(),V.log("Template handlers re-initialized"),this.reinitializePluginHandlers(),V.log("Plugin handlers re-initialized"),this.router&&this.router.navigateToCurrentPath(),V.log("Locale changed successfully to",e)}catch(n){throw V.error("Failed to change locale:",n),n}}loadLocaleFromStorage(){try{return localStorage.getItem(Ea.LOCALE_STORAGE_KEY)}catch(e){return V.warn("Failed to load locale from storage:",e),null}}saveLocaleToStorage(e){try{localStorage.setItem(Ea.LOCALE_STORAGE_KEY,e)}catch(n){V.warn("Failed to save locale to storage:",n)}}async saveLocaleToDatabase(e){const n=localStorage.getItem("auth_token");if(!n){V.log("No auth token, skipping DB locale save");return}let a,i;if(this.config.localeApi)a=this.config.localeApi.endpoint,i=this.config.localeApi.method;else{const o=this.config.templateType==="admin";a=o?"/api/admin/users/me/language":"/api/user/profile/update-language",i=o?"PATCH":"POST"}try{const o=this.getXsrfToken(),d=await fetch(a,{method:i,headers:{"Content-Type":"application/json",Accept:"application/json",...o&&{"X-XSRF-TOKEN":o},Authorization:`Bearer ${n}`},credentials:"include",body:JSON.stringify({language:e})});d.ok?V.log("Locale saved to DB:",e):V.warn("Failed to save locale to DB (UI will still change):",d.statusText)}catch(o){V.warn("Failed to call locale API (UI will still change):",o)}}getXsrfToken(){if(typeof document>"u")return null;const n=`; ${document.cookie}`.split("; XSRF-TOKEN=");return n.length===2?decodeURIComponent(n.pop()?.split(";").shift()||""):null}loadCacheVersionFromStorage(){try{const e=localStorage.getItem(Ea.CACHE_VERSION_STORAGE_KEY);return e?parseInt(e,10):null}catch(e){return V.warn("Failed to load cache version from storage:",e),null}}saveCacheVersionToStorage(e){try{localStorage.setItem(Ea.CACHE_VERSION_STORAGE_KEY,String(e))}catch(n){V.warn("Failed to save cache version to storage:",n)}}reinitializeModuleHandlers(){if(typeof window>"u")return;const e="__",n=window;Object.keys(n).forEach(a=>{if(a.startsWith(e)&&typeof n[a]?.initModule=="function")try{n[a].initModule(),V.log(`Module handler re-initialized: ${a}`)}catch(i){V.warn(`Failed to re-initialize module handlers for ${a}:`,i)}})}reinitializeTemplateHandlers(){if(typeof window>"u")return;const e=window.G7TemplateHandlers;if(!e){V.warn("Template handlers not found on window.G7TemplateHandlers");return}const n=this.getActionDispatcher();if(!n){V.warn("ActionDispatcher not available for template handler registration");return}Object.entries(e).forEach(([a,i])=>{n.registerHandler(a,i)}),V.log(`${Object.keys(e).length} template handler(s) re-registered:`,Object.keys(e))}reinitializePluginHandlers(){if(typeof window>"u")return;const e="__",n=window;Object.keys(n).forEach(a=>{if(a.startsWith(e)&&typeof n[a]?.initPlugin=="function")try{n[a].initPlugin(),V.log(`Plugin handler re-initialized: ${a}`)}catch(i){V.warn(`Failed to re-initialize plugin handlers for ${a}:`,i)}})}getLocale(){return this.config.locale}getErrorPageHandler(){return this.errorPageHandler}getGlobalState(){return{...this.globalState}}setGlobalState(e){const n={...this.globalState};typeof e=="function"?this.globalState=e(this.globalState):this.globalState={...this.globalState,...e},V.log("Global state updated:",this.globalState),window.G7Core?.devTools?.captureStateSnapshot?.({source:"setGlobalState",prev:n,next:this.globalState}),this.globalStateListeners.forEach(i=>{i(this.globalState)}),Promise.resolve().then(()=>qa).then(({updateTemplateData:i,getState:o})=>{const d=o();d.reactRoot&&d.currentLayoutJson&&i({_global:{...this.globalState},_local:this.globalState._local||{}})})}onGlobalStateChange(e){this.globalStateListeners.add(e)}offGlobalStateChange(e){this.globalStateListeners.delete(e)}async refetchDataSource(e,n){let a=this.currentDataSources.find(i=>i.id===e);if(!a)for(const[,i]of this.modalDataSources){const o=i.find(d=>d.id===e);if(o){a=o;break}}if(!a){V.warn(`Data source not found: ${e}`);return}V.log(`Refetching data source: ${e}`,n?.sync?"(sync mode)":"",n?.globalStateOverride?"(with global override)":"",n?.localStateOverride?"(with local override)":""),Pa.setPending(!0);try{const i=new is;this.currentGlobalHeaders.length>0&&i.setGlobalHeaders(this.currentGlobalHeaders);const o=wr(),d=o.currentDataContext?._global||{},g=n?.globalStateOverride?{...d,...n.globalStateOverride}:d,h=o.currentDataContext?._local||{},f=n?.localStateOverride?{...h,...n.localStateOverride}:h,x=(await i.fetchDataSourcesWithResults([a],this.currentRouteParams,this.currentQueryParams,g,f,{ignoreAutoFetch:!0}))[0];if(x.state==="success"&&x.data!==void 0){this.currentFetchedData[e]=x.data;const y={};this.processInitOptions([a],{[e]:x.data},y);const w=wr();if(w.bindingEngine){const C=[e];a.initGlobal&&C.push("_global"),a.initLocal&&C.push("_local"),w.bindingEngine.invalidateCacheByKeys(C)}const v={[e]:x.data};return Object.keys(y).length>0&&(v._localInit=y),a.initGlobal&&(v._global={...this.globalState}),hi(v,n?.sync?{sync:!0}:void 0),V.log(`Data source refetched successfully: ${e}`),x.data}else if(x.state==="error"){V.error(`Failed to refetch data source: ${e}`,x.error);return}}catch(i){V.error(`Error refetching data source: ${e}`,i);return}finally{Pa.setPending(!1)}}registerModalDataSources(e,n){this.modalDataSources.set(e,n),V.log(`Modal data sources registered: ${e} (${n.length} sources)`)}unregisterModalDataSources(e){this.modalDataSources.delete(e),V.log(`Modal data sources unregistered: ${e}`)}getDataSource(e){return this.currentFetchedData[e]}setDataSource(e,n,a){if(!e){V.warn("setDataSource: dataSourceId is required");return}const{merge:i=!1,sync:o=!1}=a||{};i&&this.currentFetchedData[e]?this.currentFetchedData[e]={...this.currentFetchedData[e],...n}:this.currentFetchedData[e]=n,Promise.resolve().then(()=>qa).then(({updateTemplateData:d})=>{d({[e]:this.currentFetchedData[e]},o?{sync:!0}:void 0)}),V.log(`setDataSource: Updated ${e}`,i?"(merged)":"(replaced)")}updateDataSourceItem(e,n,a,i,o){const{idField:d="id",merge:g=!0,skipRender:h=!1}=o||{},f=this.currentFetchedData[e];if(!f)return V.warn(`updateDataSourceItem: DataSource '${e}' not found`),!1;const p=this.parseItemPath(n);let x=f;for(const v of p)if(x=x?.[v],x===void 0)return V.warn(`updateDataSourceItem: Path '${n}' not found in dataSource`),!1;if(!Array.isArray(x))return V.warn(`updateDataSourceItem: Target at '${n}' is not an array`),!1;const y=x.findIndex(v=>String(v[d])===String(a));if(y===-1)return V.warn(`updateDataSourceItem: Item with ${d}='${a}' not found`),!1;g?x[y]=this.deepMerge(x[y],i):x[y]={...x[y],...i};const w=window.G7Core?.devTools;return w?.isEnabled?.()&&w.trackDataSourceUpdate?.({dataSourceId:e,updateType:"partial",itemPath:n,itemId:a,updates:i,timestamp:Date.now()}),h||Promise.resolve().then(()=>qa).then(({updateTemplateData:v})=>{v({[e]:this.currentFetchedData[e]},{sync:!1})}),V.log(`updateDataSourceItem: Updated ${e}.${n}[${d}=${a}]`),!0}parseItemPath(e){const n=[],a=/([^\.\[\]]+)|\[(\d+)\]/g;let i;for(;(i=a.exec(e))!==null;)i[1]!==void 0?n.push(i[1]):i[2]!==void 0&&n.push(parseInt(i[2],10));return n}deepMerge(e,n){if(n==null)return e;if(typeof n!="object"||Array.isArray(n))return n;const a={...e};for(const i of Object.keys(n))typeof n[i]=="object"&&n[i]!==null&&!Array.isArray(n[i])?a[i]=this.deepMerge(a[i]||{},n[i]):a[i]=n[i];return a}setValueAtPath(e,n,a,i="deep"){const o=n.split(".");let d=e;for(let f=0;f<o.length-1;f++){const p=o[f];(d[p]===void 0||d[p]===null||typeof d[p]!="object")&&(d[p]={}),d=d[p]}const g=o[o.length-1],h=d[g];i==="replace"||h===void 0?d[g]=a:i==="shallow"?typeof h=="object"&&typeof a=="object"&&!Array.isArray(a)?d[g]={...h,...a}:d[g]=a:typeof h=="object"&&typeof a=="object"&&!Array.isArray(a)?d[g]=this.deepMerge(h,a):d[g]=a}flattenNestedObjectToMappings(e,n=""){const a=[];for(const[i,o]of Object.entries(e)){if(i==="_merge")continue;const d=n?`${n}.${i}`:i;typeof o=="string"?a.push({targetPath:d,sourcePath:o}):typeof o=="object"&&o!==null&&!Array.isArray(o)&&a.push(...this.flattenNestedObjectToMappings(o,d))}return a}async updateQueryParams(e){V.log("updateQueryParams:",e);const n=new URL(e,window.location.origin),a=new URLSearchParams(n.search);window.history.replaceState(null,"",e),V.log("URL updated via replaceState"),this.currentQueryParams=a,V.log("currentQueryParams updated:",Object.fromEntries(a.entries()));const i=this.currentDataSources.filter(o=>o.auto_fetch!==!1);if(i.length===0){V.log("No auto_fetch data sources to refetch");return}V.log(`Refetching ${i.length} auto_fetch data sources`),Pa.setPending(!0);try{const o=new is;this.currentGlobalHeaders.length>0&&o.setGlobalHeaders(this.currentGlobalHeaders);const d=wr(),g=d.currentDataContext?._global||{},h=await o.fetchDataSourcesWithResults(i,this.currentRouteParams,this.currentQueryParams,g,void 0,{ignoreAutoFetch:!1}),f={},p={};for(let x=0;x<h.length;x++){const y=h[x],w=i[x],v=w.id;y.state==="success"&&y.data!==void 0?(this.currentFetchedData[v]=y.data,f[v]=y.data,this.processInitOptions([w],{[v]:y.data},p),V.log(`Data source refetched: ${v}`)):y.state==="error"&&V.error(`Failed to refetch data source: ${v}`,y.error)}if(d.bindingEngine){const x=Object.keys(f);x.push("query"),d.bindingEngine.invalidateCacheByKeys(x)}if(Object.keys(p).length>0&&(f._localInit=p),Object.keys(f).length>0){if(f.query=Xj(this.currentQueryParams),d.currentLayoutJson?.computed&&Object.keys(d.currentLayoutJson.computed).length>0){const x={...d.currentDataContext,...f,query:f.query},y=this.calculateComputed(d.currentLayoutJson.computed,x);Object.keys(y).length>0&&(f._computed=y,this.globalState._computed=y,V.log("Computed values recalculated in updateQueryParams:",Object.keys(y)))}hi(f,{sync:!0}),V.log("Template data updated with new query params")}}catch(o){V.error("Error in updateQueryParams:",o)}finally{Pa.setPending(!1)}}calculateComputed(e,n){const a={},i=new _n;for(const[o,d]of Object.entries(e))try{let g;if(this.isComputedSwitchDefinition(d))g=i.resolveSwitch(d,n,{skipCache:!0});else if(typeof d=="string")if(d.startsWith("{{")&&d.endsWith("}}")){const h=d.slice(2,-2).trim();g=this.evaluateComputedExpression(h,n)}else g=d;a[o]=g,V.log(`Computed ${o}:`,g)}catch(g){V.warn(`Failed to calculate computed value: ${o}`,g),a[o]=void 0}return a}isComputedSwitchDefinition(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}evaluateComputedExpression(e,n){try{return new Function("ctx",`
with(ctx) {
try {
return ${e};
} catch (e) {
return undefined;
}
}
`)(n)}catch(a){V.warn(`Expression evaluation failed: ${e}`,a);return}}async executeInitActions(e,n={}){const{getActionDispatcher:a}=await Promise.resolve().then(()=>qa),i=a();if(!i){V.warn("ActionDispatcher not available for init_actions");return}V.log("Executing init_actions:",e.map(g=>g.handler)),V.log("Init actions dataContext:",n),V.log("Init actions dataContext._global:",n._global);const o=e.map(g=>g.handler).filter(g=>g.includes("."));o.length>0&&await this.waitForHandlers(i,o);let d={...n};for(const g of e)try{const h={type:"click",handler:g.handler,target:g.target,params:g.params,resultTo:g.resultTo,onSuccess:g.onSuccess,onError:g.onError,if:g.if,conditions:g.conditions,auth_mode:g.auth_mode,auth_required:g.auth_required},f=i.createHandler(h,d),p=new Event("init");await f(p),V.log(`Init action executed: ${g.handler}`);const x=this.globalState;d={...d,_global:{...x},_local:x._local||d._local||{}},V.log(`Data context refreshed after ${g.handler}:`,{cartKey:d._global?.cartKey})}catch(h){V.error(`Failed to execute init action: ${g.handler}`,h)}}async waitForHandlers(e,n,a=5e3){const i=Date.now(),o=50,d=()=>n.every(g=>e.customHandlers?.has(g));if(d()){V.log("All module handlers already registered");return}return V.log("Waiting for module handlers:",n),new Promise(g=>{const h=()=>{if(d()){V.log("All module handlers now registered"),g();return}if(Date.now()-i>=a){const f=n.filter(p=>!e.customHandlers?.has(p));V.warn("Timeout waiting for handlers:",f),g();return}setTimeout(h,o)};h()})}};H(Ea,"LOCALE_STORAGE_KEY","g7_locale"),H(Ea,"CACHE_VERSION_STORAGE_KEY","g7_cache_version");let Ro=Ea;function Pg(r){const e=new Ro(r);return r.websocket&&(Lc.configure(r.websocket),V.log("WebSocket 설정 완료")),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{e.init(),window.__templateApp=e}):(e.init(),window.__templateApp=e),e}typeof window<"u"&&(window.G7Core=window.G7Core||{},window.G7Core.initTemplateApp=Pg,window.G7Core.dataSource={refetch:async(r,e)=>{const n=window.__templateApp;if(!n){V.warn("TemplateApp not initialized (G7Core.dataSource.refetch)");return}return n.refetchDataSource(r,e)},get:r=>{const e=window.__templateApp;if(!e){V.warn("TemplateApp not initialized (G7Core.dataSource.get)");return}return e.getDataSource(r)}});const zc=[{id:"stale-closure",name:"Stale Closure",category:"state",symptoms:["이전 값이 전송됨","저장 시 오래된 데이터","API 호출 시 첫 값만 전송","클릭할 때마다 같은 값"],detector:r=>{const n=r.actionHistory.slice(-10).filter(a=>a.type==="apiCall");if(n.length<2)return!1;for(let a=1;a<n.length;a++){const i=JSON.stringify(n[a-1].params),o=JSON.stringify(n[a].params);if(i===o&&n[a].params)return!0}return!1},probability:.85,solution:"G7Core.state.get()._global 사용하여 최신 상태 참조",docLink:"troubleshooting-state.md#stale-closure",codeExample:`
// ❌ 문제: 클로저가 이전 상태 캡처
"body": { "email": "{{_global.email}}" }
// ✅ 해결: 최신 상태 참조
"body": { "email": "{{G7Core.state.get()._global.email}}" }
`},{id:"sequence-merge",name:"Sequence setState 병합 충돌",category:"state",symptoms:["sequence 내 setState 일부 누락","여러 setState 중 마지막만 적용","상태 업데이트 순서 문제"],detector:r=>r.actionHistory.filter(n=>n.type==="sequence").some(n=>n.children?.filter(a=>a.type==="setState").length>1),probability:.75,solution:"currentState 추적 패턴 사용 또는 단일 setState로 병합",docLink:"troubleshooting-state.md#사례3",codeExample:`
// ❌ 문제: sequence 내 여러 setState
"actions": [
{ "handler": "setState", "params": { "a": 1 } },
{ "handler": "setState", "params": { "b": 2 } }
]
// ✅ 해결: 단일 setState로 병합
"actions": [
{ "handler": "setState", "params": { "a": 1, "b": 2 } }
]
`},{id:"init-actions-timing",name:"init_actions 타이밍 이슈",category:"timing",symptoms:["init_actions 값이 렌더링에 반영 안됨","초기 상태가 undefined","첫 클릭 시 초기값 손실"],detector:r=>{if(r.stateHistory.length===0)return!1;const e=r.stateHistory[0];return e?.source==="init_actions"&&Object.keys(e.next||{}).length===0},probability:.7,solution:"init_actions 후 _global 상태 병합 확인",docLink:"troubleshooting-state.md#init_actions-관련-이슈"},{id:"datakey-global-init",name:'dataKey="_global.xxx" 초기화 누락',category:"form",symptoms:["Form dataKey가 전역 상태에 바인딩 안됨","Input 값이 _global에 저장 안됨","Form 제출 시 빈 값 전송"],detector:r=>r.form.filter(n=>n.dataKey?.startsWith("_global.")).length===0?!1:!r.stateHistory.some(n=>n.source==="init_actions"),probability:.95,solution:"init_actions에서 _global 상태 초기화 필수",docLink:"troubleshooting-state.md#datakey-자동-바인딩-이슈",codeExample:`
// init_actions에서 초기화 필요
"init_actions": [
{
"handler": "setState",
"params": {
"target": "global",
"loginForm": { "email": "", "password": "" }
}
}
]
`},{id:"cache-iteration",name:"캐시 반복 렌더링 문제",category:"cache",symptoms:["모든 행이 같은 값","iteration에서 첫 항목만 표시","DataGrid 데이터 중복"],detector:r=>(r.cacheStats.hitRate??0)>.9&&r.conditional.iterations.length>0,probability:.9,solution:"skipCache: true 추가",docLink:"troubleshooting-cache.md#사례4",codeExample:`
// ❌ 문제: 캐시된 값이 모든 행에 적용
"cellChildren": [{ "props": { "value": "{{item.name}}" } }]
// ✅ 해결: 렌더러에서 skipCache 옵션 사용
// 또는 ActionDispatcher에서 skipCache: true로 호출
`},{id:"cache-dynamic-query",name:"동적 쿼리 파라미터 캐싱",category:"cache",symptoms:["페이지네이션이 동작 안함","필터 변경해도 같은 결과","정렬이 적용 안됨"],detector:r=>{const e=r.network.requestHistory.slice(-5);if(e.length<2)return!1;const n=e.map(a=>a.url.split("?")[0]);return new Set(n).size<n.length},probability:.85,solution:"데이터소스 params에 skipCache: true 추가",docLink:"troubleshooting-cache.md#사례2"},{id:"orphaned-listener",name:"정리되지 않은 이벤트 리스너",category:"lifecycle",symptoms:["메모리 사용량 증가","이벤트가 여러 번 실행됨","페이지 이동 후에도 이벤트 발생"],detector:r=>r.lifecycle.orphanedListeners.length>0,probability:.8,solution:"useEffect cleanup 또는 removeEventListener 추가",docLink:"troubleshooting-components.md#lifecycle"},{id:"unmount-state-update",name:"언마운트 후 상태 업데이트",category:"lifecycle",symptoms:["Cannot update state on unmounted component","비동기 작업 완료 후 에러","모달 닫힘 후 에러"],detector:r=>r.actionHistory.some(e=>e.status==="error"&&e.error?.message?.includes("unmounted")),probability:.9,solution:"AbortController 또는 isMounted 플래그 사용",docLink:"troubleshooting-state.md#unmount-update"},{id:"excessive-rerenders",name:"과도한 리렌더링",category:"performance",symptoms:["UI가 느림","스크롤 버벅임","입력 지연"],detector:r=>{for(const e of r.performance.renderCounts.values())if(e>50)return!0;return!1},probability:.75,solution:"React.memo, useMemo, useCallback 사용",docLink:"troubleshooting-components.md#performance"},{id:"binding-eval-flood",name:"바인딩 평가 과다",category:"performance",symptoms:["페이지 로드 느림","CPU 사용량 높음"],detector:r=>r.performance.bindingEvalCount>1e3,probability:.85,solution:"불필요한 {{}} 바인딩 제거, 정적 값 사용",docLink:"troubleshooting-cache.md#binding-performance"},{id:"memory-leak",name:"잠재적 메모리 누수",category:"performance",symptoms:["시간이 지남에 따라 느려짐","브라우저 탭 메모리 증가","오래 사용 시 크래시"],detector:r=>r.performance.memoryWarnings.length>0,probability:.7,solution:"클린업 함수 확인, WeakMap 사용",docLink:"troubleshooting-state.md#memory-leak"},{id:"request-timeout",name:"API 요청 타임아웃",category:"network",symptoms:["데이터가 로딩 안됨","무한 로딩 스피너","타임아웃 에러"],detector:r=>r.network.requestHistory.some(e=>e.status==="timeout"||e.duration&&e.duration>3e4),probability:.9,solution:"서버 상태 확인, 타임아웃 설정 조정",docLink:"troubleshooting-backend.md#timeout"},{id:"duplicate-requests",name:"중복 API 요청",category:"network",symptoms:["같은 요청이 여러 번 실행","네트워크 탭에 동일 요청 반복","불필요한 서버 부하"],detector:r=>{const a=r.network.requestHistory.slice(-20).map(i=>`${i.method}:${i.url}`);return a.length!==new Set(a).size},probability:.85,solution:"debounce 추가, 데이터소스 의존성 확인",docLink:"troubleshooting-cache.md#duplicate-request"},{id:"datasource-not-loading",name:"데이터소스 미로딩",category:"network",symptoms:["데이터가 undefined","빈 테이블/목록","API 호출이 안됨"],detector:r=>r.network.pendingDataSources.length>0&&r.network.activeRequests.length===0,probability:.8,solution:"데이터소스 strategy 확인, 의존성 확인",docLink:"troubleshooting-backend.md#datasource"},{id:"permission-denied",name:"레이아웃 권한 거부 (403)",category:"network",symptoms:["403 Forbidden","권한이 없습니다","레이아웃 로드 실패","페이지 접근 불가","빈 화면"],detector:r=>r.network.requestHistory.some(e=>e.statusCode===403),probability:.9,solution:"사용자 권한 확인 또는 레이아웃 permissions 설정 확인",docLink:"frontend/layout-json.md#permissions",codeExample:`
// 레이아웃 JSON의 permissions 필드 확인
{
"permissions": ["core.products.read"] // 필요 권한
}
// 권한 없이 공개로 설정하려면:
{
"permissions": [] // 빈 배열 = 공개 레이아웃
}
`},{id:"auth-required",name:"인증 필요 (401)",category:"network",symptoms:["401 Unauthorized","로그인 필요","토큰 만료","인증되지 않음","Unauthenticated"],detector:r=>r.network.requestHistory.some(e=>e.statusCode===401),probability:.95,solution:"로그인 상태 확인 또는 토큰 갱신 필요",docLink:"frontend/auth-system.md"},{id:"infinite-scroll-state-reset",name:"무한 스크롤 상태 미초기화",category:"state",symptoms:["삭제 후 스크롤 안됨","무한 스크롤이 멈춤","hasMore가 false로 유지","더 이상 데이터 로드 안됨"],detector:r=>{const e=r.currentState;return r.actionHistory.some(a=>a.type==="refetchDataSource")&&e?._global?.infiniteScroll?.hasMore===!1},probability:.85,solution:"refetchDataSource 전에 infiniteScroll 상태 초기화 필요",docLink:"frontend/actions-handlers.md#appendDataSource",codeExample:`
// 삭제 성공 시 상태 초기화 후 refetch
"onSuccess": [
{
"handler": "setState",
"params": {
"target": "global",
"infiniteScroll": {
"currentPage": 1,
"hasMore": true,
"isLoadingMore": false
}
}
},
{ "handler": "refetchDataSource", "params": { "id": "list" } }
]
`},{id:"scroll-event-not-configured",name:"스크롤 이벤트 미설정",category:"lifecycle",symptoms:["스크롤해도 데이터 로드 안됨","무한 스크롤 작동 안함","스크롤 이벤트 안잡힘"],detector:r=>{const e=r.actionHistory.some(a=>a.type==="scroll"),n=r.actionHistory.some(a=>a.type==="appendDataSource");return!e&&!n&&r.actionHistory.length>5},probability:.7,solution:"scroll 이벤트 핸들러 설정 및 컨테이너 overflow 속성 확인",docLink:"frontend/actions.md#scroll-event",codeExample:`
// 무한 스크롤 컨테이너 설정 예시
{
"type": "Div",
"props": {
"className": "overflow-y-auto h-full"
},
"actions": {
"scroll": [
{
"handler": "appendDataSource",
"params": {
"id": "list",
"dataPath": "data",
"sourcePath": "{{_global.infiniteScroll.currentPage}}"
}
}
]
}
}
`},{id:"append-datasource-wrong-path",name:"appendDataSource 경로 오류",category:"state",symptoms:["무한 스크롤 시 데이터 덮어씀","기존 데이터가 사라짐","데이터가 병합 안됨"],detector:r=>{const e=r.actionHistory.filter(n=>n.type==="appendDataSource");return e.length>=2&&e.some(n=>n.status==="error")},probability:.75,solution:"dataPath와 sourcePath 설정 확인, 데이터소스 dataPath가 병합 대상인지 확인",docLink:"frontend/actions-handlers.md#appendDataSource"},{id:"websocket-disconnected",name:"WebSocket 연결 끊김",category:"websocket",symptoms:["실시간 업데이트 안됨","알림이 오지 않음"],detector:r=>r.websocket.connectionState==="disconnected",probability:.9,solution:"네트워크 상태 확인, 재연결 로직 확인",docLink:"troubleshooting-backend.md#websocket"},{id:"if-condition-always-false",name:"if 조건 항상 false",category:"conditional",symptoms:["컴포넌트가 표시 안됨","조건부 영역이 비어있음"],detector:r=>r.conditional.ifConditions.some(e=>e.evaluatedValue===!1&&e.evaluationCount>5),probability:.85,solution:"if 조건식 확인, 상태값 확인",docLink:"troubleshooting-state.md#if-condition"},{id:"iteration-empty",name:"iteration 소스 비어있음",category:"conditional",symptoms:["반복 영역이 비어있음","목록이 표시 안됨"],detector:r=>r.conditional.iterations.some(e=>e.sourceLength===0),probability:.8,solution:"iteration source 표현식 확인, 데이터 로딩 확인",docLink:"troubleshooting-guide.md#iteration"},{id:"iteration-item-var",name:"iteration 변수명 오류",category:"conditional",symptoms:["반복 항목 내 바인딩 빈값","올바른 개수는 표시되나 내용 없음"],detector:r=>r.conditional.iterations.some(e=>e.itemVar==="item"||e.indexVar==="index"),probability:.95,solution:"item_var, index_var 사용 (item, index 아님)",docLink:"troubleshooting-guide.md#iteration-바인딩-문제",codeExample:`
// ❌ 잘못된 속성명
"iteration": {
"source": "{{data}}",
"item": "file", // 잘못됨!
"index": "fileIdx" // 잘못됨!
}
// ✅ 올바른 속성명
"iteration": {
"source": "{{data}}",
"item_var": "file",
"index_var": "fileIdx"
}
`},{id:"form-no-datakey",name:"Form dataKey 미설정",category:"form",symptoms:["Input 값이 저장 안됨","Form 제출 시 빈 값"],detector:r=>r.form.some(e=>!e.dataKey),probability:.9,solution:"Form에 dataKey prop 추가",docLink:"troubleshooting-components.md#form-datakey"},{id:"input-no-name",name:"Input name 미설정",category:"form",symptoms:["자동 바인딩 안됨","Input 값 변경이 상태에 반영 안됨"],detector:r=>r.form.some(e=>e.inputs.some(n=>!n.name)),probability:.95,solution:"Input에 name prop 추가",docLink:"troubleshooting-components.md#input-name"},{id:"i18n-key-missing",name:"번역 키 누락",category:"i18n",symptoms:["$t:key가 그대로 표시됨","번역되지 않은 텍스트"],detector:r=>typeof document<"u"?document.body.innerHTML.includes("$t:"):!1,probability:.95,solution:"번역 파일에 키 추가",docLink:"troubleshooting-components.md#i18n"}];class Zy{constructor(){H(this,"devTools");this.devTools=Ca.getInstance()}analyze(e){const n=this.buildContext(),a=[];for(const i of zc){const o=e.some(g=>i.symptoms.some(h=>h.toLowerCase().includes(g.toLowerCase())||g.toLowerCase().includes(h.toLowerCase())));let d=!1;try{d=i.detector(n)}catch{}(o||d)&&a.push({rule:i,confidence:this.calculateConfidence(i,e,o,d),evidence:this.collectEvidence(i,n)})}return a.sort((i,o)=>o.confidence-i.confidence)}suggestFix(e){return{title:e.rule.name,description:e.rule.solution,codeExample:e.rule.codeExample,docLink:e.rule.docLink}}getCommonIssues(){const e=this.buildContext(),n=[];for(const a of zc)try{a.detector(e)&&n.push({rule:a,count:1})}catch{}return n.sort((a,i)=>i.count-a.count).map(a=>({id:a.rule.id,name:a.rule.name,description:a.rule.solution,frequency:a.count}))}getRulesByCategory(e){return zc.filter(n=>n.category===e)}getAllRules(){return[...zc]}buildContext(){return{stateHistory:this.devTools.getStateHistory(),actionHistory:this.devTools.getActionHistory(),cacheStats:this.devTools.getCacheStats(),currentState:this.devTools.getState(),lifecycle:this.devTools.getLifecycleInfo(),performance:this.devTools.getPerformanceInfo(),network:this.devTools.getNetworkInfo(),conditional:this.devTools.getConditionalInfo(),form:this.devTools.getFormInfo(),websocket:this.devTools.getWebSocketInfo(),stateAtTime:e=>this.devTools.getStateAtTime(e),layoutHas:(e,n)=>this.checkLayoutHas(e,n)}}calculateConfidence(e,n,a,i){let o=e.probability;if(a){const d=n.filter(g=>e.symptoms.some(h=>h.toLowerCase().includes(g.toLowerCase())||g.toLowerCase().includes(h.toLowerCase()))).length;o+=d*.05}return i&&(o+=.1),Math.min(o,.99)}collectEvidence(e,n){const a=[];switch(e.category){case"state":n.stateHistory.length>0&&a.push(`상태 변경 이력: ${n.stateHistory.length}개`);break;case"cache":a.push(`캐시 히트율: ${((n.cacheStats.hitRate??0)*100).toFixed(1)}%`);break;case"lifecycle":n.lifecycle.orphanedListeners.length>0&&a.push(`정리되지 않은 리스너: ${n.lifecycle.orphanedListeners.length}개`);break;case"performance":a.push(`바인딩 평가 횟수: ${n.performance.bindingEvalCount}`);break;case"network":a.push(`진행 중인 요청: ${n.network.activeRequests.length}개`);break;case"form":a.push(`추적 중인 Form: ${n.form.length}개`);break}return a}checkLayoutHas(e,n){try{const i=window.G7Core?.getCurrentLayout?.();if(!i)return!1;const o=JSON.stringify(i);return o.includes(`"${e}":"${n}`)||o.includes(`"${e}": "${n}`)}catch{return!1}}}const Qj=Object.freeze(Object.defineProperty({__proto__:null,DiagnosticEngine:Zy},Symbol.toStringTag,{value:"Module"})),Zj={dumpEndpoint:"/_boost/g7-debug/dump-state",logEndpoint:"/_boost/g7-debug/log",timeout:1e4,autoCapture:!1,autoCaptureInterval:3e4};class ek{constructor(e){H(this,"config");H(this,"devTools");H(this,"connected",!1);H(this,"autoCaptureTimer",null);H(this,"CHUNK_SIZE",2*1024*1024);H(this,"BULK_THRESHOLD",4*1024*1024);this.config={...Zj,...e},this.devTools=Ca.getInstance(),this.config.autoCapture&&this.startAutoCapture()}async dumpState(e=!1){const n=`${Date.now()}_${Math.random().toString(36).substring(2,9)}`,a=Date.now(),i=this.devTools.getPerformanceInfo(),o={renderCounts:Object.fromEntries(i.renderCounts),bindingEvalCount:i.bindingEvalCount,memoryWarnings:i.memoryWarnings},d={state:()=>this.devTools.getState(),actions:()=>this.devTools.getActionHistory(),cache:()=>this.devTools.getCacheStats(),lifecycle:()=>this.devTools.getLifecycleInfo(),network:()=>this.devTools.getNetworkInfo(),expressions:()=>this.devTools.getExpressions(),forms:()=>this.devTools.getForms(),performance:()=>o,conditionals:()=>this.devTools.getConditionalInfo(),dataSources:()=>this.devTools.getDataSources(),handlers:()=>this.devTools.getHandlers(),componentEvents:()=>this.devTools.getComponentEventInfo(),stateRendering:()=>this.devTools.getStateRenderingInfo(),stateHierarchy:()=>this.devTools.getStateHierarchyInfo(),contextFlow:()=>this.devTools.getContextFlowInfo(),styleValidation:()=>this.devTools.getStyleValidationInfo(),authDebug:()=>this.devTools.getAuthDebugInfo(),logs:()=>this.devTools.getLogInfo(),layout:()=>this.devTools.getLayoutDebugInfo(),changeDetection:()=>this.devTools.getChangeDetectionInfo(),sequenceTracking:()=>this.devTools.getSequenceTrackingInfo(),staleClosureTracking:()=>this.devTools.getStaleClosureTrackingInfo(),cacheDecisionTracking:()=>this.devTools.getCacheDecisionTrackingInfo(),dataPathTransformTracking:()=>this.devTools.getDataPathTransformTrackingInfo(),nestedContextTracking:()=>this.devTools.getNestedContextTrackingInfo(),formBindingValidationTracking:()=>this.devTools.getFormBindingValidationTrackingInfo(),computedDependencyTracking:()=>this.devTools.getComputedDependencyTrackingInfo(),modalStateScopeTracking:()=>this.devTools.getModalStateScopeTrackingInfo(),namedActionTracking:()=>this.devTools.getNamedActionTrackingInfo()},g={},h=[];let f=0;for(const[y,w]of Object.entries(d))try{const v=w(),C=this.safeStringify(v,y);C===null?(h.push(`${y}: 직렬화 실패`),g[y]=JSON.stringify({_error:`${y} 섹션 직렬화 실패`})):g[y]=C,f+=g[y].length}catch(v){const C=v instanceof Error?v.message:String(v);h.push(`${y}: ${C}`),g[y]=JSON.stringify({_error:`${y} 섹션 수집 실패: ${C}`}),f+=g[y].length}const p=Object.keys(g).length,x=p-h.length;try{return f<=this.BULK_THRESHOLD?(await this.sendBulkDump(g,a,e),console.log(`[G7DevTools] 상태 덤프 완료 - 일괄 전송 (${(f/1024).toFixed(1)}KB, ${x}/${p} 섹션 성공)`)):(await this.sendChunkedDump(n,g,a,e),console.log(`[G7DevTools] 상태 덤프 완료 - 분할 전송 (${(f/1024/1024).toFixed(2)}MB, ${x}/${p} 섹션 성공)`)),this.connected=!0,h.length>0&&console.warn("[G7DevTools] 일부 섹션 실패:",h.join(", ")),n}catch(y){throw this.connected=!1,console.error("[G7DevTools] 상태 덤프 실패:",y),y}}async sendBulkDump(e,n,a){const i={};for(const[o,d]of Object.entries(e))try{i[o]=JSON.parse(d)}catch{i[o]={_error:"파싱 실패"}}await this.sendRequest(this.config.dumpEndpoint,{bulk:!0,sections:i,timestamp:n,saveHistory:a})}async sendChunkedDump(e,n,a,i){const o=Object.keys(n),d=o.length;for(let g=0;g<o.length;g++){const h=o[g],f=n[h],p=g===o.length-1;await this.sendChunkedSection(e,h,f,p,a,i,d)}}async sendChunkedSection(e,n,a,i,o,d,g){const h=this.splitIntoChunks(a),f=h.length;for(let p=0;p<h.length;p++){const x=p===h.length-1,y=h[p];await this.sendRequest(this.config.dumpEndpoint,{sessionId:e,sectionName:n,chunkData:y,chunkIndex:p,totalChunks:f,isLastChunk:x,isLastSection:i&&x,timestamp:o,saveHistory:d,totalSections:g})}}splitIntoChunks(e){const n=[];for(let a=0;a<e.length;a+=this.CHUNK_SIZE)n.push(e.slice(a,a+this.CHUNK_SIZE));return n.length>0?n:[""]}safeStringify(e,n){const a=new WeakSet;try{return JSON.stringify(e,(o,d)=>{if(typeof d=="object"&&d!==null){if(a.has(d))return"[Circular Reference]";a.add(d)}return typeof d=="function"?"[Function]":typeof d=="symbol"?"[Symbol]":typeof d=="bigint"?d.toString():d})}catch(i){return console.warn(`[G7DevTools] ${n} 직렬화 오류:`,i),null}}async sendLog(e){console.log("[G7:DEBUG]",JSON.stringify(e));try{await this.sendRequest(this.config.logEndpoint,{type:"debug",data:e,timestamp:Date.now()})}catch{}}async sendError(e,n){const a={name:e.name,message:e.message,stack:e.stack,context:n,state:this.devTools.getState(),actions:this.devTools.getActionHistory().slice(-10),timestamp:Date.now()};console.log("[G7:ERROR]",JSON.stringify(a));try{await this.sendRequest(this.config.logEndpoint,{type:"error",data:a,timestamp:Date.now()})}catch{}}async sendProfile(e){console.log("[G7:PROFILE]",JSON.stringify(e));try{await this.sendRequest(this.config.logEndpoint,{type:"profile",data:e,timestamp:Date.now()})}catch{}}isConnected(){return this.connected}async testConnection(){try{const e=await this.sendRequest(this.config.dumpEndpoint,{test:!0,timestamp:Date.now()});return this.connected=e.status==="success",this.connected}catch{return this.connected=!1,!1}}startAutoCapture(){this.autoCaptureTimer&&this.stopAutoCapture(),this.autoCaptureTimer=setInterval(()=>{this.devTools.isEnabled()&&this.dumpState().catch(()=>{})},this.config.autoCaptureInterval),console.log("[G7DevTools] 자동 캡처 시작 (간격:",this.config.autoCaptureInterval,"ms)")}stopAutoCapture(){this.autoCaptureTimer&&(clearInterval(this.autoCaptureTimer),this.autoCaptureTimer=null,console.log("[G7DevTools] 자동 캡처 중지"))}updateConfig(e){this.config={...this.config,...e},("autoCapture"in e||"autoCaptureInterval"in e)&&(this.stopAutoCapture(),this.config.autoCapture&&this.startAutoCapture())}async sendRequest(e,n){const a=new AbortController,i=setTimeout(()=>a.abort(),this.config.timeout);try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify(n),signal:a.signal});if(clearTimeout(i),!o.ok)throw new Error(`HTTP ${o.status}: ${o.statusText}`);const d=await o.text();if(d.trim().startsWith("<")||d.includes("<br />")||d.includes("<b>")){const g=this.extractErrorFromHtml(d);throw new Error(`서버 오류: ${g}`)}try{return JSON.parse(d)}catch{throw new Error(`잘못된 JSON 응답: ${d.substring(0,100)}...`)}}catch(o){throw clearTimeout(i),o instanceof Error&&o.name==="AbortError"?new Error("요청 타임아웃"):o}}extractErrorFromHtml(e){const n=[/<b>(Fatal error|Warning|Notice|Parse error)<\/b>:\s*([^<]+)/i,/Exception:\s*([^<\n]+)/i,/Error:\s*([^<\n]+)/i,/(TypeError|ArgumentCountError|ValueError)[^:]*:\s*([^<\n]+)/i];for(const i of n){const o=e.match(i);if(o)return(o[o.length-1]||o[1]).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').trim().substring(0,200)}return e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().substring(0,200)||"Unknown server error"}destroy(){this.stopAutoCapture()}}let Ug=null;function ex(){return Ug||(Ug=new ek),Ug}const tk=`
#g7-devtools-root {
/* 기본 폰트 설정 */
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 14px;
line-height: 1.5;
}
#g7-devtools-root * {
box-sizing: border-box;
}
/* 패널 기본 스타일 */
.g7dt-panel {
position: fixed;
background-color: #111827;
color: #ffffff;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
z-index: 9999;
display: flex;
flex-direction: column;
border-radius: 8px;
overflow: hidden;
}
.g7dt-panel.maximized {
border-radius: 0;
}
/* 리사이즈 핸들 */
.g7dt-resize-handle {
position: absolute;
z-index: 10001;
background: transparent;
transition: background-color 0.15s ease;
}
.g7dt-resize-handle:hover {
background-color: rgba(59, 130, 246, 0.5);
}
.g7dt-resize-corner {
width: 12px;
height: 12px;
}
.g7dt-resize-edge-h {
height: 6px;
}
.g7dt-resize-edge-v {
width: 6px;
}
.g7dt-resize-nw { top: 0; left: 0; cursor: nw-resize; }
.g7dt-resize-ne { top: 0; right: 0; cursor: ne-resize; }
.g7dt-resize-sw { bottom: 0; left: 0; cursor: sw-resize; }
.g7dt-resize-se { bottom: 0; right: 0; cursor: se-resize; }
.g7dt-resize-n { top: 0; left: 12px; right: 12px; cursor: n-resize; }
.g7dt-resize-s { bottom: 0; left: 12px; right: 12px; cursor: s-resize; }
.g7dt-resize-w { left: 0; top: 12px; bottom: 12px; cursor: w-resize; }
.g7dt-resize-e { right: 0; top: 12px; bottom: 12px; cursor: e-resize; }
/* 헤더 */
.g7dt-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 16px;
background-color: #1f2937;
border-bottom: 1px solid #374151;
flex-shrink: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
cursor: grab;
user-select: none;
}
.g7dt-header.dragging {
cursor: grabbing;
}
.g7dt-header-left {
display: flex;
align-items: center;
gap: 12px;
}
.g7dt-header-title {
font-weight: 700;
font-size: 14px;
}
.g7dt-header-badge {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: #374151;
}
.g7dt-header-badge.connected {
background-color: #059669;
}
.g7dt-header-right {
display: flex;
align-items: center;
gap: 8px;
}
.g7dt-btn {
background: none;
border: none;
color: #9ca3af;
cursor: pointer;
padding: 4px 8px;
border-radius: 4px;
transition: all 0.15s ease;
font-size: 14px;
}
.g7dt-btn:hover {
color: #ffffff;
background-color: rgba(255, 255, 255, 0.1);
}
.g7dt-btn-primary {
background-color: #2563eb;
color: #ffffff;
font-size: 12px;
}
.g7dt-btn-primary:hover {
background-color: #1d4ed8;
}
/* 탭 */
.g7dt-tabs {
display: flex;
border-bottom: 1px solid #374151;
overflow-x: auto;
flex-shrink: 0;
background-color: #111827;
}
.g7dt-tabs::-webkit-scrollbar {
height: 4px;
}
.g7dt-tabs::-webkit-scrollbar-track {
background: transparent;
}
.g7dt-tabs::-webkit-scrollbar-thumb {
background: #374151;
border-radius: 2px;
}
.g7dt-tab {
padding: 8px 16px;
font-size: 13px;
white-space: nowrap;
background: none;
border: none;
color: #9ca3af;
cursor: pointer;
transition: all 0.15s ease;
border-bottom: 2px solid transparent;
}
.g7dt-tab:hover {
color: #ffffff;
background-color: #1f2937;
}
.g7dt-tab.active {
color: #ffffff;
background-color: #1f2937;
border-bottom-color: #3b82f6;
}
/* 콘텐츠 영역 */
.g7dt-content {
flex: 1;
overflow: hidden;
padding: 16px;
min-width: 0;
min-height: 0;
background-color: #111827;
display: flex;
flex-direction: column;
}
.g7dt-content::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.g7dt-content::-webkit-scrollbar-track {
background: #1f2937;
}
.g7dt-content::-webkit-scrollbar-thumb {
background: #4b5563;
border-radius: 4px;
}
.g7dt-content::-webkit-scrollbar-thumb:hover {
background: #6b7280;
}
/* 푸터 */
.g7dt-footer {
padding: 8px 16px;
background-color: #1f2937;
font-size: 11px;
color: #6b7280;
display: flex;
justify-content: space-between;
border-top: 1px solid #374151;
flex-shrink: 0;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
}
/* 플로팅 버튼 */
.g7dt-floating-btn {
position: fixed;
bottom: 16px;
right: 16px;
background-color: #2563eb;
color: #ffffff;
padding: 12px;
border-radius: 50%;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
z-index: 9999;
border: none;
cursor: pointer;
transition: background-color 0.15s ease;
}
.g7dt-floating-btn:hover {
background-color: #1d4ed8;
}
.g7dt-floating-btn svg {
width: 24px;
height: 24px;
}
/* 최소화 상태 */
.g7dt-minimized {
position: fixed;
bottom: 0;
right: 0;
background-color: #111827;
color: #ffffff;
box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
z-index: 9999;
border-top-left-radius: 8px;
}
.g7dt-minimized-content {
display: flex;
align-items: center;
padding: 8px 16px;
gap: 8px;
}
/* 비활성화 알림 */
.g7dt-disabled-notice {
position: fixed;
bottom: 16px;
right: 16px;
background-color: #111827;
color: #ffffff;
padding: 16px;
border-radius: 8px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
z-index: 9999;
max-width: 320px;
}
/* 유틸리티 */
.g7dt-text-yellow { color: #facc15; }
.g7dt-text-cyan { color: #22d3ee; }
.g7dt-text-pink { color: #f472b6; }
.g7dt-text-orange { color: #fb923c; }
.g7dt-text-blue { color: #60a5fa; }
.g7dt-text-purple { color: #c084fc; }
.g7dt-text-green { color: #4ade80; }
.g7dt-text-red { color: #f87171; }
.g7dt-text-gray { color: #9ca3af; }
.g7dt-text-gray-dark { color: #6b7280; }
.g7dt-text-white { color: #ffffff; }
.g7dt-bg-gray-700 { background-color: #374151; }
.g7dt-bg-gray-800 { background-color: #1f2937; }
.g7dt-bg-green-600 { background-color: #059669; }
.g7dt-bg-red-600 { background-color: #dc2626; }
.g7dt-bg-blue-600 { background-color: #2563eb; }
.g7dt-bg-yellow-600 { background-color: #ca8a04; }
.g7dt-font-bold { font-weight: 700; }
.g7dt-font-mono { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; }
.g7dt-text-xs { font-size: 11px; }
.g7dt-text-sm { font-size: 13px; }
.g7dt-flex { display: flex; }
.g7dt-flex-col { flex-direction: column; }
.g7dt-items-center { align-items: center; }
.g7dt-justify-between { justify-content: space-between; }
.g7dt-gap-1 { gap: 4px; }
.g7dt-gap-2 { gap: 8px; }
.g7dt-gap-3 { gap: 12px; }
.g7dt-ml-1 { margin-left: 4px; }
.g7dt-ml-2 { margin-left: 8px; }
.g7dt-ml-4 { margin-left: 16px; }
.g7dt-mt-1 { margin-top: 4px; }
.g7dt-mt-2 { margin-top: 8px; }
.g7dt-mb-1 { margin-bottom: 4px; }
.g7dt-mb-2 { margin-bottom: 8px; }
.g7dt-p-1 { padding: 4px; }
.g7dt-p-2 { padding: 8px; }
.g7dt-px-1 { padding-left: 4px; padding-right: 4px; }
.g7dt-px-2 { padding-left: 8px; padding-right: 8px; }
.g7dt-py-1 { padding-top: 4px; padding-bottom: 4px; }
.g7dt-rounded { border-radius: 4px; }
.g7dt-rounded-lg { border-radius: 8px; }
.g7dt-border { border: 1px solid #374151; }
.g7dt-border-l { border-left: 1px solid #374151; }
.g7dt-cursor-pointer { cursor: pointer; }
.g7dt-select-none { user-select: none; }
.g7dt-overflow-auto { overflow: auto; }
.g7dt-overflow-hidden { overflow: hidden; }
.g7dt-whitespace-nowrap { white-space: nowrap; }
.g7dt-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g7dt-w-4 { width: 16px; }
.g7dt-w-full { width: 100%; }
.g7dt-h-6 { height: 24px; }
.g7dt-w-6 { width: 24px; }
.g7dt-ring-highlight {
box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.5);
background-color: rgba(113, 63, 18, 0.3);
}
/* 입력 필드 */
.g7dt-input {
background-color: #1f2937;
border: 1px solid #374151;
border-radius: 4px;
padding: 6px 12px;
color: #ffffff;
font-size: 13px;
outline: none;
transition: border-color 0.15s ease;
}
.g7dt-input:focus {
border-color: #3b82f6;
}
.g7dt-input::placeholder {
color: #6b7280;
}
/* 트리 노드 호버 */
.g7dt-tree-node {
padding: 2px 4px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.1s ease;
}
.g7dt-tree-node:hover {
background-color: rgba(55, 65, 81, 0.5);
}
/* 리사이즈 중 하이라이트 */
.g7dt-resizing .g7dt-resize-handle {
background-color: rgba(59, 130, 246, 0.3);
}
/* 액션 아이템 */
.g7dt-action-item {
padding: 8px;
border-radius: 4px;
border: 1px solid #374151;
margin-bottom: 8px;
background-color: #1f2937;
}
.g7dt-action-item:hover {
background-color: #283548;
}
/* 액션 아이템 상태별 배경색 */
.g7dt-action-item.g7dt-status-success {
background-color: rgba(34, 197, 94, 0.15);
border-color: rgba(34, 197, 94, 0.4);
}
.g7dt-action-item.g7dt-status-error {
background-color: rgba(239, 68, 68, 0.15);
border-color: rgba(239, 68, 68, 0.4);
}
.g7dt-action-item.g7dt-status-started {
background-color: rgba(59, 130, 246, 0.15);
border-color: rgba(59, 130, 246, 0.4);
}
.g7dt-action-item.g7dt-status-default {
background-color: #1f2937;
border-color: #374151;
}
/* 액션 상세 영역 (토글 펼침) */
.g7dt-action-details {
margin-top: 8px;
padding: 8px;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 4px;
}
/* 상태 뱃지 */
.g7dt-status-badge {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 9999px;
font-size: 11px;
font-weight: 500;
margin-left: 8px;
}
.g7dt-status-success { background-color: rgba(34, 197, 94, 0.3); color: #4ade80; }
.g7dt-status-error { background-color: rgba(239, 68, 68, 0.3); color: #f87171; }
.g7dt-status-warning { background-color: rgba(234, 179, 8, 0.3); color: #facc15; }
.g7dt-status-pending { background-color: rgba(59, 130, 246, 0.3); color: #60a5fa; }
.g7dt-status-info { background-color: rgba(107, 114, 128, 0.3); color: #9ca3af; }
.g7dt-status-started { background-color: rgba(59, 130, 246, 0.3); color: #60a5fa; }
.g7dt-status-default { background-color: rgba(107, 114, 128, 0.3); color: #9ca3af; }
/* 코드 블록 */
.g7dt-code {
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 12px;
background-color: #1f2937;
padding: 2px 6px;
border-radius: 4px;
}
/* 선택 불가 */
.g7dt-noselect {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* 추가 유틸리티 클래스 - flex column으로 변경하여 자식이 늘어나도록 */
.g7dt-space-y-4 {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
gap: 16px;
overflow-y: auto;
}
.g7dt-space-y-2 {
display: flex;
flex-direction: column;
gap: 8px;
}
/* 스크롤 리스트 내부용 - flex column 없이 gap만 */
.g7dt-space-y-2-flat {
display: flex;
flex-direction: column;
gap: 8px;
}
.g7dt-space-y-1 {
display: flex;
flex-direction: column;
gap: 4px;
}
.g7dt-text-muted { color: #6b7280; }
.g7dt-text-center { text-align: center; }
.g7dt-text-xxs { font-size: 10px; }
.g7dt-text-lg { font-size: 18px; }
.g7dt-flex-1 { flex: 1; }
.g7dt-flex-shrink-0 { flex-shrink: 0; }
.g7dt-flex-wrap { flex-wrap: wrap; }
.g7dt-items-start { align-items: flex-start; }
.g7dt-justify-center { justify-content: center; }
.g7dt-mb-3 { margin-bottom: 12px; }
.g7dt-mt-3 { margin-top: 12px; }
.g7dt-pt-3 { padding-top: 12px; }
.g7dt-mono { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; }
.g7dt-uppercase { text-transform: uppercase; }
.g7dt-whitespace-pre-wrap { white-space: pre-wrap; }
.g7dt-w-32 { width: 128px; }
.g7dt-max-h-16 { max-height: 64px; }
.g7dt-max-h-40 { max-height: 160px; }
.g7dt-max-h-60 { max-height: 240px; }
.g7dt-overflow-auto { overflow: auto; }
.g7dt-border-t { border-top: 1px solid #374151; }
/* 그리드 레이아웃 */
.g7dt-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.g7dt-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.g7dt-stats-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.g7dt-stats-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.g7dt-stats-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.g7dt-stats-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
/* 카드 및 리스트 스타일 */
.g7dt-card {
background-color: #1f2937;
padding: 12px;
border-radius: 4px;
border: 1px solid #374151;
}
.g7dt-stat-card {
background-color: #1f2937;
padding: 12px;
border-radius: 4px;
text-align: center;
border: 1px solid #374151;
}
.g7dt-stat-card-sm {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
text-align: center;
border: 1px solid #374151;
}
.g7dt-stat-value {
font-size: 20px;
font-weight: 700;
}
.g7dt-stat-value-sm {
font-size: 18px;
font-weight: 700;
}
.g7dt-stat-label {
font-size: 11px;
color: #6b7280;
}
/* 스크롤 리스트 - flex로 남은 공간 채움 */
.g7dt-scroll-list {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-scroll-list > * + * { margin-top: 4px; }
.g7dt-scroll-list-sm {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-scroll-list-sm > * + * { margin-top: 4px; }
.g7dt-scroll-list-lg {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-scroll-list-lg > * + * { margin-top: 4px; }
.g7dt-scroll-list-xs {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-scroll-list-xs > * + * { margin-top: 4px; }
/* 탭 콘텐츠 래퍼 - flex column으로 자식이 늘어나도록 */
.g7dt-tab-content {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
/* 섹션 래퍼 - flex로 스크롤 리스트가 늘어나도록 */
.g7dt-section {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
/* 빈 상태 */
.g7dt-empty-state {
color: #6b7280;
font-size: 13px;
text-align: center;
padding: 16px;
}
/* 버튼 스타일 */
.g7dt-btn-secondary {
background-color: #374151;
color: #ffffff;
font-size: 12px;
padding: 4px 12px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.15s ease;
}
.g7dt-btn-secondary:hover {
background-color: #4b5563;
}
.g7dt-btn-danger {
background-color: #b91c1c;
color: #ffffff;
font-size: 12px;
padding: 4px 12px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.15s ease;
}
.g7dt-btn-danger:hover {
background-color: #dc2626;
}
.g7dt-close-btn {
color: #9ca3af;
font-size: 12px;
background: none;
border: none;
cursor: pointer;
padding: 4px;
}
.g7dt-close-btn:hover {
color: #ffffff;
}
.g7dt-filter-btn {
font-size: 12px;
padding: 4px 12px;
border-radius: 4px;
background-color: #1f2937;
color: #9ca3af;
border: none;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-filter-btn:hover {
background-color: #374151;
}
.g7dt-filter-btn-active,
.g7dt-filter-btn-active-yellow {
background-color: #ca8a04;
color: #ffffff;
}
.g7dt-prefix-btn {
font-size: 12px;
padding: 4px 8px;
border-radius: 4px;
background-color: #1f2937;
border: 1px solid #374151;
color: #ffffff;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-prefix-btn:hover {
border-color: #4b5563;
}
.g7dt-prefix-btn-active {
background-color: #2563eb;
border-color: #1d4ed8;
color: #ffffff;
}
/* Select 스타일 */
.g7dt-select {
background-color: #1f2937;
border: 1px solid #374151;
border-radius: 4px;
padding: 4px 12px;
color: #ffffff;
font-size: 13px;
cursor: pointer;
}
/* 리스트 아이템 */
.g7dt-list-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid #374151;
display: flex;
justify-content: space-between;
align-items: center;
}
.g7dt-list-item:hover {
background-color: #374151;
}
/* 렌더 로그 아이템 */
.g7dt-render-log-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid #374151;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-render-log-item:hover {
border-color: #4b5563;
}
.g7dt-render-log-item.g7dt-selected {
border-color: #2563eb;
background-color: rgba(37, 99, 235, 0.2);
}
.g7dt-render-log-item.g7dt-warning {
border-color: rgba(161, 98, 7, 0.5);
}
.g7dt-render-log-item.g7dt-warning:hover {
border-color: #ca8a04;
}
.g7dt-render-comp-item {
background-color: #111827;
padding: 8px;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
}
/* 경고 박스 */
.g7dt-warning-box {
background-color: rgba(161, 98, 7, 0.2);
padding: 8px;
border-radius: 4px;
border: 1px solid rgba(161, 98, 7, 0.5);
}
.g7dt-list {
list-style-type: disc;
padding-left: 16px;
}
/* 태그 */
.g7dt-tag {
font-size: 12px;
background-color: #1f2937;
padding: 4px 8px;
border-radius: 4px;
border: 1px solid #374151;
}
.g7dt-role-tag {
background-color: rgba(37, 99, 235, 0.3);
color: #93c5fd;
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
}
.g7dt-perm-tag {
background-color: rgba(147, 51, 234, 0.3);
color: #d8b4fe;
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
}
/* Pre 스타일 */
.g7dt-pre {
margin-top: 4px;
padding: 8px;
background-color: #111827;
border-radius: 4px;
overflow: auto;
max-height: 80px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 12px;
}
.g7dt-pre-stack {
margin-top: 4px;
padding: 8px;
background-color: #111827;
border-radius: 4px;
overflow: auto;
max-height: 128px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 10px;
}
/* 인증 이벤트 아이템 */
.g7dt-auth-event-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid #374151;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-auth-event-item:hover {
border-color: #4b5563;
}
.g7dt-auth-event-item.g7dt-selected {
border-color: #2563eb;
background-color: rgba(37, 99, 235, 0.2);
}
.g7dt-auth-event-item.g7dt-error {
border-color: rgba(185, 28, 28, 0.5);
}
.g7dt-auth-event-item.g7dt-error:hover {
border-color: #dc2626;
}
/* 헤더 아이템 */
.g7dt-header-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid #374151;
display: flex;
justify-content: space-between;
}
/* 로그 아이템 */
.g7dt-log-item {
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-log-item.g7dt-selected {
border-color: #2563eb;
background-color: rgba(37, 99, 235, 0.2);
}
.g7dt-log-error {
background-color: rgba(185, 28, 28, 0.3);
border-color: #b91c1c;
}
.g7dt-log-warn {
background-color: rgba(161, 98, 7, 0.3);
border-color: #a16207;
}
.g7dt-log-info {
background-color: rgba(37, 99, 235, 0.3);
border-color: #2563eb;
}
.g7dt-log-debug {
background-color: #1f2937;
border-color: #4b5563;
}
.g7dt-log-default {
background-color: #1f2937;
border-color: #374151;
}
/* 스타일 이슈 아이템 */
.g7dt-style-issue-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-style-issue-item:hover {
border-color: #4b5563;
}
.g7dt-style-issue-item.g7dt-selected {
border-color: #2563eb;
background-color: rgba(37, 99, 235, 0.2);
}
.g7dt-severity-error { border-color: rgba(185, 28, 28, 0.5); }
.g7dt-severity-warning { border-color: rgba(161, 98, 7, 0.5); }
.g7dt-severity-info { border-color: rgba(37, 99, 235, 0.5); }
/* 뱃지 */
.g7dt-badge-error {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(185, 28, 28, 0.5);
color: #fca5a5;
}
.g7dt-badge-warning {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(161, 98, 7, 0.5);
color: #fcd34d;
}
.g7dt-badge-info {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(37, 99, 235, 0.5);
color: #93c5fd;
}
.g7dt-badge-success {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(34, 197, 94, 0.5);
color: #86efac;
}
.g7dt-badge-gray {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(107, 114, 128, 0.5);
color: #d1d5db;
}
.g7dt-badge-blue {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(59, 130, 246, 0.5);
color: #93c5fd;
}
.g7dt-badge-purple {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: rgba(147, 51, 234, 0.5);
color: #d8b4fe;
}
/* 미니 뱃지 */
.g7dt-mini-badge {
font-size: 10px;
padding: 1px 6px;
border-radius: 4px;
}
/* 데이터소스 그리드 */
.g7dt-ds-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.g7dt-ds-item {
background-color: #1f2937;
padding: 12px;
border-radius: 8px;
border: 1px solid #374151;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-ds-item:hover {
border-color: #4b5563;
background-color: #283548;
}
.g7dt-ds-selected {
border-color: #2563eb;
background-color: rgba(37, 99, 235, 0.15);
}
/* 액션 리스트 - flex 부모에서 늘어남 */
.g7dt-action-list {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-action-list > * + * { margin-top: 8px; }
/* 이벤트 리스트 - flex 부모에서 늘어남 */
.g7dt-event-list {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-event-list > * + * { margin-top: 4px; }
/* 핸들러 리스트 - flex 부모에서 늘어남 */
.g7dt-handler-list {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-handler-list > * + * { margin-top: 4px; }
/* 표현식 리스트 - flex 부모에서 늘어남 */
.g7dt-expr-list {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.g7dt-expr-list > * + * { margin-top: 4px; }
.g7dt-expr-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid #374151;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-expr-item:hover {
border-color: #4b5563;
}
.g7dt-expr-selected {
border-color: #2563eb;
background-color: rgba(37, 99, 235, 0.2);
}
.g7dt-expr-warning {
border-color: rgba(161, 98, 7, 0.5);
}
.g7dt-expr-warning:hover {
border-color: #ca8a04;
}
/* 조건 아이템 */
.g7dt-condition-item {
background-color: #1f2937;
padding: 8px;
border-radius: 4px;
font-size: 12px;
border: 1px solid #374151;
}
.g7dt-condition-true {
border-color: rgba(34, 197, 94, 0.5);
}
.g7dt-condition-false {
border-color: rgba(185, 28, 28, 0.5);
}
/* 키 태그 */
.g7dt-key-tag {
font-size: 11px;
background-color: #374151;
color: #d1d5db;
padding: 2px 6px;
border-radius: 4px;
}
/* 의존성 태그 */
.g7dt-dep-tag {
font-size: 11px;
background-color: rgba(34, 197, 94, 0.2);
color: #86efac;
padding: 2px 6px;
border-radius: 4px;
}
/* 타입 태그 */
.g7dt-type-tag {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: #374151;
}
/* 태그 블루 */
.g7dt-tag-blue {
background-color: rgba(59, 130, 246, 0.3);
color: #93c5fd;
}
/* 경고 태그 */
.g7dt-warning-tag {
font-size: 11px;
background-color: rgba(161, 98, 7, 0.3);
color: #fcd34d;
padding: 2px 6px;
border-radius: 4px;
}
/* 신뢰도 뱃지 */
.g7dt-confidence-badge {
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
background-color: #374151;
}
/* 증상 버튼 */
.g7dt-symptom-btn {
font-size: 12px;
padding: 6px 12px;
border-radius: 4px;
background-color: #1f2937;
border: 1px solid #374151;
color: #9ca3af;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-symptom-btn:hover {
border-color: #4b5563;
color: #ffffff;
}
.g7dt-symptom-active {
background-color: #2563eb;
border-color: #1d4ed8;
color: #ffffff;
}
/* 버튼 추가 스타일 */
.g7dt-btn-close {
color: #9ca3af;
background: none;
border: none;
cursor: pointer;
padding: 4px;
font-size: 14px;
transition: color 0.15s ease;
}
.g7dt-btn-close:hover {
color: #ffffff;
}
.g7dt-btn-danger-sm {
background-color: #b91c1c;
color: #ffffff;
font-size: 11px;
padding: 2px 8px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.15s ease;
}
.g7dt-btn-danger-sm:hover {
background-color: #dc2626;
}
.g7dt-btn-disabled {
opacity: 0.5;
cursor: not-allowed;
}
.g7dt-btn-text {
background: none;
border: none;
color: #60a5fa;
cursor: pointer;
font-size: 12px;
padding: 0;
}
.g7dt-btn-text:hover {
text-decoration: underline;
}
/* 필터 활성화 */
.g7dt-filter-active {
background-color: #2563eb;
color: #ffffff;
}
/* 체크박스 */
.g7dt-checkbox {
width: 16px;
height: 16px;
cursor: pointer;
}
.g7dt-checkbox-label {
font-size: 13px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
}
/* 카드 에러 */
.g7dt-card-error {
background-color: #1f2937;
padding: 12px;
border-radius: 4px;
border: 1px solid rgba(185, 28, 28, 0.5);
}
/* 에러 박스 */
.g7dt-error-box {
background-color: rgba(185, 28, 28, 0.2);
padding: 8px;
border-radius: 4px;
border: 1px solid rgba(185, 28, 28, 0.5);
}
.g7dt-error-inline {
color: #f87171;
font-size: 12px;
}
/* 경고 박스 라이트 */
.g7dt-warning-box-light {
background-color: rgba(161, 98, 7, 0.15);
padding: 8px;
border-radius: 4px;
border: 1px solid rgba(161, 98, 7, 0.3);
}
/* 경고 카드 (빨간 배경) */
.g7dt-warning-card {
background-color: rgba(185, 28, 28, 0.4);
padding: 12px;
border-radius: 4px;
border: 1px solid rgba(185, 28, 28, 0.6);
}
/* 빈 메시지 */
.g7dt-empty-message {
color: #6b7280;
font-size: 13px;
text-align: center;
}
/* 요약 (토글 헤더) - 투명 배경 */
.g7dt-summary {
font-size: 12px;
font-weight: 500;
cursor: pointer;
padding: 4px 0;
color: #9ca3af;
list-style: none;
}
.g7dt-summary::-webkit-details-marker {
display: none;
}
.g7dt-summary::before {
content: '▶ ';
font-size: 10px;
}
details[open] > .g7dt-summary::before {
content: '▼ ';
}
/* 상세 영역 - 배경 없음, 펼쳐진 내용만 스타일 */
.g7dt-details {
margin-top: 4px;
}
/* 펼쳐진 내용에만 배경색 적용 - 스크롤 제거 */
.g7dt-details > .g7dt-pre {
background-color: rgba(0, 0, 0, 0.3);
border-radius: 4px;
max-height: none;
overflow: visible;
}
/* 프로그레스 바 */
.g7dt-progress-bar {
width: 100%;
height: 8px;
background-color: #374151;
border-radius: 4px;
overflow: hidden;
}
.g7dt-progress-fill {
height: 100%;
background-color: #2563eb;
transition: width 0.3s ease;
}
/* 대기 중 요청 */
.g7dt-pending-request {
background-color: rgba(59, 130, 246, 0.2);
border: 1px solid rgba(59, 130, 246, 0.5);
padding: 8px;
border-radius: 4px;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
/* 추가 유틸리티 */
.g7dt-space-y-3 > * + * { margin-top: 12px; }
.g7dt-space-y-6 > * + * { margin-top: 24px; }
.g7dt-mr-2 { margin-right: 8px; }
.g7dt-pl-2 { padding-left: 8px; }
.g7dt-py-4 { padding-top: 16px; padding-bottom: 16px; }
.g7dt-py-8 { padding-top: 32px; padding-bottom: 32px; }
.g7dt-col-span-2 { grid-column: span 2; }
.g7dt-min-w-0 { min-width: 0; }
.g7dt-items-end { align-items: flex-end; }
.g7dt-text-lightgray { color: #d1d5db; }
.g7dt-text-darkgray { color: #4b5563; }
.g7dt-truncate-60 {
max-width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.g7dt-stat-label-xs {
font-size: 10px;
color: #6b7280;
}
.g7dt-stat-value-lg {
font-size: 24px;
font-weight: 700;
}
.g7dt-status-default { background-color: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.g7dt-status-started { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
/* Layout 탭 전용 스타일 */
.g7dt-btn-small {
padding: 4px 8px;
font-size: 11px;
border-radius: 4px;
background-color: #374151;
color: #9ca3af;
border: none;
cursor: pointer;
transition: all 0.15s ease;
}
.g7dt-btn-small:hover {
background-color: #4b5563;
color: #ffffff;
}
.g7dt-section-btn {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background-color: #1f2937;
border: 1px solid #374151;
border-radius: 4px;
color: #d1d5db;
cursor: pointer;
font-size: 12px;
transition: all 0.15s ease;
}
.g7dt-section-btn:hover {
background-color: #374151;
border-color: #4b5563;
}
.g7dt-section-btn.g7dt-selected {
background-color: #1e40af;
border-color: #3b82f6;
color: #ffffff;
}
.g7dt-history-item {
padding: 8px;
background-color: #1f2937;
border-radius: 4px;
border: 1px solid #374151;
}
.g7dt-history-item:hover {
border-color: #4b5563;
}
.g7dt-max-h-96 {
max-height: 24rem;
}
.g7dt-overflow-auto {
overflow: auto;
}
.g7dt-list-disc {
list-style-type: disc;
}
.g7dt-cursor-pointer {
cursor: pointer;
}
`,nk=()=>{const r="g7-devtools-styles";if(document.getElementById(r))return;const e=document.createElement("style");e.id=r,e.textContent=tk,document.head.appendChild(e)},tx={state:"상태",actions:"액션",cache:"캐시",diagnose:"진단",performance:"성능",lifecycle:"라이프사이클",network:"네트워크",form:"Form",conditional:"조건부",expression:"표현식",handlers:"핸들러",events:"이벤트",datasources:"데이터소스",renders:"렌더링",styles:"스타일",auth:"인증",logs:"로그",layout:"레이아웃",changedetection:"변경감지",staleclosure:"Stale Closure",nestedcontext:"Context",modalscope:"모달스코프",namedactions:"Named Actions"},ak=700,sk=500,nx=400,ax=300,sx="g7-devtools-panel",Bg=r=>r===null||r===void 0?"g7dt-text-gray":typeof r=="string"?"g7dt-text-yellow":typeof r=="number"?"g7dt-text-cyan":typeof r=="boolean"?"g7dt-text-pink":Array.isArray(r)?"g7dt-text-orange":typeof r=="object"?"g7dt-text-blue":"g7dt-text-white",rk=r=>r===null?"null":r===void 0?"undefined":Array.isArray(r)?`Array(${r.length})`:typeof r=="object"?`Object(${Object.keys(r).length})`:typeof r,ik=r=>r===null?"null":r===void 0?"undefined":typeof r=="string"?r.length>50?`"${r.substring(0,50)}..."`:`"${r}"`:typeof r=="boolean"?r?"true":"false":typeof r=="number"?String(r):"",rx=()=>{try{const r=localStorage.getItem(sx);if(r)return JSON.parse(r)}catch(r){console.warn("[G7DevTools] 설정 로드 실패:",r)}return{}},ix=r=>{try{const n={...rx(),...r};localStorage.setItem(sx,JSON.stringify(n))}catch(e){console.warn("[G7DevTools] 설정 저장 실패:",e)}},gi=({keyName:r,value:e,path:n,expandedPaths:a,onToggle:i,searchTerm:o,depth:d=0})=>{const g=e!==null&&typeof e=="object",h=a.has(n),f=Array.isArray(e),p=o&&(r.toLowerCase().includes(o.toLowerCase())||typeof e=="string"&&e.toLowerCase().includes(o.toLowerCase())||typeof e=="number"&&String(e).includes(o)),x=w=>{w.stopPropagation(),g&&i(n)},y=g?Object.entries(e):[];return l.jsxs("div",{style:{marginLeft:d>0?"16px":"0"},children:[l.jsxs("div",{className:`g7dt-tree-node g7dt-flex g7dt-items-center g7dt-gap-1 ${p?"g7dt-ring-highlight":""}`,onClick:x,children:[g?l.jsx("span",{className:"g7dt-text-gray g7dt-w-4 g7dt-text-xs g7dt-select-none",style:{textAlign:"center"},children:h?"▼":"▶"}):l.jsx("span",{className:"g7dt-w-4"}),l.jsx("span",{className:"g7dt-text-purple g7dt-text-xs",children:r}),l.jsx("span",{className:"g7dt-text-gray-dark g7dt-text-xs",children:":"}),g?l.jsxs("span",{className:`g7dt-text-xs ${Bg(e)}`,children:[f?"[":"{",!h&&l.jsx("span",{className:"g7dt-text-gray",style:{margin:"0 4px"},children:rk(e)}),!h&&(f?"]":"}")]}):l.jsx("span",{className:`g7dt-text-xs ${Bg(e)}`,children:ik(e)}),!g&&l.jsxs("span",{className:"g7dt-text-gray-dark g7dt-text-xs g7dt-ml-1",children:["(",typeof e,")"]})]}),g&&h&&l.jsxs("div",{className:"g7dt-border-l",style:{marginLeft:"8px"},children:[y.map(([w,v])=>l.jsx(gi,{keyName:f?`[${w}]`:w,value:v,path:`${n}.${w}`,expandedPaths:a,onToggle:i,searchTerm:o,depth:d+1},`${n}.${w}`)),l.jsx("div",{className:"g7dt-ml-4 g7dt-text-xs",children:l.jsx("span",{className:Bg(e),children:f?"]":"}"})})]})]})},ok=({state:r,devTools:e})=>{const[n,a]=j.useState(new Set(["_global","_local","_computed","_isolated","$parent"])),[i,o]=j.useState(""),[d,g]=j.useState(!1),[h,f]=j.useState(!1),[p,x]=j.useState(null),y=j.useCallback(()=>{e&&x(e.getComputedDependencyTrackingInfo())},[e]);j.useEffect(()=>{if(h&&e){y();const L=setInterval(y,2e3);return()=>clearInterval(L)}},[h,e,y]);const w=L=>{switch(L){case"state-change":return"📊";case"prop-change":return"📥";case"dependency-change":return"🔗";case"manual":return"👆";case"initial":return"🚀";default:return"❓"}},v=j.useCallback(L=>{a(z=>{const Y=new Set(z);return Y.has(L)?Y.delete(L):Y.add(L),Y})},[]),C=j.useCallback((L,z)=>{const Y=[z];if(L!==null&&typeof L=="object")for(const[he,be]of Object.entries(L))Y.push(...C(be,`${z}.${he}`));return Y},[]),k=j.useCallback(()=>{if(d)a(new Set(["_global","_local","_computed","_isolated","$parent"]));else{const L=new Set;C(r._global,"_global").forEach(z=>L.add(z)),C(r._local,"_local").forEach(z=>L.add(z)),C(r._computed,"_computed").forEach(z=>L.add(z)),C(r._isolated,"_isolated").forEach(z=>L.add(z)),r.$parent&&C(r.$parent,"$parent").forEach(z=>L.add(z)),a(L)}g(!d)},[d,r,C]),A=Object.keys(r._global||{}).length,R=Object.keys(r._local||{}).length,N=Object.keys(r._computed||{}).length,D=Object.keys(r._isolated||{}).length,M=Object.keys(r.$parent||{}).length;return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-items-center g7dt-flex-shrink-0",children:[l.jsx("input",{type:"text",placeholder:"키 또는 값 검색...",value:i,onChange:L=>o(L.target.value),className:"g7dt-input g7dt-flex-1"}),l.jsx("button",{onClick:k,className:"g7dt-btn g7dt-bg-gray-700",children:d?"모두 접기":"모두 펼치기"})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-3 g7dt-text-xs g7dt-text-gray g7dt-flex-wrap g7dt-flex-shrink-0",children:[l.jsxs("span",{children:[l.jsx("span",{className:"g7dt-text-yellow",children:"●"})," string"]}),l.jsxs("span",{children:[l.jsx("span",{className:"g7dt-text-cyan",children:"●"})," number"]}),l.jsxs("span",{children:[l.jsx("span",{className:"g7dt-text-pink",children:"●"})," boolean"]}),l.jsxs("span",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"●"})," null"]}),l.jsxs("span",{children:[l.jsx("span",{className:"g7dt-text-orange",children:"●"})," array"]}),l.jsxs("span",{children:[l.jsx("span",{className:"g7dt-text-blue",children:"●"})," object"]})]}),l.jsxs("div",{className:"g7dt-bg-gray-800 g7dt-rounded g7dt-p-2 g7dt-overflow-auto g7dt-border",style:{flex:1,minHeight:0},children:[l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-green g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>v("_global"),children:[l.jsx("span",{children:n.has("_global")?"▼":"▶"}),l.jsx("span",{children:"_global"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",A,"개 키)"]})]}),n.has("_global")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._global||{}).map(([L,z])=>l.jsx(gi,{keyName:L,value:z,path:`_global.${L}`,expandedPaths:n,onToggle:v,searchTerm:i},`_global.${L}`))})]}),l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-blue g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>v("_local"),children:[l.jsx("span",{children:n.has("_local")?"▼":"▶"}),l.jsx("span",{children:"_local"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",R,"개 키)"]})]}),n.has("_local")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._local||{}).map(([L,z])=>l.jsx(gi,{keyName:L,value:z,path:`_local.${L}`,expandedPaths:n,onToggle:v,searchTerm:i},`_local.${L}`))})]}),l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-purple g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>v("_computed"),children:[l.jsx("span",{children:n.has("_computed")?"▼":"▶"}),l.jsx("span",{children:"_computed"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",N,"개 키)"]})]}),n.has("_computed")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._computed||{}).map(([L,z])=>l.jsx(gi,{keyName:L,value:z,path:`_computed.${L}`,expandedPaths:n,onToggle:v,searchTerm:i},`_computed.${L}`))})]}),D>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-orange g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>v("_isolated"),children:[l.jsx("span",{children:n.has("_isolated")?"▼":"▶"}),l.jsx("span",{children:"_isolated"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",D,"개 스코프)"]})]}),n.has("_isolated")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._isolated||{}).map(([L,z])=>l.jsx(gi,{keyName:L,value:z,path:`_isolated.${L}`,expandedPaths:n,onToggle:v,searchTerm:i},`_isolated.${L}`))})]}),M>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-cyan g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>v("$parent"),children:[l.jsx("span",{children:n.has("$parent")?"▼":"▶"}),l.jsx("span",{children:"$parent"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",M,"개 키)"]})]}),n.has("$parent")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r.$parent||{}).map(([L,z])=>l.jsx(gi,{keyName:L,value:z,path:`$parent.${L}`,expandedPaths:n,onToggle:v,searchTerm:i},`$parent.${L}`))})]})]}),e&&l.jsx("div",{className:"g7dt-flex g7dt-justify-end g7dt-mt-2",children:l.jsx("button",{onClick:()=>f(!h),className:`g7dt-tab-button ${h?"g7dt-tab-active":""}`,children:"🧮 Computed 추적"})}),h&&p&&l.jsxs("div",{className:"g7dt-card g7dt-mt-2",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["Computed 의존성 추적 (",p.properties.length,"개)"]}),l.jsxs("div",{className:"g7dt-stats-grid g7dt-mb-3",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-purple",children:p.stats.totalComputed}),l.jsx("div",{className:"g7dt-stat-label",children:"Computed"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:p.stats.totalRecalculations}),l.jsx("div",{className:"g7dt-stat-label",children:"재계산"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-yellow",children:p.stats.unnecessaryRecalculations}),l.jsx("div",{className:"g7dt-stat-label",children:"불필요"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsxs("div",{className:"g7dt-stat-value g7dt-text-green",children:[p.stats.avgComputationTime.toFixed(1),"ms"]}),l.jsx("div",{className:"g7dt-stat-label",children:"평균시간"})]})]}),p.stats.cycleDetectionCount>0&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-red g7dt-mb-3 g7dt-p-2 g7dt-bg-red-900 g7dt-rounded",children:["⚠️ 순환 의존성 감지: ",p.stats.cycleDetectionCount,"건"]}),p.stats.topRecalculated.length>0&&l.jsxs("div",{className:"g7dt-mb-3",children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"자주 재계산되는 속성"}),l.jsx("div",{className:"g7dt-space-y-1",children:p.stats.topRecalculated.slice(0,3).map((L,z)=>l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[l.jsx("span",{className:"g7dt-text-purple g7dt-font-mono",children:L.name}),l.jsxs("span",{className:"g7dt-text-muted",children:[L.count,"회"]})]},z))})]}),p.recalcLogs.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"재계산 로그가 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-40 g7dt-overflow-y-auto",children:p.recalcLogs.slice().reverse().slice(0,20).map(L=>l.jsxs("div",{className:`g7dt-list-item ${L.valueChanged?"":"g7dt-border-yellow"}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:w(L.trigger)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-purple g7dt-font-mono",children:L.computedName}),!L.valueChanged&&l.jsx("span",{className:"g7dt-badge g7dt-text-xs g7dt-text-yellow",children:"값 변경 없음"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[L.computationTime.toFixed(1),"ms"]})]}),L.triggeredBy&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["트리거: ",l.jsx("span",{className:"g7dt-text-blue",children:L.triggeredBy.path})]})]},L.id))})]})]})},lk=({actions:r,devTools:e})=>{const[n,a]=j.useState(""),[i,o]=j.useState("actions"),[d,g]=j.useState(null),[h,f]=j.useState(null),p=j.useCallback(()=>{e&&g(e.getSequenceTrackingInfo())},[e]);j.useEffect(()=>{if(i==="sequences"&&e){p();const C=setInterval(p,2e3);return()=>clearInterval(C)}},[i,e,p]);const x=n?r.filter(C=>C.type.toLowerCase().includes(n.toLowerCase())||C.status===n):r,y=C=>{switch(C){case"success":return"g7dt-status-success";case"error":return"g7dt-status-error";case"started":return"g7dt-status-started";default:return"g7dt-status-default"}},w=C=>{switch(C){case"success":return"g7dt-badge-success";case"error":return"g7dt-badge-error";default:return"g7dt-badge-warning"}},v=h&&d?d.executions.find(C=>C.id===h):null;return l.jsxs("div",{className:"g7dt-space-y-4",children:[e&&l.jsx("div",{className:"g7dt-card",children:l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsxs("button",{className:`g7dt-tab-button ${i==="actions"?"g7dt-tab-active":""}`,onClick:()=>o("actions"),children:["📋 액션 (",r.length,")"]}),l.jsxs("button",{className:`g7dt-tab-button ${i==="sequences"?"g7dt-tab-active":""}`,onClick:()=>o("sequences"),children:["🔗 Sequence (",d?.executions.length||0,")"]})]})}),i==="actions"&&l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-flex-shrink-0",children:[l.jsx("input",{type:"text",placeholder:"액션 타입 또는 상태로 필터...",value:n,onChange:C=>a(C.target.value),className:"g7dt-input g7dt-flex-1"}),l.jsx("button",{onClick:()=>a(""),className:"g7dt-btn-text",children:"초기화"})]}),i==="sequences"&&d&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Sequence 통계"}),l.jsxs("div",{className:"g7dt-stats-grid-3",children:[l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-blue",children:d.stats.totalSequences}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 실행"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-green",children:d.stats.successCount}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"성공"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:d.stats.errorCount}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"실패"})]})]})]}),l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Sequence 실행 목록"}),d.executions.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"실행된 Sequence가 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-40 g7dt-overflow-y-auto",children:d.executions.slice().reverse().map(C=>l.jsx("div",{className:`g7dt-list-item g7dt-cursor-pointer ${h===C.id?"g7dt-selected":""} ${C.status==="error"?"g7dt-border-red":""}`,onClick:()=>f(h===C.id?null:C.id),children:l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:C.status==="completed"?"✅":C.status==="error"?"❌":"⏳"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-white",children:[C.actions.length,"개 액션"]}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[C.totalDuration.toFixed(0),"ms"]})]})},C.id))})]}),v&&l.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["🔗 Sequence 상세 (",v.actions.length,"개 액션)"]}),l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:v.actions.map((C,k)=>l.jsxs("div",{className:`g7dt-list-item ${C.status==="error"?"g7dt-border-red":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted",children:["#",C.index+1]}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-font-mono",children:C.handler}),l.jsx("span",{className:`g7dt-text-xs ${C.status==="success"?"g7dt-text-green":"g7dt-text-red"}`,children:C.status==="success"?"✓":"✕"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[C.duration.toFixed(0),"ms"]})]}),C.stateChanges&&C.stateChanges.length>0&&l.jsxs("div",{className:"g7dt-mt-1",children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 변경:"}),C.stateChanges.slice(0,3).map((A,R)=>l.jsx("div",{className:"g7dt-text-xs g7dt-text-yellow g7dt-ml-2",children:A.path},R)),C.stateChanges.length>3&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-2",children:["...외 ",C.stateChanges.length-3,"개"]})]})]},k))})]})]}),i==="actions"&&l.jsx("div",{className:"g7dt-section",children:l.jsx("div",{className:"g7dt-scroll-list g7dt-space-y-2-flat g7dt-action-list",children:x.length===0?l.jsx("div",{className:"g7dt-empty-message",children:"액션 이력이 없습니다"}):x.slice(-30).reverse().map((C,k)=>l.jsxs("div",{className:`g7dt-action-item ${y(C.status)}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-start",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-font-mono g7dt-font-bold",children:C.type}),l.jsx("span",{className:`g7dt-status-badge ${w(C.status)}`,children:C.status})]}),l.jsx("span",{className:"g7dt-text-gray",children:C.duration?`${C.duration.toFixed(2)}ms`:"-"})]}),C.error&&l.jsx("div",{className:"g7dt-error-box",children:C.error.message}),C.params&&Object.keys(C.params).length>0&&l.jsxs("details",{className:"g7dt-details",children:[l.jsx("summary",{className:"g7dt-summary",children:"파라미터"}),l.jsx("pre",{className:"g7dt-pre",children:JSON.stringify(C.params,null,2)})]})]},`${C.id}-${k}`))})})]})},ck=({stats:r,devTools:e})=>{const[n,a]=j.useState(null),[i,o]=j.useState(!1),d=j.useCallback(()=>{a(e.getCacheDecisionTrackingInfo())},[e]);j.useEffect(()=>{if(i){d();const f=setInterval(d,2e3);return()=>clearInterval(f)}},[i,d]);const g=()=>{e.resetCacheStats(),console.log("[G7DevTools] 캐시 통계 초기화")},h=f=>{switch(f){case"use_cache":return"✅";case"skip_cache":return"⏭️";case"invalidate":return"🗑️";default:return"❓"}};return l.jsxs("div",{className:"g7dt-space-y-6",children:[l.jsxs("div",{className:"g7dt-stats-grid",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-green",children:r.hits}),l.jsx("div",{className:"g7dt-stat-label",children:"Cache Hits"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-red",children:r.misses}),l.jsx("div",{className:"g7dt-stat-label",children:"Cache Misses"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:r.entries}),l.jsx("div",{className:"g7dt-stat-label",children:"Entries"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsxs("div",{className:"g7dt-stat-value g7dt-text-purple",children:[r.hitRate.toFixed(1),"%"]}),l.jsx("div",{className:"g7dt-stat-label",children:"Hit Rate"})]})]}),l.jsxs("div",{className:"g7dt-space-y-2",children:[l.jsx("div",{className:"g7dt-text-sm g7dt-text-gray",children:"캐시 히트율"}),l.jsx("div",{className:"g7dt-progress-bar",children:l.jsx("div",{className:"g7dt-progress-fill",style:{width:`${r.hitRate}%`}})})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsx("button",{onClick:g,className:"g7dt-btn-danger",children:"캐시 통계 초기화"}),l.jsx("button",{onClick:()=>o(!i),className:`g7dt-tab-button ${i?"g7dt-tab-active":""}`,children:"📋 Decision Log"})]}),i&&n&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["캐시 결정 로그 (",n.decisions.length,"개)"]}),n.decisions.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"캐시 결정 기록이 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:n.decisions.slice().reverse().slice(0,50).map(f=>l.jsxs("div",{className:`g7dt-list-item ${f.decision==="skip_cache"?"g7dt-border-yellow":f.decision==="invalidate"?"g7dt-border-red":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:h(f.decision)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-font-mono g7dt-truncate",style:{maxWidth:"200px"},children:f.expression}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:f.decision})]}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:f.reason}),f.context&&l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-mt-1",children:[f.context.isInIteration&&l.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"🔄 iteration"}),f.context.isInAction&&l.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"⚡ action"})]})]},f.id))})]})]})},dk=()=>{const[r,e]=j.useState([]),[n,a]=j.useState([]),[i,o]=j.useState(""),d=["이전 값이 전송됨","모든 행이 같은 값","상태가 업데이트 안됨","API 호출이 안됨","초기값이 없음","무한 로딩","Form 값이 저장 안됨","iteration 데이터 중복"],g=p=>{e(x=>x.includes(p)?x.filter(y=>y!==p):[...x,p])},h=()=>{i&&!r.includes(i)&&(e(p=>[...p,i]),o(""))},f=async()=>{const{DiagnosticEngine:p}=await Promise.resolve().then(()=>Qj),y=new p().analyze(r);a(y)};return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"증상 선택"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:d.map(p=>l.jsx("button",{onClick:()=>g(p),className:r.includes(p)?"g7dt-symptom-btn g7dt-symptom-active":"g7dt-symptom-btn",children:p},p))})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsx("input",{type:"text",placeholder:"직접 증상 입력...",value:i,onChange:p=>o(p.target.value),onKeyDown:p=>p.key==="Enter"&&h(),className:"g7dt-input g7dt-flex-1"}),l.jsx("button",{onClick:h,className:"g7dt-btn-secondary",children:"추가"})]}),l.jsxs("button",{onClick:f,disabled:r.length===0,className:r.length===0?"g7dt-btn-primary g7dt-btn-disabled g7dt-w-full":"g7dt-btn-primary g7dt-w-full",children:["진단 실행 (",r.length,"개 증상)"]}),n.length>0&&l.jsxs("div",{className:"g7dt-space-y-3",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"진단 결과"}),n.slice(0,5).map((p,x)=>l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("span",{className:"g7dt-font-bold g7dt-text-yellow",children:p.rule.name}),l.jsxs("span",{className:"g7dt-confidence-badge",children:[(p.confidence*100).toFixed(0),"%"]})]}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-lightgray",children:p.rule.solution}),p.rule.codeExample&&l.jsx("pre",{className:"g7dt-pre g7dt-mt-2",children:p.rule.codeExample})]},x))]})]})},uk=({devTools:r})=>{const e=r.getPerformanceInfo();return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-stats-grid-2",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:e.bindingEvalCount}),l.jsx("div",{className:"g7dt-stat-label",children:"바인딩 평가 횟수"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-purple",children:e.renderCounts.size}),l.jsx("div",{className:"g7dt-stat-label",children:"렌더링된 컴포넌트"})]})]}),e.memoryWarnings.length>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-red g7dt-mb-2",children:"메모리 경고"}),l.jsx("div",{className:"g7dt-space-y-2",children:e.memoryWarnings.map((n,a)=>l.jsxs("div",{className:"g7dt-warning-card",children:[l.jsx("div",{className:"g7dt-font-bold",children:n.type}),l.jsx("div",{className:"g7dt-text-lightgray",children:n.message}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-gray g7dt-mt-1",children:n.suggestion})]},a))})]}),e.renderCounts.size>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"컴포넌트별 렌더링"}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list",children:Array.from(e.renderCounts.entries()).sort((n,a)=>a[1]-n[1]).slice(0,10).map(([n,a])=>l.jsxs("div",{className:"g7dt-list-item",children:[l.jsx("span",{className:"g7dt-text-lightgray g7dt-truncate",children:n}),l.jsxs("span",{className:a>50?"g7dt-text-red":"g7dt-text-gray",children:[a,"회"]})]},n))})]})]})},gk=({devTools:r})=>{const e=r.getLifecycleInfo();return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-section",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-green g7dt-mb-2 g7dt-flex-shrink-0",children:["마운트된 컴포넌트 (",e.mountedComponents.length,")"]}),l.jsx("div",{className:"g7dt-scroll-list",children:e.mountedComponents.length===0?l.jsx("div",{className:"g7dt-empty-message",children:"추적된 컴포넌트 없음"}):e.mountedComponents.map(n=>l.jsxs("div",{className:"g7dt-list-item g7dt-text-xs",children:[l.jsx("span",{className:"g7dt-text-lightgray",children:n.name}),l.jsx("span",{className:"g7dt-text-gray",children:n.id})]},n.id))})]}),e.orphanedListeners.length>0&&l.jsxs("div",{className:"g7dt-section",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-red g7dt-mb-2 g7dt-flex-shrink-0",children:["정리되지 않은 리스너 (",e.orphanedListeners.length,")"]}),l.jsx("div",{className:"g7dt-scroll-list",children:e.orphanedListeners.map((n,a)=>l.jsxs("div",{className:"g7dt-warning-card g7dt-text-xs",children:[l.jsx("span",{className:"g7dt-text-lightgray",children:n.type}),l.jsxs("span",{className:"g7dt-text-gray g7dt-ml-2",children:["on ",n.target]})]},a))})]})]})},hk=({devTools:r})=>{const e=r.getNetworkInfo(),n=d=>{switch(d){case"success":return"g7dt-text-green";case"error":return"g7dt-text-red";case"pending":return"g7dt-text-yellow";default:return"g7dt-text-gray"}},a=d=>d.queryParams&&Object.keys(d.queryParams).length>0,i=d=>Object.entries(d).map(([g,h])=>l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-text-xs",children:[l.jsxs("span",{className:"g7dt-text-purple",children:[g,":"]}),l.jsx("span",{className:"g7dt-text-lightgray",children:Array.isArray(h)?JSON.stringify(h):h})]},g)),o=(d,g=5e3)=>{try{const h=JSON.stringify(d,null,2);return h.length>g?h.substring(0,g)+`
... (truncated)`:h}catch{return"(직렬화 불가)"}};return l.jsxs("div",{className:"g7dt-space-y-4",children:[e.activeRequests.length>0&&l.jsxs("div",{children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:["진행 중 (",e.activeRequests.length,")"]}),l.jsx("div",{className:"g7dt-space-y-1",children:e.activeRequests.map(d=>l.jsxs("details",{className:"g7dt-details",children:[l.jsxs("summary",{className:"g7dt-summary g7dt-pending-request",children:[l.jsx("span",{className:"g7dt-font-bold",children:d.method}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-lightgray g7dt-truncate",children:d.fullUrl||d.url})]}),l.jsxs("div",{className:"g7dt-card g7dt-mt-1 g7dt-text-xs",children:[a(d)&&l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsx("div",{className:"g7dt-text-blue g7dt-font-bold g7dt-mb-1",children:"쿼리 파라미터"}),l.jsx("div",{className:"g7dt-pl-2 g7dt-border-l-2 g7dt-border-blue",children:i(d.queryParams)})]}),d.requestBody&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-orange g7dt-font-bold g7dt-mb-1",children:"요청 본문"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-xs",children:o(d.requestBody,2e3)})]})]})]},d.id))})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"요청 이력"}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list-lg",children:e.requestHistory.length===0?l.jsx("div",{className:"g7dt-empty-message",children:"요청 이력 없음"}):e.requestHistory.slice(-20).reverse().map(d=>l.jsxs("details",{className:"g7dt-details",children:[l.jsxs("summary",{className:"g7dt-summary g7dt-card g7dt-text-xs",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-w-full",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-font-bold",children:d.method}),l.jsx("span",{className:`g7dt-ml-2 ${n(d.status)}`,children:d.statusCode||d.status})]}),l.jsxs("span",{className:"g7dt-text-gray",children:[d.duration,"ms"]})]}),l.jsx("div",{className:"g7dt-text-gray g7dt-truncate g7dt-mt-1",children:d.fullUrl||d.url})]}),l.jsxs("div",{className:"g7dt-card g7dt-mt-1 g7dt-text-xs g7dt-ml-2 g7dt-border-l-2 g7dt-border-gray",children:[l.jsx("div",{className:"g7dt-mb-2",children:l.jsxs("div",{className:"g7dt-text-xs g7dt-space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"URL:"})," ",l.jsx("span",{className:"g7dt-text-lightgray",children:d.fullUrl||d.url})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"상태:"})," ",l.jsx("span",{className:n(d.status),children:d.statusCode||d.status})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"소요시간:"})," ",l.jsxs("span",{className:"g7dt-text-lightgray",children:[d.duration,"ms"]})]}),d.dataSourceId&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"데이터소스:"})," ",l.jsx("span",{className:"g7dt-text-blue",children:d.dataSourceId})]}),d.error&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"에러:"})," ",l.jsx("span",{className:"g7dt-text-red",children:d.error})]})]})}),a(d)&&l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsx("div",{className:"g7dt-text-blue g7dt-font-bold g7dt-mb-1",children:"쿼리 파라미터"}),l.jsx("div",{className:"g7dt-pl-2 g7dt-border-l-2 g7dt-border-blue",children:i(d.queryParams)})]}),d.requestBody&&l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsx("div",{className:"g7dt-text-orange g7dt-font-bold g7dt-mb-1",children:"요청 본문"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-max-h-40 g7dt-overflow-auto",children:o(d.requestBody,2e3)})]}),d.response!==void 0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-green g7dt-font-bold g7dt-mb-1",children:"응답 내용"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-max-h-60 g7dt-overflow-auto",children:o(d.response,5e3)})]})]})]},d.id))})]}),e.pendingDataSources.length>0&&l.jsxs("div",{children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-blue g7dt-mb-2",children:["대기 중인 데이터소스 (",e.pendingDataSources.length,")"]}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:e.pendingDataSources.map(d=>l.jsx("span",{className:"g7dt-tag-blue",children:d},d))})]})]})},fk=({devTools:r})=>{const e=r.getFormInfo(),[n,a]=j.useState(!1),[i,o]=j.useState(null),d=j.useCallback(()=>{o(r.getFormBindingValidationTrackingInfo())},[r]);j.useEffect(()=>{if(n){d();const f=setInterval(d,2e3);return()=>clearInterval(f)}},[n,d]);const g=f=>{switch(f){case"missing-datakey":return"🔑";case"missing-input-name":return"📝";case"context-not-propagated":return"🔗";case"sortable-context-break":return"📊";case"modal-context-isolation":return"🪟";case"duplicate-input-name":return"👯";case"value-type-mismatch":return"⚠️";case"binding-path-invalid":return"❌";default:return"❓"}},h=f=>{switch(f){case"error":return"g7dt-text-red";case"warning":return"g7dt-text-yellow";case"info":return"g7dt-text-blue";default:return"g7dt-text-gray"}};return l.jsxs("div",{className:"g7dt-space-y-4",children:[e.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-8",children:"추적된 Form이 없습니다"}):e.map(f=>l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("span",{className:"g7dt-font-bold g7dt-text-blue",children:f.dataKey||"(no dataKey)"}),!f.dataKey&&l.jsx("span",{className:"g7dt-text-red g7dt-text-xs",children:"dataKey 필요"})]}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-mb-2",children:f.inputs.map((p,x)=>l.jsxs("div",{className:"g7dt-text-xs g7dt-flex g7dt-justify-between",children:[l.jsx("span",{children:p.name||l.jsx("span",{className:"g7dt-text-red",children:"name 없음"})}),l.jsx("span",{className:"g7dt-text-gray",children:p.type})]},x))}),l.jsxs("details",{className:"g7dt-details",children:[l.jsx("summary",{className:"g7dt-summary",children:"현재 값 보기"}),l.jsx("pre",{className:"g7dt-pre",children:JSON.stringify(f,null,2)})]})]},f.id)),l.jsx("div",{className:"g7dt-flex g7dt-justify-end",children:l.jsx("button",{onClick:()=>a(!n),className:`g7dt-tab-button ${n?"g7dt-tab-active":""}`,children:"🔍 Auto-Binding Check"})}),n&&i&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Form 바인딩 검증 결과"}),l.jsxs("div",{className:"g7dt-stats-grid g7dt-mb-3",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:i.stats.totalFormsValidated}),l.jsx("div",{className:"g7dt-stat-label",children:"검증된 Form"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-green",children:i.stats.validForms}),l.jsx("div",{className:"g7dt-stat-label",children:"유효"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-red",children:i.stats.formsWithIssues}),l.jsx("div",{className:"g7dt-stat-label",children:"문제 있음"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-yellow",children:i.stats.totalIssues}),l.jsx("div",{className:"g7dt-stat-label",children:"총 이슈"})]})]}),i.stats.topIssues.length>0&&l.jsxs("div",{className:"g7dt-mb-3",children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"자주 발생하는 이슈"}),l.jsx("div",{className:"g7dt-space-y-1",children:i.stats.topIssues.slice(0,3).map((f,p)=>l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[l.jsx("span",{children:g(f.type)}),l.jsx("span",{className:"g7dt-text-white",children:f.description}),l.jsxs("span",{className:"g7dt-text-muted",children:["(",f.count,")"]})]},p))})]}),i.issues.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"바인딩 이슈가 없습니다 ✅"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:i.issues.slice().reverse().slice(0,30).map(f=>l.jsxs("div",{className:`g7dt-list-item ${f.severity==="error"?"g7dt-border-red":f.severity==="warning"?"g7dt-border-yellow":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:g(f.type)}),l.jsx("span",{className:`g7dt-text-xs g7dt-font-bold ${h(f.severity)}`,children:f.type}),f.formDataKey&&l.jsx("span",{className:"g7dt-text-xs g7dt-text-blue g7dt-font-mono",children:f.formDataKey})]}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-white g7dt-mt-1",children:f.description}),l.jsxs("div",{className:"g7dt-text-xs g7dt-text-green g7dt-mt-1",children:["💡 ",f.suggestion]}),f.contextInfo&&l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-mt-1",children:[f.contextInfo.isInsideModal&&l.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"🪟 modal"}),f.contextInfo.isInsideSortable&&l.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"📊 sortable"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted",children:["depth: ",f.contextInfo.depth]})]})]},f.id))})]})]})},pk=({devTools:r})=>{const e=r.getConditionalInfo();return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-purple g7dt-mb-2",children:["if 조건 (",e.ifConditions.length,")"]}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list",children:e.ifConditions.length===0?l.jsx("div",{className:"g7dt-empty-message",children:"추적된 if 조건 없음"}):e.ifConditions.map(n=>l.jsx("div",{className:`g7dt-condition-item ${n.evaluatedValue?"g7dt-condition-true":"g7dt-condition-false"}`,children:l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsx("span",{className:"g7dt-font-mono g7dt-text-lightgray g7dt-truncate-60",children:n.expression}),l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:n.evaluatedValue?"g7dt-badge-success":"g7dt-badge-error",children:n.evaluatedValue?"true":"false"}),l.jsxs("span",{className:"g7dt-text-gray",children:[n.evaluationCount,"회"]})]})]})},n.id))})]}),l.jsxs("div",{children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-cyan g7dt-mb-2",children:["iteration (",e.iterations.length,")"]}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list",children:e.iterations.length===0?l.jsx("div",{className:"g7dt-empty-message",children:"추적된 iteration 없음"}):e.iterations.map(n=>l.jsxs("div",{className:"g7dt-card g7dt-text-xs",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-1",children:[l.jsx("span",{className:"g7dt-font-mono g7dt-text-lightgray g7dt-truncate-60",children:n.source}),l.jsxs("span",{className:n.sourceLength>0?"g7dt-badge-blue":"g7dt-badge-warning",children:[n.sourceLength,"개 항목"]})]}),l.jsxs("div",{className:"g7dt-text-gray",children:[l.jsxs("span",{className:"g7dt-mr-2",children:["item_var: ",n.itemVar]}),n.indexVar&&l.jsxs("span",{children:["index_var: ",n.indexVar]})]})]},n.id))})]}),(e.ifConditions.some(n=>n.evaluatedValue===!1&&n.evaluationCount>5)||e.iterations.some(n=>n.sourceLength===0))&&l.jsxs("div",{className:"g7dt-warning-box",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:"잠재적 문제"}),l.jsxs("div",{className:"g7dt-space-y-1 g7dt-text-xs",children:[e.ifConditions.filter(n=>n.evaluatedValue===!1&&n.evaluationCount>5).map(n=>l.jsxs("div",{className:"g7dt-text-lightgray",children:["⚠️ if 조건 항상 false: ",n.expression]},n.id)),e.iterations.filter(n=>n.sourceLength===0).map(n=>l.jsxs("div",{className:"g7dt-text-lightgray",children:["⚠️ iteration 소스 비어있음: ",n.source]},n.id))]})]})]})},mk=({devTools:r})=>{const[e,n]=j.useState([]),[a,i]=j.useState({totalEvaluations:0,uniqueExpressions:0,warningCount:0,cacheHitRate:0,averageDuration:0,byType:{},byWarning:{}}),[o,d]=j.useState(""),[g,h]=j.useState(!1),[f,p]=j.useState(null),x=j.useCallback(()=>{const A=r.getExpressionInfo();n(A.expressions),i(A.stats)},[r]);j.useEffect(()=>{x();const A=r.watchExpressions(()=>{x()}),R=setInterval(x,2e3);return()=>{A(),clearInterval(R)}},[r,x]);const y=e.filter(A=>{if(g&&!A.warning)return!1;if(o){const R=o.toLowerCase();return A.expression.toLowerCase().includes(R)||A.componentName?.toLowerCase().includes(R)||A.propName?.toLowerCase().includes(R)||A.resultType.toLowerCase().includes(R)}return!0}),w=A=>{switch(A){case"string":return"g7dt-text-green";case"number":return"g7dt-text-blue";case"boolean":return"g7dt-text-purple";case"array":return"g7dt-text-cyan";case"object":return"g7dt-text-yellow";case"undefined":case"null":return"g7dt-text-red";default:return"g7dt-text-gray"}},v=A=>{switch(A){case"undefined-result":return"undefined 결과";case"null-result":return"null 결과";case"array-to-string":return"배열→문자열";case"object-to-string":return"객체→문자열";case"missing-optional-chain":return"?. 누락 의심";case"wrong-iteration-var":return"잘못된 반복 변수";case"type-mismatch":return"타입 불일치";case"cache-stale":return"캐시 오래됨";case"slow-evaluation":return"느린 평가";default:return A}},C=(A,R)=>R==="undefined"?"undefined":R==="null"?"null":R==="string"?`"${String(A).substring(0,50)}${String(A).length>50?"...":""}"`:R==="array"?`Array(${Array.isArray(A)?A.length:"?"})`:R==="object"?"Object{...}":String(A),k=()=>{r.clearExpressions(),n([]),p(null)};return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-stats-grid-5",children:[l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-blue",children:a.totalEvaluations}),l.jsx("div",{className:"g7dt-stat-label-xs",children:"총 평가"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-green",children:a.uniqueExpressions}),l.jsx("div",{className:"g7dt-stat-label-xs",children:"고유 표현식"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-yellow",children:a.warningCount}),l.jsx("div",{className:"g7dt-stat-label-xs",children:"경고"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsxs("div",{className:"g7dt-stat-value-lg g7dt-text-purple",children:[(a.cacheHitRate*100).toFixed(0),"%"]}),l.jsx("div",{className:"g7dt-stat-label-xs",children:"캐시 히트"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsxs("div",{className:"g7dt-stat-value-lg g7dt-text-cyan",children:[a.averageDuration.toFixed(1),"ms"]}),l.jsx("div",{className:"g7dt-stat-label-xs",children:"평균 시간"})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-items-center",children:[l.jsx("input",{type:"text",placeholder:"표현식, 컴포넌트, prop 검색...",value:o,onChange:A=>d(A.target.value),className:"g7dt-input g7dt-flex-1"}),l.jsxs("label",{className:"g7dt-checkbox-label",children:[l.jsx("input",{type:"checkbox",checked:g,onChange:A=>h(A.target.checked),className:"g7dt-checkbox"}),"경고만"]}),l.jsx("button",{onClick:k,className:"g7dt-btn-danger-sm",children:"초기화"})]}),Object.keys(a.byType).length>0&&l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:Object.entries(a.byType).map(([A,R])=>l.jsxs("span",{className:`g7dt-type-tag ${w(A)}`,children:[A,": ",R]},A))}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-expr-list",children:y.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:o||g?"조건에 맞는 표현식이 없습니다":"추적된 표현식이 없습니다"}):y.slice(-50).reverse().map(A=>l.jsx("div",{onClick:()=>p(A),className:`g7dt-expr-item ${f?.id===A.id?"g7dt-expr-selected":A.warning?"g7dt-expr-warning":""}`,children:l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-start g7dt-gap-2",children:[l.jsxs("div",{className:"g7dt-flex-1 g7dt-min-w-0",children:[l.jsx("div",{className:"g7dt-font-mono g7dt-text-white g7dt-truncate",title:A.expression,children:A.expression}),l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-mt-1 g7dt-text-xxs",children:[A.componentName&&l.jsxs("span",{className:"g7dt-text-gray",children:[A.componentName,A.propName&&`.${A.propName}`]}),l.jsx("span",{className:w(A.resultType),children:C(A.result,A.resultType)})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-flex-col g7dt-items-end g7dt-gap-1",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-1",children:[A.fromCache&&l.jsx("span",{className:"g7dt-mini-badge g7dt-badge-success",children:"캐시"}),A.warning&&l.jsx("span",{className:"g7dt-mini-badge g7dt-badge-warning",children:v(A.warning.type)})]}),A.duration!==void 0&&l.jsxs("span",{className:"g7dt-text-xxs g7dt-text-gray",children:[A.duration.toFixed(2),"ms"]})]})]})},A.id))}),f&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"표현식 상세"}),l.jsx("button",{onClick:()=>p(null),className:"g7dt-btn-close",children:"✕"})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"표현식:"}),l.jsx("code",{className:"g7dt-code g7dt-text-green",children:f.expression})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"결과:"}),l.jsx("span",{className:`g7dt-ml-2 ${w(f.resultType)}`,children:JSON.stringify(f.result,null,2)?.substring(0,200)}),l.jsxs("span",{className:"g7dt-ml-2 g7dt-text-darkgray",children:["(",f.resultType,")"]})]}),f.componentName&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"컴포넌트:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-blue",children:f.componentName}),f.propName&&l.jsxs("span",{className:"g7dt-text-gray",children:[".",f.propName]})]}),f.method&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"메서드:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-purple",children:f.method})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"캐시:"}),l.jsxs("span",{className:`g7dt-ml-2 ${f.fromCache?"g7dt-text-green":"g7dt-text-gray"}`,children:[f.fromCache?"캐시에서 로드":"새로 평가",f.skipCache&&" (skipCache)"]})]}),f.duration!==void 0&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"소요 시간:"}),l.jsxs("span",{className:`g7dt-ml-2 ${f.duration>10?"g7dt-text-red":"g7dt-text-lightgray"}`,children:[f.duration.toFixed(3),"ms"]})]}),f.warning&&l.jsxs("div",{className:"g7dt-warning-box-light",children:[l.jsxs("div",{className:"g7dt-text-yellow g7dt-font-bold",children:["⚠️ ",v(f.warning.type)]}),l.jsx("div",{className:"g7dt-text-lightgray g7dt-mt-1",children:f.warning.message}),f.warning.suggestion&&l.jsxs("div",{className:"g7dt-text-gray g7dt-mt-1 g7dt-text-xxs",children:["💡 ",f.warning.suggestion]})]}),f.steps&&f.steps.length>0&&l.jsxs("details",{className:"g7dt-details",children:[l.jsxs("summary",{className:"g7dt-summary",children:["평가 단계 (",f.steps.length,")"]}),l.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1 g7dt-pl-2 g7dt-border-l",children:f.steps.map((A,R)=>l.jsxs("div",{className:"g7dt-text-xxs",children:[l.jsx("span",{className:"g7dt-text-purple",children:A.step}),A.path&&l.jsx("span",{className:"g7dt-text-gray g7dt-ml-1",children:A.path}),A.fromCache&&l.jsx("span",{className:"g7dt-text-green g7dt-ml-1",children:"(cached)"}),A.error&&l.jsx("span",{className:"g7dt-text-red g7dt-ml-1",children:A.error})]},R))})]})]})]}),Object.keys(a.byWarning).length>0&&l.jsxs("div",{className:"g7dt-warning-box-light",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:"경고 요약"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:Object.entries(a.byWarning).map(([A,R])=>l.jsxs("span",{className:"g7dt-warning-tag",children:[v(A),": ",R]},A))})]})]})},yk=({devTools:r})=>{const e=r.getHandlers(),[n,a]=j.useState(""),[i,o]=j.useState("all"),d={"built-in":e.filter(f=>f.category==="built-in"),custom:e.filter(f=>f.category==="custom"),module:e.filter(f=>f.category==="module"),plugin:e.filter(f=>f.category==="plugin")},g={all:e.length,"built-in":d["built-in"].length,custom:d.custom.length,module:d.module.length,plugin:d.plugin.length},h=e.filter(f=>i!=="all"&&f.category!==i?!1:n?f.name.toLowerCase().includes(n.toLowerCase())||f.description?.toLowerCase().includes(n.toLowerCase()):!0);return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsx("div",{className:"g7dt-flex g7dt-gap-2",children:["all","built-in","custom","module","plugin"].map(f=>l.jsxs("button",{onClick:()=>o(f),className:i===f?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:[f==="all"?"전체":f," (",g[f],")"]},f))}),l.jsx("input",{type:"text",placeholder:"핸들러 이름 검색...",value:n,onChange:f=>a(f.target.value),className:"g7dt-input g7dt-w-full"}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-handler-list",children:h.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"등록된 핸들러가 없습니다"}):h.map(f=>l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsx("span",{className:"g7dt-font-mono g7dt-text-blue",children:f.name}),l.jsx("span",{className:f.category==="built-in"?"g7dt-mini-badge g7dt-badge-success":f.category==="module"?"g7dt-mini-badge g7dt-badge-purple":f.category==="plugin"?"g7dt-mini-badge g7dt-badge-info":"g7dt-mini-badge g7dt-badge-warning",children:f.category})]}),f.description&&l.jsx("div",{className:"g7dt-text-xs g7dt-text-gray g7dt-mt-1",children:f.description})]},f.name))}),l.jsxs("div",{className:"g7dt-text-xs g7dt-text-gray",children:["총 ",e.length,"개 핸들러 | 빌트인 ",g["built-in"]," | 커스텀 ",g.custom," | 모듈 ",g.module," | 플러그인 ",g.plugin]})]})},xk=({devTools:r})=>{const[e,n]=j.useState(r.getComponentEventInfo()),[a,i]=j.useState(null),o=j.useCallback(()=>{n(r.getComponentEventInfo())},[r]);j.useEffect(()=>{o();const g=setInterval(o,2e3);return()=>clearInterval(g)},[o]);const d=a?e.emitHistory.filter(g=>g.eventName===a):e.emitHistory;return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-stats-grid-3",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-blue",children:e.subscriptions.length}),l.jsx("div",{className:"g7dt-stat-label",children:"이벤트 타입"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-green",children:e.totalSubscribers}),l.jsx("div",{className:"g7dt-stat-label",children:"총 구독자"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-purple",children:e.totalEmits}),l.jsx("div",{className:"g7dt-stat-label",children:"총 발행"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"구독된 이벤트"}),l.jsxs("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:[l.jsx("button",{onClick:()=>i(null),className:a===null?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:"전체"}),e.subscriptions.map(g=>l.jsxs("button",{onClick:()=>i(g.eventName),className:a===g.eventName?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:[g.eventName," (",g.subscriberCount,")"]},g.eventName))]})]}),l.jsxs("div",{children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:["발행 이력 ",a&&`(${a})`]}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-event-list",children:d.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"이벤트 발행 이력이 없습니다"}):d.slice(-30).reverse().map(g=>l.jsxs("div",{className:`g7dt-card g7dt-text-xs ${g.hasError?"g7dt-card-error":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsx("span",{className:"g7dt-font-mono g7dt-text-green",children:g.eventName}),l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsxs("span",{className:"g7dt-text-gray",children:[g.listenerCount," listeners"]}),g.hasError&&l.jsx("span",{className:"g7dt-text-red g7dt-text-xxs",children:"에러"})]})]}),g.data!==void 0&&l.jsxs("details",{className:"g7dt-details g7dt-mt-1",children:[l.jsx("summary",{className:"g7dt-summary",children:"데이터"}),l.jsx("pre",{className:"g7dt-pre",children:JSON.stringify(g.data,null,2)})]}),g.hasError&&g.errorMessage&&l.jsx("div",{className:"g7dt-error-inline",children:g.errorMessage})]},g.id))})]}),l.jsx("button",{onClick:o,className:"g7dt-btn-secondary",children:"새로고침"})]})},bk=({devTools:r})=>{const e=r.getDataSources(),[n,a]=j.useState("all"),[i,o]=j.useState(null),[d,g]=j.useState(!1),[h,f]=j.useState(null),p=j.useCallback(()=>{f(r.getDataPathTransformTrackingInfo())},[r]);j.useEffect(()=>{if(d){p();const k=setInterval(p,2e3);return()=>clearInterval(k)}},[d,p]);const x=k=>{switch(k){case"api_response":return"📥";case"extract_data":return"📄";case"apply_path":return"🔗";case"init_global":return"🌐";case"init_local":return"📌";default:return"❓"}},y=e.filter(k=>n==="all"?!0:k.status===n),w={all:e.length,idle:e.filter(k=>k.status==="idle").length,loading:e.filter(k=>k.status==="loading").length,loaded:e.filter(k=>k.status==="loaded").length,error:e.filter(k=>k.status==="error").length},v=k=>{switch(k){case"loaded":return"g7dt-badge-success";case"loading":return"g7dt-badge-warning";case"error":return"g7dt-badge-error";default:return"g7dt-badge-gray"}},C=i?e.find(k=>k.id===i):null;return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsx("div",{className:"g7dt-flex g7dt-gap-2",children:["all","idle","loading","loaded","error"].map(k=>l.jsxs("button",{onClick:()=>a(k),className:n===k?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:[k==="all"?"전체":k," (",w[k],")"]},k))}),l.jsx("div",{className:"g7dt-ds-grid",children:y.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-col-span-2 g7dt-py-4",children:"데이터소스가 없습니다"}):y.map(k=>l.jsxs("div",{onClick:()=>o(k.id),className:`g7dt-ds-item ${i===k.id?"g7dt-ds-selected":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsx("span",{className:"g7dt-font-mono g7dt-text-blue g7dt-truncate",children:k.id}),l.jsx("span",{className:`g7dt-mini-badge ${v(k.status)}`,children:k.status})]}),l.jsx("div",{className:"g7dt-text-gray g7dt-mt-1 g7dt-truncate",children:k.endpoint||"(endpoint 없음)"}),k.itemCount!==void 0&&l.jsxs("div",{className:"g7dt-text-lightgray g7dt-mt-1",children:[k.itemCount,"개 항목"]})]},k.id))}),C&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:C.id}),l.jsx("button",{onClick:()=>o(null),className:"g7dt-btn-close",children:"✕"})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"엔드포인트:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-green",children:C.endpoint||"-"})]}),C.dataPath&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"데이터 경로:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:C.dataPath})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"상태:"}),l.jsx("span",{className:`g7dt-ml-2 g7dt-mini-badge ${v(C.status)}`,children:C.status})]}),C.itemCount!==void 0&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"항목 수:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-blue",children:C.itemCount})]}),C.keys&&C.keys.length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"키:"}),l.jsxs("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:[C.keys.slice(0,10).map(k=>l.jsx("span",{className:"g7dt-key-tag",children:k},k)),C.keys.length>10&&l.jsxs("span",{className:"g7dt-text-gray",children:["+",C.keys.length-10,"개"]})]})]}),C.dependencies&&C.dependencies.length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"의존성:"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:C.dependencies.map(k=>l.jsx("span",{className:"g7dt-dep-tag",children:k},k))})]})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("div",{className:"g7dt-text-xs g7dt-text-gray",children:["총 ",e.length,"개 데이터소스 | 로드됨 ",w.loaded," | 로딩중 ",w.loading," | 에러 ",w.error]}),l.jsx("button",{onClick:()=>g(!d),className:`g7dt-tab-button ${d?"g7dt-tab-active":""}`,children:"🔀 Path Transform"})]}),d&&h&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["데이터 경로 변환 추적 (",h.transforms.length,"개)"]}),l.jsxs("div",{className:"g7dt-stats-grid-3 g7dt-mb-3",children:[l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-xl g7dt-font-bold g7dt-text-blue",children:h.stats.totalTransforms}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 변환"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-xl g7dt-font-bold g7dt-text-purple",children:Object.keys(h.stats.byDataSource).length}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"데이터소스"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-xl g7dt-font-bold g7dt-text-yellow",children:h.stats.warningsCount}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"경고"})]})]}),h.transforms.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"변환 기록이 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:h.transforms.slice().reverse().slice(0,20).map((k,A)=>l.jsxs("div",{className:`g7dt-list-item ${k.warnings.length>0?"g7dt-border-yellow":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:"g7dt-text-xs g7dt-text-blue g7dt-font-mono",children:k.dataSourceId}),k.warnings.length>0&&l.jsxs("span",{className:"g7dt-badge g7dt-text-xs g7dt-text-yellow",children:["⚠️ ",k.warnings.length]})]}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:k.transformSteps.map((R,N)=>l.jsxs("span",{className:"g7dt-badge g7dt-text-xs",title:`${R.inputPath} → ${R.outputPath}`,children:[x(R.step)," ",R.step]},N))}),k.finalBinding&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["최종: ",l.jsx("span",{className:"g7dt-text-green",children:k.finalBinding.expression}),"→ ",l.jsx("span",{className:"g7dt-text-blue",children:k.finalBinding.resolvedPath})]}),k.warnings.length>0&&l.jsx("div",{className:"g7dt-text-xs g7dt-text-yellow g7dt-mt-1",children:k.warnings[0]})]},`${k.dataSourceId}-${A}`))}),h.stats.commonWarnings.length>0&&l.jsxs("div",{className:"g7dt-mt-3",children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-1",children:"자주 발생하는 경고"}),l.jsx("div",{className:"g7dt-space-y-1",children:h.stats.commonWarnings.slice(0,5).map((k,A)=>l.jsxs("div",{className:"g7dt-text-xs g7dt-text-yellow",children:[k.warning," (",k.count,"회)"]},A))})]})]})]})},vk=({devTools:r})=>{const[e,n]=j.useState(r.getStateRenderingInfo()),[a,i]=j.useState(null),[o,d]=j.useState(!1),[g,h]=j.useState(""),f=j.useCallback(()=>{n(r.getStateRenderingInfo())},[r]);j.useEffect(()=>{f();const v=setInterval(f,2e3);return()=>clearInterval(v)},[f]);const p=e.logs.filter(v=>!(o&&v.renderedComponents.length>0||g&&!v.statePath.toLowerCase().includes(g.toLowerCase()))),x=a?e.logs.find(v=>v.setStateId===a):null,y=e.stats,w=e.logs.filter(v=>v.renderedComponents.length===0).length;return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-stats-grid",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:y.totalStateChanges}),l.jsx("div",{className:"g7dt-stat-label",children:"상태 변경"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-green",children:y.totalRenders}),l.jsx("div",{className:"g7dt-stat-label",children:"총 렌더링"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsxs("div",{className:"g7dt-stat-value g7dt-text-purple",children:[y.avgRenderDuration.toFixed(1),"ms"]}),l.jsx("div",{className:"g7dt-stat-label",children:"평균 렌더 시간"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:`g7dt-stat-value ${w>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:w}),l.jsx("div",{className:"g7dt-stat-label",children:"렌더링 없음"})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsx("input",{type:"text",placeholder:"상태 경로 필터 (예: _global.user)",value:g,onChange:v=>h(v.target.value),className:"g7dt-input g7dt-flex-1"}),l.jsx("button",{onClick:()=>d(!o),className:o?"g7dt-filter-btn-active-yellow":"g7dt-filter-btn",children:"렌더링 없음만"})]}),l.jsx("div",{className:"g7dt-scroll-list",children:p.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"상태-렌더링 로그가 없습니다"}):p.slice(-30).reverse().map(v=>{const C=v.renderedComponents.length>0,k=C?"✅":"⚠️",A=new Date(v.timestamp).toLocaleTimeString();return l.jsxs("div",{onClick:()=>i(v.setStateId),className:`g7dt-render-log-item ${a===v.setStateId?"g7dt-selected":C?"":"g7dt-warning"}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("span",{className:"g7dt-mono g7dt-text-blue",children:[k," ",v.statePath]}),l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[C?l.jsxs("span",{className:"g7dt-text-green",children:[v.renderedComponents.length,"개 렌더"]}):l.jsx("span",{className:"g7dt-text-yellow",children:"렌더링 없음"}),l.jsx("span",{className:"g7dt-text-muted",children:A})]})]}),v.triggeredBy?.handlerType&&l.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1",children:["트리거: ",v.triggeredBy.handlerType]})]},v.setStateId)})}),x&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:x.statePath}),l.jsx("button",{onClick:()=>i(null),className:"g7dt-close-btn",children:"✕"})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"setStateId:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-purple g7dt-mono",children:x.setStateId})]}),x.triggeredBy&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"트리거:"}),l.jsxs("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:[x.triggeredBy.handlerType,x.triggeredBy.actionId&&` (${x.triggeredBy.actionId})`]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"이전 값:"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-red",children:JSON.stringify(x.oldValue,null,2)?.slice(0,200)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"새 값:"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-green",children:JSON.stringify(x.newValue,null,2)?.slice(0,200)})]}),x.renderedComponents.length>0?l.jsxs("div",{children:[l.jsxs("span",{className:"g7dt-text-muted",children:["렌더링된 컴포넌트 (",x.renderedComponents.length,"개):"]}),l.jsxs("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:[x.renderedComponents.slice(0,10).map((v,C)=>l.jsxs("div",{className:"g7dt-render-comp-item",children:[l.jsx("span",{className:"g7dt-text-blue",children:v.componentName}),l.jsxs("span",{className:"g7dt-text-muted",children:[v.renderDuration.toFixed(2),"ms"]})]},C)),x.renderedComponents.length>10&&l.jsxs("div",{className:"g7dt-text-muted g7dt-text-center",children:["... 외 ",x.renderedComponents.length-10,"개"]})]}),l.jsxs("div",{className:"g7dt-mt-2 g7dt-text-muted",children:["총 렌더 시간: ",x.totalRenderDuration.toFixed(2),"ms"]})]}):l.jsxs("div",{className:"g7dt-warning-box",children:[l.jsx("span",{className:"g7dt-text-yellow",children:"⚠️ 렌더링이 발생하지 않았습니다"}),l.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-text-xxs",children:["가능한 원인:",l.jsxs("ul",{className:"g7dt-list g7dt-mt-1",children:[l.jsx("li",{children:"해당 상태를 바인딩하는 컴포넌트가 없음"}),l.jsx("li",{children:"컴포넌트가 마운트되지 않은 상태"}),l.jsx("li",{children:"동일한 값으로 상태 설정"})]})]})]})]})]}),y.topRenderedComponents.length>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"가장 많이 렌더링된 컴포넌트"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:y.topRenderedComponents.slice(0,5).map((v,C)=>l.jsxs("span",{className:"g7dt-tag",children:[v.name,": ",l.jsx("span",{className:"g7dt-text-blue",children:v.count})]},C))})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsx("button",{onClick:f,className:"g7dt-btn-secondary",children:"새로고침"}),l.jsx("button",{onClick:()=>{r.clearStateRenderingLogs(),f()},className:"g7dt-btn-danger",children:"로그 초기화"})]})]})},Sk=({devTools:r})=>{const[e,n]=j.useState(null),[a,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{n(r.getStyleValidationInfo())},[r]);if(j.useEffect(()=>{g();const x=setInterval(g,2e3);return()=>clearInterval(x)},[g]),!e)return l.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const h=e.issues.filter(x=>o==="all"?!0:x.type===o),f=a?e.issues.find(x=>x.componentId===a):null,p=e.stats;return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-stats-grid",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:p.totalComponents}),l.jsx("div",{className:"g7dt-stat-label",children:"총 컴포넌트"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:`g7dt-stat-value ${p.invisibleCount>0?"g7dt-text-red":"g7dt-text-green"}`,children:p.invisibleCount}),l.jsx("div",{className:"g7dt-stat-label",children:"숨겨진 요소"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:`g7dt-stat-value ${p.tailwindIssueCount>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:p.tailwindIssueCount}),l.jsx("div",{className:"g7dt-stat-label",children:"Tailwind 이슈"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:`g7dt-stat-value ${p.darkModeIssueCount>0?"g7dt-text-purple":"g7dt-text-green"}`,children:p.darkModeIssueCount}),l.jsx("div",{className:"g7dt-stat-label",children:"다크모드 이슈"})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsxs("select",{value:o,onChange:x=>d(x.target.value),className:"g7dt-select",children:[l.jsx("option",{value:"all",children:"모든 이슈"}),l.jsx("option",{value:"invisible-element",children:"숨겨진 요소"}),l.jsx("option",{value:"tailwind-purging",children:"Tailwind 퍼징"}),l.jsx("option",{value:"dark-mode-missing",children:"다크모드 누락"})]}),l.jsx("button",{onClick:g,className:"g7dt-btn-secondary",children:"새로고침"})]}),l.jsx("div",{className:"g7dt-scroll-list",children:h.length===0?l.jsx("div",{className:"g7dt-empty-state",children:e.issues.length===0?"스타일 이슈가 없습니다 ✓":"필터에 맞는 이슈가 없습니다"}):h.map(x=>{const y=x.type==="invisible-element"?"👁️":x.type==="tailwind-purging"?"🎨":"🌙",w=x.severity==="error"?"g7dt-severity-error":x.severity==="warning"?"g7dt-severity-warning":"g7dt-severity-info";return l.jsxs("div",{onClick:()=>i(x.componentId),className:`g7dt-style-issue-item ${w} ${a===x.componentId?"g7dt-selected":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("span",{className:"g7dt-mono g7dt-text-blue",children:[y," ",x.componentName]}),l.jsx("span",{className:x.severity==="error"?"g7dt-badge-error":x.severity==="warning"?"g7dt-badge-warning":"g7dt-badge-info",children:x.type})]}),l.jsx("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:x.description})]},x.componentId)})}),f&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:f.componentName}),l.jsx("button",{onClick:()=>i(null),className:"g7dt-close-btn",children:"✕"})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"이슈 타입:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:f.type})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"설명:"}),l.jsx("div",{className:"g7dt-mt-1 g7dt-text-white",children:f.description})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"CSS 속성:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-purple",children:f.property}),l.jsxs("span",{className:"g7dt-ml-2 g7dt-text-muted",children:["= ",f.currentValue]}),f.expectedValue&&l.jsxs("span",{className:"g7dt-ml-2 g7dt-text-green",children:["(예상: ",f.expectedValue,")"]})]}),f.suggestion&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"해결 방법:"}),l.jsx("div",{className:"g7dt-mt-1 g7dt-text-green",children:f.suggestion})]})]})]}),e.componentStyles.length>0&&l.jsxs("div",{children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:["컴포넌트 스타일 (",e.componentStyles.length,")"]}),l.jsx("div",{className:"g7dt-scroll-list-sm",children:e.componentStyles.slice(0,20).map((x,y)=>l.jsxs("div",{className:"g7dt-list-item",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-blue",children:x.componentName}),l.jsxs("span",{className:"g7dt-text-muted",children:[x.classes.length," classes"]})]}),x.classes.length>0&&l.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:[x.classes.slice(0,5).join(" "),x.classes.length>5&&"..."]})]},y))})]})]})},wk=({devTools:r})=>{const[e,n]=j.useState(null),[a,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{n(r.getAuthDebugInfo())},[r]);if(j.useEffect(()=>{g();const y=setInterval(g,2e3);return()=>clearInterval(y)},[g]),!e)return l.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const h=e.events.filter(y=>o==="all"?!0:y.type===o),f=a?e.events.find(y=>y.id===a):null,p=e.stats,x=e.state;return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-justify-between g7dt-mb-3",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"현재 인증 상태"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted",children:["소스: ",x.source||"unknown"]})]}),l.jsxs("div",{className:"g7dt-stats-grid-3 g7dt-mb-3",children:[l.jsx("div",{className:"g7dt-text-center",children:l.jsx("div",{className:`g7dt-text-lg g7dt-font-bold ${x.isAuthenticated?"g7dt-text-green":"g7dt-text-red"}`,children:x.isAuthenticated?"✓ 인증됨":"✕ 미인증"})}),l.jsx("div",{className:"g7dt-text-center",children:l.jsx("div",{className:`g7dt-text-lg g7dt-font-bold ${x.tokens.hasAccessToken?"g7dt-text-green":"g7dt-text-yellow"}`,children:x.tokens.hasAccessToken?"✓ 토큰 유효":"⚠ 토큰 없음"})}),l.jsx("div",{className:"g7dt-text-center",children:l.jsx("div",{className:"g7dt-text-lg g7dt-font-bold g7dt-text-blue",children:x.user?.name||x.user?.email||"익명"})})]}),x.user&&l.jsxs("div",{className:"g7dt-border-t g7dt-pt-3 g7dt-mt-3",children:[l.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"ID:"}),l.jsx("span",{className:"g7dt-text-white g7dt-mono",children:x.user.id})]}),l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"이메일:"}),l.jsx("span",{className:"g7dt-text-white g7dt-truncate g7dt-ml-2",title:x.user.email,children:x.user.email})]}),x.user.name&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"이름:"}),l.jsx("span",{className:"g7dt-text-white",children:x.user.name})]}),x.user.nickname&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"닉네임:"}),l.jsx("span",{className:"g7dt-text-white",children:x.user.nickname})]}),x.user.phone&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"전화번호:"}),l.jsx("span",{className:"g7dt-text-white",children:x.user.phone})]}),x.user.status&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"상태:"}),l.jsx("span",{className:x.user.status==="active"?"g7dt-text-green":"g7dt-text-yellow",children:x.user.status})]}),x.user.locale&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"언어:"}),l.jsx("span",{className:"g7dt-text-white",children:x.user.locale})]})]}),x.user.roles&&x.user.roles.length>0&&l.jsxs("div",{className:"g7dt-mt-2",children:[l.jsx("span",{className:"g7dt-text-muted g7dt-text-xs",children:"역할: "}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:x.user.roles.map((y,w)=>l.jsx("span",{className:"g7dt-role-tag",title:y.guard_name?`guard: ${y.guard_name}`:void 0,children:typeof y=="string"?y:y.name},w))})]}),x.user.permissions&&x.user.permissions.length>0&&l.jsxs("div",{className:"g7dt-mt-2",children:[l.jsx("span",{className:"g7dt-text-muted g7dt-text-xs",children:"권한: "}),l.jsxs("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1 g7dt-max-h-16 g7dt-overflow-auto",children:[x.user.permissions.slice(0,10).map((y,w)=>l.jsx("span",{className:"g7dt-perm-tag",title:y.guard_name?`guard: ${y.guard_name}`:void 0,children:typeof y=="string"?y:y.name},w)),x.user.permissions.length>10&&l.jsxs("span",{className:"g7dt-text-muted g7dt-text-xs",children:["+",x.user.permissions.length-10,"개"]})]})]}),l.jsxs("div",{className:"g7dt-mt-2 g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[x.user.created_at&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"가입일:"}),l.jsx("span",{className:"g7dt-text-muted",children:new Date(x.user.created_at).toLocaleDateString()})]}),x.user.last_login_at&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"마지막 로그인:"}),l.jsx("span",{className:"g7dt-text-muted",children:new Date(x.user.last_login_at).toLocaleString()})]}),x.user.email_verified_at&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"이메일 인증:"}),l.jsx("span",{className:"g7dt-text-green",children:"✓ 인증됨"})]})]})]}),l.jsx("div",{className:"g7dt-border-t g7dt-pt-3 g7dt-mt-3",children:l.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"저장소:"}),l.jsx("span",{className:"g7dt-text-white",children:x.tokens.storage})]}),x.tokens.accessTokenPreview&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"토큰:"}),l.jsx("span",{className:"g7dt-text-muted g7dt-mono",children:x.tokens.accessTokenPreview})]})]})}),x.tokens.accessTokenExpiresAt&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-2 g7dt-text-center",children:["토큰 만료: ",new Date(x.tokens.accessTokenExpiresAt).toLocaleString()]})]}),l.jsxs("div",{className:"g7dt-stats-grid-5",children:[l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-blue",children:p.loginAttempts}),l.jsx("div",{className:"g7dt-stat-label",children:"로그인 시도"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-green",children:p.successfulLogins}),l.jsx("div",{className:"g7dt-stat-label",children:"성공"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:`g7dt-stat-value-sm ${p.failedLogins>0?"g7dt-text-red":"g7dt-text-muted"}`,children:p.failedLogins}),l.jsx("div",{className:"g7dt-stat-label",children:"실패"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-purple",children:p.tokenRefreshes}),l.jsx("div",{className:"g7dt-stat-label",children:"토큰 갱신"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:`g7dt-stat-value-sm ${p.unauthorizedResponses>0?"g7dt-text-red":"g7dt-text-muted"}`,children:p.unauthorizedResponses}),l.jsx("div",{className:"g7dt-stat-label",children:"401 응답"})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsxs("select",{value:o,onChange:y=>d(y.target.value),className:"g7dt-select",children:[l.jsx("option",{value:"all",children:"모든 이벤트"}),l.jsx("option",{value:"login",children:"로그인"}),l.jsx("option",{value:"logout",children:"로그아웃"}),l.jsx("option",{value:"token-refresh",children:"토큰 갱신"}),l.jsx("option",{value:"token-expired",children:"토큰 만료"}),l.jsx("option",{value:"api-unauthorized",children:"401 응답"})]}),l.jsx("button",{onClick:g,className:"g7dt-btn-secondary",children:"새로고침"})]}),l.jsx("div",{className:"g7dt-scroll-list-sm",children:h.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"인증 이벤트가 없습니다"}):h.slice(-20).reverse().map(y=>{const w=y.success?"✅":"❌",v=new Date(y.timestamp).toLocaleTimeString();return l.jsxs("div",{onClick:()=>i(y.id),className:`g7dt-auth-event-item ${a===y.id?"g7dt-selected":y.success?"":"g7dt-error"}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("span",{className:"g7dt-mono",children:[w," ",y.type]}),l.jsx("span",{className:"g7dt-text-muted",children:v})]}),y.error&&l.jsx("div",{className:"g7dt-text-red g7dt-mt-1 g7dt-truncate",children:y.error})]},y.id)})}),f&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:f.type}),l.jsx("button",{onClick:()=>i(null),className:"g7dt-close-btn",children:"✕"})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"결과:"}),l.jsx("span",{className:`g7dt-ml-2 ${f.success?"g7dt-text-green":"g7dt-text-red"}`,children:f.success?"성공":"실패"})]}),f.error&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"에러:"}),l.jsx("div",{className:"g7dt-mt-1 g7dt-text-red",children:f.error})]}),f.details&&Object.keys(f.details).length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"상세:"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-green",children:JSON.stringify(f.details,null,2)})]})]})]}),e.headerAnalysis.length>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"최근 API 인증 헤더"}),l.jsx("div",{className:"g7dt-scroll-list-xs",children:e.headerAnalysis.slice(-10).reverse().map((y,w)=>l.jsxs("div",{className:"g7dt-header-item",children:[l.jsx("span",{className:"g7dt-text-blue g7dt-truncate g7dt-flex-1",children:y.url}),l.jsx("span",{className:`g7dt-ml-2 ${y.hasAuthHeader?"g7dt-text-green":"g7dt-text-yellow"}`,children:y.hasAuthHeader?`✓ ${y.headerType}`:"✕ 헤더 없음"}),y.responseStatus&&l.jsx("span",{className:`g7dt-ml-2 ${y.responseStatus<400?"g7dt-text-muted":"g7dt-text-red"}`,children:y.responseStatus})]},w))})]})]})},Ck=({devTools:r})=>{const[e,n]=j.useState([]),[a,i]=j.useState(null),[o,d]=j.useState(null),[g,h]=j.useState("all"),[f,p]=j.useState(""),[x,y]=j.useState(""),w=j.useCallback(()=>{const N=r.getLogInfo();n(N.entries),i(N.stats)},[r]);j.useEffect(()=>{w();const N=setInterval(w,1e3);return()=>clearInterval(N)},[w]);const v=e.filter(N=>!(g!=="all"&&N.level!==g||f&&!N.prefix.toLowerCase().includes(f.toLowerCase())||x&&!N.message.toLowerCase().includes(x.toLowerCase()))),C=o?e.find(N=>N.id===o):null,k=()=>{r.clearLogs(),w(),d(null)},A=N=>{switch(N){case"error":return"g7dt-text-red";case"warn":return"g7dt-text-yellow";case"info":return"g7dt-text-blue";case"debug":return"g7dt-text-muted";default:return"g7dt-text-white"}},R=N=>{switch(N){case"error":return"g7dt-log-error";case"warn":return"g7dt-log-warn";case"info":return"g7dt-log-info";case"debug":return"g7dt-log-debug";default:return"g7dt-log-default"}};return l.jsxs("div",{className:"g7dt-space-y-4",children:[a&&l.jsxs("div",{className:"g7dt-stats-grid-6",children:[l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-white",children:a.totalLogs}),l.jsx("div",{className:"g7dt-stat-label",children:"전체"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-red",children:a.byLevel.error}),l.jsx("div",{className:"g7dt-stat-label",children:"에러"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-yellow",children:a.byLevel.warn}),l.jsx("div",{className:"g7dt-stat-label",children:"경고"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-blue",children:a.byLevel.info}),l.jsx("div",{className:"g7dt-stat-label",children:"정보"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:`g7dt-stat-value-sm ${a.recentErrors>0?"g7dt-text-red":"g7dt-text-green"}`,children:a.recentErrors}),l.jsx("div",{className:"g7dt-stat-label",children:"최근 에러"})]}),l.jsxs("div",{className:"g7dt-stat-card-sm",children:[l.jsx("div",{className:`g7dt-stat-value-sm ${a.recentWarnings>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:a.recentWarnings}),l.jsx("div",{className:"g7dt-stat-label",children:"최근 경고"})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-flex-wrap",children:[l.jsxs("select",{value:g,onChange:N=>h(N.target.value),className:"g7dt-select",children:[l.jsx("option",{value:"all",children:"모든 레벨"}),l.jsx("option",{value:"error",children:"에러"}),l.jsx("option",{value:"warn",children:"경고"}),l.jsx("option",{value:"info",children:"정보"}),l.jsx("option",{value:"log",children:"로그"}),l.jsx("option",{value:"debug",children:"디버그"})]}),l.jsx("input",{type:"text",placeholder:"prefix 필터",value:f,onChange:N=>p(N.target.value),className:"g7dt-input g7dt-w-32"}),l.jsx("input",{type:"text",placeholder:"메시지 검색",value:x,onChange:N=>y(N.target.value),className:"g7dt-input g7dt-flex-1"}),l.jsx("button",{onClick:w,className:"g7dt-btn-secondary",children:"새로고침"}),l.jsx("button",{onClick:k,className:"g7dt-btn-danger",children:"초기화"})]}),l.jsx("div",{className:"g7dt-scroll-list-lg",children:v.length===0?l.jsx("div",{className:"g7dt-empty-state",children:e.length===0?"로그가 없습니다":"필터에 맞는 로그가 없습니다"}):v.slice(-50).reverse().map(N=>{const D=new Date(N.timestamp).toLocaleTimeString();return l.jsxs("div",{onClick:()=>d(N.id),className:`g7dt-log-item ${o===N.id?"g7dt-selected":R(N.level)}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:`g7dt-font-bold g7dt-uppercase ${A(N.level)}`,children:N.level}),l.jsxs("span",{className:"g7dt-text-purple",children:["[",N.prefix,"]"]})]}),l.jsx("span",{className:"g7dt-text-muted",children:D})]}),l.jsx("div",{className:"g7dt-text-white g7dt-mt-1 g7dt-truncate",children:N.message})]},N.id)})}),C&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold",children:[l.jsx("span",{className:A(C.level),children:C.level.toUpperCase()})," ",l.jsxs("span",{className:"g7dt-text-purple",children:["[",C.prefix,"]"]})]}),l.jsx("button",{onClick:()=>d(null),className:"g7dt-close-btn",children:"✕"})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"시간:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-white",children:new Date(C.timestamp).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"메시지:"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-white g7dt-whitespace-pre-wrap",children:C.message})]}),C.args.length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"인수:"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-green",children:JSON.stringify(C.args,null,2)})]}),C.stack&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"스택 트레이스:"}),l.jsx("pre",{className:"g7dt-pre-stack g7dt-text-red",children:C.stack})]})]})]}),a&&Object.keys(a.byPrefix).length>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"Prefix별 로그 수"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:Object.entries(a.byPrefix).sort((N,D)=>D[1]-N[1]).slice(0,10).map(([N,D])=>l.jsxs("button",{onClick:()=>p(N),className:f===N?"g7dt-prefix-btn-active":"g7dt-prefix-btn",children:[N,": ",l.jsx("span",{className:"g7dt-text-blue",children:D})]},N))})]})]})},jk=({devTools:r})=>{const[e,n]=j.useState(r.getLayoutDebugInfo()),[a,i]=j.useState(!1),[o,d]=j.useState(null),[g,h]=j.useState(!1),[f,p]=j.useState({});j.useEffect(()=>{const A=setInterval(()=>{n(r.getLayoutDebugInfo())},1e3);return()=>clearInterval(A)},[r]),j.useEffect(()=>{(async()=>{try{const R=await fetch("/api/admin/permissions",{headers:{Authorization:`Bearer ${localStorage.getItem("auth_token")}`,Accept:"application/json"}});if(R.ok){const N=await R.json(),D={},M=L=>{L.forEach(z=>{D[z.identifier]=z.name,z.children?.length&&M(z.children)})};Object.values(N.data?.permissions||{}).forEach(L=>{L.permissions&&M(L.permissions)}),p(D)}}catch(R){console.warn("[G7DevTools] 권한 목록 조회 실패:",R)}})()},[]);const x=e.current,y=x?.layoutJson,w=e.history,v=e.stats,C=y?[{key:"components",label:"컴포넌트",count:Array.isArray(y.components)?y.components.length:0},{key:"data_sources",label:"데이터소스",count:Array.isArray(y.data_sources)?y.data_sources.length:0},{key:"computed",label:"Computed",count:y.computed?Object.keys(y.computed).length:0},{key:"defines",label:"Defines",count:y.defines?Object.keys(y.defines).length:0},{key:"slots",label:"Slots",count:y.slots?Object.keys(y.slots).length:0},{key:"modals",label:"Modals",count:y.modals?Object.keys(y.modals).length:0},{key:"init_actions",label:"초기화 액션",count:Array.isArray(y.init_actions)?y.init_actions.length:0},{key:"scripts",label:"스크립트",count:Array.isArray(y.scripts)?y.scripts.length:0},{key:"meta",label:"메타데이터",count:y.meta?Object.keys(y.meta).length:0},{key:"errorHandling",label:"에러핸들링",count:y.errorHandling?Object.keys(y.errorHandling).length:0},{key:"permissions",label:"권한",count:Array.isArray(y.permissions)?y.permissions.length:0}]:[],k=A=>{navigator.clipboard.writeText(JSON.stringify(A,null,2))};return x?l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"📊 로드 통계"}),l.jsxs("div",{className:"g7dt-grid-3",children:[l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"총 로드:"}),l.jsx("span",{className:"g7dt-text-blue",children:v.totalLoads})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"캐시 히트:"}),l.jsx("span",{className:"g7dt-text-green",children:v.cacheHits})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"API 로드:"}),l.jsx("span",{className:"g7dt-text-yellow",children:v.apiLoads})]})]})]}),l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"📋 현재 레이아웃"}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsx("button",{onClick:()=>k(y),className:"g7dt-btn-small",title:"전체 JSON 복사",children:"📋 복사"}),l.jsx("button",{onClick:()=>i(!a),className:"g7dt-btn-small",children:a?"요약 보기":"전체 보기"})]})]}),l.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[l.jsxs("div",{className:"g7dt-flex g7dt-gap-4",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"경로:"}),l.jsx("span",{className:"g7dt-ml-1 g7dt-text-white g7dt-font-mono",children:x.layoutPath})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"템플릿:"}),l.jsx("span",{className:"g7dt-ml-1 g7dt-text-blue",children:x.templateId})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-4",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"버전:"}),l.jsx("span",{className:"g7dt-ml-1 g7dt-text-white",children:x.version||"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"소스:"}),l.jsx("span",{className:`g7dt-ml-1 ${x.source==="cache"?"g7dt-text-green":"g7dt-text-yellow"}`,children:x.source==="cache"?"💾 캐시":"🌐 API"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"로드 시간:"}),l.jsx("span",{className:"g7dt-ml-1 g7dt-text-white",children:x.loadedAt?new Date(x.loadedAt).toLocaleTimeString():"-"})]})]}),l.jsx("div",{className:"g7dt-flex g7dt-gap-4 g7dt-mt-2",children:l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"권한:"}),y.permissions&&y.permissions.length>0?l.jsxs("span",{className:"g7dt-ml-1 g7dt-text-yellow",children:["🔒 ",y.permissions.map(A=>f[A]||A).join(", ")]}):y.permissions&&y.permissions.length===0?l.jsx("span",{className:"g7dt-ml-1 g7dt-text-green",children:"🌐 공개"}):l.jsx("span",{className:"g7dt-ml-1 g7dt-text-muted",children:"미정의 (부모 상속)"})]})})]})]}),!a&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"🏗️ 레이아웃 구조"}),l.jsx("div",{className:"g7dt-grid-2",children:C.map(A=>l.jsxs("button",{onClick:()=>d(o===A.key?null:A.key),className:`g7dt-section-btn ${o===A.key?"g7dt-selected":""}`,children:[l.jsx("span",{children:A.label}),l.jsxs("span",{className:"g7dt-text-blue",children:[A.count,"개"]})]},A.key))})]}),(a||o)&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:a?"📄 전체 레이아웃 JSON":`📎 ${o} 섹션`}),l.jsx("button",{onClick:()=>{a?k(y):o&&y&&k(y[o])},className:"g7dt-btn-small",children:"복사"})]}),o==="permissions"&&!a?l.jsx("div",{className:"g7dt-text-xs",children:y.permissions&&y.permissions.length>0?l.jsxs("table",{className:"g7dt-table g7dt-w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"g7dt-border-b g7dt-border-gray-700",children:[l.jsx("th",{className:"g7dt-text-left g7dt-p-2 g7dt-text-muted",children:"권한 ID"}),l.jsx("th",{className:"g7dt-text-left g7dt-p-2 g7dt-text-muted",children:"명칭"})]})}),l.jsx("tbody",{children:y.permissions.map(A=>l.jsxs("tr",{className:"g7dt-border-b g7dt-border-gray-800",children:[l.jsx("td",{className:"g7dt-p-2 g7dt-font-mono g7dt-text-blue",children:A}),l.jsx("td",{className:"g7dt-p-2 g7dt-text-white",children:f[A]||l.jsx("span",{className:"g7dt-text-muted",children:"-"})})]},A))})]}):y.permissions&&y.permissions.length===0?l.jsx("p",{className:"g7dt-text-muted g7dt-p-2",children:"🌐 공개 레이아웃 (permissions: [])"}):l.jsx("p",{className:"g7dt-text-muted g7dt-p-2",children:"권한 미정의 (부모 레이아웃 상속)"})}):l.jsx("pre",{className:"g7dt-pre g7dt-text-green g7dt-max-h-96 g7dt-overflow-auto",children:JSON.stringify(a?y:o&&y?y[o]:null,null,2)})]}),w.length>0&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-cursor-pointer",onClick:()=>h(!g),children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold",children:["📜 로드 이력 (",w.length,")"]}),l.jsx("span",{className:"g7dt-text-muted",children:g?"▼":"▶"})]}),g&&l.jsx("div",{className:"g7dt-mt-2 g7dt-space-y-1",children:w.slice(-20).reverse().map(A=>l.jsxs("div",{className:"g7dt-history-item",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsx("span",{className:"g7dt-font-mono g7dt-text-xs",children:A.layoutPath}),l.jsx("span",{className:`g7dt-text-xs ${A.source==="cache"?"g7dt-text-green":"g7dt-text-yellow"}`,children:A.source==="cache"?"💾":"🌐"})]}),l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted",children:[A.templateId," · ",A.loadedAt?new Date(A.loadedAt).toLocaleTimeString():"-"]})]},A.id))})]}),l.jsxs("div",{className:"g7dt-card g7dt-text-xs g7dt-text-muted",children:["💡 레이아웃 캐시 문제가 의심되면:",l.jsxs("ul",{className:"g7dt-ml-4 g7dt-list-disc",children:[l.jsx("li",{children:'"소스" 항목이 💾 캐시인지 🌐 API인지 확인'}),l.jsx("li",{children:"캐시에서 로드된 경우, JSON 내용이 최신인지 확인"}),l.jsxs("li",{children:["문제가 있으면 ",l.jsx("code",{className:"g7dt-code",children:"php artisan template:refresh-layout"})," 실행"]})]})]})]}):l.jsx("div",{className:"g7dt-space-y-4",children:l.jsxs("div",{className:"g7dt-empty-state",children:["현재 로드된 레이아웃이 없습니다.",l.jsx("br",{}),"페이지를 새로고침하거나 라우트를 변경해보세요."]})})},kk=({devTools:r})=>{const[e,n]=j.useState(r.getChangeDetectionInfo()),[a,i]=j.useState(null),[o,d]=j.useState(!1),[g,h]=j.useState(new Set);j.useEffect(()=>{const N=setInterval(()=>{n(r.getChangeDetectionInfo())},500);return()=>clearInterval(N)},[r]);const{executionDetails:f,alerts:p,stats:x}=e,y=o?f.filter(N=>N.alerts.length>0||N.stateChanges.length===0):f,w=a?f.find(N=>N.executionId===a):null,v=N=>{h(D=>{const M=new Set(D);return M.has(N)?M.delete(N):M.add(N),M})},C=N=>{switch(N){case"normal":return"✅";case"early-return-condition":return"⏎";case"early-return-validation":return"❌";case"error":return"💥";default:return"❓"}},k=N=>{switch(N){case"no-state-change":return"⚠️";case"no-datasource-change":return"📊";case"expected-not-fulfilled":return"❗";case"object-reference-same":return"🔄";case"early-return-detected":return"⏎";case"async-timing-issue":return"⏱️";default:return"📢"}},A=N=>{switch(N){case"error":return"g7dt-text-red";case"warning":return"g7dt-text-yellow";case"info":return"g7dt-text-blue";default:return"g7dt-text-white"}},R=N=>new Date(N).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3});return l.jsxs("div",{className:"g7dt-space-y-4",children:[p.filter(N=>N.severity==="error"||N.severity==="warning").length>0&&l.jsx("div",{className:"g7dt-card",style:{backgroundColor:"#7f1d1d",borderColor:"#991b1b"},children:l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("span",{className:"g7dt-font-bold",children:["⚠️ 변경 감지 알림: ",p.filter(N=>N.severity==="error").length,"개 에러,"," ",p.filter(N=>N.severity==="warning").length,"개 경고"]}),l.jsx("button",{onClick:()=>r.clearChangeDetectionData(),className:"g7dt-btn-small",children:"초기화"})]})}),l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"📊 변경 감지 통계"}),l.jsxs("div",{className:"g7dt-grid-3",children:[l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"총 실행:"}),l.jsx("span",{className:"g7dt-text-blue",children:x.totalExecutions})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"상태 변경 있음:"}),l.jsx("span",{className:"g7dt-text-green",children:x.executionsWithStateChange})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"상태 변경 없음:"}),l.jsx("span",{className:x.executionsWithoutStateChange>0?"g7dt-text-yellow":"g7dt-text-gray",children:x.executionsWithoutStateChange})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"Early Return:"}),l.jsx("span",{className:"g7dt-text-orange",children:x.earlyReturnCount})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"알림:"}),l.jsx("span",{className:x.alertCount>0?"g7dt-text-red":"g7dt-text-gray",children:x.alertCount})]})]})]}),p.length>0&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"🔔 최근 알림"}),l.jsx("div",{className:"g7dt-space-y-2",style:{maxHeight:"200px",overflowY:"auto"},children:p.slice(-10).reverse().map(N=>l.jsxs("div",{className:"g7dt-list-item",onClick:()=>v(N.id),style:{cursor:"pointer"},children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-start",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:k(N.type)}),l.jsx("span",{className:`g7dt-text-xs ${A(N.severity)}`,children:N.message})]}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:R(N.timestamp)})]}),g.has(N.id)&&l.jsxs("div",{className:"g7dt-mt-2 g7dt-text-xs g7dt-text-muted g7dt-pl-6",children:[l.jsx("p",{children:N.description}),N.statePath&&l.jsxs("p",{className:"g7dt-mt-1",children:[l.jsx("span",{className:"g7dt-text-cyan",children:"경로:"})," ",N.statePath]}),N.suggestion&&l.jsxs("p",{className:"g7dt-mt-1",children:[l.jsx("span",{className:"g7dt-text-green",children:"제안:"})," ",N.suggestion]}),N.docLink&&l.jsxs("p",{className:"g7dt-mt-1",children:[l.jsx("span",{className:"g7dt-text-blue",children:"문서:"})," ",l.jsx("code",{className:"g7dt-code",children:N.docLink})]})]})]},N.id))})]}),l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"🔧 핸들러 실행 이력"}),l.jsxs("label",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[l.jsx("input",{type:"checkbox",checked:o,onChange:N=>d(N.target.checked)}),l.jsx("span",{children:"경고만 표시"})]})]}),y.length===0?l.jsxs("div",{className:"g7dt-empty-state",children:["핸들러 실행 이력이 없습니다.",l.jsx("br",{}),"액션을 실행하면 여기에 표시됩니다."]}):l.jsx("div",{className:"g7dt-space-y-1",style:{maxHeight:"300px",overflowY:"auto"},children:y.slice(-20).reverse().map(N=>l.jsxs("div",{className:`g7dt-list-item ${a===N.executionId?"g7dt-selected":""}`,onClick:()=>i(a===N.executionId?null:N.executionId),style:{cursor:"pointer"},children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:C(N.exitReason)}),l.jsx("span",{className:"g7dt-text-white g7dt-font-mono g7dt-text-xs",children:N.handlerName}),N.alerts.length>0&&l.jsx("span",{className:"g7dt-badge g7dt-badge-warning",children:N.alerts.length})]}),l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[l.jsxs("span",{className:"g7dt-text-muted",children:["상태: ",N.stateChanges.length]}),l.jsx("span",{className:"g7dt-text-muted",children:N.duration?`${N.duration}ms`:"-"}),l.jsx("span",{className:"g7dt-text-muted",children:R(N.startTime)})]})]}),a===N.executionId&&w&&l.jsxs("div",{className:"g7dt-mt-3 g7dt-pt-3 g7dt-border-t g7dt-border-gray-700",children:[l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:"종료 사유: "}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:w.exitReason||"unknown"}),w.exitLocation&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-2",children:"위치: "}),l.jsx("code",{className:"g7dt-code g7dt-text-xs",children:w.exitLocation})]})]}),w.exitDescription&&l.jsx("div",{className:"g7dt-mb-2 g7dt-text-xs g7dt-text-muted",children:w.exitDescription}),w.stateChanges.length>0&&l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsxs("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-green",children:["상태 변경 (",w.stateChanges.length,")"]}),l.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:w.stateChanges.map(D=>l.jsxs("div",{className:"g7dt-text-xs g7dt-pl-2",children:[l.jsx("span",{className:"g7dt-text-cyan",children:D.path}),l.jsxs("span",{className:"g7dt-text-muted",children:[" (",D.changeType,")"]}),D.comparison.changedKeys&&l.jsxs("span",{className:"g7dt-text-muted g7dt-ml-1",children:["[변경: ",D.comparison.changedKeys.join(", "),"]"]})]},D.id))})]}),w.dataSourceChanges.length>0&&l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsxs("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-blue",children:["데이터소스 변경 (",w.dataSourceChanges.length,")"]}),l.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:w.dataSourceChanges.map((D,M)=>l.jsxs("div",{className:"g7dt-text-xs g7dt-pl-2",children:[l.jsx("span",{className:"g7dt-text-cyan",children:D.dataSourceId}),l.jsxs("span",{className:"g7dt-text-muted",children:[" ","(",D.changeType,": ",D.previousStatus," → ",D.newStatus,")"]})]},M))})]}),w.expectedChanges&&l.jsxs("div",{className:"g7dt-mb-2",children:[l.jsx("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-yellow",children:"기대 변경"}),l.jsxs("div",{className:"g7dt-mt-1 g7dt-text-xs g7dt-pl-2 g7dt-text-muted",children:["상태: ",w.expectedChanges.expectedStatePaths.join(", ")||"없음",l.jsx("br",{}),"데이터소스: ",w.expectedChanges.expectedDataSources.join(", ")||"없음"]})]}),w.alerts.length>0&&l.jsxs("div",{children:[l.jsxs("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-red",children:["알림 (",w.alerts.length,")"]}),l.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:w.alerts.map(D=>l.jsxs("div",{className:"g7dt-text-xs g7dt-pl-2",children:[l.jsx("span",{children:k(D.type)}),l.jsx("span",{className:`g7dt-ml-1 ${A(D.severity)}`,children:D.message})]},D.id))})]})]})]},N.executionId))})]}),l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"💡 변경 감지 가이드"}),l.jsxs("ul",{className:"g7dt-help-list",children:[l.jsx("li",{children:"핸들러 실행 후 상태 변경이 없으면 ⚠️ 경고가 표시됩니다"}),l.jsx("li",{children:"early return으로 종료된 경우 ⏎ 아이콘으로 표시됩니다"}),l.jsx("li",{children:"객체 변경 시 참조가 동일하면 🔄 경고가 발생합니다"}),l.jsx("li",{children:"문제 해결: exitLocation 확인 → 조건문 검토 → 불변성 확인"})]})]})]})},Nk=({devTools:r})=>{const[e,n]=j.useState(null),[a,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{n(r.getStaleClosureTrackingInfo())},[r]);if(j.useEffect(()=>{g();const v=setInterval(g,2e3);return()=>clearInterval(v)},[g]),!e)return l.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const{warnings:h,stats:f}=e,p=h.filter(v=>o==="all"?!0:v.severity===o),x=a?h.find(v=>v.id===a):null,y=v=>{switch(v){case"error":return"❌";case"warning":return"⚠️";default:return"❓"}},w=v=>{switch(v){case"state-changed-during-async":return"⏳";case"captured-in-callback":return"📸";case"stale-in-handler":return"🔄";default:return"❓"}};return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Stale Closure 통계"}),l.jsxs("div",{className:"g7dt-stats-grid-3",children:[l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-yellow",children:f.totalWarnings||0}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 경고"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:f.warningsBySeverity?.error||0}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"에러"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-orange",children:f.warningsBySeverity?.warning||0}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"경고"})]})]})]}),f.warningsByType&&Object.keys(f.warningsByType).length>0&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"타입별 분포"}),l.jsx("div",{className:"g7dt-space-y-2",children:Object.entries(f.warningsByType).map(([v,C])=>l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[l.jsxs("span",{className:"g7dt-text-muted",children:[w(v)," ",v]}),l.jsx("span",{className:"g7dt-text-white g7dt-font-mono",children:C})]},v))})]}),l.jsx("div",{className:"g7dt-card",children:l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:"심각도:"}),l.jsxs("select",{value:o,onChange:v=>d(v.target.value),className:"g7dt-select",children:[l.jsx("option",{value:"all",children:"전체"}),l.jsx("option",{value:"error",children:"에러"}),l.jsx("option",{value:"warning",children:"경고"})]}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[p.length,"개 표시"]})]})}),l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Stale Closure 경고"}),p.length===0?l.jsx("div",{className:"g7dt-empty-state g7dt-text-green",children:"✅ Stale Closure 경고가 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:p.slice().reverse().map(v=>l.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${a===v.id?"g7dt-selected":""}`,onClick:()=>i(a===v.id?null:v.id),children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:y(v.severity)}),l.jsx("span",{children:w(v.type)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-truncate",children:v.location}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:new Date(v.timestamp).toLocaleTimeString()})]}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:v.statePath})]},v.id))})]}),x&&l.jsxs("div",{className:"g7dt-card g7dt-border-yellow",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[y(x.severity)," 경고 상세"]}),l.jsxs("div",{className:"g7dt-space-y-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"위치"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white g7dt-mono",children:x.location})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"타입"}),l.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[w(x.type)," ",x.type]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 경로"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-yellow g7dt-mono",children:x.statePath})]}),l.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"캡처된 값"}),l.jsx("pre",{className:"g7dt-code-block g7dt-text-red",children:JSON.stringify(x.capturedValue,null,2)})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"현재 값"}),l.jsx("pre",{className:"g7dt-code-block g7dt-text-green",children:JSON.stringify(x.currentValue,null,2)})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"시간 차이"}),l.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[x.timeDiff,"ms"]})]}),x.suggestion&&l.jsxs("div",{className:"g7dt-bg-blue-dark g7dt-p-2 g7dt-rounded",children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-blue",children:"💡 제안"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white g7dt-mt-1",children:x.suggestion})]})]})]})]})},Ek=({devTools:r})=>{const[e,n]=j.useState(null),[a,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{n(r.getNestedContextTrackingInfo())},[r]);if(j.useEffect(()=>{g();const v=setInterval(g,2e3);return()=>clearInterval(v)},[g]),!e)return l.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const{contexts:h,stats:f}=e,p=h.filter(v=>o==="all"?!0:v.componentType===o),x=a?h.find(v=>v.id===a):null,y=v=>{switch(v){case"expandChildren":return"📂";case"cellChildren":return"📊";case"iteration":return"🔄";case"modal":return"🪟";case"slot":return"🔲";default:return"❓"}},w=v=>"│".repeat(Math.max(0,v-1))+(v>0?"├─":"");return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Nested Context 통계"}),l.jsxs("div",{className:"g7dt-stats-grid-3",children:[l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-blue",children:f.totalContexts||0}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 컨텍스트"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-purple",children:f.maxDepth||0}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"최대 깊이"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:f.failedAccessCount||0}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"접근 오류"})]})]})]}),f.byType&&Object.keys(f.byType).length>0&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"타입별 분포"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-3",children:Object.entries(f.byType).map(([v,C])=>l.jsxs("div",{className:`g7dt-badge g7dt-cursor-pointer ${o===v?"g7dt-badge-selected":""}`,onClick:()=>d(o===v?"all":v),children:[y(v)," ",v,": ",C]},v))})]}),l.jsx("div",{className:"g7dt-card",children:l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:"타입:"}),l.jsxs("select",{value:o,onChange:v=>d(v.target.value),className:"g7dt-select",children:[l.jsx("option",{value:"all",children:"전체"}),l.jsx("option",{value:"expandChildren",children:"expandChildren"}),l.jsx("option",{value:"cellChildren",children:"cellChildren"}),l.jsx("option",{value:"iteration",children:"iteration"}),l.jsx("option",{value:"modal",children:"modal"}),l.jsx("option",{value:"slot",children:"slot"})]}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[p.length,"개 표시"]})]})}),l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"컨텍스트 목록"}),p.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"추적된 Nested Context가 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:p.slice().reverse().map(v=>{const C=v.accessAttempts?.some(A=>!A.found),k=v.mergedContext?.all||[];return l.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${a===v.id?"g7dt-selected":""} ${C?"g7dt-border-red":""}`,onClick:()=>i(a===v.id?null:v.id),children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:"g7dt-text-muted g7dt-mono g7dt-text-xs",children:w(v.depth)}),l.jsx("span",{children:y(v.componentType)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:v.componentId||v.componentType}),C&&l.jsx("span",{className:"g7dt-text-red g7dt-text-xs",children:"⚠️ 오류"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:["깊이: ",v.depth]})]}),l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["변수: ",k.slice(0,5).join(", "),k.length>5&&"..."]})]},v.id)})})]}),x&&l.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[y(x.componentType)," 컨텍스트 상세"]}),l.jsxs("div",{className:"g7dt-space-y-3",children:[l.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"타입"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:x.componentType})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"깊이"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:x.depth})]})]}),x.componentId&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"컴포넌트 ID"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-blue g7dt-mono",children:x.componentId})]}),x.parentId&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"부모 컨텍스트"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-purple g7dt-mono",children:x.parentId})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"사용 가능한 변수"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:(x.mergedContext?.all||[]).map(v=>l.jsx("span",{className:"g7dt-badge g7dt-badge-blue g7dt-text-xs",children:v},v))})]}),x.ownContext?.added&&x.ownContext.added.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"추가된 변수 (이 컨텍스트에서)"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:x.ownContext.added.map(v=>l.jsxs("span",{className:"g7dt-badge g7dt-badge-green g7dt-text-xs",children:["+ ",v]},v))})]}),x.accessAttempts&&x.accessAttempts.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"접근 시도"}),l.jsx("div",{className:"g7dt-space-y-1",children:x.accessAttempts.slice(0,10).map((v,C)=>l.jsxs("div",{className:`g7dt-flex g7dt-justify-between g7dt-text-xs ${v.found?"":"g7dt-text-red"}`,children:[l.jsx("span",{className:"g7dt-mono",children:v.path}),l.jsx("span",{children:v.found?"✓":"✕"})]},C))})]})]})]})]})},_k=({devTools:r})=>{const[e,n]=j.useState(null),[a,i]=j.useState(null),[o,d]=j.useState(null),[g,h]=j.useState("modals"),f=j.useCallback(()=>{n(r.getModalStateScopeTrackingInfo())},[r]);if(j.useEffect(()=>{f();const D=setInterval(f,2e3);return()=>clearInterval(D)},[f]),!e)return l.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const{modals:p,issues:x,relations:y,changeLogs:w,stats:v}=e,C=a?p.find(D=>D.modalId===a):null,k=o?x.find(D=>D.id===o):null,A=D=>{switch(D){case"isolated":return"🔒";case"shared":return"🔓";case"inherited":return"📥";default:return"❓"}},R=D=>{switch(D){case"state-leakage":return"💧";case"isolation-violation":return"🔓";case"parent-mutation":return"👆";case"orphaned-state":return"👻";case"scope-mismatch":return"🔀";case"cleanup-failure":return"🧹";case"missing-definition":return"🚫";default:return"❓"}},N=D=>{switch(D){case"error":return"❌";case"warning":return"⚠️";default:return"❓"}};return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"모달 상태 스코프 통계"}),l.jsxs("div",{className:"g7dt-stats-grid-3",children:[l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-blue",children:v.totalModals}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 모달"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-green",children:v.openModals}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"열린 모달"})]}),l.jsxs("div",{className:"g7dt-text-center",children:[l.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:v.totalIssues}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"이슈"})]})]})]}),l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"스코프별 / 이슈별"}),l.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"스코프 타입"}),l.jsx("div",{className:"g7dt-space-y-1",children:Object.entries(v.byScope).map(([D,M])=>l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[l.jsxs("span",{children:[A(D)," ",D]}),l.jsx("span",{className:"g7dt-font-mono",children:M})]},D))})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"이슈 타입"}),l.jsxs("div",{className:"g7dt-space-y-1",children:[Object.entries(v.issuesByType).filter(([D,M])=>M>0).map(([D,M])=>l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[l.jsxs("span",{children:[R(D)," ",D]}),l.jsx("span",{className:"g7dt-font-mono g7dt-text-red",children:M})]},D)),Object.values(v.issuesByType).every(D=>D===0)&&l.jsx("div",{className:"g7dt-text-xs g7dt-text-green",children:"✅ 이슈 없음"})]})]})]})]}),l.jsx("div",{className:"g7dt-card",children:l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsxs("button",{className:`g7dt-tab-button ${g==="modals"?"g7dt-tab-active":""}`,onClick:()=>h("modals"),children:["🪟 모달 (",p.length,")"]}),l.jsxs("button",{className:`g7dt-tab-button ${g==="issues"?"g7dt-tab-active":""}`,onClick:()=>h("issues"),children:["⚠️ 이슈 (",x.length,")"]}),l.jsxs("button",{className:`g7dt-tab-button ${g==="logs"?"g7dt-tab-active":""}`,onClick:()=>h("logs"),children:["📝 로그 (",w.length,")"]})]})}),g==="modals"&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"모달 목록"}),p.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"추적된 모달이 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:p.map(D=>{const M=x.some(L=>L.modalId===D.modalId);return l.jsx("div",{className:`g7dt-list-item g7dt-cursor-pointer ${a===D.modalId?"g7dt-selected":""} ${M?"g7dt-border-red":""}`,onClick:()=>i(a===D.modalId?null:D.modalId),children:l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:D.closedAt===null?"📭":"📪"}),l.jsx("span",{children:A(D.scopeType)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:D.modalName}),M&&l.jsx("span",{className:"g7dt-text-red",children:"⚠️"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:["변경: ",D.stateChangeCount]})]})},D.modalId)})})]}),g==="issues"&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"이슈 목록"}),x.length===0?l.jsx("div",{className:"g7dt-empty-state g7dt-text-green",children:"✅ 모달 상태 이슈가 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:x.slice().reverse().map(D=>l.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${o===D.id?"g7dt-selected":""}`,onClick:()=>d(o===D.id?null:D.id),children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:N(D.severity)}),l.jsx("span",{children:R(D.type)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:D.modalName}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:new Date(D.timestamp).toLocaleTimeString()})]}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:D.description})]},D.id))})]}),g==="logs"&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"상태 변경 로그"}),w.length===0?l.jsx("div",{className:"g7dt-empty-state",children:"상태 변경 로그가 없습니다"}):l.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:w.slice().reverse().slice(0,50).map(D=>l.jsxs("div",{className:`g7dt-list-item ${D.violatesIsolation?"g7dt-border-red":""}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:D.modalName}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-blue g7dt-mono",children:D.stateKey}),D.violatesIsolation&&l.jsx("span",{className:"g7dt-text-red",children:"⚠️ 격리 위반"}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:new Date(D.timestamp).toLocaleTimeString()})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-text-xs g7dt-mt-1",children:[l.jsx("span",{className:"g7dt-text-red g7dt-truncate",style:{maxWidth:"45%"},children:JSON.stringify(D.previousValue)}),l.jsx("span",{className:"g7dt-text-muted",children:"→"}),l.jsx("span",{className:"g7dt-text-green g7dt-truncate",style:{maxWidth:"45%"},children:JSON.stringify(D.newValue)})]})]},D.id))})]}),C&&g==="modals"&&l.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[A(C.scopeType)," 모달 상세: ",C.modalName]}),l.jsxs("div",{className:"g7dt-space-y-3",children:[l.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"스코프"}),l.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[A(C.scopeType)," ",C.scopeType]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:C.closedAt===null?"📭 열림":"📪 닫힘"})]})]}),C.parentModalId&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"부모 모달"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-purple g7dt-mono",children:C.parentModalId})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 변경 횟수"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:C.stateChangeCount})]}),C.isolatedStateKeys.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-1",children:"격리된 상태 키"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:C.isolatedStateKeys.map(D=>l.jsxs("span",{className:"g7dt-badge g7dt-badge-red g7dt-text-xs",children:["🔒 ",D]},D))})]}),C.sharedStateKeys.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-1",children:"공유된 상태 키"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:C.sharedStateKeys.map(D=>l.jsxs("span",{className:"g7dt-badge g7dt-badge-blue g7dt-text-xs",children:["🔓 ",D]},D))})]})]})]}),k&&g==="issues"&&l.jsxs("div",{className:"g7dt-card g7dt-border-red",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[N(k.severity)," 이슈 상세"]}),l.jsxs("div",{className:"g7dt-space-y-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"타입"}),l.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[R(k.type)," ",k.type]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"설명"}),l.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:k.description})]}),k.affectedStateKeys.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"영향 받는 상태 키"}),l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:k.affectedStateKeys.map(D=>l.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:D},D))})]}),k.leakedValue!==void 0&&l.jsxs("div",{children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"유출된 값"}),l.jsx("pre",{className:"g7dt-code-block g7dt-text-red",children:JSON.stringify(k.leakedValue,null,2)})]})]})]}),y.length>0&&l.jsxs("div",{className:"g7dt-card",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"모달 관계"}),l.jsx("div",{className:"g7dt-space-y-2",children:y.map((D,M)=>l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[l.jsx("span",{className:"g7dt-text-purple",children:D.parentModalId}),l.jsx("span",{className:"g7dt-text-muted",children:"→"}),l.jsx("span",{className:"g7dt-text-blue",children:D.childModalId}),l.jsx("span",{className:"g7dt-badge g7dt-text-xs g7dt-ml-auto",children:D.relationType})]},M))})]})]})},Tk=({devTools:r})=>{const[e,n]=j.useState("definitions"),[a,i]=j.useState(null),[o,d]=j.useState(""),g=j.useCallback(()=>{r&&i(r.getNamedActionTrackingInfo())},[r]);if(j.useEffect(()=>{g();const v=setInterval(g,2e3);return()=>clearInterval(v)},[g]),!a)return l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"데이터 로딩 중..."});const{definitions:h,refLogs:f,stats:p}=a,x=Object.keys(h),y=x.filter(v=>!o||v.toLowerCase().includes(o.toLowerCase())||h[v]?.handler?.toLowerCase().includes(o.toLowerCase())),w=f.filter(v=>!o||v.actionRefName.toLowerCase().includes(o.toLowerCase())||v.resolvedHandler.toLowerCase().includes(o.toLowerCase()));return l.jsxs("div",{className:"g7dt-space-y-4",children:[l.jsxs("div",{className:"g7dt-grid g7dt-grid-cols-3 g7dt-gap-2",children:[l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value",children:p.totalDefinitions}),l.jsx("div",{className:"g7dt-stat-label",children:"정의"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value",children:p.totalRefs}),l.jsx("div",{className:"g7dt-stat-label",children:"참조"})]}),l.jsxs("div",{className:"g7dt-stat-card",children:[l.jsx("div",{className:"g7dt-stat-value",style:{color:p.unusedDefinitions.length>0?"#f59e0b":"#10b981"},children:p.unusedDefinitions.length}),l.jsx("div",{className:"g7dt-stat-label",children:"미사용"})]})]}),l.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[l.jsxs("button",{onClick:()=>n("definitions"),className:e==="definitions"?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:["정의 목록 (",x.length,")"]}),l.jsxs("button",{onClick:()=>n("refs"),className:e==="refs"?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:["참조 이력 (",f.length,")"]}),l.jsx("button",{onClick:g,className:"g7dt-filter-btn",title:"새로고침",children:"↻"})]}),l.jsx("input",{type:"text",placeholder:e==="definitions"?"액션 이름 검색...":"actionRef 검색...",value:o,onChange:v=>d(v.target.value),className:"g7dt-input g7dt-w-full"}),e==="definitions"&&l.jsx("div",{className:"g7dt-space-y-1",children:y.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:x.length===0?"정의된 named_actions가 없습니다":"검색 결과 없음"}):y.map(v=>{const C=h[v],k=p.refCountByName[v]||0,A=p.unusedDefinitions.includes(v);return l.jsxs("div",{className:"g7dt-card",style:{borderLeft:A?"3px solid #f59e0b":"3px solid #10b981"},children:[l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-font-bold",children:v}),l.jsxs("span",{className:"g7dt-text-muted g7dt-ml-2",children:["→ ",C.handler]})]}),l.jsxs("span",{className:"g7dt-badge",title:"참조 횟수",children:[k,"회"]})]}),C.params&&l.jsxs("details",{className:"g7dt-mt-1",children:[l.jsx("summary",{className:"g7dt-text-xs g7dt-text-muted g7dt-cursor-pointer",children:"params"}),l.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-mt-1",style:{maxHeight:"200px",overflow:"auto"},children:JSON.stringify(C.params,null,2)})]}),A&&l.jsx("div",{className:"g7dt-text-xs",style:{color:"#f59e0b",marginTop:"4px"},children:"⚠ 미사용 정의"})]},v)})}),e==="refs"&&l.jsx("div",{className:"g7dt-space-y-1",children:w.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:f.length===0?"actionRef 해석 이력이 없습니다":"검색 결과 없음"}):[...w].reverse().map(v=>l.jsx("div",{className:"g7dt-card",children:l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-font-bold",children:v.actionRefName}),l.jsxs("span",{className:"g7dt-text-muted g7dt-ml-2",children:["→ ",v.resolvedHandler]})]}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:new Date(v.timestamp).toLocaleTimeString()})]})},v.id))})]})},Ak=()=>{j.useEffect(()=>{nk()},[]);const r=j.useRef(rx()),[e,n]=j.useState(r.current.isOpen??!1),[a,i]=j.useState(!1),[o,d]=j.useState("state"),[g,h]=j.useState({_global:{},_local:{},_computed:{}}),[f,p]=j.useState([]),[x,y]=j.useState({hits:0,misses:0,entries:0,hitRate:0}),[w,v]=j.useState(!1),[C,k]=j.useState(r.current.position??{x:-1,y:-1}),[A,R]=j.useState(!1),N=j.useRef(null),D=j.useRef(null),[M,L]=j.useState(r.current.size??{width:ak,height:sk}),[z,Y]=j.useState(!1),[he,be]=j.useState(null),X=j.useRef(null),[ge,xe]=j.useState(!1),le=j.useRef(null),je=Ca.getInstance(),J=ex();j.useEffect(()=>{if(C.x===-1&&C.y===-1){const q=window.innerWidth-M.width-16;k({x:q,y:16})}},[C,M.width]),j.useEffect(()=>{if(C.x===-1&&C.y===-1||A||z)return;const q=setTimeout(()=>{ix({position:C,size:M})},300);return()=>clearTimeout(q)},[C,M,A,z]),j.useEffect(()=>{ix({isOpen:e})},[e]);const F=j.useCallback(q=>{q.target.tagName!=="BUTTON"&&(R(!0),N.current={x:q.clientX,y:q.clientY,posX:C.x,posY:C.y},q.preventDefault())},[C]);j.useEffect(()=>{if(!A)return;const q=se=>{if(!N.current)return;const we=se.clientX-N.current.x,Ee=se.clientY-N.current.y;let Oe=N.current.posX+we,tt=N.current.posY+Ee;const Me=window.innerWidth-M.width,qe=window.innerHeight-M.height;Oe=Math.max(0,Math.min(Oe,Me)),tt=Math.max(0,Math.min(tt,qe)),k({x:Oe,y:tt})},ie=()=>{R(!1),N.current=null};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",ie)}},[A,M.width,M.height]);const Q=j.useCallback(q=>ie=>{ie.preventDefault(),ie.stopPropagation(),Y(!0),be(q),X.current={x:ie.clientX,y:ie.clientY,width:M.width,height:M.height,posX:C.x,posY:C.y}},[M,C]);j.useEffect(()=>{if(!z||!he)return;const q=se=>{if(!X.current)return;const we=se.clientX-X.current.x,Ee=se.clientY-X.current.y;let Oe=X.current.width,tt=X.current.height,Me=X.current.posX,qe=X.current.posY;if(he.includes("e")&&(Oe=Math.max(nx,X.current.width+we)),he.includes("w")){const zt=Math.min(we,X.current.width-nx);Oe=X.current.width-zt,Me=X.current.posX+zt}if(he.includes("s")&&(tt=Math.max(ax,X.current.height+Ee)),he.includes("n")){const zt=Math.min(Ee,X.current.height-ax);tt=X.current.height-zt,qe=X.current.posY+zt}Oe=Math.min(Oe,window.innerWidth-Me),tt=Math.min(tt,window.innerHeight-qe),Me=Math.max(0,Me),qe=Math.max(0,qe),L({width:Oe,height:tt}),k({x:Me,y:qe})},ie=()=>{Y(!1),be(null),X.current=null};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",ie)}},[z,he]);const pe=j.useCallback(()=>{ge?(le.current&&(k(le.current.position),L(le.current.size)),xe(!1)):(le.current={position:C,size:M},k({x:0,y:0}),L({width:window.innerWidth,height:window.innerHeight}),xe(!0))},[ge,C,M]),$=j.useCallback(()=>{je.isEnabled()&&(h(je.getState()),p(je.getActionHistory()),y(je.getCacheStats()),v(J.isConnected()))},[je,J]);j.useEffect(()=>{const q=ie=>{ie.ctrlKey&&ie.shiftKey&&ie.key==="G"&&(ie.preventDefault(),n(se=>!se))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[]),j.useEffect(()=>{if(!e||!je.isEnabled())return;$();const q=je.watchState("*",()=>{h(je.getState())}),ie=je.watchActions(()=>{p(je.getActionHistory()),y(je.getCacheStats())}),se=setInterval($,5e3);return()=>{q(),ie(),clearInterval(se)}},[e,je,$]);const U=async()=>{try{const q=await J.dumpState();console.log("[G7DevTools] 상태 덤프 완료:",q),v(!0)}catch(q){console.error("[G7DevTools] 상태 덤프 실패:",q),v(!1)}};return je.isEnabled()?e?a?l.jsx("div",{className:"g7dt-minimized",children:l.jsxs("div",{className:"g7dt-minimized-content",children:[l.jsx("span",{className:"g7dt-font-bold g7dt-text-sm",children:"G7 DevTools"}),l.jsx("button",{onClick:()=>i(!1),className:"g7dt-btn g7dt-text-xs",title:"확장",children:"▲"}),l.jsx("button",{onClick:()=>n(!1),className:"g7dt-btn g7dt-text-xs",children:"✕"})]})}):l.jsxs("div",{ref:D,className:`g7dt-panel ${ge?"maximized":""} ${z?"g7dt-resizing":""}`,style:{left:`${C.x>=0?C.x:0}px`,top:`${C.y>=0?C.y:0}px`,width:`${M.width}px`,height:`${M.height}px`},children:[!ge&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-nw",onMouseDown:Q("nw")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-ne",onMouseDown:Q("ne")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-sw",onMouseDown:Q("sw")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-se",onMouseDown:Q("se")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-h g7dt-resize-n",onMouseDown:Q("n")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-h g7dt-resize-s",onMouseDown:Q("s")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-v g7dt-resize-w",onMouseDown:Q("w")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-v g7dt-resize-e",onMouseDown:Q("e")})]}),l.jsxs("div",{className:`g7dt-header ${A?"dragging":""}`,onMouseDown:F,children:[l.jsxs("div",{className:"g7dt-header-left",children:[l.jsx("span",{className:"g7dt-header-title",children:"G7 DevTools"}),l.jsx("span",{className:`g7dt-header-badge ${w?"connected":""}`,title:w?"서버 덤프 성공":"서버에 덤프되지 않음 (덤프 버튼 클릭)",children:w?"덤프 완료":"로컬 모드"})]}),l.jsxs("div",{className:"g7dt-header-right",children:[l.jsx("button",{onClick:U,className:"g7dt-btn g7dt-btn-primary",title:"서버로 상태 덤프",children:"덤프"}),l.jsx("button",{onClick:$,className:"g7dt-btn",title:"새로고침",children:"↻"}),l.jsx("button",{onClick:pe,className:"g7dt-btn",title:ge?"복원":"최대화",children:ge?"❐":"□"}),l.jsx("button",{onClick:()=>i(!0),className:"g7dt-btn",title:"최소화",children:"▼"}),l.jsx("button",{onClick:()=>n(!1),className:"g7dt-btn",children:"✕"})]})]}),l.jsx("div",{className:"g7dt-tabs",children:Object.keys(tx).map(q=>l.jsx("button",{onClick:()=>d(q),className:`g7dt-tab ${o===q?"active":""}`,children:tx[q]},q))}),l.jsxs("div",{className:"g7dt-content",children:[o==="state"&&l.jsx(ok,{state:g,devTools:je}),o==="actions"&&l.jsx(lk,{actions:f,devTools:je}),o==="cache"&&l.jsx(ck,{stats:x,devTools:je}),o==="diagnose"&&l.jsx(dk,{}),o==="performance"&&l.jsx(uk,{devTools:je}),o==="lifecycle"&&l.jsx(gk,{devTools:je}),o==="network"&&l.jsx(hk,{devTools:je}),o==="form"&&l.jsx(fk,{devTools:je}),o==="conditional"&&l.jsx(pk,{devTools:je}),o==="expression"&&l.jsx(mk,{devTools:je}),o==="handlers"&&l.jsx(yk,{devTools:je}),o==="events"&&l.jsx(xk,{devTools:je}),o==="datasources"&&l.jsx(bk,{devTools:je}),o==="renders"&&l.jsx(vk,{devTools:je}),o==="styles"&&l.jsx(Sk,{devTools:je}),o==="auth"&&l.jsx(wk,{devTools:je}),o==="logs"&&l.jsx(Ck,{devTools:je}),o==="layout"&&l.jsx(jk,{devTools:je}),o==="changedetection"&&l.jsx(kk,{devTools:je}),o==="staleclosure"&&l.jsx(Nk,{devTools:je}),o==="nestedcontext"&&l.jsx(Ek,{devTools:je}),o==="modalscope"&&l.jsx(_k,{devTools:je}),o==="namedactions"&&l.jsx(Tk,{devTools:je})]}),l.jsxs("div",{className:"g7dt-footer",children:[l.jsx("span",{children:"Ctrl+Shift+G 토글 | 헤더 드래그로 이동"}),l.jsxs("span",{children:["액션: ",f.length," | 캐시 히트율: ",(x.hitRate*100).toFixed(1),"%"]})]})]}):l.jsx("button",{onClick:()=>n(!0),className:"g7dt-floating-btn",title:"G7 DevTools (Ctrl+Shift+G)",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}):e?l.jsxs("div",{className:"g7dt-disabled-notice",children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-justify-between g7dt-mb-2",children:[l.jsx("span",{className:"g7dt-font-bold g7dt-text-yellow",children:"G7 DevTools"}),l.jsx("button",{onClick:()=>n(!1),className:"g7dt-btn",children:"✕"})]}),l.jsx("p",{className:"g7dt-text-sm g7dt-text-gray",children:"DevTools가 비활성화되어 있습니다."}),l.jsx("p",{className:"g7dt-text-xs g7dt-text-gray-dark g7dt-mt-2",children:"환경설정 > 고급 설정 > 디버그 모드를 켜세요."})]}):null},Dk=["display","visibility","opacity","position","zIndex","overflow","width","height","backgroundColor","color"],_r=class _r{constructor(){H(this,"enabled",!1);H(this,"trackedComponents",new Map);H(this,"mutationObserver",null);H(this,"scanInterval",null);H(this,"devTools");this.devTools=Ca.getInstance()}static getInstance(){return _r.instance||(_r.instance=new _r),_r.instance}enable(){this.enabled||(this.enabled=!0,this.setupMutationObserver(),this.scanInterval=setInterval(()=>{this.scanVisibleComponents()},5e3),console.log("[StyleTracker] 스타일 추적 활성화됨"))}disable(){this.enabled&&(this.enabled=!1,this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.scanInterval&&(clearInterval(this.scanInterval),this.scanInterval=null),this.trackedComponents.clear(),console.log("[StyleTracker] 스타일 추적 비활성화됨"))}trackComponent(e,n,a){if(!this.enabled||!this.devTools.isEnabled()||!a)return;const i=this.extractClasses(a),o=this.getComputedStyles(a);this.devTools.trackComponentStyle(e,n,i,o),this.trackedComponents.set(e,{componentId:e,componentName:n,classes:i,computedStyles:o,element:new WeakRef(a),timestamp:Date.now()}),this.detectIssues(e,n,a,i,o)}untrackComponent(e){this.trackedComponents.delete(e)}scanVisibleComponents(){if(!this.enabled||!this.devTools.isEnabled())return;(this.devTools.getLifecycleInfo().mountedComponents||[]).forEach(i=>{const o=i.id,d=i.name;let g=null;if(o&&(g=document.getElementById(o)),!g&&o&&(g=document.querySelector(`[data-component-id="${o}"]`)),!g&&o&&(g=document.querySelector(`[data-editor-id="${o}"]`)),!g)return;const h=this.extractClasses(g),f=this.getComputedStyles(g);this.devTools.trackComponentStyle(o,d,h,f),this.detectIssues(o,d,g,h,f),this.trackedComponents.set(o,{componentId:o,componentName:d,classes:h,computedStyles:f,element:new WeakRef(g),timestamp:Date.now()})}),document.querySelectorAll('[data-editor-id], [id^="comp-"]').forEach(i=>{if(!(i instanceof HTMLElement))return;const o=i.getAttribute("data-editor-id")||i.id,d=i.getAttribute("data-editor-name")||i.tagName;if(!o||this.trackedComponents.has(o))return;const g=this.extractClasses(i),h=this.getComputedStyles(i);this.devTools.trackComponentStyle(o,d,g,h),this.detectIssues(o,d,i,g,h),this.trackedComponents.set(o,{componentId:o,componentName:d,classes:g,computedStyles:h,element:new WeakRef(i),timestamp:Date.now()})})}detectIssues(e,n,a,i,o){o.display==="none"&&this.addIssue({type:"invisible-element",componentId:e,componentName:n,property:"display",currentValue:"none",severity:"info",description:"요소가 display:none으로 숨겨져 있습니다",suggestion:"의도적인 숨김이 아니라면 조건부 렌더링(if)을 확인하세요"}),o.visibility==="hidden"&&this.addIssue({type:"invisible-element",componentId:e,componentName:n,property:"visibility",currentValue:"hidden",severity:"info",description:"요소가 visibility:hidden으로 숨겨져 있습니다",suggestion:"공간은 유지되지만 보이지 않습니다. 의도적인지 확인하세요"}),o.opacity==="0"&&this.addIssue({type:"invisible-element",componentId:e,componentName:n,property:"opacity",currentValue:"0",severity:"warning",description:"요소가 opacity:0으로 투명합니다",suggestion:"애니메이션 상태가 아니라면 스타일을 확인하세요"}),(o.width==="0px"||o.height==="0px")&&this.addIssue({type:"invisible-element",componentId:e,componentName:n,property:o.width==="0px"?"width":"height",currentValue:"0px",severity:"warning",description:"요소의 크기가 0입니다",suggestion:"컨텐츠가 있는데 크기가 0이라면 레이아웃 문제일 수 있습니다"}),o.overflow==="hidden"&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight)&&this.addIssue({type:"overflow-hidden",componentId:e,componentName:n,property:"overflow",currentValue:"hidden",severity:"warning",description:"컨텐츠가 overflow:hidden으로 잘리고 있습니다",suggestion:"overflow-auto 또는 컨테이너 크기를 확인하세요"});const d=i.some(w=>w.startsWith("dark:"));i.some(w=>(w.startsWith("bg-white")||w.startsWith("bg-gray-"))&&!w.startsWith("dark:"))&&!d&&this.addIssue({type:"dark-mode-missing",componentId:e,componentName:n,property:"className",currentValue:i.filter(w=>w.startsWith("bg-")).join(" "),severity:"info",description:"다크 모드 변형 클래스가 누락되었을 수 있습니다",suggestion:"bg-white 사용 시 dark:bg-gray-800 등을 함께 지정하세요"});const h=parseInt(o.zIndex,10);!isNaN(h)&&h>50&&o.position!=="static"&&this.addIssue({type:"z-index-conflict",componentId:e,componentName:n,property:"z-index",currentValue:o.zIndex,severity:"info",description:`높은 z-index(${h})가 설정되어 있습니다`,suggestion:"z-index 충돌을 피하려면 10, 20, 30, 40, 50 단위를 사용하세요"});const f=i.some(w=>w.startsWith("sm:")||w.startsWith("md:")||w.startsWith("lg:")||w.startsWith("xl:")),p=i.includes("hidden"),x=i.includes("portable:block")||i.includes("portable:flex"),y=i.includes("desktop:block")||i.includes("desktop:flex");p&&!f&&!x&&!y&&this.addIssue({type:"responsive-issue",componentId:e,componentName:n,property:"className",currentValue:"hidden",severity:"info",description:"반응형 표시 클래스 없이 hidden이 설정되어 있습니다",suggestion:"조건에 따라 표시하려면 sm:block, desktop:flex 등을 추가하세요"})}addIssue(e){this.devTools.addStyleIssue(e)}extractClasses(e){return(e.getAttribute("class")||"").split(/\s+/).filter(Boolean)}getComputedStyles(e){const n=window.getComputedStyle(e),a={};for(const i of Dk)a[i]=n.getPropertyValue(i.replace(/([A-Z])/g,"-$1").toLowerCase());return a}setupMutationObserver(){typeof MutationObserver>"u"||(this.mutationObserver=new MutationObserver(e=>{let n=!1;for(const a of e){if(a.type==="childList"&&a.addedNodes.length>0){n=!0;break}if(a.type==="attributes"&&(a.attributeName==="class"||a.attributeName==="style")){n=!0;break}}n&&setTimeout(()=>this.scanVisibleComponents(),100)}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}))}fullScan(){return this.scanVisibleComponents(),this.devTools.getStyleValidationInfo().issues}getIssues(){return this.devTools.getStyleValidationInfo().issues}getIssuesForComponent(e){return this.getIssues().filter(n=>n.componentId===e)}clear(){this.trackedComponents.clear(),this.devTools.clearStyleValidationData()}};H(_r,"instance",null);let qg=_r;function Rk(){return qg.getInstance()}function Ok(r={}){const{checked:e,value:n,name:a,type:i="checkbox"}=r,o={checked:e??!1,value:n??String(e??""),name:a??"",type:i};return{target:o,currentTarget:o,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("change"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"change",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{}}}function Lk(r={}){const{button:e=0,clientX:n=0,clientY:a=0}=r;return{button:e,clientX:n,clientY:a,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new MouseEvent("click"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"click",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div")}}function Mk(){return{preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("submit"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"submit",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("form"),currentTarget:document.createElement("form")}}function $k(r,e="keydown"){return{key:r,code:r.length===1?`Key${r.toUpperCase()}`:r,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new KeyboardEvent(e,{key:r}),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:e,isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div"),altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,repeat:!1}}const Ik={justify:/^justify-(start|end|center|between|around|evenly)$/,items:/^items-(start|end|center|baseline|stretch)$/,content:/^content-(start|end|center|between|around|evenly|stretch)$/,self:/^self-(auto|start|end|center|stretch|baseline)$/,flex:/^flex-(row|row-reverse|col|col-reverse|wrap|wrap-reverse|nowrap|1|auto|initial|none)$/,grow:/^(grow|grow-0)$/,shrink:/^(shrink|shrink-0)$/,basis:/^basis-/,order:/^(order-|-)order-/,gap:/^gap(-x|-y)?-/,gridCols:/^grid-cols-/,gridRows:/^grid-rows-/,colSpan:/^col-(span-|start-|end-)/,rowSpan:/^row-(span-|start-|end-)/,display:/^(block|inline-block|inline|flex|inline-flex|table|inline-table|table-caption|table-cell|table-column|table-column-group|table-footer-group|table-header-group|table-row-group|table-row|flow-root|grid|inline-grid|contents|list-item|hidden)$/,position:/^(static|fixed|absolute|relative|sticky)$/,inset:/^(inset|top|right|bottom|left)-/,zIndex:/^z-/,width:/^w-/,minWidth:/^min-w-/,maxWidth:/^max-w-/,height:/^h-/,minHeight:/^min-h-/,maxHeight:/^max-h-/,padding:/^p[xytblr]?-/,margin:/^-?m[xytblr]?-/,space:/^space-(x|y)-/,fontSize:/^text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/,fontWeight:/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/,fontStyle:/^(italic|not-italic)$/,fontFamily:/^font-(sans|serif|mono)/,textAlign:/^text-(left|center|right|justify|start|end)$/,textColor:/^text-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,textDecoration:/^(underline|overline|line-through|no-underline)$/,textTransform:/^(uppercase|lowercase|capitalize|normal-case)$/,lineHeight:/^leading-/,letterSpacing:/^tracking-/,textOverflow:/^(truncate|text-ellipsis|text-clip)$/,whitespace:/^whitespace-/,wordBreak:/^break-/,bgColor:/^bg-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,bgGradient:/^bg-gradient-/,bgSize:/^bg-(auto|cover|contain)$/,bgPosition:/^bg-(bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)$/,bgRepeat:/^bg-(repeat|no-repeat|repeat-x|repeat-y|repeat-round|repeat-space)$/,bgAttachment:/^bg-(fixed|local|scroll)$/,bgClip:/^bg-clip-/,bgOrigin:/^bg-origin-/,borderWidth:/^border(-[xytblr])?(-0|-2|-4|-8)?$/,borderColor:/^border-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,borderStyle:/^border-(solid|dashed|dotted|double|hidden|none)$/,borderRadius:/^rounded(-[tblrse]{1,2})?(-none|-sm|-md|-lg|-xl|-2xl|-3xl|-full)?$/,ringWidth:/^ring(-0|-1|-2|-4|-8|-inset)?$/,ringColor:/^ring-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,ringOffset:/^ring-offset-/,shadow:/^shadow(-sm|-md|-lg|-xl|-2xl|-inner|-none)?$/,opacity:/^opacity-/,mixBlend:/^mix-blend-/,bgBlend:/^bg-blend-/,blur:/^blur(-none|-sm|-md|-lg|-xl|-2xl|-3xl)?$/,brightness:/^brightness-/,contrast:/^contrast-/,grayscale:/^grayscale(-0)?$/,hueRotate:/^-?hue-rotate-/,invert:/^invert(-0)?$/,saturate:/^saturate-/,sepia:/^sepia(-0)?$/,backdropBlur:/^backdrop-blur-/,backdropBrightness:/^backdrop-brightness-/,backdropContrast:/^backdrop-contrast-/,backdropGrayscale:/^backdrop-grayscale-/,backdropHueRotate:/^backdrop-hue-rotate-/,backdropInvert:/^backdrop-invert-/,backdropOpacity:/^backdrop-opacity-/,backdropSaturate:/^backdrop-saturate-/,backdropSepia:/^backdrop-sepia-/,scale:/^scale(-x|-y)?-/,rotate:/^-?rotate-/,translate:/^-?translate-[xy]-/,skew:/^-?skew-[xy]-/,transformOrigin:/^origin-/,transition:/^transition(-none|-all|-colors|-opacity|-shadow|-transform)?$/,duration:/^duration-/,ease:/^ease-(linear|in|out|in-out)$/,delay:/^delay-/,animate:/^animate-/,cursor:/^cursor-/,userSelect:/^select-/,pointerEvents:/^pointer-events-/,resize:/^resize(-none|-x|-y)?$/,scrollBehavior:/^scroll-(auto|smooth)$/,touchAction:/^touch-/,overflow:/^overflow(-x|-y)?-(auto|hidden|clip|visible|scroll)$/,overscroll:/^overscroll(-x|-y)?-(auto|contain|none)$/,visibility:/^(visible|invisible|collapse)$/,aspectRatio:/^aspect-/,columns:/^columns-/,breakAfter:/^break-after-/,breakBefore:/^break-before-/,breakInside:/^break-inside-/,boxDecorationBreak:/^box-decoration-/,boxSizing:/^box-(border|content)$/,float:/^float-(right|left|none)$/,clear:/^clear-(left|right|both|none)$/,isolation:/^(isolate|isolation-auto)$/,objectFit:/^object-(contain|cover|fill|none|scale-down)$/,objectPosition:/^object-/};function ox(r){const e=r.replace(/^(dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+/,"");for(const[n,a]of Object.entries(Ik))if(a.test(e))return n;return null}function lx(r){const e=r.match(/^((dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+)/);return e?e[1]:""}function zk(r,e){if(!e||e.trim()==="")return r;if(!r||r.trim()==="")return e;const n=r.split(/\s+/).filter(Boolean),a=e.split(/\s+/).filter(Boolean),i=new Map;for(const d of a){const g=ox(d);if(g){const h=lx(d),f=`${g}:${h}`;i.set(f,d)}}return[...n.filter(d=>{const g=ox(d);if(!g)return!0;const h=lx(d),f=`${g}:${h}`;return!i.has(f)}),...a].join(" ")}function Hk(r){return Object.entries(r).filter(([,e])=>e).map(([e])=>e).join(" ")}function Pk(...r){return r.filter(e=>typeof e=="string"&&e.length>0).join(" ")}window.G7Core?.createLogger?.("Core:State");function Uk(r,e,n,a){const{syncOnControlledChange:i=!0,isEqual:o}=a??{},d=r!==void 0;j.useRef(d);const[g,h]=j.useState(r!==void 0?r:e),f=g,p=j.useRef(r),x=j.useRef(!1);j.useEffect(()=>{if(x.current){p.current=r;return}i&&d&&r!==p.current&&(o?!o(g,r):g!==r)&&h(r),p.current=r},[r,d,i,o,g]);const y=j.useCallback(w=>{const v=typeof w=="function"?w(f):w;(o?o(f,v):f===v)||(x.current=!0,h(v),n?.(v),requestAnimationFrame(()=>{x.current=!1}))},[f,d,n,o]);return[f,y]}function Bk(r,e){return r===e?!0:r.length!==e.length?!1:r.every((n,a)=>n===e[a])}function qk(r,e){if(r===e)return!0;const n=Object.keys(r),a=Object.keys(e);return n.length!==a.length?!1:n.every(i=>r[i]===e[i])}const Te=at("G7CoreGlobals");function Gk(){window.React=Fe,window.ReactDOM={...Hu,createPortal:Os.createPortal,unstable_batchedUpdates:r=>r()},window.ReactJSXRuntime=c7,Te.log("전역 객체 window.React, window.ReactDOM, window.ReactJSXRuntime에 노출됨")}function Fk(r){const e=new Map,n=Ca.getInstance();r.componentEvent={on:(a,i)=>(e.has(a)||e.set(a,new Set),e.get(a).add(i),n.trackEventSubscribe(a),()=>{e.get(a)?.delete(i),n.trackEventUnsubscribe(a)}),emit:async(a,i)=>{const o=e.get(a),d=o?.size??0;if(!o||o.size===0)return n.trackEventEmit(a,i,0),[];let g,h=[];try{h=await Promise.all(Array.from(o).map(async f=>{try{return await f(i)}catch(p){throw Te.error(`componentEvent: Error in listener for "${a}":`,p),p}}))}catch(f){g=f instanceof Error?f:new Error(String(f))}if(n.trackEventEmit(a,i,d,h,g),g)throw g;return h},off:a=>{e.delete(a),n.trackEventOff(a)},clear:()=>{e.clear(),n.trackEventClear()}},Te.log("전역 객체 window.G7Core.componentEvent에 노출됨")}function Vk(r,e){r.useTranslation=Nj,r.t=(n,a)=>{const i=e.getState();if(!i.translationEngine||!i.translationContext)return n;if(a){const o="|"+Object.entries(a).map(([d,g])=>`${d}=${g}`).join("|");return i.translationEngine.translate(n,i.translationContext,o)}return i.translationEngine.translate(n,i.translationContext)},Te.log("전역 객체 window.G7Core.useTranslation에 노출됨")}function Kk(r,e){r.createChangeEvent=Ok,r.createClickEvent=Lk,r.createSubmitEvent=Mk,r.createKeyboardEvent=$k,r.uuid=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const a=Math.random()*16|0;return(n==="x"?a:a&3|8).toString(16)}),r.createLogger=at,Te.log("전역 객체 window.G7Core.createLogger에 노출됨"),r.renderItemChildren=(n,a,i,o,d)=>{const g=e.getState(),p={_global:window.__templateApp?.getGlobalState?.()||{},_local:a._local||{},_computed:a._computed||{},...a},x=new Set,y=(v,C)=>{const k=p._global?._remountKeys;return v&&k?.[v]&&!x.has(v)?(x.add(v),`${v}-remount-${k[v]}`):v||C},w={translationContext:g.translationContext,translationEngine:g.translationEngine,bindingEngine:g.bindingEngine,actionDispatcher:g.actionDispatcher,getRemountKey:y,...d};return ho(n,p,i,o,w)},r.getComponentMap=()=>ya.getInstance().getComponentMap(),r.renderComponentLayout=(n,a,i)=>{if(!n||!Array.isArray(n)||n.length===0)return null;const o=ya.getInstance().getComponentMap(),d=e.getState(),h=window.__templateApp?.getGlobalState?.()||{},f={_global:h._global||{},_local:h._local||{},_computed:h._computed||{},...a},p=new Set,x=(y,w)=>{const v=f._global?._remountKeys;return y&&v?.[y]&&!p.has(y)?(p.add(y),`${y}-remount-${v[y]}`):y||w};return ho(n,f,o,i,{translationContext:d.translationContext,translationEngine:d.translationEngine,bindingEngine:d.bindingEngine,actionDispatcher:d.actionDispatcher,getRemountKey:x})},r.renderExpandContent=n=>{const{children:a,row:i,expandContext:o,componentContext:d,keyPrefix:g}=n;if(!a||!Array.isArray(a)||a.length===0)return null;const h=n.componentMap||ya.getInstance().getComponentMap(),f=e.getState(),p=r.state?.get?.()||{},x=d?.stateRef?.current??d?.state??{},y={...p._local||{},...x},w=d?.computedRef?.current??p._computed??{},v=f.bindingEngine??r.getDataBindingEngine?.(),C={...p,_local:y,_computed:w,row:i,item:i,$item:i};let k={};if(o&&typeof o=="object"&&v)try{for(const[D,M]of Object.entries(o))if(typeof M=="string"){const L=M.match(/^\{\{([^}]+)\}\}$/);if(L){const z=L[1].trim();try{k[D]=v.evaluateExpression(z,C,{skipCache:!0})}catch{k[D]=void 0}}else k[D]=v.resolveBindings(M,C,{skipCache:!0})}else k[D]=M}catch(D){Te.warn("renderExpandContent: expandContext 평가 오류:",D)}const A={row:i,item:i,$item:i,_local:y,_global:p._global||{},_computed:p._computed||{},...k},R=new Set,N=(D,M)=>{const L=A._global?._remountKeys;return D&&L?.[D]&&!R.has(D)?(R.add(D),`${D}-remount-${L[D]}`):D||M};return ho(a,A,h,g,{translationContext:f.translationContext,translationEngine:f.translationEngine??void 0,bindingEngine:f.bindingEngine??void 0,actionDispatcher:f.actionDispatcher,componentContext:d,getRemountKey:N})},r.$get=function(a,i,o=void 0){if(a==null)return o;const d=Array.isArray(i)?i:[i];if(d.length===0)return a;let g=a;for(const h of d){if(g==null||h==null)return o;g=g[h]}return g??o},Te.log("전역 객체 window.G7Core.renderItemChildren에 노출됨"),Te.log("전역 객체 window.G7Core.renderComponentLayout에 노출됨"),Te.log("전역 객체 window.G7Core.renderExpandContent에 노출됨"),Te.log("전역 객체 window.G7Core.$get에 노출됨")}function Wk(r){r.dispatch=async(e,n)=>{const a=window.__templateApp;if(!a)return Te.warn("G7Core.dispatch: TemplateApp이 초기화되지 않았습니다."),{success:!1,error:new Error("TemplateApp이 초기화되지 않았습니다.")};const i=a.getActionDispatcher?.();if(!i)return Te.warn("G7Core.dispatch: ActionDispatcher를 찾을 수 없습니다."),{success:!1,error:new Error("ActionDispatcher를 찾을 수 없습니다.")};const o=a.getRouter?.(),d=a.getGlobalState?.(),g=a.setGlobalState?.bind(a),f=n?.componentContext||window.__g7ActionContext,p=window.__g7PendingLocalState;let x=f?.state??d;p&&f&&(x=p,Te.log("[dispatch] Using __g7PendingLocalState for context.state:",p));let y=f?.data??d;p&&f?.data?._local&&(y={...f.data,_local:p},Te.log("[dispatch] Updated context.data._local with pendingLocalState"));const w={navigate:o?(v,C)=>o.navigate(v,C):void 0,setState:f?.setState??g,state:x,data:y,_isDispatchFallbackContext:!f?.setState};try{return await i.dispatchAction(e,w)}catch(v){return Te.error("G7Core.dispatch: 액션 실행 오류:",v),{success:!1,error:v instanceof Error?v:new Error(String(v))}}},Te.log("전역 객체 window.G7Core.dispatch에 노출됨")}function Hc(r){const e={};for(const[n,a]of Object.entries(r))if(n.includes(".")){const i=n.split(".");let o=e;for(let d=0;d<i.length-1;d++){const g=i[d];g in o?(typeof o[g]!="object"||o[g]===null)&&(o[g]={}):o[g]={},o=o[g]}o[i[i.length-1]]=a}else e[n]=a;return e}function Yk(r){const e=Object.keys(r);return e.length>0&&e.every(n=>/^\d+$/.test(n))}function Wn(r,e){if(Array.isArray(r)&&!Array.isArray(e)&&Yk(e)){const a=Object.keys(e).map(o=>parseInt(o,10));if(!((a.length>0?Math.max(...a):0)>=r.length+a.length+10)){const o=[...r];for(const[d,g]of Object.entries(e)){const h=parseInt(d,10);h>=0&&h<o.length?g!==null&&typeof g=="object"&&!Array.isArray(g)&&o[h]!==null&&typeof o[h]=="object"?o[h]=Wn(o[h],g):o[h]=g:h>=o.length&&(o[h]=g)}return o}}const n={...r};for(const[a,i]of Object.entries(e))i!==null&&typeof i=="object"&&!Array.isArray(i)?n[a]!==null&&typeof n[a]=="object"?n[a]=Wn(n[a],i):n[a]={...i}:n[a]=i;return n}function Jk(r){r.state={get:()=>window.__templateApp?.getGlobalState?.()||{},set:(e,n)=>{const a=window.__templateApp;if(a?.setGlobalState&&a?.getGlobalState){const i=n?.merge||"deep",o=Hc(e);let d;if(i==="replace")d=o;else if(i==="shallow")d={...a.getGlobalState(),...o};else{const g=a.getGlobalState();d=Wn(g,o)}a.setGlobalState(d)}else Te.warn("G7Core.state.set: TemplateApp이 초기화되지 않았습니다.")},setLocal:(e,n)=>{const a=window.__templateApp,i=n?.scope??"current",o=n?.merge||"deep",d=window.__g7ActionContext,g=Hc(e);if(i==="parent"||i==="root"){const k=window.__g7LayoutContextStack||[];if(k.length>0){const A=i==="parent"?k[k.length-1]:k[0];if(A?.setState){A.setState(R=>o==="replace"?g:o==="shallow"?{...R||{},...g}:Wn(R||{},g)),Te.log(`[setLocal] scope=${i}: 타겟 컨텍스트에 상태 업데이트 (mergeMode=${o})`,g);return}}Te.warn(`[setLocal] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const h=window.__g7PendingLocalState,f=a?.getGlobalState?.()?._local||{},y=!((window.__g7LayoutContextStack||[]).length>0)&&d?.state?d.state:void 0,w=y?Wn(f,y):f,v=h||w;let C;if(o==="replace"?C=g:o==="shallow"?C={...v,...g}:C=Wn(v,g),a?.setGlobalState&&(a.setGlobalState({_local:C}),Te.log(`[setLocal] globalLocal updated via setGlobalState (mergeMode=${o}):`,g)),window.__g7PendingLocalState=C,Te.log("[setLocal] __g7PendingLocalState updated:",C),window.__g7SequenceLocalSync=C,window.__g7LastSetLocalSnapshot=C,o==="replace")window.__g7ForcedLocalFields=g;else{const k=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Wn(k,g)}if(Te.log("[setLocal] __g7ForcedLocalFields updated:",g),o==="replace")window.__g7SetLocalOverrideKeys=g;else{const k=window.__g7SetLocalOverrideKeys||{};window.__g7SetLocalOverrideKeys=Wn(k,g)}Te.log("[setLocal] __g7SetLocalOverrideKeys updated:",g),d?.setState&&d.setState(k=>o==="replace"?g:o==="shallow"?{...k||{},...g}:Wn(k||{},g)),a?.setGlobalState||Te.warn("G7Core.state.setLocal: TemplateApp이 없습니다.")},getLocal:()=>{const a=(window.__templateApp?.getGlobalState?.()||{})._local||{},i=window.__g7PendingLocalState;if(i)return Wn(a,i);const o=window.__g7LastSetLocalSnapshot;return o&&o!==a?Wn(a,o):a},update:e=>{const n=window.__templateApp;if(n?.getGlobalState&&n?.setGlobalState){const a=n.getGlobalState(),i=e(a);n.setGlobalState(i)}else Te.warn("G7Core.state.update: TemplateApp이 초기화되지 않았습니다.")},subscribe:e=>{const n=window.__templateApp;return n?.onGlobalStateChange?n.onGlobalStateChange(e):(Te.warn("G7Core.state.subscribe: TemplateApp이 초기화되지 않았습니다."),()=>{})},getDataSource:e=>window.__templateApp?.getDataSource?.(e),getIsolated:e=>e?window.__g7IsolatedStates?.[e]?.state??null:window.__g7ActionContext?.isolatedContext?.state??null,setIsolated:(e,n,a)=>{let i,o,d;typeof e=="string"?(i=e,o=n||{},d=a):(o=e,d=n&&typeof n=="object"&&"merge"in n?n:a);const g=d?.merge||"deep",h=Hc(o);if(i){const x=window.__g7IsolatedStates?.[i];x?.mergeState?x.mergeState(h,g):Te.warn(`G7Core.state.setIsolated: scopeId '${i}'를 찾을 수 없습니다.`);return}const f=window.__g7ActionContext;f?.isolatedContext?.mergeState?f.isolatedContext.mergeState(h,g):Te.warn("G7Core.state.setIsolated: 액션 컨텍스트에 isolatedContext가 없습니다.")},getParent:()=>{const e=window.__g7LayoutContextStack||[];if(e.length===0)return Te.log("[getParent] 레이아웃 컨텍스트 스택이 비어있습니다."),null;const n=e[e.length-1];if(!n)return null;const a=n.dataContext||{};return{_local:n.state||a._local||{},_global:a._global||r.state.get()||{},setState:n.setState}},setParentLocal:(e,n,a)=>{const i=window.__g7LayoutContextStack||[];if(i.length===0){Te.warn("[setParentLocal] 레이아웃 컨텍스트 스택이 비어있습니다.");return}const o=i[i.length-1];if(!o?.setState){Te.warn("[setParentLocal] 부모 컨텍스트에 setState가 없습니다.");return}let d,g;typeof e=="string"?(d={[e]:n},g=a):(d=e,g=n&&typeof n=="object"&&"merge"in n?n:a);const h=g?.merge||"deep",f=Hc(d),p=o.state?._local!==void 0,x=p?o.state._local:o.state||{};let y;h==="replace"?y=f:h==="shallow"?y={...x,...f}:y=Wn(x,f),window.__g7PendingLocalState=y;const w=window.__templateApp;if(w?.setGlobalState&&w.setGlobalState({_local:y}),o.setState(y),p?o.state._local=y:o.state=y,o.dataContext&&(o.dataContext._local=y),h==="replace")window.__g7ForcedLocalFields=f;else{const v=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Wn(v,f)}dg()},setParentGlobal:(e,n)=>{let a;typeof e=="string"?a={[e]:n}:a=e,r.state.set(a),Te.log("[setParentGlobal] 전역 상태 업데이트:",a)}},window.__g7IsolatedStates||(window.__g7IsolatedStates={}),r.state.getGlobal=r.state.get,r.state.setGlobal=r.state.set,Te.log("전역 객체 window.G7Core.state에 노출됨")}function Xk(r){r.dataSource={get:e=>window.__templateApp?.getDataSource?.(e),set:(e,n,a)=>{const i=window.__templateApp;i?.setDataSource?i.setDataSource(e,n,a):Te.warn("G7Core.dataSource.set: TemplateApp이 초기화되지 않았습니다.")},refetch:async(e,n)=>{const a=window.__templateApp;if(a?.refetchDataSource)return a.refetchDataSource(e,n);Te.warn("G7Core.dataSource.refetch: TemplateApp이 초기화되지 않았습니다.")},updateItem:(e,n,a,i,o)=>{const d=window.__templateApp;return d?.updateDataSourceItem?d.updateDataSourceItem(e,n,a,i,o):(Te.warn("G7Core.dataSource.updateItem: TemplateApp이 초기화되지 않았습니다."),!1)},updateData:(e,n,a,i="append")=>{const o=window.__templateApp;if(!o?.getDataSource||!o?.setDataSource)return Te.warn("G7Core.dataSource.updateData: TemplateApp이 초기화되지 않았습니다."),!1;const d=o.getDataSource(e);if(!d)return Te.warn(`G7Core.dataSource.updateData: 데이터 소스 '${e}'를 찾을 수 없습니다.`),!1;let g,h=d,f=null;if(n){const x=n.split(".");f=x.pop();for(const y of x)if(h&&typeof h=="object"&&y in h)h=h[y];else return Te.warn(`G7Core.dataSource.updateData: 경로 '${n}'를 찾을 수 없습니다.`),!1;g=h[f]}else g=d;if(!Array.isArray(g))return Te.warn("G7Core.dataSource.updateData: 대상 경로의 데이터가 배열이 아닙니다."),!1;if(!Array.isArray(a))return Te.warn("G7Core.dataSource.updateData: newData가 배열이 아닙니다."),!1;const p=i==="prepend"?[...a,...g]:[...g,...a];return n&&f?(h[f]=p,o.setDataSource(e,d,{merge:!1})):o.setDataSource(e,p,{merge:!1}),Te.log(`G7Core.dataSource.updateData: '${e}'에 ${a.length}개 항목 ${i==="prepend"?"앞에":"뒤에"} 추가됨`),!0}},Te.log("전역 객체 window.G7Core.dataSource에 노출됨")}function Qk(r,e){r.locale={current:()=>window.__templateApp?.getLocale?.()||"ko",supported:()=>e.getState().templateMetadata?.locales||["ko","en"],change:async n=>{const a=window.__templateApp;a?.changeLocale?await a.changeLocale(n):Te.warn("G7Core.locale.change: TemplateApp이 초기화되지 않았습니다.")}},Te.log("전역 객체 window.G7Core.locale에 노출됨")}function Zk(r){r.toast={show:(e,n)=>{r.dispatch({handler:"toast",params:{message:e,type:n?.type||"info",...n?.duration&&{duration:n.duration}}})},success:(e,n)=>{r.toast.show(e,{type:"success",duration:n})},error:(e,n)=>{r.toast.show(e,{type:"error",duration:n})},warning:(e,n)=>{r.toast.show(e,{type:"warning",duration:n})},info:(e,n)=>{r.toast.show(e,{type:"info",duration:n})}},Te.log("전역 객체 window.G7Core.toast에 노출됨")}function eN(r){r.modal={open:e=>{r.dispatch({handler:"openModal",target:e})},close:e=>{r.dispatch({handler:"closeModal",...e&&{target:e}})},closeAll:()=>{r.dispatch({handler:"closeAllModals"})},isOpen:e=>{const n=r.state.get();return n._global?.activeModal===e||n._global?.modalStack?.includes(e)||!1},getStack:()=>r.state.get()._global?.modalStack||[]},Te.log("전역 객체 window.G7Core.modal에 노출됨")}function tN(r){r.style={mergeClasses:zk,conditionalClass:Hk,joinClasses:Pk},Te.log("전역 객체 window.G7Core.style에 노출됨")}function nN(r,e){const{webSocketManager:n}=e;r.websocket={manager:n,subscribe:(a,i,o,d)=>n.subscribe(a,i,o,d),unsubscribe:a=>n.unsubscribe(a),leaveChannel:a=>n.leaveChannel(a),disconnect:()=>n.disconnect(),isInitialized:()=>n.isInitialized(),getSubscriptionCount:()=>n.getSubscriptionCount()},Te.log("전역 객체 window.G7Core.websocket에 노출됨")}function aN(r,e){const{transitionManager:n}=e;r.navigation={isPending:()=>n?.getIsPending?.()||!1,onComplete:a=>{if(!n)return a(),()=>{};let i=n.getIsPending();const o=n.subscribe(d=>{d?i=!0:i&&(a(),o())});return o}},Te.log("전역 객체 window.G7Core.navigation에 노출됨")}function sN(r){r.plugin={getSettings:e=>window.G7Config?.plugins?.[e],get:(e,n,a)=>window.G7Config?.plugins?.[e]?.[n]??a,getAll:()=>window.G7Config?.plugins??{}},Te.log("전역 객체 window.G7Core.plugin에 노출됨")}function rN(r){r.module={getSettings:e=>window.G7Config?.modules?.[e],get:(e,n,a)=>window.G7Config?.modules?.[e]?.[n]??a,getAll:()=>window.G7Config?.modules??{}},Te.log("전역 객체 window.G7Core.module에 노출됨")}function iN(r,e){const{transitionManager:n,responsiveManager:a}=e;r.AuthManager=as,r.api=ns(),r.TransitionManager=n,r.useTransitionState=Wm,r.ResponsiveManager=a,r.useResponsive=Xm,r.useControllableState=Uk,r.shallowArrayEqual=Bk,r.shallowObjectEqual=qk,r.updateQueryParams=async i=>{const o=window.__templateApp;if(o?.updateQueryParams)return o.updateQueryParams(i);Te.warn("G7Core.updateQueryParams: TemplateApp이 초기화되지 않았습니다.")},Te.log("전역 객체 window.G7Core.AuthManager에 노출됨"),Te.log("전역 객체 window.G7Core.api에 노출됨"),Te.log("전역 객체 window.G7Core.ResponsiveManager에 노출됨"),Te.log("전역 객체 window.G7Core.useResponsive에 노출됨"),Te.log("전역 객체 window.G7Core.useControllableState에 노출됨"),Te.log("전역 객체 window.G7Core.updateQueryParams에 노출됨")}function oN(r,e){r.getSlotContext=()=>window.__slotContextValue??null,r.getDynamicRenderer=()=>window.__DynamicRenderer??null,r.getComponentRegistry=()=>e.getComponentRegistry?.()??ya.getInstance(),r.getDataBindingEngine=()=>e.getDataBindingEngine?.()??e.getState().bindingEngine,r.getTranslationEngine=()=>e.getTranslationEngine?.()??e.getState().translationEngine,r.getActionDispatcher=()=>e.getActionDispatcher?.()??e.getState().actionDispatcher,Te.log("전역 객체 window.G7Core 슬롯 API에 노출됨 (getSlotContext, getDynamicRenderer 등)")}function lN(r){let e=!1,n=null,a=null;r.wysiwyg={isEditMode:()=>e,setEditMode:(i,o)=>{e=!0,n=i,a=o,Te.log(`위지윅 편집 모드 활성화: ${i} (${o})`)},clearEditMode:()=>{e=!1,n=null,a=null,Te.log("위지윅 편집 모드 비활성화")},getCurrentLayoutName:()=>n,getCurrentTemplateId:()=>a,isEditModeFromUrl:()=>typeof window>"u"?!1:new URLSearchParams(window.location.search).get("mode")==="edit",getEditModeUrl:(i,o)=>{const d=window.location.origin,g=i.startsWith("/")?i:`/${i}`;return`${d}${g}?mode=edit&template=${encodeURIComponent(o)}`},enterEditMode:(i,o)=>{if(typeof window>"u")return;const d=r.wysiwyg.getEditModeUrl(i,o);window.location.href=d},exitEditMode:()=>{if(typeof window>"u")return;const i=new URLSearchParams(window.location.search);i.delete("mode"),i.delete("template");const o=`${window.location.pathname}${i.toString()?"?"+i.toString():""}`;window.location.href=o},getVersion:()=>"1.0.0",getPhase:()=>1},Te.log("전역 객체 window.G7Core 위지윅 편집기 API에 노출됨 (wysiwyg)")}function cN(r){if(typeof window>"u")return;Gk(),window.G7Core||(window.G7Core={});const e=window.G7Core;Fk(e),iN(e,r),Vk(e,r),Kk(e,r),Wk(e),Jk(e),Xk(e),Qk(e,r),Zk(e),eN(e),tN(e),nN(e,r),aN(e,r),sN(e),rN(e),oN(e,r),lN(e),Te.log("G7Core 전역 객체 초기화 완료")}function dN(){const r=window.G7Core;if(!r){Te.warn("G7Core가 초기화되지 않았습니다.");return}const e=()=>Ca.getInstance(),n={isEnabled:()=>{try{return e().isEnabled()}catch{return!1}},trackRender:a=>{try{e().isEnabled()&&e().trackRender(a)}catch{}},trackIteration:(a,i,o,d,g)=>{try{e().isEnabled()&&e().trackIteration(a,{source:i,itemVar:o,indexVar:d,sourceLength:g})}catch{}},trackIfCondition:(a,i,o,d)=>{try{e().isEnabled()&&e().trackIfCondition(a,i,o)}catch{}},trackMount:(a,i)=>{try{e().isEnabled()&&e().trackMount(a,{...i,id:a})}catch{}},trackUnmount:a=>{try{e().isEnabled()&&e().trackUnmount(a)}catch{}},trackExpressionEval:a=>{try{e().isEnabled()&&e().trackExpressionEval(a)}catch{}},trackBindingEval:a=>{try{e().isEnabled()&&e().trackBindingEval(a)}catch{}},recordCacheHit:()=>{try{e().isEnabled()&&e().recordCacheHit()}catch{}},recordCacheMiss:()=>{try{e().isEnabled()&&e().recordCacheMiss()}catch{}},trackHandlerRegistration:(a,i,o,d)=>{try{e().isEnabled()&&e().trackHandlerRegistration(a,i,o,d)}catch{}},trackHandlerUnregistration:a=>{try{e().isEnabled()&&e().trackHandlerUnregistration(a)}catch{}},logAction:a=>{try{e().isEnabled()&&e().logAction(a)}catch{}},trackRequest:(a,i)=>{try{return e().isEnabled()?e().trackRequest(a,i):""}catch{return""}},completeRequest:(a,i,o)=>{try{e().isEnabled()&&e().completeRequest(a,i,o)}catch{}},failRequest:(a,i)=>{try{e().isEnabled()&&e().failRequest(a,i)}catch{}},trackDataSourceDefinition:a=>{try{e().isEnabled()&&e().trackDataSourceDefinition(a)}catch{}},trackDataSourceLoading:a=>{try{e().isEnabled()&&e().trackDataSourceLoading(a)}catch{}},trackDataSourceLoaded:(a,i,o)=>{try{e().isEnabled()&&e().trackDataSourceLoaded(a,i,o)}catch{}},trackDataSourceError:(a,i)=>{try{e().isEnabled()&&e().trackDataSourceError(a,i)}catch{}},trackForm:(a,i,o)=>{try{e().isEnabled()&&e().trackForm(a,i,o)}catch{}},untrackForm:a=>{try{e().isEnabled()&&e().untrackForm(a)}catch{}},startStateChange:(a,i,o,d)=>{try{return e().isEnabled()?e().startStateChange(a,i,o,d):""}catch{return""}},completeStateChange:a=>{try{e().isEnabled()&&e().completeStateChange(a)}catch{}},trackComponentRender:(a,i,o,d,g,h)=>{try{e().isEnabled()&&e().trackComponentRender(a,i,o,d,g,h)}catch{}},updateLocalState:a=>{try{e().isEnabled()&&e().updateLocalState(a)}catch{}},updateComputedState:a=>{try{e().isEnabled()&&e().updateComputedState(a)}catch{}},updateParentContext:a=>{try{e().isEnabled()&&e().updateParentContext(a)}catch{}},trackComponentStateSource:(a,i,o,d)=>{try{e().isEnabled()&&e().trackComponentStateSource(a,i,o,d)}catch{}},trackDynamicState:(a,i)=>{try{e().isEnabled()&&e().trackDynamicState(a,i)}catch{}},trackContextFlow:(a,i,o,d,g,h)=>{try{e().isEnabled()&&e().trackContextFlow(a,i,o,d,g,h)}catch{}},trackComponentStyle:(a,i,o,d)=>{try{e().isEnabled()&&e().trackComponentStyle(a,i,o,d)}catch{}},trackAuthEvent:(a,i,o,d)=>{try{e().isEnabled()&&e().trackAuthEvent(a,i,o,d)}catch{}},trackAuthHeader:(a,i,o,d,g)=>{try{e().isEnabled()&&e().trackAuthHeader(a,i,o,d,g)}catch{}},trackLog:(a,i,o)=>{try{e().isEnabled()&&e().trackLog(a,i,o)}catch{}},trackAction:a=>{try{e().isEnabled()&&e().trackAction?.(a)}catch{}},trackDataSourceUpdate:a=>{try{e().isEnabled()&&e().trackDataSourceUpdate?.(a)}catch{}},startSequenceExecution:a=>{try{return e().isEnabled()?e().startSequenceExecution(a):""}catch{return""}},captureSequenceActionBefore:(a,i,o,d,g)=>{try{e().isEnabled()&&e().captureSequenceActionBefore(a,i,o,d,g)}catch{}},captureSequenceActionAfter:(a,i,o,d,g,h)=>{try{e().isEnabled()&&e().captureSequenceActionAfter(a,i,o,d,g,h)}catch{}},endSequenceExecution:(a,i)=>{try{e().isEnabled()&&e().endSequenceExecution(a,i)}catch{}},registerStateCaptureForHandler:(a,i,o)=>{try{e().isEnabled()&&e().registerStateCaptureForHandler(a,i,o)}catch{}},detectStaleClosure:(a,i,o,d,g)=>{try{return e().isEnabled()?e().detectStaleClosure(a,i,o,d,g):[]}catch{return[]}},trackStaleClosureWarning:a=>{try{e().isEnabled()&&e().trackStaleClosureWarning(a)}catch{}},trackModalOpen:a=>{try{e().isEnabled()&&e().trackModalOpen(a)}catch{}},trackModalClose:(a,i)=>{try{e().isEnabled()&&e().trackModalClose(a,i)}catch{}},trackModalStateChange:a=>{try{e().isEnabled()&&e().trackModalStateChange(a)}catch{}},trackNestedContext:a=>{try{return e().isEnabled()?e().trackNestedContext(a):""}catch{return""}},trackNestedContextAccess:(a,i)=>{try{e().isEnabled()&&e().trackNestedContextAccess(a,i)}catch{}},trackComputedProperty:(a,i,o,d,g,h,f)=>{try{e().isEnabled()&&e().trackComputedProperty(a,i,o,d,g,h,f)}catch{}},trackComputedRecalc:(a,i,o,d,g,h,f)=>{try{e().isEnabled()&&e().trackComputedRecalc(a,i,o,d,g,h,f)}catch{}},setNamedActionDefinitions:a=>{try{e().isEnabled()&&e().setNamedActionDefinitions(a)}catch{}},trackNamedActionRef:a=>{try{e().isEnabled()&&e().trackNamedActionRef(a)}catch{}}};r.devTools=n,Te.log("G7Core.devTools 인터페이스 초기화 완료")}function uN(){const r=window.G7Core;if(!r){Te.warn("G7Core가 초기화되지 않았습니다.");return}const e=Ca.getInstance();if(e.initialize(),!e.isEnabled()){window.G7DevTools={isEnabled:()=>!1,enable:()=>{Te.log("환경설정 > 고급 설정 > 디버그 모드를 켜세요")}},Hp(),Te.log("G7DevTools 비활성화됨 (디버그 모드 꺼짐)");return}dN(),Hp();try{Rk().enable(),Te.log("StyleTracker 활성화됨")}catch(o){Te.warn("StyleTracker 활성화 실패:",o)}const n=new Zy,a=ex(),i={isEnabled:()=>e.isEnabled(),state:{get:()=>e.getState(),getHistory:()=>e.getStateHistory(),watch:(o,d)=>e.watchState(o,d)},actions:{getHistory:()=>e.getActionHistory(),watch:o=>e.watchActions(o),getMetrics:()=>e.getActionMetrics()},binding:{evaluate:o=>{const d=r.getDataBindingEngine?.();if(!d){Te.warn("DataBindingEngine이 없습니다.");return}return d.evaluateExpression(o,e.getState())},getCacheStats:()=>e.getCacheStats(),clearStats:()=>{e.resetCacheStats(),Te.log("캐시 통계 초기화됨")}},diagnose:{analyze:o=>n.analyze(o),suggestFix:o=>n.suggestFix(o),getCommonIssues:()=>n.getCommonIssues(),getRulesByCategory:o=>n.getRulesByCategory(o)},server:{dumpState:o=>a.dumpState(o),sendLog:o=>a.sendLog(o),sendError:(o,d)=>a.sendError(o,d),isConnected:()=>a.isConnected(),testConnection:()=>a.testConnection()},config:{isDebugMode:()=>e.isEnabled(),setLogLevel:o=>e.setLogLevel(o),setMaxHistory:o=>e.setMaxHistory(o)},lifecycle:{getMountedComponents:()=>e.getLifecycleInfo().mountedComponents,getOrphanedListeners:()=>e.getLifecycleInfo().orphanedListeners},performance:{getRenderCount:()=>e.getPerformanceInfo().renderCounts,getBindingEvalCount:()=>e.getPerformanceInfo().bindingEvalCount,getMemoryWarnings:()=>e.getPerformanceInfo().memoryWarnings,startProfiling:()=>e.startProfiling(),stopProfiling:()=>e.stopProfiling()},network:{getActiveRequests:()=>e.getNetworkInfo().activeRequests,getRequestHistory:()=>e.getNetworkInfo().requestHistory,getPendingDataSources:()=>e.getNetworkInfo().pendingDataSources},conditional:{getIfConditions:()=>e.getConditionalInfo().ifConditions,getIterations:()=>e.getConditionalInfo().iterations},form:{getForms:()=>e.getFormInfo()},websocket:{getInfo:()=>e.getWebSocketInfo()}};window.G7DevTools=i,r.devtools=i,Te.log("G7DevTools 전역 객체 초기화 완료 (window.G7DevTools)"),gN()}function gN(){if(document.getElementById("g7-devtools-root")){Te.log("DevToolsPanel 이미 렌더링됨");return}const r=document.createElement("div");r.id="g7-devtools-root",document.body.appendChild(r);try{Hu.createRoot(r).render(Fe.createElement(Ak)),Te.log("DevToolsPanel UI 렌더링 완료")}catch(e){Te.error("DevToolsPanel UI 렌더링 실패:",e)}}const Ze=at("TemplateEngine"),de={templateId:null,locale:"ko",isInitialized:!1,reactRoot:null,containerId:null,currentLayoutJson:null,currentDataContext:{},translationContext:{templateId:"",locale:"ko"},registry:null,bindingEngine:null,translationEngine:null,actionDispatcher:null,templateMetadata:null};let Pc=!1;const Oo=[];async function hN(r){try{Ze.log("템플릿 메타데이터 로드 중...",r);const e=r.split("-").map(a=>a.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")).join(""),n=window[e];return n?.templateMetadata?(Ze.log("템플릿 메타데이터 로드 완료 (전역 변수)",n.templateMetadata),n.templateMetadata):(Ze.warn(`템플릿 번들에 메타데이터가 없습니다. 전역 변수: ${e}`),{identifier:r,locales:["ko","en"],name:{ko:r,en:r},description:{ko:"",en:""},version:"1.0.0",type:"admin"})}catch(e){return Ze.error("템플릿 메타데이터 로드 실패",e),{identifier:r,locales:["ko","en"],name:{ko:r,en:r},description:{ko:"",en:""},version:"1.0.0",type:"admin"}}}function cx(){return{$locale:de.locale,$locales:de.templateMetadata?.locales||["ko","en"],$templateId:de.templateId}}async function Lo(r){try{if(Ze.log("템플릿 엔진 초기화 시작",r),de.isInitialized)throw new Error("템플릿 엔진이 이미 초기화되었습니다. destroyTemplate()을 먼저 호출하세요.");if(!r.templateId)throw new qj;Pc=r.debug??!1,typeof window<"u"&&(window.G7Config||(window.G7Config={}),window.G7Config.debug=Pc),uN(),de.templateId=r.templateId,de.locale=r.locale||"ko",Ze.log("엔진 인스턴스 생성 중..."),de.registry=ya.getInstance(),de.bindingEngine=new _n,de.translationEngine=yr.getInstance(),r.cacheVersion!==void 0&&r.cacheVersion>0&&de.translationEngine.setCacheVersion(r.cacheVersion),de.translationContext={templateId:r.templateId,locale:de.locale},de.actionDispatcher=new So({},de.translationEngine,de.translationContext),g7(de.actionDispatcher),Ze.log("다국어 파일 로드 중...",r.templateId,de.locale);const e="en",n=[de.translationEngine.loadTranslations(r.templateId,de.locale).then(()=>{Ze.log(`다국어 파일 로드 완료: ${de.locale}`)}).catch(a=>{Ze.warn(`다국어 파일 로드 실패 (${de.locale}):`,a instanceof Error?a.message:a)})];de.locale!==e&&n.push(de.translationEngine.loadTranslations(r.templateId,e).then(()=>{Ze.log(`폴백 다국어 파일 로드 완료: ${e}`)}).catch(a=>{Ze.warn(`폴백 다국어 파일 로드 실패 (${e}):`,a instanceof Error?a.message:a)})),await Promise.allSettled(n),Ze.log("템플릿 메타데이터 로드 중...",r.templateId),de.templateMetadata=await hN(r.templateId),de.isInitialized=!0,Ze.log("템플릿 엔진 초기화 완료 (ComponentRegistry는 별도 로드)")}catch(e){throw Ze.error("템플릿 엔진 초기화 실패",e),de.isInitialized=!1,de.registry=null,de.bindingEngine=null,de.translationEngine=null,de.actionDispatcher=null,e}}async function Mo(r){try{if(Ze.log("템플릿 렌더링 시작",r),!de.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다. initTemplateEngine()을 먼저 호출하세요.");if(!r.containerId)throw new Error("containerId는 필수입니다.");if(!r.layoutJson)throw new Error("layoutJson은 필수입니다.");const e=document.getElementById(r.containerId);if(!e)throw new Error(`컨테이너를 찾을 수 없습니다: #${r.containerId}`);const n=cx();de.containerId=r.containerId,de.currentLayoutJson=r.layoutJson,de.currentDataContext={...n,...r.dataContext||{}},de.translationContext=r.translationContext||{templateId:de.templateId||"",locale:de.locale},de.reactRoot||(Ze.log("React Root 생성"),de.reactRoot=Hu.createRoot(e));const a=ux();if(Ze.log("편집 모드:",a),a){await pN(r);return}const i=r.layoutJson.components||[];if(i.length===0){Ze.warn("렌더링할 컴포넌트가 없습니다.");return}const o=r.layoutJson.modals||[];if(Ze.log("modals 배열:",o),Ze.log("modals 개수:",o.length),Ze.log("DynamicRenderer로 렌더링 시작"),de.reactRoot.render(Fe.createElement(Dc,{translationEngine:de.translationEngine,translationContext:de.translationContext},Fe.createElement(ug,null,Fe.createElement(gg,null,Fe.createElement(Og,null,[...i.map((d,g)=>{const h=de.currentLayoutJson?.layout_name||"";return Fe.createElement(Ba,{key:h&&!d._fromBase?`${d.id}_${h}`:d.id,componentDef:d,dataContext:de.currentDataContext,translationContext:de.translationContext,registry:de.registry,bindingEngine:de.bindingEngine,translationEngine:de.translationEngine,actionDispatcher:de.actionDispatcher,isRootRenderer:g===0,layoutKey:h})}),Fe.createElement(qm,{key:"__modal_parent_context_provider"},o.map(d=>{const g=de.currentDataContext._global?.modalStack||[],f=g.includes(d.id)||de.currentDataContext._global?.activeModal===d.id,p=g.indexOf(d.id),x=p>=0?50+p:50,y=window.__g7LayoutContextStack||[],v=y[y.length-1]?.dataContext,C=Fe.createElement(Ba,{key:`modal_${d.id}_renderer`,componentDef:{...d,props:{...d.props,isOpen:f,style:{...d.props?.style,zIndex:x},onClose:de.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},de.currentDataContext)}},dataContext:de.currentDataContext,translationContext:de.translationContext,registry:de.registry,bindingEngine:de.bindingEngine,translationEngine:de.translationEngine,actionDispatcher:de.actionDispatcher,parentDataContext:v});return d.data_sources&&d.data_sources.length>0?Fe.createElement(Jy,{key:`modal_${d.id}`,isOpen:f,modalId:d.id,dataSources:d.data_sources,dataContext:de.currentDataContext,globalStateUpdater:de.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:de.bindingEngine,debug:Pc,children:C}):C}))]))))),Ze.log("템플릿 렌더링 완료"),Oo.length>0){Ze.log(`대기 중인 데이터 업데이트 ${Oo.length}건 적용`);const d=[...Oo];Oo.length=0;for(const{data:g,options:h}of d)hi(g,h)}}catch(e){throw Ze.error("템플릿 렌더링 실패",e),e}}function hi(r,e){try{if(Ze.log("템플릿 데이터 업데이트 시작",Object.keys(r)),ux()){Ze.log("편집 모드에서는 updateTemplateData를 건너뜁니다.");return}if(!de.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다.");if(!de.reactRoot||!de.currentLayoutJson){Ze.log("React 미준비 - 데이터 업데이트 큐잉:",Object.keys(r)),Oo.push({data:r,options:e});return}const n=cx(),a={...de.currentDataContext._global||{},...r._global||{}};de.currentDataContext={...n,...de.currentDataContext,...r,_global:a},a._local!==void 0&&(de.currentDataContext._local=a._local),a._computed!==void 0&&(de.currentDataContext._computed=a._computed);const i=de.currentLayoutJson.components||[],o=de.currentLayoutJson.modals||[];Ze.log("updateTemplateData - modals 배열:",o),Ze.log("updateTemplateData - modals 개수:",o.length),Ze.log("updateTemplateData - activeModal:",de.currentDataContext._global?.activeModal);const d=()=>{de.reactRoot.render(Fe.createElement(Dc,{translationEngine:de.translationEngine,translationContext:de.translationContext},Fe.createElement(ug,null,Fe.createElement(gg,null,Fe.createElement(Og,null,[...i.map((g,h)=>{const f=de.currentLayoutJson?.layout_name||"";return Fe.createElement(Ba,{key:f&&!g._fromBase?`${g.id}_${f}`:g.id,componentDef:g,dataContext:de.currentDataContext,translationContext:de.translationContext,registry:de.registry,bindingEngine:de.bindingEngine,translationEngine:de.translationEngine,actionDispatcher:de.actionDispatcher,isRootRenderer:h===0,layoutKey:f})}),Fe.createElement(qm,{key:"__modal_parent_context_provider_update"},o.map(g=>{const h=de.currentDataContext._global?.modalStack||[],p=h.includes(g.id)||de.currentDataContext._global?.activeModal===g.id,x=h.indexOf(g.id),y=x>=0?50+x:50,w=window.__g7LayoutContextStack||[],C=w[w.length-1]?.dataContext,k=Fe.createElement(Ba,{key:`modal_${g.id}_renderer`,componentDef:{...g,props:{...g.props,isOpen:p,style:{...g.props?.style,zIndex:y},onClose:de.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},de.currentDataContext)}},dataContext:de.currentDataContext,translationContext:de.translationContext,registry:de.registry,bindingEngine:de.bindingEngine,translationEngine:de.translationEngine,actionDispatcher:de.actionDispatcher,parentDataContext:C});return g.data_sources&&g.data_sources.length>0?Fe.createElement(Jy,{key:`modal_${g.id}`,isOpen:p,modalId:g.id,dataSources:g.data_sources,dataContext:de.currentDataContext,globalStateUpdater:de.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:de.bindingEngine,debug:Pc,children:k}):k}))])))))};e?.sync?(Ze.log("재렌더링 시작 (sync mode - 즉시 렌더링)"),d()):(Ze.log("재렌더링 시작 (with startTransition)"),j.startTransition(()=>{d()})),Ze.log("템플릿 데이터 업데이트 완료")}catch(n){throw Ze.error("템플릿 데이터 업데이트 실패",n),n}}function Uc(){try{Ze.log("템플릿 정리 시작"),de.reactRoot&&(Ze.log("React Root 언마운트"),de.reactRoot.unmount(),de.reactRoot=null),de.templateId=null,de.locale="ko",de.isInitialized=!1,de.containerId=null,de.currentLayoutJson=null,de.currentDataContext={},de.translationContext={templateId:"",locale:"ko"},de.registry=null,de.bindingEngine=null,de.translationEngine=null,de.actionDispatcher=null,de.templateMetadata=null,Ze.log("템플릿 정리 완료")}catch(r){throw Ze.error("템플릿 정리 실패",r),r}}function wr(){return Object.freeze({...de})}function dx(){return de.actionDispatcher}function ux(){if(typeof window>"u")return!1;const r=new URLSearchParams(window.location.search),e=r.get("mode"),n=r.get("template");return e==="edit"&&!!n}function fN(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("template")}async function pN(r){Ze.log("위지윅 편집기 렌더링 시작");try{const{WysiwygEditor:e}=await Promise.resolve().then(()=>e1),n=fN()||de.templateId||"unknown",a=()=>{const o=new URLSearchParams(window.location.search);o.delete("mode"),o.delete("template");const d=`${window.location.pathname}${o.toString()?"?"+o.toString():""}`;window.location.href=d},i=o=>{Ze.log("레이아웃 저장 완료:",o)};Ze.log("WysiwygEditor 렌더링",{templateId:n,layoutName:r.layoutJson?.layout_name}),de.reactRoot.render(Fe.createElement(Dc,{translationEngine:de.translationEngine,translationContext:de.translationContext},Fe.createElement(e,{layoutData:r.layoutJson,templateId:n,onClose:a,onSaveComplete:i,initialEditMode:"visual",readOnly:!1}))),Ze.log("위지윅 편집기 렌더링 완료")}catch(e){throw Ze.error("위지윅 편집기 로드 실패:",e),de.reactRoot.render(Fe.createElement("div",{className:"flex items-center justify-center h-screen bg-gray-100 dark:bg-gray-900"},Fe.createElement("div",{className:"text-center p-8 bg-white dark:bg-gray-800 rounded-lg shadow-lg"},Fe.createElement("h1",{className:"text-xl font-bold text-red-600 dark:text-red-400 mb-4"},"위지윅 편집기 로드 실패"),Fe.createElement("p",{className:"text-gray-600 dark:text-gray-400 mb-4"},"편집기를 불러오는 중 오류가 발생했습니다."),Fe.createElement("button",{className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",onClick:()=>window.location.reload()},"새로고침")))),e}}const $o={initTemplateEngine:Lo,renderTemplate:Mo,updateTemplateData:hi,destroyTemplate:Uc,getState:wr};typeof window<"u"&&(window.G7Core||(window.G7Core={}),window.G7Core.TemplateEngine=$o,cN({getState:()=>({translationEngine:de.translationEngine,translationContext:de.translationContext,bindingEngine:de.bindingEngine,actionDispatcher:de.actionDispatcher,templateMetadata:de.templateMetadata}),transitionManager:Pa,responsiveManager:ei,webSocketManager:Lc}),Ze.log("전역 객체 window.G7Core.TemplateEngine에 노출됨"));const qa=Object.freeze(Object.defineProperty({__proto__:null,DataSourceManager:is,LayoutLoader:Rg,TemplateApp:Ro,TemplateEngine:$o,default:$o,destroyTemplate:Uc,getActionDispatcher:dx,getState:wr,initTemplateApp:Pg,initTemplateEngine:Lo,renderTemplate:Mo,updateTemplateData:hi},Symbol.toStringTag,{value:"Module"})),gx=r=>{let e;const n=new Set,a=(f,p)=>{const x=typeof f=="function"?f(e):f;if(!Object.is(x,e)){const y=e;e=p??(typeof x!="object"||x===null)?x:Object.assign({},e,x),n.forEach(w=>w(e,y))}},i=()=>e,g={setState:a,getState:i,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f))},h=e=r(a,i,g);return g},mN=(r=>r?gx(r):gx),yN=r=>r;function xN(r,e=yN){const n=Fe.useSyncExternalStore(r.subscribe,Fe.useCallback(()=>e(r.getState()),[r,e]),Fe.useCallback(()=>e(r.getInitialState()),[r,e]));return Fe.useDebugValue(n),n}const hx=r=>{const e=mN(r),n=a=>xN(e,a);return Object.assign(n,e),n},bN=(r=>r?hx(r):hx);var fx=Symbol.for("immer-nothing"),px=Symbol.for("immer-draftable"),An=Symbol.for("immer-state");function ja(r,...e){throw new Error(`[Immer] minified error nr: ${r}. Full error at: https://bit.ly/3cXEKWf`)}var Yn=Object,fi=Yn.getPrototypeOf,Bc="constructor",qc="prototype",Gg="configurable",Gc="enumerable",Fc="writable",Io="value",Is=r=>!!r&&!!r[An];function os(r){return r?yx(r)||Wc(r)||!!r[px]||!!r[Bc]?.[px]||Yc(r)||Jc(r):!1}var vN=Yn[qc][Bc].toString(),mx=new WeakMap;function yx(r){if(!r||!Vg(r))return!1;const e=fi(r);if(e===null||e===Yn[qc])return!0;const n=Yn.hasOwnProperty.call(e,Bc)&&e[Bc];if(n===Object)return!0;if(!pi(n))return!1;let a=mx.get(n);return a===void 0&&(a=Function.toString.call(n),mx.set(n,a)),a===vN}function Vc(r,e,n=!0){zo(r)===0?(n?Reflect.ownKeys(r):Yn.keys(r)).forEach(i=>{e(i,r[i],r)}):r.forEach((a,i)=>e(i,a,r))}function zo(r){const e=r[An];return e?e.type_:Wc(r)?1:Yc(r)?2:Jc(r)?3:0}var xx=(r,e,n=zo(r))=>n===2?r.has(e):Yn[qc].hasOwnProperty.call(r,e),Fg=(r,e,n=zo(r))=>n===2?r.get(e):r[e],Kc=(r,e,n,a=zo(r))=>{a===2?r.set(e,n):a===3?r.add(n):r[e]=n};function SN(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e}var Wc=Array.isArray,Yc=r=>r instanceof Map,Jc=r=>r instanceof Set,Vg=r=>typeof r=="object",pi=r=>typeof r=="function",Kg=r=>typeof r=="boolean";function wN(r){const e=+r;return Number.isInteger(e)&&String(e)===r}var ls=r=>r.copy_||r.base_,Wg=r=>r.modified_?r.copy_:r.base_;function Yg(r,e){if(Yc(r))return new Map(r);if(Jc(r))return new Set(r);if(Wc(r))return Array[qc].slice.call(r);const n=yx(r);if(e===!0||e==="class_only"&&!n){const a=Yn.getOwnPropertyDescriptors(r);delete a[An];let i=Reflect.ownKeys(a);for(let o=0;o<i.length;o++){const d=i[o],g=a[d];g[Fc]===!1&&(g[Fc]=!0,g[Gg]=!0),(g.get||g.set)&&(a[d]={[Gg]:!0,[Fc]:!0,[Gc]:g[Gc],[Io]:r[d]})}return Yn.create(fi(r),a)}else{const a=fi(r);if(a!==null&&n)return{...r};const i=Yn.create(a);return Yn.assign(i,r)}}function Jg(r,e=!1){return Qc(r)||Is(r)||!os(r)||(zo(r)>1&&Yn.defineProperties(r,{set:Xc,add:Xc,clear:Xc,delete:Xc}),Yn.freeze(r),e&&Vc(r,(n,a)=>{Jg(a,!0)},!1)),r}function CN(){ja(2)}var Xc={[Io]:CN};function Qc(r){return r===null||!Vg(r)?!0:Yn.isFrozen(r)}var Zc="MapSet",Xg="Patches",bx="ArrayMethods",vx={};function Cr(r){const e=vx[r];return e||ja(0,r),e}var Sx=r=>!!vx[r],Ho,wx=()=>Ho,jN=(r,e)=>({drafts_:[],parent_:r,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Sx(Zc)?Cr(Zc):void 0,arrayMethodsPlugin_:Sx(bx)?Cr(bx):void 0});function Cx(r,e){e&&(r.patchPlugin_=Cr(Xg),r.patches_=[],r.inversePatches_=[],r.patchListener_=e)}function Qg(r){Zg(r),r.drafts_.forEach(kN),r.drafts_=null}function Zg(r){r===Ho&&(Ho=r.parent_)}var jx=r=>Ho=jN(Ho,r);function kN(r){const e=r[An];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function kx(r,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(r!==void 0&&r!==n){n[An].modified_&&(Qg(e),ja(4)),os(r)&&(r=Nx(e,r));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[An].base_,r,e)}else r=Nx(e,n);return NN(e,r,!0),Qg(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),r!==fx?r:void 0}function Nx(r,e){if(Qc(e))return e;const n=e[An];if(!n)return td(e,r.handledSet_,r);if(!ed(n,r))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:a}=n;if(a)for(;a.length>0;)a.pop()(r);Tx(n,r)}return n.copy_}function NN(r,e,n=!1){!r.parent_&&r.immer_.autoFreeze_&&r.canAutoFreeze_&&Jg(e,n)}function Ex(r){r.finalized_=!0,r.scope_.unfinalizedDrafts_--}var ed=(r,e)=>r.scope_===e,EN=[];function _x(r,e,n,a){const i=ls(r),o=r.type_;if(a!==void 0&&Fg(i,a,o)===e){Kc(i,a,n,o);return}if(!r.draftLocations_){const g=r.draftLocations_=new Map;Vc(i,(h,f)=>{if(Is(f)){const p=g.get(f)||[];p.push(h),g.set(f,p)}})}const d=r.draftLocations_.get(e)??EN;for(const g of d)Kc(i,g,n,o)}function _N(r,e,n){r.callbacks_.push(function(i){const o=e;if(!o||!ed(o,i))return;i.mapSetPlugin_?.fixSetContents(o);const d=Wg(o);_x(r,o.draft_??o,d,n),Tx(o,i)})}function Tx(r,e){if(r.modified_&&!r.finalized_&&(r.type_===3||r.type_===1&&r.allIndicesReassigned_||(r.assigned_?.size??0)>0)){const{patchPlugin_:a}=e;if(a){const i=a.getPath(r);i&&a.generatePatches_(r,i,e)}Ex(r)}}function TN(r,e,n){const{scope_:a}=r;if(Is(n)){const i=n[An];ed(i,a)&&i.callbacks_.push(function(){ad(r);const d=Wg(i);_x(r,n,d,e)})}else os(n)&&r.callbacks_.push(function(){const o=ls(r);r.type_===3?o.has(n)&&td(n,a.handledSet_,a):Fg(o,e,r.type_)===n&&a.drafts_.length>1&&(r.assigned_.get(e)??!1)===!0&&r.copy_&&td(Fg(r.copy_,e,r.type_),a.handledSet_,a)})}function td(r,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Is(r)||e.has(r)||!os(r)||Qc(r)||(e.add(r),Vc(r,(a,i)=>{if(Is(i)){const o=i[An];if(ed(o,n)){const d=Wg(o);Kc(r,a,d,r.type_),Ex(o)}}else os(i)&&td(i,e,n)})),r}function AN(r,e){const n=Wc(r),a={type_:n?1:0,scope_:e?e.scope_:wx(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:r,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=a,o=nd;n&&(i=[a],o=Po);const{revoke:d,proxy:g}=Proxy.revocable(i,o);return a.draft_=g,a.revoke_=d,[g,a]}var nd={get(r,e){if(e===An)return r;let n=r.scope_.arrayMethodsPlugin_;const a=r.type_===1&&typeof e=="string";if(a&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(r,e);const i=ls(r);if(!xx(i,e,r.type_))return DN(r,i,e);const o=i[e];if(r.finalized_||!os(o)||a&&r.operationMethod&&n?.isMutatingArrayMethod(r.operationMethod)&&wN(e))return o;if(o===eh(r.base_,e)){ad(r);const d=r.type_===1?+e:e,g=nh(r.scope_,o,r,d);return r.copy_[d]=g}return o},has(r,e){return e in ls(r)},ownKeys(r){return Reflect.ownKeys(ls(r))},set(r,e,n){const a=Ax(ls(r),e);if(a?.set)return a.set.call(r.draft_,n),!0;if(!r.modified_){const i=eh(ls(r),e),o=i?.[An];if(o&&o.base_===n)return r.copy_[e]=n,r.assigned_.set(e,!1),!0;if(SN(n,i)&&(n!==void 0||xx(r.base_,e,r.type_)))return!0;ad(r),th(r)}return r.copy_[e]===n&&(n!==void 0||e in r.copy_)||Number.isNaN(n)&&Number.isNaN(r.copy_[e])||(r.copy_[e]=n,r.assigned_.set(e,!0),TN(r,e,n)),!0},deleteProperty(r,e){return ad(r),eh(r.base_,e)!==void 0||e in r.base_?(r.assigned_.set(e,!1),th(r)):r.assigned_.delete(e),r.copy_&&delete r.copy_[e],!0},getOwnPropertyDescriptor(r,e){const n=ls(r),a=Reflect.getOwnPropertyDescriptor(n,e);return a&&{[Fc]:!0,[Gg]:r.type_!==1||e!=="length",[Gc]:a[Gc],[Io]:n[e]}},defineProperty(){ja(11)},getPrototypeOf(r){return fi(r.base_)},setPrototypeOf(){ja(12)}},Po={};for(let r in nd){let e=nd[r];Po[r]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}Po.deleteProperty=function(r,e){return Po.set.call(this,r,e,void 0)},Po.set=function(r,e,n){return nd.set.call(this,r[0],e,n,r[0])};function eh(r,e){const n=r[An];return(n?ls(n):r)[e]}function DN(r,e,n){const a=Ax(e,n);return a?Io in a?a[Io]:a.get?.call(r.draft_):void 0}function Ax(r,e){if(!(e in r))return;let n=fi(r);for(;n;){const a=Object.getOwnPropertyDescriptor(n,e);if(a)return a;n=fi(n)}}function th(r){r.modified_||(r.modified_=!0,r.parent_&&th(r.parent_))}function ad(r){r.copy_||(r.assigned_=new Map,r.copy_=Yg(r.base_,r.scope_.immer_.useStrictShallowCopy_))}var RN=class{constructor(r){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,n,a)=>{if(pi(e)&&!pi(n)){const o=n;n=e;const d=this;return function(h=o,...f){return d.produce(h,p=>n.call(this,p,...f))}}pi(n)||ja(6),a!==void 0&&!pi(a)&&ja(7);let i;if(os(e)){const o=jx(this),d=nh(o,e,void 0);let g=!0;try{i=n(d),g=!1}finally{g?Qg(o):Zg(o)}return Cx(o,a),kx(i,o)}else if(!e||!Vg(e)){if(i=n(e),i===void 0&&(i=e),i===fx&&(i=void 0),this.autoFreeze_&&Jg(i,!0),a){const o=[],d=[];Cr(Xg).generateReplacementPatches_(e,i,{patches_:o,inversePatches_:d}),a(o,d)}return i}else ja(1,e)},this.produceWithPatches=(e,n)=>{if(pi(e))return(d,...g)=>this.produceWithPatches(d,h=>e(h,...g));let a,i;return[this.produce(e,n,(d,g)=>{a=d,i=g}),a,i]},Kg(r?.autoFreeze)&&this.setAutoFreeze(r.autoFreeze),Kg(r?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(r.useStrictShallowCopy),Kg(r?.useStrictIteration)&&this.setUseStrictIteration(r.useStrictIteration)}createDraft(r){os(r)||ja(8),Is(r)&&(r=ON(r));const e=jx(this),n=nh(e,r,void 0);return n[An].isManual_=!0,Zg(e),n}finishDraft(r,e){const n=r&&r[An];(!n||!n.isManual_)&&ja(9);const{scope_:a}=n;return Cx(a,e),kx(void 0,a)}setAutoFreeze(r){this.autoFreeze_=r}setUseStrictShallowCopy(r){this.useStrictShallowCopy_=r}setUseStrictIteration(r){this.useStrictIteration_=r}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(r,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}n>-1&&(e=e.slice(n+1));const a=Cr(Xg).applyPatches_;return Is(r)?a(r,e):this.produce(r,i=>a(i,e))}};function nh(r,e,n,a){const[i,o]=Yc(e)?Cr(Zc).proxyMap_(e,n):Jc(e)?Cr(Zc).proxySet_(e,n):AN(e,n);return(n?.scope_??wx()).drafts_.push(i),o.callbacks_=n?.callbacks_??[],o.key_=a,n&&a!==void 0?_N(n,o,a):o.callbacks_.push(function(h){h.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:f}=h;o.modified_&&f&&f.generatePatches_(o,[],h)}),i}function ON(r){return Is(r)||ja(10,r),Dx(r)}function Dx(r){if(!os(r)||Qc(r))return r;const e=r[An];let n,a=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=Yg(r,e.scope_.immer_.useStrictShallowCopy_),a=e.scope_.immer_.shouldUseStrictIteration()}else n=Yg(r,!0);return Vc(n,(i,o)=>{Kc(n,i,Dx(o))},a),e&&(e.finalized_=!1),n}var LN=new RN,MN=LN.produce;const $N=r=>(e,n,a)=>(a.setState=(i,o,...d)=>{const g=typeof i=="function"?MN(i):i;return e(g,o,...d)},r(a.setState,n,a)),Rx={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_NAME:"그누보드7",VITE_REVERB_APP_KEY:"",VITE_REVERB_HOST:"localhost",VITE_REVERB_PORT:"8080",VITE_REVERB_SCHEME:"https"},Uo=new Map,sd=r=>{const e=Uo.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([n,a])=>[n,a.getState()])):{}},IN=(r,e,n)=>{if(r===void 0)return{type:"untracked",connection:e.connect(n)};const a=Uo.get(n.name);if(a)return{type:"tracked",store:r,...a};const i={connection:e.connect(n),stores:{}};return Uo.set(n.name,i),{type:"tracked",store:r,...i}},zN=(r,e)=>{if(e===void 0)return;const n=Uo.get(r);n&&(delete n.stores[e],Object.keys(n.stores).length===0&&Uo.delete(r))},HN=r=>{var e,n;if(!r)return;const a=r.split(`
`),i=a.findIndex(d=>d.includes("api.setState"));if(i<0)return;const o=((e=a[i+1])==null?void 0:e.trim())||"";return(n=/.+ (.+) .+/.exec(o))==null?void 0:n[1]},PN=(r,e={})=>(n,a,i)=>{const{enabled:o,anonymousActionType:d,store:g,...h}=e;let f;try{f=(o??(Rx?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!f)return r(n,a,i);const{connection:p,...x}=IN(g,f,h);let y=!0;i.setState=((C,k,A)=>{const R=n(C,k);if(!y)return R;const N=A===void 0?{type:d||HN(new Error().stack)||"anonymous"}:typeof A=="string"?{type:A}:A;return g===void 0?(p?.send(N,a()),R):(p?.send({...N,type:`${g}/${N.type}`},{...sd(h.name),[g]:i.getState()}),R)}),i.devtools={cleanup:()=>{p&&typeof p.unsubscribe=="function"&&p.unsubscribe(),zN(h.name,g)}};const w=(...C)=>{const k=y;y=!1,n(...C),y=k},v=r(i.setState,a,i);if(x.type==="untracked"?p?.init(v):(x.stores[x.store]=i,p?.init(Object.fromEntries(Object.entries(x.stores).map(([C,k])=>[C,C===x.store?v:k.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let C=!1;const k=i.dispatch;i.dispatch=(...A)=>{(Rx?"production":void 0)!=="production"&&A[0].type==="__setState"&&!C&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),C=!0),k(...A)}}return p.subscribe(C=>{var k;switch(C.type){case"ACTION":if(typeof C.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return ah(C.payload,A=>{if(A.type==="__setState"){if(g===void 0){w(A.state);return}Object.keys(A.state).length!==1&&console.error(`
[zustand devtools middleware] Unsupported __setState action format.
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
`);const R=A.state[g];if(R==null)return;JSON.stringify(i.getState())!==JSON.stringify(R)&&w(R);return}i.dispatchFromDevtools&&typeof i.dispatch=="function"&&i.dispatch(A)});case"DISPATCH":switch(C.payload.type){case"RESET":return w(v),g===void 0?p?.init(i.getState()):p?.init(sd(h.name));case"COMMIT":if(g===void 0){p?.init(i.getState());return}return p?.init(sd(h.name));case"ROLLBACK":return ah(C.state,A=>{if(g===void 0){w(A),p?.init(i.getState());return}w(A[g]),p?.init(sd(h.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return ah(C.state,A=>{if(g===void 0){w(A);return}JSON.stringify(i.getState())!==JSON.stringify(A[g])&&w(A[g])});case"IMPORT_STATE":{const{nextLiftedState:A}=C.payload,R=(k=A.computedStates.slice(-1)[0])==null?void 0:k.state;if(!R)return;w(g===void 0?R:R[g]),p?.send(null,A);return}case"PAUSE_RECORDING":return y=!y}return}}),v},ah=(r,e)=>{let n;try{n=JSON.parse(r)}catch(a){console.error("[zustand devtools middleware] Could not parse the received json",a)}n!==void 0&&e(n)},UN={maxHistorySize:50};function Bo(r="component"){const e=Date.now().toString(36),n=Math.random().toString(36).substring(2,8);return`${r.toLowerCase().replace(/[^a-z0-9]/g,"_")}_${e}_${n}`}function sh(r,e){for(const n of r)if(typeof n!="string"&&(n.id===e||n.children&&sh(n.children,e)))return!0;return!1}function jr(r,e,n=null,a=[]){for(let i=0;i<r.length;i++){const o=r[i];if(typeof o!="string"){if(o.id===e)return{component:o,parentId:n,index:i,path:[...a,o.id]};if(o.children){const d=jr(o.children,e,o.id,[...a,o.id]);if(d)return d}}}return null}function qo(r,e,n,a){return n?r.map(i=>{if(typeof i=="string")return i;if(i.id===n)switch(a){case"before":return i;case"after":return i;case"inside":case"last-child":return{...i,children:[...i.children||[],e]};case"first-child":return{...i,children:[e,...i.children||[]]};default:return i}if(i.children){const o=[];for(let h=0;h<i.children.length;h++){const f=i.children[h];typeof f!="string"&&f.id===n?a==="before"?(o.push(e),o.push(f)):a==="after"?(o.push(f),o.push(e)):o.push(f):o.push(f)}const d=qo(o,e,n,a);if(JSON.stringify(d)!==JSON.stringify(i.children))return{...i,children:d}}return i}):[...r,e]}function rd(r,e){return r.filter(n=>typeof n=="string"?!0:n.id!==e).map(n=>typeof n=="string"?n:n.children?{...n,children:rd(n.children,e)}:n)}function id(r,e,n){return r.map(a=>{if(typeof a=="string")return a;if(a.id===e){const i=n.props?{...a.props,...n.props}:a.props;return{...a,...n,props:i}}return a.children?{...a,children:id(a.children,e,n)}:a})}function od(r,e,n,a){const i=jr(r,e);if(!i||e===n||BN(r,e,n))return r;const o=i.component,d=rd(r,e);return qo(d,o,n,a)}function BN(r,e,n){const a=jr(r,e);if(!a)return!1;const i=a.component;return i.children?sh(i.children,n):!1}function rh(r){const e={...r,id:Bo(r.name),props:r.props?{...r.props}:void 0,data_binding:r.data_binding?{...r.data_binding}:void 0,style:r.style?{...r.style}:void 0,actions:r.actions?JSON.parse(JSON.stringify(r.actions)):void 0,iteration:r.iteration?{...r.iteration}:void 0,lifecycle:r.lifecycle?JSON.parse(JSON.stringify(r.lifecycle)):void 0,responsive:r.responsive?JSON.parse(JSON.stringify(r.responsive)):void 0};return r.children&&(e.children=r.children.map(n=>typeof n=="string"?n:rh(n))),e}function Ox(r,e){const n=jr(r,e);if(!n)return null;const a=rh(n.component);return{components:qo(r,a,e,"after"),newId:a.id}}function ih(r,e){if(!e)return null;const n=e.split(".");let a=r;for(let i=0;i<n.length;i++){const o=n[i];if(o==="children")if(typeof a=="object"&&!Array.isArray(a)&&a.children)a=a.children;else return null;else{const d=parseInt(o,10);if(isNaN(d))return null;if(Array.isArray(a)){const g=a[d];if(!g||typeof g=="string")return null;a=g}else return null}}return typeof a=="object"&&!Array.isArray(a)&&"name"in a?a:null}function Go(r,e){const n=ih(r,e);if(!n)return null;if(n.id)return{components:r,id:n.id};const a=Bo(n.name);return{components:Lx(r,e,{id:a}),id:a}}function Lx(r,e,n){if(!e)return r;const a=e.split(".");function i(o,d){const g=a[d],h=parseInt(g,10);if(isNaN(h)||h<0||h>=o.length)return o;const f=o[h];if(typeof f=="string")return o;if(d===a.length-1){const x={...f,...n,props:n.props?{...f.props,...n.props}:f.props};return[...o.slice(0,h),x,...o.slice(h+1)]}if(a[d+1]==="children"&&f.children){const x=i(f.children,d+2),y={...f,children:x};return[...o.slice(0,h),y,...o.slice(h+1)]}return o}return i(r,0)}const vt=at("EditorState"),qN={layoutData:null,originalLayoutData:null,templateId:null,templateType:null,layoutName:null,selectedComponentId:null,hoveredComponentId:null,multiSelectedIds:[],editMode:"visual",previewDevice:"desktop",customWidth:1024,previewDarkMode:!1,loadingState:"idle",error:null,history:[],historyIndex:-1,maxHistorySize:UN.maxHistorySize,componentCategories:null,handlers:[],mockDataContext:{},versions:[],currentVersionId:null,inheritanceInfo:null,overlays:[],extensionPoints:[],activePropertyTab:"props",expandedTreeNodes:[],clipboard:null,draggingComponent:null,dropTargetId:null,dropPosition:null,hasChanges:!1,lastSavedAt:null};async function GN(r,e,n){const a=await fetch(`/api/admin/templates/${r}/layouts/${n}`);if(!a.ok)throw new Error(`Failed to fetch layout: ${a.status} ${a.statusText}`);return(await a.json()).data}async function FN(r,e,n,a){const i=await fetch(`/api/admin/templates/${r}/layouts/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({layout_data:n,description:a})});if(!i.ok)throw new Error(`Failed to save layout: ${i.status} ${i.statusText}`)}async function VN(r,e){const n=await fetch(`/api/admin/templates/${r}/layouts/${e}/versions`);if(!n.ok)throw new Error(`Failed to fetch versions: ${n.status} ${n.statusText}`);return(await n.json()).data.map(i=>({...i,createdAt:new Date(i.created_at)}))}async function KN(r,e,n){const a=await fetch(`/api/admin/templates/${r}/layouts/${e}/versions/${n}/restore`,{method:"POST",headers:{Accept:"application/json"}});if(!a.ok)throw new Error(`Failed to restore version: ${a.status} ${a.statusText}`);return(await a.json()).data}async function WN(r){const e=await fetch(`/api/templates/${r}/components.json`);if(!e.ok)throw new Error(`Failed to fetch component metadata: ${e.status}`);const n=await e.json();return{basic:n.components.basic||[],composite:n.components.composite||[],layout:n.components.layout||[],extension:[]}}const Se=bN()(PN($N((r,e)=>({...qN,loadLayout:async(n,a,i)=>{r(o=>{o.loadingState="loading",o.error=null});try{const o=await GN(n,a,i),d=await WN(n);r(g=>{g.layoutData=o,g.originalLayoutData=JSON.parse(JSON.stringify(o)),g.templateId=n,g.templateType=a,g.layoutName=i,g.componentCategories=d,g.loadingState="loaded",g.hasChanges=!1,o.extends&&(g.inheritanceInfo={parentLayout:o.extends,inheritedSlots:[],overridableSlots:Object.keys(o.slots||{}),depth:1}),g.history=[],g.historyIndex=-1}),vt.log("Layout loaded:",i)}catch(o){const d=o instanceof Error?o.message:"Unknown error";throw r(g=>{g.loadingState="error",g.error=d}),vt.error("Failed to load layout:",d),o}},saveLayout:async n=>{const{templateId:a,layoutName:i,layoutData:o}=e();if(!a||!i||!o)throw new Error("No layout loaded");r(d=>{d.loadingState="saving"});try{await FN(a,i,o,n),r(d=>{d.originalLayoutData=JSON.parse(JSON.stringify(o)),d.hasChanges=!1,d.lastSavedAt=new Date,d.loadingState="loaded"}),vt.log("Layout saved:",i)}catch(d){const g=d instanceof Error?d.message:"Unknown error";throw r(h=>{h.loadingState="error",h.error=g}),vt.error("Failed to save layout:",g),d}},publishLayout:async()=>{await e().saveLayout("Published");try{await fetch("/api/admin/cache/refresh",{method:"POST"}),vt.log("Cache refreshed after publish")}catch(n){vt.warn("Cache refresh failed:",n)}},resetLayout:()=>{const{originalLayoutData:n}=e();n&&r(a=>{a.layoutData=JSON.parse(JSON.stringify(n)),a.hasChanges=!1,a.selectedComponentId=null,a.hoveredComponentId=null})},setLayoutData:(n,a)=>{vt.log("Setting layout data directly:",{layoutName:n.layout_name,componentsCount:n.components?.length||0,templateId:a}),r(i=>{i.layoutData=n,i.originalLayoutData=JSON.parse(JSON.stringify(n)),i.templateId=a,i.loadingState="loaded",i.hasChanges=!1,n.extends&&(i.inheritanceInfo={parentLayout:n.extends,inheritedSlots:[],overridableSlots:Object.keys(n.slots||{}),depth:1}),i.history=[],i.historyIndex=-1})},updateLayoutMeta:n=>{const{layoutData:a}=e();a&&(vt.log("Updating layout meta:",n),r(i=>{i.layoutData&&(n.permissions!==void 0&&(i.layoutData.permissions=n.permissions),n.version!==void 0&&(i.layoutData.version=n.version),n.layout_name!==void 0&&(i.layoutData.layout_name=n.layout_name),n.extends!==void 0&&(i.layoutData.extends=n.extends),i.hasChanges=!0)}))},selectComponent:n=>{r(a=>{let i=n;if(n?.startsWith("auto_path:")&&a.layoutData){const o=n.substring(10),d=Go(a.layoutData.components,o);d&&(d.components!==a.layoutData.components&&(a.layoutData.components=d.components,vt.log("Auto-assigned component ID:",d.id,"at path:",o)),i=d.id)}if(a.selectedComponentId=i,i&&a.layoutData){const o=jr(a.layoutData.components,i);o&&o.path.forEach(d=>{a.expandedTreeNodes.includes(d)||a.expandedTreeNodes.push(d)})}})},hoverComponent:n=>{r(a=>{a.hoveredComponentId=n})},setHoveredComponentId:n=>{r(a=>{a.hoveredComponentId=n})},addComponent:(n,a,i)=>{const{layoutData:o}=e();o&&(e().pushHistory("Add component"),r(d=>{if(!d.layoutData)return;const g={...n,id:Bo(n.name)};d.layoutData.components=qo(d.layoutData.components,g,a,i),d.hasChanges=!0,d.selectedComponentId=g.id}))},deleteComponent:n=>{const{layoutData:a}=e();a&&(e().pushHistory("Delete component"),r(i=>{i.layoutData&&(i.layoutData.components=rd(i.layoutData.components,n),i.hasChanges=!0,i.selectedComponentId===n&&(i.selectedComponentId=null))}))},duplicateComponent:n=>{const{layoutData:a}=e();a&&(e().pushHistory("Duplicate component"),r(i=>{if(!i.layoutData)return;const o=Ox(i.layoutData.components,n);o&&(i.layoutData.components=o.components,i.hasChanges=!0,i.selectedComponentId=o.newId)}))},moveComponent:(n,a,i)=>{const{layoutData:o}=e();o&&(e().pushHistory("Move component"),r(d=>{d.layoutData&&(d.layoutData.components=od(d.layoutData.components,n,a,i),d.hasChanges=!0)}))},updateComponentProps:(n,a)=>{const{layoutData:i}=e();i&&(e().pushHistory("Update props"),r(o=>{o.layoutData&&(o.layoutData.components=id(o.layoutData.components,n,{props:{...a}}),o.hasChanges=!0)}))},updateComponent:(n,a)=>{const{layoutData:i}=e();i&&(e().pushHistory("Update component"),r(o=>{o.layoutData&&(o.layoutData.components=id(o.layoutData.components,n,a),o.hasChanges=!0)}))},ensureComponentId:n=>{const{layoutData:a}=e();if(!a)return null;const i=Go(a.components,n);return i?(i.components!==a.components&&(e().pushHistory("Auto-assign component ID"),r(o=>{o.layoutData&&(o.layoutData.components=i.components,o.hasChanges=!0)}),vt.log("Component ID auto-assigned:",i.id,"at path:",n)),i.id):(vt.warn("ensureComponentId failed: component not found at path",n),null)},ensureComponentIdAndMove:(n,a,i)=>{const{layoutData:o}=e();if(!o)return!1;vt.log("ensureComponentIdAndMove called:",{path:n,targetId:a,position:i});const d=Go(o.components,n);if(!d)return vt.warn("ensureComponentIdAndMove failed: component not found at path",n),!1;const g=d.id;if(vt.log("ensureComponentIdAndMove: sourceId =",g),g===a)return vt.log("ensureComponentIdAndMove: source and target are the same, skipping"),!1;const h=jr(d.components,a);return vt.log("ensureComponentIdAndMove: targetResult =",h?"found":"NOT FOUND"),h?(e().pushHistory("Move component"),r(f=>{if(!f.layoutData)return;const p=od(d.components,g,a,i);vt.log("ensureComponentIdAndMove: move result components count =",p.length),f.layoutData.components=p,f.hasChanges=!0}),vt.log("ensureComponentIdAndMove success:",g,"->",a,i),!0):(vt.warn("ensureComponentIdAndMove: target not found in components",a),!1)},moveComponentByPaths:(n,a,i)=>{const{layoutData:o}=e();if(!o)return!1;if(vt.log("moveComponentByPaths called:",{sourcePath:n,targetPath:a,position:i}),n===a)return vt.log("moveComponentByPaths: source and target paths are the same, skipping"),!1;const d=o.components,g=Go(d,n);if(!g)return vt.warn("moveComponentByPaths: source not found at path",n),!1;const h=g.id,f=Go(g.components,a);if(!f)return vt.warn("moveComponentByPaths: target not found at path",a),!1;const p=f.id;return vt.log("moveComponentByPaths: sourceId =",h,", targetId =",p),h===p?(vt.log("moveComponentByPaths: source and target are the same component, skipping"),!1):(e().pushHistory("Move component"),r(x=>{if(!x.layoutData)return;const y=od(f.components,h,p,i);vt.log("moveComponentByPaths: move result components count =",y.length),x.layoutData.components=y,x.hasChanges=!0}),vt.log("moveComponentByPaths success:",h,"->",p,i),!0)},updateComponentByPath:(n,a)=>{const{layoutData:i}=e();i&&(e().pushHistory("Update component by path"),r(o=>{o.layoutData&&(o.layoutData.components=Lx(o.layoutData.components,n,a),o.hasChanges=!0)}))},undo:()=>{r(n=>{if(n.historyIndex<0||n.history.length===0)return;if(n.historyIndex===n.history.length-1&&n.layoutData){const i={layoutData:JSON.parse(JSON.stringify(n.layoutData)),description:"Current state",timestamp:Date.now()};n.history.push(i)}const a=n.history[n.historyIndex];a&&(n.layoutData=JSON.parse(JSON.stringify(a.layoutData)),n.historyIndex-=1,n.hasChanges=!0)})},redo:()=>{r(n=>{if(n.historyIndex>=n.history.length-1)return;n.historyIndex+=1;const a=n.history[n.historyIndex+1];a&&(n.layoutData=JSON.parse(JSON.stringify(a.layoutData)),n.hasChanges=!0)})},pushHistory:n=>{r(a=>{if(!a.layoutData)return;a.history=a.history.slice(0,a.historyIndex+1);const i={layoutData:JSON.parse(JSON.stringify(a.layoutData)),description:n,timestamp:Date.now()};for(a.history.push(i),a.historyIndex=a.history.length-1;a.history.length>a.maxHistorySize;)a.history.shift(),a.historyIndex-=1})},setEditMode:n=>{r(a=>{a.editMode=n})},setPreviewDevice:(n,a)=>{r(i=>{i.previewDevice=n,a!==void 0&&(i.customWidth=a)})},togglePreviewDarkMode:()=>{r(n=>{n.previewDarkMode=!n.previewDarkMode})},loadVersions:async()=>{const{templateId:n,layoutName:a}=e();if(!(!n||!a))try{const i=await VN(n,a);r(o=>{o.versions=i})}catch(i){vt.error("Failed to load versions:",i)}},restoreVersion:async n=>{const{templateId:a,layoutName:i}=e();if(!(!a||!i))try{const o=await KN(a,i,n);r(d=>{d.layoutData=o,d.hasChanges=!0}),vt.log("Version restored:",n)}catch(o){throw vt.error("Failed to restore version:",o),o}},compareVersions:async(n,a)=>[],addDataSource:n=>{e().pushHistory("Add data source"),r(a=>{a.layoutData&&(a.layoutData.data_sources||(a.layoutData.data_sources=[]),a.layoutData.data_sources.push(n),a.hasChanges=!0)})},updateDataSource:(n,a)=>{e().pushHistory("Update data source"),r(i=>{if(!i.layoutData?.data_sources)return;const o=i.layoutData.data_sources.findIndex(d=>d.id===n);o!==-1&&(i.layoutData.data_sources[o]={...i.layoutData.data_sources[o],...a},i.hasChanges=!0)})},deleteDataSource:n=>{e().pushHistory("Delete data source"),r(a=>{a.layoutData?.data_sources&&(a.layoutData.data_sources=a.layoutData.data_sources.filter(i=>i.id!==n),a.hasChanges=!0)})},testDataSource:async n=>({success:!0,data:{}}),setMockData:(n,a)=>{r(i=>{i.mockDataContext[n]=a})},addModal:n=>{e().pushHistory("Add modal"),r(a=>{a.layoutData&&(a.layoutData.modals||(a.layoutData.modals=[]),a.layoutData.modals.push(n),a.hasChanges=!0)})},updateModal:(n,a)=>{e().pushHistory("Update modal"),r(i=>{if(!i.layoutData?.modals)return;const o=i.layoutData.modals.findIndex(d=>d.id===n);o!==-1&&(i.layoutData.modals[o]={...i.layoutData.modals[o],...a},i.hasChanges=!0)})},deleteModal:n=>{e().pushHistory("Delete modal"),r(a=>{a.layoutData?.modals&&(a.layoutData.modals=a.layoutData.modals.filter(i=>i.id!==n),a.hasChanges=!0)})},setActivePropertyTab:n=>{r(a=>{a.activePropertyTab=n})},toggleTreeNode:n=>{r(a=>{const i=a.expandedTreeNodes.indexOf(n);i===-1?a.expandedTreeNodes.push(n):a.expandedTreeNodes.splice(i,1)})},copyToClipboard:n=>{r(a=>{a.clipboard=JSON.parse(JSON.stringify(n))})},pasteFromClipboard:(n,a)=>{const{clipboard:i}=e();if(!i)return;const o={...JSON.parse(JSON.stringify(i)),id:Bo(i.name)};e().addComponent(o,n,a)},startDrag:n=>{r(a=>{a.draggingComponent=n})},dragOver:(n,a)=>{r(i=>{i.dropTargetId=n,i.dropPosition=a})},endDrag:()=>{r(n=>{n.draggingComponent=null,n.dropTargetId=null,n.dropPosition=null})},saveExtensionOverride:async(n,a)=>{vt.log("Save extension override:",n)},restoreExtensionOverride:async n=>{vt.log("Restore extension override:",n)}})),{name:"WysiwygEditorState"})),ld=r=>r.historyIndex>=0,cd=r=>r.historyIndex<r.history.length-1,ra=at("EditorContext"),YN=j.createContext(null),JN={autoSave:!1,autoSaveInterval:3e4,maxHistorySize:50,snapToGrid:!1,gridSize:8,keyboardShortcuts:!0,accessibilityMode:!1};function Mx({children:r,config:e,autoInitialize:n=!1,templateId:a,templateType:i,layoutName:o,layoutData:d,initialEditMode:g="visual"}){const h=Se(Q=>Q.loadLayout),f=Se(Q=>Q.setLayoutData),p=Se(Q=>Q.setEditMode),x=Se(Q=>Q.layoutData),y=Se(Q=>Q.selectedComponentId),w=Se(Q=>Q.loadingState),v=Se(Q=>Q.error),C=Se(Q=>Q.hasChanges),k=Se(Q=>Q.undo),A=Se(Q=>Q.redo),R=Se(Q=>Q.saveLayout),N=Se(Q=>Q.deleteComponent),D=Se(Q=>Q.duplicateComponent),M=Se(Q=>Q.copyToClipboard),L=Se(Q=>Q.pasteFromClipboard),z=Se(Q=>Q.clipboard),Y=Se(ld),he=Se(cd),be=j.useMemo(()=>({...JN,...e}),[e]),X=w==="loaded",ge=w==="loading",xe=w==="saving",le=j.useMemo(()=>{if(!x||!y)return null;const Q=(pe,$)=>{for(const U of pe)if(typeof U!="string"){if(U.id===$)return U;if(U.children){const q=Q(U.children,$);if(q)return q}}return null};return Q(x.components,y)},[x,y]),je=j.useCallback(async(Q,pe,$)=>{ra.log("Initializing editor:",{tid:Q,ttype:pe,lname:$}),await h(Q,pe,$)},[h]),J=j.useCallback(()=>{ra.log("Deactivating editor")},[]);j.useEffect(()=>{d&&!x&&(ra.log("Setting initial layout data from props",{layoutName:d.layout_name,componentsCount:d.components?.length||0}),f(d,a||"unknown"),p(g))},[d,x,a,g,f,p]),j.useEffect(()=>{n&&a&&i&&o&&!d&&je(a,i,o).catch(Q=>{ra.error("Auto-initialize failed:",Q)})},[n,a,i,o,je,d]),j.useEffect(()=>{if(!be.keyboardShortcuts||!X)return;const Q=pe=>{const $=pe.target;if($.tagName==="INPUT"||$.tagName==="TEXTAREA"||$.isContentEditable)return;const q=navigator.platform.toUpperCase().indexOf("MAC")>=0?pe.metaKey:pe.ctrlKey;if(q&&pe.key==="z"&&!pe.shiftKey){pe.preventDefault(),Y&&(k(),ra.log("Undo triggered"));return}if(q&&pe.key==="z"&&pe.shiftKey||q&&pe.key==="y"){pe.preventDefault(),he&&(A(),ra.log("Redo triggered"));return}if(q&&pe.key==="s"){pe.preventDefault(),C&&R().catch(ie=>{ra.error("Save failed:",ie)});return}if((pe.key==="Delete"||pe.key==="Backspace")&&y){pe.preventDefault(),N(y),ra.log("Delete triggered");return}if(q&&pe.key==="d"&&y){pe.preventDefault(),D(y),ra.log("Duplicate triggered");return}if(q&&pe.key==="c"&&le){pe.preventDefault(),M(le),ra.log("Copy triggered");return}if(q&&pe.key==="v"&&z&&y){pe.preventDefault(),L(y,"after"),ra.log("Paste triggered");return}if(pe.key==="Escape"){const ie=Se.getState().selectComponent;ie(null);return}};return window.addEventListener("keydown",Q),()=>{window.removeEventListener("keydown",Q)}},[be.keyboardShortcuts,X,Y,he,C,y,le,z,k,A,R,N,D,M,L]),j.useEffect(()=>{if(!be.autoSave||!X||!C)return;const Q=setTimeout(()=>{R("Auto-save").catch(pe=>{ra.error("Auto-save failed:",pe)})},be.autoSaveInterval);return()=>{clearTimeout(Q)}},[be.autoSave,be.autoSaveInterval,X,C,R]),j.useEffect(()=>{if(!C)return;const Q=pe=>{pe.preventDefault(),pe.returnValue=""};return window.addEventListener("beforeunload",Q),()=>{window.removeEventListener("beforeunload",Q)}},[C]);const F=j.useMemo(()=>({isEditorActive:X,config:be,initialize:je,deactivate:J,selectedComponent:le,layoutData:x,canUndo:Y,canRedo:he,hasChanges:C,isLoading:ge,isSaving:xe,error:v}),[X,be,je,J,le,x,Y,he,C,ge,xe,v]);return l.jsx(YN.Provider,{value:F,children:r})}const XN=500;function oh(r={}){const{debounceMs:e=XN}=r,n=Se(L=>L.history),a=Se(L=>L.historyIndex),i=Se(L=>L.undo),o=Se(L=>L.redo),d=Se(L=>L.pushHistory),g=Se(ld),h=Se(cd),f=j.useRef(null),p=j.useRef(null),x=j.useRef(null),y=j.useRef(!1),w=j.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),Se.setState({history:[],historyIndex:-1})},[]),v=j.useCallback(L=>{if(L<0||L>=n.length)return;const z=n[L];z&&Se.setState({layoutData:JSON.parse(JSON.stringify(z.layoutData)),historyIndex:L,hasChanges:!0})},[n]),C=j.useCallback(L=>{y.current||(f.current&&clearTimeout(f.current),p.current===L?f.current=setTimeout(()=>{d(L),f.current=null},e):(d(L),p.current=L))},[d,e]),k=j.useCallback(L=>{y.current||(y.current=!0,x.current=L,f.current&&(clearTimeout(f.current),f.current=null))},[]),A=j.useCallback(()=>{if(!y.current)return;const L=x.current||"Batch update";d(L),y.current=!1,x.current=null},[d]),R=j.useMemo(()=>a<0||a>=n.length?null:n[a],[n,a]),N=n.length,D=a+1,M=n.length-a-1;return{history:n,historyIndex:a,canUndo:g,canRedo:h,undo:i,redo:o,pushHistory:d,pushHistoryDebounced:C,startBatch:k,endBatch:A,isBatching:y.current,clearHistory:w,goToHistory:v,currentEntry:R,historySize:N,undoStackSize:D,redoStackSize:M}}const QN=({value:r,onChange:e,disabled:n=!1,placeholder:a="권한을 선택하세요"})=>{const[i,o]=j.useState({}),[d,g]=j.useState(!0),[h,f]=j.useState(null),[p,x]=j.useState(new Set(["admin"])),[y,w]=j.useState("");j.useEffect(()=>{(async()=>{try{g(!0),f(null);const L=await fetch("/api/admin/permissions",{headers:{Authorization:`Bearer ${localStorage.getItem("auth_token")}`,Accept:"application/json"}});if(!L.ok)throw new Error(`HTTP ${L.status}`);const z=await L.json();o(z.data?.data?.permissions||{})}catch(L){console.error("권한 목록 조회 실패:",L),f("권한 목록을 불러올 수 없습니다")}finally{g(!1)}})()},[]);const v=j.useCallback(M=>{n||(r.includes(M)?e(r.filter(L=>L!==M)):e([...r,M]))},[r,e,n]),C=j.useCallback(M=>{x(L=>{const z=new Set(L);return z.has(M)?z.delete(M):z.add(M),z})},[]),k=j.useCallback(()=>{if(n)return;const M=[],L=z=>{z.forEach(Y=>{M.push(Y.identifier),Y.children?.length&&L(Y.children)})};Object.values(i).forEach(z=>{z.permissions&&L(z.permissions)}),e(M)},[i,e,n]),A=j.useCallback(()=>{n||e([])},[e,n]),R=j.useCallback(M=>{if(!y.trim())return M;const L=y.toLowerCase(),z=Y=>{const he=Y.name.toLowerCase().includes(L),be=Y.identifier.toLowerCase().includes(L),X=Y.children?.map(z).filter(Boolean);return he||be||X&&X.length>0?{...Y,children:X}:null};return M.map(z).filter(Boolean)},[y]),N=(M,L=0)=>{const z=r.includes(M.identifier),Y=M.children&&M.children.length>0;return l.jsxs("div",{children:[l.jsxs("label",{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer transition-colors
${n?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-gray-700"}
${z?"bg-blue-50 dark:bg-blue-900/30":""}
`,style:{paddingLeft:`${8+L*16}px`},children:[l.jsx("input",{type:"checkbox",checked:z,onChange:()=>v(M.identifier),disabled:n,className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),l.jsxs("span",{className:"flex-1 text-sm text-gray-900 dark:text-gray-100",children:[M.name,l.jsxs("span",{className:"ml-2 text-xs text-gray-500 dark:text-gray-400",children:["(",M.identifier,")"]})]})]}),Y&&M.children?.map(he=>N(he,L+1))]},M.identifier)};if(d)return l.jsxs("div",{className:"p-4 text-center text-sm text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:"inline-block animate-spin mr-2",children:"⏳"}),"권한 목록 로딩 중..."]});if(h)return l.jsx("div",{className:"p-4 text-center text-sm text-red-500 dark:text-red-400",children:h});const D=Object.entries(i);return l.jsxs("div",{className:"border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 overflow-hidden",children:[l.jsxs("div",{className:"p-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:["선택된 권한: ",l.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[r.length,"개"]}),r.length===0&&l.jsx("span",{className:"text-gray-500 ml-1",children:"(공개 레이아웃)"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{type:"button",onClick:k,disabled:n,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",children:"전체 선택"}),l.jsx("button",{type:"button",onClick:A,disabled:n||r.length===0,className:"text-xs text-red-600 dark:text-red-400 hover:underline disabled:opacity-50",children:"전체 해제"})]})]}),l.jsx("input",{type:"text",value:y,onChange:M=>w(M.target.value),placeholder:"권한 검색...",className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),l.jsx("div",{className:"max-h-64 overflow-y-auto",children:D.length===0?l.jsx("div",{className:"p-4 text-center text-sm text-gray-500 dark:text-gray-400",children:"권한이 없습니다"}):D.map(([M,L])=>{const z=R(L.permissions||[]);if(y&&z.length===0)return null;const Y=p.has(M);return l.jsxs("div",{className:"border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[l.jsxs("button",{type:"button",onClick:()=>C(M),className:"w-full flex items-center gap-2 px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[l.jsx("span",{className:"text-gray-400",children:Y?"▼":"▶"}),l.jsx("span",{children:L.label}),l.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-auto",children:[z.length,"개"]})]}),Y&&l.jsx("div",{className:"pb-2",children:z.map(he=>N(he))})]},M)})}),r.length>0&&l.jsxs("div",{className:"p-2 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:[l.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:"선택됨:"}),l.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.slice(0,5).map(M=>l.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded",title:M,children:[M,l.jsx("button",{type:"button",onClick:()=>v(M),disabled:n,className:"hover:text-red-500",children:"×"})]},M)),r.length>5&&l.jsxs("span",{className:"text-xs text-gray-500",children:["+",r.length-5,"개 더..."]})]})]}),l.jsx("div",{className:"p-2 border-t border-gray-200 dark:border-gray-700 text-xs text-gray-500 dark:text-gray-400",children:"권한을 선택하지 않으면 공개 레이아웃이 됩니다. 선택된 권한은 AND 조건으로 적용됩니다."})]})},ZN=at("LayoutSettingsModal");function eE({isOpen:r,onClose:e}){const n=Se(y=>y.layoutData),a=Se(y=>y.updateLayoutMeta),i=Se(y=>y.pushHistory),[o,d]=j.useState([]),[g,h]=j.useState(!1);j.useEffect(()=>{n&&r&&(d(n.permissions||[]),h(!1))},[n,r]);const f=j.useCallback(y=>{d(y),h(!0)},[]),p=j.useCallback(()=>{n&&(ZN.log("Saving layout permissions:",o),i("레이아웃 권한 변경"),a({permissions:o}),h(!1),e())},[n,o,i,a,e]),x=j.useCallback(()=>{g&&!window.confirm("변경사항이 저장되지 않습니다. 정말 닫으시겠습니까?")||e()},[g,e]);return r?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:x}),l.jsxs("div",{className:"relative w-full max-w-2xl mx-4 bg-white dark:bg-gray-800 rounded-lg shadow-xl max-h-[90vh] flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"레이아웃 설정"}),n&&l.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:[n.layout_name,n.version&&l.jsxs("span",{className:"ml-2 text-xs bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:["v",n.version]})]})]}),l.jsx("button",{onClick:x,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",title:"닫기",children:l.jsx("span",{className:"text-xl",children:"✕"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto px-6 py-4",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"레이아웃 정보"}),l.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"이름:"}),l.jsx("span",{className:"ml-2 text-gray-900 dark:text-white font-mono",children:n?.layout_name||"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"버전:"}),l.jsx("span",{className:"ml-2 text-gray-900 dark:text-white",children:n?.version||"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"상속:"}),l.jsx("span",{className:"ml-2 text-gray-900 dark:text-white font-mono",children:n?.extends||"없음"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"컴포넌트:"}),l.jsxs("span",{className:"ml-2 text-gray-900 dark:text-white",children:[n?.components?.length||0,"개"]})]})]})]}),l.jsx("hr",{className:"border-gray-200 dark:border-gray-700 mb-6"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"접근 권한"}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:"이 레이아웃에 접근하기 위해 필요한 권한을 설정합니다. 권한을 선택하지 않으면 공개 레이아웃이 됩니다. 선택된 권한은 AND 조건으로 적용됩니다."}),l.jsx(QN,{value:o,onChange:f})]})]}),l.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:[l.jsx("button",{onClick:x,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:"취소"}),l.jsx("button",{onClick:p,disabled:!g,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-lg transition-colors",children:g?"저장":"변경 없음"})]})]})]}):null}const mi=at("Toolbar");function lh({icon:r,label:e,onClick:n,disabled:a=!1,variant:i="default",loading:o=!1}){const d="flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",g={default:"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",primary:"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-600 dark:hover:bg-blue-700",danger:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900"};return l.jsxs("button",{className:`${d} ${g[i]}`,onClick:n,disabled:a||o,title:e,children:[o?l.jsx("span",{className:"animate-spin",children:"⏳"}):l.jsx("span",{children:r}),l.jsx("span",{className:"hidden sm:inline",children:e})]})}function ch({icon:r,label:e,onClick:n,disabled:a=!1,active:i=!1}){return l.jsx("button",{className:`p-2 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${i?"bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-400":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,onClick:n,disabled:a,title:e,children:l.jsx("span",{children:r})})}function tE({currentMode:r,onChange:e}){const n=[{id:"visual",icon:"🎨",label:"비주얼"},{id:"json",icon:"📝",label:"JSON"},{id:"split",icon:"⬛",label:"분할"}];return l.jsx("div",{className:"flex items-center bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:n.map(a=>l.jsxs("button",{className:`flex items-center gap-1 px-3 py-1 text-sm rounded transition-colors ${r===a.id?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,onClick:()=>e(a.id),title:`${a.label} 모드`,children:[l.jsx("span",{children:a.icon}),l.jsx("span",{className:"hidden md:inline",children:a.label})]},a.id))})}function nE({hasChanges:r,isSaving:e,lastSaved:n}){return e?l.jsxs("div",{className:"flex items-center gap-1 text-sm text-blue-600 dark:text-blue-400",children:[l.jsx("span",{className:"animate-spin",children:"⏳"}),l.jsx("span",{children:"저장 중..."})]}):r?l.jsxs("div",{className:"flex items-center gap-1 text-sm text-orange-600 dark:text-orange-400",children:[l.jsx("span",{children:"🔶"}),l.jsx("span",{children:"변경사항 있음"})]}):n?l.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600 dark:text-green-400",children:[l.jsx("span",{children:"✅"}),l.jsx("span",{children:"저장됨"}),l.jsxs("span",{className:"text-gray-400 dark:text-gray-500 text-xs",children:["(",n.toLocaleTimeString(),")"]})]}):null}function aE({currentVersion:r,onVersionSelect:e}){const[n,a]=j.useState(!1);return l.jsxs("div",{className:"relative",children:[l.jsxs("button",{className:"flex items-center gap-1 px-3 py-1.5 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:()=>a(!n),children:[l.jsx("span",{children:"📋"}),l.jsx("span",{className:"hidden sm:inline",children:"버전"}),r&&l.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",r,")"]}),l.jsx("span",{className:"text-xs",children:n?"▲":"▼"})]}),n&&l.jsx("div",{className:"absolute top-full right-0 mt-1 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:l.jsx("div",{className:"p-3",children:l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center",children:"버전 관리 (Phase 4)"})})})]})}function $x({className:r="",onClose:e,onSaveComplete:n}){const a=Se(be=>be.layoutData),i=Se(be=>be.editMode),o=Se(be=>be.hasChanges),d=Se(be=>be.loadingState),g=Se(be=>be.setEditMode),h=Se(be=>be.saveLayout),f=Se(ld),p=Se(cd),{undo:x,redo:y,undoStackSize:w,redoStackSize:v}=oh(),[C,k]=j.useState(void 0),[A,R]=j.useState(!1),N=d==="saving",D=j.useCallback(async()=>{try{await h("Manual save"),k(new Date),n?.(),mi.log("Layout saved")}catch(be){mi.error("Save failed:",be)}},[h,n]),M=j.useCallback(()=>{f&&(x(),mi.log("Undo performed"))},[f,x]),L=j.useCallback(()=>{p&&(y(),mi.log("Redo performed"))},[p,y]),z=j.useCallback(()=>{o&&!window.confirm("저장되지 않은 변경사항이 있습니다. 정말 닫으시겠습니까?")||e?.()},[o,e]),Y=j.useCallback(async()=>{mi.log("Publish requested"),alert("발행 기능은 Phase 4에서 구현됩니다.")},[]),he=j.useCallback(be=>{mi.log("Version selected:",be)},[]);return l.jsxs("div",{className:`flex items-center justify-between px-4 py-2 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 ${r}`,children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xl",children:"✏️"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"위지윅 편집기"}),a&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a.layout_name})]})]}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ch,{icon:"↩️",label:`실행 취소 (${w})`,onClick:M,disabled:!f}),l.jsx(ch,{icon:"↪️",label:`다시 실행 (${v})`,onClick:L,disabled:!p})]}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsx(tE,{currentMode:i,onChange:g})]}),l.jsx("div",{className:"flex-1 flex justify-center",children:l.jsx(nE,{hasChanges:o,isSaving:N,lastSaved:C})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(lh,{icon:"⚙️",label:"환경설정",onClick:()=>R(!0)}),l.jsx(aE,{currentVersion:a?.version,onVersionSelect:he}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsx(lh,{icon:"💾",label:"저장",onClick:D,disabled:!o,loading:N}),l.jsx(lh,{icon:"🚀",label:"발행",onClick:Y,variant:"primary",disabled:o}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsx(ch,{icon:"✕",label:"닫기",onClick:z})]}),l.jsx(eE,{isOpen:A,onClose:()=>R(!1)})]})}const yi=at("LayoutTree");function sE(r){const e=r.split(".");return e.length===1?e[0]:e[0]+e.slice(1).map(n=>`.children.${n}`).join("")}function Ix(r,e,n=""){for(let a=0;a<r.length;a++){const i=r[a];if(typeof i=="string")continue;const o=n?`${n}.${a}`:`${a}`,d=i.id||`tree_${o}`;if(d===e||i.id===e)return[d];if(i.children&&i.children.length>0){const g=Ix(i.children,e,o);if(g)return[d,...g]}}return null}function rE(r,e){const n=r.props?._extensionSource,a=r.children?r.children.filter(i=>typeof i!="string").length:0;return{id:r.id,name:r.name,type:r.type==="extension_point"?"extension_point":r.type,hasCondition:!!r.if,hasIteration:!!r.iteration,isFromExtension:!!n,extensionSource:n,childCount:a,depth:e}}function iE(r){switch(r){case"basic":return"📦";case"composite":return"🧩";case"layout":return"📐";case"extension_point":return"🔌";default:return"📄"}}function oE(r){if(r.isFromExtension)return"text-purple-600 dark:text-purple-400";switch(r.type){case"basic":return"text-blue-600 dark:text-blue-400";case"composite":return"text-green-600 dark:text-green-400";case"layout":return"text-orange-600 dark:text-orange-400";case"extension_point":return"text-pink-600 dark:text-pink-400";default:return"text-gray-600 dark:text-gray-400"}}const lE=Fe.memo(function r({component:e,depth:n,treePath:a,enableDragDrop:i,expandedNodes:o,onToggleExpand:d,onNodeClick:g,onNodeDoubleClick:h,onDragStart:f,onDragOver:p,onDrop:x,onDragEnd:y,draggedNodeId:w,dropTargetId:v,dropPosition:C}){const k=Se($=>$.selectedComponentId),A=Se($=>$.hoveredComponentId),R=Se($=>$.setHoveredComponentId),N=e.id||`tree_${a}`,D=j.useMemo(()=>rE(e,n),[e,n]),M=e.children&&e.children.length>0,L=o.has(N),z=j.useMemo(()=>k?k===N||k===e.id:!1,[k,N,e.id]),Y=A===N,he=w===N,be=v===N,X=j.useCallback($=>{$.stopPropagation(),g?.(N)},[N,g]),ge=j.useCallback($=>{$.stopPropagation(),h?.(N)},[N,h]),xe=j.useCallback($=>{$.stopPropagation(),d(N)},[N,d]),le=j.useCallback(()=>{R(N)},[N,R]),je=j.useCallback(()=>{R(null)},[R]),J=j.useCallback($=>{i&&f($,N)},[N,i,f]),F=j.useCallback($=>{i&&($.preventDefault(),p($,N))},[N,i,p]),Q=j.useCallback($=>{if(!i)return;$.preventDefault();const U=$.currentTarget.getBoundingClientRect(),q=$.clientY-U.top,ie=U.height;let se;q<ie*.25?se="before":q>ie*.75?se="after":se="inside",x($,N,se)},[N,i,x]),pe=j.useMemo(()=>{const $=["flex items-center gap-1 px-2 py-1 rounded cursor-pointer","transition-colors duration-150","hover:bg-gray-100 dark:hover:bg-gray-700"];return z?$.push("bg-blue-100 dark:bg-blue-900"):Y&&$.push("bg-gray-50 dark:bg-gray-800"),he&&$.push("opacity-50"),be&&(C==="before"?$.push("border-t-2 border-blue-500"):C==="after"?$.push("border-b-2 border-blue-500"):C==="inside"&&$.push("ring-2 ring-blue-500")),$.join(" ")},[z,Y,he,be,C]);return l.jsxs("div",{className:"select-none",children:[l.jsxs("div",{className:pe,style:{paddingLeft:`${n*16+8}px`},onClick:X,onDoubleClick:ge,onMouseEnter:le,onMouseLeave:je,draggable:i,onDragStart:J,onDragOver:F,onDrop:Q,onDragEnd:y,role:"treeitem","aria-selected":z,"aria-expanded":M?L:void 0,children:[M?l.jsx("button",{className:"w-4 h-4 flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",onClick:xe,"aria-label":L?"접기":"펼치기",children:L?"▼":"▶"}):l.jsx("span",{className:"w-4"}),l.jsx("span",{className:"text-sm",title:D.type,children:iE(D.type)}),l.jsx("span",{className:`text-sm font-medium ${oE(D)}`,children:D.name}),e.id?l.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-1",children:["#",e.id.length>10?e.id.slice(0,8)+"…":e.id]}):l.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600 ml-1",title:"ID 미정의",children:"(no id)"}),l.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[D.hasCondition&&l.jsx("span",{className:"px-1 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",title:`조건: ${e.if}`,children:"if"}),D.hasIteration&&l.jsx("span",{className:"px-1 text-xs bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300 rounded",title:`반복: ${e.iteration?.source}`,children:"∞"}),D.isFromExtension&&D.extensionSource&&l.jsx("span",{className:"px-1 text-xs bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300 rounded",title:`출처: ${D.extensionSource}`,children:D.extensionSource})]})]}),M&&L&&l.jsx("div",{role:"group",children:e.children.map(($,U)=>{if(typeof $=="string")return null;const q=`${a}.${U}`,ie=$.id||`tree_${q}`;return l.jsx(r,{component:$,depth:n+1,treePath:q,enableDragDrop:i,expandedNodes:o,onToggleExpand:d,onNodeClick:g,onNodeDoubleClick:h,onDragStart:f,onDragOver:p,onDrop:x,onDragEnd:y,draggedNodeId:w,dropTargetId:v,dropPosition:C},ie)})})]})}),cE=Fe.memo(function({x:e,y:n,nodeId:a,onClose:i}){const o=Se(k=>k.deleteComponent),d=Se(k=>k.duplicateComponent),g=Se(k=>k.copyToClipboard),h=Se(k=>k.pasteFromClipboard),f=Se(k=>k.clipboard),p=Se(k=>k.layoutData),x=j.useMemo(()=>{if(!p)return null;const k=A=>{for(const R of A)if(typeof R!="string"){if(R.id===a)return R;if(R.children){const N=k(R.children);if(N)return N}}return null};return k(p.components)},[p,a]),y=j.useCallback(()=>{x&&(g(x),yi.log("Copied component:",a)),i()},[x,g,a,i]),w=j.useCallback(()=>{f&&(h(a,"inside"),yi.log("Pasted component inside:",a)),i()},[f,h,a,i]),v=j.useCallback(()=>{d(a),yi.log("Duplicated component:",a),i()},[d,a,i]),C=j.useCallback(()=>{o(a),yi.log("Deleted component:",a),i()},[o,a,i]);return Fe.useEffect(()=>{const k=()=>i();return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[i]),l.jsxs("div",{className:"fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-32",style:{left:e,top:n},onClick:k=>k.stopPropagation(),children:[l.jsx("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",onClick:y,children:"📋 복사"}),l.jsx("button",{className:`w-full px-4 py-2 text-left text-sm ${f?"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300":"text-gray-400 dark:text-gray-600 cursor-not-allowed"}`,onClick:w,disabled:!f,children:"📥 붙여넣기"}),l.jsx("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",onClick:v,children:"📑 복제"}),l.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),l.jsx("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-red-50 dark:hover:bg-red-900 text-red-600 dark:text-red-400",onClick:C,children:"🗑️ 삭제"})]})});function zx({className:r="",showContextMenu:e=!0,enableDragDrop:n=!0,onNodeClick:a,onNodeDoubleClick:i}){const o=Se(X=>X.layoutData),d=Se(X=>X.selectComponent),g=Se(X=>X.moveComponent),h=Se(X=>X.selectedComponentId),[f,p]=j.useState(new Set),[x,y]=j.useState(null),[w,v]=j.useState(null),[C,k]=j.useState(null),[A,R]=j.useState({visible:!1,x:0,y:0,nodeId:null});Fe.useEffect(()=>{if(o){const X=new Set;o.components.forEach((ge,xe)=>{if(typeof ge!="string"){const je=ge.id||`tree_${xe}`;X.add(je)}}),p(X)}},[o?.layout_name]),Fe.useEffect(()=>{if(!h||!o)return;const X=Ix(o.components,h);X&&X.length>0&&p(ge=>{const xe=new Set(ge);return X.slice(0,-1).forEach(le=>xe.add(le)),xe})},[h,o]);const N=j.useCallback(X=>{p(ge=>{const xe=new Set(ge);return xe.has(X)?xe.delete(X):xe.add(X),xe})},[]),D=j.useCallback(X=>{let ge=X;if(X.startsWith("tree_")){const xe=X.substring(5);ge=`auto_path:${sE(xe)}`}d(ge),a?.(ge)},[d,a]),M=j.useCallback(X=>{if(!e)return;X.preventDefault();const xe=X.target.closest('[role="treeitem"]');if(xe){const le=xe.getAttribute("data-node-id");le&&R({visible:!0,x:X.clientX,y:X.clientY,nodeId:le})}},[e]),L=j.useCallback((X,ge)=>{y(ge),X.dataTransfer.effectAllowed="move",X.dataTransfer.setData("text/plain",ge),yi.log("Drag start:",ge)},[]),z=j.useCallback((X,ge)=>{if(x===ge)return;const xe=X.target.getBoundingClientRect(),le=X.clientY-xe.top,je=xe.height;let J;le<je*.25?J="before":le>je*.75?J="after":J="inside",v(ge),k(J)},[x]),Y=j.useCallback((X,ge,xe)=>{x&&x!==ge&&(g(x,ge,xe),yi.log("Dropped:",x,"to",ge,xe)),y(null),v(null),k(null)},[x,g]),he=j.useCallback(()=>{y(null),v(null),k(null)},[]),be=j.useCallback(()=>{R({visible:!1,x:0,y:0,nodeId:null})},[]);return o?l.jsxs("div",{className:`h-full overflow-auto bg-white dark:bg-gray-900 ${r}`,onContextMenu:M,role:"tree","aria-label":"레이아웃 트리",children:[l.jsxs("div",{className:"sticky top-0 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 px-3 py-2",children:[l.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"레이아웃 트리"}),l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[o.layout_name,o.extends&&l.jsxs("span",{className:"ml-1 text-blue-500",children:["(extends: ",o.extends,")"]})]})]}),l.jsx("div",{className:"p-2",children:o.components.map((X,ge)=>{if(typeof X=="string")return null;const xe=X,le=`${ge}`,je=xe.id||`tree_${le}`;return l.jsx(lE,{component:xe,depth:0,treePath:le,enableDragDrop:n,expandedNodes:f,onToggleExpand:N,onNodeClick:D,onNodeDoubleClick:i,onDragStart:L,onDragOver:z,onDrop:Y,onDragEnd:he,draggedNodeId:x,dropTargetId:w,dropPosition:C},je)})}),A.visible&&A.nodeId&&l.jsx(cE,{x:A.x,y:A.y,nodeId:A.nodeId,onClose:be})]}):l.jsx("div",{className:`flex items-center justify-center h-full text-gray-500 dark:text-gray-400 ${r}`,children:l.jsx("p",{children:"레이아웃을 로드하세요"})})}const yn=at("PreviewCanvas"),dh={desktop:{width:1920,label:"Desktop",icon:"🖥️"},tablet:{width:768,label:"Tablet",icon:"📱"},mobile:{width:375,label:"Mobile",icon:"📱"},custom:{width:0,label:"Custom",icon:"📐"}};function dE({currentDevice:r,customWidth:e,onDeviceChange:n,onCustomWidthChange:a}){const i=["desktop","tablet","mobile","custom"];return l.jsxs("div",{className:"flex items-center gap-2 p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:[i.map(o=>{const d=dh[o],g=r===o;return l.jsxs("button",{className:`flex items-center gap-1 px-3 py-1.5 rounded text-sm transition-colors ${g?"bg-blue-500 text-white":"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600"}`,onClick:()=>n(o),title:`${d.label} (${o==="custom"?e:d.width}px)`,children:[l.jsx("span",{children:d.icon}),l.jsx("span",{className:"hidden sm:inline",children:d.label})]},o)}),r==="custom"&&l.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[l.jsx("input",{type:"number",value:e,onChange:o=>a(parseInt(o.target.value,10)||320),min:320,max:2560,className:"w-20 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300"}),l.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:"px"})]})]})}function uE({zoom:r,onZoomChange:e}){const n=[25,50,75,100,125,150,200];return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700",onClick:()=>e(Math.max(25,r-25)),disabled:r<=25,title:"축소",children:"➖"}),l.jsx("select",{value:r,onChange:a=>e(parseInt(a.target.value,10)),className:"px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300",children:n.map(a=>l.jsxs("option",{value:a,children:[a,"%"]},a))}),l.jsx("button",{className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700",onClick:()=>e(Math.min(200,r+25)),disabled:r>=200,title:"확대",children:"➕"}),l.jsx("button",{className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700",onClick:()=>e(100),title:"100%로 리셋",children:"🔄"})]})}function gE({targetId:r,position:e,containerRef:n}){const[a,i]=j.useState(null);return j.useEffect(()=>{if(!r||!e||!n.current){i(null);return}const o=n.current,d=o.querySelector(`[data-editor-id="${r}"]`);if(d){const g=o.getBoundingClientRect(),h=o.scrollLeft,f=o.scrollTop,p=d.getBoundingClientRect();i(new DOMRect(p.left-g.left+h,p.top-g.top+f,p.width,p.height))}else i(null)},[r,e,n]),!a||!e?null:e==="before"?l.jsx("div",{className:"absolute h-1 bg-blue-500 rounded pointer-events-none z-50",style:{left:a.x,top:a.y-2,width:a.width}}):e==="after"?l.jsx("div",{className:"absolute h-1 bg-blue-500 rounded pointer-events-none z-50",style:{left:a.x,top:a.y+a.height,width:a.width}}):l.jsx("div",{className:"absolute border-2 border-dashed border-blue-500 rounded pointer-events-none z-50",style:{left:a.x,top:a.y,width:a.width,height:a.height}})}function Hx(r,e){return r.querySelector(`[data-editor-id="${e}"]`)}function hE({selectedId:r,hoveredId:e,containerRef:n,zoom:a}){const[i,o]=j.useState(null),[d,g]=j.useState(null);return j.useEffect(()=>{if(!n.current)return;const h=()=>{const k=n.current;if(!k)return;const A=k.getBoundingClientRect(),R=k.scrollLeft,N=k.scrollTop;if(r){const D=Hx(k,r);if(D){const M=D.getBoundingClientRect();o(new DOMRect(M.left-A.left+R,M.top-A.top+N,M.width,M.height))}else o(null)}else o(null);if(e&&e!==r){const D=Hx(k,e);if(D){const M=D.getBoundingClientRect();g(new DOMRect(M.left-A.left+R,M.top-A.top+N,M.width,M.height))}else g(null)}else g(null)};h();let f,p=null;const x=350,y=k=>{p===null&&(p=k);const A=k-p;h(),A<x&&(f=requestAnimationFrame(y))};f=requestAnimationFrame(y);const w=new ResizeObserver(h);w.observe(n.current);const v=n.current;v.addEventListener("scroll",h),window.addEventListener("scroll",h,!0);const C=new MutationObserver(h);return C.observe(v,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(f),w.disconnect(),C.disconnect(),v?.removeEventListener("scroll",h),window.removeEventListener("scroll",h,!0)}},[r,e,n,a]),l.jsxs(l.Fragment,{children:[i&&l.jsxs("div",{className:"absolute pointer-events-none border-2 border-blue-500",style:{left:i.x,top:i.y,width:i.width,height:i.height},children:[l.jsx("div",{className:"absolute -left-1 -top-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -right-1 -top-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -left-1 -bottom-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -right-1 -bottom-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -top-6 left-0 px-1 py-0.5 text-xs bg-blue-500 text-white rounded whitespace-nowrap",children:r})]}),d&&l.jsx("div",{className:"absolute pointer-events-none border border-dashed border-green-400",style:{left:d.x,top:d.y,width:d.width,height:d.height},children:l.jsx("div",{className:"absolute -top-5 left-0 px-1 py-0.5 text-xs bg-green-400 text-white rounded whitespace-nowrap opacity-80",children:e})})]})}function fE(){return l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 dark:text-gray-400",children:[l.jsx("div",{className:"text-6xl mb-4",children:"📄"}),l.jsx("h3",{className:"text-lg font-medium mb-2",children:"레이아웃이 없습니다"}),l.jsx("p",{className:"text-sm text-center max-w-xs",children:"편집할 레이아웃을 선택하거나, 새 레이아웃을 생성하세요."})]})}function pE(){return l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 dark:text-gray-400",children:[l.jsx("div",{className:"animate-spin text-4xl mb-4",children:"⏳"}),l.jsx("p",{className:"text-sm",children:"레이아웃 로딩 중..."})]})}function mE({message:r,onRetry:e}){return l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-red-500 dark:text-red-400",children:[l.jsx("div",{className:"text-6xl mb-4",children:"⚠️"}),l.jsx("h3",{className:"text-lg font-medium mb-2",children:"오류 발생"}),l.jsx("p",{className:"text-sm text-center max-w-xs mb-4",children:r}),e&&l.jsx("button",{className:"px-4 py-2 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded hover:bg-red-200 dark:hover:bg-red-800",onClick:e,children:"다시 시도"})]})}function yE({width:r,zoom:e,children:n}){const a=e/100,i=r*a;return l.jsxs("div",{className:"mx-auto bg-white dark:bg-gray-900 shadow-xl rounded-lg overflow-hidden transition-all duration-300",style:{width:i,transform:`scale(${a})`,transformOrigin:"top center"},children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),l.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),l.jsx("div",{className:"w-3 h-3 rounded-full bg-green-500"})]}),l.jsx("div",{className:"flex-1 mx-4",children:l.jsxs("div",{className:"px-3 py-1 text-xs bg-white dark:bg-gray-700 rounded text-gray-500 dark:text-gray-400 truncate",children:[window.location.origin,"/preview"]})})]}),l.jsx("div",{className:"min-h-96",children:n})]})}function uh({className:r="",showOverlay:e=!0,onComponentSelect:n,onComponentHover:a,onComponentDrop:i}){const o=j.useRef(null),d=Se(Ce=>Ce.layoutData),g=Se(Ce=>Ce.loadingState),h=Se(Ce=>Ce.error),f=Se(Ce=>Ce.previewDevice),p=Se(Ce=>Ce.customWidth),x=Se(Ce=>Ce.selectedComponentId),y=Se(Ce=>Ce.hoveredComponentId),w=Se(Ce=>Ce.setPreviewDevice),v=Se(Ce=>Ce.selectComponent),C=Se(Ce=>Ce.setHoveredComponentId),k=Se(Ce=>Ce.mockDataContext),A=Se(Ce=>Ce.templateId),R=Se(Ce=>Ce.moveComponent),N=Se(Ce=>Ce.startDrag),D=Se(Ce=>Ce.dragOver),M=Se(Ce=>Ce.endDrag),L=Se(Ce=>Ce.dropTargetId),z=Se(Ce=>Ce.dropPosition),Y=Se(Ce=>Ce.ensureComponentIdAndMove),he=Se(Ce=>Ce.moveComponentByPaths),[be,X]=j.useState(100),[ge,xe]=j.useState(!1),le=j.useRef(null),je=50,J=8,F=j.useRef(null),Q=j.useRef(null),pe=j.useRef(null),$=j.useRef(null),U=j.useMemo(()=>({templateId:A||"sirsoft-basic",locale:"ko"}),[A]),q=j.useMemo(()=>({_global:{sidebarOpen:!1,...k?._global||{}},_local:{...k?._local||{}},$locale:"ko",$templateId:A||"sirsoft-basic",route:{},query:{},...k||{}}),[k,A]);j.useEffect(()=>{(async()=>{try{F.current||(F.current=ya.getInstance(),A&&await F.current.loadComponents(A,"user")),Q.current||(Q.current=new _n),pe.current||(pe.current=yr.getInstance()),!$.current&&pe.current&&($.current=new So({},pe.current,U)),xe(!0),yn.log("Editor engines initialized")}catch(Ge){yn.error("Failed to initialize engines:",Ge)}})()},[A,U]);const ie=j.useCallback((Ce,Ge)=>{if(Ge.stopPropagation(),Ce.startsWith("auto_")){const bt=Ge.target.closest("[data-editor-path]")?.getAttribute("data-editor-path");if(bt){const Ct=`auto_path:${bt}`;v(Ct),n?.(Ct),yn.log("Component selected via DynamicRenderer:",Ce,"-> path:",bt);return}}v(Ce),n?.(Ce),yn.log("Component selected via DynamicRenderer:",Ce)},[v,n]),se=j.useCallback((Ce,Ge)=>{yn.log("handleDynamicHover called:",Ce),C(Ce),a?.(Ce)},[C,a]),we=j.useCallback((Ce,Ge)=>{if(!d){Ge.dataTransfer.effectAllowed="none";return}if(Ce.startsWith("auto_")){const ot=Ge.target.closest("[data-editor-path]")?.getAttribute("data-editor-path");if(ot){const We=ih(d.components,ot);if(We){N(We),Ge.dataTransfer.effectAllowed="move",Ge.dataTransfer.setData("text/plain",`path:${ot}`),yn.log("Drag started (path-based):",ot);return}}yn.warn("Auto-generated component without valid path:",Ce),Ge.dataTransfer.effectAllowed="none";return}const it=(bt,Ct)=>{for(const ot of bt){if(typeof ot=="string")continue;const We=ot;if(We.id===Ct)return We;if(We.children){const nn=it(We.children,Ct);if(nn)return nn}}return null},ft=it(d.components,Ce);ft?(N(ft),Ge.dataTransfer.effectAllowed="move",Ge.dataTransfer.setData("text/plain",Ce),yn.log("Drag started (id-based):",Ce)):(yn.warn("Component not found for drag:",Ce),Ge.dataTransfer.effectAllowed="none")},[d,N]),Ee=j.useCallback(Ce=>{le.current&&(cancelAnimationFrame(le.current),le.current=null),M(),yn.log("Drag ended")},[M]),Oe=j.useMemo(()=>f==="custom"?p:dh[f].width,[f,p]),tt=j.useCallback(Ce=>{w(Ce),yn.log("Device changed:",Ce)},[w]),Me=j.useCallback(Ce=>{w("custom",Ce),yn.log("Custom width changed:",Ce)},[w]),qe=j.useCallback(Ce=>{const Ge=Ce.target;let it=null;if(Ge.hasAttribute("data-editor-id")?it=Ge:it=Ge.closest("[data-editor-id]"),it){const ft=it.getAttribute("data-editor-id");ft&&(v(ft),n?.(ft),yn.log("Component selected:",ft))}else v(null),n?.(null)},[v,n]),zt=j.useCallback(Ce=>{const Ge=Ce.target;let it=null;if(Ge.hasAttribute("data-editor-id")?it=Ge:it=Ge.closest("[data-editor-id]"),it){const ft=it.getAttribute("data-editor-id");ft&&ft!==y&&(C(ft),a?.(ft))}},[y,C,a]),Et=j.useCallback(()=>{C(null),a?.(null)},[C,a]),$t=j.useCallback(Ce=>{Ce.preventDefault();const Ge=Ce.dataTransfer.getData("text/plain"),ft=Ce.target.closest("[data-editor-id]");if(ft&&Ge){let bt=ft.getAttribute("data-editor-id");const Ct=ft.getAttribute("data-editor-path");if(bt?.startsWith("auto_")&&Ct&&d?.components){const W=d.components,ve=ih(W,Ct);ve?.id?bt=ve.id:yn.log("Target is auto ID, will use path-based move")}const ot=ft.getBoundingClientRect(),We=Ce.clientY-ot.top,nn=ot.height;let Nt;We<nn*.25?Nt="before":We>nn*.75?Nt="after":Nt="inside";const It=Ge.startsWith("path:"),an=It?Ge.substring(5):null,_a=bt?.startsWith("auto_");It&&Ct&&_a?(yn.log("Both source and target are path-based:",an,"->",Ct),an&&Ct&&an!==Ct&&he(an,Ct,Nt)&&(i?.(bt||"",Nt),yn.log("Component moved (both path-based):",an,"->",Ct,Nt))):It&&bt&&!_a?an&&Y(an,bt,Nt)&&(i?.(bt,Nt),yn.log("Component moved (source path, target id):",an,"->",bt,Nt)):!It&&bt&&Ge!==bt&&(R(Ge,bt,Nt),i?.(bt,Nt),yn.log("Component moved (id-based):",Ge,"->",bt,Nt))}M()},[d,R,M,i,Y,he]),kt=j.useCallback((Ce,Ge)=>{if(le.current)return;const it=()=>{Ce.scrollTop+=Ge,le.current=requestAnimationFrame(it)};le.current=requestAnimationFrame(it)},[]),tn=j.useCallback(()=>{le.current&&(cancelAnimationFrame(le.current),le.current=null)},[]),Vt=j.useCallback(Ce=>{Ce.preventDefault(),Ce.dataTransfer.dropEffect="move";const Ge=o.current;if(!Ge)return;const it=Ge.getBoundingClientRect(),ft=Ce.clientY;ft-it.top<je?kt(Ge,-J):it.bottom-ft<je?kt(Ge,J):tn();const Ct=Ce.target.closest("[data-editor-id]");if(Ct){const ot=Ct.getAttribute("data-editor-id");if(ot){const We=Ct.getBoundingClientRect(),nn=Ce.clientY-We.top,Nt=We.height;let It;nn<Nt*.25?It="before":nn>Nt*.75?It="after":It="inside",D(ot,It)}}},[D,kt,tn,je,J]),oa=()=>g==="loading"?l.jsx(pE,{}):h?l.jsx(mE,{message:h}):d?!ge||!F.current||!Q.current||!pe.current||!$.current?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 dark:text-gray-400",children:[l.jsx("div",{className:"animate-spin text-4xl mb-4",children:"⏳"}),l.jsx("p",{className:"text-sm",children:"렌더링 엔진 초기화 중..."})]}):l.jsx(Dc,{translationEngine:pe.current,translationContext:U,children:l.jsx(ug,{children:l.jsx(gg,{overrideWidth:Oe,children:l.jsx(Og,{children:d.components.map((Ce,Ge)=>{if(typeof Ce=="string")return null;const it=Ce;return l.jsx(Ba,{componentDef:it,dataContext:q,translationContext:U,onDragStart:we,onDragEnd:Ee,registry:F.current,bindingEngine:Q.current,translationEngine:pe.current,actionDispatcher:$.current,isEditMode:!0,onComponentSelect:ie,onComponentHover:se,isRootRenderer:!0,componentPath:`${Ge}`},it.id||`component-${Ge}`)})})})})}):l.jsx(fE,{});return l.jsxs("div",{className:`flex flex-col h-full bg-gray-50 dark:bg-gray-950 ${r}`,children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-800",children:[l.jsx(dE,{currentDevice:f,customWidth:p,onDeviceChange:tt,onCustomWidthChange:Me}),l.jsx(uE,{zoom:be,onZoomChange:X})]}),l.jsxs("div",{ref:o,className:"flex-1 overflow-auto p-8 relative",onClick:qe,onMouseMove:zt,onMouseLeave:Et,onDrop:$t,onDragOver:Vt,children:[l.jsx(yE,{width:Oe,zoom:be,children:oa()}),e&&d&&l.jsx(hE,{selectedId:x,hoveredId:y,containerRef:o,zoom:be}),L&&l.jsx(gE,{targetId:L,position:z,containerRef:o})]}),l.jsxs("div",{className:"flex items-center justify-between px-4 py-1 text-xs border-t border-gray-200 dark:border-gray-800 bg-gray-100 dark:bg-gray-900 text-gray-500 dark:text-gray-400",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{children:[f==="custom"?p:dh[f].width,"px"]}),l.jsxs("span",{children:["Zoom: ",be,"%"]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[x&&l.jsxs("span",{children:["선택됨: ",l.jsx("span",{className:"text-blue-500",children:x})]}),d&&l.jsxs("span",{children:[d.components.length,"개 컴포넌트"]})]})]})]})}const Px={Div:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],Span:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],Button:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"type",type:"select",label:"버튼 타입",options:[{label:"Button",value:"button"},{label:"Submit",value:"submit"},{label:"Reset",value:"reset"}]},{name:"disabled",type:"boolean",label:"비활성화",allowBinding:!0}],Input:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"type",type:"select",label:"입력 타입",options:[{label:"Text",value:"text"},{label:"Password",value:"password"},{label:"Email",value:"email"},{label:"Number",value:"number"},{label:"Tel",value:"tel"},{label:"Date",value:"date"},{label:"Hidden",value:"hidden"}]},{name:"name",type:"text",label:"Name",required:!0},{name:"placeholder",type:"text",label:"Placeholder",allowBinding:!0},{name:"disabled",type:"boolean",label:"비활성화",allowBinding:!0},{name:"required",type:"boolean",label:"필수"}],Label:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"htmlFor",type:"text",label:"For (ID)"}],Image:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"src",type:"text",label:"이미지 URL",required:!0,allowBinding:!0},{name:"alt",type:"text",label:"대체 텍스트",allowBinding:!0}],Link:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"href",type:"text",label:"URL",allowBinding:!0},{name:"target",type:"select",label:"열기 방식",options:[{label:"현재 창",value:"_self"},{label:"새 창",value:"_blank"}]}],Icon:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"name",type:"icon",label:"아이콘 이름",required:!0},{name:"size",type:"select",label:"크기",options:[{label:"xs",value:"xs"},{label:"sm",value:"sm"},{label:"md",value:"md"},{label:"lg",value:"lg"},{label:"xl",value:"xl"}]}],H1:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],H2:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],H3:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],H4:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],H5:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],H6:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],P:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}],Form:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"dataKey",type:"text",label:"데이터 키",required:!0}],Select:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"name",type:"text",label:"Name",required:!0},{name:"placeholder",type:"text",label:"Placeholder"},{name:"disabled",type:"boolean",label:"비활성화",allowBinding:!0}],Textarea:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"name",type:"text",label:"Name",required:!0},{name:"placeholder",type:"text",label:"Placeholder",allowBinding:!0},{name:"rows",type:"number",label:"행 수",defaultValue:3},{name:"disabled",type:"boolean",label:"비활성화",allowBinding:!0}],Card:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"title",type:"text",label:"제목",allowBinding:!0}],Modal:[{name:"id",type:"text",label:"모달 ID",required:!0},{name:"title",type:"text",label:"제목",allowBinding:!0},{name:"size",type:"select",label:"크기",options:[{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"},{label:"XLarge",value:"xl"},{label:"Full",value:"full"}]}],DataGrid:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"columns",type:"array",label:"컬럼 정의",required:!0},{name:"data",type:"expression",label:"데이터",required:!0,allowBinding:!0},{name:"rowKey",type:"text",label:"행 키",defaultValue:"id"}],PageHeader:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"title",type:"text",label:"제목",allowBinding:!0},{name:"description",type:"text",label:"설명",allowBinding:!0}],Pagination:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"current",type:"expression",label:"현재 페이지",allowBinding:!0},{name:"total",type:"expression",label:"전체 항목 수",allowBinding:!0},{name:"perPage",type:"number",label:"페이지당 항목 수",defaultValue:10}],Tabs:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"defaultTab",type:"text",label:"기본 탭"}],Tab:[{name:"id",type:"text",label:"탭 ID",required:!0},{name:"label",type:"text",label:"탭 레이블",required:!0,allowBinding:!0}],Alert:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"type",type:"select",label:"타입",options:[{label:"Info",value:"info"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Error",value:"error"}]},{name:"dismissible",type:"boolean",label:"닫기 가능"}],Container:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"maxWidth",type:"select",label:"최대 너비",options:[{label:"sm",value:"sm"},{label:"md",value:"md"},{label:"lg",value:"lg"},{label:"xl",value:"xl"},{label:"2xl",value:"2xl"},{label:"Full",value:"full"}]}],Grid:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"cols",type:"number",label:"컬럼 수",defaultValue:1},{name:"gap",type:"number",label:"간격",defaultValue:4}],Flex:[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0},{name:"direction",type:"select",label:"방향",options:[{label:"Row",value:"row"},{label:"Column",value:"col"},{label:"Row Reverse",value:"row-reverse"},{label:"Column Reverse",value:"col-reverse"}]},{name:"justify",type:"select",label:"주축 정렬",options:[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Between",value:"between"},{label:"Around",value:"around"},{label:"Evenly",value:"evenly"}]},{name:"align",type:"select",label:"교차축 정렬",options:[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"},{label:"Baseline",value:"baseline"}]},{name:"gap",type:"number",label:"간격",defaultValue:0}]};function Fo(){const r=Se(x=>x.componentCategories),e=Se(x=>x.handlers),n=j.useMemo(()=>r?[...r.basic,...r.composite,...r.layout]:[],[r]),a=j.useMemo(()=>r?.extension||[],[r]),i=j.useCallback(x=>n.find(y=>y.name===x)||null,[n]),o=j.useCallback(x=>{if(Px[x])return Px[x];const y=i(x);return y?.props?y.props.map(w=>({name:w,type:"text",label:w,allowBinding:!0})):[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}]},[i]),d=j.useCallback(x=>{const y=x.toLowerCase(),w=n.filter(C=>C.name.toLowerCase().includes(y)||C.description?.toLowerCase().includes(y)),v=a.filter(C=>C.name.toLowerCase().includes(y)||C.description?.toLowerCase().includes(y)||C.source.toLowerCase().includes(y));return[...w,...v]},[n,a]),g=j.useCallback(x=>r?x==="extension"?r.extension:r[x]:[],[r]),h=j.useCallback(x=>{const y=i(x);return y?.allowsChildren!==void 0?y.allowsChildren:y?.type==="layout"||y?.type==="composite"?!0:["Div","Span","Button","Form","Label","Link"].includes(x)},[i]),f=j.useCallback(x=>e.find(y=>y.name===x)||null,[e]),p=j.useCallback(x=>e.filter(y=>y.category===x),[e]);return{categories:r,allComponents:n,extensionComponents:a,handlers:e,getMetadata:i,getPropsSchema:o,searchComponents:d,filterByCategory:g,allowsChildren:h,getHandler:f,filterHandlersByCategory:p}}const Ux=at("PropsEditor");function Bx({schema:r,value:e,onChange:n}){const[a,i]=j.useState(typeof e=="string"&&e.includes("{{")),o=j.useCallback(h=>{n(h.target.value)},[n]),d=r.type==="textarea",g=typeof e=="string"?e:"";return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsxs("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsx("button",{type:"button",className:`text-xs px-1.5 py-0.5 rounded ${a?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,onClick:()=>i(!a),title:"바인딩 표현식 사용",children:"{{}}"})]}),d?l.jsx("textarea",{value:g,onChange:o,placeholder:r.placeholder||`${r.name} 입력`,rows:3,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 resize-none"}):l.jsx("input",{type:"text",value:g,onChange:o,placeholder:r.placeholder||`${r.name} 입력`,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),r.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description}),a&&l.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["바인딩 예시: ","{{users.data[0].name}}"]})]})}function xE({schema:r,value:e,onChange:n}){const a=j.useCallback(o=>{const d=parseFloat(o.target.value);n(isNaN(d)?void 0:d)},[n]),i=typeof e=="number"?e:"";return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsx("input",{type:"number",value:i,onChange:a,placeholder:r.placeholder||"0",min:r.min,max:r.max,step:r.step||1,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),r.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function bE({schema:r,value:e,onChange:n}){const a=j.useCallback(o=>{n(o.target.checked)},[n]),i=!!e;return l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("input",{type:"checkbox",id:`prop-${r.name}`,checked:i,onChange:a,className:"mt-0.5 w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:`prop-${r.name}`,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r.label||r.name}),r.description&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r.description})]})]})}function vE({schema:r,value:e,onChange:n}){const a=j.useCallback(d=>{n(d.target.value||void 0)},[n]),i=typeof e=="string"?e:"",o=r.options||[];return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsxs("select",{value:i,onChange:a,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[l.jsx("option",{value:"",children:"선택하세요"}),o.map(d=>l.jsx("option",{value:d.value,children:d.label},d.value))]}),r.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function SE({schema:r,value:e,onChange:n}){const a=j.useCallback(o=>{n(o.target.value)},[n]),i=typeof e=="string"?e:"#000000";return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"color",value:i,onChange:a,className:"w-10 h-10 p-0 border border-gray-300 dark:border-gray-600 rounded cursor-pointer"}),l.jsx("input",{type:"text",value:i,onChange:a,placeholder:"#000000",className:"flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white font-mono"})]}),r.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function wE({schema:r,value:e,onChange:n}){const a=j.useCallback(d=>{n(d.target.value)},[n]),i=typeof e=="string"?e:"",o=i.split(/\s+/).filter(Boolean);return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsx("textarea",{value:i,onChange:a,placeholder:"space-y-4 p-4 bg-white dark:bg-gray-800",rows:3,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono resize-none"}),o.length>0&&l.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[o.slice(0,10).map((d,g)=>l.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded",children:d},g)),o.length>10&&l.jsxs("span",{className:"px-1.5 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",o.length-10,"개 더"]})]}),r.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function CE({schema:r,value:e,onChange:n}){j.useCallback(i=>{n(i.target.value)},[n]);const a=typeof e=="string"?e:"";return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsxs("div",{className:"relative",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 text-sm",children:"{{"}),l.jsx("input",{type:"text",value:a.replace(/^\{\{|\}\}$/g,""),onChange:i=>n(`{{${i.target.value}}}`),placeholder:"expression",className:"w-full pl-8 pr-8 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono"}),l.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 text-sm",children:"}}"})]}),r.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function qx({schema:r,value:e,onChange:n}){const[a,i]=j.useState(null),o=j.useCallback(g=>{const h=g.target.value;try{const f=JSON.parse(h);n(f),i(null)}catch{i("유효한 JSON이 아닙니다")}},[n]),d=j.useMemo(()=>{try{return JSON.stringify(e,null,2)}catch{return""}},[e]);return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[r.label||r.name,r.required&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),l.jsx("textarea",{value:d,onChange:o,placeholder:"{}",rows:4,className:`w-full px-3 py-2 text-sm border rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono resize-none ${a?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600"}`}),a&&l.jsx("p",{className:"mt-1 text-xs text-red-500 dark:text-red-400",children:a}),r.description&&!a&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function jE(r,e,n){const a={schema:r,value:e,onChange:n};switch(r.type){case"text":case"textarea":return l.jsx(Bx,{...a});case"number":return l.jsx(xE,{...a});case"boolean":return l.jsx(bE,{...a});case"select":return l.jsx(vE,{...a});case"color":return l.jsx(SE,{...a});case"className":return l.jsx(wE,{...a});case"expression":return l.jsx(CE,{...a});case"object":return l.jsx(qx,{...a});default:return l.jsx(Bx,{...a})}}function Gx({component:r,onChange:e}){const{getPropsSchema:n}=Fo(),a=j.useMemo(()=>n(r.name),[r.name,n]),i=r.props||{},o=j.useCallback((g,h)=>{const f={...i,[g]:h};(h===void 0||h==="")&&delete f[g],e({props:f}),Ux.log("Prop changed:",g,h)},[i,e]),d=j.useCallback(g=>{e({text:g||void 0}),Ux.log("Text changed:",g)},[e]);return l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"텍스트 (text)"}),l.jsx("input",{type:"text",value:r.text||"",onChange:g=>d(g.target.value),placeholder:"컴포넌트 텍스트 내용",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),l.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:["$t:key 또는 ","{{expression}}"," 사용 가능"]})]}),l.jsx("hr",{className:"border-gray-200 dark:border-gray-700"}),a.length>0?a.map(g=>l.jsx("div",{children:jE(g,i[g.name],h=>o(g.name,h))},g.name)):l.jsxs("div",{className:"text-center py-4 text-gray-400 dark:text-gray-500",children:[l.jsx("p",{className:"text-sm",children:"이 컴포넌트의 props 스키마가 정의되지 않았습니다."}),l.jsx("p",{className:"text-xs mt-1",children:"Raw JSON으로 편집하세요."})]}),l.jsx("hr",{className:"border-gray-200 dark:border-gray-700"}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase mb-2",children:"모든 Props (Raw JSON)"}),l.jsx(qx,{schema:{name:"props",type:"object",label:"Props",description:"컴포넌트의 모든 속성을 JSON으로 직접 편집"},value:i,onChange:g=>{typeof g=="object"&&g!==null&&e({props:g})}})]})]})}function gh(r){const e=r.match(/\{\{(.+?)\}\}/);return e?e[1].trim():null}function dd(r){return typeof r=="string"&&r.includes("{{")}function hh(r){return`{{${r}}}`}function kE({sources:r,selectedPath:e,onSelect:n}){const[a,i]=j.useState(null);return l.jsx("div",{className:"space-y-2",children:r.map(o=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded",children:[l.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",onClick:()=>i(a===o.id?null:o.id),children:[l.jsx("span",{children:o.icon}),l.jsx("span",{className:"flex-1 text-left font-medium text-gray-700 dark:text-gray-300",children:o.label}),l.jsx("span",{className:"text-gray-400",children:a===o.id?"▼":"▶"})]}),a===o.id&&l.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 max-h-40 overflow-auto",children:o.paths.length>0?o.paths.map(d=>{const g=o.type==="dataSource"?`${o.id}.${d}`:d,h=e===g;return l.jsx("button",{className:`w-full px-4 py-1.5 text-xs text-left hover:bg-gray-100 dark:hover:bg-gray-700 ${h?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400"}`,onClick:()=>n(g),children:l.jsx("code",{className:"font-mono",children:d})},d)}):l.jsx("div",{className:"px-4 py-2 text-xs text-gray-400 dark:text-gray-500",children:"사용 가능한 경로가 없습니다"})})]},o.id))})}function NE({isOpen:r,propKey:e,currentValue:n,sources:a,onSave:i,onCancel:o}){const[d,g]=j.useState("simple"),[h,f]=j.useState(()=>gh(n)||""),[p,x]=j.useState(()=>gh(n)||""),y=j.useCallback(()=>{const v=d==="simple"?h:p;i(v?hh(v):"")},[d,h,p,i]),w=j.useCallback(v=>{f(v),x(v)},[]);return r?l.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-lg mx-4",children:[l.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:l.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:["바인딩 편집: ",e]})}),l.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{className:`px-3 py-1.5 text-sm rounded ${d==="simple"?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onClick:()=>g("simple"),children:"단순 모드"}),l.jsx("button",{className:`px-3 py-1.5 text-sm rounded ${d==="advanced"?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onClick:()=>g("advanced"),children:"고급 모드"})]})}),l.jsx("div",{className:"p-4 max-h-96 overflow-auto",children:d==="simple"?l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"바인딩할 데이터 소스를 선택하세요:"}),l.jsx(kE,{sources:a,selectedPath:h,onSelect:w}),h&&l.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-900 rounded",children:[l.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"미리보기:"}),l.jsx("code",{className:"block mt-1 text-sm text-blue-600 dark:text-blue-400 font-mono",children:hh(h)})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"표현식을 직접 입력하세요:"}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"표현식 (중괄호 없이)"}),l.jsx("input",{type:"text",value:p,onChange:v=>x(v.target.value),placeholder:"users?.data?.total ?? 0",className:"w-full px-3 py-2 text-sm font-mono border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 space-y-1",children:[l.jsx("p",{children:"지원되는 문법:"}),l.jsxs("ul",{className:"list-disc list-inside ml-2",children:[l.jsxs("li",{children:["Optional Chaining: ",l.jsx("code",{children:"users?.data"})]}),l.jsxs("li",{children:["Nullish Coalescing: ",l.jsx("code",{children:"value ?? 'default'"})]}),l.jsxs("li",{children:["삼항 연산자: ",l.jsx("code",{children:"condition ? a : b"})]})]})]}),p&&l.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-900 rounded",children:[l.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"미리보기:"}),l.jsx("code",{className:"block mt-1 text-sm text-blue-600 dark:text-blue-400 font-mono",children:hh(p)})]})]})}),l.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-700 flex justify-end gap-2",children:[l.jsx("button",{className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:o,children:"취소"}),l.jsx("button",{className:"px-4 py-2 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",onClick:y,children:"적용"})]})]})}):null}function EE({binding:r,onEdit:e,onRemove:n}){const a=gh(r.value);return l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 group",children:l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:r.key}),l.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded",children:r.type})]}),l.jsx("code",{className:"block mt-1 text-xs text-blue-600 dark:text-blue-400 font-mono truncate",children:r.value}),a&&l.jsxs("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:["경로: ",l.jsx("code",{className:"font-mono",children:a})]})]}),l.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{className:"p-1 text-gray-400 hover:text-blue-500",onClick:e,title:"편집",children:"✏️"}),l.jsx("button",{className:"p-1 text-gray-400 hover:text-red-500",onClick:n,title:"바인딩 제거",children:"🗑️"})]})]})})}function _E({component:r,onChange:e}){const[n,a]=j.useState(null),[i,o]=j.useState(!1),[d,g]=j.useState(""),h=Se(N=>N.layoutData),f=Se(N=>N.mockDataContext),p=j.useMemo(()=>h?{dataSources:h.data_sources||[],globalState:Object.keys(f._global||{}),localState:Object.keys(f._local||{}),routeParams:["id","slug"],queryParams:["page","per_page","search","sort","order"],defines:h.defines||{},computed:h.computed||{}}:{dataSources:[],globalState:[],localState:[],routeParams:["id","slug"],queryParams:["page","per_page","search","sort","order"],defines:{},computed:{}},[h,f]),{getMetadata:x}=Fo(),y=x(r.name),w=j.useMemo(()=>{const N=[];return r.props&&Object.entries(r.props).forEach(([D,M])=>{dd(M)&&N.push({key:D,value:M,type:"prop"})}),r.text&&dd(r.text)&&N.push({key:"text",value:r.text,type:"text"}),r.if&&dd(r.if)&&N.push({key:"if",value:r.if,type:"if"}),r.iteration?.source&&dd(r.iteration.source)&&N.push({key:"iteration.source",value:r.iteration.source,type:"iteration"}),N},[r]),v=j.useMemo(()=>{const N=new Set(w.filter(M=>M.type==="prop").map(M=>M.key));return(y?.props?Object.keys(y.props):[]).filter(M=>!N.has(M))},[w,y]),C=j.useMemo(()=>{const N=[];return p.dataSources.forEach(D=>{N.push({id:D.id,label:D.id,icon:"📡",type:"dataSource",paths:["data","loading","error","data.items","data.total","data.per_page"]})}),p.globalState.length>0&&N.push({id:"_global",label:"Global State",icon:"🌐",type:"global",paths:p.globalState.map(D=>`_global.${D}`)}),p.localState.length>0&&N.push({id:"_local",label:"Local State",icon:"📍",type:"local",paths:p.localState.map(D=>`_local.${D}`)}),N.push({id:"route",label:"Route Params",icon:"🛤️",type:"route",paths:p.routeParams.map(D=>`route.${D}`)}),N.push({id:"query",label:"Query Params",icon:"❓",type:"query",paths:p.queryParams.map(D=>`query.${D}`)}),Object.keys(p.defines).length>0&&N.push({id:"defines",label:"Defines",icon:"📝",type:"defines",paths:Object.keys(p.defines).map(D=>`defines.${D}`)}),Object.keys(p.computed).length>0&&N.push({id:"computed",label:"Computed",icon:"⚡",type:"computed",paths:Object.keys(p.computed).map(D=>`computed.${D}`)}),N},[p]),k=j.useCallback((N,D)=>{const M={};N==="text"?M.text=D||void 0:N==="if"?M.if=D||void 0:N==="iteration.source"?M.iteration=D?{...r.iteration,source:D,item_var:r.iteration?.item_var||"item"}:void 0:(M.props={...r.props,[N]:D||void 0},!D&&M.props&&delete M.props[N]),e(M),a(null),o(!1),g("")},[r,e]),A=j.useCallback(N=>{k(N.key,"")},[k]),R=j.useCallback(()=>{d&&(a(d),o(!1))},[d]);return l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("p",{children:"데이터 바인딩을 설정하여 동적 데이터를 컴포넌트에 연결합니다."}),l.jsxs("p",{className:"mt-1 text-xs",children:["문법: ",l.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"{{expression}}"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:["현재 바인딩 (",w.length,")"]}),l.jsx("button",{className:"text-xs text-blue-500 hover:text-blue-600",onClick:()=>o(!0),children:"+ 바인딩 추가"})]}),w.length>0?l.jsx("div",{className:"space-y-2",children:w.map(N=>l.jsx(EE,{binding:N,onEdit:()=>a(N.key),onRemove:()=>A(N)},`${N.type}-${N.key}`))}):l.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:l.jsx("p",{children:"설정된 바인딩이 없습니다"})})]}),i&&l.jsxs("div",{className:"p-3 border border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 rounded",children:[l.jsx("label",{className:"block text-xs text-gray-700 dark:text-gray-300 mb-2",children:"바인딩할 속성 선택"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("select",{value:d,onChange:N=>g(N.target.value),className:"flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[l.jsx("option",{value:"",children:"속성 선택..."}),l.jsx("option",{value:"text",children:"text (텍스트)"}),l.jsx("option",{value:"if",children:"if (조건부 렌더링)"}),l.jsx("option",{value:"iteration.source",children:"iteration.source (반복 소스)"}),v.map(N=>l.jsx("option",{value:N,children:N},N))]}),l.jsx("button",{className:"px-3 py-2 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",onClick:R,disabled:!d,children:"다음"}),l.jsx("button",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:()=>{o(!1),g("")},children:"취소"})]})]}),l.jsx(NE,{isOpen:n!==null,propKey:n||"",currentValue:n&&w.find(N=>N.key===n)?.value||"",sources:C,onSave:N=>n&&k(n,N),onCancel:()=>a(null)})]})}const TE=[{value:"navigate",label:"navigate",description:"페이지 이동"},{value:"navigateBack",label:"navigateBack",description:"브라우저 뒤로가기"},{value:"navigateForward",label:"navigateForward",description:"브라우저 앞으로가기"},{value:"apiCall",label:"apiCall",description:"API 호출"},{value:"login",label:"login",description:"로그인 (토큰 저장)"},{value:"logout",label:"logout",description:"로그아웃"},{value:"setState",label:"setState",description:"상태 변경"},{value:"setError",label:"setError",description:"에러 상태 설정"},{value:"openModal",label:"openModal",description:"모달 열기"},{value:"closeModal",label:"closeModal",description:"모달 닫기"},{value:"showAlert",label:"showAlert",description:"알림 표시"},{value:"toast",label:"toast",description:"토스트 알림"},{value:"switch",label:"switch",description:"조건 분기"},{value:"sequence",label:"sequence",description:"순차 실행"},{value:"parallel",label:"parallel",description:"병렬 실행"},{value:"showErrorPage",label:"showErrorPage",description:"에러 페이지 표시"},{value:"loadScript",label:"loadScript",description:"외부 스크립트 로드"},{value:"callExternal",label:"callExternal",description:"외부 함수 호출"},{value:"callExternalEmbed",label:"callExternalEmbed",description:"외부 임베드"},{value:"saveToLocalStorage",label:"saveToLocalStorage",description:"로컬스토리지 저장"},{value:"loadFromLocalStorage",label:"loadFromLocalStorage",description:"로컬스토리지 로드"},{value:"appendDataSource",label:"appendDataSource",description:"데이터소스 병합 (무한스크롤용)"},{value:"scrollIntoView",label:"scrollIntoView",description:"요소로 스크롤"},{value:"refetchDataSource",label:"refetchDataSource",description:"데이터소스 재조회"},{value:"remount",label:"remount",description:"컴포넌트 재마운트"},{value:"custom",label:"custom",description:"커스텀 액션"}],AE=[{value:"click",label:"click",description:"클릭"},{value:"change",label:"change",description:"값 변경"},{value:"input",label:"input",description:"입력"},{value:"submit",label:"submit",description:"폼 제출"},{value:"keydown",label:"keydown",description:"키 누름"},{value:"keyup",label:"keyup",description:"키 뗌"},{value:"focus",label:"focus",description:"포커스"},{value:"blur",label:"blur",description:"블러"},{value:"mount",label:"mount",description:"마운트"},{value:"unmount",label:"unmount",description:"언마운트"},{value:"scroll",label:"scroll",description:"스크롤 (무한스크롤용)"}];function DE({component:r,onChange:e}){const[n,a]=j.useState(null),[i,o]=j.useState(!1),d=j.useMemo(()=>r.actions||[],[r.actions]),g=j.useCallback(()=>{const y={type:"click",handler:"navigate",params:{}},w=[...d,y];e({actions:w}),a(w.length-1),o(!1)},[d,e]),h=j.useCallback(y=>{const w=d.filter((v,C)=>C!==y);e({actions:w.length>0?w:void 0}),n===y?a(null):n!==null&&n>y&&a(n-1)},[d,n,e]),f=j.useCallback((y,w)=>{const v=d.map((C,k)=>k===y?{...C,...w}:C);e({actions:v})},[d,e]),p=j.useCallback(y=>{const w=d[y],v=JSON.parse(JSON.stringify(w)),C=[...d.slice(0,y+1),v,...d.slice(y+1)];e({actions:C})},[d,e]),x=j.useCallback((y,w)=>{const v=w==="up"?y-1:y+1;if(v<0||v>=d.length)return;const C=[...d];[C[y],C[v]]=[C[v],C[y]],e({actions:C}),n===y?a(v):n===v&&a(y)},[d,n,e]);return l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"이벤트 핸들러를 설정하여 사용자 상호작용에 반응합니다."}),d.length>0?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:["등록된 액션 (",d.length,")"]}),d.map((y,w)=>l.jsx(RE,{action:y,index:w,isEditing:n===w,isFirst:w===0,isLast:w===d.length-1,onEdit:()=>a(n===w?null:w),onDelete:()=>h(w),onDuplicate:()=>p(w),onMove:v=>x(w,v),onUpdate:v=>f(w,v)},w))]}):l.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[l.jsx("p",{children:"등록된 액션이 없습니다"}),l.jsx("p",{className:"text-xs mt-1",children:"아래 버튼을 클릭하여 액션을 추가하세요"})]}),i?l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:g,className:"flex-1 px-3 py-2 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 transition-colors",children:"기본 액션 추가"}),l.jsx("button",{onClick:()=>o(!1),className:"px-3 py-2 text-gray-600 dark:text-gray-400 text-sm rounded border border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:"취소"})]}):l.jsx("button",{onClick:()=>o(!0),className:"w-full px-3 py-2 border-2 border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 text-sm rounded hover:border-blue-400 hover:text-blue-500 transition-colors",children:"+ 액션 추가"})]})}function RE({action:r,index:e,isEditing:n,isFirst:a,isLast:i,onEdit:o,onDelete:d,onDuplicate:g,onMove:h,onUpdate:f}){const p=r.event||r.type||"click",x=!!r.event;return l.jsxs("div",{className:`rounded border transition-colors ${n?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800"}`,children:[l.jsxs("div",{className:"p-2 flex items-center gap-2 cursor-pointer",onClick:o,children:[l.jsx("span",{className:"w-5 h-5 flex items-center justify-center text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-200 dark:bg-gray-700 rounded",children:e+1}),l.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded ${x?"text-purple-600 dark:text-purple-400 bg-purple-100 dark:bg-purple-900/30":"text-blue-600 dark:text-blue-400 bg-blue-100 dark:bg-blue-900/30"}`,children:p}),l.jsx("span",{className:"text-xs text-gray-400",children:"→"}),l.jsx("span",{className:"text-xs font-medium text-green-600 dark:text-green-400",children:r.handler}),r.target&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-xs text-gray-400",children:":"}),l.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 truncate max-w-[100px]",children:r.target})]}),(r.onSuccess||r.onError)&&l.jsx("span",{className:"text-xs text-orange-500 dark:text-orange-400",children:"+chain"}),r.confirm&&l.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"⚠️"}),r.debounce&&l.jsxs("span",{className:"text-xs text-purple-500 dark:text-purple-400",title:"Debounce 적용됨",children:["⏱️",typeof r.debounce=="number"?r.debounce:r.debounce.delay,"ms"]}),l.jsx("span",{className:"ml-auto text-gray-400",children:n?"▼":"▶"})]}),n&&l.jsxs("div",{className:"p-3 border-t border-gray-200 dark:border-gray-700 space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"이벤트 타입"}),l.jsx("div",{className:"flex gap-2",children:l.jsxs("select",{value:r.event?"custom":r.type||"click",onChange:y=>{const w=y.target.value;f(w==="custom"?{type:"click",event:"onChange"}:{type:w,event:void 0})},className:"flex-1 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[AE.map(y=>l.jsxs("option",{value:y.value,children:[y.label," (",y.description,")"]},y.value)),l.jsx("option",{value:"custom",children:"커스텀 이벤트"})]})}),r.event&&l.jsx("input",{type:"text",value:r.event,onChange:y=>f({event:y.target.value}),placeholder:"이벤트명 (예: onChange, onRowAction)",className:"mt-2 w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"핸들러"}),l.jsx("select",{value:r.handler,onChange:y=>f({handler:y.target.value}),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:TE.map(y=>l.jsxs("option",{value:y.value,children:[y.label," - ",y.description]},y.value))})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Target (선택)"}),l.jsx("input",{type:"text",value:r.target||"",onChange:y=>f({target:y.target.value||void 0}),placeholder:"URL, 모달 ID, API 엔드포인트 등",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),l.jsx(OE,{params:r.params||{},onChange:y=>f({params:y}),handler:r.handler}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"확인 메시지 (선택)"}),l.jsx("input",{type:"text",value:r.confirm||"",onChange:y=>f({confirm:y.target.value||void 0}),placeholder:"실행 전 확인 대화상자 메시지",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),(r.type==="keydown"||r.type==="keyup")&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"키 필터"}),l.jsx("input",{type:"text",value:r.key||"",onChange:y=>f({key:y.target.value||void 0}),placeholder:"Enter, Escape, ArrowDown 등",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),l.jsx(LE,{debounce:r.debounce,onChange:y=>f({debounce:y})}),(r.onSuccess||r.onError)&&l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 p-2 bg-gray-100 dark:bg-gray-700 rounded",children:[l.jsxs("p",{children:[l.jsx("span",{className:"text-green-600 dark:text-green-400",children:"onSuccess:"})," ",r.onSuccess?Array.isArray(r.onSuccess)?`${r.onSuccess.length}개 액션`:"1개 액션":"없음"]}),l.jsxs("p",{children:[l.jsx("span",{className:"text-red-600 dark:text-red-400",children:"onError:"})," ",r.onError?Array.isArray(r.onError)?`${r.onError.length}개 액션`:"1개 액션":"없음"]})]}),l.jsxs("div",{className:"flex gap-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[l.jsx("button",{onClick:()=>h("up"),disabled:a,className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"위로 이동",children:"↑"}),l.jsx("button",{onClick:()=>h("down"),disabled:i,className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"아래로 이동",children:"↓"}),l.jsx("button",{onClick:g,className:"px-2 py-1 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300",title:"복제",children:"복제"}),l.jsx("button",{onClick:d,className:"px-2 py-1 text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 ml-auto",title:"삭제",children:"삭제"})]})]})]})}function OE({params:r,onChange:e,handler:n}){const[a,i]=j.useState(""),[o,d]=j.useState(""),g=j.useMemo(()=>{switch(n){case"navigate":return["path","query","mergeQuery","replace"];case"apiCall":return["method","body","headers"];case"setState":return["target","merge"];case"toast":return["type","message"];case"openModal":return[];case"closeModal":return[];case"showErrorPage":return["errorCode","target","containerId","layout"];case"refetchDataSource":return["dataSourceId"];case"remount":return["componentId"];case"appendDataSource":return["id","dataPath","sourcePath"];case"scrollIntoView":return["selector","behavior","block","scrollContainer","waitForElement"];case"switch":return["value"];case"sequence":case"parallel":return["actions"];default:return[]}},[n]),h=j.useCallback(()=>{if(!a.trim())return;const y={...r,[a.trim()]:o};e(y),i(""),d("")},[r,a,o,e]),f=j.useCallback(y=>{const{[y]:w,...v}=r;e(v)},[r,e]),p=j.useCallback((y,w)=>{const v={...r,[y]:w};e(v)},[r,e]),x=Object.entries(r);return l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"파라미터"}),x.length>0&&l.jsx("div",{className:"space-y-1 mb-2",children:x.map(([y,w])=>l.jsxs("div",{className:"flex gap-1 items-center",children:[l.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400 w-24 truncate",children:[y,":"]}),l.jsx("input",{type:"text",value:typeof w=="object"?JSON.stringify(w):String(w),onChange:v=>p(y,v.target.value),className:"flex-1 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),l.jsx("button",{onClick:()=>f(y),className:"text-red-500 hover:text-red-700 text-xs px-1",title:"삭제",children:"×"})]},y))}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("input",{type:"text",value:a,onChange:y=>i(y.target.value),placeholder:"키",list:`suggested-params-${n}`,className:"w-24 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),l.jsx("datalist",{id:`suggested-params-${n}`,children:g.filter(y=>!r[y]).map(y=>l.jsx("option",{value:y},y))}),l.jsx("input",{type:"text",value:o,onChange:y=>d(y.target.value),placeholder:"값",className:"flex-1 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",onKeyDown:y=>{y.key==="Enter"&&h()}}),l.jsx("button",{onClick:h,disabled:!a.trim(),className:"px-2 py-1 text-xs bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 rounded hover:bg-gray-300 dark:hover:bg-gray-500 disabled:opacity-50",children:"+"})]}),g.length>0&&l.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:["권장: ",g.join(", ")]})]})}function LE({debounce:r,onChange:e}){const[n,a]=j.useState(!1),i=typeof r=="number"?r:r?.delay||0,o=typeof r=="object"?r.leading??!1:!1,d=typeof r=="object"?r.trailing??!0:!0,g=r!==void 0&&i>0,h=j.useCallback(()=>{e(g?void 0:300)},[g,e]),f=j.useCallback(y=>{const w=parseInt(y,10);if(isNaN(w)||w<=0){e(void 0);return}e(n?{delay:w,leading:o,trailing:d}:w)},[n,o,d,e]),p=j.useCallback((y,w)=>{e({delay:i||300,leading:y==="leading"?w:o,trailing:y==="trailing"?w:d})},[i,o,d,e]),x=j.useCallback(()=>{!n&&g?e({delay:i,leading:!1,trailing:!0}):n&&g&&e(i),a(!n)},[n,g,i,e]);return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:"Debounce (연속 호출 제어)"}),l.jsx("button",{type:"button",onClick:h,className:`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${g?"bg-blue-500":"bg-gray-300 dark:bg-gray-600"}`,children:l.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${g?"translate-x-4":"translate-x-0"}`})})]}),g&&l.jsxs("div",{className:"space-y-2 mt-2 p-2 bg-gray-50 dark:bg-gray-800 rounded",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{className:"text-xs text-gray-600 dark:text-gray-400 w-16",children:"지연 시간"}),l.jsx("input",{type:"number",value:i,onChange:y=>f(y.target.value),min:0,step:100,placeholder:"300",className:"flex-1 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),l.jsx("span",{className:"text-xs text-gray-500",children:"ms"})]}),l.jsx("button",{type:"button",onClick:x,className:"text-xs text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-300",children:n?"▼ 고급 설정 숨기기":"▶ 고급 설정 보기"}),n&&l.jsxs("div",{className:"space-y-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"checkbox",id:"debounce-leading",checked:o,onChange:y=>p("leading",y.target.checked),className:"h-3 w-3 rounded border-gray-300 dark:border-gray-600"}),l.jsx("label",{htmlFor:"debounce-leading",className:"text-xs text-gray-600 dark:text-gray-400",children:"Leading (첫 호출 즉시 실행)"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"checkbox",id:"debounce-trailing",checked:d,onChange:y=>p("trailing",y.target.checked),className:"h-3 w-3 rounded border-gray-300 dark:border-gray-600"}),l.jsx("label",{htmlFor:"debounce-trailing",className:"text-xs text-gray-600 dark:text-gray-400",children:"Trailing (마지막 호출 후 실행)"})]}),l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"권장: change 이벤트에 300ms, 검색에 300~500ms"})]})]}),!g&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:"텍스트 입력 필드에서 연속 호출을 제어합니다"})]})}const Fx=[{label:"상태 확인",value:"{{_local.isVisible}}",description:"로컬 상태가 참일 때"},{label:"값 존재 확인",value:"{{data?.length > 0}}",description:"데이터가 존재할 때"},{label:"권한 확인",value:'{{_global.user?.permissions?.includes("admin")}}',description:"관리자 권한이 있을 때"},{label:"로딩 완료",value:"{{!_local.isLoading}}",description:"로딩이 완료되었을 때"},{label:"에러 없음",value:"{{!_local.error}}",description:"에러가 없을 때"}];function ME({component:r,onChange:e}){const[n,a]=j.useState(!1),[i,o]=j.useState(!1),d=Se(y=>y.layoutData),g=Se(y=>y.mockDataContext),h=j.useMemo(()=>{const y=[];return d?.data_sources&&d.data_sources.forEach(w=>{y.push({label:w.id,value:`{{${w.id}.data}}`,description:`데이터 소스: ${w.id}`})}),g._global&&Object.keys(g._global).forEach(w=>{Array.isArray(g._global[w])&&y.push({label:`_global.${w}`,value:`{{_global.${w}}}`,description:"전역 상태 배열"})}),g._local&&Object.keys(g._local).forEach(w=>{Array.isArray(g._local[w])&&y.push({label:`_local.${w}`,value:`{{_local.${w}}}`,description:"로컬 상태 배열"})}),y},[d,g]),f=j.useCallback(y=>{e({if:y||void 0})},[e]),p=j.useCallback(y=>{if(y===null)e({iteration:void 0});else{const w=r.iteration||{source:"",item_var:"item",index_var:"index"};e({iteration:{...w,...y}})}},[r.iteration,e]),x=j.useCallback(()=>{e({iteration:{source:"",item_var:"item",index_var:"index"}}),o(!0)},[e]);return l.jsxs("div",{className:"p-4 space-y-6",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:"조건부 렌더링 (if)"}),r.if&&l.jsx("button",{onClick:()=>f(""),className:"text-xs text-red-500 hover:text-red-700",title:"조건 삭제",children:"삭제"})]}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"조건이 참일 때만 컴포넌트를 렌더링합니다."}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("input",{type:"text",value:r.if||"",onChange:y=>f(y.target.value),placeholder:"{{_local.showComponent}}",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),l.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"빠른 입력:"}),Fx.slice(0,3).map(y=>l.jsx("button",{onClick:()=>f(y.value),className:"px-2 py-0.5 text-xs bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",title:y.description,children:y.label},y.value)),l.jsx("button",{onClick:()=>a(!n),className:"px-2 py-0.5 text-xs text-blue-600 dark:text-blue-400 hover:underline",children:n?"닫기":"더보기..."})]}),n&&l.jsxs("div",{className:"mt-2 p-2 bg-gray-50 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:[l.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:"조건 템플릿 선택:"}),l.jsx("div",{className:"space-y-1",children:Fx.map(y=>l.jsxs("button",{onClick:()=>{f(y.value),a(!1)},className:"w-full text-left px-2 py-1 text-xs hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",children:[l.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:y.label}),l.jsx("span",{className:"text-gray-500 dark:text-gray-400 ml-2",children:y.description}),l.jsx("code",{className:"block text-xs text-blue-600 dark:text-blue-400 mt-0.5",children:y.value})]},y.value))})]})]}),r.if&&l.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs",children:l.jsx("span",{className:"px-2 py-0.5 bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400 rounded",children:"⚠️ 조건부 렌더링 활성화"})})]}),l.jsx("hr",{className:"border-gray-200 dark:border-gray-700"}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:"반복 렌더링 (iteration)"}),r.iteration&&l.jsx("button",{onClick:()=>p(null),className:"text-xs text-red-500 hover:text-red-700",title:"반복 삭제",children:"삭제"})]}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"데이터 배열을 순회하며 컴포넌트를 반복 렌더링합니다."}),r.iteration?l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Source (반복할 배열)"}),l.jsx("input",{type:"text",value:r.iteration.source||"",onChange:y=>p({source:y.target.value}),placeholder:"{{users.data}}",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),h.length>0&&l.jsxs("div",{className:"flex items-center gap-1 flex-wrap mt-1",children:[l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"사용 가능:"}),h.slice(0,3).map(y=>l.jsx("button",{onClick:()=>p({source:y.value}),className:"px-2 py-0.5 text-xs bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",title:y.description,children:y.label},y.value))]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Item 변수명"}),l.jsx("input",{type:"text",value:r.iteration.item_var||"item",onChange:y=>p({item_var:y.target.value||"item"}),placeholder:"item",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Index 변수명"}),l.jsx("input",{type:"text",value:r.iteration.index_var||"index",onChange:y=>p({index_var:y.target.value||"index"}),placeholder:"index",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]})]}),l.jsxs("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/20 rounded text-xs text-blue-700 dark:text-blue-300",children:[l.jsx("p",{className:"font-medium mb-1",children:"사용법:"}),l.jsxs("code",{className:"block",children:[`{{${r.iteration.item_var||"item"}.속성}}`," - 현재 아이템 접근"]}),l.jsxs("code",{className:"block",children:[`{{${r.iteration.index_var||"index"}}}`," - 현재 인덱스 접근"]})]}),l.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[l.jsx("span",{className:"px-2 py-0.5 bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 rounded",children:"🔁 반복 렌더링 활성화"}),r.iteration.source&&l.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["소스: ",r.iteration.source]})]})]}):l.jsxs("div",{className:"text-center py-4",children:[l.jsx("p",{className:"text-gray-400 dark:text-gray-500 mb-2",children:"반복 설정이 없습니다"}),l.jsx("button",{onClick:x,className:"px-3 py-1.5 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:"+ 반복 렌더링 추가"})]})]}),r.if&&r.iteration&&l.jsxs("div",{className:"p-2 bg-amber-50 dark:bg-amber-900/20 rounded border border-amber-200 dark:border-amber-800 text-xs text-amber-700 dark:text-amber-300",children:[l.jsx("p",{className:"font-medium",children:"⚠️ 조건 + 반복 조합"}),l.jsx("p",{className:"mt-1",children:"조건(if)과 반복(iteration)이 함께 설정되어 있습니다. 조건이 먼저 평가되고, 참일 때만 반복이 실행됩니다."})]})]})}const Vx=[{key:"mobile",label:"모바일",range:"0 ~ 767px",icon:"📱"},{key:"tablet",label:"태블릿",range:"768 ~ 1023px",icon:"📲"},{key:"desktop",label:"데스크톱",range:"1024px 이상",icon:"🖥️"},{key:"portable",label:"포터블",range:"0 ~ 1023px",icon:"📱+📲",description:"모바일 + 태블릿"}],$E=[{label:"숨김",value:"hidden"},{label:"표시",value:"block"},{label:"Flex 표시",value:"flex"},{label:"Grid 표시",value:"grid"},{label:"1열 그리드",value:"grid grid-cols-1"},{label:"2열 그리드",value:"grid grid-cols-2"},{label:"3열 그리드",value:"grid grid-cols-3"},{label:"세로 정렬",value:"flex flex-col"},{label:"가로 정렬",value:"flex flex-row"},{label:"전체 너비",value:"w-full"},{label:"작은 패딩",value:"p-2"},{label:"중간 패딩",value:"p-4"},{label:"큰 패딩",value:"p-6"}];function IE({breakpointKey:r,label:e,range:n,icon:a,description:i,config:o,component:d,isOpen:g,onToggle:h,onChange:f}){const p=o!==void 0,{getMetadata:x}=Fo(),y=x(d.name),w=j.useCallback((R,N)=>{const D=o?.props||{};let M;if(N===""){const{[R]:L,...z}=D;M=z}else M={...D,[R]:N};Object.keys(M).length===0&&!o?.text&&!o?.if?f(null):f({...o,props:M})},[o,f]),v=j.useCallback(R=>{if(R===""){const{text:N,...D}=o||{};Object.keys(D.props||{}).length===0&&!D.if?f(null):f(D)}else f({...o,text:R})},[o,f]),C=j.useCallback(R=>{if(R===""){const{if:N,...D}=o||{};Object.keys(D.props||{}).length===0&&!D.text?f(null):f(D)}else f({...o,if:R})},[o,f]),k=j.useCallback(()=>{f(p?null:{props:{}})},[p,f]),A=j.useCallback(R=>{const N=o?.props||{},D=N.className||"",M=D?`${D} ${R}`:R;f({...o,props:{...N,className:M}})},[o,f]);return l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded overflow-hidden",children:[l.jsxs("div",{className:`flex items-center justify-between px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/20":"bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750"}`,onClick:h,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{children:a}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e}),l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:n}),i&&l.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-1",children:["(",i,")"]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:R=>{R.stopPropagation(),k()},className:`px-2 py-0.5 text-xs rounded transition-colors ${p?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-600 dark:text-gray-300"}`,children:p?"활성":"비활성"}),l.jsx("span",{className:`text-gray-400 transition-transform ${g?"rotate-180":""}`,children:"▼"})]})]}),g&&p&&l.jsxs("div",{className:"p-3 space-y-4 border-t border-gray-200 dark:border-gray-700",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"className"}),l.jsx("input",{type:"text",value:o?.props?.className||"",onChange:R=>w("className",R.target.value),placeholder:d.props?.className||"기본값 사용",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),l.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:$E.slice(0,6).map(R=>l.jsx("button",{onClick:()=>A(R.value),className:"px-2 py-0.5 text-xs bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",title:R.value,children:R.label},R.value))})]}),y?.props?.filter(R=>R.name!=="className"&&R.name!=="children").slice(0,5).map(R=>l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:R.label||R.name}),R.type==="boolean"?l.jsxs("select",{value:o?.props?.[R.name]===void 0?"":String(o.props[R.name]),onChange:N=>{const D=N.target.value;D===""?w(R.name,""):w(R.name,D==="true")},className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[l.jsx("option",{value:"",children:"기본값"}),l.jsx("option",{value:"true",children:"true"}),l.jsx("option",{value:"false",children:"false"})]}):R.type==="select"&&R.options?l.jsxs("select",{value:o?.props?.[R.name]||"",onChange:N=>w(R.name,N.target.value),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[l.jsx("option",{value:"",children:"기본값"}),R.options.map(N=>l.jsx("option",{value:String(N.value),children:N.label},String(N.value)))]}):l.jsx("input",{type:R.type==="number"?"number":"text",value:o?.props?.[R.name]||"",onChange:N=>w(R.name,N.target.value),placeholder:d.props?.[R.name]?String(d.props[R.name]):"기본값",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]},R.name)),d.text!==void 0&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"text"}),l.jsx("input",{type:"text",value:o?.text||"",onChange:R=>v(R.target.value),placeholder:d.text||"기본값 사용",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"if (조건부 렌더링)"}),l.jsx("input",{type:"text",value:o?.if||"",onChange:R=>C(R.target.value),placeholder:d.if||"{{true}}",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"}),l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:["예: ",l.jsx("code",{className:"text-blue-600 dark:text-blue-400",children:"{{_global.sidebarOpen}}"})]})]}),o&&Object.keys(o).length>0&&l.jsxs("div",{className:"mt-3 p-2 bg-gray-50 dark:bg-gray-800 rounded text-xs",children:[l.jsx("p",{className:"font-medium text-gray-700 dark:text-gray-300 mb-1",children:"설정된 오버라이드:"}),l.jsx("pre",{className:"text-gray-600 dark:text-gray-400 overflow-auto max-h-24",children:JSON.stringify(o,null,2)})]})]})]})}function zE({responsive:r,onChange:e,onAddRange:n,onRemoveRange:a}){const[i,o]=j.useState(""),[d,g]=j.useState(""),h=j.useMemo(()=>{if(!r)return[];const p=Vx.map(x=>x.key);return Object.keys(r).filter(x=>!p.includes(x))},[r]),f=j.useCallback(()=>{let p;if(i&&d)p=`${i}-${d}`;else if(i&&!d)p=`${i}-`;else if(!i&&d)p=`-${d}`;else return;n(p),o(""),g("")},[i,d,n]);return l.jsxs("div",{className:"space-y-3",children:[l.jsx("h5",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:"커스텀 범위"}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"특정 화면 너비 범위에 대한 오버라이드를 설정합니다."}),h.length>0&&l.jsx("div",{className:"space-y-2",children:h.map(p=>l.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-800 rounded",children:[l.jsxs("span",{className:"text-sm font-mono text-gray-700 dark:text-gray-300",children:[p,"px"]}),l.jsx("button",{onClick:()=>a(p),className:"text-xs text-red-500 hover:text-red-700",children:"삭제"})]},p))}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"number",value:i,onChange:p=>o(p.target.value),placeholder:"최소",className:"w-20 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400"}),l.jsx("span",{className:"text-gray-500",children:"~"}),l.jsx("input",{type:"number",value:d,onChange:p=>g(p.target.value),placeholder:"최대",className:"w-20 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400"}),l.jsx("span",{className:"text-gray-500 text-sm",children:"px"}),l.jsx("button",{onClick:f,disabled:!i&&!d,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"추가"})]}),l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"예: 0-599 (작은 모바일), 600-899 (큰 모바일), 1200- (와이드 데스크톱)"})]})}function HE({component:r,onChange:e}){const[n,a]=j.useState(new Set),[i,o]=j.useState(!1),d=r.responsive,g=j.useCallback(w=>{a(v=>{const C=new Set(v);return C.has(w)?C.delete(w):C.add(w),C})},[]),h=j.useCallback((w,v)=>{const C={...d||{}};v===null?delete C[w]:C[w]=v,Object.keys(C).length===0?e({responsive:void 0}):e({responsive:C})},[d,e]),f=j.useCallback(w=>{const v={...d||{}};v[w]={props:{}},e({responsive:v}),a(C=>new Set(C).add(w))},[d,e]),p=j.useCallback(w=>{const v={...d||{}};delete v[w],Object.keys(v).length===0?e({responsive:void 0}):e({responsive:v})},[d,e]),x=j.useCallback(()=>{e({responsive:void 0})},[e]),y=j.useMemo(()=>d?Object.keys(d).length:0,[d]);return l.jsxs("div",{className:"p-4 space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:"반응형 오버라이드"}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"브레이크포인트별로 다른 속성을 설정합니다."})]}),y>0&&l.jsx("button",{onClick:x,className:"text-xs text-red-500 hover:text-red-700",children:"모두 삭제"})]}),y>0&&l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("span",{className:"px-2 py-0.5 text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 rounded",children:["📱 ",y,"개 브레이크포인트 활성화"]})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:"프리셋 브레이크포인트"}),Vx.map(w=>l.jsx(IE,{breakpointKey:w.key,label:w.label,range:w.range,icon:w.icon,description:w.description,config:d?.[w.key],component:r,isOpen:n.has(w.key),onToggle:()=>g(w.key),onChange:v=>h(w.key,v)},w.key))]}),l.jsx("hr",{className:"border-gray-200 dark:border-gray-700"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>o(!i),className:"flex items-center gap-2 text-sm text-blue-600 dark:text-blue-400 hover:underline",children:[l.jsx("span",{children:i?"▼":"▶"}),l.jsx("span",{children:"커스텀 범위 설정"})]}),i&&l.jsx("div",{className:"mt-3",children:l.jsx(zE,{responsive:d,onChange:h,onAddRange:f,onRemoveRange:p})})]}),l.jsxs("div",{className:"p-3 bg-blue-50 dark:bg-blue-900/20 rounded text-xs text-blue-700 dark:text-blue-300",children:[l.jsx("p",{className:"font-medium mb-2",children:"반응형 규칙:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-blue-600 dark:text-blue-400",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"portable"}),"을 사용할 때는 mobile/tablet과 혼용 금지"]}),l.jsx("li",{children:"프리셋 브레이크포인트보다 커스텀 범위가 우선 적용"}),l.jsx("li",{children:"좁은 범위가 넓은 범위보다 우선 적용"}),l.jsx("li",{children:"Props는 얕은 머지 (shallow merge) 적용"})]})]}),d&&Object.keys(d).length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:"설정 미리보기 (JSON)"}),l.jsx("pre",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 text-xs text-gray-600 dark:text-gray-400 overflow-auto max-h-48",children:JSON.stringify(d,null,2)})]})]})}at("ClassMapEditor");function PE({variantKey:r,variantClass:e,onKeyChange:n,onClassChange:a,onDelete:i}){return l.jsxs("div",{className:"flex items-start gap-2 p-2 bg-gray-50 dark:bg-gray-800 rounded",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"키 (variant name)"}),l.jsx("input",{type:"text",value:r,onChange:o=>n(o.target.value),placeholder:"success, error, warning...",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]}),l.jsxs("div",{className:"flex-[2]",children:[l.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"클래스"}),l.jsx("input",{type:"text",value:e,onChange:o=>a(o.target.value),placeholder:"bg-green-100 text-green-800",className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono"})]}),l.jsx("button",{type:"button",onClick:i,className:"mt-5 p-1 text-red-500 dark:text-red-400 hover:bg-red-100 dark:hover:bg-red-900/30 rounded",title:"variant 삭제",children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})})})]})}function Kx({classes:r}){const e=r.split(/\s+/).filter(Boolean);return e.length===0?null:l.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.slice(0,8).map((n,a)=>l.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded",children:n},a)),e.length>8&&l.jsxs("span",{className:"px-1.5 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",e.length-8,"개 더"]})]})}function UE({value:r,onChange:e,label:n="classMap",description:a}){const[i,o]=j.useState(!!r),d=j.useCallback(()=>{r?(e(void 0),o(!1)):(e({base:"",variants:{},key:"",default:""}),o(!0))},[r,e]),g=j.useCallback(C=>{e({...r,base:C||void 0})},[r,e]),h=j.useCallback(C=>{e({...r,key:C||void 0})},[r,e]),f=j.useCallback(C=>{e({...r,default:C||void 0})},[r,e]),p=j.useCallback(()=>{const C=r?.variants||{},k=`variant_${Object.keys(C).length+1}`;e({...r,variants:{...C,[k]:""}})},[r,e]),x=j.useCallback((C,k)=>{if(!r?.variants||C===k)return;const A={...r.variants},R=A[C];delete A[C],A[k]=R,e({...r,variants:A})},[r,e]),y=j.useCallback((C,k)=>{e({...r,variants:{...r?.variants,[C]:k}})},[r,e]),w=j.useCallback(C=>{if(!r?.variants)return;const k={...r.variants};delete k[C],e({...r,variants:k})},[r,e]),v=j.useMemo(()=>Object.entries(r?.variants||{}),[r?.variants]);return l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 cursor-pointer",onClick:()=>o(!i),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-4 h-4 text-gray-500 dark:text-gray-400 transition-transform ${i?"rotate-90":""}`,viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})}),l.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n}),r&&l.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 rounded",children:"활성화"})]}),l.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),d()},className:`px-2 py-1 text-xs rounded ${r?"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 hover:bg-red-200 dark:hover:bg-red-900/50":"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 hover:bg-green-200 dark:hover:bg-green-900/50"}`,children:r?"제거":"추가"})]}),i&&r&&l.jsxs("div",{className:"p-3 space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"기본 클래스 (base)"}),l.jsx("textarea",{value:r.base||"",onChange:C=>g(C.target.value),placeholder:"px-2 py-1 rounded-full text-xs font-medium",rows:2,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono resize-none"}),l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"모든 상태에서 항상 적용되는 클래스"}),r.base&&l.jsx(Kx,{classes:r.base})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"키 표현식 (key)"}),l.jsxs("div",{className:"relative",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 text-sm",children:"{{"}),l.jsx("input",{type:"text",value:(r.key||"").replace(/^\{\{|\}\}$/g,""),onChange:C=>h(`{{${C.target.value}}}`),placeholder:"row.status",className:"w-full pl-8 pr-8 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono"}),l.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 text-sm",children:"}}"})]}),l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"variant를 결정하는 표현식 (예: row.status, item.type)"})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:["Variants (",v.length,")"]}),l.jsx("button",{type:"button",onClick:p,className:"px-2 py-1 text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded hover:bg-blue-200 dark:hover:bg-blue-900/50",children:"+ 추가"})]}),v.length>0?l.jsx("div",{className:"space-y-2",children:v.map(([C,k])=>l.jsx(PE,{variantKey:C,variantClass:k,onKeyChange:A=>x(C,A),onClassChange:A=>y(C,A),onDelete:()=>w(C)},C))}):l.jsxs("div",{className:"p-4 text-center text-gray-400 dark:text-gray-500 bg-gray-50 dark:bg-gray-800 rounded",children:[l.jsx("p",{className:"text-sm",children:"variant가 없습니다"}),l.jsx("p",{className:"text-xs mt-1",children:"+ 추가 버튼을 클릭하여 variant를 추가하세요"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"기본값 클래스 (default)"}),l.jsx("input",{type:"text",value:r.default||"",onChange:C=>f(C.target.value),placeholder:"bg-gray-100 text-gray-600",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 font-mono"}),l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"매칭되는 variant가 없을 때 적용되는 클래스"}),r.default&&l.jsx(Kx,{classes:r.default})]}),l.jsxs("div",{className:"p-3 bg-gray-100 dark:bg-gray-900 rounded text-xs",children:[l.jsx("div",{className:"font-medium text-gray-700 dark:text-gray-300 mb-2",children:"생성될 JSON 미리보기:"}),l.jsx("pre",{className:"text-gray-600 dark:text-gray-400 overflow-x-auto",children:JSON.stringify({classMap:{...r.base&&{base:r.base},...Object.keys(r.variants||{}).length>0&&{variants:r.variants},...r.key&&{key:r.key},...r.default&&{default:r.default}}},null,2)})]})]}),a&&!i&&l.jsx("p",{className:"px-3 pb-2 text-xs text-gray-500 dark:text-gray-400",children:a})]})}at("AdvancedEditor");function ud({title:r,badge:e,isExpanded:n,onToggle:a}){return l.jsxs("button",{type:"button",className:"w-full flex items-center justify-between p-2 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors",onClick:a,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-4 h-4 text-gray-500 dark:text-gray-400 transition-transform ${n?"rotate-90":""}`,viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})}),l.jsx("span",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 uppercase",children:r})]}),e&&l.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded",children:e})]})}function BE({component:r,onChange:e}){const[n,a]=j.useState({basic:!0,classMap:!1,expressionHelpers:!1,rawJson:!1}),i=j.useCallback(f=>{a(p=>({...p,[f]:!p[f]}))},[]),o=j.useCallback(f=>{f&&f!==r.id&&e({id:f})},[r.id,e]),d=j.useCallback(f=>{const p={...r.props};f?p.classMap=f:delete p.classMap,e({props:p})},[r.props,e]),g=j.useCallback(f=>{e({blur_until_loaded:f||void 0})},[e]),h=r.props?.classMap;return l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{children:[l.jsx(ud,{title:"기본 설정",isExpanded:n.basic,onToggle:()=>i("basic")}),n.basic&&l.jsxs("div",{className:"mt-3 space-y-4 pl-2",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"컴포넌트 ID"}),l.jsx("input",{type:"text",value:r.id,onChange:f=>o(f.target.value),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white font-mono"}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"레이아웃 내에서 고유해야 합니다"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"슬롯 (Slot)"}),l.jsx("input",{type:"text",value:r.slot||"",readOnly:!0,placeholder:"(없음)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300"})]}),r.slot&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"슬롯 순서"}),l.jsx("input",{type:"number",value:r.slotOrder||0,readOnly:!0,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300"})]}),l.jsx("div",{children:l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:r.blur_until_loaded||!1,onChange:f=>g(f.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),l.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"데이터 로드 전까지 블러 처리"})]})}),r.lifecycle&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Lifecycle"}),l.jsxs("div",{className:"space-y-2",children:[r.lifecycle.onMount&&l.jsxs("div",{className:"p-2 bg-gray-50 dark:bg-gray-800 rounded",children:[l.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"onMount:"}),l.jsxs("span",{className:"text-xs text-gray-700 dark:text-gray-300 ml-2",children:[r.lifecycle.onMount.length,"개 액션"]})]}),r.lifecycle.onUnmount&&l.jsxs("div",{className:"p-2 bg-gray-50 dark:bg-gray-800 rounded",children:[l.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:"onUnmount:"}),l.jsxs("span",{className:"text-xs text-gray-700 dark:text-gray-300 ml-2",children:[r.lifecycle.onUnmount.length,"개 액션"]})]})]})]})]})]}),l.jsxs("div",{children:[l.jsx(ud,{title:"classMap (조건부 스타일)",badge:h?"활성화":void 0,isExpanded:n.classMap,onToggle:()=>i("classMap")}),n.classMap&&l.jsx("div",{className:"mt-3",children:l.jsx(UE,{value:h,onChange:d,label:"조건부 클래스 매핑",description:"상태에 따라 다른 CSS 클래스를 적용합니다. 중첩 삼항 연산자 대신 사용하세요."})})]}),l.jsxs("div",{children:[l.jsx(ud,{title:"표현식 헬퍼",isExpanded:n.expressionHelpers,onToggle:()=>i("expressionHelpers")}),n.expressionHelpers&&l.jsxs("div",{className:"mt-3 space-y-4",children:[l.jsxs("div",{className:"p-3 bg-orange-50 dark:bg-orange-900/20 rounded text-xs",children:[l.jsx("div",{className:"font-medium text-orange-700 dark:text-orange-300 mb-2",children:"$switch 표현식"}),l.jsx("p",{className:"text-orange-600 dark:text-orange-400 mb-2",children:"중첩 삼항 연산자 대신 선언적 switch-case 패턴을 사용할 수 있습니다."}),l.jsx("pre",{className:"bg-white dark:bg-gray-800 p-2 rounded font-mono overflow-x-auto text-gray-700 dark:text-gray-300",children:`{
"$switch": "{{status}}",
"$cases": {
"active": "text-green-500",
"pending": "text-yellow-500"
},
"$default": "text-gray-500"
}`})]}),l.jsxs("div",{className:"p-3 bg-cyan-50 dark:bg-cyan-900/20 rounded text-xs",children:[l.jsx("div",{className:"font-medium text-cyan-700 dark:text-cyan-300 mb-2",children:"$get 헬퍼"}),l.jsx("p",{className:"text-cyan-600 dark:text-cyan-400 mb-2",children:"동적 키를 포함한 깊은 객체 경로 접근과 폴백을 지원합니다."}),l.jsx("pre",{className:"bg-white dark:bg-gray-800 p-2 rounded font-mono overflow-x-auto text-gray-700 dark:text-gray-300",children:"{{$get(product.prices, [currency, 'formatted'], product.price_formatted)}}"})]}),l.jsxs("div",{className:"p-3 bg-purple-50 dark:bg-purple-900/20 rounded text-xs",children:[l.jsx("div",{className:"font-medium text-purple-700 dark:text-purple-300 mb-2",children:"파이프 함수"}),l.jsx("p",{className:"text-purple-600 dark:text-purple-400 mb-2",children:"체이닝 방식으로 데이터를 변환할 수 있습니다."}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 p-2 rounded space-y-1 font-mono text-gray-700 dark:text-gray-300",children:[l.jsx("div",{children:"{{value | date}}"}),l.jsx("div",{children:"{{text | truncate(50)}}"}),l.jsx("div",{children:"{{name | default('Unknown')}}"}),l.jsx("div",{children:"{{items | first}}"})]})]}),l.jsxs("div",{className:"p-3 bg-green-50 dark:bg-green-900/20 rounded text-xs",children:[l.jsx("div",{className:"font-medium text-green-700 dark:text-green-300 mb-2",children:"computed 속성"}),l.jsx("p",{className:"text-green-600 dark:text-green-400 mb-2",children:"레이아웃 수준에서 재사용 가능한 계산 값을 정의합니다. 레이아웃 JSON의 최상위에 computed 섹션을 추가하세요."}),l.jsx("pre",{className:"bg-white dark:bg-gray-800 p-2 rounded font-mono overflow-x-auto text-gray-700 dark:text-gray-300",children:`// 레이아웃 JSON
{
"computed": {
"displayPrice": "{{$get(product.prices, [currency, 'formatted'])}}",
"canEdit": "{{!deleted && permissions.edit}}"
}
}
// 사용
{{$computed.displayPrice}}
{{$computed.canEdit}}`})]})]})]}),l.jsxs("div",{children:[l.jsx(ud,{title:"Raw JSON",isExpanded:n.rawJson,onToggle:()=>i("rawJson")}),n.rawJson&&l.jsx("div",{className:"mt-3",children:l.jsx("pre",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 text-xs text-gray-600 dark:text-gray-400 overflow-auto max-h-96",children:JSON.stringify(r,null,2)})})]})]})}const qE=[{id:"props",label:"Props",icon:"⚙️",description:"기본 속성 편집"},{id:"bindings",label:"Bindings",icon:"🔗",description:"데이터 바인딩 설정"},{id:"actions",label:"Actions",icon:"⚡",description:"이벤트 핸들러 설정"},{id:"conditions",label:"Conditions",icon:"🔀",description:"조건부/반복 렌더링"},{id:"responsive",label:"Responsive",icon:"📱",description:"반응형 오버라이드"},{id:"advanced",label:"Advanced",icon:"🔧",description:"고급 설정"}];function GE({tab:r,isActive:e,onClick:n}){return l.jsxs("button",{className:`flex items-center gap-1 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${e?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:n,title:r.description,children:[l.jsx("span",{children:r.icon}),l.jsx("span",{className:"hidden lg:inline",children:r.label})]})}function FE(){return l.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8 text-gray-500 dark:text-gray-400",children:[l.jsx("div",{className:"text-4xl mb-4",children:"👆"}),l.jsx("h3",{className:"text-lg font-medium mb-2",children:"컴포넌트를 선택하세요"}),l.jsx("p",{className:"text-sm text-center",children:"편집할 컴포넌트를 미리보기 캔버스 또는 레이아웃 트리에서 클릭하세요."})]})}function VE({component:r}){const{getMetadata:e}=Fo(),n=e(r.name);return l.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-lg",children:r.type==="basic"?"📦":r.type==="composite"?"🧩":r.type==="layout"?"📐":"🔌"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white truncate",children:r.name}),l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:["ID: ",r.id]})]}),l.jsx("span",{className:`px-2 py-0.5 text-xs rounded ${r.type==="basic"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":r.type==="composite"?"bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300":r.type==="layout"?"bg-orange-100 dark:bg-orange-900 text-orange-700 dark:text-orange-300":"bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300"}`,children:r.type})]}),n?.description&&l.jsx("p",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:n.description})]})}function Wx({className:r=""}){const[e,n]=j.useState("props"),a=Se(p=>p.layoutData),i=Se(p=>p.selectedComponentId),o=Se(p=>p.updateComponentProps),d=Se(p=>p.updateComponent),g=j.useMemo(()=>{if(!a||!i)return null;const p=x=>{for(const y of x)if(typeof y!="string"){if(y.id===i)return y;if(y.children){const w=p(y.children);if(w)return w}}return null};return p(a.components)},[a,i]),h=j.useCallback(p=>{!i||!g||(Object.keys(p).length===1&&p.props?o(i,p.props):d(i,p))},[i,g,o,d]);if(!g)return l.jsx("div",{className:`h-full bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 ${r}`,children:l.jsx(FE,{})});const f=()=>{switch(e){case"props":return l.jsx(Gx,{component:g,onChange:h});case"bindings":return l.jsx(_E,{component:g,onChange:h});case"actions":return l.jsx(DE,{component:g,onChange:h});case"conditions":return l.jsx(ME,{component:g,onChange:h});case"responsive":return l.jsx(HE,{component:g,onChange:h});case"advanced":return l.jsx(BE,{component:g,onChange:h});default:return null}};return l.jsxs("div",{className:`flex flex-col h-full bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 ${r}`,children:[l.jsx(VE,{component:g}),l.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700 overflow-x-auto",children:qE.map(p=>l.jsx(GE,{tab:p,isActive:e===p.id,onClick:()=>n(p.id)},p.id))}),l.jsx("div",{className:"flex-1 overflow-auto",children:f()})]})}const Vo=at("EditorOverlay");function KE({rect:r,componentId:e,onCopy:n,onDuplicate:a,onDelete:i,onMoveUp:o,onMoveDown:d}){const g=Math.max(0,r.top-36),h=window.innerWidth-r.right;return l.jsxs("div",{className:"fixed z-50 flex items-center gap-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg px-1 py-1",style:{top:g,right:Math.max(8,h)},onClick:f=>f.stopPropagation(),children:[l.jsx("button",{className:"p-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:o,title:"위로 이동",children:"⬆️"}),l.jsx("button",{className:"p-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:d,title:"아래로 이동",children:"⬇️"}),l.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700 mx-1"}),l.jsx("button",{className:"p-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:n,title:"복사",children:"📋"}),l.jsx("button",{className:"p-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:a,title:"복제",children:"📑"}),l.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700 mx-1"}),l.jsx("button",{className:"p-1.5 text-red-500 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-900 rounded",onClick:i,title:"삭제",children:"🗑️"}),l.jsx("div",{className:"ml-2 px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded",children:e})]})}function WE({rect:r,position:e}){const n={position:"fixed",pointerEvents:"none",zIndex:40};return e==="before"?l.jsx("div",{style:{...n,left:r.left,top:r.top-2,width:r.width,height:4},className:"bg-blue-500"}):e==="after"?l.jsx("div",{style:{...n,left:r.left,top:r.bottom-2,width:r.width,height:4},className:"bg-blue-500"}):e==="inside"?l.jsx("div",{style:{...n,left:r.left,top:r.top,width:r.width,height:r.height},className:"border-2 border-dashed border-blue-500 bg-blue-500 bg-opacity-10"}):null}function Yx({rect:r,containerRect:e,type:n,label:a}){const i=n==="selected",o=e?e.left:0,d=e?e.top:0;return l.jsxs("div",{className:`absolute pointer-events-none ${i?"border-2 border-blue-500":"border border-dashed border-green-500"}`,style:{left:r.left-o,top:r.top-d,width:r.width,height:r.height,zIndex:i?31:30},children:[i&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute -left-1 -top-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -right-1 -top-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -left-1 -bottom-1 w-2 h-2 bg-blue-500 rounded-full"}),l.jsx("div",{className:"absolute -right-1 -bottom-1 w-2 h-2 bg-blue-500 rounded-full"})]}),a&&l.jsx("div",{className:`absolute -top-6 left-0 px-1.5 py-0.5 text-xs text-white rounded whitespace-nowrap ${i?"bg-blue-500":"bg-green-500"}`,children:a})]})}function fh({containerRef:r,enabled:e=!0,selectionMode:n=!0}){const a=j.useRef(null),i=Se(X=>X.layoutData),o=Se(X=>X.selectedComponentId),d=Se(X=>X.hoveredComponentId),g=Se(X=>X.selectComponent),h=Se(X=>X.setHoveredComponentId),f=Se(X=>X.deleteComponent),p=Se(X=>X.duplicateComponent),x=Se(X=>X.copyToClipboard);Se(X=>X.moveComponent);const[y,w]=j.useState([]),[v,C]=j.useState(null),[k,A]=j.useState({isDragging:!1,targetId:null,position:null,targetRect:null}),R=j.useCallback(()=>{if(!r.current||!i)return[];const X=r.current.querySelectorAll("[data-editor-id]"),ge=[],xe=(le,je)=>{for(const J of le)if(typeof J!="string"){if(J.id===je)return J;if(J.children){const F=xe(J.children,je);if(F)return F}}return null};return X.forEach(le=>{const je=le.getAttribute("data-editor-id");if(!je)return;const J=le.getBoundingClientRect(),F=xe(i.components,je);F&&ge.push({id:je,rect:J,component:F,isSelected:je===o,isHovered:je===d})}),ge},[r,i,o,d]),N=j.useCallback(()=>{w(R()),r.current&&C(r.current.getBoundingClientRect())},[R,r]);j.useEffect(()=>{if(!e)return;N();const X=()=>{requestAnimationFrame(N)};window.addEventListener("resize",X),window.addEventListener("scroll",X,!0);const ge=new ResizeObserver(X);r.current&&ge.observe(r.current);const xe=new MutationObserver(X);return r.current&&xe.observe(r.current,{childList:!0,subtree:!0,attributes:!0}),()=>{window.removeEventListener("resize",X),window.removeEventListener("scroll",X,!0),ge.disconnect(),xe.disconnect()}},[e,r,N]),j.useCallback(X=>{if(!n)return;const ge=X.target;if(a.current?.contains(ge))return;let xe=null;if(ge.hasAttribute("data-editor-id")?xe=ge:xe=ge.closest("[data-editor-id]"),xe){const le=xe.getAttribute("data-editor-id");le&&(g(le),X.preventDefault(),X.stopPropagation())}else g(null)},[n,g]),j.useCallback(X=>{const ge=X.target;if(a.current?.contains(ge))return;let xe=null;if(ge.hasAttribute("data-editor-id")?xe=ge:xe=ge.closest("[data-editor-id]"),xe){const le=xe.getAttribute("data-editor-id");le&&le!==d&&h(le)}else d&&h(null)},[d,h]),j.useCallback(()=>{h(null)},[h]);const D=j.useCallback(()=>{if(!o)return;const X=y.find(ge=>ge.id===o);X&&(x(X.component),Vo.log("Copied:",o))},[o,y,x]),M=j.useCallback(()=>{o&&(p(o),Vo.log("Duplicated:",o))},[o,p]),L=j.useCallback(()=>{o&&(f(o),Vo.log("Deleted:",o))},[o,f]),z=j.useCallback(()=>{o&&Vo.log("Move up:",o)},[o]),Y=j.useCallback(()=>{o&&Vo.log("Move down:",o)},[o]),he=j.useMemo(()=>y.find(X=>X.isSelected),[y]),be=j.useMemo(()=>y.find(X=>X.isHovered&&!X.isSelected),[y]);return e?l.jsx(l.Fragment,{children:l.jsxs("div",{ref:a,className:"absolute inset-0 pointer-events-none z-20",children:[be&&l.jsx(Yx,{rect:be.rect,containerRect:v,type:"hovered",label:be.component.name}),he&&l.jsxs(l.Fragment,{children:[l.jsx(Yx,{rect:he.rect,containerRect:v,type:"selected",label:he.component.name}),l.jsx("div",{className:"pointer-events-auto",children:l.jsx(KE,{rect:he.rect,componentId:he.id,onCopy:D,onDuplicate:M,onDelete:L,onMoveUp:z,onMoveDown:Y})})]}),k.isDragging&&k.targetRect&&k.position&&l.jsx(WE,{rect:k.targetRect,position:k.position})]})}):null}const cs=at("WysiwygEditor"),YE={leftPanel:280,rightPanel:320,bottomPanel:200},ph=200,JE=400,XE=500,QE=400;function gd({direction:r,onResize:e}){const[n,a]=j.useState(!1),i=j.useRef(0),o=j.useCallback(g=>{g.preventDefault(),a(!0),i.current=r==="horizontal"?g.clientX:g.clientY;const h=p=>{const x=r==="horizontal"?p.clientX:p.clientY,y=x-i.current;i.current=x,e(y)},f=()=>{a(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",f)};document.addEventListener("mousemove",h),document.addEventListener("mouseup",f)},[r,e]),d=r==="horizontal";return l.jsx("div",{className:`${d?"w-1 cursor-col-resize":"h-1 cursor-row-resize"} bg-gray-200 dark:bg-gray-700 hover:bg-blue-400 dark:hover:bg-blue-600 transition-colors ${n?"bg-blue-500 dark:bg-blue-500":""}`,onMouseDown:o})}function ZE({onClose:r,onSaveComplete:e,readOnly:n=!1,className:a=""}){const i=Se(xe=>xe.layoutData),o=Se(xe=>xe.editMode),d=Se(xe=>xe.selectedComponentId),g=Se(xe=>xe.saveLayout),h=Se(xe=>xe.selectComponent),f=Se(xe=>xe.deleteComponent),p=Se(xe=>xe.duplicateComponent),{undo:x,redo:y,canUndo:w,canRedo:v}=oh(),[C,k]=j.useState(YE),[A,R]=j.useState(!0),[N,D]=j.useState(!0),[M,L]=j.useState(!0),z=j.useRef(null);j.useEffect(()=>{const xe=le=>{if(le.target instanceof HTMLInputElement||le.target instanceof HTMLTextAreaElement||le.target.contentEditable==="true")return;const J=navigator.platform.toUpperCase().indexOf("MAC")>=0?le.metaKey:le.ctrlKey;if(J&&le.key==="z"&&!le.shiftKey){le.preventDefault(),w&&(x(),cs.log("Keyboard shortcut: Undo"));return}if(J&&le.key==="z"&&le.shiftKey){le.preventDefault(),v&&(y(),cs.log("Keyboard shortcut: Redo"));return}if(J&&le.key==="y"){le.preventDefault(),v&&(y(),cs.log("Keyboard shortcut: Redo (Y)"));return}if(J&&le.key==="s"){le.preventDefault(),n||(Y(),cs.log("Keyboard shortcut: Save"));return}if((le.key==="Delete"||le.key==="Backspace")&&d){le.preventDefault(),n||(f(d),cs.log("Keyboard shortcut: Delete"));return}if(J&&le.key==="d"&&d){le.preventDefault(),n||(p(d),cs.log("Keyboard shortcut: Duplicate"));return}if(le.key==="Escape"){le.preventDefault(),h(null),cs.log("Keyboard shortcut: Deselect");return}if(J&&le.key==="1"){le.preventDefault(),R(F=>!F);return}if(J&&le.key==="2"){le.preventDefault(),D(F=>!F);return}if(J&&le.key==="3"){le.preventDefault(),L(F=>!F);return}};return window.addEventListener("keydown",xe),()=>window.removeEventListener("keydown",xe)},[w,v,x,y,d,h,f,p,n]);const Y=j.useCallback(async()=>{try{await g("Manual save"),i&&e&&e(i),cs.log("Layout saved successfully")}catch(xe){cs.error("Failed to save layout:",xe)}},[g,i,e]),he=j.useCallback(xe=>{k(le=>({...le,leftPanel:Math.min(JE,Math.max(ph,le.leftPanel+xe))}))},[]),be=j.useCallback(xe=>{k(le=>({...le,rightPanel:Math.min(XE,Math.max(ph,le.rightPanel-xe))}))},[]),X=j.useCallback(xe=>{k(le=>({...le,bottomPanel:Math.min(QE,Math.max(ph,le.bottomPanel-xe))}))},[]),ge=()=>{switch(o){case"visual":return l.jsxs("div",{ref:z,className:"relative flex-1 overflow-hidden",children:[l.jsx(uh,{showOverlay:!n}),!n&&l.jsx(fh,{containerRef:z})]});case"json":return l.jsx("div",{className:"flex-1 overflow-hidden bg-gray-900 p-4",children:l.jsx("pre",{className:"h-full overflow-auto text-sm text-green-400 font-mono",children:JSON.stringify(i,null,2)})});case"split":return l.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[l.jsxs("div",{ref:z,className:"relative flex-1 overflow-hidden",children:[l.jsx(uh,{showOverlay:!n}),!n&&l.jsx(fh,{containerRef:z})]}),l.jsx(gd,{direction:"horizontal",onResize:()=>{}}),l.jsx("div",{className:"flex-1 overflow-hidden bg-gray-900 p-4",children:l.jsx("pre",{className:"h-full overflow-auto text-sm text-green-400 font-mono",children:JSON.stringify(i,null,2)})})]});default:return null}};return l.jsxs("div",{className:`flex flex-col h-screen bg-gray-100 dark:bg-gray-900 ${a}`,children:[l.jsx($x,{onClose:r,onSaveComplete:Y}),l.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[A&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-shrink-0 overflow-hidden bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700",style:{width:C.leftPanel},children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[l.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"레이아웃 트리"}),l.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",onClick:()=>R(!1),title:"패널 닫기",children:"✕"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:l.jsx(zx,{enableDragDrop:!n})})]})}),l.jsx(gd,{direction:"horizontal",onResize:he})]}),l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[ge(),M&&l.jsxs(l.Fragment,{children:[l.jsx(gd,{direction:"vertical",onResize:X}),l.jsx("div",{className:"flex-shrink-0 overflow-hidden bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700",style:{height:C.bottomPanel},children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[l.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"데이터소스 / 상태"}),l.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",onClick:()=>L(!1),title:"패널 닫기",children:"✕"})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center",children:"데이터소스 관리자 (Phase 3에서 구현)"})})]})})]})]}),N&&l.jsxs(l.Fragment,{children:[l.jsx(gd,{direction:"horizontal",onResize:be}),l.jsx("div",{className:"flex-shrink-0 overflow-hidden bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700",style:{width:C.rightPanel},children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[l.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"속성"}),l.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",onClick:()=>D(!1),title:"패널 닫기",children:"✕"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:l.jsx(Wx,{})})]})})]})]}),(!A||!N||!M)&&l.jsxs("div",{className:"fixed bottom-4 left-1/2 transform -translate-x-1/2 flex items-center gap-2 bg-white dark:bg-gray-800 rounded-lg shadow-lg px-4 py-2 border border-gray-200 dark:border-gray-700",children:[!A&&l.jsx("button",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:()=>R(!0),children:"📑 트리"}),!M&&l.jsx("button",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:()=>L(!0),children:"📊 데이터"}),!N&&l.jsx("button",{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",onClick:()=>D(!0),children:"⚙️ 속성"})]}),n&&l.jsx("div",{className:"fixed top-16 right-4 bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200 px-3 py-1 rounded-full text-sm font-medium shadow",children:"읽기 전용"})]})}function Jx({layoutData:r,templateId:e,onClose:n,onSaveComplete:a,onPublishComplete:i,initialEditMode:o="visual",readOnly:d=!1,className:g=""}){return l.jsx(Mx,{layoutData:r,templateId:e,initialEditMode:o,children:l.jsx(ZE,{onClose:n,onSaveComplete:a,readOnly:d,className:g})})}const e1=Object.freeze(Object.defineProperty({__proto__:null,EditorOverlay:fh,EditorProvider:Mx,LayoutTree:zx,PreviewCanvas:uh,PropertyPanel:Wx,PropsEditor:Gx,Toolbar:$x,WysiwygEditor:Jx,addComponentToLayout:qo,deepCloneComponent:rh,default:Jx,duplicateComponentInLayout:Ox,findComponentById:jr,generateUniqueId:Bo,isIdDuplicate:sh,moveComponentInLayout:od,removeComponentFromLayout:rd,selectCanRedo:cd,selectCanUndo:ld,updateComponentInLayout:id,useComponentMetadata:Fo,useEditorState:Se,useHistory:oh},Symbol.toStringTag,{value:"Module"}));dn.DataSourceManager=is,dn.LayoutLoader=Rg,dn.TemplateApp=Ro,dn.TemplateEngine=$o,dn.default=$o,dn.destroyTemplate=Uc,dn.getActionDispatcher=dx,dn.getState=wr,dn.initTemplateApp=Pg,dn.initTemplateEngine=Lo,dn.renderTemplate=Mo,dn.updateTemplateData=hi,Object.defineProperties(dn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.G7Core=this.G7Core||{});
//# sourceMappingURL=template-engine.min.js.map