1872 lines
1.1 MiB
Plaintext
1872 lines
1.1 MiB
Plaintext
var M1=Object.defineProperty;var $1=(ln,sa,aa)=>sa in ln?M1(ln,sa,{enumerable:!0,configurable:!0,writable:!0,value:aa}):ln[sa]=aa;var H=(ln,sa,aa)=>$1(ln,typeof sa!="symbol"?sa+"":sa,aa);(function(ln){"use strict";function sa(r,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in r)){const o=Object.getOwnPropertyDescriptor(s,i);o&&Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function aa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Lu={exports:{}},Ze={};/**
|
||
* @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 Rp;function ww(){if(Rp)return Ze;Rp=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),s=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"),y=Symbol.for("react.activity"),x=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=x&&R[x]||R["@@iterator"],typeof R=="function"?R:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,k={};function A(R,q,re){this.props=R,this.context=q,this.refs=k,this.updater=re||v}A.prototype.isReactComponent={},A.prototype.setState=function(R,q){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,q,"setState")},A.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function O(){}O.prototype=A.prototype;function N(R,q,re){this.props=R,this.context=q,this.refs=k,this.updater=re||v}var D=N.prototype=new O;D.constructor=N,S(D,A.prototype),D.isPureReactComponent=!0;var $=Array.isArray;function M(){}var z={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function ye(R,q,re){var xe=re.ref;return{$$typeof:r,type:R,key:q,ref:xe!==void 0?xe:null,props:re}}function we(R,q){return ye(R.type,q,R.props)}function J(R){return typeof R=="object"&&R!==null&&R.$$typeof===r}function ve(R){var q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(re){return q[re]})}var le=/\/+/g;function de(R,q){return typeof R=="object"&&R!==null&&R.key!=null?ve(""+R.key):q.toString(36)}function je(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(M,M):(R.status="pending",R.then(function(q){R.status==="pending"&&(R.status="fulfilled",R.value=q)},function(q){R.status==="pending"&&(R.status="rejected",R.reason=q)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function W(R,q,re,xe,oe){var ke=typeof R;(ke==="undefined"||ke==="boolean")&&(R=null);var Oe=!1;if(R===null)Oe=!0;else switch(ke){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(R.$$typeof){case r:case e:Oe=!0;break;case p:return Oe=R._init,W(Oe(R._payload),q,re,xe,oe)}}if(Oe)return oe=oe(R),Oe=xe===""?"."+de(R,0):xe,$(oe)?(re="",Oe!=null&&(re=Oe.replace(le,"$&/")+"/"),W(oe,q,re,"",function(Ie){return Ie})):oe!=null&&(J(oe)&&(oe=we(oe,re+(oe.key==null||R&&R.key===oe.key?"":(""+oe.key).replace(le,"$&/")+"/")+Oe)),q.push(oe)),1;Oe=0;var De=xe===""?".":xe+":";if($(R))for(var qe=0;qe<R.length;qe++)xe=R[qe],ke=De+de(xe,qe),Oe+=W(xe,q,re,ke,oe);else if(qe=w(R),typeof qe=="function")for(R=qe.call(R),qe=0;!(xe=R.next()).done;)xe=xe.value,ke=De+de(xe,qe++),Oe+=W(xe,q,re,ke,oe);else if(ke==="object"){if(typeof R.then=="function")return W(je(R),q,re,xe,oe);throw q=String(R),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function he(R,q,re){if(R==null)return R;var xe=[],oe=0;return W(R,xe,"","",function(ke){return q.call(re,ke,oe++)}),xe}function ee(R){if(R._status===-1){var q=R._result;q=q(),q.then(function(re){(R._status===0||R._status===-1)&&(R._status=1,R._result=re)},function(re){(R._status===0||R._status===-1)&&(R._status=2,R._result=re)}),R._status===-1&&(R._status=0,R._result=q)}if(R._status===1)return R._result.default;throw R._result}var X=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},se={map:he,forEach:function(R,q,re){he(R,function(){q.apply(this,arguments)},re)},count:function(R){var q=0;return he(R,function(){q++}),q},toArray:function(R){return he(R,function(q){return q})||[]},only:function(R){if(!J(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ze.Activity=y,Ze.Children=se,Ze.Component=A,Ze.Fragment=t,Ze.Profiler=i,Ze.PureComponent=N,Ze.StrictMode=s,Ze.Suspense=h,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(R){return z.H.useMemoCache(R)}},Ze.cache=function(R){return function(){return R.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(R,q,re){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var xe=S({},R.props),oe=R.key;if(q!=null)for(ke in q.key!==void 0&&(oe=""+q.key),q)!K.call(q,ke)||ke==="key"||ke==="__self"||ke==="__source"||ke==="ref"&&q.ref===void 0||(xe[ke]=q[ke]);var ke=arguments.length-2;if(ke===1)xe.children=re;else if(1<ke){for(var Oe=Array(ke),De=0;De<ke;De++)Oe[De]=arguments[De+2];xe.children=Oe}return ye(R.type,oe,xe)},Ze.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:o,_context:R},R},Ze.createElement=function(R,q,re){var xe,oe={},ke=null;if(q!=null)for(xe in q.key!==void 0&&(ke=""+q.key),q)K.call(q,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(oe[xe]=q[xe]);var Oe=arguments.length-2;if(Oe===1)oe.children=re;else if(1<Oe){for(var De=Array(Oe),qe=0;qe<Oe;qe++)De[qe]=arguments[qe+2];oe.children=De}if(R&&R.defaultProps)for(xe in Oe=R.defaultProps,Oe)oe[xe]===void 0&&(oe[xe]=Oe[xe]);return ye(R,ke,oe)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(R){return{$$typeof:g,render:R}},Ze.isValidElement=J,Ze.lazy=function(R){return{$$typeof:p,_payload:{_status:-1,_result:R},_init:ee}},Ze.memo=function(R,q){return{$$typeof:f,type:R,compare:q===void 0?null:q}},Ze.startTransition=function(R){var q=z.T,re={};z.T=re;try{var xe=R(),oe=z.S;oe!==null&&oe(re,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(M,X)}catch(ke){X(ke)}finally{q!==null&&re.types!==null&&(q.types=re.types),z.T=q}},Ze.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ze.use=function(R){return z.H.use(R)},Ze.useActionState=function(R,q,re){return z.H.useActionState(R,q,re)},Ze.useCallback=function(R,q){return z.H.useCallback(R,q)},Ze.useContext=function(R){return z.H.useContext(R)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(R,q){return z.H.useDeferredValue(R,q)},Ze.useEffect=function(R,q){return z.H.useEffect(R,q)},Ze.useEffectEvent=function(R){return z.H.useEffectEvent(R)},Ze.useId=function(){return z.H.useId()},Ze.useImperativeHandle=function(R,q,re){return z.H.useImperativeHandle(R,q,re)},Ze.useInsertionEffect=function(R,q){return z.H.useInsertionEffect(R,q)},Ze.useLayoutEffect=function(R,q){return z.H.useLayoutEffect(R,q)},Ze.useMemo=function(R,q){return z.H.useMemo(R,q)},Ze.useOptimistic=function(R,q){return z.H.useOptimistic(R,q)},Ze.useReducer=function(R,q,re){return z.H.useReducer(R,q,re)},Ze.useRef=function(R){return z.H.useRef(R)},Ze.useState=function(R){return z.H.useState(R)},Ze.useSyncExternalStore=function(R,q,re){return z.H.useSyncExternalStore(R,q,re)},Ze.useTransition=function(){return z.H.useTransition()},Ze.version="19.2.0",Ze}var Op;function Mu(){return Op||(Op=1,Lu.exports=ww()),Lu.exports}var j=Mu();const Ke=aa(j);var $u={exports:{}},io={},Iu={exports:{}},zu={};/**
|
||
* @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 Lp;function Sw(){return Lp||(Lp=1,(function(r){function e(W,he){var ee=W.length;W.push(he);e:for(;0<ee;){var X=ee-1>>>1,se=W[X];if(0<i(se,he))W[X]=he,W[ee]=se,ee=X;else break e}}function t(W){return W.length===0?null:W[0]}function s(W){if(W.length===0)return null;var he=W[0],ee=W.pop();if(ee!==he){W[0]=ee;e:for(var X=0,se=W.length,R=se>>>1;X<R;){var q=2*(X+1)-1,re=W[q],xe=q+1,oe=W[xe];if(0>i(re,ee))xe<se&&0>i(oe,re)?(W[X]=oe,W[xe]=ee,X=xe):(W[X]=re,W[q]=ee,X=q);else if(xe<se&&0>i(oe,ee))W[X]=oe,W[xe]=ee,X=xe;else break e}}return he}function i(W,he){var ee=W.sortIndex-he.sortIndex;return ee!==0?ee:W.id-he.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,y=null,x=3,w=!1,v=!1,S=!1,k=!1,A=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function D(W){for(var he=t(f);he!==null;){if(he.callback===null)s(f);else if(he.startTime<=W)s(f),he.sortIndex=he.expirationTime,e(h,he);else break;he=t(f)}}function $(W){if(S=!1,D(W),!v)if(t(h)!==null)v=!0,M||(M=!0,ve());else{var he=t(f);he!==null&&je($,he.startTime-W)}}var M=!1,z=-1,K=5,ye=-1;function we(){return k?!0:!(r.unstable_now()-ye<K)}function J(){if(k=!1,M){var W=r.unstable_now();ye=W;var he=!0;try{e:{v=!1,S&&(S=!1,O(z),z=-1),w=!0;var ee=x;try{t:{for(D(W),y=t(h);y!==null&&!(y.expirationTime>W&&we());){var X=y.callback;if(typeof X=="function"){y.callback=null,x=y.priorityLevel;var se=X(y.expirationTime<=W);if(W=r.unstable_now(),typeof se=="function"){y.callback=se,D(W),he=!0;break t}y===t(h)&&s(h),D(W)}else s(h);y=t(h)}if(y!==null)he=!0;else{var R=t(f);R!==null&&je($,R.startTime-W),he=!1}}break e}finally{y=null,x=ee,w=!1}he=void 0}}finally{he?ve():M=!1}}}var ve;if(typeof N=="function")ve=function(){N(J)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,de=le.port2;le.port1.onmessage=J,ve=function(){de.postMessage(null)}}else ve=function(){A(J,0)};function je(W,he){z=A(function(){W(r.unstable_now())},he)}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(W){W.callback=null},r.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<W?Math.floor(1e3/W):5},r.unstable_getCurrentPriorityLevel=function(){return x},r.unstable_next=function(W){switch(x){case 1:case 2:case 3:var he=3;break;default:he=x}var ee=x;x=he;try{return W()}finally{x=ee}},r.unstable_requestPaint=function(){k=!0},r.unstable_runWithPriority=function(W,he){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ee=x;x=W;try{return he()}finally{x=ee}},r.unstable_scheduleCallback=function(W,he,ee){var X=r.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?X+ee:X):ee=X,W){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=ee+se,W={id:p++,callback:he,priorityLevel:W,startTime:ee,expirationTime:se,sortIndex:-1},ee>X?(W.sortIndex=ee,e(f,W),t(h)===null&&W===t(f)&&(S?(O(z),z=-1):S=!0,je($,ee-X))):(W.sortIndex=se,e(h,W),v||w||(v=!0,M||(M=!0,ve()))),W},r.unstable_shouldYield=we,r.unstable_wrapCallback=function(W){var he=x;return function(){var ee=x;x=he;try{return W.apply(this,arguments)}finally{x=ee}}}})(zu)),zu}var Mp;function Cw(){return Mp||(Mp=1,Iu.exports=Sw()),Iu.exports}var Hu={exports:{}},Nn={};/**
|
||
* @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 $p;function jw(){if($p)return Nn;$p=1;var r=Mu();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 t(){}var s={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(h,f,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,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 Nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Nn.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)},Nn.flushSync=function(h){var f=d.T,p=s.p;try{if(d.T=null,s.p=2,h)return h()}finally{d.T=f,s.p=p,s.d.f()}},Nn.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(h,f))},Nn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Nn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var p=f.as,y=g(p,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,w=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?s.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:w}):p==="script"&&s.d.X(h,{crossOrigin:y,integrity:x,fetchPriority:w,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Nn.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);s.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&&s.d.M(h)},Nn.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,y=g(p,f.crossOrigin);s.d.L(h,p,{crossOrigin:y,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})}},Nn.preloadModule=function(h,f){if(typeof h=="string")if(f){var p=g(f.as,f.crossOrigin);s.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 s.d.m(h)},Nn.requestFormReset=function(h){s.d.r(h)},Nn.unstable_batchedUpdates=function(h,f){return h(f)},Nn.useFormState=function(h,f,p){return d.H.useFormState(h,f,p)},Nn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Nn.version="19.2.0",Nn}var Ip;function zp(){if(Ip)return Hu.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(),Hu.exports=jw(),Hu.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 Hp;function kw(){if(Hp)return io;Hp=1;var r=Cw(),e=Mu(),t=zp();function s(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function d(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function g(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function h(n){if(o(n)!==n)throw Error(s(188))}function f(n){var a=n.alternate;if(!a){if(a=o(n),a===null)throw Error(s(188));return a!==n?null:n}for(var c=n,u=a;;){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),n;if(b===u)return h(m),a;b=b.sibling}throw Error(s(188))}if(c.return!==u.return)c=m,u=b;else{for(var E=!1,L=m.child;L;){if(L===c){E=!0,c=m,u=b;break}if(L===u){E=!0,u=m,c=b;break}L=L.sibling}if(!E){for(L=b.child;L;){if(L===c){E=!0,c=b,u=m;break}if(L===u){E=!0,u=b,c=m;break}L=L.sibling}if(!E)throw Error(s(189))}}if(c.alternate!==u)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?n:a}function p(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=p(n),a!==null)return a;n=n.sibling}return null}var y=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),ye=Symbol.for("react.activity"),we=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function ve(n){return n===null||typeof n!="object"?null:(n=J&&n[J]||n["@@iterator"],typeof n=="function"?n:null)}var le=Symbol.for("react.client.reference");function de(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===le?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case S:return"Fragment";case A:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case M:return"SuspenseList";case ye:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case v:return"Portal";case N:return n.displayName||"Context";case O:return(n._context.displayName||"Context")+".Consumer";case D:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return a=n.displayName||null,a!==null?a:de(n.type)||"Memo";case K:a=n._payload,n=n._init;try{return de(n(a))}catch{}}return null}var je=Array.isArray,W=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},X=[],se=-1;function R(n){return{current:n}}function q(n){0>se||(n.current=X[se],X[se]=null,se--)}function re(n,a){se++,X[se]=n.current,n.current=a}var xe=R(null),oe=R(null),ke=R(null),Oe=R(null);function De(n,a){switch(re(ke,a),re(oe,n),re(xe,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?Bv(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Bv(a),n=qv(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}q(xe),re(xe,n)}function qe(){q(xe),q(oe),q(ke)}function Ie(n){n.memoizedState!==null&&re(Oe,n);var a=xe.current,c=qv(a,n.type);a!==c&&(re(oe,n),re(xe,c))}function Nt(n){oe.current===n&&(q(xe),q(oe)),Oe.current===n&&(q(Oe),Xl._currentValue=ee)}var Rt,Xt;function Mt(n){if(Rt===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Rt=a&&a[1]||"",Xt=-1<c.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Rt+n+Xt}var Qt=!1;function Et(n,a){if(!n||Qt)return"";Qt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(ie){var te=ie}Reflect.construct(n,[],be)}else{try{be.call()}catch(ie){te=ie}n.call(be.prototype)}}else{try{throw Error()}catch(ie){te=ie}(be=n())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(ie){if(ie&&te&&typeof ie.stack=="string")return[ie.stack,te.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],L=b[1];if(E&&L){var B=E.split(`
|
||
`),Z=L.split(`
|
||
`);for(m=u=0;u<B.length&&!B[u].includes("DetermineComponentFrameRoot");)u++;for(;m<Z.length&&!Z[m].includes("DetermineComponentFrameRoot");)m++;if(u===B.length||m===Z.length)for(u=B.length-1,m=Z.length-1;1<=u&&0<=m&&B[u]!==Z[m];)m--;for(;1<=u&&0<=m;u--,m--)if(B[u]!==Z[m]){if(u!==1||m!==1)do if(u--,m--,0>m||B[u]!==Z[m]){var ce=`
|
||
`+B[u].replace(" at new "," at ");return n.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",n.displayName)),ce}while(1<=u&&0<=m);break}}}finally{Qt=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?Mt(c):""}function Dn(n,a){switch(n.tag){case 26:case 27:case 5:return Mt(n.type);case 16:return Mt("Lazy");case 13:return n.child!==a&&a!==null?Mt("Suspense Fallback"):Mt("Suspense");case 19:return Mt("SuspenseList");case 0:case 15:return Et(n.type,!1);case 11:return Et(n.type.render,!1);case 1:return Et(n.type,!0);case 31:return Mt("Activity");default:return""}}function Ce(n){try{var a="",c=null;do a+=Dn(n,c),c=n,n=n.return;while(n);return a}catch(u){return`
|
||
Error generating stack: `+u.message+`
|
||
`+u.stack}}var Ge=Object.prototype.hasOwnProperty,at=r.unstable_scheduleCallback,pt=r.unstable_cancelCallback,bt=r.unstable_shouldYield,_t=r.unstable_requestPaint,mt=r.unstable_now,tt=r.unstable_getCurrentPriorityLevel,vn=r.unstable_ImmediatePriority,wt=r.unstable_UserBlockingPriority,Tt=r.unstable_NormalPriority,qt=r.unstable_LowPriority,Jn=r.unstable_IdlePriority,un=r.log,Rs=r.unstable_setDisableYieldValue,ds=null,V=null;function me(n){if(typeof un=="function"&&Rs(n),V&&typeof V.setStrictMode=="function")try{V.setStrictMode(ds,n)}catch{}}var ue=Math.clz32?Math.clz32:Ae,ne=Math.log,_e=Math.LN2;function Ae(n){return n>>>=0,n===0?32:31-(ne(n)/_e|0)|0}var Me=256,ze=262144,Pe=4194304;function Te(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Fe(n,a,c){var u=n.pendingLanes;if(u===0)return 0;var m=0,b=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var L=u&134217727;return L!==0?(u=L&~b,u!==0?m=Te(u):(E&=L,E!==0?m=Te(E):c||(c=L&~n,c!==0&&(m=Te(c))))):(L=u&~b,L!==0?m=Te(L):E!==0?m=Te(E):c||(c=u&~n,c!==0&&(m=Te(c)))),m===0?0:a!==0&&a!==m&&(a&b)===0&&(b=m&-m,c=a&-a,b>=c||b===32&&(c&4194048)!==0)?a:m}function We(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Je(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 rt(){var n=Pe;return Pe<<=1,(Pe&62914560)===0&&(Pe=4194304),n}function Ue(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Re(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function $e(n,a,c,u,m,b){var E=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var L=n.entanglements,B=n.expirationTimes,Z=n.hiddenUpdates;for(c=E&~c;0<c;){var ce=31-ue(c),be=1<<ce;L[ce]=0,B[ce]=-1;var te=Z[ce];if(te!==null)for(Z[ce]=null,ce=0;ce<te.length;ce++){var ie=te[ce];ie!==null&&(ie.lane&=-536870913)}c&=~be}u!==0&<(n,u,0),b!==0&&m===0&&n.tag!==0&&(n.suspendedLanes|=b&~(E&~a))}function lt(n,a,c){n.pendingLanes|=a,n.suspendedLanes&=~a;var u=31-ue(a);n.entangledLanes|=a,n.entanglements[u]=n.entanglements[u]|1073741824|c&261930}function Dt(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var u=31-ue(c),m=1<<u;m&a|n[u]&a&&(n[u]|=a),c&=~m}}function tn(n,a){var c=a&-a;return c=(c&42)!==0?1:xn(c),(c&(n.suspendedLanes|a))!==0?0:c}function xn(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Xn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Qn(){var n=he.p;return n!==0?n:(n=window.event,n===void 0?32:gw(n.type))}function Ws(n,a){var c=he.p;try{return he.p=n,a()}finally{he.p=c}}var zn=Math.random().toString(36).slice(2),gn="__reactFiber$"+zn,wn="__reactProps$"+zn,Hn="__reactContainer$"+zn,Jo="__reactEvents$"+zn,bh="__reactListeners$"+zn,vh="__reactHandles$"+zn,wi="__reactResources$"+zn,ga="__reactMarker$"+zn;function Xo(n){delete n[gn],delete n[wn],delete n[Jo],delete n[bh],delete n[vh]}function Ua(n){var a=n[gn];if(a)return a;for(var c=n.parentNode;c;){if(a=c[Hn]||c[gn]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=Jv(n);n!==null;){if(c=n[gn])return c;n=Jv(n)}return a}n=c,c=n.parentNode}return null}function Ba(n){if(n=n[gn]||n[Hn]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function Tr(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(s(33))}function Ys(n){var a=n[wi];return a||(a=n[wi]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function nn(n){n[ga]=!0}var md=new Set,yd={};function ha(n,a){qa(n,a),qa(n+"Capture",a)}function qa(n,a){for(yd[n]=a,n=0;n<a.length;n++)md.add(a[n])}var Os=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]*$"),Qo={},Js={};function Zo(n){return Ge.call(Js,n)?!0:Ge.call(Qo,n)?!1:Os.test(n)?Js[n]=!0:(Qo[n]=!0,!1)}function Si(n,a,c){if(Zo(a))if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+c)}}function Ci(n,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+c)}}function Ls(n,a,c,u){if(u===null)n.removeAttribute(c);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(a,c,""+u)}}function Pn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ji(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function wh(n,a,c){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var m=u.get,b=u.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return m.call(this)},set:function(E){c=""+E,b.call(this,E)}}),Object.defineProperty(n,a,{enumerable:u.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function el(n){if(!n._valueTracker){var a=ji(n)?"checked":"value";n._valueTracker=wh(n,a,""+n[a])}}function tl(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),u="";return n&&(u=ji(n)?n.checked?"true":"false":n.value),n=u,n!==c?(a.setValue(n),!0):!1}function fa(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Dr=/[\n"\\]/g;function Un(n){return n.replace(Dr,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function pa(n,a,c,u,m,b,E,L){n.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?n.type=E:n.removeAttribute("type"),a!=null?E==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Pn(a)):n.value!==""+Pn(a)&&(n.value=""+Pn(a)):E!=="submit"&&E!=="reset"||n.removeAttribute("value"),a!=null?nl(n,E,Pn(a)):c!=null?nl(n,E,Pn(c)):u!=null&&n.removeAttribute("value"),m==null&&b!=null&&(n.defaultChecked=!!b),m!=null&&(n.checked=m&&typeof m!="function"&&typeof m!="symbol"),L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?n.name=""+Pn(L):n.removeAttribute("name")}function xd(n,a,c,u,m,b,E,L){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(n.type=b),a!=null||c!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){el(n);return}c=c!=null?""+Pn(c):"",a=a!=null?""+Pn(a):c,L||a===n.value||(n.value=a),n.defaultValue=a}u=u??m,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=L?n.checked:!!u,n.defaultChecked=!!u,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.name=E),el(n)}function nl(n,a,c){a==="number"&&fa(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function Ga(n,a,c,u){if(n=n.options,a){a={};for(var m=0;m<c.length;m++)a["$"+c[m]]=!0;for(c=0;c<n.length;c++)m=a.hasOwnProperty("$"+n[c].value),n[c].selected!==m&&(n[c].selected=m),m&&u&&(n[c].defaultSelected=!0)}else{for(c=""+Pn(c),a=null,m=0;m<n.length;m++){if(n[m].value===c){n[m].selected=!0,u&&(n[m].defaultSelected=!0);return}a!==null||n[m].disabled||(a=n[m])}a!==null&&(a.selected=!0)}}function bd(n,a,c){if(a!=null&&(a=""+Pn(a),a!==n.value&&(n.value=a),c==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=c!=null?""+Pn(c):""}function vd(n,a,c,u){if(a==null){if(u!=null){if(c!=null)throw Error(s(92));if(je(u)){if(1<u.length)throw Error(s(93));u=u[0]}c=u}c==null&&(c=""),a=c}c=Pn(a),n.defaultValue=c,u=n.textContent,u===c&&u!==""&&u!==null&&(n.value=u),el(n)}function Fa(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var Sh=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 ki(n,a,c){var u=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?u?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":u?n.setProperty(a,c):typeof c!="number"||c===0||Sh.has(a)?a==="float"?n.cssFloat=c:n[a]=(""+c).trim():n[a]=c+"px"}function Xs(n,a,c){if(a!=null&&typeof a!="object")throw Error(s(62));if(n=n.style,c!=null){for(var u in c)!c.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var m in a)u=a[m],a.hasOwnProperty(m)&&c[m]!==u&&ki(n,m,u)}else for(var b in a)a.hasOwnProperty(b)&&ki(n,b,a[b])}function sl(n){if(n.indexOf("-")===-1)return!1;switch(n){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 Ch=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"]]),jh=/^[\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 Ni(n){return jh.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function us(){}var al=null;function Ei(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Va=null,Ka=null;function wd(n){var a=Ba(n);if(a&&(n=a.stateNode)){var c=n[wn]||null;e:switch(n=a.stateNode,a.type){case"input":if(pa(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Un(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var u=c[a];if(u!==n&&u.form===n.form){var m=u[wn]||null;if(!m)throw Error(s(90));pa(u,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(a=0;a<c.length;a++)u=c[a],u.form===n.form&&tl(u)}break e;case"textarea":bd(n,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Ga(n,!!c.multiple,a,!1)}}}var rl=!1;function Sd(n,a,c){if(rl)return n(a,c);rl=!0;try{var u=n(a);return u}finally{if(rl=!1,(Va!==null||Ka!==null)&&(gu(),Va&&(a=Va,n=Ka,Ka=Va=null,wd(a),n)))for(a=0;a<n.length;a++)wd(n[a])}}function Rr(n,a){var c=n.stateNode;if(c===null)return null;var u=c[wn]||null;if(u===null)return null;c=u[a];e:switch(a){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)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(s(231,a,typeof c));return c}var Ms=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),il=!1;if(Ms)try{var Or={};Object.defineProperty(Or,"passive",{get:function(){il=!0}}),window.addEventListener("test",Or,Or),window.removeEventListener("test",Or,Or)}catch{il=!1}var $s=null,ol=null,_i=null;function Xe(){if(_i)return _i;var n,a=ol,c=a.length,u,m="value"in $s?$s.value:$s.textContent,b=m.length;for(n=0;n<c&&a[n]===m[n];n++);var E=c-n;for(u=1;u<=E&&a[c-u]===m[b-u];u++);return _i=m.slice(n,1<u?1-u:void 0)}function Wa(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function ma(){return!0}function Cd(){return!1}function _n(n){function a(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 L in n)n.hasOwnProperty(L)&&(c=n[L],this[L]=c?c(b):b[L]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?ma:Cd,this.isPropagationStopped=Cd,this}return y(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ma)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ma)},persist:function(){},isPersistent:ma}),a}var Qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ai=_n(Qs),Lr=y({},Qs,{view:0,detail:0}),kh=_n(Lr),ll,cl,Ti,Di=y({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ul,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ti&&(Ti&&n.type==="mousemove"?(ll=n.screenX-Ti.screenX,cl=n.screenY-Ti.screenY):cl=ll=0,Ti=n),ll)},movementY:function(n){return"movementY"in n?n.movementY:cl}}),jd=_n(Di),sb=y({},Di,{dataTransfer:0}),Nh=_n(sb),Eh=y({},Lr,{relatedTarget:0}),dl=_n(Eh),_h=y({},Qs,{animationName:0,elapsedTime:0,pseudoElement:0}),Ah=_n(_h),Th=y({},Qs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Dh=_n(Th),Rh=y({},Qs,{data:0}),kd=_n(Rh),Oh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lh={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"},Mh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $h(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=Mh[n])?!!a[n]:!1}function ul(){return $h}var Ih=y({},Lr,{key:function(n){if(n.key){var a=Oh[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Wa(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Lh[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ul,charCode:function(n){return n.type==="keypress"?Wa(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Wa(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),hn=_n(Ih),gl=y({},Di,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nd=_n(gl),T=y({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ul}),C=_n(T),_=y({},Qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),I=_n(_),P=y({},Di,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),fe=_n(P),Ne=y({},Qs,{newState:0,oldState:0}),He=_n(Ne),Qe=[9,13,27,32],ut=Ms&&"CompositionEvent"in window,yt=null;Ms&&"documentMode"in document&&(yt=document.documentMode);var Kt=Ms&&"TextEvent"in window&&!yt,Mr=Ms&&(!ut||yt&&8<yt&&11>=yt),Ed=" ",hl=!1;function _d(n,a){switch(n){case"keyup":return Qe.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fl(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ya=!1;function Ad(n,a){switch(n){case"compositionend":return fl(a);case"keypress":return a.which!==32?null:(hl=!0,Ed);case"textInput":return n=a.data,n===Ed&&hl?null:n;default:return null}}function zh(n,a){if(Ya)return n==="compositionend"||!ut&&_d(n,a)?(n=Xe(),_i=ol=$s=null,Ya=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Mr&&a.locale!=="ko"?null:a.data;default:return null}}var Hh={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 pl(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!Hh[n.type]:a==="textarea"}function ml(n,a,c,u){Va?Ka?Ka.push(u):Ka=[u]:Va=u,a=bu(a,"onChange"),0<a.length&&(c=new Ai("onChange","change",null,c,u),n.push({event:c,listeners:a}))}var Ja=null,ya=null;function yl(n){$v(n,0)}function $r(n){var a=Tr(n);if(tl(a))return n}function Td(n,a){if(n==="change")return a}var Dd=!1;if(Ms){var xl;if(Ms){var bl="oninput"in document;if(!bl){var vl=document.createElement("div");vl.setAttribute("oninput","return;"),bl=typeof vl.oninput=="function"}xl=bl}else xl=!1;Dd=xl&&(!document.documentMode||9<document.documentMode)}function ab(){Ja&&(Ja.detachEvent("onpropertychange",rb),ya=Ja=null)}function rb(n){if(n.propertyName==="value"&&$r(ya)){var a=[];ml(a,ya,n,Ei(n)),Sd(yl,a)}}function c_(n,a,c){n==="focusin"?(ab(),Ja=a,ya=c,Ja.attachEvent("onpropertychange",rb)):n==="focusout"&&ab()}function d_(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return $r(ya)}function u_(n,a){if(n==="click")return $r(a)}function g_(n,a){if(n==="input"||n==="change")return $r(a)}function h_(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Zn=typeof Object.is=="function"?Object.is:h_;function wl(n,a){if(Zn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),u=Object.keys(a);if(c.length!==u.length)return!1;for(u=0;u<c.length;u++){var m=c[u];if(!Ge.call(a,m)||!Zn(n[m],a[m]))return!1}return!0}function ib(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function ob(n,a){var c=ib(n);n=0;for(var u;c;){if(c.nodeType===3){if(u=n+c.textContent.length,n<=a&&u>=a)return{node:c,offset:a-n};n=u}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ib(c)}}function lb(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?lb(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function cb(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=fa(n.document);a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=fa(n.document)}return a}function Ph(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var f_=Ms&&"documentMode"in document&&11>=document.documentMode,Ri=null,Uh=null,Sl=null,Bh=!1;function db(n,a,c){var u=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Bh||Ri==null||Ri!==fa(u)||(u=Ri,"selectionStart"in u&&Ph(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}),Sl&&wl(Sl,u)||(Sl=u,u=bu(Uh,"onSelect"),0<u.length&&(a=new Ai("onSelect","select",null,a,c),n.push({event:a,listeners:u}),a.target=Ri)))}function Ir(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var Oi={animationend:Ir("Animation","AnimationEnd"),animationiteration:Ir("Animation","AnimationIteration"),animationstart:Ir("Animation","AnimationStart"),transitionrun:Ir("Transition","TransitionRun"),transitionstart:Ir("Transition","TransitionStart"),transitioncancel:Ir("Transition","TransitionCancel"),transitionend:Ir("Transition","TransitionEnd")},qh={},ub={};Ms&&(ub=document.createElement("div").style,"AnimationEvent"in window||(delete Oi.animationend.animation,delete Oi.animationiteration.animation,delete Oi.animationstart.animation),"TransitionEvent"in window||delete Oi.transitionend.transition);function zr(n){if(qh[n])return qh[n];if(!Oi[n])return n;var a=Oi[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in ub)return qh[n]=a[c];return n}var gb=zr("animationend"),hb=zr("animationiteration"),fb=zr("animationstart"),p_=zr("transitionrun"),m_=zr("transitionstart"),y_=zr("transitioncancel"),pb=zr("transitionend"),mb=new Map,Gh="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(" ");Gh.push("scrollEnd");function Is(n,a){mb.set(n,a),ha(a,[n])}var Rd=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},gs=[],Li=0,Fh=0;function Od(){for(var n=Li,a=Fh=Li=0;a<n;){var c=gs[a];gs[a++]=null;var u=gs[a];gs[a++]=null;var m=gs[a];gs[a++]=null;var b=gs[a];if(gs[a++]=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&&yb(c,m,b)}}function Ld(n,a,c,u){gs[Li++]=n,gs[Li++]=a,gs[Li++]=c,gs[Li++]=u,Fh|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Vh(n,a,c,u){return Ld(n,a,c,u),Md(n)}function Hr(n,a){return Ld(n,null,null,a),Md(n)}function yb(n,a,c){n.lanes|=c;var u=n.alternate;u!==null&&(u.lanes|=c);for(var m=!1,b=n.return;b!==null;)b.childLanes|=c,u=b.alternate,u!==null&&(u.childLanes|=c),b.tag===22&&(n=b.stateNode,n===null||n._visibility&1||(m=!0)),n=b,b=b.return;return n.tag===3?(b=n.stateNode,m&&a!==null&&(m=31-ue(c),n=b.hiddenUpdates,u=n[m],u===null?n[m]=[a]:u.push(a),a.lane=c|536870912),b):null}function Md(n){if(50<Gl)throw Gl=0,np=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var Mi={};function x_(n,a,c,u){this.tag=n,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=a,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 es(n,a,c,u){return new x_(n,a,c,u)}function Kh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function xa(n,a){var c=n.alternate;return c===null?(c=es(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function xb(n,a){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,a=c.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function $d(n,a,c,u,m,b){var E=0;if(u=n,typeof n=="function")Kh(n)&&(E=1);else if(typeof n=="string")E=C1(n,c,xe.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case ye:return n=es(31,c,a,m),n.elementType=ye,n.lanes=b,n;case S:return Pr(c.children,m,b,a);case k:E=8,m|=24;break;case A:return n=es(12,c,a,m|2),n.elementType=A,n.lanes=b,n;case $:return n=es(13,c,a,m),n.elementType=$,n.lanes=b,n;case M:return n=es(19,c,a,m),n.elementType=M,n.lanes=b,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:E=10;break e;case O:E=9;break e;case D:E=11;break e;case z:E=14;break e;case K:E=16,u=null;break e}E=29,c=Error(s(130,n===null?"null":typeof n,"")),u=null}return a=es(E,c,a,m),a.elementType=n,a.type=u,a.lanes=b,a}function Pr(n,a,c,u){return n=es(7,n,u,a),n.lanes=c,n}function Wh(n,a,c){return n=es(6,n,null,a),n.lanes=c,n}function bb(n){var a=es(18,null,null,0);return a.stateNode=n,a}function Yh(n,a,c){return a=es(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var vb=new WeakMap;function hs(n,a){if(typeof n=="object"&&n!==null){var c=vb.get(n);return c!==void 0?c:(a={value:n,source:a,stack:Ce(a)},vb.set(n,a),a)}return{value:n,source:a,stack:Ce(a)}}var $i=[],Ii=0,Id=null,Cl=0,fs=[],ps=0,Xa=null,Zs=1,ea="";function ba(n,a){$i[Ii++]=Cl,$i[Ii++]=Id,Id=n,Cl=a}function wb(n,a,c){fs[ps++]=Zs,fs[ps++]=ea,fs[ps++]=Xa,Xa=n;var u=Zs;n=ea;var m=32-ue(u)-1;u&=~(1<<m),c+=1;var b=32-ue(a)+m;if(30<b){var E=m-m%5;b=(u&(1<<E)-1).toString(32),u>>=E,m-=E,Zs=1<<32-ue(a)+m|c<<m|u,ea=b+n}else Zs=1<<b|c<<m|u,ea=n}function Jh(n){n.return!==null&&(ba(n,1),wb(n,1,0))}function Xh(n){for(;n===Id;)Id=$i[--Ii],$i[Ii]=null,Cl=$i[--Ii],$i[Ii]=null;for(;n===Xa;)Xa=fs[--ps],fs[ps]=null,ea=fs[--ps],fs[ps]=null,Zs=fs[--ps],fs[ps]=null}function Sb(n,a){fs[ps++]=Zs,fs[ps++]=ea,fs[ps++]=Xa,Zs=a.id,ea=a.overflow,Xa=n}var Sn=null,Pt=null,xt=!1,Qa=null,ms=!1,Qh=Error(s(519));function Za(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw jl(hs(a,n)),Qh}function Cb(n){var a=n.stateNode,c=n.type,u=n.memoizedProps;switch(a[gn]=n,a[wn]=u,c){case"dialog":dt("cancel",a),dt("close",a);break;case"iframe":case"object":case"embed":dt("load",a);break;case"video":case"audio":for(c=0;c<Vl.length;c++)dt(Vl[c],a);break;case"source":dt("error",a);break;case"img":case"image":case"link":dt("error",a),dt("load",a);break;case"details":dt("toggle",a);break;case"input":dt("invalid",a),xd(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":dt("invalid",a);break;case"textarea":dt("invalid",a),vd(a,u.value,u.defaultValue,u.children)}c=u.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||u.suppressHydrationWarning===!0||Pv(a.textContent,c)?(u.popover!=null&&(dt("beforetoggle",a),dt("toggle",a)),u.onScroll!=null&&dt("scroll",a),u.onScrollEnd!=null&&dt("scrollend",a),u.onClick!=null&&(a.onclick=us),a=!0):a=!1,a||Za(n,!0)}function jb(n){for(Sn=n.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:ms=!1;return;case 27:case 3:ms=!0;return;default:Sn=Sn.return}}function zi(n){if(n!==Sn)return!1;if(!xt)return jb(n),xt=!0,!1;var a=n.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||yp(n.type,n.memoizedProps)),c=!c),c&&Pt&&Za(n),jb(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Pt=Yv(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Pt=Yv(n)}else a===27?(a=Pt,hr(n.type)?(n=Sp,Sp=null,Pt=n):Pt=a):Pt=Sn?xs(n.stateNode.nextSibling):null;return!0}function Ur(){Pt=Sn=null,xt=!1}function Zh(){var n=Qa;return n!==null&&(Fn===null?Fn=n:Fn.push.apply(Fn,n),Qa=null),n}function jl(n){Qa===null?Qa=[n]:Qa.push(n)}var ef=R(null),Br=null,va=null;function er(n,a,c){re(ef,a._currentValue),a._currentValue=c}function wa(n){n._currentValue=ef.current,q(ef)}function tf(n,a,c){for(;n!==null;){var u=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),n===c)break;n=n.return}}function nf(n,a,c,u){var m=n.child;for(m!==null&&(m.return=n);m!==null;){var b=m.dependencies;if(b!==null){var E=m.child;b=b.firstContext;e:for(;b!==null;){var L=b;b=m;for(var B=0;B<a.length;B++)if(L.context===a[B]){b.lanes|=c,L=b.alternate,L!==null&&(L.lanes|=c),tf(b.return,c,n),u||(E=null);break e}b=L.next}}else if(m.tag===18){if(E=m.return,E===null)throw Error(s(341));E.lanes|=c,b=E.alternate,b!==null&&(b.lanes|=c),tf(E,c,n),E=null}else E=m.child;if(E!==null)E.return=m;else for(E=m;E!==null;){if(E===n){E=null;break}if(m=E.sibling,m!==null){m.return=E.return,E=m;break}E=E.return}m=E}}function Hi(n,a,c,u){n=null;for(var m=a,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(s(387));if(E=E.memoizedProps,E!==null){var L=m.type;Zn(m.pendingProps.value,E.value)||(n!==null?n.push(L):n=[L])}}else if(m===Oe.current){if(E=m.alternate,E===null)throw Error(s(387));E.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(n!==null?n.push(Xl):n=[Xl])}m=m.return}n!==null&&nf(a,n,c,u),a.flags|=262144}function zd(n){for(n=n.firstContext;n!==null;){if(!Zn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function qr(n){Br=n,va=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Cn(n){return kb(Br,n)}function Hd(n,a){return Br===null&&qr(n),kb(n,a)}function kb(n,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},va===null){if(n===null)throw Error(s(308));va=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else va=va.next=a;return c}var b_=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(c,u){n.push(u)}};this.abort=function(){a.aborted=!0,n.forEach(function(c){return c()})}},v_=r.unstable_scheduleCallback,w_=r.unstable_NormalPriority,sn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sf(){return{controller:new b_,data:new Map,refCount:0}}function kl(n){n.refCount--,n.refCount===0&&v_(w_,function(){n.controller.abort()})}var Nl=null,af=0,Pi=0,Ui=null;function S_(n,a){if(Nl===null){var c=Nl=[];af=0,Pi=lp(),Ui={status:"pending",value:void 0,then:function(u){c.push(u)}}}return af++,a.then(Nb,Nb),a}function Nb(){if(--af===0&&Nl!==null){Ui!==null&&(Ui.status="fulfilled");var n=Nl;Nl=null,Pi=0,Ui=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function C_(n,a){var c=[],u={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return n.then(function(){u.status="fulfilled",u.value=a;for(var m=0;m<c.length;m++)(0,c[m])(a)},function(m){for(u.status="rejected",u.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),u}var Eb=W.S;W.S=function(n,a){dv=mt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&S_(n,a),Eb!==null&&Eb(n,a)};var Gr=R(null);function rf(){var n=Gr.current;return n!==null?n:Ht.pooledCache}function Pd(n,a){a===null?re(Gr,Gr.current):re(Gr,a.pool)}function _b(){var n=rf();return n===null?null:{parent:sn._currentValue,pool:n}}var Bi=Error(s(460)),of=Error(s(474)),Ud=Error(s(542)),Bd={then:function(){}};function Ab(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Tb(n,a,c){switch(c=n[c],c===void 0?n.push(a):c!==a&&(a.then(us,us),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Rb(n),n;default:if(typeof a.status=="string")a.then(us,us);else{if(n=Ht,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=a,n.status="pending",n.then(function(u){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=u}},function(u){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Rb(n),n}throw Vr=a,Bi}}function Fr(n){try{var a=n._init;return a(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Vr=c,Bi):c}}var Vr=null;function Db(){if(Vr===null)throw Error(s(459));var n=Vr;return Vr=null,n}function Rb(n){if(n===Bi||n===Ud)throw Error(s(483))}var qi=null,El=0;function qd(n){var a=El;return El+=1,qi===null&&(qi=[]),Tb(qi,n,a)}function _l(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Gd(n,a){throw a.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(a),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Ob(n){function a(Y,F){if(n){var Q=Y.deletions;Q===null?(Y.deletions=[F],Y.flags|=16):Q.push(F)}}function c(Y,F){if(!n)return null;for(;F!==null;)a(Y,F),F=F.sibling;return null}function u(Y){for(var F=new Map;Y!==null;)Y.key!==null?F.set(Y.key,Y):F.set(Y.index,Y),Y=Y.sibling;return F}function m(Y,F){return Y=xa(Y,F),Y.index=0,Y.sibling=null,Y}function b(Y,F,Q){return Y.index=Q,n?(Q=Y.alternate,Q!==null?(Q=Q.index,Q<F?(Y.flags|=67108866,F):Q):(Y.flags|=67108866,F)):(Y.flags|=1048576,F)}function E(Y){return n&&Y.alternate===null&&(Y.flags|=67108866),Y}function L(Y,F,Q,pe){return F===null||F.tag!==6?(F=Wh(Q,Y.mode,pe),F.return=Y,F):(F=m(F,Q),F.return=Y,F)}function B(Y,F,Q,pe){var Ve=Q.type;return Ve===S?ce(Y,F,Q.props.children,pe,Q.key):F!==null&&(F.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===K&&Fr(Ve)===F.type)?(F=m(F,Q.props),_l(F,Q),F.return=Y,F):(F=$d(Q.type,Q.key,Q.props,null,Y.mode,pe),_l(F,Q),F.return=Y,F)}function Z(Y,F,Q,pe){return F===null||F.tag!==4||F.stateNode.containerInfo!==Q.containerInfo||F.stateNode.implementation!==Q.implementation?(F=Yh(Q,Y.mode,pe),F.return=Y,F):(F=m(F,Q.children||[]),F.return=Y,F)}function ce(Y,F,Q,pe,Ve){return F===null||F.tag!==7?(F=Pr(Q,Y.mode,pe,Ve),F.return=Y,F):(F=m(F,Q),F.return=Y,F)}function be(Y,F,Q){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=Wh(""+F,Y.mode,Q),F.return=Y,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case w:return Q=$d(F.type,F.key,F.props,null,Y.mode,Q),_l(Q,F),Q.return=Y,Q;case v:return F=Yh(F,Y.mode,Q),F.return=Y,F;case K:return F=Fr(F),be(Y,F,Q)}if(je(F)||ve(F))return F=Pr(F,Y.mode,Q,null),F.return=Y,F;if(typeof F.then=="function")return be(Y,qd(F),Q);if(F.$$typeof===N)return be(Y,Hd(Y,F),Q);Gd(Y,F)}return null}function te(Y,F,Q,pe){var Ve=F!==null?F.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Ve!==null?null:L(Y,F,""+Q,pe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return Q.key===Ve?B(Y,F,Q,pe):null;case v:return Q.key===Ve?Z(Y,F,Q,pe):null;case K:return Q=Fr(Q),te(Y,F,Q,pe)}if(je(Q)||ve(Q))return Ve!==null?null:ce(Y,F,Q,pe,null);if(typeof Q.then=="function")return te(Y,F,qd(Q),pe);if(Q.$$typeof===N)return te(Y,F,Hd(Y,Q),pe);Gd(Y,Q)}return null}function ie(Y,F,Q,pe,Ve){if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return Y=Y.get(Q)||null,L(F,Y,""+pe,Ve);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case w:return Y=Y.get(pe.key===null?Q:pe.key)||null,B(F,Y,pe,Ve);case v:return Y=Y.get(pe.key===null?Q:pe.key)||null,Z(F,Y,pe,Ve);case K:return pe=Fr(pe),ie(Y,F,Q,pe,Ve)}if(je(pe)||ve(pe))return Y=Y.get(Q)||null,ce(F,Y,pe,Ve,null);if(typeof pe.then=="function")return ie(Y,F,Q,qd(pe),Ve);if(pe.$$typeof===N)return ie(Y,F,Q,Hd(F,pe),Ve);Gd(F,pe)}return null}function Le(Y,F,Q,pe){for(var Ve=null,Ct=null,Be=F,ot=F=0,ht=null;Be!==null&&ot<Q.length;ot++){Be.index>ot?(ht=Be,Be=null):ht=Be.sibling;var jt=te(Y,Be,Q[ot],pe);if(jt===null){Be===null&&(Be=ht);break}n&&Be&&jt.alternate===null&&a(Y,Be),F=b(jt,F,ot),Ct===null?Ve=jt:Ct.sibling=jt,Ct=jt,Be=ht}if(ot===Q.length)return c(Y,Be),xt&&ba(Y,ot),Ve;if(Be===null){for(;ot<Q.length;ot++)Be=be(Y,Q[ot],pe),Be!==null&&(F=b(Be,F,ot),Ct===null?Ve=Be:Ct.sibling=Be,Ct=Be);return xt&&ba(Y,ot),Ve}for(Be=u(Be);ot<Q.length;ot++)ht=ie(Be,Y,ot,Q[ot],pe),ht!==null&&(n&&ht.alternate!==null&&Be.delete(ht.key===null?ot:ht.key),F=b(ht,F,ot),Ct===null?Ve=ht:Ct.sibling=ht,Ct=ht);return n&&Be.forEach(function(xr){return a(Y,xr)}),xt&&ba(Y,ot),Ve}function Ye(Y,F,Q,pe){if(Q==null)throw Error(s(151));for(var Ve=null,Ct=null,Be=F,ot=F=0,ht=null,jt=Q.next();Be!==null&&!jt.done;ot++,jt=Q.next()){Be.index>ot?(ht=Be,Be=null):ht=Be.sibling;var xr=te(Y,Be,jt.value,pe);if(xr===null){Be===null&&(Be=ht);break}n&&Be&&xr.alternate===null&&a(Y,Be),F=b(xr,F,ot),Ct===null?Ve=xr:Ct.sibling=xr,Ct=xr,Be=ht}if(jt.done)return c(Y,Be),xt&&ba(Y,ot),Ve;if(Be===null){for(;!jt.done;ot++,jt=Q.next())jt=be(Y,jt.value,pe),jt!==null&&(F=b(jt,F,ot),Ct===null?Ve=jt:Ct.sibling=jt,Ct=jt);return xt&&ba(Y,ot),Ve}for(Be=u(Be);!jt.done;ot++,jt=Q.next())jt=ie(Be,Y,ot,jt.value,pe),jt!==null&&(n&&jt.alternate!==null&&Be.delete(jt.key===null?ot:jt.key),F=b(jt,F,ot),Ct===null?Ve=jt:Ct.sibling=jt,Ct=jt);return n&&Be.forEach(function(L1){return a(Y,L1)}),xt&&ba(Y,ot),Ve}function zt(Y,F,Q,pe){if(typeof Q=="object"&&Q!==null&&Q.type===S&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:e:{for(var Ve=Q.key;F!==null;){if(F.key===Ve){if(Ve=Q.type,Ve===S){if(F.tag===7){c(Y,F.sibling),pe=m(F,Q.props.children),pe.return=Y,Y=pe;break e}}else if(F.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===K&&Fr(Ve)===F.type){c(Y,F.sibling),pe=m(F,Q.props),_l(pe,Q),pe.return=Y,Y=pe;break e}c(Y,F);break}else a(Y,F);F=F.sibling}Q.type===S?(pe=Pr(Q.props.children,Y.mode,pe,Q.key),pe.return=Y,Y=pe):(pe=$d(Q.type,Q.key,Q.props,null,Y.mode,pe),_l(pe,Q),pe.return=Y,Y=pe)}return E(Y);case v:e:{for(Ve=Q.key;F!==null;){if(F.key===Ve)if(F.tag===4&&F.stateNode.containerInfo===Q.containerInfo&&F.stateNode.implementation===Q.implementation){c(Y,F.sibling),pe=m(F,Q.children||[]),pe.return=Y,Y=pe;break e}else{c(Y,F);break}else a(Y,F);F=F.sibling}pe=Yh(Q,Y.mode,pe),pe.return=Y,Y=pe}return E(Y);case K:return Q=Fr(Q),zt(Y,F,Q,pe)}if(je(Q))return Le(Y,F,Q,pe);if(ve(Q)){if(Ve=ve(Q),typeof Ve!="function")throw Error(s(150));return Q=Ve.call(Q),Ye(Y,F,Q,pe)}if(typeof Q.then=="function")return zt(Y,F,qd(Q),pe);if(Q.$$typeof===N)return zt(Y,F,Hd(Y,Q),pe);Gd(Y,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,F!==null&&F.tag===6?(c(Y,F.sibling),pe=m(F,Q),pe.return=Y,Y=pe):(c(Y,F),pe=Wh(Q,Y.mode,pe),pe.return=Y,Y=pe),E(Y)):c(Y,F)}return function(Y,F,Q,pe){try{El=0;var Ve=zt(Y,F,Q,pe);return qi=null,Ve}catch(Be){if(Be===Bi||Be===Ud)throw Be;var Ct=es(29,Be,null,Y.mode);return Ct.lanes=pe,Ct.return=Y,Ct}finally{}}}var Kr=Ob(!0),Lb=Ob(!1),tr=!1;function lf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cf(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function nr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function sr(n,a,c){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(At&2)!==0){var m=u.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),u.pending=a,a=Md(n),yb(n,null,c),a}return Ld(n,u,a,c),Md(n)}function Al(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var u=a.lanes;u&=n.pendingLanes,c|=u,a.lanes=c,Dt(n,c)}}function df(n,a){var c=n.updateQueue,u=n.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=a:b=b.next=a}else m=b=a;c={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:b,shared:u.shared,callbacks:u.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=a:n.next=a,c.lastBaseUpdate=a}var uf=!1;function Tl(){if(uf){var n=Ui;if(n!==null)throw n}}function Dl(n,a,c,u){uf=!1;var m=n.updateQueue;tr=!1;var b=m.firstBaseUpdate,E=m.lastBaseUpdate,L=m.shared.pending;if(L!==null){m.shared.pending=null;var B=L,Z=B.next;B.next=null,E===null?b=Z:E.next=Z,E=B;var ce=n.alternate;ce!==null&&(ce=ce.updateQueue,L=ce.lastBaseUpdate,L!==E&&(L===null?ce.firstBaseUpdate=Z:L.next=Z,ce.lastBaseUpdate=B))}if(b!==null){var be=m.baseState;E=0,ce=Z=B=null,L=b;do{var te=L.lane&-536870913,ie=te!==L.lane;if(ie?(gt&te)===te:(u&te)===te){te!==0&&te===Pi&&(uf=!0),ce!==null&&(ce=ce.next={lane:0,tag:L.tag,payload:L.payload,callback:null,next:null});e:{var Le=n,Ye=L;te=a;var zt=c;switch(Ye.tag){case 1:if(Le=Ye.payload,typeof Le=="function"){be=Le.call(zt,be,te);break e}be=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=Ye.payload,te=typeof Le=="function"?Le.call(zt,be,te):Le,te==null)break e;be=y({},be,te);break e;case 2:tr=!0}}te=L.callback,te!==null&&(n.flags|=64,ie&&(n.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[te]:ie.push(te))}else ie={lane:te,tag:L.tag,payload:L.payload,callback:L.callback,next:null},ce===null?(Z=ce=ie,B=be):ce=ce.next=ie,E|=te;if(L=L.next,L===null){if(L=m.shared.pending,L===null)break;ie=L,L=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);ce===null&&(B=be),m.baseState=B,m.firstBaseUpdate=Z,m.lastBaseUpdate=ce,b===null&&(m.shared.lanes=0),lr|=E,n.lanes=E,n.memoizedState=be}}function Mb(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function $b(n,a){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)Mb(c[n],a)}var Gi=R(null),Fd=R(0);function Ib(n,a){n=Ta,re(Fd,n),re(Gi,a),Ta=n|a.baseLanes}function gf(){re(Fd,Ta),re(Gi,Gi.current)}function hf(){Ta=Fd.current,q(Gi),q(Fd)}var ts=R(null),ys=null;function ar(n){var a=n.alternate;re(Zt,Zt.current&1),re(ts,n),ys===null&&(a===null||Gi.current!==null||a.memoizedState!==null)&&(ys=n)}function ff(n){re(Zt,Zt.current),re(ts,n),ys===null&&(ys=n)}function zb(n){n.tag===22?(re(Zt,Zt.current),re(ts,n),ys===null&&(ys=n)):rr()}function rr(){re(Zt,Zt.current),re(ts,ts.current)}function ns(n){q(ts),ys===n&&(ys=null),q(Zt)}var Zt=R(0);function Vd(n){for(var a=n;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||vp(c)||wp(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Sa=0,it=null,$t=null,an=null,Kd=!1,Fi=!1,Wr=!1,Wd=0,Rl=0,Vi=null,j_=0;function Wt(){throw Error(s(321))}function pf(n,a){if(a===null)return!1;for(var c=0;c<a.length&&c<n.length;c++)if(!Zn(n[c],a[c]))return!1;return!0}function mf(n,a,c,u,m,b){return Sa=b,it=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,W.H=n===null||n.memoizedState===null?w0:Df,Wr=!1,b=c(u,m),Wr=!1,Fi&&(b=Pb(a,c,u,m)),Hb(n),b}function Hb(n){W.H=Ml;var a=$t!==null&&$t.next!==null;if(Sa=0,an=$t=it=null,Kd=!1,Rl=0,Vi=null,a)throw Error(s(300));n===null||rn||(n=n.dependencies,n!==null&&zd(n)&&(rn=!0))}function Pb(n,a,c,u){it=n;var m=0;do{if(Fi&&(Vi=null),Rl=0,Fi=!1,25<=m)throw Error(s(301));if(m+=1,an=$t=null,n.updateQueue!=null){var b=n.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}W.H=S0,b=a(c,u)}while(Fi);return b}function k_(){var n=W.H,a=n.useState()[0];return a=typeof a.then=="function"?Ol(a):a,n=n.useState()[0],($t!==null?$t.memoizedState:null)!==n&&(it.flags|=1024),a}function yf(){var n=Wd!==0;return Wd=0,n}function xf(n,a,c){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~c}function bf(n){if(Kd){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Kd=!1}Sa=0,an=$t=it=null,Fi=!1,Rl=Wd=0,Vi=null}function Rn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return an===null?it.memoizedState=an=n:an=an.next=n,an}function en(){if($t===null){var n=it.alternate;n=n!==null?n.memoizedState:null}else n=$t.next;var a=an===null?it.memoizedState:an.next;if(a!==null)an=a,$t=n;else{if(n===null)throw it.alternate===null?Error(s(467)):Error(s(310));$t=n,n={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},an===null?it.memoizedState=an=n:an=an.next=n}return an}function Yd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ol(n){var a=Rl;return Rl+=1,Vi===null&&(Vi=[]),n=Tb(Vi,n,a),a=it,(an===null?a.memoizedState:an.next)===null&&(a=a.alternate,W.H=a===null||a.memoizedState===null?w0:Df),n}function Jd(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ol(n);if(n.$$typeof===N)return Cn(n)}throw Error(s(438,String(n)))}function vf(n){var a=null,c=it.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var u=it.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Yd(),it.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(n),u=0;u<n;u++)c[u]=we;return a.index++,c}function Ca(n,a){return typeof a=="function"?a(n):a}function Xd(n){var a=en();return wf(a,$t,n)}function wf(n,a,c){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=c;var m=n.baseQueue,b=u.pending;if(b!==null){if(m!==null){var E=m.next;m.next=b.next,b.next=E}a.baseQueue=m=b,u.pending=null}if(b=n.baseState,m===null)n.memoizedState=b;else{a=m.next;var L=E=null,B=null,Z=a,ce=!1;do{var be=Z.lane&-536870913;if(be!==Z.lane?(gt&be)===be:(Sa&be)===be){var te=Z.revertLane;if(te===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),be===Pi&&(ce=!0);else if((Sa&te)===te){Z=Z.next,te===Pi&&(ce=!0);continue}else be={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},B===null?(L=B=be,E=b):B=B.next=be,it.lanes|=te,lr|=te;be=Z.action,Wr&&c(b,be),b=Z.hasEagerState?Z.eagerState:c(b,be)}else te={lane:be,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},B===null?(L=B=te,E=b):B=B.next=te,it.lanes|=be,lr|=be;Z=Z.next}while(Z!==null&&Z!==a);if(B===null?E=b:B.next=L,!Zn(b,n.memoizedState)&&(rn=!0,ce&&(c=Ui,c!==null)))throw c;n.memoizedState=b,n.baseState=E,n.baseQueue=B,u.lastRenderedState=b}return m===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function Sf(n){var a=en(),c=a.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=n;var u=c.dispatch,m=c.pending,b=a.memoizedState;if(m!==null){c.pending=null;var E=m=m.next;do b=n(b,E.action),E=E.next;while(E!==m);Zn(b,a.memoizedState)||(rn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),c.lastRenderedState=b}return[b,u]}function Ub(n,a,c){var u=it,m=en(),b=xt;if(b){if(c===void 0)throw Error(s(407));c=c()}else c=a();var E=!Zn(($t||m).memoizedState,c);if(E&&(m.memoizedState=c,rn=!0),m=m.queue,kf(Gb.bind(null,u,m,n),[n]),m.getSnapshot!==a||E||an!==null&&an.memoizedState.tag&1){if(u.flags|=2048,Ki(9,{destroy:void 0},qb.bind(null,u,m,c,a),null),Ht===null)throw Error(s(349));b||(Sa&127)!==0||Bb(u,a,c)}return c}function Bb(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=it.updateQueue,a===null?(a=Yd(),it.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function qb(n,a,c,u){a.value=c,a.getSnapshot=u,Fb(a)&&Vb(n)}function Gb(n,a,c){return c(function(){Fb(a)&&Vb(n)})}function Fb(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!Zn(n,c)}catch{return!0}}function Vb(n){var a=Hr(n,2);a!==null&&Vn(a,n,2)}function Cf(n){var a=Rn();if(typeof n=="function"){var c=n;if(n=c(),Wr){me(!0);try{c()}finally{me(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ca,lastRenderedState:n},a}function Kb(n,a,c,u){return n.baseState=c,wf(n,$t,typeof u=="function"?u:Ca)}function N_(n,a,c,u,m){if(eu(n))throw Error(s(485));if(n=a.action,n!==null){var b={payload:m,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){b.listeners.push(E)}};W.T!==null?c(!0):b.isTransition=!1,u(b),c=a.pending,c===null?(b.next=a.pending=b,Wb(a,b)):(b.next=c.next,a.pending=c.next=b)}}function Wb(n,a){var c=a.action,u=a.payload,m=n.state;if(a.isTransition){var b=W.T,E={};W.T=E;try{var L=c(m,u),B=W.S;B!==null&&B(E,L),Yb(n,a,L)}catch(Z){jf(n,a,Z)}finally{b!==null&&E.types!==null&&(b.types=E.types),W.T=b}}else try{b=c(m,u),Yb(n,a,b)}catch(Z){jf(n,a,Z)}}function Yb(n,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(u){Jb(n,a,u)},function(u){return jf(n,a,u)}):Jb(n,a,c)}function Jb(n,a,c){a.status="fulfilled",a.value=c,Xb(a),n.state=c,a=n.pending,a!==null&&(c=a.next,c===a?n.pending=null:(c=c.next,a.next=c,Wb(n,c)))}function jf(n,a,c){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=c,Xb(a),a=a.next;while(a!==u)}n.action=null}function Xb(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Qb(n,a){return a}function Zb(n,a){if(xt){var c=Ht.formState;if(c!==null){e:{var u=it;if(xt){if(Pt){t:{for(var m=Pt,b=ms;m.nodeType!==8;){if(!b){m=null;break t}if(m=xs(m.nextSibling),m===null){m=null;break t}}b=m.data,m=b==="F!"||b==="F"?m:null}if(m){Pt=xs(m.nextSibling),u=m.data==="F!";break e}}Za(u)}u=!1}u&&(a=c[0])}}return c=Rn(),c.memoizedState=c.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qb,lastRenderedState:a},c.queue=u,c=x0.bind(null,it,u),u.dispatch=c,u=Cf(!1),b=Tf.bind(null,it,!1,u.queue),u=Rn(),m={state:a,dispatch:null,action:n,pending:null},u.queue=m,c=N_.bind(null,it,m,b,c),m.dispatch=c,u.memoizedState=n,[a,c,!1]}function e0(n){var a=en();return t0(a,$t,n)}function t0(n,a,c){if(a=wf(n,a,Qb)[0],n=Xd(Ca)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Ol(a)}catch(E){throw E===Bi?Ud:E}else u=a;a=en();var m=a.queue,b=m.dispatch;return c!==a.memoizedState&&(it.flags|=2048,Ki(9,{destroy:void 0},E_.bind(null,m,c),null)),[u,b,n]}function E_(n,a){n.action=a}function n0(n){var a=en(),c=$t;if(c!==null)return t0(a,c,n);en(),a=a.memoizedState,c=en();var u=c.queue.dispatch;return c.memoizedState=n,[a,u,!1]}function Ki(n,a,c,u){return n={tag:n,create:c,deps:u,inst:a,next:null},a=it.updateQueue,a===null&&(a=Yd(),it.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=n.next=n:(u=c.next,c.next=n,n.next=u,a.lastEffect=n),n}function s0(){return en().memoizedState}function Qd(n,a,c,u){var m=Rn();it.flags|=n,m.memoizedState=Ki(1|a,{destroy:void 0},c,u===void 0?null:u)}function Zd(n,a,c,u){var m=en();u=u===void 0?null:u;var b=m.memoizedState.inst;$t!==null&&u!==null&&pf(u,$t.memoizedState.deps)?m.memoizedState=Ki(a,b,c,u):(it.flags|=n,m.memoizedState=Ki(1|a,b,c,u))}function a0(n,a){Qd(8390656,8,n,a)}function kf(n,a){Zd(2048,8,n,a)}function __(n){it.flags|=4;var a=it.updateQueue;if(a===null)a=Yd(),it.updateQueue=a,a.events=[n];else{var c=a.events;c===null?a.events=[n]:c.push(n)}}function r0(n){var a=en().memoizedState;return __({ref:a,nextImpl:n}),function(){if((At&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function i0(n,a){return Zd(4,2,n,a)}function o0(n,a){return Zd(4,4,n,a)}function l0(n,a){if(typeof a=="function"){n=n();var c=a(n);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function c0(n,a,c){c=c!=null?c.concat([n]):null,Zd(4,4,l0.bind(null,a,n),c)}function Nf(){}function d0(n,a){var c=en();a=a===void 0?null:a;var u=c.memoizedState;return a!==null&&pf(a,u[1])?u[0]:(c.memoizedState=[n,a],n)}function u0(n,a){var c=en();a=a===void 0?null:a;var u=c.memoizedState;if(a!==null&&pf(a,u[1]))return u[0];if(u=n(),Wr){me(!0);try{n()}finally{me(!1)}}return c.memoizedState=[u,a],u}function Ef(n,a,c){return c===void 0||(Sa&1073741824)!==0&&(gt&261930)===0?n.memoizedState=a:(n.memoizedState=c,n=gv(),it.lanes|=n,lr|=n,c)}function g0(n,a,c,u){return Zn(c,a)?c:Gi.current!==null?(n=Ef(n,c,u),Zn(n,a)||(rn=!0),n):(Sa&42)===0||(Sa&1073741824)!==0&&(gt&261930)===0?(rn=!0,n.memoizedState=c):(n=gv(),it.lanes|=n,lr|=n,a)}function h0(n,a,c,u,m){var b=he.p;he.p=b!==0&&8>b?b:8;var E=W.T,L={};W.T=L,Tf(n,!1,a,c);try{var B=m(),Z=W.S;if(Z!==null&&Z(L,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var ce=C_(B,u);Ll(n,a,ce,rs(n))}else Ll(n,a,u,rs(n))}catch(be){Ll(n,a,{then:function(){},status:"rejected",reason:be},rs())}finally{he.p=b,E!==null&&L.types!==null&&(E.types=L.types),W.T=E}}function A_(){}function _f(n,a,c,u){if(n.tag!==5)throw Error(s(476));var m=f0(n).queue;h0(n,m,a,ee,c===null?A_:function(){return p0(n),c(u)})}function f0(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ca,lastRenderedState:ee},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ca,lastRenderedState:c},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function p0(n){var a=f0(n);a.next===null&&(a=n.alternate.memoizedState),Ll(n,a.next.queue,{},rs())}function Af(){return Cn(Xl)}function m0(){return en().memoizedState}function y0(){return en().memoizedState}function T_(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var c=rs();n=nr(c);var u=sr(a,n,c);u!==null&&(Vn(u,a,c),Al(u,a,c)),a={cache:sf()},n.payload=a;return}a=a.return}}function D_(n,a,c){var u=rs();c={lane:u,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},eu(n)?b0(a,c):(c=Vh(n,a,c,u),c!==null&&(Vn(c,n,u),v0(c,a,u)))}function x0(n,a,c){var u=rs();Ll(n,a,c,u)}function Ll(n,a,c,u){var m={lane:u,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(eu(n))b0(a,m);else{var b=n.alternate;if(n.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var E=a.lastRenderedState,L=b(E,c);if(m.hasEagerState=!0,m.eagerState=L,Zn(L,E))return Ld(n,a,m,0),Ht===null&&Od(),!1}catch{}finally{}if(c=Vh(n,a,m,u),c!==null)return Vn(c,n,u),v0(c,a,u),!0}return!1}function Tf(n,a,c,u){if(u={lane:2,revertLane:lp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},eu(n)){if(a)throw Error(s(479))}else a=Vh(n,c,u,2),a!==null&&Vn(a,n,2)}function eu(n){var a=n.alternate;return n===it||a!==null&&a===it}function b0(n,a){Fi=Kd=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function v0(n,a,c){if((c&4194048)!==0){var u=a.lanes;u&=n.pendingLanes,c|=u,a.lanes=c,Dt(n,c)}}var Ml={readContext:Cn,use:Jd,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};Ml.useEffectEvent=Wt;var w0={readContext:Cn,use:Jd,useCallback:function(n,a){return Rn().memoizedState=[n,a===void 0?null:a],n},useContext:Cn,useEffect:a0,useImperativeHandle:function(n,a,c){c=c!=null?c.concat([n]):null,Qd(4194308,4,l0.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Qd(4194308,4,n,a)},useInsertionEffect:function(n,a){Qd(4,2,n,a)},useMemo:function(n,a){var c=Rn();a=a===void 0?null:a;var u=n();if(Wr){me(!0);try{n()}finally{me(!1)}}return c.memoizedState=[u,a],u},useReducer:function(n,a,c){var u=Rn();if(c!==void 0){var m=c(a);if(Wr){me(!0);try{c(a)}finally{me(!1)}}}else m=a;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=D_.bind(null,it,n),[u.memoizedState,n]},useRef:function(n){var a=Rn();return n={current:n},a.memoizedState=n},useState:function(n){n=Cf(n);var a=n.queue,c=x0.bind(null,it,a);return a.dispatch=c,[n.memoizedState,c]},useDebugValue:Nf,useDeferredValue:function(n,a){var c=Rn();return Ef(c,n,a)},useTransition:function(){var n=Cf(!1);return n=h0.bind(null,it,n.queue,!0,!1),Rn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,c){var u=it,m=Rn();if(xt){if(c===void 0)throw Error(s(407));c=c()}else{if(c=a(),Ht===null)throw Error(s(349));(gt&127)!==0||Bb(u,a,c)}m.memoizedState=c;var b={value:c,getSnapshot:a};return m.queue=b,a0(Gb.bind(null,u,b,n),[n]),u.flags|=2048,Ki(9,{destroy:void 0},qb.bind(null,u,b,c,a),null),c},useId:function(){var n=Rn(),a=Ht.identifierPrefix;if(xt){var c=ea,u=Zs;c=(u&~(1<<32-ue(u)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Wd++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=j_++,a="_"+a+"r_"+c.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Af,useFormState:Zb,useActionState:Zb,useOptimistic:function(n){var a=Rn();a.memoizedState=a.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Tf.bind(null,it,!0,c),c.dispatch=a,[n,a]},useMemoCache:vf,useCacheRefresh:function(){return Rn().memoizedState=T_.bind(null,it)},useEffectEvent:function(n){var a=Rn(),c={impl:n};return a.memoizedState=c,function(){if((At&2)!==0)throw Error(s(440));return c.impl.apply(void 0,arguments)}}},Df={readContext:Cn,use:Jd,useCallback:d0,useContext:Cn,useEffect:kf,useImperativeHandle:c0,useInsertionEffect:i0,useLayoutEffect:o0,useMemo:u0,useReducer:Xd,useRef:s0,useState:function(){return Xd(Ca)},useDebugValue:Nf,useDeferredValue:function(n,a){var c=en();return g0(c,$t.memoizedState,n,a)},useTransition:function(){var n=Xd(Ca)[0],a=en().memoizedState;return[typeof n=="boolean"?n:Ol(n),a]},useSyncExternalStore:Ub,useId:m0,useHostTransitionStatus:Af,useFormState:e0,useActionState:e0,useOptimistic:function(n,a){var c=en();return Kb(c,$t,n,a)},useMemoCache:vf,useCacheRefresh:y0};Df.useEffectEvent=r0;var S0={readContext:Cn,use:Jd,useCallback:d0,useContext:Cn,useEffect:kf,useImperativeHandle:c0,useInsertionEffect:i0,useLayoutEffect:o0,useMemo:u0,useReducer:Sf,useRef:s0,useState:function(){return Sf(Ca)},useDebugValue:Nf,useDeferredValue:function(n,a){var c=en();return $t===null?Ef(c,n,a):g0(c,$t.memoizedState,n,a)},useTransition:function(){var n=Sf(Ca)[0],a=en().memoizedState;return[typeof n=="boolean"?n:Ol(n),a]},useSyncExternalStore:Ub,useId:m0,useHostTransitionStatus:Af,useFormState:n0,useActionState:n0,useOptimistic:function(n,a){var c=en();return $t!==null?Kb(c,$t,n,a):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:vf,useCacheRefresh:y0};S0.useEffectEvent=r0;function Rf(n,a,c,u){a=n.memoizedState,c=c(u,a),c=c==null?a:y({},a,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Of={enqueueSetState:function(n,a,c){n=n._reactInternals;var u=rs(),m=nr(u);m.payload=a,c!=null&&(m.callback=c),a=sr(n,m,u),a!==null&&(Vn(a,n,u),Al(a,n,u))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var u=rs(),m=nr(u);m.tag=1,m.payload=a,c!=null&&(m.callback=c),a=sr(n,m,u),a!==null&&(Vn(a,n,u),Al(a,n,u))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=rs(),u=nr(c);u.tag=2,a!=null&&(u.callback=a),a=sr(n,u,c),a!==null&&(Vn(a,n,c),Al(a,n,c))}};function C0(n,a,c,u,m,b,E){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,b,E):a.prototype&&a.prototype.isPureReactComponent?!wl(c,u)||!wl(m,b):!0}function j0(n,a,c,u){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,u),a.state!==n&&Of.enqueueReplaceState(a,a.state,null)}function Yr(n,a){var c=a;if("ref"in a){c={};for(var u in a)u!=="ref"&&(c[u]=a[u])}if(n=n.defaultProps){c===a&&(c=y({},c));for(var m in n)c[m]===void 0&&(c[m]=n[m])}return c}function k0(n){Rd(n)}function N0(n){console.error(n)}function E0(n){Rd(n)}function tu(n,a){try{var c=n.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function _0(n,a,c){try{var u=n.onCaughtError;u(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Lf(n,a,c){return c=nr(c),c.tag=3,c.payload={element:null},c.callback=function(){tu(n,a)},c}function A0(n){return n=nr(n),n.tag=3,n}function T0(n,a,c,u){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var b=u.value;n.payload=function(){return m(b)},n.callback=function(){_0(a,c,u)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(n.callback=function(){_0(a,c,u),typeof m!="function"&&(cr===null?cr=new Set([this]):cr.add(this));var L=u.stack;this.componentDidCatch(u.value,{componentStack:L!==null?L:""})})}function R_(n,a,c,u,m){if(c.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=c.alternate,a!==null&&Hi(a,c,m,!0),c=ts.current,c!==null){switch(c.tag){case 31:case 13:return ys===null?hu():c.alternate===null&&Yt===0&&(Yt=3),c.flags&=-257,c.flags|=65536,c.lanes=m,u===Bd?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([u]):a.add(u),rp(n,u,m)),!1;case 22:return c.flags|=65536,u===Bd?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([u]):c.add(u)),rp(n,u,m)),!1}throw Error(s(435,c.tag))}return rp(n,u,m),hu(),!1}if(xt)return a=ts.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,u!==Qh&&(n=Error(s(422),{cause:u}),jl(hs(n,c)))):(u!==Qh&&(a=Error(s(423),{cause:u}),jl(hs(a,c))),n=n.current.alternate,n.flags|=65536,m&=-m,n.lanes|=m,u=hs(u,c),m=Lf(n.stateNode,u,m),df(n,m),Yt!==4&&(Yt=2)),!1;var b=Error(s(520),{cause:u});if(b=hs(b,c),ql===null?ql=[b]:ql.push(b),Yt!==4&&(Yt=2),a===null)return!0;u=hs(u,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,n=m&-m,c.lanes|=n,n=Lf(c.stateNode,u,n),df(c,n),!1;case 1:if(a=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(cr===null||!cr.has(b))))return c.flags|=65536,m&=-m,c.lanes|=m,m=A0(m),T0(m,n,c,u),df(c,m),!1}c=c.return}while(c!==null);return!1}var Mf=Error(s(461)),rn=!1;function jn(n,a,c,u){a.child=n===null?Lb(a,null,c,u):Kr(a,n.child,c,u)}function D0(n,a,c,u,m){c=c.render;var b=a.ref;if("ref"in u){var E={};for(var L in u)L!=="ref"&&(E[L]=u[L])}else E=u;return qr(a),u=mf(n,a,c,E,b,m),L=yf(),n!==null&&!rn?(xf(n,a,m),ja(n,a,m)):(xt&&L&&Jh(a),a.flags|=1,jn(n,a,u,m),a.child)}function R0(n,a,c,u,m){if(n===null){var b=c.type;return typeof b=="function"&&!Kh(b)&&b.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=b,O0(n,a,b,u,m)):(n=$d(c.type,null,u,a,a.mode,m),n.ref=a.ref,n.return=a,a.child=n)}if(b=n.child,!qf(n,m)){var E=b.memoizedProps;if(c=c.compare,c=c!==null?c:wl,c(E,u)&&n.ref===a.ref)return ja(n,a,m)}return a.flags|=1,n=xa(b,u),n.ref=a.ref,n.return=a,a.child=n}function O0(n,a,c,u,m){if(n!==null){var b=n.memoizedProps;if(wl(b,u)&&n.ref===a.ref)if(rn=!1,a.pendingProps=u=b,qf(n,m))(n.flags&131072)!==0&&(rn=!0);else return a.lanes=n.lanes,ja(n,a,m)}return $f(n,a,c,u,m)}function L0(n,a,c,u){var m=u.children,b=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|c:c,n!==null){for(u=a.child=n.child,m=0;u!==null;)m=m|u.lanes|u.childLanes,u=u.sibling;u=m&~b}else u=0,a.child=null;return M0(n,a,b,c,u)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Pd(a,b!==null?b.cachePool:null),b!==null?Ib(a,b):gf(),zb(a);else return u=a.lanes=536870912,M0(n,a,b!==null?b.baseLanes|c:c,c,u)}else b!==null?(Pd(a,b.cachePool),Ib(a,b),rr(),a.memoizedState=null):(n!==null&&Pd(a,null),gf(),rr());return jn(n,a,m,c),a.child}function $l(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function M0(n,a,c,u,m){var b=rf();return b=b===null?null:{parent:sn._currentValue,pool:b},a.memoizedState={baseLanes:c,cachePool:b},n!==null&&Pd(a,null),gf(),zb(a),n!==null&&Hi(n,a,u,!0),a.childLanes=m,null}function nu(n,a){return a=au({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function $0(n,a,c){return Kr(a,n.child,null,c),n=nu(a,a.pendingProps),n.flags|=2,ns(a),a.memoizedState=null,n}function O_(n,a,c){var u=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(xt){if(u.mode==="hidden")return n=nu(a,u),a.lanes=536870912,$l(null,n);if(ff(a),(n=Pt)?(n=Wv(n,ms),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Xa!==null?{id:Zs,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},c=bb(n),c.return=a,a.child=c,Sn=a,Pt=null)):n=null,n===null)throw Za(a);return a.lanes=536870912,null}return nu(a,u)}var b=n.memoizedState;if(b!==null){var E=b.dehydrated;if(ff(a),m)if(a.flags&256)a.flags&=-257,a=$0(n,a,c);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(rn||Hi(n,a,c,!1),m=(c&n.childLanes)!==0,rn||m){if(u=Ht,u!==null&&(E=tn(u,c),E!==0&&E!==b.retryLane))throw b.retryLane=E,Hr(n,E),Vn(u,n,E),Mf;hu(),a=$0(n,a,c)}else n=b.treeContext,Pt=xs(E.nextSibling),Sn=a,xt=!0,Qa=null,ms=!1,n!==null&&Sb(a,n),a=nu(a,u),a.flags|=4096;return a}return n=xa(n.child,{mode:u.mode,children:u.children}),n.ref=a.ref,a.child=n,n.return=a,n}function su(n,a){var c=a.ref;if(c===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(s(284));(n===null||n.ref!==c)&&(a.flags|=4194816)}}function $f(n,a,c,u,m){return qr(a),c=mf(n,a,c,u,void 0,m),u=yf(),n!==null&&!rn?(xf(n,a,m),ja(n,a,m)):(xt&&u&&Jh(a),a.flags|=1,jn(n,a,c,m),a.child)}function I0(n,a,c,u,m,b){return qr(a),a.updateQueue=null,c=Pb(a,u,c,m),Hb(n),u=yf(),n!==null&&!rn?(xf(n,a,b),ja(n,a,b)):(xt&&u&&Jh(a),a.flags|=1,jn(n,a,c,b),a.child)}function z0(n,a,c,u,m){if(qr(a),a.stateNode===null){var b=Mi,E=c.contextType;typeof E=="object"&&E!==null&&(b=Cn(E)),b=new c(u,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=Of,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=u,b.state=a.memoizedState,b.refs={},lf(a),E=c.contextType,b.context=typeof E=="object"&&E!==null?Cn(E):Mi,b.state=a.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(Rf(a,c,E,u),b.state=a.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&&Of.enqueueReplaceState(b,b.state,null),Dl(a,u,b,m),Tl(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(n===null){b=a.stateNode;var L=a.memoizedProps,B=Yr(c,L);b.props=B;var Z=b.context,ce=c.contextType;E=Mi,typeof ce=="object"&&ce!==null&&(E=Cn(ce));var be=c.getDerivedStateFromProps;ce=typeof be=="function"||typeof b.getSnapshotBeforeUpdate=="function",L=a.pendingProps!==L,ce||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(L||Z!==E)&&j0(a,b,u,E),tr=!1;var te=a.memoizedState;b.state=te,Dl(a,u,b,m),Tl(),Z=a.memoizedState,L||te!==Z||tr?(typeof be=="function"&&(Rf(a,c,be,u),Z=a.memoizedState),(B=tr||C0(a,c,B,u,te,Z,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"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=Z),b.props=u,b.state=Z,b.context=E,u=B):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{b=a.stateNode,cf(n,a),E=a.memoizedProps,ce=Yr(c,E),b.props=ce,be=a.pendingProps,te=b.context,Z=c.contextType,B=Mi,typeof Z=="object"&&Z!==null&&(B=Cn(Z)),L=c.getDerivedStateFromProps,(Z=typeof L=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(E!==be||te!==B)&&j0(a,b,u,B),tr=!1,te=a.memoizedState,b.state=te,Dl(a,u,b,m),Tl();var ie=a.memoizedState;E!==be||te!==ie||tr||n!==null&&n.dependencies!==null&&zd(n.dependencies)?(typeof L=="function"&&(Rf(a,c,L,u),ie=a.memoizedState),(ce=tr||C0(a,c,ce,u,te,ie,B)||n!==null&&n.dependencies!==null&&zd(n.dependencies))?(Z||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(u,ie,B),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(u,ie,B)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||E===n.memoizedProps&&te===n.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||E===n.memoizedProps&&te===n.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ie),b.props=u,b.state=ie,b.context=B,u=ce):(typeof b.componentDidUpdate!="function"||E===n.memoizedProps&&te===n.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||E===n.memoizedProps&&te===n.memoizedState||(a.flags|=1024),u=!1)}return b=u,su(n,a),u=(a.flags&128)!==0,b||u?(b=a.stateNode,c=u&&typeof c.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,n!==null&&u?(a.child=Kr(a,n.child,null,m),a.child=Kr(a,null,c,m)):jn(n,a,c,m),a.memoizedState=b.state,n=a.child):n=ja(n,a,m),n}function H0(n,a,c,u){return Ur(),a.flags|=256,jn(n,a,c,u),a.child}var If={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zf(n){return{baseLanes:n,cachePool:_b()}}function Hf(n,a,c){return n=n!==null?n.childLanes&~c:0,a&&(n|=as),n}function P0(n,a,c){var u=a.pendingProps,m=!1,b=(a.flags&128)!==0,E;if((E=b)||(E=n!==null&&n.memoizedState===null?!1:(Zt.current&2)!==0),E&&(m=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,n===null){if(xt){if(m?ar(a):rr(),(n=Pt)?(n=Wv(n,ms),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Xa!==null?{id:Zs,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},c=bb(n),c.return=a,a.child=c,Sn=a,Pt=null)):n=null,n===null)throw Za(a);return wp(n)?a.lanes=32:a.lanes=536870912,null}var L=u.children;return u=u.fallback,m?(rr(),m=a.mode,L=au({mode:"hidden",children:L},m),u=Pr(u,m,c,null),L.return=a,u.return=a,L.sibling=u,a.child=L,u=a.child,u.memoizedState=zf(c),u.childLanes=Hf(n,E,c),a.memoizedState=If,$l(null,u)):(ar(a),Pf(a,L))}var B=n.memoizedState;if(B!==null&&(L=B.dehydrated,L!==null)){if(b)a.flags&256?(ar(a),a.flags&=-257,a=Uf(n,a,c)):a.memoizedState!==null?(rr(),a.child=n.child,a.flags|=128,a=null):(rr(),L=u.fallback,m=a.mode,u=au({mode:"visible",children:u.children},m),L=Pr(L,m,c,null),L.flags|=2,u.return=a,L.return=a,u.sibling=L,a.child=u,Kr(a,n.child,null,c),u=a.child,u.memoizedState=zf(c),u.childLanes=Hf(n,E,c),a.memoizedState=If,a=$l(null,u));else if(ar(a),wp(L)){if(E=L.nextSibling&&L.nextSibling.dataset,E)var Z=E.dgst;E=Z,u=Error(s(419)),u.stack="",u.digest=E,jl({value:u,source:null,stack:null}),a=Uf(n,a,c)}else if(rn||Hi(n,a,c,!1),E=(c&n.childLanes)!==0,rn||E){if(E=Ht,E!==null&&(u=tn(E,c),u!==0&&u!==B.retryLane))throw B.retryLane=u,Hr(n,u),Vn(E,n,u),Mf;vp(L)||hu(),a=Uf(n,a,c)}else vp(L)?(a.flags|=192,a.child=n.child,a=null):(n=B.treeContext,Pt=xs(L.nextSibling),Sn=a,xt=!0,Qa=null,ms=!1,n!==null&&Sb(a,n),a=Pf(a,u.children),a.flags|=4096);return a}return m?(rr(),L=u.fallback,m=a.mode,B=n.child,Z=B.sibling,u=xa(B,{mode:"hidden",children:u.children}),u.subtreeFlags=B.subtreeFlags&65011712,Z!==null?L=xa(Z,L):(L=Pr(L,m,c,null),L.flags|=2),L.return=a,u.return=a,u.sibling=L,a.child=u,$l(null,u),u=a.child,L=n.child.memoizedState,L===null?L=zf(c):(m=L.cachePool,m!==null?(B=sn._currentValue,m=m.parent!==B?{parent:B,pool:B}:m):m=_b(),L={baseLanes:L.baseLanes|c,cachePool:m}),u.memoizedState=L,u.childLanes=Hf(n,E,c),a.memoizedState=If,$l(n.child,u)):(ar(a),c=n.child,n=c.sibling,c=xa(c,{mode:"visible",children:u.children}),c.return=a,c.sibling=null,n!==null&&(E=a.deletions,E===null?(a.deletions=[n],a.flags|=16):E.push(n)),a.child=c,a.memoizedState=null,c)}function Pf(n,a){return a=au({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function au(n,a){return n=es(22,n,null,a),n.lanes=0,n}function Uf(n,a,c){return Kr(a,n.child,null,c),n=Pf(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function U0(n,a,c){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a),tf(n.return,a,c)}function Bf(n,a,c,u,m,b){var E=n.memoizedState;E===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:c,tailMode:m,treeForkCount:b}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=u,E.tail=c,E.tailMode=m,E.treeForkCount=b)}function B0(n,a,c){var u=a.pendingProps,m=u.revealOrder,b=u.tail;u=u.children;var E=Zt.current,L=(E&2)!==0;if(L?(E=E&1|2,a.flags|=128):E&=1,re(Zt,E),jn(n,a,u,c),u=xt?Cl:0,!L&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&U0(n,c,a);else if(n.tag===19)U0(n,c,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(m){case"forwards":for(c=a.child,m=null;c!==null;)n=c.alternate,n!==null&&Vd(n)===null&&(m=c),c=c.sibling;c=m,c===null?(m=a.child,a.child=null):(m=c.sibling,c.sibling=null),Bf(a,!1,m,c,b,u);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=a.child,a.child=null;m!==null;){if(n=m.alternate,n!==null&&Vd(n)===null){a.child=m;break}n=m.sibling,m.sibling=c,c=m,m=n}Bf(a,!0,c,null,b,u);break;case"together":Bf(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function ja(n,a,c){if(n!==null&&(a.dependencies=n.dependencies),lr|=a.lanes,(c&a.childLanes)===0)if(n!==null){if(Hi(n,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(s(153));if(a.child!==null){for(n=a.child,c=xa(n,n.pendingProps),a.child=c,c.return=a;n.sibling!==null;)n=n.sibling,c=c.sibling=xa(n,n.pendingProps),c.return=a;c.sibling=null}return a.child}function qf(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&zd(n)))}function L_(n,a,c){switch(a.tag){case 3:De(a,a.stateNode.containerInfo),er(a,sn,n.memoizedState.cache),Ur();break;case 27:case 5:Ie(a);break;case 4:De(a,a.stateNode.containerInfo);break;case 10:er(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,ff(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(ar(a),a.flags|=128,null):(c&a.child.childLanes)!==0?P0(n,a,c):(ar(a),n=ja(n,a,c),n!==null?n.sibling:null);ar(a);break;case 19:var m=(n.flags&128)!==0;if(u=(c&a.childLanes)!==0,u||(Hi(n,a,c,!1),u=(c&a.childLanes)!==0),m){if(u)return B0(n,a,c);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),re(Zt,Zt.current),u)break;return null;case 22:return a.lanes=0,L0(n,a,c,a.pendingProps);case 24:er(a,sn,n.memoizedState.cache)}return ja(n,a,c)}function q0(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps)rn=!0;else{if(!qf(n,c)&&(a.flags&128)===0)return rn=!1,L_(n,a,c);rn=(n.flags&131072)!==0}else rn=!1,xt&&(a.flags&1048576)!==0&&wb(a,Cl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(n=Fr(a.elementType),a.type=n,typeof n=="function")Kh(n)?(u=Yr(n,u),a.tag=1,a=z0(null,a,n,u,c)):(a.tag=0,a=$f(null,a,n,u,c));else{if(n!=null){var m=n.$$typeof;if(m===D){a.tag=11,a=D0(null,a,n,u,c);break e}else if(m===z){a.tag=14,a=R0(null,a,n,u,c);break e}}throw a=de(n)||n,Error(s(306,a,""))}}return a;case 0:return $f(n,a,a.type,a.pendingProps,c);case 1:return u=a.type,m=Yr(u,a.pendingProps),z0(n,a,u,m,c);case 3:e:{if(De(a,a.stateNode.containerInfo),n===null)throw Error(s(387));u=a.pendingProps;var b=a.memoizedState;m=b.element,cf(n,a),Dl(a,u,null,c);var E=a.memoizedState;if(u=E.cache,er(a,sn,u),u!==b.cache&&nf(a,[sn],c,!0),Tl(),u=E.element,b.isDehydrated)if(b={element:u,isDehydrated:!1,cache:E.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=H0(n,a,u,c);break e}else if(u!==m){m=hs(Error(s(424)),a),jl(m),a=H0(n,a,u,c);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Pt=xs(n.firstChild),Sn=a,xt=!0,Qa=null,ms=!0,c=Lb(a,null,u,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ur(),u===m){a=ja(n,a,c);break e}jn(n,a,u,c)}a=a.child}return a;case 26:return su(n,a),n===null?(c=ew(a.type,null,a.pendingProps,null))?a.memoizedState=c:xt||(c=a.type,n=a.pendingProps,u=vu(ke.current).createElement(c),u[gn]=a,u[wn]=n,kn(u,c,n),nn(u),a.stateNode=u):a.memoizedState=ew(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Ie(a),n===null&&xt&&(u=a.stateNode=Xv(a.type,a.pendingProps,ke.current),Sn=a,ms=!0,m=Pt,hr(a.type)?(Sp=m,Pt=xs(u.firstChild)):Pt=m),jn(n,a,a.pendingProps.children,c),su(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&xt&&((m=u=Pt)&&(u=d1(u,a.type,a.pendingProps,ms),u!==null?(a.stateNode=u,Sn=a,Pt=xs(u.firstChild),ms=!1,m=!0):m=!1),m||Za(a)),Ie(a),m=a.type,b=a.pendingProps,E=n!==null?n.memoizedProps:null,u=b.children,yp(m,b)?u=null:E!==null&&yp(m,E)&&(a.flags|=32),a.memoizedState!==null&&(m=mf(n,a,k_,null,null,c),Xl._currentValue=m),su(n,a),jn(n,a,u,c),a.child;case 6:return n===null&&xt&&((n=c=Pt)&&(c=u1(c,a.pendingProps,ms),c!==null?(a.stateNode=c,Sn=a,Pt=null,n=!0):n=!1),n||Za(a)),null;case 13:return P0(n,a,c);case 4:return De(a,a.stateNode.containerInfo),u=a.pendingProps,n===null?a.child=Kr(a,null,u,c):jn(n,a,u,c),a.child;case 11:return D0(n,a,a.type,a.pendingProps,c);case 7:return jn(n,a,a.pendingProps,c),a.child;case 8:return jn(n,a,a.pendingProps.children,c),a.child;case 12:return jn(n,a,a.pendingProps.children,c),a.child;case 10:return u=a.pendingProps,er(a,a.type,u.value),jn(n,a,u.children,c),a.child;case 9:return m=a.type._context,u=a.pendingProps.children,qr(a),m=Cn(m),u=u(m),a.flags|=1,jn(n,a,u,c),a.child;case 14:return R0(n,a,a.type,a.pendingProps,c);case 15:return O0(n,a,a.type,a.pendingProps,c);case 19:return B0(n,a,c);case 31:return O_(n,a,c);case 22:return L0(n,a,c,a.pendingProps);case 24:return qr(a),u=Cn(sn),n===null?(m=rf(),m===null&&(m=Ht,b=sf(),m.pooledCache=b,b.refCount++,b!==null&&(m.pooledCacheLanes|=c),m=b),a.memoizedState={parent:u,cache:m},lf(a),er(a,sn,m)):((n.lanes&c)!==0&&(cf(n,a),Dl(a,null,null,c),Tl()),m=n.memoizedState,b=a.memoizedState,m.parent!==u?(m={parent:u,cache:u},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),er(a,sn,u)):(u=b.cache,er(a,sn,u),u!==m.cache&&nf(a,[sn],c,!0))),jn(n,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function ka(n){n.flags|=4}function Gf(n,a,c,u,m){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(m&335544128)===m)if(n.stateNode.complete)n.flags|=8192;else if(mv())n.flags|=8192;else throw Vr=Bd,of}else n.flags&=-16777217}function G0(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!rw(a))if(mv())n.flags|=8192;else throw Vr=Bd,of}function ru(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?rt():536870912,n.lanes|=a,Xi|=a)}function Il(n,a){if(!xt)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var u=null;c!==null;)c.alternate!==null&&(u=c),c=c.sibling;u===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function Ut(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,u=0;if(a)for(var m=n.child;m!==null;)c|=m.lanes|m.childLanes,u|=m.subtreeFlags&65011712,u|=m.flags&65011712,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)c|=m.lanes|m.childLanes,u|=m.subtreeFlags,u|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=u,n.childLanes=c,a}function M_(n,a,c){var u=a.pendingProps;switch(Xh(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(a),null;case 1:return Ut(a),null;case 3:return c=a.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),wa(sn),qe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(zi(a)?ka(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Zh())),Ut(a),null;case 26:var m=a.type,b=a.memoizedState;return n===null?(ka(a),b!==null?(Ut(a),G0(a,b)):(Ut(a),Gf(a,m,null,u,c))):b?b!==n.memoizedState?(ka(a),Ut(a),G0(a,b)):(Ut(a),a.flags&=-16777217):(n=n.memoizedProps,n!==u&&ka(a),Ut(a),Gf(a,m,n,u,c)),null;case 27:if(Nt(a),c=ke.current,m=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&ka(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Ut(a),null}n=xe.current,zi(a)?Cb(a):(n=Xv(m,u,c),a.stateNode=n,ka(a))}return Ut(a),null;case 5:if(Nt(a),m=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&ka(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Ut(a),null}if(b=xe.current,zi(a))Cb(a);else{var E=vu(ke.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]=a,b[wn]=u;e:for(E=a.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===a)break e;for(;E.sibling===null;){if(E.return===null||E.return===a)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}a.stateNode=b;e:switch(kn(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&&ka(a)}}return Ut(a),Gf(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,c),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==u&&ka(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(s(166));if(n=ke.current,zi(a)){if(n=a.stateNode,c=a.memoizedProps,u=null,m=Sn,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[gn]=a,n=!!(n.nodeValue===c||u!==null&&u.suppressHydrationWarning===!0||Pv(n.nodeValue,c)),n||Za(a,!0)}else n=vu(n).createTextNode(u),n[gn]=a,a.stateNode=n}return Ut(a),null;case 31:if(c=a.memoizedState,n===null||n.memoizedState!==null){if(u=zi(a),c!==null){if(n===null){if(!u)throw Error(s(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[gn]=a}else Ur(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),n=!1}else c=Zh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return a.flags&256?(ns(a),a):(ns(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Ut(a),null;case 13:if(u=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=zi(a),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(s(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));m[gn]=a}else Ur(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),m=!1}else m=Zh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(ns(a),a):(ns(a),null)}return ns(a),(a.flags&128)!==0?(a.lanes=c,a):(c=u!==null,n=n!==null&&n.memoizedState!==null,c&&(u=a.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!==n&&c&&(a.child.flags|=8192),ru(a,a.updateQueue),Ut(a),null);case 4:return qe(),n===null&&gp(a.stateNode.containerInfo),Ut(a),null;case 10:return wa(a.type),Ut(a),null;case 19:if(q(Zt),u=a.memoizedState,u===null)return Ut(a),null;if(m=(a.flags&128)!==0,b=u.rendering,b===null)if(m)Il(u,!1);else{if(Yt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(b=Vd(n),b!==null){for(a.flags|=128,Il(u,!1),n=b.updateQueue,a.updateQueue=n,ru(a,n),a.subtreeFlags=0,n=c,c=a.child;c!==null;)xb(c,n),c=c.sibling;return re(Zt,Zt.current&1|2),xt&&ba(a,u.treeForkCount),a.child}n=n.sibling}u.tail!==null&&mt()>du&&(a.flags|=128,m=!0,Il(u,!1),a.lanes=4194304)}else{if(!m)if(n=Vd(b),n!==null){if(a.flags|=128,m=!0,n=n.updateQueue,a.updateQueue=n,ru(a,n),Il(u,!0),u.tail===null&&u.tailMode==="hidden"&&!b.alternate&&!xt)return Ut(a),null}else 2*mt()-u.renderingStartTime>du&&c!==536870912&&(a.flags|=128,m=!0,Il(u,!1),a.lanes=4194304);u.isBackwards?(b.sibling=a.child,a.child=b):(n=u.last,n!==null?n.sibling=b:a.child=b,u.last=b)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=mt(),n.sibling=null,c=Zt.current,re(Zt,m?c&1|2:c&1),xt&&ba(a,u.treeForkCount),n):(Ut(a),null);case 22:case 23:return ns(a),hf(),u=a.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(c&536870912)!==0&&(a.flags&128)===0&&(Ut(a),a.subtreeFlags&6&&(a.flags|=8192)):Ut(a),c=a.updateQueue,c!==null&&ru(a,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==c&&(a.flags|=2048),n!==null&&q(Gr),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),wa(sn),Ut(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function $_(n,a){switch(Xh(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return wa(sn),qe(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Nt(a),null;case 31:if(a.memoizedState!==null){if(ns(a),a.alternate===null)throw Error(s(340));Ur()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(ns(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));Ur()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return q(Zt),null;case 4:return qe(),null;case 10:return wa(a.type),null;case 22:case 23:return ns(a),hf(),n!==null&&q(Gr),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return wa(sn),null;case 25:return null;default:return null}}function F0(n,a){switch(Xh(a),a.tag){case 3:wa(sn),qe();break;case 26:case 27:case 5:Nt(a);break;case 4:qe();break;case 31:a.memoizedState!==null&&ns(a);break;case 13:ns(a);break;case 19:q(Zt);break;case 10:wa(a.type);break;case 22:case 23:ns(a),hf(),n!==null&&q(Gr);break;case 24:wa(sn)}}function zl(n,a){try{var c=a.updateQueue,u=c!==null?c.lastEffect:null;if(u!==null){var m=u.next;c=m;do{if((c.tag&n)===n){u=void 0;var b=c.create,E=c.inst;u=b(),E.destroy=u}c=c.next}while(c!==m)}}catch(L){Lt(a,a.return,L)}}function ir(n,a,c){try{var u=a.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var b=m.next;u=b;do{if((u.tag&n)===n){var E=u.inst,L=E.destroy;if(L!==void 0){E.destroy=void 0,m=a;var B=c,Z=L;try{Z()}catch(ce){Lt(m,B,ce)}}}u=u.next}while(u!==b)}}catch(ce){Lt(a,a.return,ce)}}function V0(n){var a=n.updateQueue;if(a!==null){var c=n.stateNode;try{$b(a,c)}catch(u){Lt(n,n.return,u)}}}function K0(n,a,c){c.props=Yr(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(u){Lt(n,a,u)}}function Hl(n,a){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof c=="function"?n.refCleanup=c(u):c.current=u}}catch(m){Lt(n,a,m)}}function ta(n,a){var c=n.ref,u=n.refCleanup;if(c!==null)if(typeof u=="function")try{u()}catch(m){Lt(n,a,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Lt(n,a,m)}else c.current=null}function W0(n){var a=n.type,c=n.memoizedProps,u=n.stateNode;try{e:switch(a){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){Lt(n,n.return,m)}}function Ff(n,a,c){try{var u=n.stateNode;a1(u,n.type,c,a),u[wn]=a}catch(m){Lt(n,n.return,m)}}function Y0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&hr(n.type)||n.tag===4}function Vf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Y0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&hr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Kf(n,a,c){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(n),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=us));else if(u!==4&&(u===27&&hr(n.type)&&(c=n.stateNode,a=null),n=n.child,n!==null))for(Kf(n,a,c),n=n.sibling;n!==null;)Kf(n,a,c),n=n.sibling}function iu(n,a,c){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?c.insertBefore(n,a):c.appendChild(n);else if(u!==4&&(u===27&&hr(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(iu(n,a,c),n=n.sibling;n!==null;)iu(n,a,c),n=n.sibling}function J0(n){var a=n.stateNode,c=n.memoizedProps;try{for(var u=n.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);kn(a,u,c),a[gn]=n,a[wn]=c}catch(b){Lt(n,n.return,b)}}var Na=!1,on=!1,Wf=!1,X0=typeof WeakSet=="function"?WeakSet:Set,bn=null;function I_(n,a){if(n=n.containerInfo,pp=Eu,n=cb(n),Ph(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.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,L=-1,B=-1,Z=0,ce=0,be=n,te=null;t:for(;;){for(var ie;be!==c||m!==0&&be.nodeType!==3||(L=E+m),be!==b||u!==0&&be.nodeType!==3||(B=E+u),be.nodeType===3&&(E+=be.nodeValue.length),(ie=be.firstChild)!==null;)te=be,be=ie;for(;;){if(be===n)break t;if(te===c&&++Z===m&&(L=E),te===b&&++ce===u&&(B=E),(ie=be.nextSibling)!==null)break;be=te,te=be.parentNode}be=ie}c=L===-1||B===-1?null:{start:L,end:B}}else c=null}c=c||{start:0,end:0}}else c=null;for(mp={focusedElem:n,selectionRange:c},Eu=!1,bn=a;bn!==null;)if(a=bn,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,bn=n;else for(;bn!==null;){switch(a=bn,b=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)m=n[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&b!==null){n=void 0,c=a,m=b.memoizedProps,b=b.memoizedState,u=c.stateNode;try{var Le=Yr(c.type,m);n=u.getSnapshotBeforeUpdate(Le,b),u.__reactInternalSnapshotBeforeUpdate=n}catch(Ye){Lt(c,c.return,Ye)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,c=n.nodeType,c===9)bp(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":bp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=a.sibling,n!==null){n.return=a.return,bn=n;break}bn=a.return}}function Q0(n,a,c){var u=c.flags;switch(c.tag){case 0:case 11:case 15:_a(n,c),u&4&&zl(5,c);break;case 1:if(_a(n,c),u&4)if(n=c.stateNode,a===null)try{n.componentDidMount()}catch(E){Lt(c,c.return,E)}else{var m=Yr(c.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(m,a,n.__reactInternalSnapshotBeforeUpdate)}catch(E){Lt(c,c.return,E)}}u&64&&V0(c),u&512&&Hl(c,c.return);break;case 3:if(_a(n,c),u&64&&(n=c.updateQueue,n!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{$b(n,a)}catch(E){Lt(c,c.return,E)}}break;case 27:a===null&&u&4&&J0(c);case 26:case 5:_a(n,c),a===null&&u&4&&W0(c),u&512&&Hl(c,c.return);break;case 12:_a(n,c);break;case 31:_a(n,c),u&4&&tv(n,c);break;case 13:_a(n,c),u&4&&nv(n,c),u&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=V_.bind(null,c),g1(n,c))));break;case 22:if(u=c.memoizedState!==null||Na,!u){a=a!==null&&a.memoizedState!==null||on,m=Na;var b=on;Na=u,(on=a)&&!b?Aa(n,c,(c.subtreeFlags&8772)!==0):_a(n,c),Na=m,on=b}break;case 30:break;default:_a(n,c)}}function Z0(n){var a=n.alternate;a!==null&&(n.alternate=null,Z0(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Xo(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Bt=null,Bn=!1;function Ea(n,a,c){for(c=c.child;c!==null;)ev(n,a,c),c=c.sibling}function ev(n,a,c){if(V&&typeof V.onCommitFiberUnmount=="function")try{V.onCommitFiberUnmount(ds,c)}catch{}switch(c.tag){case 26:on||ta(c,a),Ea(n,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:on||ta(c,a);var u=Bt,m=Bn;hr(c.type)&&(Bt=c.stateNode,Bn=!1),Ea(n,a,c),Wl(c.stateNode),Bt=u,Bn=m;break;case 5:on||ta(c,a);case 6:if(u=Bt,m=Bn,Bt=null,Ea(n,a,c),Bt=u,Bn=m,Bt!==null)if(Bn)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(c.stateNode)}catch(b){Lt(c,a,b)}else try{Bt.removeChild(c.stateNode)}catch(b){Lt(c,a,b)}break;case 18:Bt!==null&&(Bn?(n=Bt,Vv(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),ro(n)):Vv(Bt,c.stateNode));break;case 4:u=Bt,m=Bn,Bt=c.stateNode.containerInfo,Bn=!0,Ea(n,a,c),Bt=u,Bn=m;break;case 0:case 11:case 14:case 15:ir(2,c,a),on||ir(4,c,a),Ea(n,a,c);break;case 1:on||(ta(c,a),u=c.stateNode,typeof u.componentWillUnmount=="function"&&K0(c,a,u)),Ea(n,a,c);break;case 21:Ea(n,a,c);break;case 22:on=(u=on)||c.memoizedState!==null,Ea(n,a,c),on=u;break;default:Ea(n,a,c)}}function tv(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{ro(n)}catch(c){Lt(a,a.return,c)}}}function nv(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{ro(n)}catch(c){Lt(a,a.return,c)}}function z_(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new X0),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new X0),a;default:throw Error(s(435,n.tag))}}function ou(n,a){var c=z_(n);a.forEach(function(u){if(!c.has(u)){c.add(u);var m=K_.bind(null,n,u);u.then(m,m)}})}function qn(n,a){var c=a.deletions;if(c!==null)for(var u=0;u<c.length;u++){var m=c[u],b=n,E=a,L=E;e:for(;L!==null;){switch(L.tag){case 27:if(hr(L.type)){Bt=L.stateNode,Bn=!1;break e}break;case 5:Bt=L.stateNode,Bn=!1;break e;case 3:case 4:Bt=L.stateNode.containerInfo,Bn=!0;break e}L=L.return}if(Bt===null)throw Error(s(160));ev(b,E,m),Bt=null,Bn=!1,b=m.alternate,b!==null&&(b.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)sv(a,n),a=a.sibling}var zs=null;function sv(n,a){var c=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:qn(a,n),Gn(n),u&4&&(ir(3,n,n.return),zl(3,n),ir(5,n,n.return));break;case 1:qn(a,n),Gn(n),u&512&&(on||c===null||ta(c,c.return)),u&64&&Na&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?u:c.concat(u))));break;case 26:var m=zs;if(qn(a,n),Gn(n),u&512&&(on||c===null||ta(c,c.return)),u&4){var b=c!==null?c.memoizedState:null;if(u=n.memoizedState,c===null)if(u===null)if(n.stateNode===null){e:{u=n.type,c=n.memoizedProps,m=m.ownerDocument||m;t:switch(u){case"title":b=m.getElementsByTagName("title")[0],(!b||b[ga]||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"))),kn(b,u,c),b[gn]=n,nn(b),u=b;break e;case"link":var E=sw("link","href",m).get(u+(c.href||""));if(E){for(var L=0;L<E.length;L++)if(b=E[L],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(L,1);break t}}b=m.createElement(u),kn(b,u,c),m.head.appendChild(b);break;case"meta":if(E=sw("meta","content",m).get(u+(c.content||""))){for(L=0;L<E.length;L++)if(b=E[L],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(L,1);break t}}b=m.createElement(u),kn(b,u,c),m.head.appendChild(b);break;default:throw Error(s(468,u))}b[gn]=n,nn(b),u=b}n.stateNode=u}else aw(m,n.type,n.stateNode);else n.stateNode=nw(m,u,n.memoizedProps);else b!==u?(b===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):b.count--,u===null?aw(m,n.type,n.stateNode):nw(m,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Ff(n,n.memoizedProps,c.memoizedProps)}break;case 27:qn(a,n),Gn(n),u&512&&(on||c===null||ta(c,c.return)),c!==null&&u&4&&Ff(n,n.memoizedProps,c.memoizedProps);break;case 5:if(qn(a,n),Gn(n),u&512&&(on||c===null||ta(c,c.return)),n.flags&32){m=n.stateNode;try{Fa(m,"")}catch(Le){Lt(n,n.return,Le)}}u&4&&n.stateNode!=null&&(m=n.memoizedProps,Ff(n,m,c!==null?c.memoizedProps:m)),u&1024&&(Wf=!0);break;case 6:if(qn(a,n),Gn(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,c=n.stateNode;try{c.nodeValue=u}catch(Le){Lt(n,n.return,Le)}}break;case 3:if(Cu=null,m=zs,zs=wu(a.containerInfo),qn(a,n),zs=m,Gn(n),u&4&&c!==null&&c.memoizedState.isDehydrated)try{ro(a.containerInfo)}catch(Le){Lt(n,n.return,Le)}Wf&&(Wf=!1,av(n));break;case 4:u=zs,zs=wu(n.stateNode.containerInfo),qn(a,n),Gn(n),zs=u;break;case 12:qn(a,n),Gn(n);break;case 31:qn(a,n),Gn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,ou(n,u)));break;case 13:qn(a,n),Gn(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(cu=mt()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,ou(n,u)));break;case 22:m=n.memoizedState!==null;var B=c!==null&&c.memoizedState!==null,Z=Na,ce=on;if(Na=Z||m,on=ce||B,qn(a,n),on=ce,Na=Z,Gn(n),u&8192)e:for(a=n.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(c===null||B||Na||on||Jr(n)),c=null,a=n;;){if(a.tag===5||a.tag===26){if(c===null){B=c=a;try{if(b=B.stateNode,m)E=b.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{L=B.stateNode;var be=B.memoizedProps.style,te=be!=null&&be.hasOwnProperty("display")?be.display:null;L.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Le){Lt(B,B.return,Le)}}}else if(a.tag===6){if(c===null){B=a;try{B.stateNode.nodeValue=m?"":B.memoizedProps}catch(Le){Lt(B,B.return,Le)}}}else if(a.tag===18){if(c===null){B=a;try{var ie=B.stateNode;m?Kv(ie,!0):Kv(B.stateNode,!1)}catch(Le){Lt(B,B.return,Le)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=n.updateQueue,u!==null&&(c=u.retryQueue,c!==null&&(u.retryQueue=null,ou(n,c))));break;case 19:qn(a,n),Gn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,ou(n,u)));break;case 30:break;case 21:break;default:qn(a,n),Gn(n)}}function Gn(n){var a=n.flags;if(a&2){try{for(var c,u=n.return;u!==null;){if(Y0(u)){c=u;break}u=u.return}if(c==null)throw Error(s(160));switch(c.tag){case 27:var m=c.stateNode,b=Vf(n);iu(n,b,m);break;case 5:var E=c.stateNode;c.flags&32&&(Fa(E,""),c.flags&=-33);var L=Vf(n);iu(n,L,E);break;case 3:case 4:var B=c.stateNode.containerInfo,Z=Vf(n);Kf(n,Z,B);break;default:throw Error(s(161))}}catch(ce){Lt(n,n.return,ce)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function av(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;av(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function _a(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Q0(n,a.alternate,a),a=a.sibling}function Jr(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:ir(4,a,a.return),Jr(a);break;case 1:ta(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&K0(a,a.return,c),Jr(a);break;case 27:Wl(a.stateNode);case 26:case 5:ta(a,a.return),Jr(a);break;case 22:a.memoizedState===null&&Jr(a);break;case 30:Jr(a);break;default:Jr(a)}n=n.sibling}}function Aa(n,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,m=n,b=a,E=b.flags;switch(b.tag){case 0:case 11:case 15:Aa(m,b,c),zl(4,b);break;case 1:if(Aa(m,b,c),u=b,m=u.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(Z){Lt(u,u.return,Z)}if(u=b,m=u.updateQueue,m!==null){var L=u.stateNode;try{var B=m.shared.hiddenCallbacks;if(B!==null)for(m.shared.hiddenCallbacks=null,m=0;m<B.length;m++)Mb(B[m],L)}catch(Z){Lt(u,u.return,Z)}}c&&E&64&&V0(b),Hl(b,b.return);break;case 27:J0(b);case 26:case 5:Aa(m,b,c),c&&u===null&&E&4&&W0(b),Hl(b,b.return);break;case 12:Aa(m,b,c);break;case 31:Aa(m,b,c),c&&E&4&&tv(m,b);break;case 13:Aa(m,b,c),c&&E&4&&nv(m,b);break;case 22:b.memoizedState===null&&Aa(m,b,c),Hl(b,b.return);break;case 30:break;default:Aa(m,b,c)}a=a.sibling}}function Yf(n,a){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&kl(c))}function Jf(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&kl(n))}function Hs(n,a,c,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)rv(n,a,c,u),a=a.sibling}function rv(n,a,c,u){var m=a.flags;switch(a.tag){case 0:case 11:case 15:Hs(n,a,c,u),m&2048&&zl(9,a);break;case 1:Hs(n,a,c,u);break;case 3:Hs(n,a,c,u),m&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&kl(n)));break;case 12:if(m&2048){Hs(n,a,c,u),n=a.stateNode;try{var b=a.memoizedProps,E=b.id,L=b.onPostCommit;typeof L=="function"&&L(E,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(B){Lt(a,a.return,B)}}else Hs(n,a,c,u);break;case 31:Hs(n,a,c,u);break;case 13:Hs(n,a,c,u);break;case 23:break;case 22:b=a.stateNode,E=a.alternate,a.memoizedState!==null?b._visibility&2?Hs(n,a,c,u):Pl(n,a):b._visibility&2?Hs(n,a,c,u):(b._visibility|=2,Wi(n,a,c,u,(a.subtreeFlags&10256)!==0||!1)),m&2048&&Yf(E,a);break;case 24:Hs(n,a,c,u),m&2048&&Jf(a.alternate,a);break;default:Hs(n,a,c,u)}}function Wi(n,a,c,u,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=n,E=a,L=c,B=u,Z=E.flags;switch(E.tag){case 0:case 11:case 15:Wi(b,E,L,B,m),zl(8,E);break;case 23:break;case 22:var ce=E.stateNode;E.memoizedState!==null?ce._visibility&2?Wi(b,E,L,B,m):Pl(b,E):(ce._visibility|=2,Wi(b,E,L,B,m)),m&&Z&2048&&Yf(E.alternate,E);break;case 24:Wi(b,E,L,B,m),m&&Z&2048&&Jf(E.alternate,E);break;default:Wi(b,E,L,B,m)}a=a.sibling}}function Pl(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=n,u=a,m=u.flags;switch(u.tag){case 22:Pl(c,u),m&2048&&Yf(u.alternate,u);break;case 24:Pl(c,u),m&2048&&Jf(u.alternate,u);break;default:Pl(c,u)}a=a.sibling}}var Ul=8192;function Yi(n,a,c){if(n.subtreeFlags&Ul)for(n=n.child;n!==null;)iv(n,a,c),n=n.sibling}function iv(n,a,c){switch(n.tag){case 26:Yi(n,a,c),n.flags&Ul&&n.memoizedState!==null&&j1(c,zs,n.memoizedState,n.memoizedProps);break;case 5:Yi(n,a,c);break;case 3:case 4:var u=zs;zs=wu(n.stateNode.containerInfo),Yi(n,a,c),zs=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=Ul,Ul=16777216,Yi(n,a,c),Ul=u):Yi(n,a,c));break;default:Yi(n,a,c)}}function ov(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Bl(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var u=a[c];bn=u,cv(u,n)}ov(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)lv(n),n=n.sibling}function lv(n){switch(n.tag){case 0:case 11:case 15:Bl(n),n.flags&2048&&ir(9,n,n.return);break;case 3:Bl(n);break;case 12:Bl(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,lu(n)):Bl(n);break;default:Bl(n)}}function lu(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var u=a[c];bn=u,cv(u,n)}ov(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:ir(8,a,a.return),lu(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,lu(a));break;default:lu(a)}n=n.sibling}}function cv(n,a){for(;bn!==null;){var c=bn;switch(c.tag){case 0:case 11:case 15:ir(8,c,a);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:kl(c.memoizedState.cache)}if(u=c.child,u!==null)u.return=c,bn=u;else e:for(c=n;bn!==null;){u=bn;var m=u.sibling,b=u.return;if(Z0(u),u===c){bn=null;break e}if(m!==null){m.return=b,bn=m;break e}bn=b}}}var H_={getCacheForType:function(n){var a=Cn(sn),c=a.data.get(n);return c===void 0&&(c=n(),a.data.set(n,c)),c},cacheSignal:function(){return Cn(sn).controller.signal}},P_=typeof WeakMap=="function"?WeakMap:Map,At=0,Ht=null,ct=null,gt=0,Ot=0,ss=null,or=!1,Ji=!1,Xf=!1,Ta=0,Yt=0,lr=0,Xr=0,Qf=0,as=0,Xi=0,ql=null,Fn=null,Zf=!1,cu=0,dv=0,du=1/0,uu=null,cr=null,fn=0,dr=null,Qi=null,Da=0,ep=0,tp=null,uv=null,Gl=0,np=null;function rs(){return(At&2)!==0&>!==0?gt&-gt:W.T!==null?lp():Qn()}function gv(){if(as===0)if((gt&536870912)===0||xt){var n=ze;ze<<=1,(ze&3932160)===0&&(ze=262144),as=n}else as=536870912;return n=ts.current,n!==null&&(n.flags|=32),as}function Vn(n,a,c){(n===Ht&&(Ot===2||Ot===9)||n.cancelPendingCommit!==null)&&(Zi(n,0),ur(n,gt,as,!1)),Re(n,c),((At&2)===0||n!==Ht)&&(n===Ht&&((At&2)===0&&(Xr|=c),Yt===4&&ur(n,gt,as,!1)),na(n))}function hv(n,a,c){if((At&6)!==0)throw Error(s(327));var u=!c&&(a&127)===0&&(a&n.expiredLanes)===0||We(n,a),m=u?q_(n,a):ap(n,a,!0),b=u;do{if(m===0){Ji&&!u&&ur(n,a,0,!1);break}else{if(c=n.current.alternate,b&&!U_(c)){m=ap(n,a,!1),b=!1;continue}if(m===2){if(b=a,n.errorRecoveryDisabledLanes&b)var E=0;else E=n.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){a=E;e:{var L=n;m=ql;var B=L.current.memoizedState.isDehydrated;if(B&&(Zi(L,E).flags|=256),E=ap(L,E,!1),E!==2){if(Xf&&!B){L.errorRecoveryDisabledLanes|=b,Xr|=b,m=4;break e}b=Fn,Fn=m,b!==null&&(Fn===null?Fn=b:Fn.push.apply(Fn,b))}m=E}if(b=!1,m!==2)continue}}if(m===1){Zi(n,0),ur(n,a,0,!0);break}e:{switch(u=n,b=m,b){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:ur(u,a,as,!or);break e;case 2:Fn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(m=cu+300-mt(),10<m)){if(ur(u,a,as,!or),Fe(u,0,!0)!==0)break e;Da=a,u.timeoutHandle=Gv(fv.bind(null,u,c,Fn,uu,Zf,a,as,Xr,Xi,or,b,"Throttled",-0,0),m);break e}fv(u,c,Fn,uu,Zf,a,as,Xr,Xi,or,b,null,-0,0)}}break}while(!0);na(n)}function fv(n,a,c,u,m,b,E,L,B,Z,ce,be,te,ie){if(n.timeoutHandle=-1,be=a.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:us},iv(a,b,be);var Le=(b&62914560)===b?cu-mt():(b&4194048)===b?dv-mt():0;if(Le=k1(be,Le),Le!==null){Da=b,n.cancelPendingCommit=Le(Sv.bind(null,n,a,b,c,u,m,E,L,B,ce,be,null,te,ie)),ur(n,b,E,!Z);return}}Sv(n,a,b,c,u,m,E,L,B)}function U_(n){for(var a=n;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.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(!Zn(b(),m))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ur(n,a,c,u){a&=~Qf,a&=~Xr,n.suspendedLanes|=a,n.pingedLanes&=~a,u&&(n.warmLanes|=a),u=n.expirationTimes;for(var m=a;0<m;){var b=31-ue(m),E=1<<b;u[b]=-1,m&=~E}c!==0&<(n,c,a)}function gu(){return(At&6)===0?(Fl(0),!1):!0}function sp(){if(ct!==null){if(Ot===0)var n=ct.return;else n=ct,va=Br=null,bf(n),qi=null,El=0,n=ct;for(;n!==null;)F0(n.alternate,n),n=n.return;ct=null}}function Zi(n,a){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,o1(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),Da=0,sp(),Ht=n,ct=c=xa(n.current,null),gt=a,Ot=0,ss=null,or=!1,Ji=We(n,a),Xf=!1,Xi=as=Qf=Xr=lr=Yt=0,Fn=ql=null,Zf=!1,(a&8)!==0&&(a|=a&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=a;0<u;){var m=31-ue(u),b=1<<m;a|=n[m],u&=~b}return Ta=a,Od(),c}function pv(n,a){it=null,W.H=Ml,a===Bi||a===Ud?(a=Db(),Ot=3):a===of?(a=Db(),Ot=4):Ot=a===Mf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ss=a,ct===null&&(Yt=1,tu(n,hs(a,n.current)))}function mv(){var n=ts.current;return n===null?!0:(gt&4194048)===gt?ys===null:(gt&62914560)===gt||(gt&536870912)!==0?n===ys:!1}function yv(){var n=W.H;return W.H=Ml,n===null?Ml:n}function xv(){var n=W.A;return W.A=H_,n}function hu(){Yt=4,or||(gt&4194048)!==gt&&ts.current!==null||(Ji=!0),(lr&134217727)===0&&(Xr&134217727)===0||Ht===null||ur(Ht,gt,as,!1)}function ap(n,a,c){var u=At;At|=2;var m=yv(),b=xv();(Ht!==n||gt!==a)&&(uu=null,Zi(n,a)),a=!1;var E=Yt;e:do try{if(Ot!==0&&ct!==null){var L=ct,B=ss;switch(Ot){case 8:sp(),E=6;break e;case 3:case 2:case 9:case 6:ts.current===null&&(a=!0);var Z=Ot;if(Ot=0,ss=null,eo(n,L,B,Z),c&&Ji){E=0;break e}break;default:Z=Ot,Ot=0,ss=null,eo(n,L,B,Z)}}B_(),E=Yt;break}catch(ce){pv(n,ce)}while(!0);return a&&n.shellSuspendCounter++,va=Br=null,At=u,W.H=m,W.A=b,ct===null&&(Ht=null,gt=0,Od()),E}function B_(){for(;ct!==null;)bv(ct)}function q_(n,a){var c=At;At|=2;var u=yv(),m=xv();Ht!==n||gt!==a?(uu=null,du=mt()+500,Zi(n,a)):Ji=We(n,a);e:do try{if(Ot!==0&&ct!==null){a=ct;var b=ss;t:switch(Ot){case 1:Ot=0,ss=null,eo(n,a,b,1);break;case 2:case 9:if(Ab(b)){Ot=0,ss=null,vv(a);break}a=function(){Ot!==2&&Ot!==9||Ht!==n||(Ot=7),na(n)},b.then(a,a);break e;case 3:Ot=7;break e;case 4:Ot=5;break e;case 7:Ab(b)?(Ot=0,ss=null,vv(a)):(Ot=0,ss=null,eo(n,a,b,7));break;case 5:var E=null;switch(ct.tag){case 26:E=ct.memoizedState;case 5:case 27:var L=ct;if(E?rw(E):L.stateNode.complete){Ot=0,ss=null;var B=L.sibling;if(B!==null)ct=B;else{var Z=L.return;Z!==null?(ct=Z,fu(Z)):ct=null}break t}}Ot=0,ss=null,eo(n,a,b,5);break;case 6:Ot=0,ss=null,eo(n,a,b,6);break;case 8:sp(),Yt=6;break e;default:throw Error(s(462))}}G_();break}catch(ce){pv(n,ce)}while(!0);return va=Br=null,W.H=u,W.A=m,At=c,ct!==null?0:(Ht=null,gt=0,Od(),Yt)}function G_(){for(;ct!==null&&!bt();)bv(ct)}function bv(n){var a=q0(n.alternate,n,Ta);n.memoizedProps=n.pendingProps,a===null?fu(n):ct=a}function vv(n){var a=n,c=a.alternate;switch(a.tag){case 15:case 0:a=I0(c,a,a.pendingProps,a.type,void 0,gt);break;case 11:a=I0(c,a,a.pendingProps,a.type.render,a.ref,gt);break;case 5:bf(a);default:F0(c,a),a=ct=xb(a,Ta),a=q0(c,a,Ta)}n.memoizedProps=n.pendingProps,a===null?fu(n):ct=a}function eo(n,a,c,u){va=Br=null,bf(a),qi=null,El=0;var m=a.return;try{if(R_(n,m,a,c,gt)){Yt=1,tu(n,hs(c,n.current)),ct=null;return}}catch(b){if(m!==null)throw ct=m,b;Yt=1,tu(n,hs(c,n.current)),ct=null;return}a.flags&32768?(xt||u===1?n=!0:Ji||(gt&536870912)!==0?n=!1:(or=n=!0,(u===2||u===9||u===3||u===6)&&(u=ts.current,u!==null&&u.tag===13&&(u.flags|=16384))),wv(a,n)):fu(a)}function fu(n){var a=n;do{if((a.flags&32768)!==0){wv(a,or);return}n=a.return;var c=M_(a.alternate,a,Ta);if(c!==null){ct=c;return}if(a=a.sibling,a!==null){ct=a;return}ct=a=n}while(a!==null);Yt===0&&(Yt=5)}function wv(n,a){do{var c=$_(n.alternate,n);if(c!==null){c.flags&=32767,ct=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(n=n.sibling,n!==null)){ct=n;return}ct=n=c}while(n!==null);Yt=6,ct=null}function Sv(n,a,c,u,m,b,E,L,B){n.cancelPendingCommit=null;do pu();while(fn!==0);if((At&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(b=a.lanes|a.childLanes,b|=Fh,$e(n,c,b,E,L,B),n===Ht&&(ct=Ht=null,gt=0),Qi=a,dr=n,Da=c,ep=b,tp=m,uv=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,W_(Tt,function(){return Ev(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=W.T,W.T=null,m=he.p,he.p=2,E=At,At|=4;try{I_(n,a,c)}finally{At=E,he.p=m,W.T=u}}fn=1,Cv(),jv(),kv()}}function Cv(){if(fn===1){fn=0;var n=dr,a=Qi,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=W.T,W.T=null;var u=he.p;he.p=2;var m=At;At|=4;try{sv(a,n);var b=mp,E=cb(n.containerInfo),L=b.focusedElem,B=b.selectionRange;if(E!==L&&L&&L.ownerDocument&&lb(L.ownerDocument.documentElement,L)){if(B!==null&&Ph(L)){var Z=B.start,ce=B.end;if(ce===void 0&&(ce=Z),"selectionStart"in L)L.selectionStart=Z,L.selectionEnd=Math.min(ce,L.value.length);else{var be=L.ownerDocument||document,te=be&&be.defaultView||window;if(te.getSelection){var ie=te.getSelection(),Le=L.textContent.length,Ye=Math.min(B.start,Le),zt=B.end===void 0?Ye:Math.min(B.end,Le);!ie.extend&&Ye>zt&&(E=zt,zt=Ye,Ye=E);var Y=ob(L,Ye),F=ob(L,zt);if(Y&&F&&(ie.rangeCount!==1||ie.anchorNode!==Y.node||ie.anchorOffset!==Y.offset||ie.focusNode!==F.node||ie.focusOffset!==F.offset)){var Q=be.createRange();Q.setStart(Y.node,Y.offset),ie.removeAllRanges(),Ye>zt?(ie.addRange(Q),ie.extend(F.node,F.offset)):(Q.setEnd(F.node,F.offset),ie.addRange(Q))}}}}for(be=[],ie=L;ie=ie.parentNode;)ie.nodeType===1&&be.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof L.focus=="function"&&L.focus(),L=0;L<be.length;L++){var pe=be[L];pe.element.scrollLeft=pe.left,pe.element.scrollTop=pe.top}}Eu=!!pp,mp=pp=null}finally{At=m,he.p=u,W.T=c}}n.current=a,fn=2}}function jv(){if(fn===2){fn=0;var n=dr,a=Qi,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=W.T,W.T=null;var u=he.p;he.p=2;var m=At;At|=4;try{Q0(n,a.alternate,a)}finally{At=m,he.p=u,W.T=c}}fn=3}}function kv(){if(fn===4||fn===3){fn=0,_t();var n=dr,a=Qi,c=Da,u=uv;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?fn=5:(fn=0,Qi=dr=null,Nv(n,n.pendingLanes));var m=n.pendingLanes;if(m===0&&(cr=null),Xn(c),a=a.stateNode,V&&typeof V.onCommitFiberRoot=="function")try{V.onCommitFiberRoot(ds,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=W.T,m=he.p,he.p=2,W.T=null;try{for(var b=n.onRecoverableError,E=0;E<u.length;E++){var L=u[E];b(L.value,{componentStack:L.stack})}}finally{W.T=a,he.p=m}}(Da&3)!==0&&pu(),na(n),m=n.pendingLanes,(c&261930)!==0&&(m&42)!==0?n===np?Gl++:(Gl=0,np=n):Gl=0,Fl(0)}}function Nv(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,kl(a)))}function pu(){return Cv(),jv(),kv(),Ev()}function Ev(){if(fn!==5)return!1;var n=dr,a=ep;ep=0;var c=Xn(Da),u=W.T,m=he.p;try{he.p=32>c?32:c,W.T=null,c=tp,tp=null;var b=dr,E=Da;if(fn=0,Qi=dr=null,Da=0,(At&6)!==0)throw Error(s(331));var L=At;if(At|=4,lv(b.current),rv(b,b.current,E,c),At=L,Fl(0,!1),V&&typeof V.onPostCommitFiberRoot=="function")try{V.onPostCommitFiberRoot(ds,b)}catch{}return!0}finally{he.p=m,W.T=u,Nv(n,a)}}function _v(n,a,c){a=hs(c,a),a=Lf(n.stateNode,a,2),n=sr(n,a,2),n!==null&&(Re(n,2),na(n))}function Lt(n,a,c){if(n.tag===3)_v(n,n,c);else for(;a!==null;){if(a.tag===3){_v(a,n,c);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(cr===null||!cr.has(u))){n=hs(c,n),c=A0(2),u=sr(a,c,2),u!==null&&(T0(c,u,a,n),Re(u,2),na(u));break}}a=a.return}}function rp(n,a,c){var u=n.pingCache;if(u===null){u=n.pingCache=new P_;var m=new Set;u.set(a,m)}else m=u.get(a),m===void 0&&(m=new Set,u.set(a,m));m.has(c)||(Xf=!0,m.add(c),n=F_.bind(null,n,a,c),a.then(n,n))}function F_(n,a,c){var u=n.pingCache;u!==null&&u.delete(a),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Ht===n&&(gt&c)===c&&(Yt===4||Yt===3&&(gt&62914560)===gt&&300>mt()-cu?(At&2)===0&&Zi(n,0):Qf|=c,Xi===gt&&(Xi=0)),na(n)}function Av(n,a){a===0&&(a=rt()),n=Hr(n,a),n!==null&&(Re(n,a),na(n))}function V_(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),Av(n,c)}function K_(n,a){var c=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(c=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(a),Av(n,c)}function W_(n,a){return at(n,a)}var mu=null,to=null,ip=!1,yu=!1,op=!1,gr=0;function na(n){n!==to&&n.next===null&&(to===null?mu=to=n:to=to.next=n),yu=!0,ip||(ip=!0,J_())}function Fl(n,a){if(!op&&yu){op=!0;do for(var c=!1,u=mu;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var b=0;else{var E=u.suspendedLanes,L=u.pingedLanes;b=(1<<31-ue(42|n)+1)-1,b&=m&~(E&~L),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,Ov(u,b))}else b=gt,b=Fe(u,u===Ht?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(b&3)===0||We(u,b)||(c=!0,Ov(u,b));u=u.next}while(c);op=!1}}function Y_(){Tv()}function Tv(){yu=ip=!1;var n=0;gr!==0&&i1()&&(n=gr);for(var a=mt(),c=null,u=mu;u!==null;){var m=u.next,b=Dv(u,a);b===0?(u.next=null,c===null?mu=m:c.next=m,m===null&&(to=c)):(c=u,(n!==0||(b&3)!==0)&&(yu=!0)),u=m}fn!==0&&fn!==5||Fl(n),gr!==0&&(gr=0)}function Dv(n,a){for(var c=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,b=n.pendingLanes&-62914561;0<b;){var E=31-ue(b),L=1<<E,B=m[E];B===-1?((L&c)===0||(L&u)!==0)&&(m[E]=Je(L,a)):B<=a&&(n.expiredLanes|=L),b&=~L}if(a=Ht,c=gt,c=Fe(n,n===a?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,c===0||n===a&&(Ot===2||Ot===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&pt(u),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||We(n,c)){if(a=c&-c,a===n.callbackPriority)return a;switch(u!==null&&pt(u),Xn(c)){case 2:case 8:c=wt;break;case 32:c=Tt;break;case 268435456:c=Jn;break;default:c=Tt}return u=Rv.bind(null,n),c=at(c,u),n.callbackPriority=a,n.callbackNode=c,a}return u!==null&&u!==null&&pt(u),n.callbackPriority=2,n.callbackNode=null,2}function Rv(n,a){if(fn!==0&&fn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(pu()&&n.callbackNode!==c)return null;var u=gt;return u=Fe(n,n===Ht?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(hv(n,u,a),Dv(n,mt()),n.callbackNode!=null&&n.callbackNode===c?Rv.bind(null,n):null)}function Ov(n,a){if(pu())return null;hv(n,a,!0)}function J_(){l1(function(){(At&6)!==0?at(vn,Y_):Tv()})}function lp(){if(gr===0){var n=Pi;n===0&&(n=Me,Me<<=1,(Me&261888)===0&&(Me=256)),gr=n}return gr}function Lv(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Ni(""+n)}function Mv(n,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,n.id&&c.setAttribute("form",n.id),a.parentNode.insertBefore(c,a),n=new FormData(n),c.parentNode.removeChild(c),n}function X_(n,a,c,u,m){if(a==="submit"&&c&&c.stateNode===m){var b=Lv((m[wn]||null).action),E=u.submitter;E&&(a=(a=E[wn]||null)?Lv(a.formAction):E.getAttribute("formAction"),a!==null&&(b=a,E=null));var L=new Ai("action","action",null,u,m);n.push({event:L,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(gr!==0){var B=E?Mv(m,E):new FormData(m);_f(c,{pending:!0,data:B,method:m.method,action:b},null,B)}}else typeof b=="function"&&(L.preventDefault(),B=E?Mv(m,E):new FormData(m),_f(c,{pending:!0,data:B,method:m.method,action:b},b,B))},currentTarget:m}]})}}for(var cp=0;cp<Gh.length;cp++){var dp=Gh[cp],Q_=dp.toLowerCase(),Z_=dp[0].toUpperCase()+dp.slice(1);Is(Q_,"on"+Z_)}Is(gb,"onAnimationEnd"),Is(hb,"onAnimationIteration"),Is(fb,"onAnimationStart"),Is("dblclick","onDoubleClick"),Is("focusin","onFocus"),Is("focusout","onBlur"),Is(p_,"onTransitionRun"),Is(m_,"onTransitionStart"),Is(y_,"onTransitionCancel"),Is(pb,"onTransitionEnd"),qa("onMouseEnter",["mouseout","mouseover"]),qa("onMouseLeave",["mouseout","mouseover"]),qa("onPointerEnter",["pointerout","pointerover"]),qa("onPointerLeave",["pointerout","pointerover"]),ha("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ha("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ha("onBeforeInput",["compositionend","keypress","textInput","paste"]),ha("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ha("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ha("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="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(" "),e1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vl));function $v(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var u=n[c],m=u.event;u=u.listeners;e:{var b=void 0;if(a)for(var E=u.length-1;0<=E;E--){var L=u[E],B=L.instance,Z=L.currentTarget;if(L=L.listener,B!==b&&m.isPropagationStopped())break e;b=L,m.currentTarget=Z;try{b(m)}catch(ce){Rd(ce)}m.currentTarget=null,b=B}else for(E=0;E<u.length;E++){if(L=u[E],B=L.instance,Z=L.currentTarget,L=L.listener,B!==b&&m.isPropagationStopped())break e;b=L,m.currentTarget=Z;try{b(m)}catch(ce){Rd(ce)}m.currentTarget=null,b=B}}}}function dt(n,a){var c=a[Jo];c===void 0&&(c=a[Jo]=new Set);var u=n+"__bubble";c.has(u)||(Iv(a,n,2,!1),c.add(u))}function up(n,a,c){var u=0;a&&(u|=4),Iv(c,n,u,a)}var xu="_reactListening"+Math.random().toString(36).slice(2);function gp(n){if(!n[xu]){n[xu]=!0,md.forEach(function(c){c!=="selectionchange"&&(e1.has(c)||up(c,!1,n),up(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[xu]||(a[xu]=!0,up("selectionchange",!1,a))}}function Iv(n,a,c,u){switch(gw(a)){case 2:var m=_1;break;case 8:m=A1;break;default:m=Ep}c=m.bind(null,a,c,n),m=void 0,!il||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),u?m!==void 0?n.addEventListener(a,c,{capture:!0,passive:m}):n.addEventListener(a,c,!0):m!==void 0?n.addEventListener(a,c,{passive:m}):n.addEventListener(a,c,!1)}function hp(n,a,c,u,m){var b=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var E=u.tag;if(E===3||E===4){var L=u.stateNode.containerInfo;if(L===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(;L!==null;){if(E=Ua(L),E===null)return;if(B=E.tag,B===5||B===6||B===26||B===27){u=b=E;continue e}L=L.parentNode}}u=u.return}Sd(function(){var Z=b,ce=Ei(c),be=[];e:{var te=mb.get(n);if(te!==void 0){var ie=Ai,Le=n;switch(n){case"keypress":if(Wa(c)===0)break e;case"keydown":case"keyup":ie=hn;break;case"focusin":Le="focus",ie=dl;break;case"focusout":Le="blur",ie=dl;break;case"beforeblur":case"afterblur":ie=dl;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":ie=jd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=Nh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=C;break;case gb:case hb:case fb:ie=Ah;break;case pb:ie=I;break;case"scroll":case"scrollend":ie=kh;break;case"wheel":ie=fe;break;case"copy":case"cut":case"paste":ie=Dh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Nd;break;case"toggle":case"beforetoggle":ie=He}var Ye=(a&4)!==0,zt=!Ye&&(n==="scroll"||n==="scrollend"),Y=Ye?te!==null?te+"Capture":null:te;Ye=[];for(var F=Z,Q;F!==null;){var pe=F;if(Q=pe.stateNode,pe=pe.tag,pe!==5&&pe!==26&&pe!==27||Q===null||Y===null||(pe=Rr(F,Y),pe!=null&&Ye.push(Kl(F,pe,Q))),zt)break;F=F.return}0<Ye.length&&(te=new ie(te,Le,null,c,ce),be.push({event:te,listeners:Ye}))}}if((a&7)===0){e:{if(te=n==="mouseover"||n==="pointerover",ie=n==="mouseout"||n==="pointerout",te&&c!==al&&(Le=c.relatedTarget||c.fromElement)&&(Ua(Le)||Le[Hn]))break e;if((ie||te)&&(te=ce.window===ce?ce:(te=ce.ownerDocument)?te.defaultView||te.parentWindow:window,ie?(Le=c.relatedTarget||c.toElement,ie=Z,Le=Le?Ua(Le):null,Le!==null&&(zt=o(Le),Ye=Le.tag,Le!==zt||Ye!==5&&Ye!==27&&Ye!==6)&&(Le=null)):(ie=null,Le=Z),ie!==Le)){if(Ye=jd,pe="onMouseLeave",Y="onMouseEnter",F="mouse",(n==="pointerout"||n==="pointerover")&&(Ye=Nd,pe="onPointerLeave",Y="onPointerEnter",F="pointer"),zt=ie==null?te:Tr(ie),Q=Le==null?te:Tr(Le),te=new Ye(pe,F+"leave",ie,c,ce),te.target=zt,te.relatedTarget=Q,pe=null,Ua(ce)===Z&&(Ye=new Ye(Y,F+"enter",Le,c,ce),Ye.target=Q,Ye.relatedTarget=zt,pe=Ye),zt=pe,ie&&Le)t:{for(Ye=t1,Y=ie,F=Le,Q=0,pe=Y;pe;pe=Ye(pe))Q++;pe=0;for(var Ve=F;Ve;Ve=Ye(Ve))pe++;for(;0<Q-pe;)Y=Ye(Y),Q--;for(;0<pe-Q;)F=Ye(F),pe--;for(;Q--;){if(Y===F||F!==null&&Y===F.alternate){Ye=Y;break t}Y=Ye(Y),F=Ye(F)}Ye=null}else Ye=null;ie!==null&&zv(be,te,ie,Ye,!1),Le!==null&&zt!==null&&zv(be,zt,Le,Ye,!0)}}e:{if(te=Z?Tr(Z):window,ie=te.nodeName&&te.nodeName.toLowerCase(),ie==="select"||ie==="input"&&te.type==="file")var Ct=Td;else if(pl(te))if(Dd)Ct=g_;else{Ct=d_;var Be=c_}else ie=te.nodeName,!ie||ie.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?Z&&sl(Z.elementType)&&(Ct=Td):Ct=u_;if(Ct&&(Ct=Ct(n,Z))){ml(be,Ct,c,ce);break e}Be&&Be(n,te,Z),n==="focusout"&&Z&&te.type==="number"&&Z.memoizedProps.value!=null&&nl(te,"number",te.value)}switch(Be=Z?Tr(Z):window,n){case"focusin":(pl(Be)||Be.contentEditable==="true")&&(Ri=Be,Uh=Z,Sl=null);break;case"focusout":Sl=Uh=Ri=null;break;case"mousedown":Bh=!0;break;case"contextmenu":case"mouseup":case"dragend":Bh=!1,db(be,c,ce);break;case"selectionchange":if(f_)break;case"keydown":case"keyup":db(be,c,ce)}var ot;if(ut)e:{switch(n){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else Ya?_d(n,c)&&(ht="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(ht="onCompositionStart");ht&&(Mr&&c.locale!=="ko"&&(Ya||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&Ya&&(ot=Xe()):($s=ce,ol="value"in $s?$s.value:$s.textContent,Ya=!0)),Be=bu(Z,ht),0<Be.length&&(ht=new kd(ht,n,null,c,ce),be.push({event:ht,listeners:Be}),ot?ht.data=ot:(ot=fl(c),ot!==null&&(ht.data=ot)))),(ot=Kt?Ad(n,c):zh(n,c))&&(ht=bu(Z,"onBeforeInput"),0<ht.length&&(Be=new kd("onBeforeInput","beforeinput",null,c,ce),be.push({event:Be,listeners:ht}),Be.data=ot)),X_(be,n,Z,c,ce)}$v(be,a)})}function Kl(n,a,c){return{instance:n,listener:a,currentTarget:c}}function bu(n,a){for(var c=a+"Capture",u=[];n!==null;){var m=n,b=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||b===null||(m=Rr(n,c),m!=null&&u.unshift(Kl(n,m,b)),m=Rr(n,a),m!=null&&u.push(Kl(n,m,b))),n.tag===3)return u;n=n.return}return[]}function t1(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function zv(n,a,c,u,m){for(var b=a._reactName,E=[];c!==null&&c!==u;){var L=c,B=L.alternate,Z=L.stateNode;if(L=L.tag,B!==null&&B===u)break;L!==5&&L!==26&&L!==27||Z===null||(B=Z,m?(Z=Rr(c,b),Z!=null&&E.unshift(Kl(c,Z,B))):m||(Z=Rr(c,b),Z!=null&&E.push(Kl(c,Z,B)))),c=c.return}E.length!==0&&n.push({event:a,listeners:E})}var n1=/\r\n?/g,s1=/\u0000|\uFFFD/g;function Hv(n){return(typeof n=="string"?n:""+n).replace(n1,`
|
||
`).replace(s1,"")}function Pv(n,a){return a=Hv(a),Hv(n)===a}function It(n,a,c,u,m,b){switch(c){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||Fa(n,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&Fa(n,""+u);break;case"className":Ci(n,"class",u);break;case"tabIndex":Ci(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ci(n,c,u);break;case"style":Xs(n,u,b);break;case"data":if(a!=="object"){Ci(n,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||c!=="href")){n.removeAttribute(c);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(c);break}u=Ni(""+u),n.setAttribute(c,u);break;case"action":case"formAction":if(typeof u=="function"){n.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"?(a!=="input"&&It(n,a,"name",m.name,m,null),It(n,a,"formEncType",m.formEncType,m,null),It(n,a,"formMethod",m.formMethod,m,null),It(n,a,"formTarget",m.formTarget,m,null)):(It(n,a,"encType",m.encType,m,null),It(n,a,"method",m.method,m,null),It(n,a,"target",m.target,m,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(c);break}u=Ni(""+u),n.setAttribute(c,u);break;case"onClick":u!=null&&(n.onclick=us);break;case"onScroll":u!=null&&dt("scroll",n);break;case"onScrollEnd":u!=null&&dt("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(c=u.__html,c!=null){if(m.children!=null)throw Error(s(60));n.innerHTML=c}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.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"){n.removeAttribute("xlink:href");break}c=Ni(""+u),n.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"?n.setAttribute(c,""+u):n.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"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":u===!0?n.setAttribute(c,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(c,u):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(c,u):n.removeAttribute(c);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(c):n.setAttribute(c,u);break;case"popover":dt("beforetoggle",n),dt("toggle",n),Si(n,"popover",u);break;case"xlinkActuate":Ls(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Ls(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Ls(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Ls(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Ls(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Ls(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Ls(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Ls(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Ls(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Si(n,"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=Ch.get(c)||c,Si(n,c,u))}}function fp(n,a,c,u,m,b){switch(c){case"style":Xs(n,u,b);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(c=u.__html,c!=null){if(m.children!=null)throw Error(s(60));n.innerHTML=c}}break;case"children":typeof u=="string"?Fa(n,u):(typeof u=="number"||typeof u=="bigint")&&Fa(n,""+u);break;case"onScroll":u!=null&&dt("scroll",n);break;case"onScrollEnd":u!=null&&dt("scrollend",n);break;case"onClick":u!=null&&(n.onclick=us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yd.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),a=c.slice(2,m?c.length-7:void 0),b=n[wn]||null,b=b!=null?b[c]:null,typeof b=="function"&&n.removeEventListener(a,b,m),typeof u=="function")){typeof b!="function"&&b!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(a,u,m);break e}c in n?n[c]=u:u===!0?n.setAttribute(c,""):Si(n,c,u)}}}function kn(n,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dt("error",n),dt("load",n);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(s(137,a));default:It(n,a,b,E,c,null)}}m&&It(n,a,"srcSet",c.srcSet,c,null),u&&It(n,a,"src",c.src,c,null);return;case"input":dt("invalid",n);var L=b=E=m=null,B=null,Z=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":Z=ce;break;case"value":b=ce;break;case"defaultValue":L=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,a));break;default:It(n,a,u,ce,c,null)}}xd(n,b,L,B,Z,E,m,!1);return;case"select":dt("invalid",n),u=E=b=null;for(m in c)if(c.hasOwnProperty(m)&&(L=c[m],L!=null))switch(m){case"value":b=L;break;case"defaultValue":E=L;break;case"multiple":u=L;default:It(n,a,m,L,c,null)}a=b,c=E,n.multiple=!!u,a!=null?Ga(n,!!u,a,!1):c!=null&&Ga(n,!!u,c,!0);return;case"textarea":dt("invalid",n),b=m=u=null;for(E in c)if(c.hasOwnProperty(E)&&(L=c[E],L!=null))switch(E){case"value":u=L;break;case"defaultValue":m=L;break;case"children":b=L;break;case"dangerouslySetInnerHTML":if(L!=null)throw Error(s(91));break;default:It(n,a,E,L,c,null)}vd(n,u,m,b);return;case"option":for(B in c)if(c.hasOwnProperty(B)&&(u=c[B],u!=null))switch(B){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:It(n,a,B,u,c,null)}return;case"dialog":dt("beforetoggle",n),dt("toggle",n),dt("cancel",n),dt("close",n);break;case"iframe":case"object":dt("load",n);break;case"video":case"audio":for(u=0;u<Vl.length;u++)dt(Vl[u],n);break;case"image":dt("error",n),dt("load",n);break;case"details":dt("toggle",n);break;case"embed":case"source":case"link":dt("error",n),dt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in c)if(c.hasOwnProperty(Z)&&(u=c[Z],u!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:It(n,a,Z,u,c,null)}return;default:if(sl(a)){for(ce in c)c.hasOwnProperty(ce)&&(u=c[ce],u!==void 0&&fp(n,a,ce,u,c,void 0));return}}for(L in c)c.hasOwnProperty(L)&&(u=c[L],u!=null&&It(n,a,L,u,c,null))}function a1(n,a,c,u){switch(a){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,L=null,B=null,Z=null,ce=null;for(ie in c){var be=c[ie];if(c.hasOwnProperty(ie)&&be!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":B=be;default:u.hasOwnProperty(ie)||It(n,a,ie,null,u,be)}}for(var te in u){var ie=u[te];if(be=c[te],u.hasOwnProperty(te)&&(ie!=null||be!=null))switch(te){case"type":b=ie;break;case"name":m=ie;break;case"checked":Z=ie;break;case"defaultChecked":ce=ie;break;case"value":E=ie;break;case"defaultValue":L=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,a));break;default:ie!==be&&It(n,a,te,ie,u,be)}}pa(n,E,L,B,Z,ce,b,m);return;case"select":ie=E=L=te=null;for(b in c)if(B=c[b],c.hasOwnProperty(b)&&B!=null)switch(b){case"value":break;case"multiple":ie=B;default:u.hasOwnProperty(b)||It(n,a,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":te=b;break;case"defaultValue":L=b;break;case"multiple":E=b;default:b!==B&&It(n,a,m,b,u,B)}a=L,c=E,u=ie,te!=null?Ga(n,!!c,te,!1):!!u!=!!c&&(a!=null?Ga(n,!!c,a,!0):Ga(n,!!c,c?[]:"",!1));return;case"textarea":ie=te=null;for(L in c)if(m=c[L],c.hasOwnProperty(L)&&m!=null&&!u.hasOwnProperty(L))switch(L){case"value":break;case"children":break;default:It(n,a,L,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":te=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(s(91));break;default:m!==b&&It(n,a,E,m,u,b)}bd(n,te,ie);return;case"option":for(var Le in c)if(te=c[Le],c.hasOwnProperty(Le)&&te!=null&&!u.hasOwnProperty(Le))switch(Le){case"selected":n.selected=!1;break;default:It(n,a,Le,null,u,te)}for(B in u)if(te=u[B],ie=c[B],u.hasOwnProperty(B)&&te!==ie&&(te!=null||ie!=null))switch(B){case"selected":n.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:It(n,a,B,te,u,ie)}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 Ye in c)te=c[Ye],c.hasOwnProperty(Ye)&&te!=null&&!u.hasOwnProperty(Ye)&&It(n,a,Ye,null,u,te);for(Z in u)if(te=u[Z],ie=c[Z],u.hasOwnProperty(Z)&&te!==ie&&(te!=null||ie!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,a));break;default:It(n,a,Z,te,u,ie)}return;default:if(sl(a)){for(var zt in c)te=c[zt],c.hasOwnProperty(zt)&&te!==void 0&&!u.hasOwnProperty(zt)&&fp(n,a,zt,void 0,u,te);for(ce in u)te=u[ce],ie=c[ce],!u.hasOwnProperty(ce)||te===ie||te===void 0&&ie===void 0||fp(n,a,ce,te,u,ie);return}}for(var Y in c)te=c[Y],c.hasOwnProperty(Y)&&te!=null&&!u.hasOwnProperty(Y)&&It(n,a,Y,null,u,te);for(be in u)te=u[be],ie=c[be],!u.hasOwnProperty(be)||te===ie||te==null&&ie==null||It(n,a,be,te,u,ie)}function Uv(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function r1(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,c=performance.getEntriesByType("resource"),u=0;u<c.length;u++){var m=c[u],b=m.transferSize,E=m.initiatorType,L=m.duration;if(b&&L&&Uv(E)){for(E=0,L=m.responseEnd,u+=1;u<c.length;u++){var B=c[u],Z=B.startTime;if(Z>L)break;var ce=B.transferSize,be=B.initiatorType;ce&&Uv(be)&&(B=B.responseEnd,E+=ce*(B<L?1:(L-Z)/(B-Z)))}if(--u,a+=8*(b+E)/(m.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var pp=null,mp=null;function vu(n){return n.nodeType===9?n:n.ownerDocument}function Bv(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qv(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function yp(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var xp=null;function i1(){var n=window.event;return n&&n.type==="popstate"?n===xp?!1:(xp=n,!0):(xp=null,!1)}var Gv=typeof setTimeout=="function"?setTimeout:void 0,o1=typeof clearTimeout=="function"?clearTimeout:void 0,Fv=typeof Promise=="function"?Promise:void 0,l1=typeof queueMicrotask=="function"?queueMicrotask:typeof Fv<"u"?function(n){return Fv.resolve(null).then(n).catch(c1)}:Gv;function c1(n){setTimeout(function(){throw n})}function hr(n){return n==="head"}function Vv(n,a){var c=a,u=0;do{var m=c.nextSibling;if(n.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(u===0){n.removeChild(m),ro(a);return}u--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")u++;else if(c==="html")Wl(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Wl(c);for(var b=c.firstChild;b;){var E=b.nextSibling,L=b.nodeName;b[ga]||L==="SCRIPT"||L==="STYLE"||L==="LINK"&&b.rel.toLowerCase()==="stylesheet"||c.removeChild(b),b=E}}else c==="body"&&Wl(n.ownerDocument.body);c=m}while(c);ro(a)}function Kv(n,a){var c=n;n=0;do{var u=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),u&&u.nodeType===8)if(c=u.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=u}while(c)}function bp(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":bp(c),Xo(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function d1(n,a,c,u){for(;n.nodeType===1;){var m=c;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[ga])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(b=n.getAttribute("rel"),b==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(b!==m.rel||n.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||n.getAttribute("title")!==(m.title==null?null:m.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(b=n.getAttribute("src"),(b!==(m.src==null?null:m.src)||n.getAttribute("type")!==(m.type==null?null:m.type)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&b&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var b=m.name==null?null:""+m.name;if(m.type==="hidden"&&n.getAttribute("name")===b)return n}else return n;if(n=xs(n.nextSibling),n===null)break}return null}function u1(n,a,c){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=xs(n.nextSibling),n===null))return null;return n}function Wv(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=xs(n.nextSibling),n===null))return null;return n}function vp(n){return n.data==="$?"||n.data==="$~"}function wp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function g1(n,a){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||c.readyState!=="loading")a();else{var u=function(){a(),c.removeEventListener("DOMContentLoaded",u)};c.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function xs(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Sp=null;function Yv(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(a===0)return xs(n.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}n=n.nextSibling}return null}function Jv(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return n;a--}else c!=="/$"&&c!=="/&"||a++}n=n.previousSibling}return null}function Xv(n,a,c){switch(a=vu(c),n){case"html":if(n=a.documentElement,!n)throw Error(s(452));return n;case"head":if(n=a.head,!n)throw Error(s(453));return n;case"body":if(n=a.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function Wl(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Xo(n)}var bs=new Map,Qv=new Set;function wu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ra=he.d;he.d={f:h1,r:f1,D:p1,C:m1,L:y1,m:x1,X:v1,S:b1,M:w1};function h1(){var n=Ra.f(),a=gu();return n||a}function f1(n){var a=Ba(n);a!==null&&a.tag===5&&a.type==="form"?p0(a):Ra.r(n)}var no=typeof document>"u"?null:document;function Zv(n,a,c){var u=no;if(u&&typeof a=="string"&&a){var m=Un(a);m='link[rel="'+n+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),Qv.has(m)||(Qv.add(m),n={rel:n,crossOrigin:c,href:a},u.querySelector(m)===null&&(a=u.createElement("link"),kn(a,"link",n),nn(a),u.head.appendChild(a)))}}function p1(n){Ra.D(n),Zv("dns-prefetch",n,null)}function m1(n,a){Ra.C(n,a),Zv("preconnect",n,a)}function y1(n,a,c){Ra.L(n,a,c);var u=no;if(u&&n&&a){var m='link[rel="preload"][as="'+Un(a)+'"]';a==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+Un(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+Un(c.imageSizes)+'"]')):m+='[href="'+Un(n)+'"]';var b=m;switch(a){case"style":b=so(n);break;case"script":b=ao(n)}bs.has(b)||(n=y({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:n,as:a},c),bs.set(b,n),u.querySelector(m)!==null||a==="style"&&u.querySelector(Yl(b))||a==="script"&&u.querySelector(Jl(b))||(a=u.createElement("link"),kn(a,"link",n),nn(a),u.head.appendChild(a)))}}function x1(n,a){Ra.m(n,a);var c=no;if(c&&n){var u=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Un(u)+'"][href="'+Un(n)+'"]',b=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=ao(n)}if(!bs.has(b)&&(n=y({rel:"modulepreload",href:n},a),bs.set(b,n),c.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Jl(b)))return}u=c.createElement("link"),kn(u,"link",n),nn(u),c.head.appendChild(u)}}}function b1(n,a,c){Ra.S(n,a,c);var u=no;if(u&&n){var m=Ys(u).hoistableStyles,b=so(n);a=a||"default";var E=m.get(b);if(!E){var L={loading:0,preload:null};if(E=u.querySelector(Yl(b)))L.loading=5;else{n=y({rel:"stylesheet",href:n,"data-precedence":a},c),(c=bs.get(b))&&Cp(n,c);var B=E=u.createElement("link");nn(B),kn(B,"link",n),B._p=new Promise(function(Z,ce){B.onload=Z,B.onerror=ce}),B.addEventListener("load",function(){L.loading|=1}),B.addEventListener("error",function(){L.loading|=2}),L.loading|=4,Su(E,a,u)}E={type:"stylesheet",instance:E,count:1,state:L},m.set(b,E)}}}function v1(n,a){Ra.X(n,a);var c=no;if(c&&n){var u=Ys(c).hoistableScripts,m=ao(n),b=u.get(m);b||(b=c.querySelector(Jl(m)),b||(n=y({src:n,async:!0},a),(a=bs.get(m))&&jp(n,a),b=c.createElement("script"),nn(b),kn(b,"link",n),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(m,b))}}function w1(n,a){Ra.M(n,a);var c=no;if(c&&n){var u=Ys(c).hoistableScripts,m=ao(n),b=u.get(m);b||(b=c.querySelector(Jl(m)),b||(n=y({src:n,async:!0,type:"module"},a),(a=bs.get(m))&&jp(n,a),b=c.createElement("script"),nn(b),kn(b,"link",n),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(m,b))}}function ew(n,a,c,u){var m=(m=ke.current)?wu(m):null;if(!m)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=so(c.href),c=Ys(m).hoistableStyles,u=c.get(a),u||(u={type:"style",instance:null,count:0,state:null},c.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=so(c.href);var b=Ys(m).hoistableStyles,E=b.get(n);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(n,E),(b=m.querySelector(Yl(n)))&&!b._p&&(E.instance=b,E.state.loading=5),bs.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},bs.set(n,c),b||S1(m,n,c,E.state))),a&&u===null)throw Error(s(528,""));return E}if(a&&u!==null)throw Error(s(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ao(c),c=Ys(m).hoistableScripts,u=c.get(a),u||(u={type:"script",instance:null,count:0,state:null},c.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function so(n){return'href="'+Un(n)+'"'}function Yl(n){return'link[rel="stylesheet"]['+n+"]"}function tw(n){return y({},n,{"data-precedence":n.precedence,precedence:null})}function S1(n,a,c,u){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=n.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),kn(a,"link",c),nn(a),n.head.appendChild(a))}function ao(n){return'[src="'+Un(n)+'"]'}function Jl(n){return"script[async]"+n}function nw(n,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var u=n.querySelector('style[data-href~="'+Un(c.href)+'"]');if(u)return a.instance=u,nn(u),u;var m=y({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),nn(u),kn(u,"style",m),Su(u,c.precedence,n),a.instance=u;case"stylesheet":m=so(c.href);var b=n.querySelector(Yl(m));if(b)return a.state.loading|=4,a.instance=b,nn(b),b;u=tw(c),(m=bs.get(m))&&Cp(u,m),b=(n.ownerDocument||n).createElement("link"),nn(b);var E=b;return E._p=new Promise(function(L,B){E.onload=L,E.onerror=B}),kn(b,"link",u),a.state.loading|=4,Su(b,c.precedence,n),a.instance=b;case"script":return b=ao(c.src),(m=n.querySelector(Jl(b)))?(a.instance=m,nn(m),m):(u=c,(m=bs.get(b))&&(u=y({},c),jp(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),nn(m),kn(m,"link",u),n.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Su(u,c.precedence,n));return a.instance}function Su(n,a,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 L=u[E];if(L.dataset.precedence===a)b=L;else if(b!==m)break}b?b.parentNode.insertBefore(n,b.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(n,a.firstChild))}function Cp(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function jp(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var Cu=null;function sw(n,a,c){if(Cu===null){var u=new Map,m=Cu=new Map;m.set(c,u)}else m=Cu,u=m.get(c),u||(u=new Map,m.set(c,u));if(u.has(n))return u;for(u.set(n,null),c=c.getElementsByTagName(n),m=0;m<c.length;m++){var b=c[m];if(!(b[ga]||b[gn]||n==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var E=b.getAttribute(a)||"";E=n+E;var L=u.get(E);L?L.push(b):u.set(E,[b])}}return u}function aw(n,a,c){n=n.ownerDocument||n,n.head.insertBefore(c,a==="title"?n.querySelector("head > title"):null)}function C1(n,a,c){if(c===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function rw(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function j1(n,a,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=so(u.href),b=a.querySelector(Yl(m));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=ju.bind(n),a.then(n,n)),c.state.loading|=4,c.instance=b,nn(b);return}b=a.ownerDocument||a,u=tw(u),(m=bs.get(m))&&Cp(u,m),b=b.createElement("link"),nn(b);var E=b;E._p=new Promise(function(L,B){E.onload=L,E.onerror=B}),kn(b,"link",u),c.instance=b}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=ju.bind(n),a.addEventListener("load",c),a.addEventListener("error",c))}}var kp=0;function k1(n,a){return n.stylesheets&&n.count===0&&Nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var u=setTimeout(function(){if(n.stylesheets&&Nu(n,n.stylesheets),n.unsuspend){var b=n.unsuspend;n.unsuspend=null,b()}},6e4+a);0<n.imgBytes&&kp===0&&(kp=62500*r1());var m=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Nu(n,n.stylesheets),n.unsuspend)){var b=n.unsuspend;n.unsuspend=null,b()}},(n.imgBytes>kp?50:800)+a);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function ju(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var ku=null;function Nu(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,ku=new Map,a.forEach(N1,n),ku=null,ju.call(n))}function N1(n,a){if(!(a.state.loading&4)){var c=ku.get(n);if(c)var u=c.get(null);else{c=new Map,ku.set(n,c);for(var m=n.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=a.instance,E=m.getAttribute("data-precedence"),b=c.get(E)||u,b===u&&c.set(null,m),c.set(E,m),this.count++,u=ju.bind(this),m.addEventListener("load",u),m.addEventListener("error",u),b?b.parentNode.insertBefore(m,b.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(m,n.firstChild)),a.state.loading|=4}}var Xl={$$typeof:N,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function E1(n,a,c,u,m,b,E,L,B){this.tag=1,this.containerInfo=n,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=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(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 iw(n,a,c,u,m,b,E,L,B,Z,ce,be){return n=new E1(n,a,c,E,B,Z,ce,be,L),a=1,b===!0&&(a|=24),b=es(3,null,null,a),n.current=b,b.stateNode=n,a=sf(),a.refCount++,n.pooledCache=a,a.refCount++,b.memoizedState={element:u,isDehydrated:c,cache:a},lf(b),n}function ow(n){return n?(n=Mi,n):Mi}function lw(n,a,c,u,m,b){m=ow(m),u.context===null?u.context=m:u.pendingContext=m,u=nr(a),u.payload={element:c},b=b===void 0?null:b,b!==null&&(u.callback=b),c=sr(n,u,a),c!==null&&(Vn(c,n,a),Al(c,n,a))}function cw(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<a?c:a}}function Np(n,a){cw(n,a),(n=n.alternate)&&cw(n,a)}function dw(n){if(n.tag===13||n.tag===31){var a=Hr(n,67108864);a!==null&&Vn(a,n,67108864),Np(n,67108864)}}function uw(n){if(n.tag===13||n.tag===31){var a=rs();a=xn(a);var c=Hr(n,a);c!==null&&Vn(c,n,a),Np(n,a)}}var Eu=!0;function _1(n,a,c,u){var m=W.T;W.T=null;var b=he.p;try{he.p=2,Ep(n,a,c,u)}finally{he.p=b,W.T=m}}function A1(n,a,c,u){var m=W.T;W.T=null;var b=he.p;try{he.p=8,Ep(n,a,c,u)}finally{he.p=b,W.T=m}}function Ep(n,a,c,u){if(Eu){var m=_p(u);if(m===null)hp(n,a,u,_u,c),hw(n,u);else if(D1(m,n,a,c,u))u.stopPropagation();else if(hw(n,u),a&4&&-1<T1.indexOf(n)){for(;m!==null;){var b=Ba(m);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var E=Te(b.pendingLanes);if(E!==0){var L=b;for(L.pendingLanes|=2,L.entangledLanes|=2;E;){var B=1<<31-ue(E);L.entanglements[1]|=B,E&=~B}na(b),(At&6)===0&&(du=mt()+500,Fl(0))}}break;case 31:case 13:L=Hr(b,2),L!==null&&Vn(L,b,2),gu(),Np(b,2)}if(b=_p(u),b===null&&hp(n,a,u,_u,c),b===m)break;m=b}m!==null&&u.stopPropagation()}else hp(n,a,u,null,c)}}function _p(n){return n=Ei(n),Ap(n)}var _u=null;function Ap(n){if(_u=null,n=Ua(n),n!==null){var a=o(n);if(a===null)n=null;else{var c=a.tag;if(c===13){if(n=d(a),n!==null)return n;n=null}else if(c===31){if(n=g(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return _u=n,null}function gw(n){switch(n){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(tt()){case vn:return 2;case wt:return 8;case Tt:case qt:return 32;case Jn:return 268435456;default:return 32}default:return 32}}var Tp=!1,fr=null,pr=null,mr=null,Ql=new Map,Zl=new Map,yr=[],T1="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 hw(n,a){switch(n){case"focusin":case"focusout":fr=null;break;case"dragenter":case"dragleave":pr=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":Ql.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zl.delete(a.pointerId)}}function ec(n,a,c,u,m,b){return n===null||n.nativeEvent!==b?(n={blockedOn:a,domEventName:c,eventSystemFlags:u,nativeEvent:b,targetContainers:[m]},a!==null&&(a=Ba(a),a!==null&&dw(a)),n):(n.eventSystemFlags|=u,a=n.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),n)}function D1(n,a,c,u,m){switch(a){case"focusin":return fr=ec(fr,n,a,c,u,m),!0;case"dragenter":return pr=ec(pr,n,a,c,u,m),!0;case"mouseover":return mr=ec(mr,n,a,c,u,m),!0;case"pointerover":var b=m.pointerId;return Ql.set(b,ec(Ql.get(b)||null,n,a,c,u,m)),!0;case"gotpointercapture":return b=m.pointerId,Zl.set(b,ec(Zl.get(b)||null,n,a,c,u,m)),!0}return!1}function fw(n){var a=Ua(n.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=d(c),a!==null){n.blockedOn=a,Ws(n.priority,function(){uw(c)});return}}else if(a===31){if(a=g(c),a!==null){n.blockedOn=a,Ws(n.priority,function(){uw(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Au(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=_p(n.nativeEvent);if(c===null){c=n.nativeEvent;var u=new c.constructor(c.type,c);al=u,c.target.dispatchEvent(u),al=null}else return a=Ba(c),a!==null&&dw(a),n.blockedOn=c,!1;a.shift()}return!0}function pw(n,a,c){Au(n)&&c.delete(a)}function R1(){Tp=!1,fr!==null&&Au(fr)&&(fr=null),pr!==null&&Au(pr)&&(pr=null),mr!==null&&Au(mr)&&(mr=null),Ql.forEach(pw),Zl.forEach(pw)}function Tu(n,a){n.blockedOn===a&&(n.blockedOn=null,Tp||(Tp=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,R1)))}var Du=null;function mw(n){Du!==n&&(Du=n,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Du===n&&(Du=null);for(var a=0;a<n.length;a+=3){var c=n[a],u=n[a+1],m=n[a+2];if(typeof u!="function"){if(Ap(u||c)===null)continue;break}var b=Ba(c);b!==null&&(n.splice(a,3),a-=3,_f(b,{pending:!0,data:m,method:c.method,action:u},u,m))}}))}function ro(n){function a(B){return Tu(B,n)}fr!==null&&Tu(fr,n),pr!==null&&Tu(pr,n),mr!==null&&Tu(mr,n),Ql.forEach(a),Zl.forEach(a);for(var c=0;c<yr.length;c++){var u=yr[c];u.blockedOn===n&&(u.blockedOn=null)}for(;0<yr.length&&(c=yr[0],c.blockedOn===null);)fw(c),c.blockedOn===null&&yr.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(u=0;u<c.length;u+=3){var m=c[u],b=c[u+1],E=m[wn]||null;if(typeof b=="function")E||mw(c);else if(E){var L=null;if(b&&b.hasAttribute("formAction")){if(m=b,E=b[wn]||null)L=E.formAction;else if(Ap(m)!==null)continue}else L=E.action;typeof L=="function"?c[u+1]=L:(c.splice(u,3),u-=3),mw(c)}}}function yw(){function n(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(E){return m=E})},focusReset:"manual",scroll:"manual"})}function a(){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",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),m!==null&&(m(),m=null)}}}function Dp(n){this._internalRoot=n}Ru.prototype.render=Dp.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var c=a.current,u=rs();lw(c,u,n,a,null,null)},Ru.prototype.unmount=Dp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;lw(n.current,2,null,n,null,null),gu(),a[Hn]=null}};function Ru(n){this._internalRoot=n}Ru.prototype.unstable_scheduleHydration=function(n){if(n){var a=Qn();n={blockedOn:null,target:n,priority:a};for(var c=0;c<yr.length&&a!==0&&a<yr[c].priority;c++);yr.splice(c,0,n),c===0&&fw(n)}};var xw=e.version;if(xw!=="19.2.0")throw Error(s(527,xw,"19.2.0"));he.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=f(a),n=n!==null?p(n):null,n=n===null?null:n.stateNode,n};var O1={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{ds=Ou.inject(O1),V=Ou}catch{}}return io.createRoot=function(n,a){if(!i(n))throw Error(s(299));var c=!1,u="",m=k0,b=N0,E=E0;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError)),a=iw(n,1,!1,null,null,c,u,null,m,b,E,yw),n[Hn]=a.current,gp(n),new Dp(a)},io.hydrateRoot=function(n,a,c){if(!i(n))throw Error(s(299));var u=!1,m="",b=k0,E=N0,L=E0,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&&(L=c.onRecoverableError),c.formState!==void 0&&(B=c.formState)),a=iw(n,1,!0,a,c??null,u,m,B,b,E,L,yw),a.context=ow(null),c=a.current,u=rs(),u=xn(u),m=nr(u),m.callback=null,sr(c,m,u),c=u,a.current.lanes=c,Re(a,c),na(a),n[Hn]=a.current,gp(n),new Ru(a)},io.version="19.2.0",io}var Pp;function Nw(){if(Pp)return $u.exports;Pp=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(),$u.exports=kw(),$u.exports}var Pu=Nw();const Uu=aa(Pu),oo=[],Ew=50;let Bu=!1;function Up(){try{return window.G7Core?.devTools}catch{return}}function Qr(r,e,t){const s=Up();if(Bu&&s?.isEnabled?.()){s.trackLog?.(r,e,t);return}Bu||(r==="error"||r==="warn")&&oo.length<Ew&&oo.push({level:r,prefix:e,args:t,timestamp:Date.now()})}function Bp(){Bu=!0;const r=Up();if(!r?.isEnabled?.()){oo.length=0;return}for(const e of oo)r.trackLog?.(e.level,e.prefix,e.args);oo.length=0}const Nr=class Nr{constructor(){H(this,"debug");H(this,"prefix","[TemplateEngine]");this.debug=!1}static getInstance(){return Nr.instance||(Nr.instance=new Nr),Nr.instance}setDebug(e){this.debug=e}isDebugEnabled(){return this.debug}log(...e){this.debug&&console.log(this.prefix,...e),Qr("log","TemplateEngine",e)}error(...e){this.debug&&console.error(this.prefix,...e),Qr("error","TemplateEngine",e)}warn(...e){this.debug&&console.warn(this.prefix,...e),Qr("warn","TemplateEngine",e)}};H(Nr,"instance");let lo=Nr;function nt(r){const e=`[${r}]`,t=lo.getInstance();return{log:(...s)=>{t.isDebugEnabled()&&console.log(e,...s),Qr("log",r,s)},warn:(...s)=>{t.isDebugEnabled()&&console.warn(e,...s),Qr("warn",r,s)},error:(...s)=>{t.isDebugEnabled()&&console.error(e,...s),Qr("error",r,s)}}}lo.getInstance();const Ps=nt("ComponentRegistry");class pn extends Error{constructor(e,t,s){super(e),this.code=t,this.details=s,this.name="ComponentRegistryError"}}const cs=class cs{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 cs.instance||(cs.instance=new cs),cs.instance}static resetInstance(){cs.instance=null}async loadComponents(e,t){if(this.loadingState==="loading")throw new pn("Components are already being loaded","LOADING_IN_PROGRESS");if(this.loadingState==="loaded"&&this.templateId===e&&this.templateType===t){Ps.log("Components already loaded for template:",e,t);return}this.loadingState="loading",this.templateId=e,this.templateType=t,this.error=null;try{await this.loadManifest(),await this.loadComponentBundle(),this.loadingState="loaded",Ps.log("Successfully loaded components:",Object.keys(this.registry).length)}catch(s){throw this.loadingState="error",this.error=s instanceof Error?s:new Error(String(s)),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(cs.manifestCache.has(e)){this.manifest=cs.manifestCache.get(e),Ps.log("Manifest loaded from cache:",this.manifest.templateId);return}const t=`/api/templates/${this.templateId}/components.json`,s=await fetch(t);if(!s.ok)throw new pn(`Failed to fetch manifest: ${s.status} ${s.statusText}`,"MANIFEST_FETCH_FAILED",{status:s.status,statusText:s.statusText});const i=await s.json();this.validateManifest(i),this.manifest=i,cs.manifestCache.set(e,i),Ps.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 t=["basic","composite","layout"];for(const s of t){if(!Array.isArray(e.components[s]))throw new pn(`Manifest field 'components.${s}' must be an array`,"MANIFEST_INVALID",{field:`components.${s}`,value:e.components[s]});e.components[s].forEach((i,o)=>{if(!i.name||typeof i.name!="string")throw new pn(`Invalid component metadata at ${s}[${o}]: missing or invalid 'name'`,"MANIFEST_INVALID",{type:s,index:o,metadata:i});if(!i.type||typeof i.type!="string")throw new pn(`Invalid component metadata at ${s}[${o}]: missing or invalid 'type'`,"MANIFEST_INVALID",{type:s,index:o,metadata:i})})}Ps.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(),t=window[e];if(!t||typeof t!="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(t),Ps.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 t=["basic","composite","layout"];for(const s of t){const i=this.manifest.components[s]||[];for(const o of i){const d=o.name,g=e[d];if(!g){Ps.warn(`Component '${d}' not found in bundle`);continue}this.registerComponent(d,g,o)}}}registerComponent(e,t,s){this.registry[e]&&Ps.warn(`Component '${e}' already registered, overwriting`);const i=Ke.memo(t);this.registry[e]={component:i,metadata:s},Ps.log(`[ComponentRegistry] Registered component: ${e} (${s.type})`)}getComponent(e){const t=this.registry[e];return t?t.component:null}getMetadata(e){const t=this.registry[e];return t?t.metadata:null}hasComponent(e){return e in this.registry}getComponentsByType(e){return Object.entries(this.registry).filter(([t,s])=>s.metadata.type===e).map(([t,s])=>t)}getAllComponents(){return Object.keys(this.registry)}getComponentMap(){const e={};for(const[t,s]of Object.entries(this.registry))e[t]=s.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,Ps.log("Registry cleared")}};H(cs,"instance",null),H(cs,"manifestCache",new Map);let vs=cs;const qp=nt("TranslationEngine");class qu extends Error{constructor(e,t,s){super(e),this.key=t,this.locale=s,this.name="TranslationError"}}const In=class In{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 In.instance||(In.instance=new In(e)),In.instance}static resetInstance(){In.instance=null}setCacheVersion(e){this.cacheVersion!==e&&(qp.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.cache.clear())}getCacheVersion(){return this.cacheVersion}async loadTranslations(e,t,s="/api",i=!1){const o=`${e}:${t}`;if(!i){const d=this.getFromCache(o);if(d)return this.translations.set(o,d),d}try{let d=`${s}/templates/${e}/lang/${t}.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 qu(`Failed to load translations: ${h.statusText}`,void 0,t);const p=await h.json();return this.saveToCache(o,p),this.translations.set(o,p),p}catch(d){throw new qu(`Failed to fetch translations for ${t}: ${d instanceof Error?d.message:String(d)}`,void 0,t)}}resolveTranslations(e,t,s){let i=e;const o=5;let d=0;for(;d<o&&i.includes("=$t:");){const g=i;if(i=i.replace(In.NESTED_TRANSLATION_PARAM_PATTERN,(h,f,p)=>"="+this.translate(p,t,void 0,s)),i===g)break;d++}return i.replace(In.TRANSLATION_PATTERN,(g,h,f)=>{const{cleanedParams:p,trailing:y}=this.separateTrailingText(f);return this.translate(h,t,p,s)+y})}translate(e,t,s,i){const o=this.getTranslation(e,t),d=s&&this.cleanParamsStr(s);if(d){const g=this.parseParams(d,i);return this.replaceParams(o,g)}return o}getTranslation(e,t){const{templateId:s,locale:i}=t,o=`${s}:${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=`${s}:${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,t){const s=t.split(".");let i=e;for(const o of s){if(i==null||typeof i!="object")return null;i=i[o]}return typeof i=="string"?i:null}parseParams(e,t){const s={},i=e.startsWith("|")?e.slice(1):e,o=[],g=i.replace(/\{\{(?:[^}]|\}(?!\}))*\}\}/g,h=>(o.push(h),`__PLACEHOLDER_${o.length-1}__`)).matchAll(In.PARAM_PATTERN);for(const h of g){const[,f,p]=h,y=p.replace(/__PLACEHOLDER_(\d+)__/g,(x,w)=>o[parseInt(w,10)]);s[f.trim()]=this.resolveParamValue(y.trim(),t)}return s}resolveParamValue(e,t){if(e.startsWith("{{")&&e.endsWith("}}")){const s=e.slice(2,-2).trim();if(/[|&()[\]!?:+\-*/%<>=\s]/.test(s)&&t)try{const d=new Function(...Object.keys(t),`return ${s}`)(...Object.values(t));return String(d??"")}catch(o){return qp.error("Expression evaluation failed:",s,o),""}else{const o=this.getNestedDataValue(t,s);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 s=e.match(/(\s+[^\p{L}\w=|&\s][^\p{L}\w=]*\s*)$/u);return s?{cleanedParams:e.slice(0,-s[1].length),trailing:s[1]}:{cleanedParams:e,trailing:""}}cleanParamsStr(e){return this.separateTrailingText(e).cleanedParams||""}getNestedDataValue(e,t){if(!e)return;const s=t.split(".");let i=e;for(const o of s){if(i==null)return;i=i[o]}return i}replaceParams(e,t){let s=e;for(const[i,o]of Object.entries(t)){const d=new RegExp(`\\{\\{${i}\\}\\}`,"g");s=s.replace(d,String(o));const g=new RegExp(`\\{${i}\\}`,"g");s=s.replace(g,String(o))}return s}getFromCache(e){const t=this.cache.get(e);return t?Date.now()-t.timestamp>this.options.cacheTTL?(this.cache.delete(e),null):t.data:null}saveToCache(e,t){this.cache.set(e,{data:t,timestamp:Date.now()})}clearCache(){this.cache.clear(),this.translations.clear()}pruneCache(){const e=Date.now(),t=[];for(const[s,i]of this.cache.entries())e-i.timestamp>this.options.cacheTTL&&t.push(s);for(const s of t)this.cache.delete(s)}getCacheStats(){const e=Date.now();let t=0;for(const s of this.cache.values())e-s.timestamp>this.options.cacheTTL&&t++;return{size:this.cache.size,expired:t}}};H(In,"instance",null),H(In,"TRANSLATION_PATTERN",/\$t:(?:defer:)?([a-zA-Z0-9._-]+)(\|(?:(?!\$t:).)+)?/g),H(In,"NESTED_TRANSLATION_PARAM_PATTERN",/=(\$t:([a-zA-Z0-9._-]+))(?=[|&\s]|$)/g),H(In,"PARAM_PATTERN",/([^=|&]+)=([^|&]+)/g);let br=In;const Gp=Object.freeze(Object.defineProperty({__proto__:null,TranslationEngine:br,TranslationError:qu},Symbol.toStringTag,{value:"Module"})),Zr=nt("PipeRegistry");function Fp(r,e){const t=r.getFullYear(),s=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(t)).replace("YY",String(t).slice(-2)).replace("MM",s).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 _w(r,e="ko"){const s=new Date().getTime()-r.getTime(),i=Math.floor(s/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 Gu(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 co={date:{fn:(r,e="YYYY-MM-DD")=>{const t=Gu(r);return t?Fp(t,e):""},description:"날짜 포맷 (기본: YYYY-MM-DD)"},datetime:{fn:(r,e="YYYY-MM-DD HH:mm")=>{const t=Gu(r);return t?Fp(t,e):""},description:"날짜+시간 포맷 (기본: YYYY-MM-DD HH:mm)"},relativeTime:{fn:(r,e="ko")=>{const t=Gu(r);return t?_w(t,e):""},description:'상대 시간 표시 (예: "3분 전")'},number:{fn:(r,e)=>{const t=Number(r);if(isNaN(t))return String(r??"");const s={};return e!==void 0&&(s.minimumFractionDigits=e,s.maximumFractionDigits=e),t.toLocaleString(void 0,s)},description:"숫자 포맷 (천단위 구분, 선택적 소수점)"},truncate:{fn:(r,e=100,t="...")=>typeof r!="string"?String(r??""):r.length<=e?r:r.slice(0,e)+t,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,t)=>Array.isArray(r)?Array.isArray(e)?r.filter(s=>{const i=t?s?.[t]:s;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:"다국어 객체에서 로케일에 맞는 값 추출"}},ei=new Map,Er=class Er{static getInstance(){return Er.instance||(Er.instance=new Er),Er.instance}register(e,t,s){if(co[e]){Zr.warn(`[PipeRegistry] 내장 파이프를 덮어쓸 수 없습니다: ${e}`);return}ei.set(e,{fn:t,description:s}),Zr.log(`[PipeRegistry] 커스텀 파이프 등록됨: ${e}`)}unregister(e){if(co[e])return Zr.warn(`[PipeRegistry] 내장 파이프는 해제할 수 없습니다: ${e}`),!1;const t=ei.delete(e);return t&&Zr.log(`[PipeRegistry] 커스텀 파이프 해제됨: ${e}`),t}get(e){const t=co[e];return t?t.fn:ei.get(e)?.fn}has(e){return!!co[e]||ei.has(e)}execute(e,t,s=[]){const i=this.get(e);if(!i)return Zr.warn(`[PipeRegistry] 알 수 없는 파이프: ${e}`),t;try{return i(t,...s)}catch(o){return Zr.error(`[PipeRegistry] 파이프 실행 오류 (${e}):`,o),t}}list(){const e=[];for(const[t,s]of Object.entries(co))e.push({name:t,description:s.description,type:"built-in"});for(const[t,s]of ei.entries())e.push({name:t,description:s.description,type:"custom"});return e.sort((t,s)=>t.name.localeCompare(s.name))}clearCustomPipes(){ei.clear()}};H(Er,"instance",null);let tc=Er;tc.getInstance();function Aw(r){const e=r.trim(),t=e.indexOf("(");if(t===-1)return{name:e,args:[]};const s=e.slice(0,t).trim(),i=e.slice(t+1,-1);if(!i.trim())return{name:s,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(Vp(d.trim())),d="";continue}d+=p}return d.trim()&&o.push(Vp(d.trim())),{name:s,args:o}}function Vp(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 Tw(r){const e=[];let t="",s=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==="\\"){t+=d;continue}if((d==='"'||d==="'")&&!s){s=d,t+=d;continue}if(d===s){s=null,t+=d;continue}if(s){t+=d;continue}if(d==="("||d==="["||d==="{"){i++,t+=d;continue}if(d===")"||d==="]"||d==="}"){i--,t+=d;continue}if(d==="|"&&h!=="|"&&g!=="|"&&i===0){e.push(t.trim()),t="";continue}t+=d}return t.trim()&&e.push(t.trim()),e.length===0?[r,[]]:[e[0],e.slice(1)]}function Kp(r){let e=null,t=0;for(let s=0;s<r.length;s++){const i=r[s],o=s>0?r[s-1]:"",d=s<r.length-1?r[s+1]:"";if(o!=="\\"){if((i==='"'||i==="'")&&!e){e=i;continue}if(i===e){e=null;continue}if(!e){if(i==="("||i==="["||i==="{"){t++;continue}if(i===")"||i==="]"||i==="}"){t--;continue}if(i==="|"&&d!=="|"&&o!=="|"&&t===0)return!0}}}return!1}function Dw(r,e){const t=tc.getInstance();let s=r;for(const i of e){const o=Aw(i);s=t.execute(o.name,s,o.args)}return s}const Oa="raw:",nc="",uo="",La="";function go(r){return nc+r+uo}function Wp(r){return r.length>=2&&r.charCodeAt(0)===64976&&r.charCodeAt(r.length-1)===64977}function Yp(r){return r.includes(nc)}function Jp(r){return r.slice(1,-1)}function ho(r){if(typeof r=="string")return go(r);if(Array.isArray(r))return r.map(ho);if(r&&typeof r=="object"){const e={};for(const[t,s]of Object.entries(r))e[t]=ho(s);return e}return r}const fo=nt("DataBindingEngine");function sc(){try{return window.G7Core?.devTools}catch{return}}class Fu extends Error{constructor(e,t,s){super(e),this.path=t,this.context=s,this.name="DataBindingError"}}const As=class As{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,t){this.isRenderCycleCacheActive()&&this.renderCycleCache.set(e,t)}resolveBindings(e,t,s,i){const o={...this.defaultOptions,...s},d=sc(),g=t._computed&&!t.$computed?{...t,$computed:t._computed}:t;return e.replace(As.BINDING_PATTERN,(h,f)=>{const p=f.trim();let y=!1,x=p;if(p.startsWith(Oa)&&(y=!0,x=p.slice(Oa.length)),Kp(x)){const N=d?.isEnabled()?performance.now():0;try{const[D,$]=Tw(x);let M,z=!1;const K=/[?:|&!+\-*/<>=()]/.test(D)||/\[['"]/.test(D),ye=D.startsWith("_global")||D.startsWith("_local")||D.startsWith("_isolated")||D.startsWith("$parent");if(o.skipCache)K?M=this.evaluateExpression(D,g):M=this.resolvePath(D,g,o);else if(K){const ve=this.getFromRenderCycleCache(`expr:${D}`);ve!==void 0?(M=ve,z=!0):(M=this.evaluateExpression(D,g),this.saveToRenderCycleCache(`expr:${D}`,M))}else if(ye){const ve=this.getFromRenderCycleCache(D);ve!==void 0?(M=ve,z=!0):(M=this.resolvePath(D,g,o),this.saveToRenderCycleCache(D,M))}else{const ve=this.getFromCache(D);ve!==void 0?(M=ve,z=!0):(M=this.resolvePath(D,g,o),this.saveToCache(D,M))}const we=Dw(M,$);if(d?.isEnabled()){const ve=performance.now()-N;d.trackExpressionEval({expression:`{{${p}}}`,result:this.sanitizeResultForTracking(we),resultType:this.getResultType(we),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:z,duration:ve,method:"resolveBindings",skipCache:o.skipCache})}const J=this.formatValue(we);return y?go(J):J}catch(D){return fo.error("Pipe expression evaluation failed:",x,D),h}}if(/[?:&!+\-*/<>=()]/.test(x)||/\|\|/.test(x)||/\[['"]/.test(x)){const N=d?.isEnabled()?performance.now():0;try{let D,$=!1;if(o.skipCache)D=this.evaluateExpression(x,g);else{const z=`expr:${x}`,K=this.getFromRenderCycleCache(z);K!==void 0?(D=K,$=!0):(D=this.evaluateExpression(x,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:$,duration:z,method:"resolveBindings",skipCache:o.skipCache})}const M=this.formatValue(D);return y?go(M):M}catch(D){return fo.error("Expression evaluation failed:",x,D),h}}if(o.skipCache){const N=d?.isEnabled()?performance.now():0,D=this.resolvePath(x,g,o);if(d?.isEnabled()){const M=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:M,method:"resolveBindings",skipCache:!0})}const $=this.formatValue(D);return y?go($):$}const v=x.startsWith("_global")||x.startsWith("_local")||x.startsWith("_isolated")||x.startsWith("$parent"),S=d?.isEnabled()?performance.now():0;let k,A=!1;if(v){const N=this.getFromRenderCycleCache(x);N!==void 0?(k=N,A=!0):(k=this.resolvePath(x,g,o),this.saveToRenderCycleCache(x,k))}else{const N=this.getFromCache(x);N!==void 0?(k=N,A=!0):(k=this.resolvePath(x,g,o),this.saveToCache(x,k))}if(d?.isEnabled()){const N=performance.now()-S;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 O=this.formatValue(k);return y?go(O):O})}resolve(e,t,s,i){const o={...this.defaultOptions,...s},d=sc(),g=d?.isEnabled()?performance.now():0;if(o.skipCache){const y=this.resolvePath(e,t,o);return d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(y),resultType:this.getResultType(y),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:performance.now()-g,method:"resolve",skipCache:!0}),y}const h=e.startsWith("_global")||e.startsWith("_local")||e.startsWith("_isolated")||e.startsWith("$parent");let f=!1;if(h){const y=this.getFromRenderCycleCache(e);if(y!==void 0)return f=!0,d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(y),resultType:this.getResultType(y),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-g,method:"resolve",skipCache:o.skipCache}),y}else{const y=this.getFromCache(e);if(y!==void 0)return f=!0,d?.isEnabled()&&d.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(y),resultType:this.getResultType(y),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-g,method:"resolve",skipCache:o.skipCache}),y}const p=this.resolvePath(e,t,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,t,s,i=0,o=new WeakSet){if(s.maxDepth&&i>s.maxDepth){if(s.detectCircular)throw new Fu(`Maximum depth exceeded (${s.maxDepth}). Possible circular reference.`,e,t);return s.defaultValue}const d=this.parsePath(e);let g=t;for(let h=0;h<d.length;h++){const f=d[h];if(g==null){if(s.nullSafe)return s.defaultValue;throw new Fu(`Cannot read property '${f}' of ${g}`,e,t)}if(s.detectCircular&&typeof g=="object"){if(o.has(g))throw new Fu(`Circular reference detected at path: ${d.slice(0,h+1).join(".")}`,e,t);o.add(g)}g=g[f],e==="_global.toasts"&&fo.log(`[DataBindingEngine] segment: ${f}, current:`,g)}return g!==void 0?g:s.defaultValue}parsePath(e){const t=[];let s;for(As.PATH_SEGMENT_PATTERN.lastIndex=0;(s=As.PATH_SEGMENT_PATTERN.exec(e))!==null;){const i=s[1]||s[2];i&&t.push(i)}return t}formatValue(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return"[Object]"}return String(e)}getFromCache(e){const t=this.cache.get(e),s=sc();if(!t){s?.isEnabled()&&s.recordCacheMiss();return}if(Date.now()-t.timestamp>As.CACHE_EXPIRY){this.cache.delete(e),s?.isEnabled()&&s.recordCacheMiss();return}return s?.isEnabled()&&s.recordCacheHit(),t.value}saveToCache(e,t){this.cache.set(e,{value:t,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,t,s){if(this.isSwitchExpression(e)){const g=e;return this.resolveSwitch(g,t,s)}if(this.isActionDefinition(e))return{...e};if("iteration"in e)return{...e};const i={},d=[...["cellChildren","expandChildren","expandContext","render"],...s?.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 y=!1,x=p;p.startsWith(Oa)&&(y=!0,x=p.slice(Oa.length));const v=/[?:|&!+\-*/<>=()]/.test(x)||/\[['"]/.test(x)?this.evaluateExpression(x,t,s):this.resolve(x,t,s);i[g]=y&&v!=null?ho(v):v}else i[g]=this.resolveBindings(h,t,s)}else Array.isArray(h)?i[g]=h.map(f=>typeof f=="string"?this.resolveBindings(f,t,s):typeof f=="object"&&f!==null?this.resolveObject(f,t,s):f):h&&typeof h=="object"?i[g]=this.resolveObject(h,t,s):i[g]=h}return i}clearCache(){this.cache.clear(),this.expressionFnCache.clear()}invalidateCacheByKeys(e){for(const t of this.cache.keys())for(const s of e)if(t===s||t.startsWith(`${s}.`)||t.startsWith(`${s}[`)){this.cache.delete(t);break}}pruneCache(){const e=Date.now();for(const[t,s]of this.cache.entries())e-s.timestamp>As.CACHE_EXPIRY&&this.cache.delete(t)}getCacheStats(){const e=Date.now();let t=0;for(const s of this.cache.values())e-s.timestamp>As.CACHE_EXPIRY&&t++;return{size:this.cache.size,expired:t}}evaluateExpression(e,t,s){const i=sc(),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={...t};for(const D of g)D in h||(h[D]=void 0);t._computed&&!h.$computed&&(h.$computed=t._computed);const f=t.$locale||"ko";h.$localized=(D,$)=>{if(D==null&&!$)return"";if(typeof D=="string")return D;if(D&&typeof D=="object"&&D[f])return D[f];if($&&typeof $=="string"){const M=h.$t?h.$t($):$;if(M&&M!==$)return M}return D&&typeof D=="object"?D.ko||D.en||Object.values(D)[0]||"":D==null?"":String(D)};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,D=>{const $=Math.random()*16|0;return(D==="x"?$:$&3|8).toString(16)});let y=t.$templateId,x=f;if(!y&&typeof window<"u"){const $=window.__templateApp?.getConfig?.();$?.templateId&&(y=$.templateId,!t.$locale&&$.locale&&(x=$.locale))}const w={templateId:y||"",locale:x};h.$t=D=>{if(!D||typeof D!="string")return"";try{return br.getInstance().translate(D,w)}catch($){return fo.warn("$t() translation failed for key:",D,$),D}},h.$get=(D,$,M=void 0)=>{if(D==null)return M;const z=Array.isArray($)?$:[$];if(z.length===0)return D;let K=D;for(const ye of z){if(K==null||ye==null)return M;K=K[ye]}return K??M};const v=Object.keys(h),S=Object.values(h),k=`${d}|${v.join(",")}`;let A=this.expressionFnCache.get(k);const O=!!A;A||(A=new Function(...v,`return (${d});`),this.expressionFnCache.set(k,A));const N=A(...S);if(i?.isEnabled()){const D=performance.now()-o;i.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(N),resultType:this.getResultType(N),componentId:s?.componentId,componentName:s?.componentName,propName:s?.propName,fromCache:O,duration:D,method:"evaluateExpression",skipCache:s?.skipCache})}return N}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 t=Object.keys(e);return t.length>20?`{Object(${t.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,(t,s,i,o)=>`$t('${o}')`),e.replace(/(?<!['"]\s*)(\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*)(?!\s*['"])/g,'"$1"')}preprocessOptionalChaining(e){const t=[];let s=e.replace(/(['"])(?:(?!\1|\\).|\\.)*\1/g,o=>(t.push(o),`__STRING_LITERAL_${t.length-1}__`));const i=[];return s=s.replace(/\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*(?:\|[^'"\s,)]+)?/g,o=>(i.push(o),`__TRANSLATION_TOKEN_${i.length-1}__`)),s=s.replace(/([a-zA-Z_$][a-zA-Z0-9_$]*)\.(?!\?)/g,"$1?."),s=s.replace(/__TRANSLATION_TOKEN_(\d+)__/g,(o,d)=>i[parseInt(d,10)]),s=s.replace(/__STRING_LITERAL_(\d+)__/g,(o,d)=>t[parseInt(d,10)]),s}extractVariablesFromExpression(e){const t=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"]),s=/(?<![.\w$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,i=new Set;let o;for(;(o=s.exec(e))!==null;){const d=o[1];t.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,t,s){const i={...s,skipCache:!0};let o;try{o=this.resolveBindings(e.$switch,t,i)?.toString()?.trim()??""}catch(g){fo.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,t,i):d:d!==null&&typeof d=="object"?this.resolveObject(d,t,i):d}};H(As,"BINDING_PATTERN",/\{\{([^}]+)\}\}/g),H(As,"PATH_SEGMENT_PATTERN",/([^.[\]]+)|\[(\d+)\]/g),H(As,"CACHE_EXPIRY",3e4);let An=As;new An;const Vu={mobile:{min:0,max:767},tablet:{min:768,max:1023},desktop:{min:1024,max:1/0},portable:{min:0,max:1023}},ac=new Map;function Rw(r,e){let t=null;return((...s)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{r(...s)},e)})}class Ow{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=Rw(()=>{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(ac.has(e))return ac.get(e)??null;let t=null;if(Vu[e])t={...Vu[e]};else{const s=e.match(/^(-?\d*)-(-?\d*)$/);if(s){const[,i,o]=s,d=i===""?0:parseInt(i,10),g=o===""?1/0:parseInt(o,10);!isNaN(d)&&!isNaN(g)&&d<=g&&(t={min:d,max:g})}}return ac.set(e,t),t}getMatchingKey(e,t){const s=[];for(const i of Object.keys(e)){const o=this.parseRange(i);o&&t>=o.min&&t<=o.max&&s.push({key:i,range:o,isPreset:!!Vu[i]})}return s.length===0?null:(s.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}),s[0].key)}matches(e){const t=this.parseRange(e);return t?this.currentWidth>=t.min&&this.currentWidth<=t.max:!1}clearSubscribers(){this.subscribers.clear()}destroy(){this.debouncedHandler&&typeof window<"u"&&window.removeEventListener("resize",this.debouncedHandler),this.clearSubscribers(),ac.clear()}_setWidthForTesting(e){this.currentWidth=e,this.notifySubscribers()}}const ti=new Ow,rc=nt("ConditionEvaluator");function Lw(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 Mw(r){return/[?:|&!+\-*/<>=()]/.test(r)}function $w(r){if(!r.startsWith("{{")||!r.endsWith("}}"))return null;const e=r.slice(2,-2);let t=null,s=0;for(let i=0;i<e.length;i++){const o=e[i];if((i>0?e[i-1]:"")!=="\\"&&((o==='"'||o==="'")&&!t?t=o:o===t&&(t=null),!t&&(o==="{"&&s++,o==="}"&&s--,s<0)))return null}return s===0?e.trim():null}function Iw(r,e,t){if(!r)return!0;try{const s=$w(r);let i;if(s!==null){const o=Lw(s);o!==void 0?i=o.value:Mw(s)?i=t.evaluateExpression(s,e):i=t.resolve(s,e,{skipCache:!0})}else i=t.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(s){return rc.warn(`evaluateStringCondition: 조건 평가 실패: ${r}`,s),!1}}function ic(r,e,t){if(typeof r=="string")return Iw(r,e,t);if("and"in r){if(!Array.isArray(r.and)||r.and.length===0)return rc.warn("evaluateConditionExpression: AND 그룹이 비어있습니다"),!0;for(const s of r.and)if(!ic(s,e,t))return!1;return!0}if("or"in r){if(!Array.isArray(r.or)||r.or.length===0)return rc.warn("evaluateConditionExpression: OR 그룹이 비어있습니다"),!1;for(const s of r.or)if(ic(s,e,t))return!0;return!1}return rc.warn("evaluateConditionExpression: 알 수 없는 조건 형식",r),!1}function Xp(r,e,t){if(!Array.isArray(r)||r.length===0)return{matched:!1,branchIndex:-1};for(let s=0;s<r.length;s++){const i=r[s];if(i.if===void 0)return{matched:!0,branchIndex:s};if(ic(i.if,e,t))return{matched:!0,branchIndex:s}}return{matched:!1,branchIndex:-1}}function zw(r){return typeof r=="string"?!0:r&&typeof r=="object"?"and"in r||"or"in r:!1}function Hw(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 ra=nt("RenderHelpers"),Pw=new Map([["true",!0],["false",!1],["null",null]]);function Qp(){try{return window.G7Core?.devTools}catch{return}}const Zp=new An;function Ku(r){return/[?:|&!+\-*/<>=()]/.test(r)}function em(r){if(!r.startsWith("{{")||!r.endsWith("}}"))return null;const e=r.slice(2,-2);let t=null,s=0;for(let i=0;i<e.length;i++){const o=e[i];if((i>0?e[i-1]:"")!=="\\"&&((o==='"'||o==="'")&&!t?t=o:o===t&&(t=null),!t&&(o==="{"&&s++,o==="}"&&s--,s<0)))return null}return s===0?e.trim():null}function Wu(r,e,t){let s=r;if(r.startsWith("{{")&&r.endsWith("}}")&&(s=r.slice(2,-2).trim()),Ku(s))try{return t.evaluateExpression(s,e)}catch(i){ra.warn(`resolveIterationSource: 표현식 평가 실패: ${r}`,i);return}return t.resolve(s,e,{skipCache:!0})}function Uw(r,e){const t={...r};if(e?.parentDataContext)for(const[s,i]of Object.entries(e.parentDataContext))s in t||(t[s]=i);if(e?.state){const s=t._local||{};t._local={...s,...e.state}}return e?.isolatedContext?.state&&(t._isolated=e.isolatedContext.state),t}function Yu(r,e,t,s){if(!e||!Array.isArray(e)||e.length===0)return r;const i=s?.actionDispatcher??Wm(),o={...r,actions:e},d=i.bindActionsToProps(o,t,s?.componentContext);return delete d.actions,d}function tm(r,e,t,s){if(typeof r=="boolean")return r;if(!r)return!0;try{const i=em(r);let o;if(i!==null){const d=Pw.get(i);d!==void 0?o=d:Ku(i)?o=t.evaluateExpression(i,e):o=t.resolve(i,e,{skipCache:!0})}else o=t.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 ra.warn(`evaluateIfCondition: 조건 평가 실패 (컴포넌트: ${s||"unknown"}):`,i),!1}}function ni(r,e,t,s){if(r.if!==void 0)return tm(r.if,e,t,s);if(r.condition!==void 0)return tm(r.condition,e,t,s);if(r.conditions===void 0)return!0;const i=r.conditions;try{return zw(i)?ic(i,e,t):Hw(i)?Xp(i,e,t).matched:(ra.warn(`evaluateRenderCondition: 알 수 없는 conditions 형식 (컴포넌트: ${s||"unknown"})`),!0)}catch(o){return ra.warn(`evaluateRenderCondition: conditions 평가 실패 (컴포넌트: ${s||"unknown"}):`,o),!1}}function nm(r){if(!r.responsive)return r;const e=ti.getWidth(),t=ti.getMatchingKey(r.responsive,e);if(!t)return r;const s=r.responsive[t];return{...r,props:{...r.props,...s.props},children:s.children??r.children,text:s.text??r.text,if:s.if??r.if,iteration:s.iteration??r.iteration}}function po(r,e,t,s,i){if(!r||r.length===0)return[];const o=i?.bindingEngine??new An,d=i?.translationEngine??br.getInstance(),g=i?.translationContext??{templateId:"",locale:"ko"},h=Uw(e,i?.componentContext),f=(x,w)=>{if(typeof x=="string"){if(Wp(x))return Jp(x);if(Yp(x)){const S=[],k=x.replace(new RegExp(`${nc}([^${uo}]*)${uo}`,"g"),(O,N)=>(S.push(N),`${La}${S.length-1}${La}`));let A=k;return/\$t:[a-zA-Z0-9._-]+/.test(k)&&(A=d.resolveTranslations(k,g,w)),A.replace(new RegExp(`${La}(\\d+)${La}`,"g"),(O,N)=>S[parseInt(N)])}if(x.startsWith("$t:defer:")){const S="$t:"+x.slice(9);return d.resolveTranslations(S,g,w)}if(x.startsWith("$t:"))return d.resolveTranslations(x,g,w);const v=em(x);if(v!==null){let S=!1,k=v;v.startsWith(Oa)&&(S=!0,k=v.slice(Oa.length));let A;if(Ku(k))try{A=o.evaluateExpression(k,w)}catch(O){ra.warn("renderItemChildren: 표현식 평가 실패:",O);return}else A=o.resolve(k,w,{skipCache:!0});return!S&&typeof A=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(A)&&(A=d.resolveTranslations(A,g,w)),S&&A!=null?ho(A):A}if(x.includes("{{")){const S=o.resolveBindings(x,w,{skipCache:!0});return typeof S=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(S)?d.resolveTranslations(S,g,w):S}return x}if(Array.isArray(x))return x.map(v=>f(v,w));if(x&&typeof x=="object"){const v={};for(const[S,k]of Object.entries(x))v[S]=f(k,w);return v}return x},p=(x,w)=>{if(!x)return{};const v={};for(const[S,k]of Object.entries(x))v[S]=f(k,w);return v},y=(x,w,v)=>{const S=nm(x),k=S.iteration;if(!k)return[];const A=Wu(k.source,v,o);if(!Array.isArray(A))return ra.warn(`renderItemChildren: iteration.source가 배열이 아닙니다: ${k.source}`),[];const O=Qp();if(O?.isEnabled()){const D=`${w}-iteration`;O.trackIteration(D,k.source,k.item_var,k.index_var,A.length)}const N=t[S.name];return N?A.flatMap((D,$)=>{const M={...v,[k.item_var]:D,[`${k.item_var}_index`]:$,...k.index_var?{[k.index_var]:$}:{}},z=ni({if:S.if,condition:S.condition,conditions:S.conditions},M,o,S.id);if(S.if&&O?.isEnabled()){const de=`${w}-iter-${$}-if`;O.trackIfCondition(de,S.if,z,S.name)}if(!z)return[];const K=S.id?String(f(S.id,M)):void 0,ye=`${w}-iter-${$}`,we=i?.getRemountKey?i.getRemountKey(K,ye):ye,J=p(S.props,M),ve=Yu(J,S.actions,M,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let le=null;return S.text!==void 0?le=f(S.text,M):S.children&&S.children.length>0&&(le=po(S.children,M,t,we,i)),O?.isEnabled()&&O.trackRender(S.name),[Ke.createElement(N,{key:we,...ve},le)]}):(ra.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${S.name}`),[])};return r.flatMap((x,w)=>{const v=nm(x),S=v.id?String(f(v.id,h)):void 0,k=s?`${s}-${S||w}`:S||`child-${w}`,A=i?.getRemountKey?i.getRemountKey(S,k):k;if(v.iteration)return y(v,A,h);const O=ni({if:v.if,condition:v.condition,conditions:v.conditions},h,o,v.id),N=Qp();if(v.if&&N?.isEnabled()){const K=`${A}-if`;N.trackIfCondition(K,v.if,O,v.name)}if(!O)return[];const D=t[v.name];if(!D)return ra.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${v.name}`),[];const $=p(v.props,h),M=Yu($,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=po(v.children,h,t,A,i)),N?.isEnabled()&&N.trackRender(v.name),[Ke.createElement(D,{key:A,...M},z)]})}function si(r,e,t,s){let i,o;return t instanceof An?(i=t,o=s):(i=Zp,o=t),i.resolveBindings(r,e,o)}function Bw(r,e,t,s){const i=t??Zp,o={skipCache:!0,...s};let d;try{d=i.resolveBindings(r.key,e,{skipCache:o.skipCache})?.toString()?.trim()??""}catch(f){ra.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 sm(r,e){return function(){return r.apply(e,arguments)}}const{toString:qw}=Object.prototype,{getPrototypeOf:Ju}=Object,{iterator:oc,toStringTag:am}=Symbol,lc=(r=>e=>{const t=qw.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ws=r=>(r=r.toLowerCase(),e=>lc(e)===r),cc=r=>e=>typeof e===r,{isArray:ai}=Array,ri=cc("undefined");function mo(r){return r!==null&&!ri(r)&&r.constructor!==null&&!ri(r.constructor)&&On(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const rm=ws("ArrayBuffer");function Gw(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&rm(r.buffer),e}const Fw=cc("string"),On=cc("function"),im=cc("number"),yo=r=>r!==null&&typeof r=="object",Vw=r=>r===!0||r===!1,dc=r=>{if(lc(r)!=="object")return!1;const e=Ju(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(am in r)&&!(oc in r)},Kw=r=>{if(!yo(r)||mo(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},Ww=ws("Date"),Yw=ws("File"),Jw=ws("Blob"),Xw=ws("FileList"),Qw=r=>yo(r)&&On(r.pipe),Zw=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||On(r.append)&&((e=lc(r))==="formdata"||e==="object"&&On(r.toString)&&r.toString()==="[object FormData]"))},eS=ws("URLSearchParams"),[tS,nS,sS,aS]=["ReadableStream","Request","Response","Headers"].map(ws),rS=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function xo(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,i;if(typeof r!="object"&&(r=[r]),ai(r))for(s=0,i=r.length;s<i;s++)e.call(null,r[s],s,r);else{if(mo(r))return;const o=t?Object.getOwnPropertyNames(r):Object.keys(r),d=o.length;let g;for(s=0;s<d;s++)g=o[s],e.call(null,r[g],g,r)}}function om(r,e){if(mo(r))return null;e=e.toLowerCase();const t=Object.keys(r);let s=t.length,i;for(;s-- >0;)if(i=t[s],e===i.toLowerCase())return i;return null}const vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lm=r=>!ri(r)&&r!==vr;function Xu(){const{caseless:r,skipUndefined:e}=lm(this)&&this||{},t={},s=(i,o)=>{const d=r&&om(t,o)||o;dc(t[d])&&dc(i)?t[d]=Xu(t[d],i):dc(i)?t[d]=Xu({},i):ai(i)?t[d]=i.slice():(!e||!ri(i))&&(t[d]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&xo(arguments[i],s);return t}const iS=(r,e,t,{allOwnKeys:s}={})=>(xo(e,(i,o)=>{t&&On(i)?r[o]=sm(i,t):r[o]=i},{allOwnKeys:s}),r),oS=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),lS=(r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},cS=(r,e,t,s)=>{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],(!s||s(d,r,e))&&!g[d]&&(e[d]=r[d],g[d]=!0);r=t!==!1&&Ju(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},dS=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},uS=r=>{if(!r)return null;if(ai(r))return r;let e=r.length;if(!im(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},gS=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Ju(Uint8Array)),hS=(r,e)=>{const s=(r&&r[oc]).call(r);let i;for(;(i=s.next())&&!i.done;){const o=i.value;e.call(r,o[0],o[1])}},fS=(r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},pS=ws("HTMLFormElement"),mS=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,i){return s.toUpperCase()+i}),cm=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),yS=ws("RegExp"),dm=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};xo(t,(i,o)=>{let d;(d=e(i,o,r))!==!1&&(s[o]=d||i)}),Object.defineProperties(r,s)},xS=r=>{dm(r,(e,t)=>{if(On(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=r[t];if(On(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},bS=(r,e)=>{const t={},s=i=>{i.forEach(o=>{t[o]=!0})};return ai(r)?s(r):s(String(r).split(e)),t},vS=()=>{},wS=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function SS(r){return!!(r&&On(r.append)&&r[am]==="FormData"&&r[oc])}const CS=r=>{const e=new Array(10),t=(s,i)=>{if(yo(s)){if(e.indexOf(s)>=0)return;if(mo(s))return s;if(!("toJSON"in s)){e[i]=s;const o=ai(s)?[]:{};return xo(s,(d,g)=>{const h=t(d,i+1);!ri(h)&&(o[g]=h)}),e[i]=void 0,o}}return s};return t(r,0)},jS=ws("AsyncFunction"),kS=r=>r&&(yo(r)||On(r))&&On(r.then)&&On(r.catch),um=((r,e)=>r?setImmediate:e?((t,s)=>(vr.addEventListener("message",({source:i,data:o})=>{i===vr&&o===t&&s.length&&s.shift()()},!1),i=>{s.push(i),vr.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",On(vr.postMessage)),NS=typeof queueMicrotask<"u"?queueMicrotask.bind(vr):typeof process<"u"&&process.nextTick||um,ae={isArray:ai,isArrayBuffer:rm,isBuffer:mo,isFormData:Zw,isArrayBufferView:Gw,isString:Fw,isNumber:im,isBoolean:Vw,isObject:yo,isPlainObject:dc,isEmptyObject:Kw,isReadableStream:tS,isRequest:nS,isResponse:sS,isHeaders:aS,isUndefined:ri,isDate:Ww,isFile:Yw,isBlob:Jw,isRegExp:yS,isFunction:On,isStream:Qw,isURLSearchParams:eS,isTypedArray:gS,isFileList:Xw,forEach:xo,merge:Xu,extend:iS,trim:rS,stripBOM:oS,inherits:lS,toFlatObject:cS,kindOf:lc,kindOfTest:ws,endsWith:dS,toArray:uS,forEachEntry:hS,matchAll:fS,isHTMLForm:pS,hasOwnProperty:cm,hasOwnProp:cm,reduceDescriptors:dm,freezeMethods:xS,toObjectSet:bS,toCamelCase:mS,noop:vS,toFiniteNumber:wS,findKey:om,global:vr,isContextDefined:lm,isSpecCompliantForm:SS,toJSONObject:CS,isAsyncFn:jS,isThenable:kS,setImmediate:um,asap:NS,isIterable:r=>r!=null&&On(r[oc])};function st(r,e,t,s,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),t&&(this.config=t),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}ae.inherits(st,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:ae.toJSONObject(this.config),code:this.code,status:this.status}}});const gm=st.prototype,hm={};["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=>{hm[r]={value:r}}),Object.defineProperties(st,hm),Object.defineProperty(gm,"isAxiosError",{value:!0}),st.from=(r,e,t,s,i,o)=>{const d=Object.create(gm);ae.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 st.call(d,g,h,t,s,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 ES=null;function Qu(r){return ae.isPlainObject(r)||ae.isArray(r)}function fm(r){return ae.endsWith(r,"[]")?r.slice(0,-2):r}function pm(r,e,t){return r?r.concat(e).map(function(i,o){return i=fm(i),!t&&o?"["+i+"]":i}).join(t?".":""):e}function _S(r){return ae.isArray(r)&&!r.some(Qu)}const AS=ae.toFlatObject(ae,{},null,function(e){return/^is[A-Z]/.test(e)});function uc(r,e,t){if(!ae.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=ae.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,k){return!ae.isUndefined(k[S])});const s=t.metaTokens,i=t.visitor||p,o=t.dots,d=t.indexes,h=(t.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(e);if(!ae.isFunction(i))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(ae.isDate(v))return v.toISOString();if(ae.isBoolean(v))return v.toString();if(!h&&ae.isBlob(v))throw new st("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(v)||ae.isTypedArray(v)?h&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function p(v,S,k){let A=v;if(v&&!k&&typeof v=="object"){if(ae.endsWith(S,"{}"))S=s?S:S.slice(0,-2),v=JSON.stringify(v);else if(ae.isArray(v)&&_S(v)||(ae.isFileList(v)||ae.endsWith(S,"[]"))&&(A=ae.toArray(v)))return S=fm(S),A.forEach(function(N,D){!(ae.isUndefined(N)||N===null)&&e.append(d===!0?pm([S],D,o):d===null?S:S+"[]",f(N))}),!1}return Qu(v)?!0:(e.append(pm(k,S,o),f(v)),!1)}const y=[],x=Object.assign(AS,{defaultVisitor:p,convertValue:f,isVisitable:Qu});function w(v,S){if(!ae.isUndefined(v)){if(y.indexOf(v)!==-1)throw Error("Circular reference detected in "+S.join("."));y.push(v),ae.forEach(v,function(A,O){(!(ae.isUndefined(A)||A===null)&&i.call(e,A,ae.isString(O)?O.trim():O,S,x))===!0&&w(A,S?S.concat(O):[O])}),y.pop()}}if(!ae.isObject(r))throw new TypeError("data must be an object");return w(r),e}function mm(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Zu(r,e){this._pairs=[],r&&uc(r,this,e)}const ym=Zu.prototype;ym.append=function(e,t){this._pairs.push([e,t])},ym.toString=function(e){const t=e?function(s){return e.call(this,s,mm)}:mm;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function TS(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xm(r,e,t){if(!e)return r;const s=t&&t.encode||TS;ae.isFunction(t)&&(t={serialize:t});const i=t&&t.serialize;let o;if(i?o=i(e,t):o=ae.isURLSearchParams(e)?e.toString():new Zu(e,t).toString(s),o){const d=r.indexOf("#");d!==-1&&(r=r.slice(0,d)),r+=(r.indexOf("?")===-1?"?":"&")+o}return r}class bm{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ae.forEach(this.handlers,function(s){s!==null&&e(s)})}}const vm={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},DS={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Zu,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},eg=typeof window<"u"&&typeof document<"u",tg=typeof navigator=="object"&&navigator||void 0,RS=eg&&(!tg||["ReactNative","NativeScript","NS"].indexOf(tg.product)<0),OS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",LS=eg&&window.location.href||"http://localhost",En={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:eg,hasStandardBrowserEnv:RS,hasStandardBrowserWebWorkerEnv:OS,navigator:tg,origin:LS},Symbol.toStringTag,{value:"Module"})),...DS};function MS(r,e){return uc(r,new En.classes.URLSearchParams,{visitor:function(t,s,i,o){return En.isNode&&ae.isBuffer(t)?(this.append(s,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function $S(r){return ae.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function IS(r){const e={},t=Object.keys(r);let s;const i=t.length;let o;for(s=0;s<i;s++)o=t[s],e[o]=r[o];return e}function wm(r){function e(t,s,i,o){let d=t[o++];if(d==="__proto__")return!0;const g=Number.isFinite(+d),h=o>=t.length;return d=!d&&ae.isArray(i)?i.length:d,h?(ae.hasOwnProp(i,d)?i[d]=[i[d],s]:i[d]=s,!g):((!i[d]||!ae.isObject(i[d]))&&(i[d]=[]),e(t,s,i[d],o)&&ae.isArray(i[d])&&(i[d]=IS(i[d])),!g)}if(ae.isFormData(r)&&ae.isFunction(r.entries)){const t={};return ae.forEachEntry(r,(s,i)=>{e($S(s),i,t,0)}),t}return null}function zS(r,e,t){if(ae.isString(r))try{return(e||JSON.parse)(r),ae.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}const bo={transitional:vm,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",i=s.indexOf("application/json")>-1,o=ae.isObject(e);if(o&&ae.isHTMLForm(e)&&(e=new FormData(e)),ae.isFormData(e))return i?JSON.stringify(wm(e)):e;if(ae.isArrayBuffer(e)||ae.isBuffer(e)||ae.isStream(e)||ae.isFile(e)||ae.isBlob(e)||ae.isReadableStream(e))return e;if(ae.isArrayBufferView(e))return e.buffer;if(ae.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let g;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return MS(e,this.formSerializer).toString();if((g=ae.isFileList(e))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return uc(g?{"files[]":e}:e,h&&new h,this.formSerializer)}}return o||i?(t.setContentType("application/json",!1),zS(e)):e}],transformResponse:[function(e){const t=this.transitional||bo.transitional,s=t&&t.forcedJSONParsing,i=this.responseType==="json";if(ae.isResponse(e)||ae.isReadableStream(e))return e;if(e&&ae.isString(e)&&(s&&!this.responseType||i)){const d=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(g){if(d)throw g.name==="SyntaxError"?st.from(g,st.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:En.classes.FormData,Blob:En.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],r=>{bo.headers[r]={}});const HS=ae.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"]),PS=r=>{const e={};let t,s,i;return r&&r.split(`
|
||
`).forEach(function(d){i=d.indexOf(":"),t=d.substring(0,i).trim().toLowerCase(),s=d.substring(i+1).trim(),!(!t||e[t]&&HS[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},Sm=Symbol("internals");function vo(r){return r&&String(r).trim().toLowerCase()}function gc(r){return r===!1||r==null?r:ae.isArray(r)?r.map(gc):String(r)}function US(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(r);)e[s[1]]=s[2];return e}const BS=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function ng(r,e,t,s,i){if(ae.isFunction(s))return s.call(this,e,t);if(i&&(e=t),!!ae.isString(e)){if(ae.isString(s))return e.indexOf(s)!==-1;if(ae.isRegExp(s))return s.test(e)}}function qS(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function GS(r,e){const t=ae.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(r,s+t,{value:function(i,o,d){return this[s].call(this,e,i,o,d)},configurable:!0})})}let Ln=class{constructor(e){e&&this.set(e)}set(e,t,s){const i=this;function o(g,h,f){const p=vo(h);if(!p)throw new Error("header name must be a non-empty string");const y=ae.findKey(i,p);(!y||i[y]===void 0||f===!0||f===void 0&&i[y]!==!1)&&(i[y||h]=gc(g))}const d=(g,h)=>ae.forEach(g,(f,p)=>o(f,p,h));if(ae.isPlainObject(e)||e instanceof this.constructor)d(e,t);else if(ae.isString(e)&&(e=e.trim())&&!BS(e))d(PS(e),t);else if(ae.isObject(e)&&ae.isIterable(e)){let g={},h,f;for(const p of e){if(!ae.isArray(p))throw TypeError("Object iterator must return a key-value pair");g[f=p[0]]=(h=g[f])?ae.isArray(h)?[...h,p[1]]:[h,p[1]]:p[1]}d(g,t)}else e!=null&&o(t,e,s);return this}get(e,t){if(e=vo(e),e){const s=ae.findKey(this,e);if(s){const i=this[s];if(!t)return i;if(t===!0)return US(i);if(ae.isFunction(t))return t.call(this,i,s);if(ae.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vo(e),e){const s=ae.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||ng(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let i=!1;function o(d){if(d=vo(d),d){const g=ae.findKey(s,d);g&&(!t||ng(s,s[g],g,t))&&(delete s[g],i=!0)}}return ae.isArray(e)?e.forEach(o):o(e),i}clear(e){const t=Object.keys(this);let s=t.length,i=!1;for(;s--;){const o=t[s];(!e||ng(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const t=this,s={};return ae.forEach(this,(i,o)=>{const d=ae.findKey(s,o);if(d){t[d]=gc(i),delete t[o];return}const g=e?qS(o):String(o).trim();g!==o&&delete t[o],t[g]=gc(i),s[g]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ae.forEach(this,(s,i)=>{s!=null&&s!==!1&&(t[i]=e&&ae.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).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,...t){const s=new this(e);return t.forEach(i=>s.set(i)),s}static accessor(e){const s=(this[Sm]=this[Sm]={accessors:{}}).accessors,i=this.prototype;function o(d){const g=vo(d);s[g]||(GS(i,d),s[g]=!0)}return ae.isArray(e)?e.forEach(o):o(e),this}};Ln.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ae.reduceDescriptors(Ln.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(s){this[t]=s}}}),ae.freezeMethods(Ln);function sg(r,e){const t=this||bo,s=e||t,i=Ln.from(s.headers);let o=s.data;return ae.forEach(r,function(g){o=g.call(t,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Cm(r){return!!(r&&r.__CANCEL__)}function ii(r,e,t){st.call(this,r??"canceled",st.ERR_CANCELED,e,t),this.name="CanceledError"}ae.inherits(ii,st,{__CANCEL__:!0});function jm(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?r(t):e(new st("Request failed with status code "+t.status,[st.ERR_BAD_REQUEST,st.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function FS(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function VS(r,e){r=r||10;const t=new Array(r),s=new Array(r);let i=0,o=0,d;return e=e!==void 0?e:1e3,function(h){const f=Date.now(),p=s[o];d||(d=f),t[i]=h,s[i]=f;let y=o,x=0;for(;y!==i;)x+=t[y++],y=y%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(x*1e3/w):void 0}}function KS(r,e){let t=0,s=1e3/e,i,o;const d=(f,p=Date.now())=>{t=p,i=null,o&&(clearTimeout(o),o=null),r(...f)};return[(...f)=>{const p=Date.now(),y=p-t;y>=s?d(f,p):(i=f,o||(o=setTimeout(()=>{o=null,d(i)},s-y)))},()=>i&&d(i)]}const hc=(r,e,t=3)=>{let s=0;const i=VS(50,250);return KS(o=>{const d=o.loaded,g=o.lengthComputable?o.total:void 0,h=d-s,f=i(h),p=d<=g;s=d;const y={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(y)},t)},km=(r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},Nm=r=>(...e)=>ae.asap(()=>r(...e)),WS=En.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,En.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(En.origin),En.navigator&&/(msie|trident)/i.test(En.navigator.userAgent)):()=>!0,YS=En.hasStandardBrowserEnv?{write(r,e,t,s,i,o){const d=[r+"="+encodeURIComponent(e)];ae.isNumber(t)&&d.push("expires="+new Date(t).toGMTString()),ae.isString(s)&&d.push("path="+s),ae.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 JS(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function XS(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Em(r,e,t){let s=!JS(e);return r&&(s||t==!1)?XS(r,e):e}const _m=r=>r instanceof Ln?{...r}:r;function wr(r,e){e=e||{};const t={};function s(f,p,y,x){return ae.isPlainObject(f)&&ae.isPlainObject(p)?ae.merge.call({caseless:x},f,p):ae.isPlainObject(p)?ae.merge({},p):ae.isArray(p)?p.slice():p}function i(f,p,y,x){if(ae.isUndefined(p)){if(!ae.isUndefined(f))return s(void 0,f,y,x)}else return s(f,p,y,x)}function o(f,p){if(!ae.isUndefined(p))return s(void 0,p)}function d(f,p){if(ae.isUndefined(p)){if(!ae.isUndefined(f))return s(void 0,f)}else return s(void 0,p)}function g(f,p,y){if(y in e)return s(f,p);if(y in r)return s(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,y)=>i(_m(f),_m(p),y,!0)};return ae.forEach(Object.keys({...r,...e}),function(p){const y=h[p]||i,x=y(r[p],e[p],p);ae.isUndefined(x)&&y!==g||(t[p]=x)}),t}const Am=r=>{const e=wr({},r);let{data:t,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:o,headers:d,auth:g}=e;if(e.headers=d=Ln.from(d),e.url=xm(Em(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),g&&d.set("Authorization","Basic "+btoa((g.username||"")+":"+(g.password?unescape(encodeURIComponent(g.password)):""))),ae.isFormData(t)){if(En.hasStandardBrowserEnv||En.hasStandardBrowserWebWorkerEnv)d.setContentType(void 0);else if(ae.isFunction(t.getHeaders)){const h=t.getHeaders(),f=["content-type","content-length"];Object.entries(h).forEach(([p,y])=>{f.includes(p.toLowerCase())&&d.set(p,y)})}}if(En.hasStandardBrowserEnv&&(s&&ae.isFunction(s)&&(s=s(e)),s||s!==!1&&WS(e.url))){const h=i&&o&&YS.read(o);h&&d.set(i,h)}return e},QS=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,s){const i=Am(r);let o=i.data;const d=Ln.from(i.headers).normalize();let{responseType:g,onUploadProgress:h,onDownloadProgress:f}=i,p,y,x,w,v;function S(){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()),$={data:!g||g==="text"||g==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:N,config:r,request:k};jm(function(z){t(z),S()},function(z){s(z),S()},$),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&&(s(new st("Request aborted",st.ECONNABORTED,r,k)),k=null)},k.onerror=function(D){const $=D&&D.message?D.message:"Network Error",M=new st($,st.ERR_NETWORK,r,k);M.event=D||null,s(M),k=null},k.ontimeout=function(){let D=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const $=i.transitional||vm;i.timeoutErrorMessage&&(D=i.timeoutErrorMessage),s(new st(D,$.clarifyTimeoutError?st.ETIMEDOUT:st.ECONNABORTED,r,k)),k=null},o===void 0&&d.setContentType(null),"setRequestHeader"in k&&ae.forEach(d.toJSON(),function(D,$){k.setRequestHeader($,D)}),ae.isUndefined(i.withCredentials)||(k.withCredentials=!!i.withCredentials),g&&g!=="json"&&(k.responseType=i.responseType),f&&([x,v]=hc(f,!0),k.addEventListener("progress",x)),h&&k.upload&&([y,w]=hc(h),k.upload.addEventListener("progress",y),k.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(p=N=>{k&&(s(!N||N.type?new ii(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 O=FS(i.url);if(O&&En.protocols.indexOf(O)===-1){s(new st("Unsupported protocol "+O+":",st.ERR_BAD_REQUEST,r));return}k.send(o||null)})},ZS=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let s=new AbortController,i;const o=function(f){if(!i){i=!0,g();const p=f instanceof Error?f:this.reason;s.abort(p instanceof st?p:new ii(p instanceof Error?p.message:p))}};let d=e&&setTimeout(()=>{d=null,o(new st(`timeout ${e} of ms exceeded`,st.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}=s;return h.unsubscribe=()=>ae.asap(g),h}},e7=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let s=0,i;for(;s<t;)i=s+e,yield r.slice(s,i),s=i},t7=async function*(r,e){for await(const t of n7(r))yield*e7(t,e)},n7=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},Tm=(r,e,t,s)=>{const i=t7(r,e);let o=0,d,g=h=>{d||(d=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:f,value:p}=await i.next();if(f){g(),h.close();return}let y=p.byteLength;if(t){let x=o+=y;t(x)}h.enqueue(new Uint8Array(p))}catch(f){throw g(f),f}},cancel(h){return g(h),i.return()}},{highWaterMark:2})},Dm=64*1024,{isFunction:fc}=ae,s7=(({Request:r,Response:e})=>({Request:r,Response:e}))(ae.global),{ReadableStream:Rm,TextEncoder:Om}=ae.global,Lm=(r,...e)=>{try{return!!r(...e)}catch{return!1}},a7=r=>{r=ae.merge.call({skipUndefined:!0},s7,r);const{fetch:e,Request:t,Response:s}=r,i=e?fc(e):typeof fetch=="function",o=fc(t),d=fc(s);if(!i)return!1;const g=i&&fc(Rm),h=i&&(typeof Om=="function"?(v=>S=>v.encode(S))(new Om):async v=>new Uint8Array(await new t(v).arrayBuffer())),f=o&&g&&Lm(()=>{let v=!1;const S=new t(En.origin,{body:new Rm,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!S}),p=d&&g&&Lm(()=>ae.isReadableStream(new s("").body)),y={stream:p&&(v=>v.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!y[v]&&(y[v]=(S,k)=>{let A=S&&S[v];if(A)return A.call(S);throw new st(`Response type '${v}' is not supported`,st.ERR_NOT_SUPPORT,k)})});const x=async v=>{if(v==null)return 0;if(ae.isBlob(v))return v.size;if(ae.isSpecCompliantForm(v))return(await new t(En.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(ae.isArrayBufferView(v)||ae.isArrayBuffer(v))return v.byteLength;if(ae.isURLSearchParams(v)&&(v=v+""),ae.isString(v))return(await h(v)).byteLength},w=async(v,S)=>{const k=ae.toFiniteNumber(v.getContentLength());return k??x(S)};return async v=>{let{url:S,method:k,data:A,signal:O,cancelToken:N,timeout:D,onDownloadProgress:$,onUploadProgress:M,responseType:z,headers:K,withCredentials:ye="same-origin",fetchOptions:we}=Am(v),J=e||fetch;z=z?(z+"").toLowerCase():"text";let ve=ZS([O,N&&N.toAbortSignal()],D),le=null;const de=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let je;try{if(M&&f&&k!=="get"&&k!=="head"&&(je=await w(K,A))!==0){let R=new t(S,{method:"POST",body:A,duplex:"half"}),q;if(ae.isFormData(A)&&(q=R.headers.get("content-type"))&&K.setContentType(q),R.body){const[re,xe]=km(je,hc(Nm(M)));A=Tm(R.body,Dm,re,xe)}}ae.isString(ye)||(ye=ye?"include":"omit");const W=o&&"credentials"in t.prototype,he={...we,signal:ve,method:k.toUpperCase(),headers:K.normalize().toJSON(),body:A,duplex:"half",credentials:W?ye:void 0};le=o&&new t(S,he);let ee=await(o?J(le,we):J(S,he));const X=p&&(z==="stream"||z==="response");if(p&&($||X&&de)){const R={};["status","statusText","headers"].forEach(oe=>{R[oe]=ee[oe]});const q=ae.toFiniteNumber(ee.headers.get("content-length")),[re,xe]=$&&km(q,hc(Nm($),!0))||[];ee=new s(Tm(ee.body,Dm,re,()=>{xe&&xe(),de&&de()}),R)}z=z||"text";let se=await y[ae.findKey(y,z)||"text"](ee,v);return!X&&de&&de(),await new Promise((R,q)=>{jm(R,q,{data:se,headers:Ln.from(ee.headers),status:ee.status,statusText:ee.statusText,config:v,request:le})})}catch(W){throw de&&de(),W&&W.name==="TypeError"&&/Load failed|fetch/i.test(W.message)?Object.assign(new st("Network Error",st.ERR_NETWORK,v,le),{cause:W.cause||W}):st.from(W,W&&W.code,v,le)}}},r7=new Map,Mm=r=>{let e=r?r.env:{};const{fetch:t,Request:s,Response:i}=e,o=[s,i,t];let d=o.length,g=d,h,f,p=r7;for(;g--;)h=o[g],f=p.get(h),f===void 0&&p.set(h,f=g?new Map:a7(e)),p=f;return f};Mm();const ag={http:ES,xhr:QS,fetch:{get:Mm}};ae.forEach(ag,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const $m=r=>`- ${r}`,i7=r=>ae.isFunction(r)||r===null||r===!1,Im={getAdapter:(r,e)=>{r=ae.isArray(r)?r:[r];const{length:t}=r;let s,i;const o={};for(let d=0;d<t;d++){s=r[d];let g;if(i=s,!i7(s)&&(i=ag[(g=String(s)).toLowerCase()],i===void 0))throw new st(`Unknown adapter '${g}'`);if(i&&(ae.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=t?d.length>1?`since :
|
||
`+d.map($m).join(`
|
||
`):" "+$m(d[0]):"as no adapter specified";throw new st("There is no suitable adapter to dispatch the request "+g,"ERR_NOT_SUPPORT")}return i},adapters:ag};function rg(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new ii(null,r)}function zm(r){return rg(r),r.headers=Ln.from(r.headers),r.data=sg.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Im.getAdapter(r.adapter||bo.adapter,r)(r).then(function(s){return rg(r),s.data=sg.call(r,r.transformResponse,s),s.headers=Ln.from(s.headers),s},function(s){return Cm(s)||(rg(r),s&&s.response&&(s.response.data=sg.call(r,r.transformResponse,s.response),s.response.headers=Ln.from(s.response.headers))),Promise.reject(s)})}const Hm="1.12.2",pc={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{pc[r]=function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r}});const Pm={};pc.transitional=function(e,t,s){function i(o,d){return"[Axios v"+Hm+"] Transitional option '"+o+"'"+d+(s?". "+s:"")}return(o,d,g)=>{if(e===!1)throw new st(i(d," has been removed"+(t?" in "+t:"")),st.ERR_DEPRECATED);return t&&!Pm[d]&&(Pm[d]=!0,console.warn(i(d," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,d,g):!0}},pc.spelling=function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function o7(r,e,t){if(typeof r!="object")throw new st("options must be an object",st.ERR_BAD_OPTION_VALUE);const s=Object.keys(r);let i=s.length;for(;i-- >0;){const o=s[i],d=e[o];if(d){const g=r[o],h=g===void 0||d(g,o,r);if(h!==!0)throw new st("option "+o+" must be "+h,st.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new st("Unknown option "+o,st.ERR_BAD_OPTION)}}const mc={assertOptions:o7,validators:pc},Us=mc.validators;let Sr=class{constructor(e){this.defaults=e||{},this.interceptors={request:new bm,response:new bm}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
||
`+o):s.stack=o}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=wr(this.defaults,t);const{transitional:s,paramsSerializer:i,headers:o}=t;s!==void 0&&mc.assertOptions(s,{silentJSONParsing:Us.transitional(Us.boolean),forcedJSONParsing:Us.transitional(Us.boolean),clarifyTimeoutError:Us.transitional(Us.boolean)},!1),i!=null&&(ae.isFunction(i)?t.paramsSerializer={serialize:i}:mc.assertOptions(i,{encode:Us.function,serialize:Us.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),mc.assertOptions(t,{baseUrl:Us.spelling("baseURL"),withXsrfToken:Us.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let d=o&&ae.merge(o.common,o[t.method]);o&&ae.forEach(["delete","get","head","post","put","patch","common"],v=>{delete o[v]}),t.headers=Ln.concat(d,o);const g=[];let h=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(t)===!1||(h=h&&S.synchronous,g.unshift(S.fulfilled,S.rejected))});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let p,y=0,x;if(!h){const v=[zm.bind(this),void 0];for(v.unshift(...g),v.push(...f),x=v.length,p=Promise.resolve(t);y<x;)p=p.then(v[y++],v[y++]);return p}x=g.length;let w=t;for(;y<x;){const v=g[y++],S=g[y++];try{w=v(w)}catch(k){S.call(this,k);break}}try{p=zm.call(this,w)}catch(v){return Promise.reject(v)}for(y=0,x=f.length;y<x;)p=p.then(f[y++],f[y++]);return p}getUri(e){e=wr(this.defaults,e);const t=Em(e.baseURL,e.url,e.allowAbsoluteUrls);return xm(t,e.params,e.paramsSerializer)}};ae.forEach(["delete","get","head","options"],function(e){Sr.prototype[e]=function(t,s){return this.request(wr(s||{},{method:e,url:t,data:(s||{}).data}))}}),ae.forEach(["post","put","patch"],function(e){function t(s){return function(o,d,g){return this.request(wr(g||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:d}))}}Sr.prototype[e]=t(),Sr.prototype[e+"Form"]=t(!0)});let l7=class bw{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});const s=this;this.promise.then(i=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](i);s._listeners=null}),this.promise.then=i=>{let o;const d=new Promise(g=>{s.subscribe(g),o=g}).then(i);return d.cancel=function(){s.unsubscribe(o)},d},e(function(o,d,g){s.reason||(s.reason=new ii(o,d,g),t(s.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 t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=s=>{e.abort(s)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new bw(function(i){e=i}),cancel:e}}};function c7(r){return function(t){return r.apply(null,t)}}function d7(r){return ae.isObject(r)&&r.isAxiosError===!0}const ig={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(ig).forEach(([r,e])=>{ig[e]=r});function Um(r){const e=new Sr(r),t=sm(Sr.prototype.request,e);return ae.extend(t,Sr.prototype,e,{allOwnKeys:!0}),ae.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Um(wr(r,i))},t}const Jt=Um(bo);Jt.Axios=Sr,Jt.CanceledError=ii,Jt.CancelToken=l7,Jt.isCancel=Cm,Jt.VERSION=Hm,Jt.toFormData=uc,Jt.AxiosError=st,Jt.Cancel=Jt.CanceledError,Jt.all=function(e){return Promise.all(e)},Jt.spread=c7,Jt.isAxiosError=d7,Jt.mergeConfig=wr,Jt.AxiosHeaders=Ln,Jt.formToJSON=r=>wm(ae.isHTMLForm(r)?new FormData(r):r),Jt.getAdapter=Im.getAdapter,Jt.HttpStatusCode=ig,Jt.default=Jt;const{Axios:q1,AxiosError:G1,CanceledError:F1,isCancel:V1,CancelToken:K1,VERSION:W1,all:Y1,Cancel:J1,isAxiosError:X1,spread:Q1,toFormData:Z1,AxiosHeaders:eA,HttpStatusCode:tA,formToJSON:nA,getAdapter:sA,mergeConfig:aA}=Jt,u7=nt("ApiClient");function og(){return typeof window<"u"&&window.__G7_DEVTOOLS__?window.__G7_DEVTOOLS__:null}class g7{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=Jt.create({baseURL:this.config.baseURL,timeout:this.config.timeout,headers:{"Content-Type":"application/json",Accept:"application/json"},paramsSerializer:{serialize:t=>{const s=[];for(const[i,o]of Object.entries(t))if(o!=null)if(Array.isArray(o)){const d=i.endsWith("[]")?i:`${i}[]`;for(const g of o)s.push(`${encodeURIComponent(d)}=${encodeURIComponent(String(g))}`)}else s.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(o))}`);return s.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 t=this.getToken();if(t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),typeof window<"u"&&e.headers){const i=localStorage.getItem("g7_locale");i&&(e.headers["Accept-Language"]=i)}const s=og();if(s?.isEnabled()){const i=this.buildFullUrl(e),o=(e.method||"GET").toUpperCase(),d=s.trackRequest(i,o,{requestBody:e.data});e._devToolsRequestId=d}return e},e=>Promise.reject(e)),this.client.interceptors.response.use(e=>{const t=e.config,s=t._devToolsRequestId;if(s){const i=og();i?.isEnabled()&&i.completeRequest(s,e.status,e.data),t._devToolsRequestId=null}return e},async e=>{const t=e.config,s=t?.url||"",o=["/auth/","/layouts/"].some(d=>s.includes(d));if(e.response?.status===401&&!t?._retry&&!o){if(t._retry=!0,await qs.getInstance().refreshToken()){const h=this.getToken();return h&&(t.headers.Authorization=`Bearer ${h}`),t._devToolsRequestId=null,this.client(t)}return this.completeDevToolsRequest(t,e),this.removeToken(),this.config.onUnauthorized&&this.config.onUnauthorized(),Promise.reject(e)}return e.response?.status===401&&o?(this.completeDevToolsRequest(t,e),Promise.reject(e)):e.response?.status===403?(this.completeDevToolsRequest(t,e),this.callOnError(e),Promise.reject(e)):(this.completeDevToolsRequest(t,e),e.response&&this.callOnError(e),Promise.reject(e))})}async get(e,t){return(await this.client.get(e,t)).data}async post(e,t,s){return(await this.client.post(e,t,s)).data}async put(e,t,s){return(await this.client.put(e,t,s)).data}async patch(e,t,s){return(await this.client.patch(e,t,s)).data}async delete(e,t){return(await this.client.delete(e,t)).data}getInstance(){return this.client}setOnUnauthorized(e){this.config.onUnauthorized=e}setOnError(e){this.config.onError=e}completeDevToolsRequest(e,t){if(!e?._devToolsRequestId)return;const s=og();if(!s?.isEnabled())return;const i=e._devToolsRequestId;e._devToolsRequestId=null,t.response?s.completeRequest(i,t.response.status,t.response.data):t.request?s.failRequest(i,t.message||"Network error"):s.failRequest(i,t.message||"Request error")}buildFullUrl(e){let t=e.url||"";if(e.baseURL&&!t.startsWith("http")&&(t=`${e.baseURL}${t.startsWith("/")?"":"/"}${t}`),e.params&&typeof e.params=="object"){const s=e.params,i=[];for(const[o,d]of Object.entries(s))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&&(t+=(t.includes("?")?"&":"?")+i.join("&"))}return t}callOnError(e){if(!this.config.onError)return;const t={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(t)}catch(s){u7.error("Error in onError handler:",s)}}}let lg=null;function Bs(){return lg||(lg=new g7),lg}const wo=nt("AuthManager");function oi(r,e,t,s){try{window.G7Core?.devTools?.trackAuthEvent?.(r,e,t,s)}catch{}}const yc={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"}},Ts=class Ts{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",yc.admin),this.config.set("user",yc.user)}static getInstance(){return Ts.instance||(Ts.instance=new Ts),Ts.instance}on(e,t){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(t)}emit(e,...t){const s=this.eventHandlers.get(e);s&&s.forEach(i=>i(...t))}isAuthenticated(){return this.state.isAuthenticated}getUser(){return this.state.user}getAuthType(){return this.state.type}async checkAuth(e){const t=Bs();if(!t.getToken())return this.clearState(),!1;const i=this.config.get(e);if(!i)return wo.error(`Unknown auth type: ${e}`),!1;try{const o=await t.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(t){return wo.warn(`Preload auth failed for type ${e}:`,t),!1}}async login(e,t,s){const i=Bs();if(!this.config.get(e))throw new Error(`Unknown auth type: ${e}`);const d=e==="admin"?yc.admin.loginEndpoint:yc.user.loginEndpoint;try{const g=s?.headers?{headers:s.headers}:void 0,h=await i.post(d,t,g);if(h.success&&h.data){i.setToken(h.data.token);const f=h.data.user.language,p=localStorage.getItem(Ts.LOCALE_STORAGE_KEY),y=f&&f!==p;if(f)try{localStorage.setItem(Ts.LOCALE_STORAGE_KEY,f)}catch(x){wo.warn("Failed to save user language to localStorage:",x)}return this.state={isAuthenticated:!0,user:h.data.user,type:e},this.emit("login",this.state),this.emit("authStateChange",this.state),oi("login",!0,void 0,{userId:h.data.user.uuid,email:h.data.user.email,type:e}),y&&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,oi("login",!1,f.message,{type:e,status:g.response?.status}),f}}async logout(){const e=Bs(),t=this.state.type?this.config.get(this.state.type):null;try{t&&await e.post(t.logoutEndpoint)}catch(s){wo.warn("Logout API call failed:",s)}finally{e.removeToken();const s={...this.state};if(this.clearState(),this.emit("logout",s),this.emit("authStateChange",this.state),oi("logout",!0,void 0,{previousType:s.type}),t&&s.type){const i=window.location.pathname+window.location.search;window.location.href=this.getLoginRedirectUrl(s.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 t=this.config.get(e);if(!t)return!1;const s=Bs();try{const i=await s.post(t.refreshEndpoint);return i.success&&i.data?.token?(s.setToken(i.data.token),this.emit("tokenRefreshed"),oi("token-refresh",!0,void 0,{type:e}),!0):(oi("token-refresh",!1,"No token in response",{type:e}),!1)}catch(i){return wo.error("Token refresh failed:",i),oi("token-refresh",!1,i instanceof Error?i.message:"Unknown error",{type:e}),!1}}getLoginRedirectUrl(e,t,s){const i=this.config.get(e);if(!i)return"/login";const o=encodeURIComponent(t);let d=`${i.loginPath}?redirect=${o}`;return s&&(d+=`&reason=${encodeURIComponent(s)}`),d}updateConfig(e,t){if(t.loginPath!==void 0){const i=t.loginPath;if(!i.startsWith("/")||i.startsWith("//"))throw new Error(`AuthManager.updateConfig: loginPath must be a same-origin path starting with '/' (got: ${i})`)}const s=this.config.get(e);s&&this.config.set(e,{...s,...t})}getRedirectUrl(e){const s=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 s}getConfig(e){return this.config.get(e)}clearState(){this.state={isAuthenticated:!1,user:null,type:null}}static resetInstance(){Ts.instance=null}};H(Ts,"instance"),H(Ts,"LOCALE_STORAGE_KEY","g7_locale");let qs=Ts;const Bm={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}}"}}},ia={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,t){if(r.handler!=="showErrorPage"||r.params?.errorCode!==void 0)return r;const s=typeof e=="string"?parseInt(e,10):e,i=isNaN(s)?t:s;return i===void 0?r:{...r,params:{...r.params,errorCode:i}}}},Ss=nt("ErrorHandlingResolver"),Pa=class Pa{constructor(){H(this,"templateErrorHandling",null);H(this,"layoutErrorHandling",null);H(this,"executeAction",null)}static getInstance(){return Pa.instance||(Pa.instance=new Pa),Pa.instance}static resetInstance(){Pa.instance=null}setTemplateConfig(e){this.templateErrorHandling=e,Ss.log("Template config set:",e)}setLayoutConfig(e){this.layoutErrorHandling=e,Ss.log("Layout config set:",e)}setActionExecutor(e){this.executeAction=e}resolve(e,t={}){const{errorHandling:s,onError:i}=t;Ss.log("Resolving error:",e,{hasActionErrorHandling:!!s,hasActionOnError:!!i,hasLayoutConfig:!!this.layoutErrorHandling,hasTemplateConfig:!!this.templateErrorHandling});let o=ia.findHandler(s,e);if(o){const d=this.getMatchedKey(s,e);return{handler:ia.injectErrorCode(o,d,e),level:"action",matchedKey:d}}if(i){const d=ia.normalizeOnError(i);if(d.length>0)return{handler:d.length===1?d[0]:{handler:"sequence",actions:d},level:"action",matchedKey:"onError"}}if(o=ia.findHandler(this.layoutErrorHandling||void 0,e),o){const d=this.getMatchedKey(this.layoutErrorHandling,e);return{handler:ia.injectErrorCode(o,d,e),level:"layout",matchedKey:d}}if(o=ia.findHandler(this.templateErrorHandling||void 0,e),o){const d=this.getMatchedKey(this.templateErrorHandling,e);return{handler:ia.injectErrorCode(o,d,e),level:"template",matchedKey:d}}if(o=ia.findHandler(Bm,e),o){const d=this.getMatchedKey(Bm,e);return{handler:ia.injectErrorCode(o,d,e),level:"system",matchedKey:d}}return{handler:null,level:null,matchedKey:null}}async execute(e,t){if(!this.executeAction){Ss.error("Action executor is not set");return}Ss.log("Executing handler:",e.handler,{errorContext:t});try{return await this.executeAction(e,{error:t})}catch(s){throw Ss.error("Failed to execute handler:",s),s}}async resolveAndExecute(e,t,s={}){const i=this.resolve(e,s);if(Ss.log("Resolve result:",{errorCode:e,handler:i.handler?.handler,level:i.level,matchedKey:i.matchedKey}),!i.handler)return Ss.warn("No handler found for error:",e),{handled:!1};try{return{handled:!0,result:await this.execute(i.handler,t)}}catch(o){return Ss.error("Handler execution failed:",o),{handled:!1}}}getMatchedKey(e,t){return e[t]?t:e[String(t)]?String(t):"default"}clearLayoutConfig(){this.layoutErrorHandling=null,Ss.log("Layout config cleared")}clearAllConfig(){this.templateErrorHandling=null,this.layoutErrorHandling=null,Ss.log("All config cleared")}getConfigStatus(){return{hasTemplate:this.templateErrorHandling!==null,hasLayout:this.layoutErrorHandling!==null,hasExecutor:this.executeAction!==null}}};H(Pa,"instance",null);let cg=Pa;function Cs(){return cg.getInstance()}var dg={exports:{}},So={};/**
|
||
* @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 qm;function h7(){if(qm)return So;qm=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(s,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:s,key:d,ref:i!==void 0?i:null,props:o}}return So.Fragment=e,So.jsx=t,So.jsxs=t,So}var Gm;function f7(){return Gm||(Gm=1,dg.exports=h7()),dg.exports}var l=f7();const p7=sa({__proto__:null,default:aa(l)},[l]),ug=nt("ParentContextProvider"),Fm=j.createContext(null);let xc=null;function gg(){xc?(ug.log("[triggerModalParentUpdate] 모달 부모 컨텍스트 업데이트 트리거"),xc()):ug.warn("[triggerModalParentUpdate] Provider가 아직 마운트되지 않음")}const Vm=({children:r})=>{const[e,t]=j.useState(0),s=j.useRef(!0),i=j.useCallback(()=>{const d=window.__g7LayoutContextStack||[];return d[d.length-1]?.dataContext},[]);j.useEffect(()=>(s.current=!0,xc=()=>{s.current&&(t(d=>d+1),ug.log("[ParentContextProvider] 버전 업데이트됨"))},()=>{s.current=!1,xc=null}),[]);const o={version:e,getParentDataContext:i};return l.jsx(Fm.Provider,{value:o,children:r})};function m7(){return j.useContext(Fm)}const hg="g7.identity.redirectStash",bc=nt("IdentityGuardInterceptor");class cn{static setLauncher(e){this.launcher=e}static hasLauncher(){return this.launcher!==null}static resolveDeferred(e){const t=this.deferredResolver;if(!t){bc.warn("IdentityGuardInterceptor.resolveDeferred 호출됐지만 대기 중인 launcher 가 없습니다. 모달이 launcher 외부에서 열렸는지 확인하세요.");return}this.deferredResolver=null,t(e)}static createDeferred(){if(this.deferredResolver){const e=this.deferredResolver;this.deferredResolver=null,e({status:"cancelled"})}return new Promise(e=>{this.deferredResolver=e})}static isIdentityRequired(e,t){return e===428&&typeof t=="object"&&t!==null&&t.error_code==="identity_verification_required"}static async handle(e,t){const i=await(this.launcher??x7)(e.verification);if(i.status!=="verified")return null;const o=e.verification.return_request;if(!o)return null;const d=y7(o.url,i.token);return fetch(d,{method:o.method,headers:t?.headers??{Accept:"application/json","Content-Type":"application/json"},body:t?.body,credentials:t?.credentials??"same-origin"})}static redirectExternally(e){const t=e.redirect_url;if(!t)return bc.error("redirectExternally 호출 시 verification.redirect_url 이 없습니다. payload:",e),Promise.resolve({status:"failed",failureCode:"MISSING_REDIRECT_URL",reason:"verification.redirect_url is required for external_redirect flow"});if(typeof window<"u"){const s={return_url:window.location.href,payload:e,stashed_at:Date.now()};try{window.sessionStorage?.setItem(hg,JSON.stringify(s))}catch(i){bc.warn("sessionStorage 접근 실패 — stash 없이 redirect 합니다.",i)}window.location.href=t}return new Promise(()=>{})}static reset(){if(this.deferredResolver){const e=this.deferredResolver;this.deferredResolver=null;try{e({status:"cancelled"})}catch{}}this.launcher=null}}H(cn,"launcher",null),H(cn,"deferredResolver",null);function y7(r,e){if(!e)return r;try{const t=typeof window<"u"?window.location.origin:"http://localhost",s=new URL(r,t);return s.searchParams.set("verification_token",e),/^https?:\/\//i.test(r)?s.toString():`${s.pathname}${s.search}${s.hash}`}catch{const t=r.includes("?")?"&":"?";return`${r}${t}verification_token=${encodeURIComponent(e)}`}}const x7=async r=>{if(typeof window>"u")return{status:"cancelled"};if(r.render_hint==="external_redirect"||r.redirect_url)return cn.redirectExternally(r);const e=window.G7Core;if(!e?.dispatch)return console.error("[IdentityGuardInterceptor] defaultLauncher: G7Core 가 초기화되지 않아 본인인증 흐름을 시작할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};try{await e.dispatch({handler:"toast",params:{message:"본인 확인이 필요합니다.",variant:"warning"}})}catch{}const t=window.location.href,s={return_url:t,payload:r,stashed_at:Date.now()};try{window.sessionStorage?.setItem(hg,JSON.stringify(s))}catch{}const i=`/identity/challenge?return=${encodeURIComponent(t)}`;try{await e.dispatch({handler:"navigate",params:{path:i}})}catch(o){bc.warn("navigate 실패 — window.location 으로 폴백",o),window.location.href=i}return new Promise(()=>{})},U=nt("ActionDispatcher"),Km=new Set(["navigate","navigateBack","navigateForward","replaceUrl","refresh","logout"]),b7=new Set(["redirect"]);function Kn(){try{return window.G7Core?.devTools}catch{return}}class Gt extends Error{constructor(e,t,s){super(e),this.action=t,this.originalError=s,this.name="ActionError"}}const vi=class vi{constructor(e={},t,s){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);H(this,"intervals",new Map);this.bindingEngine=new An,this.translationEngine=t,this.translationContext=s,this.defaultContext=e,this.registerDefaultHandlers(),this.setupErrorHandling()}setGlobalHeaders(e){this.globalHeaders=e||[]}setNamedActions(e){this.namedActions=e||{};const t=Kn();t?.isEnabled?.()&&t.setNamedActionDefinitions?.(this.namedActions),U.log("[setNamedActions] registered:",Object.keys(this.namedActions))}getNamedActions(){return this.namedActions}setPreviewMode(e){this.previewMode=e,U.log("Preview mode:",e?"enabled":"disabled")}isPreviewMode(){return this.previewMode}static getPreviewSuppressedHandlers(){return Km}static getPreviewSuppressedLayoutFeatures(){return b7}resolveActionRef(e){if(!e.actionRef)return e;const t=this.namedActions[e.actionRef];if(!t)return U.warn(`[resolveActionRef] named action not found: "${e.actionRef}"`),e;const s=Kn();s?.isEnabled?.()&&s.trackNamedActionRef?.({actionRefName:e.actionRef,resolvedHandler:t.handler,timestamp:Date.now()});const{actionRef:i,type:o,key:d,event:g,...h}=e,f={...t,...Object.fromEntries(Object.entries(h).filter(([,p])=>p!==void 0)),type:o??t.type};return d!==void 0&&(f.key=d),g!==void 0&&(f.event=g),f}matchesPattern(e,t){if(t==="*")return!0;const s=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${s}$`).test(e)}getMatchingGlobalHeaders(e,t){const s={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([o,d])=>{const g=si(d,t,{skipCache:!0});g!=null&&g!==""&&(s[o]=String(g))});return s}setupErrorHandling(){if(this.errorHandlingSetup)return;Cs().setActionExecutor(async(t,s)=>{const i={type:"click",handler:t.handler,target:t.target,params:t.params,actions:t.actions},o={data:{...this.defaultContext.data,error:s.error}};return await this.dispatchAction(i,o)}),this.errorHandlingSetup=!0}registerDefaultHandlers(){this.registerHandler("refetchDataSource",async(t,s)=>{const i=t.params?.dataSourceId,o=t.params?.sync;if(!i){U.warn("refetchDataSource: dataSourceId is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.refetch){const d=window.G7Core?.state?.get?.()||{},g={...s.state?._global,...d},h=window.G7Core?.state?.getLocal?.()||{},f=s.data?._local||s.state||{},p={...h,...f},y=s.isolatedContext?.state;U.log("[refetchDataSource] localStateOverride:",p),await window.G7Core.dataSource.refetch(i,{...o?{sync:!0}:{},...g?{globalStateOverride:g}:{},...p?{localStateOverride:p}:{},...y?{isolatedStateOverride:y}:{}})}else U.warn("refetchDataSource: G7Core.dataSource.refetch is not available")}),this.registerHandler("appendDataSource",async(t,s)=>{const{dataSourceId:i,dataPath:o,newData:d}=t.params||{};if(!i){U.warn("appendDataSource: dataSourceId is required");return}if(d===void 0){U.warn("appendDataSource: newData is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.updateData){if(!Array.isArray(d)){U.warn("appendDataSource: newData must be an array, got:",typeof d,d);return}await window.G7Core.dataSource.updateData(i,o||null,d,"append")}else U.warn("appendDataSource: G7Core.dataSource.updateData is not available")}),this.registerHandler("updateDataSource",async(t,s)=>{const{dataSourceId:i,data:o,merge:d=!1}=t.params||{};if(!i){U.warn("updateDataSource: dataSourceId is required");return}if(o===void 0){U.warn("updateDataSource: data is required");return}typeof window<"u"&&window.G7Core?.dataSource?.set?(U.log(`[updateDataSource] Updating dataSource '${i}' with:`,o),window.G7Core.dataSource.set(i,o,{merge:d})):U.warn("updateDataSource: G7Core.dataSource.set is not available")}),this.registerHandler("scrollIntoView",async(t,s)=>{const{selector:i,behavior:o="smooth",block:d="nearest",inline:g="nearest",waitForElement:h=!1,timeout:f=2e3,delay:p=0,retryCount:y=0,retryInterval:x=50,scrollContainer:w}=t.params||{};if(!i){U.warn("scrollIntoView: selector is required");return}if(typeof window>"u"||typeof document>"u"){U.warn("scrollIntoView: window/document is not available");return}let v=null;if(h){if(v=await new Promise(S=>{const k=document.querySelector(i);if(k){S(k);return}const A=setTimeout(()=>{O.disconnect(),S(null)},f),O=new MutationObserver(()=>{const N=document.querySelector(i);N&&(clearTimeout(A),O.disconnect(),S(N))});O.observe(document.body,{childList:!0,subtree:!0})}),!v){U.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 S=0;for(;!v&&S<y;)await new Promise(k=>setTimeout(k,x)),v=document.querySelector(i),S++;if(!v){U.warn(`scrollIntoView: element not found for selector "${i}" after ${S+1} attempts`);return}}if(w){const S=document.querySelector(w);if(!S){U.warn(`scrollIntoView: container not found for selector "${w}"`);return}const k=v.getBoundingClientRect(),A=S.getBoundingClientRect(),O=k.top-A.top+S.scrollTop,N=O+k.height;let D;switch(d){case"start":D=O;break;case"center":D=O-S.clientHeight/2+k.height/2;break;case"end":D=N-S.clientHeight;break;case"nearest":default:const $=k.top<A.top,M=k.bottom>A.bottom;if($)D=O;else if(M)D=N-S.clientHeight;else return;break}S.scrollTo({top:Math.max(0,D),behavior:o});return}v.scrollIntoView({behavior:o,block:d,inline:g})}),this.registerHandler("reloadExtensions",async(t,s)=>{if(typeof window>"u"){U.warn("reloadExtensions: window is not available");return}const i=window.__templateApp;if(!i){U.warn("reloadExtensions: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState()}catch(g){throw U.error("reloadExtensions: reloadExtensionState failed",g),g}else U.warn("reloadExtensions: TemplateApp.reloadExtensionState unavailable");const{moduleInfo:o,pluginInfo:d}=t.params||{};if(o)try{await this.executeAction({handler:"reloadModuleHandlers",params:t.params},s)}catch(g){U.error("reloadExtensions: reloadModuleHandlers failed",g)}if(d)try{await this.executeAction({handler:"reloadPluginHandlers",params:t.params},s)}catch(g){U.error("reloadExtensions: reloadPluginHandlers failed",g)}U.log("reloadExtensions: done")}),this.registerHandler("reloadRoutes",async(t,s)=>{if(typeof window>"u"){U.warn("reloadRoutes: window is not available");return}const i=window.__templateApp;if(!i){U.warn("reloadRoutes: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState(),U.log("reloadRoutes: delegated to reloadExtensionState")}catch(o){throw U.error("reloadRoutes: Failed to reload routes",o),o}else{const o=i.getRouter?.();o&&(await o.loadRoutes(),U.log("reloadRoutes: Routes reloaded (legacy fallback)"))}}),this.registerHandler("refresh",async(t,s)=>{if(typeof window>"u"){U.warn("refresh: window is not available");return}const i=Number(t.params?.delayMs??0);i>0&&await new Promise(o=>setTimeout(o,i)),window.location.reload()}),this.registerHandler("remount",async(t,s)=>{const{componentId:i}=t.params||{};if(!i){U.warn("remount: componentId parameter is required");return}if(!this.globalStateUpdater){U.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}}),U.log(`remount: ${i} key incremented to ${h+1}`)}),this.registerHandler("reloadTranslations",async(t,s)=>{if(typeof window>"u"){U.warn("reloadTranslations: window is not available");return}const i=window.__templateApp;if(!i){U.warn("reloadTranslations: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState(),U.log("reloadTranslations: delegated to reloadExtensionState")}catch(o){throw U.error("reloadTranslations: Failed to reload translations",o),o}}),this.registerHandler("reloadModuleHandlers",async(t,s)=>{if(typeof window>"u"){U.warn("reloadModuleHandlers: window is not available");return}const{moduleInfo:i,action:o}=t.params||{};if(!i){U.warn("reloadModuleHandlers: moduleInfo is required");return}const d=i.data||i;if(!d.identifier){U.warn("reloadModuleHandlers: moduleInfo with identifier is required");return}if(!o||o!=="add"&&o!=="remove"){U.warn('reloadModuleHandlers: action must be "add" or "remove"');return}const g=window.G7Config;if(!g){U.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,U.log(`reloadModuleHandlers: Added assets for ${h}`),d.assets.js)){const f=d.assets.js,p=`module-${h}`;if(document.getElementById(p)){U.warn(`reloadModuleHandlers: Script ${p} already loaded`);return}const y=document.createElement("script");if(y.id=p,y.src=f,y.async=!0,await new Promise((x,w)=>{y.onload=()=>{U.log(`reloadModuleHandlers: Script loaded successfully for ${h}`),x()},y.onerror=()=>{U.error(`reloadModuleHandlers: Failed to load script for ${h}`),w(new Error(`Failed to load module script: ${f}`))},document.head.appendChild(y)}),d.assets.css){const x=d.assets.css,w=`module-css-${h}`;if(!document.getElementById(w)){const v=document.createElement("link");v.id=w,v.rel="stylesheet",v.href=x,document.head.appendChild(v),U.log(`reloadModuleHandlers: CSS loaded for ${h}`)}}}}else if(o==="remove"){g.moduleAssets&&g.moduleAssets[h]&&(delete g.moduleAssets[h],U.log(`reloadModuleHandlers: Removed assets for ${h}`));const f=`module-${h}`,p=document.getElementById(f);p&&(p.remove(),U.log(`reloadModuleHandlers: Removed script for ${h}`));const y=`module-css-${h}`,x=document.getElementById(y);x&&(x.remove(),U.log(`reloadModuleHandlers: Removed CSS for ${h}`))}}catch(f){throw U.error(`reloadModuleHandlers: Failed to ${o} module assets`,f),f}}),this.registerHandler("reloadPluginHandlers",async(t,s)=>{if(typeof window>"u"){U.warn("reloadPluginHandlers: window is not available");return}const{pluginInfo:i,action:o}=t.params||{};if(!i){U.warn("reloadPluginHandlers: pluginInfo is required");return}const d=i.data||i;if(!d.identifier){U.warn("reloadPluginHandlers: pluginInfo with identifier is required");return}if(!o||o!=="add"&&o!=="remove"){U.warn('reloadPluginHandlers: action must be "add" or "remove"');return}const g=window.G7Config;if(!g){U.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,U.log(`reloadPluginHandlers: Added assets for ${h}`),d.assets.js)){const f=d.assets.js,p=`plugin-${h}`;if(document.getElementById(p)){U.warn(`reloadPluginHandlers: Script ${p} already loaded`);return}const y=document.createElement("script");if(y.id=p,y.src=f,y.async=!0,await new Promise((x,w)=>{y.onload=()=>{U.log(`reloadPluginHandlers: Script loaded successfully for ${h}`),x()},y.onerror=()=>{U.error(`reloadPluginHandlers: Failed to load script for ${h}`),w(new Error(`Failed to load plugin script: ${f}`))},document.head.appendChild(y)}),d.assets.css){const x=d.assets.css,w=`plugin-css-${h}`;if(!document.getElementById(w)){const v=document.createElement("link");v.id=w,v.rel="stylesheet",v.href=x,document.head.appendChild(v),U.log(`reloadPluginHandlers: CSS loaded for ${h}`)}}}}else if(o==="remove"){g.pluginAssets&&g.pluginAssets[h]&&(delete g.pluginAssets[h],U.log(`reloadPluginHandlers: Removed assets for ${h}`));const f=`plugin-${h}`,p=document.getElementById(f);p&&(p.remove(),U.log(`reloadPluginHandlers: Removed script for ${h}`));const y=`plugin-css-${h}`,x=document.getElementById(y);x&&(x.remove(),U.log(`reloadPluginHandlers: Removed CSS for ${h}`))}}catch(f){throw U.error(`reloadPluginHandlers: Failed to ${o} plugin assets`,f),f}});let e=!1;this.registerHandler("showErrorPage",async(t,s)=>{if(e){U.log("showErrorPage: Already active, skipping duplicate call");return}if(e=!0,typeof window>"u"){e=!1,U.warn("showErrorPage: window is not available");return}const i=window.__templateApp;if(!i){e=!1,U.warn("showErrorPage: TemplateApp not initialized");return}const o=i.getErrorPageHandler?.();if(!o){e=!1,U.warn("showErrorPage: ErrorPageHandler not available");return}const d=t.params?.errorCode||500,g=t.params?.target||"content";let h=t.params?.containerId;h||(h=g==="full"?"app":"main_content"),U.log("showErrorPage:",{errorCode:d,target:g,containerId:h});const f=(p,y=6e4)=>new Promise((x,w)=>{const v=document.getElementById(p);if(v){x(v);return}U.log(`showErrorPage: Waiting for container #${p}...`);let S;const k=new MutationObserver((A,O)=>{const N=document.getElementById(p);N&&(U.log(`showErrorPage: Container #${p} found`),O.disconnect(),clearTimeout(S),x(N))});k.observe(document.body,{childList:!0,subtree:!0}),S=setTimeout(()=>{k.disconnect(),w(new Error(`Container #${p} not found within ${y}ms`))},y)});try{await f(h);const p=Cs(),y=p.layoutErrorHandling;p.clearLayoutConfig();try{await o.renderError(d,h)||U.warn(`showErrorPage: Failed to render error page for code ${d}`)}finally{p.setLayoutConfig(y)}}catch(p){throw U.error("showErrorPage: Error rendering error page:",p),p}finally{e=!1}}),this.registerHandler("emitEvent",async(t,s)=>{const i=t.params?.event,o=t.params?.data;if(!i){U.warn("emitEvent: event parameter is required");return}if(typeof window>"u"){U.warn("emitEvent: window is not available");return}const d=window.G7Core;if(!d?.componentEvent?.emit){U.warn("emitEvent: G7Core.componentEvent is not available");return}try{U.log(`emitEvent: Emitting "${i}"`,o);const g={...o,_context:{data:s.data,state:s.state}},h=await d.componentEvent.emit(i,g);if(!h||h.length===0?U.warn(`emitEvent: No listeners found for "${i}"`):U.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(U.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(t,s)=>{const{productId:i,field:o,value:d}=t.params||{};if(!i||!o){U.warn("updateProductField: productId and field are required");return}if(typeof window>"u"){U.warn("updateProductField: window is not available");return}const g=window.G7Core;if(!g?.state?.get||!this.globalStateUpdater){U.warn("updateProductField: G7Core.state or globalStateUpdater is not available");return}try{const h=g.state.get()||{},p=(h.products?.data?.data||[]).map(x=>x.id===i?{...x,[o]:d,_modified:!0}:x),y=new Set(h._local?.modifiedProductIds||[]);y.add(i),this.globalStateUpdater({products:{...h.products,data:{...h.products?.data,data:p}},_local:{...h._local,modifiedProductIds:Array.from(y)}}),U.log(`updateProductField: Updated product ${i}, field: ${o}, value:`,d)}catch(h){throw U.error("updateProductField: Error updating product field",h),h}}),this.registerHandler("updateOptionField",async(t,s)=>{const{productId:i,optionId:o,field:d,value:g}=t.params||{};if(!i||!o||!d){U.warn("updateOptionField: productId, optionId and field are required");return}if(typeof window>"u"){U.warn("updateOptionField: window is not available");return}const h=window.G7Core;if(!h?.state?.get||!this.globalStateUpdater){U.warn("updateOptionField: G7Core.state or globalStateUpdater is not available");return}try{const f=h.state.get()||{},y=(f.products?.data?.data||[]).map(w=>{if(w.id===i&&w.options){const v=w.options.map(S=>S.id===o?{...S,[d]:g,_modified:!0}:S);return{...w,options:v,_modified:!0}}return w}),x=new Set(f._local?.modifiedProductIds||[]);x.add(i),this.globalStateUpdater({products:{...f.products,data:{...f.products?.data,data:y}},_local:{...f._local,modifiedProductIds:Array.from(x)}}),U.log(`updateOptionField: Updated product ${i} option ${o}, field: ${d}, value:`,g)}catch(f){throw U.error("updateOptionField: Error updating option field",f),f}}),this.registerHandler("setLocale",async(t,s)=>{const i=t.target;if(!i||typeof i!="string"){U.warn("setLocale: Invalid locale:",i);return}const o=window.__templateApp;if(o&&typeof o.changeLocale=="function")try{await o.changeLocale(i),U.log("setLocale: Locale changed to",i)}catch(d){U.error("setLocale: Failed to change locale:",d),window.location.reload()}else{U.warn("setLocale: TemplateApp not found, falling back to page reload");try{localStorage.setItem("g7_locale",i)}catch{}window.location.reload()}}),this.registerHandler("suppress",async()=>{U.log("suppress: Error intentionally suppressed")}),this.registerBuiltInHandlerMetadata()}registerBuiltInHandlerMetadata(){const e=Kn();if(!e?.isEnabled())return;const t=[{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 s of t)e.trackHandlerRegistration(s.name,"built-in",s.description)}createHandler(e,t,s){U.log("createHandler called for:",e.handler,e.type);const i=window.__g7DevTools,o=Date.now(),d=s?.state?{...s.state}:null,g=`handler_${e.handler}_${o}`;return async h=>{if(U.log("Handler invoked for:",e.handler,"event:",h.type),i?.isEnabled?.()&&d){const p=window.G7Core?.state?.getLocal?.()??s?.state??{},y=Date.now()-o;for(const x of Object.keys(d)){const w=d[x],v=p[x];w!==v&&y>100&&(i.trackStaleClosureWarning?.({type:"event-handler-stale",location:`createHandler(${e.handler})`,capturedPath:`_local.${x}`,capturedValue:w,capturedAt:o,currentValue:v,actionId:g,stackTrace:new Error().stack}),U.warn(`[Stale Closure] _local.${x} changed after handler creation:`,`captured="${w}" → current="${v}" (${y}ms ago)`))}}try{h.type!=="change"&&h.preventDefault();let f={};if(h.type==="submit"&&h.target instanceof HTMLFormElement){const x=h.target;new FormData(x).forEach((v,S)=>{f[S]=v})}const p={...this.defaultContext,data:{...t,form:f,_local:s?.state||{},$event:h},event:h,...s&&{state:s.state,setState:s.setState},isolatedContext:s?.isolatedContext};if(e.confirm){let x=this.resolveValue(e.confirm,p.data);if(this.translationEngine&&this.translationContext&&x.startsWith("$t:")&&(x=this.translationEngine.resolveTranslations(x,this.translationContext,p.data)),!confirm(x))return}const y=window.__g7ActionContext;window.__g7ActionContext={...s,data:p.data};try{await this.executeAction(e,p)}finally{window.__g7ActionContext=y}}catch(f){if(U.error("Action execution failed:",f),e.onError){const p=f instanceof Gt&&f.originalError?f.originalError:f,y={...this.defaultContext,data:{...t,error:p,_local:s?.state||{},$event:h},event:h,...s&&{state:s.state,setState:s.setState}},x=Array.isArray(e.onError)?e.onError:[e.onError];for(const w of x)await this.executeAction(w,y)}}}}generateActionId(e,t){const s=e.handler,i=t||"no-target",o=Date.now(),d=Math.random().toString(36).substring(2,9);return`${s}_${i.replace(/[^a-zA-Z0-9]/g,"_")}_${o}_${d}`}async executeAction(e,t){e=this.resolveActionRef(e);const s=Kn(),i=s?.isEnabled()?`action_${Date.now()}_${Math.random().toString(36).substring(2,11)}`:void 0,o=performance.now();let d;if(i&&s&&s.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),context:this.sanitizeForDevTools({hasState:!!t.state,hasSetState:!!t.setState,dataKeys:t.data?Object.keys(t.data):[]}),startTime:o,status:"started"}),e.if!==void 0)try{const h=this.resolveValue(e.if,t.data),f=h===!0||h==="true"||h&&h!=="false"&&h!=="0"&&h!==!1;if(U.log("[executeAction] if condition result:",e.handler,f),!f)return i&&s&&s.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 U.error("[executeAction] if condition error:",e.handler,h),i&&s&&s.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,t.data);i&&(d=this.sanitizeForDevTools(h));const f=e.target?this.resolveValue(e.target,t.data):void 0;if(e.handler==="apiCall"&&t.setState){g=this.generateActionId(e,f);const y=t.state?.loadingActions||{};t.setState({loadingActions:{...y,[g]:!0}})}if(this.previewMode&&Km.has(e.handler))return U.warn(`Preview mode: "${e.handler}" suppressed`,f||h),i&&s&&s.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"ensureIdentityVerified":p=await this.handleEnsureIdentityVerified(h);break;case"resolveIdentityChallenge":p=this.handleResolveIdentityChallenge(h);break;case"navigate":const y=h.path||f;p=await this.handleNavigate(y,h,t);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&&s?.isEnabled()&&i){const w=window.G7Core,v={};if(w?.state?.get){const S=w.state.get();v._global=S}t.state&&(v._local=t.state),s.registerStateCaptureForHandler?.(i,["_global","_local"],v)}const x=e.auth_mode??(e.auth_required?"required":"none");p=await this.handleApiCall(f,h,t,x);break;case"login":p=await this.handleLogin(f,h,t);break;case"logout":p=await this.handleLogout(f,t);break;case"setState":U.log("[executeAction] setState resolvedParams:",h),p=await this.handleSetState(e.render!==void 0?{...h,__render:e.render}:h,t);break;case"setError":p=await this.handleSetError(f,h,t);break;case"openModal":p=await this.handleOpenModal(f,t);break;case"closeModal":p=await this.handleCloseModal(t);break;case"showAlert":p=await this.handleShowAlert(f,t);break;case"toast":p=await this.handleToast(h,t);break;case"switch":p=await this.handleSwitch(e,t);break;case"conditions":p=await this.handleConditions(e,t);break;case"sequence":p=await this.handleSequence(e,t);break;case"parallel":p=await this.handleParallel(e,t);break;case"startInterval":p=this.handleStartInterval(h,t);break;case"stopInterval":p=this.handleStopInterval(h);break;case"loadScript":p=await this.handleLoadScript(h,e,t);break;case"callExternal":p=await this.handleCallExternal(h,e,t);break;case"callExternalEmbed":p=await this.handleCallExternalEmbed(h,e,t);break;case"saveToLocalStorage":p=await this.handleSaveToLocalStorage(h,t);break;case"loadFromLocalStorage":p=await this.handleLoadFromLocalStorage(h,t);break;default:p=await this.handleCustomAction({...e,target:f,params:h},t);break}if(e.resultTo&&p!==void 0){const{target:y,key:x,merge:w}=e.resultTo,v=this.resolveValue(x,t.data),S=w==="replace"?"replace":w==="shallow"?"shallow":"deep";if(y==="_local"&&t.setState){const k=this.buildNestedUpdate(v,p),A=S!=="deep"?{...k,__mergeMode:S}:k;t.setState(A),U.log(`[resultTo] Saved to _local.${v} (merge=${S}):`,p)}else if(y==="_local"&&this.globalStateUpdater){const O=(window.G7Core?.state?.get()||{})._local||{},N=this.buildNestedUpdate(v,p);let D;S==="replace"?D=N:S==="shallow"?D={...O,...N}:D=this.deepMergeWithState(N,O),this.globalStateUpdater({_local:D}),U.log(`[resultTo] Saved to _local.${v} via globalStateUpdater (merge=${S}):`,p)}else if(y==="_global"&&this.globalStateUpdater){const k=this.buildNestedUpdate(v,p);this.globalStateUpdater(k),U.log(`[resultTo] Saved to _global.${v}:`,p)}else if(y==="_isolated"&&t.isolatedContext){const k=this.buildNestedUpdate(v,p);t.isolatedContext.mergeState(k,S),U.log(`[resultTo] Saved to _isolated.${v} (merge=${S}):`,p)}else U.warn(`[resultTo] Cannot save result: target=${y}, setState=${!!t.setState}, globalStateUpdater=${!!this.globalStateUpdater}, isolatedContext=${!!t.isolatedContext}`)}if(e.onSuccess){if(s?.isEnabled()&&i&&e.handler==="apiCall"){const w=window.G7Core,v={};w?.state?.get&&(v._global=w.state.get()),t.state&&(v._local=t.state),s.detectStaleClosure?.(i,`${e.handler} → onSuccess`,v,"callback-state-capture",i)}const y={...t,data:{...t.data,result:p,response:p}},x=Array.isArray(e.onSuccess)?e.onSuccess:[e.onSuccess];x.length>1?await this.handleSequence({handler:"sequence",type:"click",actions:x},y):x.length===1&&await this.executeAction(x[0],y)}return i&&s&&s.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||{},y=p.data||{},x=f.originalError?.status||p.status||500,w=y.message||f.message,v={status:x,message:w,errors:y.errors||p.errors,data:y,statusText:f.originalError?.statusText},k=Cs().resolve(x,{errorHandling:e.errorHandling,onError:e.onError});if(k.handler){if(s?.isEnabled()&&i&&e.handler==="apiCall"){const O=window.G7Core,N={};O?.state?.get&&(N._global=O.state.get()),t.state&&(N._local=t.state),s.detectStaleClosure?.(i,`${e.handler} → onError`,N,"callback-state-capture",i)}const A={...t,data:{...t.data,error:v}};try{const O={type:"click",handler:k.handler.handler,target:k.handler.target,params:k.handler.params,actions:k.handler.actions};return await this.executeAction(O,A),{success:!1,error:f}}catch(O){return U.error("Error executing error handler:",O),{success:!1,error:f}}}throw i&&s&&s.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"&&t.setState&&g){const h=t.state?.loadingActions||{},{[g]:f,...p}=h;t.setState({loadingActions:p})}}}async handleNavigate(e,t,s){let i=e;if(t.query)if(t.mergeQuery===!0)i=this.buildMergedQueryPath(e,t.query);else{const d=new URLSearchParams;for(const[h,f]of Object.entries(t.query))if(f!=null&&f!=="")if(Array.isArray(f)){const p=h.endsWith("[]")?h:`${h}[]`;for(const y of f)y!=null&&y!==""&&d.append(p,String(y))}else d.set(h,String(f));const g=d.toString();g&&(i=`${e}?${g}`)}if(U.log("handleNavigate:",{target:e,params:t,finalPath:i,replace:t.replace,windowLocationSearch:window.location.search}),t.replace===!0){const d=window.G7Core;if(d?.updateQueryParams){const g=typeof t.transition_overlay_target=="string"?t.transition_overlay_target:void 0;await d.updateQueryParams(i,g?{transitionOverlayTarget:g}:void 0),U.log("handleNavigate: Used updateQueryParams for replace mode",g?{transitionOverlayTarget:g}:void 0),this.applyScrollOption(t.scroll,t.scrollBehavior,"top");return}U.warn("handleNavigate: G7Core.updateQueryParams not available, falling back to React Router")}const o=this.resolveNavigateFallbackAction(i,t);if(o){U.warn(`handleNavigate: No route matched, falling back to "${o.handler}"`),await this.dispatchAction({type:"click",handler:o.handler,params:o.params},s),this.applyScrollOption(t.scroll,t.scrollBehavior,"top");return}if(!s.navigate)throw new Gt("Navigate function is not provided in context");s.navigate(i,{replace:t.replace===!0}),this.applyScrollOption(t.scroll,t.scrollBehavior,"top")}resolveNavigateFallbackAction(e,t){const s=t.fallback;if(s===!1||t.replace===!0)return null;const o=window.__templateApp?.getRouter?.();if(!o||typeof o.match!="function"||typeof o.getRoutes=="function"&&o.getRoutes().length===0)return null;const d=e.split("?")[0];return o.match(d)?null:this.resolveNavigateFallback(s,e,t)}resolveNavigateFallback(e,t,s){return e==null?{handler:"openWindow",params:{path:t,target:"_blank"}}:typeof e=="string"?{handler:e,params:{path:t}}:typeof e=="object"&&typeof e.handler=="string"?{handler:e.handler,params:{path:t,...e.params||{}}}:(U.warn("resolveNavigateFallback: unrecognized fallback option, using openWindow",e),{handler:"openWindow",params:{path:t,target:"_blank"}})}applyScrollOption(e,t,s){const i=e===void 0?s:e;if(i==="preserve")return;const o=t==="smooth"?"smooth":"instant",d=y=>{if(typeof y!="object"||y===null)return!1;const x=y;return"container"in x||"to"in x||"block"in x||"offset"in x},g=(y,x,w=0)=>{y===window?window.scrollTo({top:x,left:w,behavior:o}):y.scrollTo({top:x,left:w,behavior:o})},h=(y,x,w,v)=>{if(x===window){y.scrollIntoView({behavior:o,block:w}),v&&window.scrollBy({top:-v,left:0,behavior:o});return}const S=x,k=y.getBoundingClientRect(),A=S.getBoundingClientRect(),O=S.scrollTop+(k.top-A.top);let N;w==="center"?N=O-(S.clientHeight-y.clientHeight)/2:w==="end"?N=O-(S.clientHeight-y.clientHeight):N=O,N-=v,S.scrollTo({top:Math.max(0,N),left:0,behavior:o})},f=()=>{window.scrollTo({top:0,left:0,behavior:o});const y=document.getElementById("app")??document.body;if(!y)return;y.querySelectorAll("*").forEach(w=>{if(w.scrollTop===0&&w.scrollLeft===0)return;const v=window.getComputedStyle(w),S=v.overflowY,k=v.overflowX;(S==="auto"||S==="scroll"||k==="auto"||k==="scroll")&&w.scrollTo({top:0,left:0,behavior:o})})},p=()=>{try{if(d(i)){const y=i,x=y.block??"start",w=typeof y.offset=="number"?y.offset:0;let v=window;if(typeof y.container=="string"&&y.container.length>0){const k=document.querySelector(y.container);if(!k){U.warn(`applyScrollOption: container not found: ${y.container}`);return}v=k}const S=y.to??"top";if(S==="top"){v===window?f():g(v,0);return}if(typeof S=="number"){g(v,S-w);return}if(typeof S=="object"&&S!==null&&("x"in S||"y"in S)){const{x:k=0,y:A=0}=S;g(v,A-w,k);return}if(typeof S=="string"&&(S.startsWith("#")||S.startsWith("."))){const k=document.querySelector(S);k?h(k,v,x,w):U.warn(`applyScrollOption: target element not found: ${S}`);return}U.warn('applyScrollOption: invalid "to" value in extended form',S);return}if(i==="top"){f();return}if(typeof i=="number"){window.scrollTo({top:i,left:0,behavior:o});return}if(typeof i=="object"&&i!==null&&("x"in i||"y"in i)){const{x:y=0,y:x=0}=i;window.scrollTo({top:x,left:y,behavior:o});return}if(typeof i=="string"&&(i.startsWith("#")||i.startsWith("."))){const y=document.querySelector(i);y&&y.scrollIntoView({behavior:o,block:"start"});return}}catch(y){U.warn("applyScrollOption: failed to apply scroll",y)}};typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(p):p()}async handleOpenWindow(e,t){let s=e;if(t.query){const i=new URLSearchParams;for(const[d,g]of Object.entries(t.query))g!=null&&g!==""&&i.set(d,String(g));const o=i.toString();o&&(s=`${e}?${o}`)}U.log("handleOpenWindow:",{target:e,params:t,finalPath:s}),window.open(s,"_blank")}async handleNavigateBack(){U.log("handleNavigateBack"),window.history.back()}async handleNavigateForward(){U.log("handleNavigateForward"),window.history.forward()}async handleReplaceUrl(e,t){let s=e;if(t.query)if(t.mergeQuery===!0)s=this.buildMergedQueryPath(e,t.query);else{const i=new URLSearchParams;for(const[d,g]of Object.entries(t.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&&(s=`${e}?${o}`)}U.log("handleReplaceUrl:",{target:e,params:t,finalPath:s}),window.history.replaceState(null,"",s),this.applyScrollOption(t.scroll,t.scrollBehavior,"preserve")}buildMergedQueryPath(e,t){const s=new URLSearchParams(window.location.search);for(const[d,g]of Object.entries(t))if(g==null||g==="")s.delete(d);else if(Array.isArray(g)){const h=d.endsWith("[]")?d:`${d}[]`;s.delete(d),s.delete(h);for(const f of g)f!=null&&f!==""&&s.append(h,String(f))}else s.set(d,String(g));const i=s.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 s=`; ${document.cookie}`.split("; XSRF-TOKEN=");if(s.length===2){const i=s.pop()?.split(";").shift();return i?decodeURIComponent(i):null}return null}buildQueryString(e){const t=new URLSearchParams;for(const[s,i]of Object.entries(e))if(!(i==null||i===""))if(Array.isArray(i))for(const o of i)o!=null&&o!==""&&t.append(`${s}[]`,String(o));else typeof i=="object"?t.append(s,JSON.stringify(i)):t.append(s,String(i));return t.toString()}async handleEnsureIdentityVerified(e){const t=typeof e.purpose=="string"?e.purpose:"sensitive_action";return await cn.handle({success:!1,error_code:"identity_verification_required",message:"",verification:{policy_key:e.policy_key??"",purpose:t,provider_id:e.provider_id??null,render_hint:e.render_hint??null,return_request:null}})!==null}handleResolveIdentityChallenge(e){const t=typeof e.result=="string"?e.result:"cancelled";let s;switch(t){case"verified":{const i=typeof e.token=="string"?e.token:"";if(!i){U.warn("resolveIdentityChallenge: result=verified 인데 token 이 비어있습니다. failed 로 강등합니다."),s={status:"failed",failureCode:"MISSING_TOKEN"};break}s={status:"verified",token:i,providerData:e.providerData&&typeof e.providerData=="object"?e.providerData:void 0};break}case"pending":{const i=typeof e.pollUrl=="string"?e.pollUrl:"",o=typeof e.expiresAt=="string"?e.expiresAt:"";if(!i||!o){U.warn("resolveIdentityChallenge: result=pending 인데 pollUrl/expiresAt 누락 — failed 로 강등합니다."),s={status:"failed",failureCode:"MALFORMED_PENDING"};break}s={status:"pending",pollUrl:i,pollIntervalMs:typeof e.pollIntervalMs=="number"?e.pollIntervalMs:void 0,expiresAt:o};break}case"failed":s={status:"failed",failureCode:typeof e.failureCode=="string"?e.failureCode:"UNKNOWN",reason:typeof e.reason=="string"?e.reason:void 0};break;case"cancelled":default:s={status:"cancelled"};break}return cn.resolveDeferred(s),!0}async handleApiCall(e,t,s,i="none"){const{method:o="GET",body:d,headers:g,contentType:h}=t;o!=="GET"&&o!=="HEAD"&&await this.ensureCsrfToken();const f=this.getCsrfTokenFromCookie();let p={};if(i==="required"||i==="optional"){const z=Bs().getToken();z&&(p={Authorization:`Bearer ${z}`})}let y=e;const x=t.query||(o==="GET"?d:null);if(x&&typeof x=="object"){const M=this.buildQueryString(x);if(M){const z=e.includes("?")?"&":"?";y=`${e}${z}${M}`}}const w=window.G7Core?.state?.getGlobal?.()||s.state?._global||{},v=window.G7Core?.state?.getLocal?.()||s.state?._local||{},S={_global:w,_local:v},k=this.getMatchingGlobalHeaders(e,S),A={};if(typeof window<"u"){const M=localStorage.getItem("g7_locale");M&&(A["Accept-Language"]=M)}const O=h==="multipart/form-data",N={method:o,headers:{...O?{}:{"Content-Type":"application/json"},Accept:"application/json",...A,...f&&{"X-XSRF-TOKEN":f},...p,...k,...g},credentials:"include"};if(d&&o!=="GET")if(O){const M=new FormData;for(const[z,K]of Object.entries(d))K instanceof File||K instanceof Blob?M.append(z,K):K!=null&&M.append(z,typeof K=="object"?JSON.stringify(K):String(K));N.body=M}else N.body=JSON.stringify(d);const D=Kn();let $=null;D?.isEnabled()&&($=D.trackRequest(y,o));try{let M=await fetch(y,N),z;try{z=await M.json()}catch{z=null}if(cn.isIdentityRequired(M.status,z)){const K=await cn.handle(z,{body:N.body,headers:N.headers,credentials:N.credentials});if(K){M=K;try{z=await M.json()}catch{z=null}}}if($&&D?.isEnabled()&&(D.completeRequest($,M.status,z),$=null),!M.ok){const K=z||{},ye=new Error(K.message||`API call failed: ${M.statusText}`);throw ye.response=K,ye.status=M.status,ye.statusText=M.statusText,new Gt(K.message||`API call failed: ${M.statusText}`,void 0,ye)}return z}catch(M){throw $&&D?.isEnabled()&&D.failRequest($,M instanceof Error?M.message:String(M)),M}}async handleLogin(e,t,s){const{body:i}=t;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?.()||s.state?._global||{},h=window.G7Core?.state?.getLocal?.()||s.state?._local||{},f={_global:g,_local:h},p=this.getMatchingGlobalHeaders(d,f),y=qs.getInstance();try{const x=Object.keys(p).length>0?{headers:p}:void 0;return{user:await y.login(o,{email:i.email,password:i.password},x)}}catch(x){const w=x.message||"Login failed",v=new Error(w);throw v.response=x.response?.data||{},v.status=x.status||x.response?.status||500,new Gt(w,void 0,v)}}async handleLogout(e,t){await qs.getInstance().logout()}async handleSetState(e,t){U.log("[handleSetState] START, params:",e);const{target:s="component",scope:i,merge:o,__render:d,...g}=e,h=Kn(),f=window.G7Core;if(typeof s=="string"&&(s.startsWith("$parent.")||s.startsWith("$root.")))return this.handleParentScopeSetState(s,g,o,t);const p=t.state&&Object.keys(t.state).length>0?t.state:f?.state?.get()||{},y=s==="global"?"_global":s.startsWith("_local.")?s:"_local",x=y==="_global"?p._global:y.startsWith("_local.")?this.getNestedProperty(p._local||{},y.slice(7)):p._local,w=h?.isEnabled()?h.startStateChange(y,x,g,{actionId:t.actionId,handlerType:"setState",source:`target=${s}`}):void 0,v=o==="replace"?"replace":o==="shallow"?"shallow":"deep",S=v!=="deep"?{...g,__mergeMode:v,...w?{__setStateId:w}:{}}:{...g,...w?{__setStateId:w}:{}};if(s==="global"){if(!this.globalStateUpdater){U.warn("Global state updater is not set"),w&&h&&h.completeStateChange(w);return}const k=f?.state?.get()||{},{__setStateId:A,__mergeMode:O,...N}=S,D=v==="deep"?this.deepMergeWithState(N,k):N,$={...D,...w?{__setStateId:w}:{},...v!=="deep"?{__mergeMode:v}:{}};return U.log("setState global:",$),this.globalStateUpdater($,{render:d}),w&&h&&setTimeout(()=>h.completeStateChange(w),0),{__target:"global",...v!=="deep"?{__mergeMode:v}:{},...D}}else if(s==="isolated"){const k=t.isolatedContext;if(k){const{__mergeMode:A,__setStateId:O,...N}=S;return k.mergeState(N,v),U.log("[handleSetState] isolated state updated:",N,"mergeMode:",v),w&&h&&setTimeout(()=>h.completeStateChange(w),0),{__target:"isolated",...N}}else if(U.warn('[handleSetState] isolated target used but no IsolatedStateContext found. Make sure the component has "isolatedState" attribute. Falling back to local state.'),t.setState){const O=window.__g7PendingLocalState||t.state||{},N=v==="deep"?this.deepMergeWithState(S,O):S;return t.setState(N),w&&h&&setTimeout(()=>h.completeStateChange(w),0),N}else throw w&&h&&h.completeStateChange(w),new Gt("isolated target used but no IsolatedStateContext found and no setState function in context")}else if(s==="local"||s==="component"||s==="_local"){if(i==="parent"||i==="root"){const A=window.__g7LayoutContextStack||[];if(A.length>0){const O=i==="parent"?A[A.length-1]:A[0];if(O?.setState){const{__mergeMode:N,__setStateId:D,...$}=S,M=v==="deep"?this.deepMergeWithState($,O.state||{}):$;return U.log(`[handleSetState] scope=${i}: 타겟 컨텍스트에 상태 업데이트`,M),O.setState(M),w&&h&&setTimeout(()=>h.completeStateChange(w),0),M}}U.warn(`[handleSetState] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const k=t.setState&&!t._isDispatchFallbackContext;if(U.log("[handleSetState] isRealComponentContext:",k,"context.setState:",!!t.setState,"_isDispatchFallbackContext:",t._isDispatchFallbackContext),k){U.log("[handleSetState] Using COMPONENT setState path"),U.log("[handleSetState] resolvedPayload:",S),U.log("[handleSetState] context.state:",t.state),U.log("[handleSetState] mergeMode:",v);const O=window.__g7PendingLocalState||t.state||{},N=v==="deep"?this.deepMergeWithState(S,{}):S;U.log("[handleSetState] convertedPayload (변경 필드만, dot notation 변환):",N),t.setState(N);const D=v==="deep"?this.deepMergeWithState(S,O):v==="shallow"?{...t.state||{},...S}:S,{__mergeMode:$,__setStateId:M,...z}=D;window.__g7PendingLocalState=z,U.log("[handleSetState] __g7PendingLocalState updated:",z);const{__mergeMode:K,__setStateId:ye,...we}=S;if(v==="replace")window.__g7ForcedLocalFields=we;else{const J=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=this.deepMergeWithState(we,J)}return U.log("[handleSetState] __g7ForcedLocalFields updated:",we),w&&h&&setTimeout(()=>h.completeStateChange(w),0),{__target:"local",...D}}else if(this.globalStateUpdater){U.log("[handleSetState] Using GLOBAL STATE UPDATER path for _local");const O=window.__g7PendingLocalState||p._local||{};U.log("[handleSetState] currentLocal (with pending):",O);const N=v==="deep"?this.deepMergeWithState(S,O):S;return U.log("[handleSetState] finalLocal (merged):",N),this.globalStateUpdater({_local:N},{render:d}),window.__g7PendingLocalState=N,U.log("[handleSetState] __g7PendingLocalState updated for globalStateUpdater path"),w&&h&&setTimeout(()=>h.completeStateChange(w),0),{__target:"local",...N}}else throw w&&h&&h.completeStateChange(w),new Gt("setState function is not provided in context and globalStateUpdater is not set")}else if(s.startsWith("_local.")){const k=s.slice(7),{__mergeMode:A,__setStateId:O,...N}=S,D=N.value!==void 0?N.value:Object.values(N)[0];if(t.setState){const M=window.__g7PendingLocalState||t.state||{},z=this.createNestedUpdate(k,D,M),K={...M,...z};return t.setState(z),w&&h&&setTimeout(()=>h.completeStateChange(w),0),K}else throw w&&h&&h.completeStateChange(w),new Gt("setState function is not provided in context")}else{if(!t.setState)throw w&&h&&h.completeStateChange(w),new Gt("setState function is not provided in context");const A=window.__g7PendingLocalState||t.state||{},O=v==="deep"?this.deepMergeWithState(S,A):S;return t.setState(O),w&&h&&setTimeout(()=>h.completeStateChange(w),0),O}}async handleParentScopeSetState(e,t,s,i){const o=Kn(),d=window.G7Core,g=s==="replace"?"replace":s==="shallow"?"shallow":"deep",h=e.startsWith("$parent."),f=h?"$parent.":"$root.",p=e.slice(f.length);let y,x;if(p==="_local"||p==="_global")y=p,x=void 0;else if(p.startsWith("_local."))y="_local",x=p.slice(7);else if(p.startsWith("_global."))y="_global",x=p.slice(8);else{U.warn(`[handleParentScopeSetState] 지원하지 않는 타겟 형식: ${e}. _local 또는 _global으로 시작해야 합니다.`);return}const w=window.__g7LayoutContextStack||[];if(w.length===0){U.warn(`[handleParentScopeSetState] 레이아웃 컨텍스트 스택이 비어있습니다. target=${e}`);return}const v=h?w[w.length-1]:w[0];if(!v){U.warn(`[handleParentScopeSetState] 타겟 컨텍스트를 찾을 수 없습니다. target=${e}`);return}const S=y==="_global"?v.state?._global:v.state?._local,k=o?.isEnabled()?o.startStateChange(e,S,t,{actionId:i.actionId,handlerType:"setState",source:`target=${e}`}):void 0,{__mergeMode:A,__setStateId:O,...N}=t;if(y==="_global"){if(!this.globalStateUpdater){U.warn("[handleParentScopeSetState] globalStateUpdater가 설정되지 않았습니다."),k&&o&&o.completeStateChange(k);return}const D=d?.state?.get()||{};if(x){const $=N.value!==void 0?N.value:Object.values(N)[0],M=this.createNestedUpdate(x,$,D),z={...D,...M};U.log(`[handleParentScopeSetState] ${e}: 전역 상태 중첩 경로 업데이트`,z),this.globalStateUpdater(z)}else{const $=g==="deep"?this.deepMergeWithState(N,D):N;U.log(`[handleParentScopeSetState] ${e}: 전역 상태 업데이트 (mergeMode=${g})`,$),this.globalStateUpdater(g!=="deep"?{...$,__mergeMode:g}:$)}return k&&o&&setTimeout(()=>o.completeStateChange(k),0),{__target:e,...N}}else{if(!v.setState){U.warn(`[handleParentScopeSetState] 타겟 컨텍스트에 setState가 없습니다. target=${e}`),k&&o&&o.completeStateChange(k);return}const D=v.state||{};if(x){const $=N.value!==void 0?N.value:Object.values(N)[0],M=this.createNestedUpdate(x,$,D),z={...D,...M};return U.log(`[handleParentScopeSetState] ${e}: 로컬 상태 중첩 경로 업데이트`,M),v.setState(M),v.state=z,v.dataContext&&(v.dataContext._local=z),gg(),k&&o&&setTimeout(()=>o.completeStateChange(k),0),z}else{const $=g!=="deep"?{...N,__mergeMode:g}:N,M=g==="replace"?N:g==="shallow"?{...D,...N}:this.deepMergeWithState(N,D);return U.log(`[handleParentScopeSetState] ${e}: 로컬 상태 업데이트 (mergeMode=${g})`,M),v.setState($),v.state=M,v.dataContext&&(v.dataContext._local=M),gg(),k&&o&&setTimeout(()=>o.completeStateChange(k),0),M}}}deepMergeWithState(e,t){const s=["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={...t};for(const[d,g]of Object.entries(i)){if(s.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)&&t[d]!==null&&typeof t[d]=="object"&&!Array.isArray(t[d])?o[d]=this.deepMergeWithState(g,t[d]):o[d]=g}return o}deepMergeInto(e,t,s){for(const[i,o]of Object.entries(t)){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]===s[i]&&(e[i]={...e[i]}),this.deepMergeInto(e[i],o,s[i]||{})):typeof o=="object"&&!Array.isArray(o)&&e[i]===void 0&&s[i]!==null&&typeof s[i]=="object"&&!Array.isArray(s[i])?e[i]={...s[i],...o}:e[i]=o}}createNestedUpdate(e,t,s){const i=e.split(".");if(i.length===1)return{[i[0]]:t};const o={};let d=o,g=s;for(let h=0;h<i.length-1;h++){const f=i[h],p=g?.[f],y=p!=null&&typeof p=="object"&&!Array.isArray(p);y?d[f]={...p}:d[f]={},d=d[f],g=y?p:{}}return d[i[i.length-1]]=t,o}buildNestedUpdate(e,t){const s=e.split(".");if(s.length===1)return{[s[0]]:t};const i={};let o=i;for(let d=0;d<s.length-1;d++)o[s[d]]={},o=o[s[d]];return o[s[s.length-1]]=t,i}async handleSetError(e,t,s){let i=e;i=this.resolveValue(i,s.data),this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,s.data));const o=t?.stateTarget||"local";o==="isolated"&&s.isolatedContext?(s.isolatedContext.mergeState({apiError:i}),U.log("[handleSetError] Error set to isolated state:",i)):o==="global"&&this.globalStateUpdater?(this.globalStateUpdater({apiError:i}),U.log("[handleSetError] Error set to global state:",i)):s.setState?(s.setState({apiError:i}),U.log("[handleSetError] Error set to local state:",i)):U.warn("[handleSetError] Cannot set error: no state updater available")}async handleOpenModal(e,t){if(!this.globalStateUpdater){U.warn("Global state updater is not set for openModal");return}const s=t.data?._global?.modalStack||[];if(s.includes(e)){U.warn(`Modal "${e}" is already open`);return}const i=window.G7Core,o=t.setState&&t.state!==void 0,d=o?void 0:i?.state?.getLocal?.()||{},g=!o&&d!==void 0&&this.globalStateUpdater;if(o||g){const p=window.__g7LayoutContextStack||[],y=o?t.state:d,x=o?t.setState:w=>{this.globalStateUpdater({_local:w})};p.push({state:y,setState:x,dataContext:{_local:y||t.data?._local,_global:o?t.data?._global:t.data?._global||i?.state?.get?.(),_computed:t.data?._computed}}),window.__g7LayoutContextStack=p,U.log(`[handleOpenModal] 레이아웃 컨텍스트 스택에 push, 스택 크기: ${p.length}, state:`,y,o?"(direct)":"(fallback via G7Core)")}else U.warn(`[handleOpenModal] 컨텍스트 스택에 push 실패 - setState: ${!!t.setState}, state: ${t.state!==void 0}, G7Core: ${!!i?.state?.getLocal}`);const h=[...s,e];this.globalStateUpdater({modalStack:h,activeModal:e});const f=Kn();if(f?.isEnabled()){const p=s.length>0?s[s.length-1]:void 0;f.trackModalOpen?.({modalId:e,modalName:e,scopeType:"isolated",parentModalId:p,initialState:t.state?{...t.state}:{}})}}async handleCloseModal(e){if(!this.globalStateUpdater){U.warn("Global state updater is not set for closeModal");return}const t=e?.data?._global?.modalStack||[],s=t.length>0?t[t.length-1]:null,i=t.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,U.log(`[handleCloseModal] 레이아웃 컨텍스트 스택에서 pop, 스택 크기: ${d.length}`)}if(s){const g=Kn();g?.isEnabled()&&g.trackModalClose?.(s,e?.state)}this.globalStateUpdater({modalStack:i,activeModal:o})}async handleShowAlert(e,t){let s=e;this.translationEngine&&this.translationContext&&e.startsWith("$t:")&&(s=this.translationEngine.resolveTranslations(e,this.translationContext,t.data)),alert(s)}async handleToast(e,t){const{type:s="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,t.data)),this.globalStateUpdater){const f={id:`toast_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,type:s,message:g,...o&&{icon:o},...d&&{duration:d}},w=[...window.G7Core?.state?.get()?.toasts||[],f];this.globalStateUpdater({toasts:w})}else U.log(`[Toast ${s}] ${g}`)}async handleSwitch(e,t){const{cases:s}=e;if(!s){U.warn("switch handler requires cases property");return}const i=this.resolveParams(e.params,t.data);let o;if(i?.value!==void 0?(o=i.value,U.log("switch handler: using params.value as case key:",o)):(o=t.data?.$args?.[0],U.log("switch handler: using $args[0] as case key:",o)),o==null){if(s.default)return U.log("switch handler: case key is undefined, using default case"),await this.executeAction(s.default,t);U.warn("switch handler: case key is not defined and no default case");return}const d=String(o);let g=s[d];if(!g&&s.default&&(U.log(`switch handler: no case found for key "${d}", using default case`),g=s.default),!g){U.warn(`switch handler: no case found for key "${d}" and no default case`);return}return await this.executeAction(g,t)}async handleConditions(e,t){const{conditions:s}=e;if(!s||!Array.isArray(s)){U.warn("conditions handler requires conditions array");return}const i=t.data||{},o=Xp(s,i,this.bindingEngine);if(!o.matched){U.log("conditions handler: no matching branch found");return}const d=s[o.branchIndex];if(U.log(`conditions handler: matched branch ${o.branchIndex}`),!d.then){U.warn('conditions handler: matched branch has no "then" action');return}return Array.isArray(d.then)?await this.handleSequence({...e,actions:d.then},t):await this.executeAction(d.then,t)}handleStartInterval(e,t){const s=typeof e.id=="string"?e.id:"",i=Number(e.intervalMs??1e3),o=Array.isArray(e.actions)?e.actions:[];if(s===""||!o.length||i<=0)return U.warn("startInterval requires non-empty id, positive intervalMs, and actions array"),{success:!1};const d=this.intervals.get(s);d&&(clearInterval(d),this.intervals.delete(s));const g=setInterval(()=>{for(const h of o)this.executeAction(h,t).catch(f=>{U.error(`[startInterval:${s}] tick action failed`,f)})},i);return this.intervals.set(s,g),{success:!0,id:s}}handleStopInterval(e){const t=typeof e.id=="string"?e.id:"";if(t==="")return U.warn("stopInterval requires id parameter"),{success:!1};const s=this.intervals.get(t);return s&&(clearInterval(s),this.intervals.delete(t)),{success:!0,id:t}}stopAllIntervals(){for(const e of this.intervals.values())clearInterval(e);this.intervals.clear()}async handleSequence(e,t){const s=e.actions||e.params?.actions;if(!s||!Array.isArray(s)||s.length===0)return U.warn("sequence handler requires non-empty actions array"),[];const i=Kn(),o=i?.isEnabled()&&i.startSequenceExecution?.({eventType:e.type})||"";window.__g7SequenceLocalSync=void 0;const d=[];let g,h=t.state?{...t.state}:{},f=t.isolatedContext?.state?{...t.isolatedContext.state}:{},p=t.data?._computed||{};const y=window.G7Core,x=()=>({_global:y?.state?.get()||{},_local:{...h},_isolated:Object.keys(f).length>0?{...f}:void 0});for(let w=0;w<s.length;w++){const v=s[w],S=Date.now();o&&i?.isEnabled()&&i.captureSequenceActionBefore?.(o,w,v.handler||"unknown",v.params||{},x());const k={...t,state:h,data:{...t.data,_local:h,_computed:p,$computed:p,$prev:g,$results:[...d],_isolated:f},isolatedContext:t.isolatedContext?{...t.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,...$}=A.data;D==="replace"?h={...h,_global:$}:h={...h,_global:{...h._global||{},...$}},U.log("[handleSequence] global state synchronized (mergeMode=%s):",D||"deep",h._global)}else if(A.data.__target==="isolated"){const{__target:N,__mergeMode:D,...$}=A.data;D==="replace"?f=$:f={...f,...$},U.log("[handleSequence] isolated state synchronized (mergeMode=%s):",D||"deep",f)}else if(A.data.__target==="local"){const{__target:N,__mergeMode:D,__setStateId:$,...M}=A.data;D==="replace"?h=M:h={...h,...M},U.log("[handleSequence] local state synchronized (mergeMode=%s):",D||"deep",h)}else h=A.data,U.log("[handleSequence] state synchronized (legacy):",h);const O=t.data?._computedDefinitions;if(O&&Object.keys(O).length>0){const N={},D={...t.data,_local:h,_computed:N,$computed:N,_isolated:f};for(const[$,M]of Object.entries(O))if(typeof M=="string"){const z=M.trim();if(z.startsWith("{{")&&z.endsWith("}}"))try{const K=z.slice(2,-2).trim();N[$]=this.bindingEngine.evaluateExpression(K,D,{skipCache:!0})}catch{N[$]=p[$]}}p=N,U.log("[handleSequence] _computed recalculated after setState:",p)}}if(v.handler!=="setState"){const O=window.__g7SequenceLocalSync;if(O&&O!==h){h=O,window.__g7SequenceLocalSync=void 0,U.log("[handleSequence] currentState synchronized from __g7SequenceLocalSync after custom handler:",v.handler);const N=t.data?._computedDefinitions;if(N&&Object.keys(N).length>0){const D={},$={...t.data,_local:h,_computed:D,$computed:D,_isolated:f};for(const[M,z]of Object.entries(N))if(typeof z=="string"){const K=z.trim();if(K.startsWith("{{")&&K.endsWith("}}"))try{const ye=K.slice(2,-2).trim();D[M]=this.bindingEngine.evaluateExpression(ye,$,{skipCache:!0})}catch{D[M]=p[M]}}p=D,U.log("[handleSequence] _computed recalculated after custom handler:",p)}}}o&&i?.isEnabled()&&i.captureSequenceActionAfter?.(o,w,x(),Date.now()-S,A.data)}catch(A){throw o&&i?.isEnabled()&&(i.captureSequenceActionAfter?.(o,w,x(),Date.now()-S,void 0,A),i.endSequenceExecution?.(o,A)),U.error(`sequence handler: action[${w}] failed:`,A),A}}return window.__g7SequenceLocalSync=void 0,o&&i?.isEnabled()&&i.endSequenceExecution?.(o),d}async handleParallel(e,t){const s=e.actions||e.params?.actions;if(!s||!Array.isArray(s)||s.length===0)return U.warn("parallel handler requires non-empty actions array"),[];U.log(`parallel handler: executing ${s.length} actions in parallel`);const i=t.isolatedContext?{...t.isolatedContext,state:{...t.isolatedContext.state}}:null,o=s.map((h,f)=>{const p={...t,isolatedContext:i};return this.executeAction(h,p).catch(y=>{throw U.error(`parallel handler: action[${f}] failed:`,y),y})}),d=await Promise.allSettled(o),g=d.filter(h=>h.status==="rejected").length;return g>0&&U.warn(`parallel handler: ${g}/${s.length} actions failed`),d}async handleLoadScript(e,t,s){const{src:i,id:o,async:d=!0,defer:g=!1}=e;if(!i)throw new Gt('loadScript handler requires "src" parameter',t);const h=o||`script_${i.replace(/[^a-zA-Z0-9]/g,"_")}`;return vi.loadedScripts.has(h)?(U.log(`loadScript: script already loaded, skipping: ${h}`),t.onLoad&&await this.executeAction(t.onLoad,s),!0):document.getElementById(h)?(U.log(`loadScript: script element already exists: ${h}`),vi.loadedScripts.add(h),t.onLoad&&await this.executeAction(t.onLoad,s),!0):(U.log(`loadScript: loading script: ${i}`),new Promise((p,y)=>{const x=document.createElement("script");x.id=h,x.src=i,x.async=d,x.defer=g,x.onload=async()=>{if(U.log(`loadScript: script loaded successfully: ${h}`),vi.loadedScripts.add(h),t.onLoad)try{await this.executeAction(t.onLoad,s)}catch(w){U.error("loadScript: onLoad action failed:",w)}p(!0)},x.onerror=w=>{U.error(`loadScript: failed to load script: ${i}`,w),y(new Gt(`Failed to load script: ${i}`,t))},document.head.appendChild(x)}))}async handleCallExternal(e,t,s){const i=e.constructor,o=e.args||{},d=e.method,g=e.methodArgs||[],h=e.callbackEvent,f=e.embedTarget,p=e.callbackSetState,y=e.callbackAction;if(!i)throw new Gt('callExternal handler requires "constructor" parameter',t);const x=this.getNestedProperty(window,i);if(!x||typeof x!="function")throw new Gt(`Constructor not found or not a function: ${i}. Make sure the script is loaded first using loadScript handler.`,t);U.log(`callExternal: calling constructor ${i}`);const w={...o};for(const[S,k]of Object.entries(o))k===!0&&(w[S]=A=>{if(U.log(`callExternal: callback triggered for ${S}`,A),h&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(h,A),p&&s.setState){const O=$=>{const M={};for(const[z,K]of Object.entries($))typeof K=="string"?M[z]=this.getNestedProperty(A,K):typeof K=="object"&&K!==null&&(M[z]=O(K));return M},N=O(p);U.log("callExternal: callbackSetState mapping result",N);const D=this.deepMergeWithState(N,s.state||{});U.log("callExternal: merged with existing state",D),s.setState(D)}else h&&s.setState&&s.setState({[`${h.replace(/:/g,"_")}_result`]:A});if(y){const O={...s,data:{...s.data,$event:A}},N=Array.isArray(y)?y:[y];for(const D of N)try{this.executeAction(D,O)}catch($){U.error("callExternal: callbackAction failed:",$)}}});const v=new x(w);if(d&&typeof v[d]=="function"){if(U.log(`callExternal: calling method ${d}`),d==="embed"&&f){const S=document.querySelector(f);if(S)return v[d](S,...g);throw new Gt(`Embed target element not found: ${f}`,t)}return v[d](...g)}return v}async handleCallExternalEmbed(e,t,s){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',t);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.`,t);U.log(`callExternalEmbed: creating layer for ${i}`);const{layer:y,closeLayer:x}=this.createEmbedLayer(h),w={...o};for(const[S,k]of Object.entries(o))k===!0&&(w[S]=A=>{if(U.log(`callExternalEmbed: callback triggered for ${S}`,A),x(),g&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(g,A),d&&s.setState){const O=$=>{const M={};for(const[z,K]of Object.entries($))typeof K=="string"?M[z]=this.getNestedProperty(A,K):typeof K=="object"&&K!==null&&(M[z]=O(K));return M},N=O(d);U.log("callExternalEmbed: callbackSetState mapping result",N);const D=this.deepMergeWithState(N,s.state||{});U.log("callExternalEmbed: merged with existing state",D),s.setState(D)}if(f){const O={...s,data:{...s.data,$event:A}},N=Array.isArray(f)?f:[f];for(const D of N)try{this.executeAction(D,O)}catch($){U.error("callExternalEmbed: callbackAction failed:",$)}}});const v=new p(w);if(typeof v.embed=="function")v.embed(y),U.log("callExternalEmbed: embedded in layer");else throw x(),new Gt(`Constructor ${i} does not have embed method`,t);return v}createEmbedLayer(e){const t=document.createElement("div");t.id="g7-embed-overlay",t.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 s=document.createElement("div");s.id="g7-embed-layer",s.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&&(s.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=()=>{t.parentNode&&t.parentNode.removeChild(t)};i.onclick=o;const d=g=>{g.key==="Escape"&&(o(),document.removeEventListener("keydown",d))};return document.addEventListener("keydown",d),t.onclick=g=>{g.target===t&&o()},s.appendChild(i),t.appendChild(s),document.body.appendChild(t),{overlay:t,layer:s,closeLayer:o}}getNestedProperty(e,t){return t.split(".").reduce((s,i)=>s&&s[i]!==void 0?s[i]:void 0,e)}async handleSaveToLocalStorage(e,t){const{key:s,value:i}=e;if(!s)return U.error("saveToLocalStorage: key parameter is required"),!1;try{const o=typeof i=="string"?i:JSON.stringify(i);return localStorage.setItem(s,o),U.log(`saveToLocalStorage: saved ${s}`,i),!0}catch(o){return U.error("saveToLocalStorage: failed to save",{key:s,error:o}),!1}}async handleLoadFromLocalStorage(e,t){const{key:s,target:i,stateKey:o,defaultValue:d}=e;if(!s)return U.error("loadFromLocalStorage: key parameter is required"),d;try{const g=localStorage.getItem(s);if(g===null)return U.log(`loadFromLocalStorage: no value found for ${s}, using default`),o&&t.setState&&t.setState({[o]:d}),d;let h;try{h=JSON.parse(g)}catch{h=g}return U.log(`loadFromLocalStorage: loaded ${s}`,h),o&&t.setState&&t.setState({[o]:h}),h}catch(g){return U.error("loadFromLocalStorage: failed to load",{key:s,error:g}),d}}async handleCustomAction(e,t){const s=this.customHandlers.get(e.handler);if(!s)throw new Gt(`Unknown action handler: ${e.handler}`,e);return await s(e,t)}resolveParams(e,t){if(!e)return{};const s={};for(const[i,o]of Object.entries(e))i.includes("{{")&&U.warn(`[resolveParams] setState params의 키에 표현식이 포함되어 있습니다: "${i}". 키는 해석되지 않습니다. 배열 항목 수정은 .map()/.filter() 패턴을 사용하세요.`),typeof o=="string"&&o.includes("{{")?s[i]=this.evaluateExpression(o,t):typeof o=="string"?s[i]=o:Array.isArray(o)?s[i]=o.map(d=>typeof d=="string"&&d.includes("{{")?this.evaluateExpression(d,t):d):typeof o=="object"&&o!==null&&!Array.isArray(o)&&Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null?s[i]=o:typeof o=="object"&&o!==null?s[i]=this.resolveParams(o,t):s[i]=o;return s}resolveValue(e,t){return t?this.bindingEngine.resolveBindings(e,t,{skipCache:!0}):e}evaluateExpressions(e,t){let s={};for(const[i,o]of Object.entries(e))if(i==="..."){let d=o;typeof o=="string"&&o.includes("{{")&&(d=this.evaluateExpression(o,t)),d&&typeof d=="object"&&!Array.isArray(d)&&(s={...s,...d})}else typeof o=="string"&&o.includes("{{")?s[i]=this.evaluateExpression(o,t):typeof o=="object"&&o!==null&&!Array.isArray(o)?s[i]=this.evaluateExpressions(o,t):s[i]=o;return s}evaluateExpressionsIfNeeded(e,t){const s={};for(const[i,o]of Object.entries(e))typeof o=="string"&&o.includes("{{")?s[i]=this.evaluateExpression(o,t):s[i]=o;return s}evaluateExpression(e,t){if(!t)return e;const s=e.match(/^\{\{(.+)\}\}$/);if(!(s&&!s[1].includes("}}")&&!s[1].includes("{{"))){let g=t;if(e.includes("_global")){const f=window.G7Core?.state?.get()?._global;f&&(g={...t,_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=s[1].trim();o=o.replace(/\$args\.(\d+)/g,"$args[$1]");let d=t;if(o.includes("_global")){const h=window.G7Core?.state?.get()?._global;h&&(d={...t,_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")&&(U.log("[evaluateExpression] expression:",o),U.log("[evaluateExpression] dataContext._global:",d._global),U.log("[evaluateExpression] dataContext._global?.modules:",d._global?.modules));try{const g=this.bindingEngine.evaluateExpression(o,d);return o.includes("_global.modules")&&U.log("[evaluateExpression] result:",g),typeof g=="string"&&g.startsWith("$t:")&&this.translationEngine&&this.translationContext?this.translationEngine.resolveTranslations(g,this.translationContext,t):g}catch(g){return U.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,t){const s={...this.defaultContext,...t,data:{...this.defaultContext.data,...t?.data}};if(e.confirm){let i=this.resolveValue(e.confirm,s.data);if(this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,s.data)),!confirm(i))return{success:!1}}try{return await this.executeAction(e,s)}catch(i){if(U.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={...s,data:{...s.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,t,s){this.customHandlers.set(e,t);const i=Kn();i?.isEnabled()&&i.trackHandlerRegistration(e,s?.category??"custom",s?.description,s?.source)}unregisterHandler(e){this.customHandlers.delete(e);const t=Kn();t?.isEnabled()&&t.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 t=e.target;if(t&&!("tagName"in t)){const o={type:e.type??"custom",target:{value:t.value,name:t.name??""}};return e._changedKeys&&(o._changedKeys=e._changedKeys),o}const i=t?{value:t.value,name:t.name??"",checked:t.checked??!1,type:t.type??"",tagName:t.tagName}:{};if(e.type==="scroll"&&t){const o=t;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:t?i:null}}executeDebouncedAction(e,t,s,i,o){const d={...s,$event:t,$args:o},g={type:t.type,target:t.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(e,d,i)(g)}handleDebouncedAction(e,t,s,i,o,d){const g=this.normalizeDebounceConfig(e.debounce),h=o||`default-${e.handler}-${Date.now()}`,f=this.extractEventData(t),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 S={...v};for(const k of p)S[k]=f.target.value[k];f.target.value=S}this.debounceAccumulatedValues.set(h,f.target.value)}const y=this.debounceTimers.get(h);y&&(clearTimeout(y),this.debounceTimers.delete(h));const x=Kn();x?.isEnabled()&&x.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,s,i,d),x?.isEnabled()&&x.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,s,i,d),x?.isEnabled()&&x.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"}})},S=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,S),this.pendingDebounceFlushers.set(h,v)}}clearDebounceTimers(e){if(e)for(const[t,s]of this.debounceTimers)t.startsWith(e+"-")&&(clearTimeout(s),this.debounceTimers.delete(t),this.pendingDebounceFlushers.delete(t),this.debounceAccumulatedValues.delete(t));else{for(const t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear(),this.pendingDebounceFlushers.clear(),this.debounceAccumulatedValues.clear()}}debouncedCall(e,t,s){const i=this.debounceTimers.get(e);i&&(clearTimeout(i),this.debounceTimers.delete(e));const o=setTimeout(()=>{this.debounceTimers.delete(e),this.pendingDebounceFlushers.delete(e),s()},t);this.debounceTimers.set(e,o),this.pendingDebounceFlushers.set(e,s)}flushPendingDebounceTimers(){if(this.pendingDebounceFlushers.size===0)return;const e=new Map(this.pendingDebounceFlushers);for(const[t,s]of e){const i=this.debounceTimers.get(t);i&&(clearTimeout(i),this.debounceTimers.delete(t)),this.debounceTimers.delete(t+"_leading"),this.pendingDebounceFlushers.delete(t),s()}this.globalStateUpdater&&this.globalStateUpdater({})}bindActionsToProps(e,t,s){const i={...e};if(e.actions&&Array.isArray(e.actions)){const o=new Map;for(const p of e.actions){const y=this.resolveActionRef(p),x=y.event||this.getEventHandlerName(y.type);o.has(x)||o.set(x,[]),o.get(x).push(y)}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,y]of o)i[p]=(...x)=>{for(const w of y){const v=x[0],S=v&&typeof v=="object"&&"preventDefault"in v;if(S&&(p==="onDragOver"||p==="onDrop")&&v.preventDefault(),S&&w.key&&"key"in v){if(v.key!==w.key){U.log("Key filter not matched:",w.key,"actual:",v.key);continue}U.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 O;if(S)O=v;else if(A){const D={type:"custom",target:v.target,preventDefault:()=>{},stopPropagation:()=>{}};v._changedKeys&&(D._changedKeys=v._changedKeys),O=D}else O=new Event("custom");const N=w.event?{...t,$args:x}:t;this.handleDebouncedAction(w,O,N,s,k,x)}else if(this.flushPendingDebounceTimers(),w.event){const k={...t,$args:x},A=S?v:new Event("custom");this.createHandler(w,k,s)(A)}else if(S)this.createHandler(w,t,s)(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,t,s)(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,t=5){const s=new WeakSet,i=(o,d)=>{if(o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o;if(d>t)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(s.has(o))return"[Circular Array]";s.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(s.has(o))return"[Circular Reference]";s.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(vi,"loadedScripts",new Set);let Co=vi,vc=null;function Wm(r){return vc||(vc=new Co(r)),vc}function v7(r){vc=r}const Ym=nt("TransitionManager");class w7{constructor(){H(this,"isPending",!1);H(this,"subscribers",new Set)}setPending(e){this.isPending!==e&&(Ym.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(){Ym.log("notifySubscribers:",{isPending:this.isPending,subscriberCount:this.subscribers.size}),this.subscribers.forEach(e=>{e(this.isPending)})}clearSubscribers(){this.subscribers.clear()}}const Gs=new w7,wc=nt("TransitionContext"),Jm=j.createContext({isTransitioning:!1}),fg=({children:r})=>{const[e,t]=j.useState(()=>{const i=Gs.getIsPending();return wc.log("Initial state:",i),i});j.useEffect(()=>{wc.log("Subscribing to TransitionManager");const i=Gs.subscribe(o=>{wc.log("Received isPending update:",o),t(o)});return()=>{wc.log("Unsubscribing from TransitionManager"),i()}},[]);const s=j.useMemo(()=>({isTransitioning:e}),[e]);return l.jsx(Jm.Provider,{value:s,children:r})},Xm=()=>j.useContext(Jm);function S7(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function Qm(r){const e=S7(r);return{width:r,isMobile:e==="mobile",isTablet:e==="tablet",isDesktop:e==="desktop",matchedPreset:e}}const Zm=j.createContext(Qm(1024)),pg=({children:r,overrideWidth:e})=>{const[t,s]=j.useState(()=>ti.getWidth());j.useEffect(()=>{const d=ti.subscribe(g=>{s(g)});return()=>{d()}},[]);const i=e??t,o=j.useMemo(()=>Qm(i),[i]);return l.jsx(Zm.Provider,{value:o,children:r})},ey=()=>j.useContext(Zm);window.G7Core?.createLogger?.("Core:State");function C7(r,e,t,s){const{syncOnControlledChange:i=!0,isEqual:o}=s??{},d=r!==void 0;j.useRef(d);const[g,h]=j.useState(r!==void 0?r:e),f=g,p=j.useRef(r),y=j.useRef(!1);j.useEffect(()=>{if(y.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 x=j.useCallback(w=>{const v=typeof w=="function"?w(f):w;(o?o(f,v):f===v)||(y.current=!0,h(v),t?.(v),requestAnimationFrame(()=>{y.current=!1}))},[f,d,t,o]);return[f,x]}function j7(r,e){return r===e?!0:r.length!==e.length?!1:r.every((t,s)=>t===e[s])}function ty(r,e){if(r===e)return!0;const t=Object.keys(r),s=Object.keys(e);return t.length!==s.length?!1:t.every(i=>r[i]===e[i])}const ny=j.createContext({}),k7=({children:r,value:e})=>l.jsx(ny.Provider,{value:e,children:r}),N7=()=>j.useContext(ny),E7=(r,e)=>{if(!r)return;const t=e.split(".");let s=r;for(const i of t){if(s==null)return;s=s[i]}return s},_7=(r,e,t)=>{const s=e.split(".");if(s.length===1)return{...r,[s[0]]:t};const i={...r};let o=i;for(let d=0;d<s.length-1;d++){const g=s[d],h=s[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[s[s.length-1]]=t,i},li=nt("IsolatedStateContext"),A7={state:{},setState:()=>{li.warn("IsolatedStateContext not available: setState called outside IsolatedStateProvider")},getState:()=>{},mergeState:()=>{li.warn("IsolatedStateContext not available: mergeState called outside IsolatedStateProvider")},stateRef:{current:{}},scopeId:""},sy=j.createContext(A7);let T7=0;function D7(){return`isolated-${++T7}-${Date.now().toString(36)}`}function ay(r,e){if(e==null)return r;if(typeof e!="object"||Array.isArray(e))return e;const t={...r};for(const s of Object.keys(e)){const i=e[s],o=r?.[s];i!==null&&typeof i=="object"&&!Array.isArray(i)&&o!==null&&typeof o=="object"&&!Array.isArray(o)?t[s]=ay(o,i):t[s]=i}return t}function R7(r,e){return e?e.split(".").reduce((t,s)=>t?.[s],r):r}function O7(r,e,t){const s=e.split("."),i={...r};let o=i;for(let d=0;d<s.length-1;d++){const g=s[d];o[g]={...o[g]},o=o[g]}return o[s[s.length-1]]=t,i}const L7=({initialState:r={},scopeId:e,children:t})=>{const i=j.useRef(e||D7()).current,[o,d]=j.useState(r),g=j.useRef(o);g.current=o;const h=j.useCallback(w=>R7(g.current,w),[]),f=j.useCallback((w,v)=>{d(S=>{const k=O7(S,w,v);return li.log(`[${i}] setState: ${w} =`,v),k})},[i]),p=j.useCallback((w,v="deep")=>{d(S=>{let k;return v==="replace"?k=w:v==="shallow"?k={...S,...w}:k=ay(S,w),li.log(`[${i}] mergeState (${v}):`,w),k})},[i]),y=j.useMemo(()=>({state:o,setState:f,getState:h,mergeState:p,stateRef:g,scopeId:i}),[o,f,h,p,i]),x=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]=x,w&&(w._isolatedStates||(w._isolatedStates={}),w._isolatedStates[i]=o),w?.devTools?.isEnabled?.()&&w.devTools.emit?.("isolated:created",{id:i,state:o}),li.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}),li.log(`[${i}] IsolatedStateProvider unmounted`)}},[i,x]),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(sy.Provider,{value:y,children:t})},M7=()=>{const r=j.useContext(sy);return r.scopeId?r:null};var Ma=zp();function $7(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return j.useMemo(()=>s=>{e.forEach(i=>i(s))},e)}const Sc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ci(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function mg(r){return"nodeType"in r}function Mn(r){var e,t;return r?ci(r)?r:mg(r)&&(e=(t=r.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function yg(r){const{Document:e}=Mn(r);return r instanceof e}function jo(r){return ci(r)?!1:r instanceof Mn(r).HTMLElement}function ry(r){return r instanceof Mn(r).SVGElement}function di(r){return r?ci(r)?r.document:mg(r)?yg(r)?r:jo(r)||ry(r)?r.ownerDocument:document:document:document}const Fs=Sc?j.useLayoutEffect:j.useEffect;function xg(r){const e=j.useRef(r);return Fs(()=>{e.current=r}),j.useCallback(function(){for(var t=arguments.length,s=new Array(t),i=0;i<t;i++)s[i]=arguments[i];return e.current==null?void 0:e.current(...s)},[])}function I7(){const r=j.useRef(null),e=j.useCallback((s,i)=>{r.current=setInterval(s,i)},[]),t=j.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,t]}function ko(r,e){e===void 0&&(e=[r]);const t=j.useRef(r);return Fs(()=>{t.current!==r&&(t.current=r)},e),t}function No(r,e){const t=j.useRef();return j.useMemo(()=>{const s=r(t.current);return t.current=s,s},[...e])}function Cc(r){const e=xg(r),t=j.useRef(null),s=j.useCallback(i=>{i!==t.current&&e?.(i,t.current),t.current=i},[]);return[t,s]}function bg(r){const e=j.useRef();return j.useEffect(()=>{e.current=r},[r]),e.current}let vg={};function Eo(r,e){return j.useMemo(()=>{if(e)return e;const t=vg[r]==null?0:vg[r]+1;return vg[r]=t,r+"-"+t},[r,e])}function iy(r){return function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];return s.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 ui=iy(1),_o=iy(-1);function z7(r){return"clientX"in r&&"clientY"in r}function wg(r){if(!r)return!1;const{KeyboardEvent:e}=Mn(r.target);return e&&r instanceof e}function H7(r){if(!r)return!1;const{TouchEvent:e}=Mn(r.target);return e&&r instanceof e}function Sg(r){if(H7(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:t}=r.touches[0];return{x:e,y:t}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:t}=r.changedTouches[0];return{x:e,y:t}}}return z7(r)?{x:r.clientX,y:r.clientY}:null}const Ao=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:t}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:t}=r;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(r){if(r)return[Ao.Translate.toString(r),Ao.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:t,easing:s}=r;return e+" "+t+"ms "+s}}}),oy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function P7(r){return r.matches(oy)?r:r.querySelector(oy)}const U7={display:"none"};function B7(r){let{id:e,value:t}=r;return Ke.createElement("div",{id:e,style:U7},t)}function q7(r){let{id:e,announcement:t,ariaLiveType:s="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 Ke.createElement("div",{id:e,style:i,role:"status","aria-live":s,"aria-atomic":!0},t)}function G7(){const[r,e]=j.useState("");return{announce:j.useCallback(s=>{s!=null&&e(s)},[]),announcement:r}}const ly=j.createContext(null);function F7(r){const e=j.useContext(ly);j.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function V7(){const[r]=j.useState(()=>new Set),e=j.useCallback(s=>(r.add(s),()=>r.delete(s)),[r]);return[j.useCallback(s=>{let{type:i,event:o}=s;r.forEach(d=>{var g;return(g=d[i])==null?void 0:g.call(d,o)})},[r]),e]}const K7={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.
|
||
`},W7={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:t}=r;return t?"Draggable item "+e.id+" was moved over droppable area "+t.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:t}=r;return t?"Draggable item "+e.id+" was dropped over droppable area "+t.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function Y7(r){let{announcements:e=W7,container:t,hiddenTextDescribedById:s,screenReaderInstructions:i=K7}=r;const{announce:o,announcement:d}=G7(),g=Eo("DndLiveRegion"),[h,f]=j.useState(!1);if(j.useEffect(()=>{f(!0)},[]),F7(j.useMemo(()=>({onDragStart(y){let{active:x}=y;o(e.onDragStart({active:x}))},onDragMove(y){let{active:x,over:w}=y;e.onDragMove&&o(e.onDragMove({active:x,over:w}))},onDragOver(y){let{active:x,over:w}=y;o(e.onDragOver({active:x,over:w}))},onDragEnd(y){let{active:x,over:w}=y;o(e.onDragEnd({active:x,over:w}))},onDragCancel(y){let{active:x,over:w}=y;o(e.onDragCancel({active:x,over:w}))}}),[o,e])),!h)return null;const p=Ke.createElement(Ke.Fragment,null,Ke.createElement(B7,{id:s,value:i.draggable}),Ke.createElement(q7,{id:g,announcement:d}));return t?Ma.createPortal(p,t):p}var dn;(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"})(dn||(dn={}));function jc(){}function cy(r,e){return j.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function J7(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return j.useMemo(()=>[...e].filter(s=>s!=null),[...e])}const js=Object.freeze({x:0,y:0});function dy(r,e){return Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2))}function uy(r,e){let{data:{value:t}}=r,{data:{value:s}}=e;return t-s}function X7(r,e){let{data:{value:t}}=r,{data:{value:s}}=e;return s-t}function gy(r){let{left:e,top:t,height:s,width:i}=r;return[{x:e,y:t},{x:e+i,y:t},{x:e,y:t+s},{x:e+i,y:t+s}]}function hy(r,e){if(!r||r.length===0)return null;const[t]=r;return t[e]}function fy(r,e,t){return e===void 0&&(e=r.left),t===void 0&&(t=r.top),{x:e+r.width*.5,y:t+r.height*.5}}const Q7=r=>{let{collisionRect:e,droppableRects:t,droppableContainers:s}=r;const i=fy(e,e.left,e.top),o=[];for(const d of s){const{id:g}=d,h=t.get(g);if(h){const f=dy(fy(h),i);o.push({id:g,data:{droppableContainer:d,value:f}})}}return o.sort(uy)},Z7=r=>{let{collisionRect:e,droppableRects:t,droppableContainers:s}=r;const i=gy(e),o=[];for(const d of s){const{id:g}=d,h=t.get(g);if(h){const f=gy(h),p=i.reduce((x,w,v)=>x+dy(f[v],w),0),y=Number((p/4).toFixed(4));o.push({id:g,data:{droppableContainer:d,value:y}})}}return o.sort(uy)};function eC(r,e){const t=Math.max(e.top,r.top),s=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-s,g=o-t;if(s<i&&t<o){const h=e.width*e.height,f=r.width*r.height,p=d*g,y=p/(h+f-p);return Number(y.toFixed(4))}return 0}const tC=r=>{let{collisionRect:e,droppableRects:t,droppableContainers:s}=r;const i=[];for(const o of s){const{id:d}=o,g=t.get(d);if(g){const h=eC(g,e);h>0&&i.push({id:d,data:{droppableContainer:o,value:h}})}}return i.sort(X7)};function nC(r,e,t){return{...r,scaleX:e&&t?e.width/t.width:1,scaleY:e&&t?e.height/t.height:1}}function py(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:js}function sC(r){return function(t){for(var s=arguments.length,i=new Array(s>1?s-1:0),o=1;o<s;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}),{...t})}}const aC=sC(1);function rC(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 iC(r,e,t){const s=rC(e);if(!s)return r;const{scaleX:i,scaleY:o,x:d,y:g}=s,h=r.left-d-(1-i)*parseFloat(t),f=r.top-g-(1-o)*parseFloat(t.slice(t.indexOf(" ")+1)),p=i?r.width/i:r.width,y=o?r.height/o:r.height;return{width:p,height:y,top:f,right:h+p,bottom:f+y,left:h}}const oC={ignoreTransform:!1};function gi(r,e){e===void 0&&(e=oC);let t=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:f,transformOrigin:p}=Mn(r).getComputedStyle(r);f&&(t=iC(t,f,p))}const{top:s,left:i,width:o,height:d,bottom:g,right:h}=t;return{top:s,left:i,width:o,height:d,bottom:g,right:h}}function my(r){return gi(r,{ignoreTransform:!0})}function lC(r){const e=r.innerWidth,t=r.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function cC(r,e){return e===void 0&&(e=Mn(r).getComputedStyle(r)),e.position==="fixed"}function dC(r,e){e===void 0&&(e=Mn(r).getComputedStyle(r));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=e[i];return typeof o=="string"?t.test(o):!1})}function kc(r,e){const t=[];function s(i){if(e!=null&&t.length>=e||!i)return t;if(yg(i)&&i.scrollingElement!=null&&!t.includes(i.scrollingElement))return t.push(i.scrollingElement),t;if(!jo(i)||ry(i)||t.includes(i))return t;const o=Mn(r).getComputedStyle(i);return i!==r&&dC(i,o)&&t.push(i),cC(i,o)?t:s(i.parentNode)}return r?s(r):t}function yy(r){const[e]=kc(r,1);return e??null}function Cg(r){return!Sc||!r?null:ci(r)?r:mg(r)?yg(r)||r===di(r).scrollingElement?window:jo(r)?r:null:null}function xy(r){return ci(r)?r.scrollX:r.scrollLeft}function by(r){return ci(r)?r.scrollY:r.scrollTop}function jg(r){return{x:xy(r),y:by(r)}}var mn;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(mn||(mn={}));function vy(r){return!Sc||!r?!1:r===document.scrollingElement}function wy(r){const e={x:0,y:0},t=vy(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},s={x:r.scrollWidth-t.width,y:r.scrollHeight-t.height},i=r.scrollTop<=e.y,o=r.scrollLeft<=e.x,d=r.scrollTop>=s.y,g=r.scrollLeft>=s.x;return{isTop:i,isLeft:o,isBottom:d,isRight:g,maxScroll:s,minScroll:e}}const uC={x:.2,y:.2};function gC(r,e,t,s,i){let{top:o,left:d,right:g,bottom:h}=t;s===void 0&&(s=10),i===void 0&&(i=uC);const{isTop:f,isBottom:p,isLeft:y,isRight:x}=wy(r),w={x:0,y:0},v={x:0,y:0},S={height:e.height*i.y,width:e.width*i.x};return!f&&o<=e.top+S.height?(w.y=mn.Backward,v.y=s*Math.abs((e.top+S.height-o)/S.height)):!p&&h>=e.bottom-S.height&&(w.y=mn.Forward,v.y=s*Math.abs((e.bottom-S.height-h)/S.height)),!x&&g>=e.right-S.width?(w.x=mn.Forward,v.x=s*Math.abs((e.right-S.width-g)/S.width)):!y&&d<=e.left+S.width&&(w.x=mn.Backward,v.x=s*Math.abs((e.left+S.width-d)/S.width)),{direction:w,speed:v}}function hC(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:t,right:s,bottom:i}=r.getBoundingClientRect();return{top:e,left:t,right:s,bottom:i,width:r.clientWidth,height:r.clientHeight}}function Sy(r){return r.reduce((e,t)=>ui(e,jg(t)),js)}function fC(r){return r.reduce((e,t)=>e+xy(t),0)}function pC(r){return r.reduce((e,t)=>e+by(t),0)}function mC(r,e){if(e===void 0&&(e=gi),!r)return;const{top:t,left:s,bottom:i,right:o}=e(r);yy(r)&&(i<=0||o<=0||t>=window.innerHeight||s>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const yC=[["x",["left","right"],fC],["y",["top","bottom"],pC]];class kg{constructor(e,t){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 s=kc(t),i=Sy(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,d,g]of yC)for(const h of d)Object.defineProperty(this,h,{get:()=>{const f=g(s),p=i[o]-f;return this.rect[h]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class To{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...t)})},this.target=e}add(e,t,s){var i;(i=this.target)==null||i.addEventListener(e,t,s),this.listeners.push([e,t,s])}}function xC(r){const{EventTarget:e}=Mn(r);return r instanceof e?r:di(r)}function Ng(r,e){const t=Math.abs(r.x),s=Math.abs(r.y);return typeof e=="number"?Math.sqrt(t**2+s**2)>e:"x"in e&&"y"in e?t>e.x&&s>e.y:"x"in e?t>e.x:"y"in e?s>e.y:!1}var is;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(is||(is={}));function Cy(r){r.preventDefault()}function bC(r){r.stopPropagation()}var ft;(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"})(ft||(ft={}));const jy={start:[ft.Space,ft.Enter],cancel:[ft.Esc],end:[ft.Space,ft.Enter,ft.Tab]},vC=(r,e)=>{let{currentCoordinates:t}=e;switch(r.code){case ft.Right:return{...t,x:t.x+25};case ft.Left:return{...t,x:t.x-25};case ft.Down:return{...t,y:t.y+25};case ft.Up:return{...t,y:t.y-25}}};class Eg{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:t}}=e;this.props=e,this.listeners=new To(di(t)),this.windowListeners=new To(Mn(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(is.Resize,this.handleCancel),this.windowListeners.add(is.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(is.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,s=e.node.current;s&&mC(s),t(js)}handleKeyDown(e){if(wg(e)){const{active:t,context:s,options:i}=this.props,{keyboardCodes:o=jy,coordinateGetter:d=vC,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}=s.current,p=f?{x:f.left,y:f.top}:js;this.referenceCoordinates||(this.referenceCoordinates=p);const y=d(e,{active:t,context:s.current,currentCoordinates:p});if(y){const x=_o(y,p),w={x:0,y:0},{scrollableAncestors:v}=s.current;for(const S of v){const k=e.code,{isTop:A,isRight:O,isLeft:N,isBottom:D,maxScroll:$,minScroll:M}=wy(S),z=hC(S),K={x:Math.min(k===ft.Right?z.right-z.width/2:z.right,Math.max(k===ft.Right?z.left:z.left+z.width/2,y.x)),y:Math.min(k===ft.Down?z.bottom-z.height/2:z.bottom,Math.max(k===ft.Down?z.top:z.top+z.height/2,y.y))},ye=k===ft.Right&&!O||k===ft.Left&&!N,we=k===ft.Down&&!D||k===ft.Up&&!A;if(ye&&K.x!==y.x){const J=S.scrollLeft+x.x,ve=k===ft.Right&&J<=$.x||k===ft.Left&&J>=M.x;if(ve&&!x.y){S.scrollTo({left:J,behavior:g});return}ve?w.x=S.scrollLeft-J:w.x=k===ft.Right?S.scrollLeft-$.x:S.scrollLeft-M.x,w.x&&S.scrollBy({left:-w.x,behavior:g});break}else if(we&&K.y!==y.y){const J=S.scrollTop+x.y,ve=k===ft.Down&&J<=$.y||k===ft.Up&&J>=M.y;if(ve&&!x.x){S.scrollTo({top:J,behavior:g});return}ve?w.y=S.scrollTop-J:w.y=k===ft.Down?S.scrollTop-$.y:S.scrollTop-M.y,w.y&&S.scrollBy({top:-w.y,behavior:g});break}}this.handleMove(e,ui(_o(y,this.referenceCoordinates),w))}}}handleMove(e,t){const{onMove:s}=this.props;e.preventDefault(),s(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Eg.activators=[{eventName:"onKeyDown",handler:(r,e,t)=>{let{keyboardCodes:s=jy,onActivation:i}=e,{active:o}=t;const{code:d}=r.nativeEvent;if(s.start.includes(d)){const g=o.activatorNode.current;return g&&r.target!==g?!1:(r.preventDefault(),i?.({event:r.nativeEvent}),!0)}return!1}}];function ky(r){return!!(r&&"distance"in r)}function Ny(r){return!!(r&&"delay"in r)}class _g{constructor(e,t,s){var i;s===void 0&&(s=xC(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=t;const{event:o}=e,{target:d}=o;this.props=e,this.events=t,this.document=di(d),this.documentListeners=new To(this.document),this.listeners=new To(s),this.windowListeners=new To(Mn(d)),this.initialCoordinates=(i=Sg(o))!=null?i:js,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:t,bypassActivationConstraint:s}}}=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(is.Resize,this.handleCancel),this.windowListeners.add(is.DragStart,Cy),this.windowListeners.add(is.VisibilityChange,this.handleCancel),this.windowListeners.add(is.ContextMenu,Cy),this.documentListeners.add(is.Keydown,this.handleKeydown),t){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ny(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(ky(t)){this.handlePending(t);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,t){const{active:s,onPending:i}=this.props;i(s,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(is.Click,bC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(is.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:s,initialCoordinates:i,props:o}=this,{onMove:d,options:{activationConstraint:g}}=o;if(!i)return;const h=(t=Sg(e))!=null?t:js,f=_o(i,h);if(!s&&g){if(ky(g)){if(g.tolerance!=null&&Ng(f,g.tolerance))return this.handleCancel();if(Ng(f,g.distance))return this.handleStart()}if(Ny(g)&&Ng(f,g.tolerance))return this.handleCancel();this.handlePending(g,f);return}e.cancelable&&e.preventDefault(),d(h)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===ft.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const wC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ag extends _g{constructor(e){const{event:t}=e,s=di(t.target);super(e,wC,s)}}Ag.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:t}=r,{onActivation:s}=e;return!t.isPrimary||t.button!==0?!1:(s?.({event:t}),!0)}}];const SC={move:{name:"mousemove"},end:{name:"mouseup"}};var Tg;(function(r){r[r.RightClick=2]="RightClick"})(Tg||(Tg={}));class CC extends _g{constructor(e){super(e,SC,di(e.event.target))}}CC.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:t}=r,{onActivation:s}=e;return t.button===Tg.RightClick?!1:(s?.({event:t}),!0)}}];const Dg={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class jC extends _g{constructor(e){super(e,Dg)}static setup(){return window.addEventListener(Dg.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Dg.move.name,e)};function e(){}}}jC.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:t}=r,{onActivation:s}=e;const{touches:i}=t;return i.length>1?!1:(s?.({event:t}),!0)}}];var Do;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(Do||(Do={}));var Nc;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nc||(Nc={}));function kC(r){let{acceleration:e,activator:t=Do.Pointer,canScroll:s,draggingRect:i,enabled:o,interval:d=5,order:g=Nc.TreeOrder,pointerCoordinates:h,scrollableAncestors:f,scrollableAncestorRects:p,delta:y,threshold:x}=r;const w=EC({delta:y,disabled:!o}),[v,S]=I7(),k=j.useRef({x:0,y:0}),A=j.useRef({x:0,y:0}),O=j.useMemo(()=>{switch(t){case Do.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Do.DraggableRect:return i}},[t,i,h]),N=j.useRef(null),D=j.useCallback(()=>{const M=N.current;if(!M)return;const z=k.current.x*A.current.x,K=k.current.y*A.current.y;M.scrollBy(z,K)},[]),$=j.useMemo(()=>g===Nc.TreeOrder?[...f].reverse():f,[g,f]);j.useEffect(()=>{if(!o||!f.length||!O){S();return}for(const M of $){if(s?.(M)===!1)continue;const z=f.indexOf(M),K=p[z];if(!K)continue;const{direction:ye,speed:we}=gC(M,K,O,e,x);for(const J of["x","y"])w[J][ye[J]]||(we[J]=0,ye[J]=0);if(we.x>0||we.y>0){S(),N.current=M,v(D,d),k.current=we,A.current=ye;return}}k.current={x:0,y:0},A.current={x:0,y:0},S()},[e,D,s,S,o,d,JSON.stringify(O),JSON.stringify(w),v,f,$,p,JSON.stringify(x)])}const NC={x:{[mn.Backward]:!1,[mn.Forward]:!1},y:{[mn.Backward]:!1,[mn.Forward]:!1}};function EC(r){let{delta:e,disabled:t}=r;const s=bg(e);return No(i=>{if(t||!s||!i)return NC;const o={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.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}}},[t,e,s])}function _C(r,e){const t=e!=null?r.get(e):void 0,s=t?t.node.current:null;return No(i=>{var o;return e==null?null:(o=s??i)!=null?o:null},[s,e])}function AC(r,e){return j.useMemo(()=>r.reduce((t,s)=>{const{sensor:i}=s,o=i.activators.map(d=>({eventName:d.eventName,handler:e(d.handler,s)}));return[...t,...o]},[]),[r,e])}var Ro;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Ro||(Ro={}));var Rg;(function(r){r.Optimized="optimized"})(Rg||(Rg={}));const Ey=new Map;function TC(r,e){let{dragging:t,dependencies:s,config:i}=e;const[o,d]=j.useState(null),{frequency:g,measure:h,strategy:f}=i,p=j.useRef(r),y=k(),x=ko(y),w=j.useCallback(function(A){A===void 0&&(A=[]),!x.current&&d(O=>O===null?A:O.concat(A.filter(N=>!O.includes(N))))},[x]),v=j.useRef(null),S=No(A=>{if(y&&!t)return Ey;if(!A||A===Ey||p.current!==r||o!=null){const O=new Map;for(let N of r){if(!N)continue;if(o&&o.length>0&&!o.includes(N.id)&&N.rect.current){O.set(N.id,N.rect.current);continue}const D=N.node.current,$=D?new kg(h(D),D):null;N.rect.current=$,$&&O.set(N.id,$)}return O}return A},[r,o,t,y,h]);return j.useEffect(()=>{p.current=r},[r]),j.useEffect(()=>{y||w()},[t,y]),j.useEffect(()=>{o&&o.length>0&&d(null)},[JSON.stringify(o)]),j.useEffect(()=>{y||typeof g!="number"||v.current!==null||(v.current=setTimeout(()=>{w(),v.current=null},g))},[g,y,w,...s]),{droppableRects:S,measureDroppableContainers:w,measuringScheduled:o!=null};function k(){switch(f){case Ro.Always:return!1;case Ro.BeforeDragging:return t;default:return!t}}}function _y(r,e){return No(t=>r?t||(typeof e=="function"?e(r):r):null,[e,r])}function DC(r,e){return _y(r,e)}function RC(r){let{callback:e,disabled:t}=r;const s=xg(e),i=j.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(s)},[s,t]);return j.useEffect(()=>()=>i?.disconnect(),[i]),i}function Ec(r){let{callback:e,disabled:t}=r;const s=xg(e),i=j.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(s)},[t]);return j.useEffect(()=>()=>i?.disconnect(),[i]),i}function OC(r){return new kg(gi(r),r)}function Ay(r,e,t){e===void 0&&(e=OC);const[s,i]=j.useState(null);function o(){i(h=>{if(!r)return null;if(r.isConnected===!1){var f;return(f=h??t)!=null?f:null}const p=e(r);return JSON.stringify(h)===JSON.stringify(p)?h:p})}const d=RC({callback(h){if(r)for(const f of h){const{type:p,target:y}=f;if(p==="childList"&&y instanceof HTMLElement&&y.contains(r)){o();break}}}}),g=Ec({callback:o});return Fs(()=>{o(),r?(g?.observe(r),d?.observe(document.body,{childList:!0,subtree:!0})):(g?.disconnect(),d?.disconnect())},[r]),s}function LC(r){const e=_y(r);return py(r,e)}const Ty=[];function MC(r){const e=j.useRef(r),t=No(s=>r?s&&s!==Ty&&r&&e.current&&r.parentNode===e.current.parentNode?s:kc(r):Ty,[r]);return j.useEffect(()=>{e.current=r},[r]),t}function $C(r){const[e,t]=j.useState(null),s=j.useRef(r),i=j.useCallback(o=>{const d=Cg(o.target);d&&t(g=>g?(g.set(d,jg(d)),new Map(g)):null)},[]);return j.useEffect(()=>{const o=s.current;if(r!==o){d(o);const g=r.map(h=>{const f=Cg(h);return f?(f.addEventListener("scroll",i,{passive:!0}),[f,jg(f)]):null}).filter(h=>h!=null);t(g.length?new Map(g):null),s.current=r}return()=>{d(r),d(o)};function d(g){g.forEach(h=>{const f=Cg(h);f?.removeEventListener("scroll",i)})}},[i,r]),j.useMemo(()=>r.length?e?Array.from(e.values()).reduce((o,d)=>ui(o,d),js):Sy(r):js,[r,e])}function Dy(r,e){e===void 0&&(e=[]);const t=j.useRef(null);return j.useEffect(()=>{t.current=null},e),j.useEffect(()=>{const s=r!==js;s&&!t.current&&(t.current=r),!s&&t.current&&(t.current=null)},[r]),t.current?_o(r,t.current):js}function IC(r){j.useEffect(()=>{if(!Sc)return;const e=r.map(t=>{let{sensor:s}=t;return s.setup==null?void 0:s.setup()});return()=>{for(const t of e)t?.()}},r.map(e=>{let{sensor:t}=e;return t}))}function zC(r,e){return j.useMemo(()=>r.reduce((t,s)=>{let{eventName:i,handler:o}=s;return t[i]=d=>{o(d,e)},t},{}),[r,e])}function Ry(r){return j.useMemo(()=>r?lC(r):null,[r])}const Oy=[];function HC(r,e){e===void 0&&(e=gi);const[t]=r,s=Ry(t?Mn(t):null),[i,o]=j.useState(Oy);function d(){o(()=>r.length?r.map(h=>vy(h)?s:new kg(e(h),h)):Oy)}const g=Ec({callback:d});return Fs(()=>{g?.disconnect(),d(),r.forEach(h=>g?.observe(h))},[r]),i}function PC(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return jo(e)?e:r}function UC(r){let{measure:e}=r;const[t,s]=j.useState(null),i=j.useCallback(f=>{for(const{target:p}of f)if(jo(p)){s(y=>{const x=e(p);return y?{...y,width:x.width,height:x.height}:x});break}},[e]),o=Ec({callback:i}),d=j.useCallback(f=>{const p=PC(f);o?.disconnect(),p&&o?.observe(p),s(p?e(p):null)},[e,o]),[g,h]=Cc(d);return j.useMemo(()=>({nodeRef:g,rect:t,setRef:h}),[t,g,h])}const BC=[{sensor:Ag,options:{}},{sensor:Eg,options:{}}],qC={current:{}},_c={draggable:{measure:my},droppable:{measure:my,strategy:Ro.WhileDragging,frequency:Rg.Optimized},dragOverlay:{measure:gi}};class Oo extends Map{get(e){var t;return e!=null&&(t=super.get(e))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,s;return(t=(s=this.get(e))==null?void 0:s.node.current)!=null?t:void 0}}const GC={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Oo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:jc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:_c,measureDroppableContainers:jc,windowRect:null,measuringScheduled:!1},FC={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:jc,draggableNodes:new Map,over:null,measureDroppableContainers:jc},Ac=j.createContext(FC),Ly=j.createContext(GC);function VC(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Oo}}}function KC(r,e){switch(e.type){case dn.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case dn.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 dn.DragEnd:case dn.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case dn.RegisterDroppable:{const{element:t}=e,{id:s}=t,i=new Oo(r.droppable.containers);return i.set(s,t),{...r,droppable:{...r.droppable,containers:i}}}case dn.SetDroppableDisabled:{const{id:t,key:s,disabled:i}=e,o=r.droppable.containers.get(t);if(!o||s!==o.key)return r;const d=new Oo(r.droppable.containers);return d.set(t,{...o,disabled:i}),{...r,droppable:{...r.droppable,containers:d}}}case dn.UnregisterDroppable:{const{id:t,key:s}=e,i=r.droppable.containers.get(t);if(!i||s!==i.key)return r;const o=new Oo(r.droppable.containers);return o.delete(t),{...r,droppable:{...r.droppable,containers:o}}}default:return r}}function WC(r){let{disabled:e}=r;const{active:t,activatorEvent:s,draggableNodes:i}=j.useContext(Ac),o=bg(s),d=bg(t?.id);return j.useEffect(()=>{if(!e&&!s&&o&&d!=null){if(!wg(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 y=P7(p);if(y){y.focus();break}}})}},[s,e,i,d,o]),null}function YC(r,e){let{transform:t,...s}=e;return r!=null&&r.length?r.reduce((i,o)=>o({transform:i,...s}),t):t}function JC(r){return j.useMemo(()=>({draggable:{..._c.draggable,...r?.draggable},droppable:{..._c.droppable,...r?.droppable},dragOverlay:{..._c.dragOverlay,...r?.dragOverlay}}),[r?.draggable,r?.droppable,r?.dragOverlay])}function XC(r){let{activeNode:e,measure:t,initialRect:s,config:i=!0}=r;const o=j.useRef(!1),{x:d,y:g}=typeof i=="boolean"?{x:i,y:i}:i;Fs(()=>{if(!d&&!g||!e){o.current=!1;return}if(o.current||!s)return;const f=e?.node.current;if(!f||f.isConnected===!1)return;const p=t(f),y=py(p,s);if(d||(y.x=0),g||(y.y=0),o.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const x=yy(f);x&&x.scrollBy({top:y.y,left:y.x})}},[e,d,g,s,t])}const My=j.createContext({...js,scaleX:1,scaleY:1});var $a;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})($a||($a={}));const QC=j.memo(function(e){var t,s,i,o;let{id:d,accessibility:g,autoScroll:h=!0,children:f,sensors:p=BC,collisionDetection:y=tC,measuring:x,modifiers:w,...v}=e;const S=j.useReducer(KC,void 0,VC),[k,A]=S,[O,N]=V7(),[D,$]=j.useState($a.Uninitialized),M=D===$a.Initialized,{draggable:{active:z,nodes:K,translate:ye},droppable:{containers:we}}=k,J=z!=null?K.get(z):null,ve=j.useRef({initial:null,translated:null}),le=j.useMemo(()=>{var Pe;return z!=null?{id:z,data:(Pe=J?.data)!=null?Pe:qC,rect:ve}:null},[z,J]),de=j.useRef(null),[je,W]=j.useState(null),[he,ee]=j.useState(null),X=ko(v,Object.values(v)),se=Eo("DndDescribedBy",d),R=j.useMemo(()=>we.getEnabled(),[we]),q=JC(x),{droppableRects:re,measureDroppableContainers:xe,measuringScheduled:oe}=TC(R,{dragging:M,dependencies:[ye.x,ye.y],config:q.droppable}),ke=_C(K,z),Oe=j.useMemo(()=>he?Sg(he):null,[he]),De=ze(),qe=DC(ke,q.draggable.measure);XC({activeNode:z!=null?K.get(z):null,config:De.layoutShiftCompensation,initialRect:qe,measure:q.draggable.measure});const Ie=Ay(ke,q.draggable.measure,qe),Nt=Ay(ke?ke.parentElement:null),Rt=j.useRef({activatorEvent:null,active:null,activeNode:ke,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:K,draggingNode:null,draggingNodeRect:null,droppableContainers:we,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xt=we.getNodeFor((t=Rt.current.over)==null?void 0:t.id),Mt=UC({measure:q.dragOverlay.measure}),Qt=(s=Mt.nodeRef.current)!=null?s:ke,Et=M?(i=Mt.rect)!=null?i:Ie:null,Dn=!!(Mt.nodeRef.current&&Mt.rect),Ce=LC(Dn?null:Ie),Ge=Ry(Qt?Mn(Qt):null),at=MC(M?Xt??ke:null),pt=HC(at),bt=YC(w,{transform:{x:ye.x-Ce.x,y:ye.y-Ce.y,scaleX:1,scaleY:1},activatorEvent:he,active:le,activeNodeRect:Ie,containerNodeRect:Nt,draggingNodeRect:Et,over:Rt.current.over,overlayNodeRect:Mt.rect,scrollableAncestors:at,scrollableAncestorRects:pt,windowRect:Ge}),_t=Oe?ui(Oe,ye):null,mt=$C(at),tt=Dy(mt),vn=Dy(mt,[Ie]),wt=ui(bt,tt),Tt=Et?aC(Et,bt):null,qt=le&&Tt?y({active:le,collisionRect:Tt,droppableRects:re,droppableContainers:R,pointerCoordinates:_t}):null,Jn=hy(qt,"id"),[un,Rs]=j.useState(null),ds=Dn?bt:ui(bt,vn),V=nC(ds,(o=un?.rect)!=null?o:null,Ie),me=j.useRef(null),ue=j.useCallback((Pe,Te)=>{let{sensor:Fe,options:We}=Te;if(de.current==null)return;const Je=K.get(de.current);if(!Je)return;const rt=Pe.nativeEvent,Ue=new Fe({active:de.current,activeNode:Je,event:rt,options:We,context:Rt,onAbort($e){if(!K.get($e))return;const{onDragAbort:Dt}=X.current,tn={id:$e};Dt?.(tn),O({type:"onDragAbort",event:tn})},onPending($e,lt,Dt,tn){if(!K.get($e))return;const{onDragPending:Xn}=X.current,Qn={id:$e,constraint:lt,initialCoordinates:Dt,offset:tn};Xn?.(Qn),O({type:"onDragPending",event:Qn})},onStart($e){const lt=de.current;if(lt==null)return;const Dt=K.get(lt);if(!Dt)return;const{onDragStart:tn}=X.current,xn={activatorEvent:rt,active:{id:lt,data:Dt.data,rect:ve}};Ma.unstable_batchedUpdates(()=>{tn?.(xn),$($a.Initializing),A({type:dn.DragStart,initialCoordinates:$e,active:lt}),O({type:"onDragStart",event:xn}),W(me.current),ee(rt)})},onMove($e){A({type:dn.DragMove,coordinates:$e})},onEnd:Re(dn.DragEnd),onCancel:Re(dn.DragCancel)});me.current=Ue;function Re($e){return async function(){const{active:Dt,collisions:tn,over:xn,scrollAdjustedTranslate:Xn}=Rt.current;let Qn=null;if(Dt&&Xn){const{cancelDrop:Ws}=X.current;Qn={activatorEvent:rt,active:Dt,collisions:tn,delta:Xn,over:xn},$e===dn.DragEnd&&typeof Ws=="function"&&await Promise.resolve(Ws(Qn))&&($e=dn.DragCancel)}de.current=null,Ma.unstable_batchedUpdates(()=>{A({type:$e}),$($a.Uninitialized),Rs(null),W(null),ee(null),me.current=null;const Ws=$e===dn.DragEnd?"onDragEnd":"onDragCancel";if(Qn){const zn=X.current[Ws];zn?.(Qn),O({type:Ws,event:Qn})}})}}},[K]),ne=j.useCallback((Pe,Te)=>(Fe,We)=>{const Je=Fe.nativeEvent,rt=K.get(We);if(de.current!==null||!rt||Je.dndKit||Je.defaultPrevented)return;const Ue={active:rt};Pe(Fe,Te.options,Ue)===!0&&(Je.dndKit={capturedBy:Te.sensor},de.current=We,ue(Fe,Te))},[K,ue]),_e=AC(p,ne);IC(p),Fs(()=>{Ie&&D===$a.Initializing&&$($a.Initialized)},[Ie,D]),j.useEffect(()=>{const{onDragMove:Pe}=X.current,{active:Te,activatorEvent:Fe,collisions:We,over:Je}=Rt.current;if(!Te||!Fe)return;const rt={active:Te,activatorEvent:Fe,collisions:We,delta:{x:wt.x,y:wt.y},over:Je};Ma.unstable_batchedUpdates(()=>{Pe?.(rt),O({type:"onDragMove",event:rt})})},[wt.x,wt.y]),j.useEffect(()=>{const{active:Pe,activatorEvent:Te,collisions:Fe,droppableContainers:We,scrollAdjustedTranslate:Je}=Rt.current;if(!Pe||de.current==null||!Te||!Je)return;const{onDragOver:rt}=X.current,Ue=We.get(Jn),Re=Ue&&Ue.rect.current?{id:Ue.id,rect:Ue.rect.current,data:Ue.data,disabled:Ue.disabled}:null,$e={active:Pe,activatorEvent:Te,collisions:Fe,delta:{x:Je.x,y:Je.y},over:Re};Ma.unstable_batchedUpdates(()=>{Rs(Re),rt?.($e),O({type:"onDragOver",event:$e})})},[Jn]),Fs(()=>{Rt.current={activatorEvent:he,active:le,activeNode:ke,collisionRect:Tt,collisions:qt,droppableRects:re,draggableNodes:K,draggingNode:Qt,draggingNodeRect:Et,droppableContainers:we,over:un,scrollableAncestors:at,scrollAdjustedTranslate:wt},ve.current={initial:Et,translated:Tt}},[le,ke,qt,Tt,K,Qt,Et,re,we,un,at,wt]),kC({...De,delta:ye,draggingRect:Tt,pointerCoordinates:_t,scrollableAncestors:at,scrollableAncestorRects:pt});const Ae=j.useMemo(()=>({active:le,activeNode:ke,activeNodeRect:Ie,activatorEvent:he,collisions:qt,containerNodeRect:Nt,dragOverlay:Mt,draggableNodes:K,droppableContainers:we,droppableRects:re,over:un,measureDroppableContainers:xe,scrollableAncestors:at,scrollableAncestorRects:pt,measuringConfiguration:q,measuringScheduled:oe,windowRect:Ge}),[le,ke,Ie,he,qt,Nt,Mt,K,we,re,un,xe,at,pt,q,oe,Ge]),Me=j.useMemo(()=>({activatorEvent:he,activators:_e,active:le,activeNodeRect:Ie,ariaDescribedById:{draggable:se},dispatch:A,draggableNodes:K,over:un,measureDroppableContainers:xe}),[he,_e,le,Ie,A,se,K,un,xe]);return Ke.createElement(ly.Provider,{value:N},Ke.createElement(Ac.Provider,{value:Me},Ke.createElement(Ly.Provider,{value:Ae},Ke.createElement(My.Provider,{value:V},f)),Ke.createElement(WC,{disabled:g?.restoreFocus===!1})),Ke.createElement(Y7,{...g,hiddenTextDescribedById:se}));function ze(){const Pe=je?.autoScrollEnabled===!1,Te=typeof h=="object"?h.enabled===!1:h===!1,Fe=M&&!Pe&&!Te;return typeof h=="object"?{...h,enabled:Fe}:{enabled:Fe}}}),ZC=j.createContext(null),$y="button",ej="Draggable";function tj(r){let{id:e,data:t,disabled:s=!1,attributes:i}=r;const o=Eo(ej),{activators:d,activatorEvent:g,active:h,activeNodeRect:f,ariaDescribedById:p,draggableNodes:y,over:x}=j.useContext(Ac),{role:w=$y,roleDescription:v="draggable",tabIndex:S=0}=i??{},k=h?.id===e,A=j.useContext(k?My:ZC),[O,N]=Cc(),[D,$]=Cc(),M=zC(d,e),z=ko(t);Fs(()=>(y.set(e,{id:e,key:o,node:O,activatorNode:D,data:z}),()=>{const ye=y.get(e);ye&&ye.key===o&&y.delete(e)}),[y,e]);const K=j.useMemo(()=>({role:w,tabIndex:S,"aria-disabled":s,"aria-pressed":k&&w===$y?!0:void 0,"aria-roledescription":v,"aria-describedby":p.draggable}),[s,w,S,k,v,p.draggable]);return{active:h,activatorEvent:g,activeNodeRect:f,attributes:K,isDragging:k,listeners:s?void 0:M,node:O,over:x,setNodeRef:N,setActivatorNodeRef:$,transform:A}}function nj(){return j.useContext(Ly)}const sj="Droppable",aj={timeout:25};function rj(r){let{data:e,disabled:t=!1,id:s,resizeObserverConfig:i}=r;const o=Eo(sj),{active:d,dispatch:g,over:h,measureDroppableContainers:f}=j.useContext(Ac),p=j.useRef({disabled:t}),y=j.useRef(!1),x=j.useRef(null),w=j.useRef(null),{disabled:v,updateMeasurementsFor:S,timeout:k}={...aj,...i},A=ko(S??s),O=j.useCallback(()=>{if(!y.current){y.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=Ec({callback:O,disabled:v||!d}),D=j.useCallback((K,ye)=>{N&&(ye&&(N.unobserve(ye),y.current=!1),K&&N.observe(K))},[N]),[$,M]=Cc(D),z=ko(e);return j.useEffect(()=>{!N||!$.current||(N.disconnect(),y.current=!1,N.observe($.current))},[$,N]),j.useEffect(()=>(g({type:dn.RegisterDroppable,element:{id:s,key:o,disabled:t,node:$,rect:x,data:z}}),()=>g({type:dn.UnregisterDroppable,key:o,id:s})),[s]),j.useEffect(()=>{t!==p.current.disabled&&(g({type:dn.SetDroppableDisabled,id:s,key:o,disabled:t}),p.current.disabled=t)},[s,o,t,g]),{active:d,rect:x,isOver:h?.id===s,node:$,over:h,setNodeRef:M}}function Og(r,e,t){const s=r.slice();return s.splice(t<0?s.length+t:t,0,s.splice(e,1)[0]),s}function ij(r,e){return r.reduce((t,s,i)=>{const o=e.get(s);return o&&(t[i]=o),t},Array(r.length))}function Tc(r){return r!==null&&r>=0}function oj(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function lj(r){return typeof r=="boolean"?{draggable:r,droppable:r}:r}const Dc={scaleX:1,scaleY:1},cj=r=>{var e;let{rects:t,activeNodeRect:s,activeIndex:i,overIndex:o,index:d}=r;const g=(e=t[i])!=null?e:s;if(!g)return null;const h=dj(t,d,i);if(d===i){const f=t[o];return f?{x:i<o?f.left+f.width-(g.left+g.width):f.left-g.left,y:0,...Dc}:null}return d>i&&d<=o?{x:-g.width-h,y:0,...Dc}:d<i&&d>=o?{x:g.width+h,y:0,...Dc}:{x:0,y:0,...Dc}};function dj(r,e,t){const s=r[e],i=r[e-1],o=r[e+1];return!s||!i&&!o?0:t<e?i?s.left-(i.left+i.width):o.left-(s.left+s.width):o?o.left-(s.left+s.width):s.left-(i.left+i.width)}const Lg=r=>{let{rects:e,activeIndex:t,overIndex:s,index:i}=r;const o=Og(e,s,t),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}},Rc={scaleX:1,scaleY:1},uj=r=>{var e;let{activeIndex:t,activeNodeRect:s,index:i,rects:o,overIndex:d}=r;const g=(e=o[t])!=null?e:s;if(!g)return null;if(i===t){const f=o[d];return f?{x:0,y:t<d?f.top+f.height-(g.top+g.height):f.top-g.top,...Rc}:null}const h=gj(o,i,t);return i>t&&i<=d?{x:0,y:-g.height-h,...Rc}:i<t&&i>=d?{x:0,y:g.height+h,...Rc}:{x:0,y:0,...Rc}};function gj(r,e,t){const s=r[e],i=r[e-1],o=r[e+1];return s?t<e?i?s.top-(i.top+i.height):o?o.top-(s.top+s.height):0:o?o.top-(s.top+s.height):i?s.top-(i.top+i.height):0:0}const Iy="Sortable",zy=Ke.createContext({activeIndex:-1,containerId:Iy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Lg,disabled:{draggable:!1,droppable:!1}});function hj(r){let{children:e,id:t,items:s,strategy:i=Lg,disabled:o=!1}=r;const{active:d,dragOverlay:g,droppableRects:h,over:f,measureDroppableContainers:p}=nj(),y=Eo(Iy,t),x=g.rect!==null,w=j.useMemo(()=>s.map(M=>typeof M=="object"&&"id"in M?M.id:M),[s]),v=d!=null,S=d?w.indexOf(d.id):-1,k=f?w.indexOf(f.id):-1,A=j.useRef(w),O=!oj(w,A.current),N=k!==-1&&S===-1||O,D=lj(o);Fs(()=>{O&&v&&p(w)},[O,w,v,p]),j.useEffect(()=>{A.current=w},[w]);const $=j.useMemo(()=>({activeIndex:S,containerId:y,disabled:D,disableTransforms:N,items:w,overIndex:k,useDragOverlay:x,sortedRects:ij(w,h),strategy:i}),[S,y,D.draggable,D.droppable,N,w,k,h,x,i]);return Ke.createElement(zy.Provider,{value:$},e)}const fj=r=>{let{id:e,items:t,activeIndex:s,overIndex:i}=r;return Og(t,s,i).indexOf(e)},pj=r=>{let{containerId:e,isSorting:t,wasDragging:s,index:i,items:o,newIndex:d,previousItems:g,previousContainerId:h,transition:f}=r;return!f||!s||g!==o&&i===d?!1:t?!0:d!==i&&e===h},mj={duration:200,easing:"ease"},Hy="transform",yj=Ao.Transition.toString({property:Hy,duration:0,easing:"linear"}),xj={roleDescription:"sortable"};function bj(r){let{disabled:e,index:t,node:s,rect:i}=r;const[o,d]=j.useState(null),g=j.useRef(t);return Fs(()=>{if(!e&&t!==g.current&&s.current){const h=i.current;if(h){const f=gi(s.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)}}t!==g.current&&(g.current=t)},[e,t,s,i]),j.useEffect(()=>{o&&d(null)},[o]),o}function vj(r){let{animateLayoutChanges:e=pj,attributes:t,disabled:s,data:i,getNewIndex:o=fj,id:d,strategy:g,resizeObserverConfig:h,transition:f=mj}=r;const{items:p,containerId:y,activeIndex:x,disabled:w,disableTransforms:v,sortedRects:S,overIndex:k,useDragOverlay:A,strategy:O}=j.useContext(zy),N=wj(s,w),D=p.indexOf(d),$=j.useMemo(()=>({sortable:{containerId:y,index:D,items:p},...i}),[y,i,D,p]),M=j.useMemo(()=>p.slice(p.indexOf(d)),[p,d]),{rect:z,node:K,isOver:ye,setNodeRef:we}=rj({id:d,data:$,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...h}}),{active:J,activatorEvent:ve,activeNodeRect:le,attributes:de,setNodeRef:je,listeners:W,isDragging:he,over:ee,setActivatorNodeRef:X,transform:se}=tj({id:d,data:$,attributes:{...xj,...t},disabled:N.draggable}),R=$7(we,je),q=!!J,re=q&&!v&&Tc(x)&&Tc(k),xe=!A&&he,oe=xe&&re?se:null,Oe=re?oe??(g??O)({rects:S,activeNodeRect:le,activeIndex:x,overIndex:k,index:D}):null,De=Tc(x)&&Tc(k)?o({id:d,items:p,activeIndex:x,overIndex:k}):D,qe=J?.id,Ie=j.useRef({activeId:qe,items:p,newIndex:De,containerId:y}),Nt=p!==Ie.current.items,Rt=e({active:J,containerId:y,isDragging:he,isSorting:q,id:d,index:D,items:p,newIndex:Ie.current.newIndex,previousItems:Ie.current.items,previousContainerId:Ie.current.containerId,transition:f,wasDragging:Ie.current.activeId!=null}),Xt=bj({disabled:!Rt,index:D,node:K,rect:z});return j.useEffect(()=>{q&&Ie.current.newIndex!==De&&(Ie.current.newIndex=De),y!==Ie.current.containerId&&(Ie.current.containerId=y),p!==Ie.current.items&&(Ie.current.items=p)},[q,De,y,p]),j.useEffect(()=>{if(qe===Ie.current.activeId)return;if(qe!=null&&Ie.current.activeId==null){Ie.current.activeId=qe;return}const Qt=setTimeout(()=>{Ie.current.activeId=qe},50);return()=>clearTimeout(Qt)},[qe]),{active:J,activeIndex:x,attributes:de,data:$,rect:z,index:D,newIndex:De,items:p,isOver:ye,isSorting:q,isDragging:he,listeners:W,node:K,overIndex:k,over:ee,setNodeRef:R,setActivatorNodeRef:X,setDroppableNodeRef:we,setDraggableNodeRef:je,transform:Xt??Oe,transition:Mt()};function Mt(){if(Xt||Nt&&Ie.current.newIndex===D)return yj;if(!(xe&&!wg(ve)||!f)&&(q||Rt))return Ao.Transition.toString({...f,property:Hy})}}function wj(r,e){var t,s;return typeof r=="boolean"?{draggable:r,droppable:!1}:{draggable:(t=r?.draggable)!=null?t:e.draggable,droppable:(s=r?.droppable)!=null?s:e.droppable}}function Oc(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 Sj=[ft.Down,ft.Right,ft.Up,ft.Left],Cj=(r,e)=>{let{context:{active:t,collisionRect:s,droppableRects:i,droppableContainers:o,over:d,scrollableAncestors:g}}=e;if(Sj.includes(r.code)){if(r.preventDefault(),!t||!s)return;const h=[];o.getEnabled().forEach(y=>{if(!y||y!=null&&y.disabled)return;const x=i.get(y.id);if(x)switch(r.code){case ft.Down:s.top<x.top&&h.push(y);break;case ft.Up:s.top>x.top&&h.push(y);break;case ft.Left:s.left>x.left&&h.push(y);break;case ft.Right:s.left<x.left&&h.push(y);break}});const f=Z7({collisionRect:s,droppableRects:i,droppableContainers:h});let p=hy(f,"id");if(p===d?.id&&f.length>1&&(p=f[1].id),p!=null){const y=o.get(t.id),x=o.get(p),w=x?i.get(x.id):null,v=x?.node.current;if(v&&w&&y&&x){const k=kc(v).some((M,z)=>g[z]!==M),A=Py(y,x),O=jj(y,x),N=k||!A?{x:0,y:0}:{x:O?s.width-w.width:0,y:O?s.height-w.height:0},D={x:w.left,y:w.top};return N.x&&N.y?D:_o(D,N)}}}};function Py(r,e){return!Oc(r)||!Oc(e)?!1:r.data.current.sortable.containerId===e.data.current.sortable.containerId}function jj(r,e){return!Oc(r)||!Oc(e)||!Py(r,e)?!1:r.data.current.sortable.index<e.data.current.sortable.index}const kj={verticalList:uj,horizontalList:cj,rectSorting:Lg},Nj=({items:r,itemKey:e,strategy:t,children:s,onSortEnd:i,onSortStart:o,sortVersion:d})=>{const g=j.useId(),h=j.useRef({inProgress:!1,lastSortTime:0,lastActiveId:null}),f=J7(cy(Ag,{activationConstraint:{distance:5}}),cy(Eg,{coordinateGetter:Cj})),p=j.useCallback(w=>{h.current={inProgress:!0,lastSortTime:Date.now(),lastActiveId:w.active.id},o?.({activeId:w.active.id})},[o]),y=j.useCallback(w=>{const{active:v,over:S}=w,k=Date.now();if(!S||v.id===S.id){h.current.inProgress=!1;return}const{lastSortTime:A,lastActiveId:O,inProgress:N}=h.current;if(O===v.id&&k-A<500&&!N)return;h.current={inProgress:!1,lastSortTime:k,lastActiveId:v.id};const D=r.findIndex(M=>String(M[e])===String(v.id)),$=r.findIndex(M=>String(M[e])===String(S.id));if(D!==-1&&$!==-1&&D!==$){const M=Og(r,D,$);i?.(M,{oldIndex:D,newIndex:$})}},[r,e,i]),x=r.map(w=>String(w[e]));return l.jsx(QC,{id:g,sensors:f,collisionDetection:Q7,onDragStart:p,onDragEnd:y,children:l.jsx(hj,{items:x,strategy:kj[t],children:s})},d!==void 0?`${g}-v${d}`:g)},Uy=j.createContext(null),Ej=({value:r,children:e})=>l.jsx(Uy.Provider,{value:r,children:e}),_j=()=>j.useContext(Uy),Aj=({id:r,handle:e,as:t="div",children:s})=>{const{attributes:i,listeners:o,setNodeRef:d,transform:g,transition:h,isDragging:f}=vj({id:r}),p={transform:Ao.Transform.toString(g),transition:h,opacity:f?.5:1,position:"relative"};return l.jsx(t,{ref:d,style:p,...i,...e?{}:o,"data-sortable-item":!0,"data-sortable-id":String(r),"data-dragging":f,children:l.jsx(Ej,{value:{listeners:o,handle:e,isDragging:f},children:s})})},vt=nt("DynamicRenderer");function oa(){try{return window.G7Core?.devTools}catch{return}}function Tj(r){const e=Object.keys(r);return e.length>0&&e.every(t=>/^\d+$/.test(t))}const ks=(r,e)=>{const t=["errors"],s={...r};for(const i of Object.keys(e)){const o=e[i],d=r[i];if(o===null){s[i]=null;continue}if(t.includes(i)){s[i]=o;continue}if(Array.isArray(o)){s[i]=o;continue}if(Array.isArray(d)&&o!==null&&typeof o=="object"&&!Array.isArray(o)&&Tj(o)){const g=Object.keys(o).map(f=>parseInt(f,10));if((g.length>0?Math.max(...g):0)>=d.length+g.length+10)s[i]={...o};else{const f=[...d];for(const[p,y]of Object.entries(o)){const x=parseInt(p,10);x>=0&&x<f.length?y!==null&&typeof y=="object"&&!Array.isArray(y)&&f[x]!==null&&typeof f[x]=="object"?f[x]=ks(f[x],y):f[x]=y:x>=f.length&&(f[x]=y)}s[i]=f}}else o!==null&&typeof o=="object"&&d!==null&&typeof d=="object"&&!Array.isArray(d)?s[i]=ks(d,o):s[i]=o}return s},By=(r,e)=>{const t={...r};for(const s of Object.keys(e)){if(!(s in t))continue;const i=e[s],o=t[s];if(i!==null&&typeof i=="object"&&!Array.isArray(i)&&o!==null&&typeof o=="object"&&!Array.isArray(o)){const d=By(o,i);Object.keys(d).length===0?delete t[s]:t[s]=d}else delete t[s]}return t},Dj=r=>{const e={},t=r.split(";").filter(s=>s.trim());for(const s of t){const i=s.indexOf(":");if(i===-1)continue;const o=s.substring(0,i).trim(),d=s.substring(i+1).trim();if(o&&d){const g=o.replace(/-([a-z])/g,(h,f)=>f.toUpperCase());e[g]=d}}return e};class Rj extends j.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){vt.error(`컴포넌트 렌더링 에러 (ID: ${this.props.componentId}, Name: ${this.props.componentName}):`,e,t)}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 Vs=j.memo(({componentDef:r,dataContext:e,translationContext:t,registry:s,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:g,parentFormContextProp:h,parentDataContext:f,isRootRenderer:p=!1,isInsideIteration:y=!1,isEditMode:x=!1,onComponentSelect:w,onComponentHover:v,onDragStart:S,onDragEnd:k,componentPath:A,layoutKey:O})=>{const[N,D]=j.useState({loadingActions:{}});j.useLayoutEffect(()=>{g||(i.startRenderCycle(),window.__g7SetLocalOverrideKeys||(window.__g7ForcedLocalFields=void 0),window.__g7PendingLocalState=null)});const $=j.useRef(null);j.useLayoutEffect(()=>{if(!g&&e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:V,_merge:me,...ue}=e._localInit,ne=`${JSON.stringify(ue)}:${V||"no-force"}`;if($.current!==ne){$.current=ne;const _e=me||"shallow",Me=window.G7Core?.state?.get?.()?._local||{},ze=window.__g7PendingLocalState||{},Pe={...Me,...ze};_e==="replace"?window.__g7PendingLocalState={loadingActions:Pe.loadingActions||{},...ue,hasChanges:!1}:_e==="deep"?window.__g7PendingLocalState=ks(Pe,{...ue,hasChanges:!1}):window.__g7PendingLocalState={...Pe,...ue,hasChanges:!1};const Te=window.__g7SetLocalOverrideKeys;Te&&typeof Te=="object"&&(_e==="replace"?window.__g7SetLocalOverrideKeys={...ue,hasChanges:!1}:window.__g7SetLocalOverrideKeys=ks(Te,{...ue,hasChanges:!1}))}}}),j.useLayoutEffect(()=>{if(!g){const V=window.__g7SetLocalOverrideKeys;if(V){D(_e=>By(_e,V));const me=V,ue=window.__g7ForcedLocalFields,ne=window.__g7LastSetLocalSnapshot;queueMicrotask(()=>{window.__g7SetLocalOverrideKeys===me&&(window.__g7SetLocalOverrideKeys=void 0),window.__g7ForcedLocalFields===ue&&(window.__g7ForcedLocalFields=void 0),window.__g7LastSetLocalSnapshot===ne&&(window.__g7LastSetLocalSnapshot=void 0)})}}},[e._local]);const M=j.useRef(O);j.useEffect(()=>{r._fromBase&&O&&M.current!==O&&(M.current=O,D({loadingActions:{}}))},[O,r._fromBase]);const z=j.useRef(""),K=j.useRef(!1),ye=j.useRef(null),we=j.useRef({}),J=j.useRef({}),ve=j.useRef(f),le=M7(),de=m7(),je=de?.getParentDataContext()??f;j.useEffect(()=>{if(e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:V,...me}=e._localInit,ue=JSON.stringify(me),ne=V!==void 0,_e="__g7LocalInitTracking";window[_e]||(window[_e]={hash:"",timestamp:void 0});const Ae=window[_e],Me=`${ue}:${V||"no-force"}`;if(Ae.hash!==Me){Ae.hash=Me,Ae.timestamp=V,z.current=ue,ne&&(K.current=!0);const{_merge:Te,...Fe}=me,We=Te||"shallow";if(D(Je=>We==="replace"?{loadingActions:Je.loadingActions||{},...Fe,hasChanges:!1}:We==="deep"?ks(Je,{...Fe,hasChanges:!1}):{...Je,...Fe,hasChanges:!1}),e._globalSetState){const Je=e._global?._local||{};let rt;We==="replace"?rt={...Fe,hasChanges:!1}:We==="deep"?rt=ks(Je,{...Fe,hasChanges:!1}):rt={...Je,...Fe,hasChanges:!1},e._globalSetState({_local:rt})}i.invalidateCacheByKeys(["_local"]),vt.log("_localInit applied (data changed):",Object.keys(me))}ye.current=e._localInit}},[e._localInit,f,i]);const{isTransitioning:W}=Xm(),he=N7(),ee=h??he,{width:X}=ey(),se=_j(),R=j.useMemo(()=>{let V=r;if(r.type==="iterator"&&r.data){const{data:ne,itemName:_e,indexName:Ae,...Me}=r;V={...Me,iteration:{source:ne,item_var:_e||"item",index_var:Ae}}}if(!V.responsive)return V;const me=ti.getMatchingKey(V.responsive,X);if(!me)return V;const ue=V.responsive[me];return{...V,props:{...V.props,...ue.props},children:ue.children??V.children,text:ue.text??V.text,if:ue.if??V.if,iteration:ue.iteration??V.iteration}},[r,X]),q=j.useCallback(V=>{const me=V?.__setStateId;if(D(ue=>{const ne=window.__g7PendingLocalState,Ae=window.__g7SetLocalOverrideKeys||ne,Me=Ae?ks(ue,Ae):ue;if(typeof V=="function"){const We=V(Me);return ks(Me,We)}const{__mergeMode:ze,__setStateId:Pe,...Te}=V;let Fe;if(ze==="replace"?Fe=Te:ze==="shallow"?Fe={...Me,...Te}:Fe=ks(Me,Te),ze!==void 0){const We=window.__g7ForcedLocalFields;We&&(window.__g7ForcedLocalFields={...We,...Te})}return Fe}),me){const ue=oa();if(ue?.isEnabled()){const ne=R.id||"unknown",_e=R.name||"Unknown";setTimeout(()=>{ue.trackComponentRender?.(ne,_e,0,["_local"],[]),ue.completeStateChange?.(me)},0)}}},[R.id,R.name]),re=g?.state??N,xe=g?.setState??q,oe=j.useMemo(()=>{const V=e._localInit&&e._localInit!==ye.current;let me;V&&e._local?me=e._local:me=e._local?ks(e._local,re):re;const ue=window.__g7ForcedLocalFields;ue&&(me=ks(me,ue));const ne={...e,_local:me},_e=e._computedDefinitions;if(_e&&Object.keys(_e).length>0){const Ae=new An,Me={...ne,...le?{_isolated:le.state}:{}},ze={},Pe=oa(),Te=Pe?.isEnabled()??!1;for(const[Fe,We]of Object.entries(_e)){const Je=Te?Date.now():0,rt=Te?e._computed?.[Fe]:void 0;let Ue;try{if(typeof We=="string")if(We.startsWith("{{")&&We.endsWith("}}")){const Re=We.slice(2,-2).trim(),$e=Ae.evaluateExpression(Re,Me,{skipCache:!0});ze[Fe]=$e}else ze[Fe]=We;else if(We&&typeof We=="object"&&"$switch"in We){const Re=Ae.resolveSwitch(We,Me,{skipCache:!0});ze[Fe]=Re}}catch(Re){vt.warn(`Failed to recalculate computed value: ${Fe}`,Re),ze[Fe]=e._computed?.[Fe],Ue=Re instanceof Error?Re.message:String(Re)}if(Te&&(Ue||rt!==ze[Fe])){const $e=Date.now()-Je;Pe.trackComputedProperty?.(Fe,typeof We=="string"?We:JSON.stringify(We),[{type:"_local",path:"_local",value:ne._local}],ze[Fe],$e,R.id,Ue),rt!==ze[Fe]&&Pe.trackComputedRecalc?.(Fe,"dependency-change",rt,ze[Fe],$e,{type:"_local",path:"_local"},R.id)}}ne._computed=ze}return le&&(ne._isolated=le.state),je&&(ne.$parent=je),r.extensionPointProps&&(ne.extensionPointProps=i.resolveObject(r.extensionPointProps,ne,y?{skipCache:!0}:void 0)),r.extensionPointCallbacks&&(ne.extensionPointCallbacks=r.extensionPointCallbacks),ne},[e,re,le?.state,je,de?.version,r.extensionPointProps,r.extensionPointCallbacks]);we.current=oe._local,J.current=oe._computed||{},ve.current=je,j.useEffect(()=>{const V=oa();if(!V?.isEnabled())return;const me=oe._local;me&&V.updateLocalState(me);const ue=oe._computed;ue&&V.updateComputedState(ue),je&&V.updateParentContext?.(je);const ne=R.id||`comp-${Date.now()}`,_e=R.name||"Unknown",Ae={global:Object.keys(e._global||{}),local:Object.keys(me||{}),context:g?Object.keys(g.state||{}):[]},Me={type:g?"componentContext":"dynamicState",hasComponentContext:!!g,parentId:g?"parent":void 0};V.trackComponentStateSource?.(ne,_e,Ae,Me),re&&Object.keys(re).length>0&&V.trackDynamicState?.(ne,re);const ze=!!(R.expandChildren||R.props?.expandChildren);V.trackContextFlow?.(ne,_e,!!g,ze,!0)},[oe._local,e,R.id,R.name,g,re,R.expandChildren,R.props?.expandChildren,je]);const ke=j.useMemo(()=>({state:{...oe._local},setState:xe,stateRef:we,computedRef:J,isolatedContext:le,parentDataContext:oe}),[oe._local,xe,N,le,oe]),Oe=j.useMemo(()=>{const V=ni({if:R.if,condition:R.condition,conditions:R.conditions},oe,i,R.id);if(R.if||R.condition!==void 0||R.conditions){const ue=oa();ue?.isEnabled()&&R.if&&ue.trackIfCondition(R.id||`if-${Date.now()}`,R.if,V)}return V},[R.if,R.conditions,oe,i,R.id]),De=j.useMemo(()=>{if(!R.slot)return null;const V=R.slot;if(V.startsWith("{{")&&V.endsWith("}}")){const me=V.slice(2,-2).trim();try{const ue={componentId:R.id,componentName:R.name,propName:"slot"},ne=i.evaluateExpression(me,oe,ue);return vt.log(`[Slot] 표현식 평가: "${me}" => "${ne}" (컴포넌트: ${R.id})`),typeof ne=="string"?ne:null}catch(ue){return vt.warn(`slot 표현식 평가 실패 (컴포넌트: ${R.id}):`,ue),null}}return vt.log(`[Slot] 정적 슬롯 ID: "${V}" (컴포넌트: ${R.id})`),V},[R.slot,R.id,oe,i]),qe=j.useMemo(()=>!De||!R.id?"":`${R.id}-${De}-${JSON.stringify(R.slotOrder??0)}`,[De,R.id,R.slotOrder]),Ie=j.useRef(null);j.useEffect(()=>{const V=window.__slotContextValue,me=V?.isEnabled??!1;if(R.slot&&vt.log(`[Slot Registration] 컴포넌트: ${R.id}, isSlotEnabled: ${me}, shouldRender: ${Oe}, resolvedSlotId: ${De}`),!me||!Oe){R.slot&&vt.log(`[Slot Registration] 등록 스킵 - isSlotEnabled: ${me}, shouldRender: ${Oe}`),Ie.current&&R.id&&V&&(V.unregisterFromSlot(Ie.current,R.id),Ie.current=null);return}if(!De||!R.id){R.slot&&vt.log(`[Slot Registration] 등록 스킵 - resolvedSlotId: ${De}, id: ${R.id}`),Ie.current&&R.id&&V&&(V.unregisterFromSlot(Ie.current,R.id),Ie.current=null);return}Ie.current&&Ie.current!==De&&V.unregisterFromSlot(Ie.current,R.id);const ue={...R,slot:void 0,slotOrder:void 0};return V.registerToSlot(De,R.id,{componentDef:ue,dataContext:e,order:R.slotOrder??0,parentFormContext:h??null,getParentComponentContext:()=>ke,translationContext:t,registrationKey:qe}),Ie.current=De,()=>{const ne=window.__slotContextValue;De&&R.id&&ne&&ne.unregisterFromSlot(De,R.id)}},[Oe,De,R,e,h,ke,t,qe]);const Nt=j.useCallback(V=>{if(typeof V=="string"){if(Wp(V))return Jp(V);if(Yp(V)){const me=[],ue=V.replace(new RegExp(`${nc}([^${uo}]*)${uo}`,"g"),(_e,Ae)=>(me.push(Ae),`${La}${me.length-1}${La}`));let ne=ue;return/\$t:[a-zA-Z0-9._-]+/.test(ue)&&(ne=o.resolveTranslations(ue,t,oe)),ne.replace(new RegExp(`${La}(\\d+)${La}`,"g"),(_e,Ae)=>me[parseInt(Ae)])}if(V.startsWith("$t:defer:"))return V;if(/\$t:[a-zA-Z0-9._-]+/.test(V)){const me=V.trim();return me.startsWith("{")&&me.endsWith("}")||me.startsWith("[")&&me.endsWith("]")?V:o.resolveTranslations(V,t,oe)}return V}if(Array.isArray(V))return V.map(me=>Nt(me));if(V&&typeof V=="object"){const me={};for(const[ue,ne]of Object.entries(V))me[ue]=Nt(ne);return me}return V},[o,t,oe]),Rt=j.useCallback(V=>/[?:|&!+\-*/<>=()]/.test(V),[]),Xt=j.useCallback(V=>{if(!V.startsWith("{{")||!V.endsWith("}}"))return null;const me=V.slice(2,-2);let ue=null,ne=0;for(let _e=0;_e<me.length;_e++){const Ae=me[_e];if((_e>0?me[_e-1]:"")!=="\\"&&((Ae==='"'||Ae==="'")&&!ue?ue=Ae:Ae===ue&&(ue=null),!ue&&(Ae==="{"&&ne++,Ae==="}"&&ne--,ne<0)))return null}return ne===0?me.trim():null},[]),Mt=j.useMemo(()=>{let V={...R.props||{}};const me=["cellChildren","expandChildren","expandContext","render"],ne=s.getMetadata(R.name)?.skipBindingKeys||[],_e=[...new Set([...me,...ne])],Ae=y?{skipCache:!0}:void 0,Me=Ue=>{if(Ae)return Ae;if(Ue.startsWith("_computed")||Ue.startsWith("$computed"))return{skipCache:!0}};for(const[Ue,Re]of Object.entries(V))if(!_e.includes(Ue))if(typeof Re=="string"){const $e=Xt(Re);if($e!==null){let lt=!1,Dt=$e;$e.startsWith(Oa)&&(lt=!0,Dt=$e.slice(Oa.length));const tn={componentId:R.id,componentName:R.name,propName:Ue};let xn;if(Rt(Dt))try{xn=i.evaluateExpression(Dt,oe,tn)}catch(Xn){vt.warn(`표현식 평가 실패 (컴포넌트: ${R.id}, prop: ${Ue}):`,Xn),xn=void 0}else xn=i.resolve(Dt,oe,Me(Dt),tn);V[Ue]=lt&&xn!=null?ho(xn):xn}else{const lt={componentId:R.id,componentName:R.name,propName:Ue};V[Ue]=i.resolveBindings(Re,oe,Ae,lt)}}else Array.isArray(Re)?V[Ue]=Re.map($e=>typeof $e=="string"?i.resolveBindings($e,oe,Ae):typeof $e=="object"&&$e!==null?i.resolveObject($e,oe,Ae):$e):Re&&typeof Re=="object"&&(V[Ue]=i.resolveObject(Re,oe,Ae));for(const[Ue,Re]of Object.entries(V))V[Ue]=Nt(Re);if(typeof V.style=="string"&&(V.style=Dj(V.style)),V=Yu(V,R.actions,oe,{componentContext:ke,actionDispatcher:d}),R.classMap){const Ue=Bw(R.classMap,oe,i,{skipCache:!0});if(Ue){const Re=V.className||"";V.className=Re?`${Re} ${Ue}`:Ue}}R.style&&(V.style=R.style),R.actions&&R.actions.length>0&&R.type==="composite"&&Object.assign(V,re),R.component_layout&&(V.__componentLayoutDefs=R.component_layout);const ze=R.expandChildren||R.props?.expandChildren,Pe=R.props?.cellChildren,Te=R.children&&R.children.length>0,Fe=R.component_layout,We=R.slot,Je=R.props?.modalId,rt=R.type==="composite";return(ze||Pe||Te||Fe||We||Je||rt)&&(V.__componentContext=ke),V},[R.props,R.actions,R.style,R.classMap,R.id,oe,t,i,o,ke,re,Nt,Rt,Xt,y]),Qt=j.useRef(null),Et=j.useMemo(()=>Qt.current&&ty(Qt.current,Mt)?Qt.current:(Qt.current=Mt,Mt),[Mt]),Dn=j.useMemo(()=>{const V=R.dataKey,me=R.trackChanges,ue=R.debounce;if(V){const ne=V.startsWith("_global."),_e=ne?V.slice(8):V,Ae=ne?e._global:oe._local;return{dataKey:_e,trackChanges:me??!1,debounce:ue,setState:ne?ze=>{e._globalSetState?e._globalSetState(ze):vt.warn("_global.formData 사용 시 _globalSetState가 필요합니다.")}:xe,state:Ae??{},_isGlobal:ne}}if(ee.dataKey)return ee},[R.dataKey,R.trackChanges,R.debounce,R.id,xe,oe._local,e._global,e._globalSetState,ee]),Ce=j.useRef(new Set);j.useEffect(()=>{Ce.current.clear()},[e._global?._remountKeys]);const Ge=j.useCallback((V,me)=>{const ue=e._global?._remountKeys;return V&&ue?.[V]&&!Ce.current.has(V)?(Ce.current.add(V),`${V}-remount-${ue[V]}`):V||me},[e._global?._remountKeys]),at=j.useMemo(()=>{if(R.text!==void 0){if(typeof R.text=="string"){const V=R.text;let me=V;const ue={componentId:R.id,componentName:R.name,propName:"text",skipCache:!0},ne=Xt(V);if(ne!==null)if(Kp(ne))me=i.resolveBindings(V,oe,{skipCache:!0},ue);else if(Rt(ne))try{me=i.evaluateExpression(ne,oe,ue)}catch(_e){vt.warn(`text 표현식 평가 실패 (컴포넌트: ${R.id}):`,_e),me=""}else me=i.resolve(ne,oe,{skipCache:!0},ue);else V.includes("{{")&&(me=i.resolveBindings(V,oe,{skipCache:!0},ue));return me=Nt(me),me??""}return R.text}return!R.children||R.children.length===0?null:R.children.map((V,me)=>{if(typeof V=="string")return V;const ue=A?`${A}.children.${me}`:`${me}`,ne=V._fromBase?V.id||`child-${me}`:Ge(V.id,`child-${me}`),_e=!V._fromBase&&O?`${ne}_${O}`:ne;return l.jsx(Vs,{componentDef:V,dataContext:oe,translationContext:t,registry:s,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:ke,parentFormContextProp:Dn,isInsideIteration:y,isEditMode:x,onComponentSelect:w,onComponentHover:v,componentPath:ue,onDragStart:S,onDragEnd:k,layoutKey:O},_e)})},[R.text,R.children,R.id,e,oe,t,s,i,o,d,ke,Dn,Xt,Rt,Nt,Ge,y,x,w,v,A,S,k,O]),pt=j.useMemo(()=>{if(!R.iteration)return null;try{const V=Wu(R.iteration.source,oe,i);if(!Array.isArray(V))return vt.warn(`iteration source가 배열이 아닙니다 (컴포넌트: ${R.id}):`,V),null;const me=oa();return me?.isEnabled()&&me.trackIteration(R.id||`iteration-${Date.now()}`,R.iteration.source,R.iteration.item_var,R.iteration.index_var,V.length),V.map((ue,ne)=>{const _e={...oe,[R.iteration.item_var]:ue};R.iteration.index_var&&(_e[R.iteration.index_var]=ne);const Ae=ne===0||ne===V.length-1;me?.isEnabled()&&Ae&&me.trackNestedContext?.({componentId:`${R.id||"unknown"}-iter-${ne}`,componentType:"iteration",parentContext:{available:Object.keys(oe),values:{}},ownContext:{added:[R.iteration.item_var,...R.iteration.index_var?[R.iteration.index_var]:[]],values:{[R.iteration.item_var]:ue,...R.iteration.index_var?{[R.iteration.index_var]:ne}:{}}},depth:1});const Me={...R,iteration:void 0,responsive:void 0},ze=A?`${A}.iteration.${ne}`:`iteration.${ne}`,Pe=`${Ge(R.id,"item")}-${ne}`;return l.jsx(Vs,{componentDef:Me,dataContext:_e,translationContext:t,registry:s,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:ke,parentFormContextProp:Dn,isInsideIteration:!0,isEditMode:x,onComponentSelect:w,onComponentHover:v,componentPath:ze,onDragStart:S,onDragEnd:k,layoutKey:O},Pe)})}catch(V){return vt.error(`iteration 렌더링 실패 (컴포넌트: ${R.id}):`,V),null}},[R.iteration,R.children,R.id,e,oe,t,s,i,o,d,ke,Dn,Ge,x,w,v,A,S,k,O]),[bt,_t]=j.useState(0),mt=j.useMemo(()=>{if(!R.sortable||!R.itemTemplate)return null;const{sortable:V,itemTemplate:me}=R;try{const ue=Wu(V.source,oe,i);if(!Array.isArray(ue))return vt.warn(`sortable source가 배열이 아닙니다 (컴포넌트: ${R.id}):`,ue),null;if(ue.length===0)return null;const ne=V.itemKey||"id",_e=V.strategy||"verticalList",Ae=V.itemVar||"$item",Me=V.indexVar||"$index",ze=V.handle,Pe=V.wrapperElement,Te=(Je,rt)=>{const Ue=R.actions?.filter(Re=>Re.event==="onSortEnd"||Re.type==="onSortEnd");if(_t(Re=>Re+1),Ue&&Ue.length>0&&d){const Re={...oe,$sortedItems:Je,$sortEvent:rt};Ue.forEach($e=>{try{const lt=d.createHandler($e,Re,ke),Dt=new Event("sortend");lt(Dt)}catch(lt){vt.error(`onSortEnd action failed: ${$e.handler}`,lt)}})}},Fe=Je=>{const rt=R.actions?.filter(Ue=>Ue.event==="onSortStart"||Ue.type==="onSortStart");if(rt&&rt.length>0&&d){const Ue={...oe,$activeId:Je.activeId};rt.forEach(Re=>{try{const $e=d.createHandler(Re,Ue,ke),lt=new Event("sortstart");$e(lt)}catch($e){vt.error(`onSortStart action failed: ${Re.handler}`,$e)}})}},We=ue.map((Je,rt)=>{const Ue=String(Je[ne]),Re={...oe,[Ae]:Je,[Me]:rt},$e=A?`${A}.sortable.${rt}`:`sortable.${rt}`,lt=`${Ge(R.id,"sortable-item")}-v${bt}-${Ue}`;return l.jsx(Aj,{id:Ue,handle:ze,...Pe?{as:Pe}:{},children:(Pe&&me.children?me.children:[me]).map((Dt,tn)=>l.jsx(Vs,{componentDef:Dt,dataContext:Re,translationContext:t,registry:s,bindingEngine:i,translationEngine:o,actionDispatcher:d,parentComponentContext:ke,parentFormContextProp:void 0,isInsideIteration:!0,isEditMode:x,onComponentSelect:w,onComponentHover:v,componentPath:$e,onDragStart:S,onDragEnd:k,layoutKey:O},`${lt}-child-${tn}`))},lt)});return l.jsx(Nj,{items:ue,itemKey:ne,strategy:_e,onSortEnd:Te,onSortStart:Fe,sortVersion:bt,children:We})}catch(ue){return vt.error(`sortable 렌더링 실패 (컴포넌트: ${R.id}):`,ue),null}},[R.sortable,R.itemTemplate,R.actions,R.id,e,oe,t,s,i,o,d,ke,Ge,x,w,v,A,S,k,bt,O]),tt=j.useRef(!1);j.useEffect(()=>{if(tt.current)return;tt.current=!0;const V=oa();if(V?.isEnabled()&&V.trackMount(r.id,{name:r.name,type:r.type||"component",props:Et}),r.lifecycle?.onMount&&r.lifecycle.onMount.length>0)for(const ue of r.lifecycle.onMount)try{const ne=d.createHandler(ue,oe,ke),_e=new Event("mount");ne(_e),vt.log(`Lifecycle onMount executed: ${ue.handler} (Component: ${r.id})`)}catch(ne){vt.error(`Lifecycle onMount failed: ${ue.handler} (Component: ${r.id})`,ne)}const me=[];if(r.onComponentEvent&&r.onComponentEvent.length>0){const ue=window.G7Core;if(ue?.componentEvent?.on)for(const ne of r.onComponentEvent){if(!ne.event){vt.warn(`onComponentEvent: event name is required (Component: ${r.id})`);continue}const _e=async Me=>{try{const ze={...oe,_eventData:Me},Te=await d.createHandler({handler:ne.handler,params:ne.params,onSuccess:ne.onSuccess,onError:ne.onError},ze,ke)(new CustomEvent(ne.event,{detail:Me}));return vt.log(`onComponentEvent "${ne.event}" handled: ${ne.handler} (Component: ${r.id})`,{eventData:Me,result:Te}),Te}catch(ze){throw vt.error(`onComponentEvent "${ne.event}" failed: ${ne.handler} (Component: ${r.id})`,ze),ze}},Ae=ue.componentEvent.on(ne.event,_e);me.push(Ae),vt.log(`onComponentEvent: Subscribed to "${ne.event}" (Component: ${r.id})`)}else vt.warn(`onComponentEvent: G7Core.componentEvent is not available (Component: ${r.id})`)}return()=>{const ue=oa();ue?.isEnabled()&&ue.trackUnmount(r.id);for(const ne of me)try{ne()}catch(_e){vt.error(`onComponentEvent: Failed to unsubscribe (Component: ${r.id})`,_e)}if(me.length>0&&vt.log(`onComponentEvent: Unsubscribed ${me.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,oe,ke),Ae=new Event("unmount");_e(Ae),vt.log(`Lifecycle onUnmount executed: ${ne.handler} (Component: ${r.id})`)}catch(_e){vt.error(`Lifecycle onUnmount failed: ${ne.handler} (Component: ${r.id})`,_e)}}},[]);const vn=j.useMemo(()=>{const V=Et.dataKey,me=Et.trackChanges,ue=Et.debounce;return V?{dataKey:V,trackChanges:me??!1,debounce:ue,setState:xe,state:re}:null},[Et.dataKey,Et.trackChanges,Et.debounce,xe,re]);j.useEffect(()=>{const V=R.dataKey||Et.dataKey;if(!V)return;const me=oa();if(!me?.isEnabled())return;const ue=[],ne=Ae=>{if(Ae)for(const Me of Ae){const ze=Me?.props?.name;if(ze&&ue.push({name:ze,type:Me.name||Me.type||"unknown"}),Me?.children&&ne(Me.children),Me?.slots)for(const Pe of Object.values(Me.slots))Array.isArray(Pe)&&ne(Pe)}};if(r.children&&ne(r.children),r.slots)for(const Ae of Object.values(r.slots))Array.isArray(Ae)&&ne(Ae);const _e=r.id||`form-${V}`;return me.trackForm(_e,V,ue),()=>{me.untrackForm(_e)}},[R,Et.dataKey,r.id,r.children]);const wt=j.useRef(null),Tt=j.useRef(void 0);j.useEffect(()=>{const V=Et?.name;if(!V||!ee.dataKey||!ee.setState||Et?.autoBinding===!1)return;const me=`${ee.dataKey}.${V}`,ue=window.__g7AutoBindingPaths??new Map;return window.__g7AutoBindingPaths=ue,ue.set(me,(ue.get(me)??0)+1),()=>{const ne=ue.get(me)??0;ne<=1?ue.delete(me):ue.set(me,ne-1)}},[Et?.name,Et?.autoBinding,ee.dataKey,ee.setState]);const qt=j.useMemo(()=>{const{dataKey:V,trackChanges:me,debounce:ue,...ne}=Et,_e=ne.name;if(!_e||!ee.dataKey||!ee.setState)return ne;if(ne.autoBinding===!1){const{autoBinding:Ue,...Re}=ne;return Re}const Ae=`${ee.dataKey}.${_e}`,Me=E7(ee.state,Ae),ze=Me!==void 0?Me:ne.value,Te=s.getMetadata(r.name)?.bindingType,Fe=typeof ze=="boolean"&&(Te==="checked"||Te==="checkable"&&["checkbox","radio"].includes(ne?.type)),We=ee.debounce,Je=Ue=>{const Re=ee.state||{},$e=_7(Re,Ae,Ue);if(ee.trackChanges&&($e.hasChanges=!0),window.__g7PendingLocalState=$e,ee.setState($e),ee._isGlobal)return;const lt=window.G7Core,Dt={[Ae]:Ue};ee.trackChanges&&(Dt.hasChanges=!0),lt?.state?.setLocal?.(Dt,{render:!1})},rt=(Ue,Re)=>{We&&We>0?(wt.current&&clearTimeout(wt.current),wt.current=setTimeout(()=>{Je(Ue),wt.current=null,Re&&(Re(),window.__g7PendingLocalState=null)},We)):(Je(Ue),Re&&(Re(),window.__g7PendingLocalState=null))};if(Fe)return{...ne,checked:ze,onChange:Re=>{const $e=Re.target.checked;Je($e),ne.onChange&&ne.onChange(Re)}};{const Ue=$e=>{const lt=$e?.target?.value!==void 0?$e.target.value:$e;We&&We>0&&(Tt.current=lt);const Dt=$e?.target?{target:{value:lt,name:$e.target.name,type:$e.target.type,checked:$e.target.checked},currentTarget:$e.currentTarget?{value:lt,name:$e.currentTarget.name}:void 0}:$e;rt(lt,()=>{ne.onChange&&ne.onChange(Dt)})};let Re;return Tt.current!==void 0?wt.current!==null?Re=Tt.current:String(ze??"")===String(Tt.current)?(Tt.current=void 0,Re=ze??""):Re=Tt.current:Re=ze??"",{...ne,value:Re,onChange:Ue}}},[Et,ee,ee.state,ee.debounce]),Jn=j.useMemo(()=>{const V=oa();if(V?.isEnabled()&&V.trackRender(r.name),!Oe)return null;if(R.sortable&&R.itemTemplate)return mt;if(R.iteration)return pt;if(R.type==="extension_point"){const{layout:ze,columns:Pe,gap:Te,className:Fe,...We}=R.props||{};let Je=Fe||"";return ze==="grid"&&Pe?Je=`${Je} grid grid-cols-${Pe} gap-${Te||4}`.trim():ze==="flex"&&(Je=`${Je} flex flex-col gap-${Te||4}`.trim()),l.jsx("div",{id:R.id,className:Je||void 0,...We,children:at})}const me=s.getComponent(R.name);if(!me)return vt.error(`컴포넌트를 찾을 수 없습니다: ${R.name} (ID: ${R.id})`,"componentDef:",JSON.stringify(R,null,2)),null;const ue=e._global?._remountKeys,ne={...qt,id:qt.id??R.id,...ue&&Object.keys(ue).length>0&&{__remountTrigger:JSON.stringify(ue)}};if(se?.listeners&&se.handle&&qt["data-drag-handle"]!==void 0&&(Object.assign(ne,se.listeners),ne.style={...ne.style,cursor:se.isDragging?"grabbing":"grab"}),x){const ze=R.id||`auto_${R.name||R.type||"unknown"}_${Math.random().toString(36).substring(2,8)}`;ne["data-editor-id"]=ze,ne["data-editor-name"]=R.name,ne["data-editor-type"]=R.type,A&&(ne["data-editor-path"]=A);const Pe=ne.onClick;ne.onClick=Te=>{w&&(Te.stopPropagation(),w(ze,Te)),typeof Pe=="function"&&Pe(Te)},v&&(ne.onMouseMove=Te=>{Te.stopPropagation(),v(ze,Te)},ne.onMouseLeave=Te=>{v(null,Te)}),ne.draggable=!0,S&&(ne.onDragStart=Te=>{Te.stopPropagation(),S(ze,Te)}),k&&(ne.onDragEnd=Te=>{k(Te)})}const Ae=R.type==="basic"||R.type==="layout"?(()=>{const{__componentContext:ze,__componentLayoutDefs:Pe,...Te}=ne;return Te})():ne;let Me=l.jsx(me,{...Ae,children:at});if(Dn&&(Me=l.jsx(k7,{value:Dn,children:Me})),R.isolatedState){const ze=typeof R.isolatedState=="object"?R.isolatedState:{},Pe=e?._isolatedInit,Te=Pe?{...ze,...Pe}:ze;Me=l.jsx(L7,{initialState:Te,scopeId:R.isolatedScopeId,children:Me})}return Me},[Oe,R.iteration,R.sortable,R.itemTemplate,R.type,R.name,R.id,R.props,R.isolatedState,R.isolatedScopeId,s,qt,at,pt,mt,se,vn,x,w,v,S,k,A,e._global?._remountKeys]),un=j.useMemo(()=>{const V=R.blur_until_loaded;if(!V||e?._global?.__isPreview)return!1;if(typeof V=="string"){const ne=Xt(V);if(ne!==null)try{const _e={componentId:R.id,componentName:R.name,propName:"blur_until_loaded"};return!!i.evaluateExpression(ne,oe,_e)}catch(_e){return vt.warn(`blur_until_loaded 표현식 평가 실패 (컴포넌트: ${R.id}):`,_e),!1}return!1}if(typeof V=="object"&&V!==null){if(!V.enabled)return!1;if(V.data_sources)return(Array.isArray(V.data_sources)?V.data_sources:[V.data_sources]).some(Me=>e[Me]===void 0);if(W)return!0;const ne=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(Ae=>!ne.includes(Ae)&&!Ae.startsWith("_")).some(Ae=>e[Ae]===void 0)}if(W)return!0;const me=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(ne=>!me.includes(ne)&&!ne.startsWith("_")).some(ne=>e[ne]===void 0)},[R.blur_until_loaded,R.id,W,e,oe,i,Xt]);if(un){const V=R.blur_until_loaded;if(typeof V=="object"&&V?.data_sources){const ue=(Array.isArray(V.data_sources)?V.data_sources:[V.data_sources]).reduce((_e,Ae)=>(_e[Ae]=e[Ae]===void 0?"UNDEFINED":"LOADED",_e),{}),ne=Object.keys(e).filter(_e=>!_e.startsWith("_"));vt.log(`[BLUR APPLIED] Component: ${R.id}, data_sources status:`,ue,"Available keys:",ne)}else vt.log(`[BLUR APPLIED] Component: ${R.id}, blur_until_loaded:`,V)}const Rs=window.__slotContextValue;return De&&Rs?.isEnabled?null:l.jsx(Rj,{componentId:r.id,componentName:r.name,children:R.blur_until_loaded?l.jsx("div",{className:un?"opacity-50 blur-sm transition-all duration-300 pointer-events-none":void 0,children:Jn}):Jn})});Vs.displayName="DynamicRenderer",typeof window<"u"&&(window.__DynamicRenderer=Vs);function Oj(r){const e={};try{const s=new URL(r,typeof window<"u"?window.location.origin:"http://localhost").searchParams,i=new Set;for(const o of s.keys()){if(i.has(o))continue;i.add(o);const d=s.getAll(o);d.length>1||o.endsWith("[]")?e[o]=d:e[o]=d[0]}}catch{}return e}function Lj(r){try{return new URL(r,typeof window<"u"?window.location.origin:"http://localhost").pathname}catch{return r.split("?")[0]}}const _r=class _r{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 _r.instance||(_r.instance=new _r),_r.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 s=window.G7Core?.state?.get?.();return s?.settings?.advanced?.debug_mode===!0||s?._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 t={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(t),this.stateHistory.length>this.config.maxHistorySize&&this.stateHistory.shift(),this.notifyStateWatchers(t)}getState(){try{const e=window.G7Core,t=e?.state?.get?.()||{},s={};if(e?._isolatedStates&&typeof e._isolatedStates=="object")for(const[i,o]of Object.entries(e._isolatedStates))s[i]=this.sanitizeObject(o);return{_global:t._global||t,_local:this.currentLocalState,_computed:this.currentComputedState,_isolated:Object.keys(s).length>0?s: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]}getDualStorageMismatch(){const e=this.currentLocalState||{};let t={};try{t=(window.G7Core?.state?.get?.()||{})._local||{}}catch{t={}}const s=this.findMismatchedLeafPaths(e,t);return{hasMismatch:s.length>0,mismatchedPaths:s,storageA:e,storageB:t}}findMismatchedLeafPaths(e,t,s=""){const i=[],o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(const d of o){const g=s?`${s}.${d}`:d,h=e?.[d],f=t?.[d],p=h&&typeof h=="object"&&!Array.isArray(h),y=f&&typeof f=="object"&&!Array.isArray(f);if(p&&y)i.push(...this.findMismatchedLeafPaths(h,f,g));else{const x=h===void 0?"__undefined__":JSON.stringify(h),w=f===void 0?"__undefined__":JSON.stringify(f);x!==w&&i.push(g)}}return i}watchState(e,t){return this.stateWatchers.has(e)||this.stateWatchers.set(e,new Set),this.stateWatchers.get(e).add(t),()=>{this.stateWatchers.get(e)?.delete(t)}}notifyStateWatchers(e){if(this.stateWatchers.get("*")?.forEach(t=>{try{t(e.next,e.prev,"*")}catch(s){console.error("[G7DevTools] State watcher error:",s)}}),e.diff)for(const t of e.diff.changed)this.stateWatchers.get(t.path)?.forEach(s=>{try{s(t.newValue,t.oldValue,t.path)}catch(i){console.error("[G7DevTools] State watcher error:",i)}})}diffSnapshots(e,t){const s=this.stateHistory.find(o=>o.id===e),i=this.stateHistory.find(o=>o.id===t);return!s||!i?null:this.calculateDiff(s.next,i.next)}calculateDiff(e,t,s=""){const i={added:[],removed:[],changed:[]},o=new Set(Object.keys(e)),d=new Set(Object.keys(t));for(const g of d){const h=s?`${s}.${g}`:g;o.has(g)?JSON.stringify(e[g])!==JSON.stringify(t[g])&&i.changed.push({path:h,oldValue:e[g],newValue:t[g]}):i.added.push(h)}for(const g of o){const h=s?`${s}.${g}`:g;d.has(g)||i.removed.push(h)}return i}logAction(e){if(!this.config.enabled)return;const t=this.actionHistory.findIndex(s=>s.id===e.id);t>=0?this.actionHistory[t]={...this.actionHistory[t],...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(t=>{try{t(e)}catch(s){console.error("[G7DevTools] Action watcher error:",s)}})}getActionMetrics(){const e=this.actionHistory.filter(o=>o.status==="success"),t=this.actionHistory.filter(o=>o.status==="error"),s={};for(const o of this.actionHistory)s[o.type]=(s[o.type]||0)+1;const i=e.reduce((o,d)=>o+(d.duration||0),0);return{totalActions:this.actionHistory.length,successCount:e.length,errorCount:t.length,averageDuration:e.length>0?i/e.length:0,actionsByType:s}}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 t={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(t),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 t=0,s=0,i=0,o=0;const d={},g={};for(const f of e)f.decision==="cache_hit"?t++:f.decision==="cache_miss"?s++: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=t+s+i;return{totalDecisions:e.length,cacheHits:t,cacheMisses:s,skipCacheCount:i,invalidateCount:o,byReason:d,byComponent:g,avgHitRate:h>0?t/h:0}}getRecentCacheDecisions(e=20,t){let s=[...this.cacheDecisions];return t&&(s=s.filter(i=>i.decision===t)),s.slice(-e)}clearCacheDecisionData(){this.cacheDecisions=[],this.cacheDecisionIdCounter=0}summarizePropsForLifecycle(e){if(!e||typeof e!="object")return e;const t={},s=["children","ref","key"];for(const[i,o]of Object.entries(e))if(!s.includes(i))if(o==null)t[i]=o;else if(Array.isArray(o))t[i]=`[Array(${o.length})]`;else if(typeof o=="object"){const d=Object.keys(o);d.length<=3?t[i]=`{${d.join(", ")}}`:t[i]=`{${d.slice(0,3).join(", ")}, ... +${d.length-3}}`}else typeof o=="string"&&o.length>50?t[i]=o.substring(0,50)+"...":typeof o=="function"?t[i]="[Function]":t[i]=o;return t}trackMount(e,t){if(!this.config.enabled)return;const s=this.summarizePropsForLifecycle(t.props),i={...t,props:s,id:e,mountTime:Date.now()};this.mountedComponents.set(e,i),this.mountWatchers.forEach(o=>{try{o({componentId:e,componentName:t.name,timestamp:i.mountTime})}catch(d){console.error("[G7DevTools] Mount watcher error:",d)}})}trackUnmount(e){if(!this.config.enabled)return;const t=this.mountedComponents.get(e),s=this.eventListeners.get(e)||[];s.length>0&&console.warn(`[G7DevTools] 컴포넌트 ${e} 언마운트 시 ${s.length}개 리스너 미정리`),t&&this.unmountWatchers.forEach(i=>{try{i({componentId:e,componentName:t.name,timestamp:Date.now(),orphanedListeners:s.length})}catch(o){console.error("[G7DevTools] Unmount watcher error:",o)}}),this.mountedComponents.delete(e)}trackListener(e,t,s){if(!this.config.enabled)return;const i=this.eventListeners.get(e)||[];i.push({type:t,target:s,addedAt:Date.now()}),this.eventListeners.set(e,i)}removeListener(e,t){if(!this.config.enabled)return;const s=this.eventListeners.get(e)||[],i=s.findIndex(o=>o.type===t);i>=0&&s.splice(i,1)}getMountedComponents(){return Array.from(this.mountedComponents.values())}getOrphanedListeners(){const e=[];for(const[t,s]of this.eventListeners)this.mountedComponents.has(t)||e.push(...s.map(i=>({...i,componentId:t})));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 t=this.renderCounts.get(e)||0;this.renderCounts.set(e,t+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 t=this.getOrphanedListeners().length;t>0&&e.push({type:"orphaned-listeners",message:`${t}개의 정리되지 않은 이벤트 리스너`,suggestion:"useEffect cleanup 또는 removeEventListener 확인",severity:t>10?"error":"warning"});const s=Array.from(this.renderCounts.entries()).filter(([,i])=>i>50);return s.length>0&&e.push({type:"excessive-renders",message:`${s.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,t=this.analyzeProfile(e);return console.log("[G7DevTools] 프로파일링 완료",t),t}analyzeProfile(e){const t=this.profilingData.filter(f=>f.type==="render"),s=this.profilingData.filter(f=>f.type==="binding"),i=this.profilingData.filter(f=>f.type==="action"),o={};for(const f of t)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((y,x)=>y+x,0)/p.durations.length:0})).sort((f,p)=>p.renderCount-f.renderCount).slice(0,10),g={};for(const f of s)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:t.length,totalBindings:s.length,totalActions:i.length,slowestComponents:d,hotPaths:h}}}resetPerformanceStats(){this.renderCounts.clear(),this.bindingEvalCount=0,this.profilingData=[]}trackRequest(e,t,s){if(!this.config.enabled)return"";const i=this.generateId(),o=Lj(e),d=Oj(e);return this.activeRequests.set(i,{id:i,url:o,fullUrl:e,queryParams:d,method:t,startTime:Date.now(),status:"pending",requestBody:s?.requestBody?this.sanitizeObject(s.requestBody):void 0,dataSourceId:s?.dataSourceId}),this.isProfiling&&this.profilingData.push({type:"network",timestamp:performance.now()}),i}completeRequest(e,t,s){if(!this.config.enabled)return;const i=this.activeRequests.get(e);if(!i)return;const o={...i,status:t>=200&&t<300?"success":"error",statusCode:t,duration:Date.now()-i.startTime,endTime:Date.now(),response:this.sanitizeObject(s)};this.requestHistory.push(o),this.activeRequests.delete(e),this.requestHistory.length>this.config.maxHistorySize&&this.requestHistory.shift(),this.notifyRequestWatchers(o)}failRequest(e,t){if(!this.config.enabled)return;const s=this.activeRequests.get(e);if(!s)return;const i={...s,status:"error",error:t,duration:Date.now()-s.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(t=>{try{t(e)}catch(s){console.error("[G7DevTools] Request watcher error:",s)}})}trackWebSocketConnection(e,t,s){this.config.enabled&&this.wsConnections.set(e,{id:e,url:t,state:s,connectedAt:s==="open"?Date.now():void 0})}trackWebSocketMessage(e,t,s,i){if(!this.config.enabled)return;const o={id:this.generateId(),connectionId:e,direction:t,type:s,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(t=>t.state==="open")?"connected":e.some(t=>t.state==="connecting")?"reconnecting":"disconnected"}watchWebSocketMessage(e){return this.wsMessageWatchers.add(e),()=>{this.wsMessageWatchers.delete(e)}}notifyWebSocketWatchers(e){this.wsMessageWatchers.forEach(t=>{try{t(e)}catch(s){console.error("[G7DevTools] WebSocket watcher error:",s)}})}trackIfCondition(e,t,s){if(!this.config.enabled)return;const i=this.ifConditions.get(e),o=i?.evaluatedValue;this.ifConditions.set(e,{id:e,expression:t,evaluatedValue:s,evaluationCount:(i?.evaluationCount||0)+1,lastEvaluated:Date.now()}),i&&o!==s&&this.notifyConditionWatchers({id:e,expression:t,oldValue:o,newValue:s,timestamp:Date.now()})}trackIteration(e,t){this.config.enabled&&this.iterations.set(e,{id:e,...t,lastRendered:Date.now()})}getIfConditions(){return Array.from(this.ifConditions.values())}getIterations(){return Array.from(this.iterations.values())}getScopeChain(e){const t=[],s=this.getState();return t.push({name:"_global",value:s._global,source:"global"}),t.push({name:"_local",value:s._local,source:"local"}),t.push({name:"_computed",value:s._computed,source:"computed"}),t}watchConditionChange(e){return this.conditionWatchers.add(e),()=>{this.conditionWatchers.delete(e)}}notifyConditionWatchers(e){this.conditionWatchers.forEach(t=>{try{t(e)}catch(s){console.error("[G7DevTools] Condition watcher error:",s)}})}trackForm(e,t,s){this.config.enabled&&this.forms.set(e,{id:e,dataKey:t,inputs:s,trackedAt:Date.now()})}trackFormChange(e,t,s){if(!this.config.enabled)return;const i={formId:e,inputName:t,value:s,timestamp:Date.now()};this.notifyFormWatchers(i)}untrackForm(e){this.forms.delete(e)}getForms(){return Array.from(this.forms.values())}getFormState(e){const t=this.getState();return this.getNestedValue(t,e)||{}}getBindingPath(e,t){return`${e}.${t}`}watchFormChange(e){return this.formWatchers.add(e),()=>{this.formWatchers.delete(e)}}notifyFormWatchers(e){this.formWatchers.forEach(t=>{try{t(e)}catch(s){console.error("[G7DevTools] Form watcher error:",s)}})}trackFormBindingIssue(e,t,s){if(!this.config.enabled)return;const i={id:`form-issue-${++this.formBindingIssueIdCounter}`,timestamp:Date.now(),type:e,severity:t,formId:s.formId,formDataKey:s.formDataKey,inputInfo:s.inputInfo,contextInfo:s.contextInfo,description:s.description,suggestion:s.suggestion,docLink:s.docLink};this.formBindingIssues.push(i),this.formBindingIssues.length>this.maxFormBindingIssues&&this.formBindingIssues.shift()}validateFormBinding(e,t,s,i){const o=s.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:t,inputInfo:{name:h.name,type:h.type},description:"Input에 name 속성이 없어 자동 바인딩이 동작하지 않습니다",suggestion:"Input에 name 속성을 추가하세요",docLink:"troubleshooting-components-form.md"})),t||(f.push("Form에 dataKey가 없습니다"),p=!1),{inputName:h.name||"(unnamed)",inputType:h.type,bindingPath:t&&h.name?`${t}.${h.name}`:"-",isValid:p,currentValue:h.value,issues:f}});if(t||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:t,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:t,timestamp:Date.now(),contextPropagation:i,inputBindings:o,isValid:o.every(h=>h.isValid)&&!!t&&!i.isContextBroken,issueCount:o.filter(h=>!h.isValid).length+(t?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},t={info:0,warning:0,error:0};for(const i of this.formBindingIssues)e[i.type]++,t[i.severity]++;const s=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:t,topIssues:s}}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,t,s,i,o,d,g){if(!this.config.enabled)return;const h=`computed-${e}-${d||"global"}`,f={id:h,name:e,expression:t,componentId:d,dependencies:s,currentValue:this.safeClone(i),lastComputedAt:Date.now(),computationTime:o,error:g};this.computedProperties.set(h,f)}trackComputedRecalc(e,t,s,i,o,d,g){if(!this.config.enabled)return;const h=`computed-${e}-${g||"global"}`,f=JSON.stringify(s)!==JSON.stringify(i),p={id:`recalc-${++this.computedRecalcIdCounter}`,computedId:h,computedName:e,timestamp:Date.now(),trigger:t,triggeredBy:d,previousValue:this.safeClone(s),newValue:this.safeClone(i),valueChanged:f,computationTime:o,cascadeCount:0};this.computedRecalcLogs.push(p),this.computedRecalcLogs.length>this.maxComputedRecalcLogs&&this.computedRecalcLogs.shift();const y=this.computedProperties.get(h);y&&(y.currentValue=this.safeClone(i),y.lastComputedAt=Date.now(),y.computationTime=o)}analyzeComputedDependencyChain(e,t){const s=new Set,i=[];let o=!1,d,g=0;const h=(p,y)=>{if(g=Math.max(g,y),s.has(p))return o=!0,d=[...i,p],{name:p,type:"computed",children:[],depth:y};s.add(p),i.push(p);const x=this.computedProperties.get(`computed-${p}-${t||"global"}`),w=[];if(x)for(const v of x.dependencies)v.type==="computed"?w.push(h(v.path,y+1)):w.push({name:v.path,type:v.type,children:[],depth:y+1});return i.pop(),s.delete(p),{name:p,type:"computed",children:w,depth:y}},f=h(e,0);return{root:e,tree:f,hasCycle:o,cyclePath:d,maxDepth:g}}getComputedDependencyTrackingInfo(){const e=Array.from(this.computedProperties.values()),t=this.getComputedDependencyStats(),s=[];for(const i of e){const o=this.analyzeComputedDependencyChain(i.name,i.componentId);s.push(o)}return{properties:e,recalcLogs:[...this.computedRecalcLogs],dependencyChains:s,stats:t,timestamp:Date.now()}}getComputedDependencyStats(){const e={"state-change":0,"datasource-update":0,"dependency-change":0,manual:0,initial:0},t={},s={};let i=0,o=0;for(const f of this.computedRecalcLogs)e[f.trigger]++,f.valueChanged||o++,t[f.computedName]=(t[f.computedName]||0)+1,s[f.computedName]||(s[f.computedName]=[]),s[f.computedName].push(f.computationTime),i+=f.computationTime;const d=Object.entries(t).sort((f,p)=>p[1]-f[1]).slice(0,5).map(([f,p])=>({name:f,count:p})),g=Object.entries(s).map(([f,p])=>({name:f,avgTime:p.reduce((y,x)=>y+x,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 t={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,t),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,t){if(!this.config.enabled)return;const s=this.modalStates.get(e);s&&(s.closedAt=Date.now(),t&&(s.currentState={...t}),this.detectStateLeakage(s))}validateModalDefinitionExists(e,t){const s=this.currentLayout;if(!s?.layoutJson)return;const i=s.layoutJson.modals;if(!i){this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:t,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 현재 레이아웃에 modals 섹션이 없습니다. 레이아웃 경로: ${s.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:t,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 렌더링된 레이아웃의 modals 섹션에 해당 ID의 정의가 없습니다. partial 로딩 실패, 레이아웃 병합 문제, extends 상속 누락 등을 확인하세요. 레이아웃 경로: ${s.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 t=this.modalStates.get(e.modalId);if(!t)return;t.stateChangeCount++,t.currentState[e.stateKey]=e.newValue;const s=this.checkIsolationViolation(t,e.stateKey),i={id:`modal-change-${++this.modalStateChangeLogIdCounter}`,modalId:e.modalId,modalName:t.modalName,timestamp:Date.now(),stateKey:e.stateKey,previousValue:e.previousValue,newValue:e.newValue,changeSource:e.changeSource||"user-action",violatesIsolation:s};this.modalStateChangeLogs.push(i),this.modalStateChangeLogs.length>this.maxModalStateChangeLogs&&this.modalStateChangeLogs.shift(),s&&this.recordModalStateIssue({type:"isolation-violation",modalId:e.modalId,modalName:t.modalName,severity:"warning",description:`모달 '${t.modalName}'에서 격리된 상태 키 '${e.stateKey}'가 변경됨`,affectedStateKeys:[e.stateKey]})}detectStateLeakage(e){if(e.scopeType==="isolated")for(const t of e.isolatedStateKeys){const s=e.initialState[t],i=e.currentState[t];if(s!==i&&e.parentModalId){const o=this.modalStates.get(e.parentModalId);o&&o.currentState.hasOwnProperty(t)&&this.recordModalStateIssue({type:"state-leakage",modalId:e.modalId,modalName:e.modalName,severity:"error",description:`모달 닫힘 후 상태 '${t}'가 부모 모달로 유출될 수 있음`,affectedStateKeys:[t],leakedValue:i,expectedValue:s})}}}checkIsolationViolation(e,t){return e.scopeType==="isolated",!1}recordModalStateIssue(e){const t={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(t),this.modalStateIssues.length>this.maxModalStateIssues&&this.modalStateIssues.shift()}getModalStateScopeTrackingInfo(){const e=Array.from(this.modalStates.values()),t=this.getModalStateScopeStats();return{modals:e,issues:[...this.modalStateIssues],relations:[...this.modalStateRelations],changeLogs:[...this.modalStateChangeLogs],stats:t,timestamp:Date.now()}}getModalStateScopeStats(){const e=Array.from(this.modalStates.values()),t={warning:0,error:0},s={"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)t[o.severity]++,s[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:t,issuesByType:s,byScope:i,leakageDetectionCount:s["state-leakage"],cleanupFailureCount:s["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 t={...e,id:`named_action_ref_${++this.namedActionRefIdCounter}`};this.namedActionRefLogs.push(t),this.namedActionRefLogs.length>this.maxNamedActionRefLogs&&(this.namedActionRefLogs=this.namedActionRefLogs.slice(-this.maxNamedActionRefLogs))}getNamedActionTrackingInfo(){const e={};for(const s of this.namedActionRefLogs)e[s.actionRefName]=(e[s.actionRefName]||0)+1;const t=Object.keys(this.namedActionDefinitions).filter(s=>!e[s]);return{definitions:this.namedActionDefinitions,refLogs:[...this.namedActionRefLogs],stats:{totalDefinitions:Object.keys(this.namedActionDefinitions).length,totalRefs:this.namedActionRefLogs.length,refCountByName:e,unusedDefinitions:t},timestamp:Date.now()}}clearNamedActionTracking(){this.namedActionDefinitions={},this.namedActionRefLogs=[],this.namedActionRefIdCounter=0}trackExpressionEval(e){if(!this.config.enabled)return;const t={...e,id:`expr-${++this.expressionIdCounter}`,timestamp:Date.now(),warning:this.detectExpressionWarning(e)};this.expressionHistory.push(t),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(t)}detectExpressionWarning(e){const{expression:t,result:s,resultType:i,method:o,duration:d}=e;if(i==="undefined"&&!t.includes("??")&&!t.includes("||")&&/^[a-zA-Z_$][a-zA-Z0-9_$.]*$/.test(t.replace(/{{|}}/g,"").trim()))return{type:"undefined-result",message:"표현식 결과가 undefined입니다",suggestion:`데이터가 로드되었는지 확인하거나 fallback 값을 추가하세요: ${t} ?? ''`};if(i==="null")return{type:"null-result",message:"표현식 결과가 null입니다",suggestion:`nullish coalescing 연산자를 사용하세요: ${t} ?? ''`};if(o==="resolveBindings"&&i==="string"){const g=String(s);if(g.includes("[object Object]")||/^\[.*\]$/.test(g))return{type:"array-to-string",message:"배열/객체가 문자열로 변환되었습니다",suggestion:"evaluateExpression()을 사용하여 원본 타입을 유지하세요"}}if(o==="resolveBindings"&&i==="string"&&String(s).includes("[object Object]"))return{type:"object-to-string",message:"객체가 [object Object]로 변환되었습니다",suggestion:"evaluateExpression()을 사용하거나 특정 속성에 접근하세요"};if(i==="undefined"&&t.includes(".")&&!t.includes("?.")){const g=t.replace(/{{|}}/g,"").trim().split(".");if(g.length>=2)return{type:"missing-optional-chain",message:"Optional chaining(?.) 누락 가능성",suggestion:`안전한 접근을 위해 ?. 사용을 고려하세요: ${g.join("?.")}`}}if((t.includes("{{item.")||t.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 t=e.toLowerCase();return this.expressionHistory.filter(s=>s.expression.toLowerCase().includes(t)||s.componentName?.toLowerCase().includes(t)||s.propName?.toLowerCase().includes(t))}getExpressionStats(){const e=this.expressionHistory,t=new Set(e.map(h=>h.expression)),s=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 s)h.warning&&(g[h.warning.type]=(g[h.warning.type]||0)+1);return{totalEvaluations:e.length,uniqueExpressions:t.size,warningCount:s.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(t=>{try{t(e)}catch(s){console.error("[G7DevTools] Expression watcher error:",s)}})}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,t=new WeakSet){if(e===null||typeof e!="object")return e;if(t.has(e))return"[Circular]";if(t.add(e),Array.isArray(e))return e.map(i=>this.sanitizeObject(i,t));const s={};for(const i of Object.keys(e))try{s[i]=this.sanitizeObject(e[i],t)}catch{s[i]="[Unable to serialize]"}return s}getNestedValue(e,t){if(!t)return e;const s=t.split(".");let i=e;for(const o of s){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 t=[...this.stateHistory].reverse().find(s=>s.timestamp<=e);if(t)return{_global:t.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,t,s){if(!this.config.enabled)return;const i=s.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:t,message:i,args:this.sanitizeObject(s),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 t={id:`debounce-action-${++this.debounceActionIdCounter}`,...e,timestamp:Date.now()};this.debounceActionHistory.push(t),this.debounceActionHistory.length>100&&this.debounceActionHistory.shift()}trackDataSourceUpdate(e){if(!this.config.enabled)return;const t={id:`ds-update-${++this.dataSourceUpdateIdCounter}`,...e};this.dataSourceUpdateHistory.push(t),this.dataSourceUpdateHistory.length>100&&this.dataSourceUpdateHistory.shift()}getDebounceActionHistory(e){let t=[...this.debounceActionHistory];return e?.handler&&(t=t.filter(s=>s.handler.includes(e.handler))),e?.status&&(t=t.filter(s=>s.status===e.status)),e?.limit&&(t=t.slice(-e.limit)),t}getDataSourceUpdateHistory(e){let t=[...this.dataSourceUpdateHistory];return e?.dataSourceId&&(t=t.filter(s=>s.dataSourceId===e.dataSourceId)),e?.updateType&&(t=t.filter(s=>s.updateType===e.updateType)),e?.limit&&(t=t.slice(-e.limit)),t}getLogs(e){let t=[...this.logHistory];if(e?.level){const s=Array.isArray(e.level)?e.level:[e.level];t=t.filter(i=>s.includes(i.level))}if(e?.prefix){const s=e.prefix.toLowerCase();t=t.filter(i=>i.prefix.toLowerCase().includes(s))}if(e?.search){const s=e.search.toLowerCase();t=t.filter(i=>i.message.toLowerCase().includes(s))}return e?.since&&(t=t.filter(s=>s.timestamp>=e.since)),e?.limit&&(t=t.slice(-e.limit)),t}getLogStats(){const t=Date.now()-6e4,s={log:0,warn:0,error:0,debug:0,info:0},i={};let o=0,d=0;for(const g of this.logHistory)s[g.level]++,i[g.prefix]=(i[g.prefix]||0)+1,g.timestamp>=t&&(g.level==="error"&&o++,g.level==="warn"&&d++);return{totalLogs:this.logHistory.length,byLevel:s,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 t=this.dataSources.get(e);t&&this.dataSources.set(e,{...t,status:"loading"})}trackDataSourceLoaded(e,t,s){if(!this.config.enabled)return;const i=this.dataSources.get(e);if(!i)return;let o,d,g=s;t&&(Array.isArray(t)?(o=t.length,d=t.length>0&&typeof t[0]=="object"?Object.keys(t[0]):void 0):typeof t=="object"&&(Array.isArray(t.data)?(g=g||"data",o=t.data.length,d=t.data.length>0&&typeof t.data[0]=="object"?Object.keys(t.data[0]):void 0):Array.isArray(t.items)?(g=g||"items",o=t.items.length,d=t.items.length>0&&typeof t.items[0]=="object"?Object.keys(t.items[0]):void 0):d=Object.keys(t))),this.dataSources.set(e,{...i,status:"loaded",dataPath:g,itemCount:o,keys:d,lastLoadedAt:Date.now(),error:void 0})}trackDataSourceError(e,t){if(!this.config.enabled)return;const s=this.dataSources.get(e);s&&this.dataSources.set(e,{...s,status:"error",error:t,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 t=this.dataPathTransforms.find(s=>s.dataSourceId===e.dataSourceId);t||(t={dataSourceId:e.dataSourceId,timestamp:Date.now(),transformSteps:[],warnings:[]},this.dataPathTransforms.push(t),this.dataPathTransforms.length>this.maxDataPathTransforms&&this.dataPathTransforms.shift()),t.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&&t.warnings.push(e.warning)}setDataPathFinalBinding(e,t){if(!this.config.enabled)return;const s=this.dataPathTransforms.find(i=>i.dataSourceId===e);s&&(s.finalBinding={expression:t.expression,resolvedPath:t.resolvedPath,value:this.safeClone(t.value)})}getDataPathTransformTrackingInfo(){const e=this.getDataPathTransformStats();return{transforms:[...this.dataPathTransforms],stats:e,timestamp:Date.now()}}getDataPathTransformStats(){const e=this.dataPathTransforms,t={};let s=0;const i={};for(const d of e){t[d.dataSourceId]=(t[d.dataSourceId]||0)+1,s+=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:t,warningsCount:s,commonWarnings:o}}getDataPathTransformForDataSource(e){return this.dataPathTransforms.find(t=>t.dataSourceId===e)}clearDataPathTransforms(){this.dataPathTransforms=[]}trackNestedContext(e){if(!this.config.enabled)return"";const t=`nested-${++this.nestedContextIdCounter}`,s=[...new Set([...e.parentContext.available,...e.ownContext.added])],i={...e.parentContext.values,...e.ownContext.values},o={id:t,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:s,values:this.safeClone(i)},accessAttempts:[],depth:e.depth,parentId:e.parentId};return this.nestedContexts.push(o),this.nestedContexts.length>this.maxNestedContexts&&this.nestedContexts.shift(),t}trackNestedContextAccess(e,t){if(!this.config.enabled)return;const s=this.nestedContexts.find(i=>i.id===e);s&&s.accessAttempts.push({path:t.path,found:t.found,value:t.found?this.safeClone(t.value):void 0,error:t.error})}getNestedContextTrackingInfo(){const e=this.getNestedContextStats();return{contexts:[...this.nestedContexts],stats:e,timestamp:Date.now()}}getNestedContextStats(){const e=this.nestedContexts,t={expandChildren:0,cellChildren:0,iteration:0,modal:0,slot:0};let s=0,i=0;const o={};for(const g of e){t[g.componentType]++,g.depth>s&&(s=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:t,maxDepth:s,failedAccessCount:i,commonFailedPaths:d}}getNestedContextForComponent(e){return this.nestedContexts.find(t=>t.componentId===e)}clearNestedContexts(){this.nestedContexts=[],this.nestedContextIdCounter=0}trackHandlerRegistration(e,t="custom",s,i){this.isEnabled&&this.handlers.set(e,{name:e,category:t,description:s,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(t=>t.category===e)}clearHandlers(){this.handlers.clear()}trackEventSubscribe(e){if(!this.isEnabled)return;const t=this.componentEventSubscriptions.get(e),s=Date.now();t?(t.subscriberCount++,t.lastSubscribedAt=s):this.componentEventSubscriptions.set(e,{eventName:e,subscriberCount:1,firstSubscribedAt:s,lastSubscribedAt:s})}trackEventUnsubscribe(e){if(!this.isEnabled)return;const t=this.componentEventSubscriptions.get(e);t&&(t.subscriberCount--,t.subscriberCount<=0&&this.componentEventSubscriptions.delete(e))}trackEventEmit(e,t,s,i,o){if(!this.isEnabled)return;const d={id:`evt_${++this.componentEventIdCounter}`,eventName:e,data:this.sanitizeForLogging(t),timestamp:Date.now(),listenerCount:s,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((t,s)=>t+s.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,t,s,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(t),newValue:this.sanitizeForLogging(s),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,t,s,i=[],o=[],d){if(!this.config.enabled)return;const g=this.componentRenderCounts.get(t)||0;this.componentRenderCounts.set(t,g+1);for(const h of i)this.stateToComponentMap.has(h)||this.stateToComponentMap.set(h,new Set),this.stateToComponentMap.get(h).add(t);if(this.currentStateChangeContext){const h={componentId:e,componentName:t,renderDuration:s,accessedStatePaths:i,evaluatedBindings:o,renderOrder:this.currentStateChangeContext.renderedComponents.length,parentId:d};this.currentStateChangeContext.renderedComponents.push(h)}this.trackRender(t)}completeStateChange(e){if(!this.config.enabled||!this.currentStateChangeContext||this.currentStateChangeContext.setStateId!==e)return;const t=this.currentStateChangeContext,i=performance.now()-t.startTime,o=this.stateRenderingLogs.findIndex(d=>d.setStateId===e);if(o>=0){const d=this.stateRenderingLogs[o];d.renderedComponents=t.renderedComponents,d.totalRenderDuration=i,d.affectedBindingsCount=t.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,t=Object.fromEntries(this.componentRenderCounts),s={};for(const[i,o]of this.stateToComponentMap)s[i]=Array.from(o);return{logs:e,componentRenderCounts:t,stateToComponentMap:s,stats:this.calculateStateRenderingStats()}}calculateStateRenderingStats(){const e=this.stateRenderingLogs;if(e.length===0)return{totalStateChanges:0,totalRenders:0,avgRenderDuration:0,avgComponentsPerChange:0,topRenderedComponents:[],topInfluentialPaths:[]};const t=e.reduce((g,h)=>g+h.renderedComponents.length,0),s=e.reduce((g,h)=>g+h.totalRenderDuration,0)/e.length,i=t/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:t,avgRenderDuration:s,avgComponentsPerChange:i,topRenderedComponents:o,topInfluentialPaths:d}}getComponentsAffectedByState(e){const t=this.stateToComponentMap.get(e);return t?Array.from(t):[]}getComponentRenderHistory(e){return this.stateRenderingLogs.filter(t=>t.renderedComponents.some(s=>s.componentName===e))}clearStateRenderingLogs(){this.stateRenderingLogs=[],this.componentRenderCounts.clear(),this.stateToComponentMap.clear(),this.currentStateChangeContext=null,this.stateRenderingIdCounter=0}trackComponentStateSource(e,t,s,i){this.config.enabled&&this.componentStateSources.set(e,{componentId:e,componentName:t,stateSource:s,stateProvider:i})}trackDynamicState(e,t){this.config.enabled&&this.dynamicStates.set(e,t)}trackContextFlow(e,t,s,i,o,d){if(!this.config.enabled)return;const g={component:t,componentId:e,contextReceived:s,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 t=this.buildStateHierarchyLayers(),s=this.detectStateConflicts(t),i=Array.from(this.componentStateSources.values());return{layers:e?t.map(d=>({...d,values:this.summarizeValues(d.values,2)})):t,conflicts:s,componentStateSources:i,timestamp:Date.now()}}summarizeValues(e,t,s=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(s>=t){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,t,s+1)):{__type:"array",__length:e.length,__preview:e.slice(0,3).map(d=>this.summarizeValues(d,t,s+1))};const i={},o=Object.keys(e);for(const d of o)i[d]=this.summarizeValues(e[d],t,s+1);return i}buildStateHierarchyLayers(){const e=[];try{const s=window.G7Core?.state?.get?.();if(!s)return e;s._local&&e.push({name:"Global _local",type:"global",path:"_local",values:s._local,priority:1}),s._global&&e.push({name:"Global _global",type:"global",path:"_global",values:s._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(s._local||{});e.push({name:"Effective _local (merged)",type:"effective",values:i,priority:3})}catch(t){console.warn("[G7DevTools] 상태 계층 빌드 실패:",t)}return e}computeEffectiveState(e){const t={...e};for(const[,s]of this.dynamicStates)s._local&&Object.assign(t,s._local);return t}detectStateConflicts(e){const t=[],s=e.find(o=>o.type==="global"&&o.path==="_local");if(!s)return t;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=s.values[g];if(JSON.stringify(f)!==JSON.stringify(h)){const p=[],y=[];for(const x of this.componentStateSources.values())x.stateSource.local.some(v=>v===`_local.${g}`||v===g)&&(x.stateProvider.type==="dynamicState"?p.push(x.componentName):x.stateProvider.type==="globalState"&&y.push(x.componentName));t.push({path:`_local.${g}`,globalValue:f,dynamicStateValue:h,effectiveValue:h,usedBy:p,notUsedBy:y,severity:y.length>0?"warning":"info",description:y.length>0?`${y.join(", ")}은(는) globalState._local을 읽어 dynamicState 값을 사용하지 못함`:"dynamicState 값이 globalState와 다르지만 모든 컴포넌트가 dynamicState를 사용"})}}}return t}getContextFlowInfo(){const e=[],t=new Set(this.contextFlowNodes.keys());for(const s of this.contextFlowNodes.values())if(s.children)for(const i of s.children)t.delete(i.componentId);for(const s of t){const i=this.contextFlowNodes.get(s);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,t,s,i){if(!this.config.enabled)return;const o=this.analyzeTailwindClasses(s),d={componentId:e,componentName:t,classes:s,computedStyles:i,tailwindAnalysis:o};this.componentStyles.set(e,d),this.detectStyleIssues(d)}analyzeTailwindClasses(e){const t=[],s=[],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:")&&t.push(h);for(const f of d)if(h.startsWith(f)){s.push(h);break}for(const f of g)if(f.test(h)){i.push(h);break}}return{usedClasses:o,darkClasses:t,responsiveClasses:s,dynamicClasses:i}}detectStyleIssues(e){const{componentId:t,componentName:s,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:t,componentName:s,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:t,componentName:s,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:t,componentName:s,property:"class",currentValue:o.dynamicClasses.join(", "),severity:"info",description:"동적으로 생성된 Tailwind 클래스가 있습니다.",suggestion:"tailwind.config.js의 safelist에 추가하거나 전체 클래스명을 상수로 정의하세요."})}addStyleIssue(e){this.styleIssues.some(s=>s.componentId===e.componentId&&s.type===e.type&&s.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(t=>t.type==="invisible-element").length,tailwindIssueCount:this.styleIssues.filter(t=>t.type==="tailwind-purging").length,darkModeIssueCount:this.styleIssues.filter(t=>t.type==="dark-mode-missing").length},timestamp:Date.now()}}clearStyleValidationData(){this.styleIssues=[],this.componentStyles.clear()}trackAuthEvent(e,t,s,i){if(!this.config.enabled)return;const o={id:`auth_${++this.authEventIdCounter}`,type:e,timestamp:Date.now(),success:t,error:s,details:i};this.authEvents.push(o),this.authEvents.length>this.maxAuthEventHistory&&(this.authEvents=this.authEvents.slice(-this.maxAuthEventHistory))}trackAuthHeader(e,t,s,i,o){if(!this.config.enabled)return;const d={url:e,hasAuthHeader:t,headerType:s,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,t=e?.api;let s=e?.auth;!s&&e?.AuthManager?.getInstance&&(s=e.AuthManager.getInstance());const i=t?.getToken?.()||s?.getAccessToken?.()||localStorage.getItem("auth_token")||localStorage.getItem("access_token"),o=s?.getRefreshToken?.()||localStorage.getItem("refresh_token");let d="unknown",g=s?.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=s?.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 y;i&&typeof i=="string"&&i.length>20?y=`${i.substring(0,10)}...${i.substring(i.length-6)}`:i&&(y="***");const x=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:x,tokens:{hasAccessToken:!!i,hasRefreshToken:!!o,storage:f,accessTokenPreview:y},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(t=>t.type==="login").length,successfulLogins:e.filter(t=>t.type==="login"&&t.success).length,failedLogins:e.filter(t=>t.type==="login"&&!t.success).length,tokenRefreshes:e.filter(t=>t.type==="token-refresh").length,unauthorizedResponses:e.filter(t=>t.type==="api-unauthorized").length},timestamp:Date.now()}}clearAuthData(){this.authEvents=[],this.authHeaderHistory=[],this.authEventIdCounter=0}trackLayoutLoad(e,t,s,i="api"){if(!this.config.enabled)return;const o=Date.now();this.currentLayout={layoutPath:e,templateId:t,layoutJson:this.sanitizeObject(s),loadedAt:o,version:s.version,layoutName:s.layout_name,source:i};const d={id:`layout-${++this.layoutIdCounter}`,layoutPath:e,templateId:t,loadedAt:o,source:i,version:s.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 t=`exec_${++this.executionIdCounter}_${Date.now()}`,s={handlerName:e,executionId:t,startTime:Date.now(),stateChanges:[],dataSourceChanges:[],alerts:[]};if(this.executionDetails.set(t,s),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 t}endHandlerExecution(e,t,s,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=t,o.exitLocation=s,o.exitDescription=i;const d=this.changeExpectations.get(e);d&&(o.expectedChanges=d,this.checkExpectations(e,o,d),this.changeExpectations.delete(e)),t==="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"}),(t==="early-return-condition"||t==="early-return-validation")&&this.addChangeAlert(e,{type:"early-return-detected",severity:"info",message:`핸들러 "${o.handlerName}"이(가) early return으로 종료됨`,description:i||`종료 위치: ${s||"알 수 없음"}`,handlerName:o.handlerName,suggestion:t==="early-return-validation"?"검증 실패로 인한 early return입니다. 입력 데이터를 확인하세요.":"조건부 early return입니다. 조건문의 평가 결과를 확인하세요."})}recordExitReason(e,t,s,i){if(!this.config.enabled||!e)return;const o=this.executionDetails.get(e);o&&(o.exitReason=t,o.exitLocation=s,o.exitDescription=i)}recordStateChange(e,t,s,i,o){if(!this.config.enabled)return;const d={id:`sc_${++this.stateChangeIdCounter}`,path:t,changeType:s,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:`상태 "${t}"가 변경되었으나 값이 동일함`,description:"객체 참조가 동일하거나 깊은 비교 결과 변경이 없습니다. 변경 감지가 실패할 수 있습니다.",handlerName:e&&this.executionDetails.get(e)?.handlerName||"unknown",statePath:t,suggestion:"불변성을 유지하여 새 객체를 생성하세요. 예: { ...oldObject, newField: value }",docLink:".claude/docs/frontend/troubleshooting-state.md#object-mutation"})}recordDataSourceChange(e,t,s,i,o){if(!this.config.enabled)return;const d={dataSourceId:t,changeType:s,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,t,s){if(!this.config.enabled||!e)return;const i=this.executionDetails.get(e);if(!i)return;const o={expectedStatePaths:t,expectedDataSources:s,setAt:Date.now(),source:i.handlerName};this.changeExpectations.set(e,o)}checkExpectations(e,t,s){const i=new Set(t.stateChanges.map(d=>d.path)),o=new Set(t.dataSourceChanges.map(d=>d.dataSourceId));for(const d of s.expectedStatePaths)i.has(d)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 상태 변경 "${d}"가 발생하지 않음`,description:`핸들러 "${t.handlerName}"이(가) "${d}" 변경을 예고했지만 실제로 변경되지 않았습니다.`,handlerName:t.handlerName,statePath:d,suggestion:"핸들러 내부 로직을 확인하세요. early return이나 조건부 분기로 인해 변경이 생략되었을 수 있습니다.",docLink:".claude/docs/frontend/troubleshooting-state.md"});for(const d of s.expectedDataSources)o.has(d)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 데이터소스 갱신 "${d}"가 발생하지 않음`,description:`핸들러 "${t.handlerName}"이(가) "${d}" 갱신을 예고했지만 실제로 갱신되지 않았습니다.`,handlerName:t.handlerName,dataSourceId:d,suggestion:"refetchDataSource 호출이 실행되었는지 확인하세요.",docLink:".claude/docs/frontend/data-sources.md"})}addChangeAlert(e,t){const s={...t,id:`alert_${++this.alertIdCounter}`,timestamp:Date.now()};if(this.changeAlerts.push(s),e){const i=this.executionDetails.get(e);i&&i.alerts.push(s)}this.changeAlerts.length>this.maxChangeAlerts&&this.changeAlerts.splice(0,this.changeAlerts.length-this.maxChangeAlerts)}compareValues(e,t){const s=this.getValueType(e),i=this.getValueType(t),o=s!==i;let d=!1,g;return!o&&(s==="object"||s==="array")?(d=this.deepEqual(e,t),!d&&s==="object"&&(g=this.getChangedKeys(e,t))):d=e===t,{typeChanged:o,oldType:s,newType:i,isDeepEqual:d,changedKeys:g}}getValueType(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}deepEqual(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e===null||t===null||typeof e!="object")return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;const s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(const o of s)if(!i.includes(o)||!this.deepEqual(e[o],t[o]))return!1;return!0}getChangedKeys(e,t){const s=[],i=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of i)this.deepEqual(e[o],t[o])||s.push(o);return s}getChangeDetectionInfo(){const e=Array.from(this.executionDetails.values()),t={totalExecutions:e.length,executionsWithStateChange:e.filter(s=>s.stateChanges.length>0).length,executionsWithoutStateChange:e.filter(s=>s.stateChanges.length===0&&s.exitReason==="normal").length,earlyReturnCount:e.filter(s=>s.exitReason==="early-return-condition"||s.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:t,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 t of this.changeAlerts)e[t.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,t){let s=[...this.changeAlerts];return t&&(s=s.filter(i=>i.severity===t)),s.slice(-e)}getHandlerExecutions(e,t=10){return Array.from(this.executionDetails.values()).filter(i=>i.handlerName===e).slice(-t)}findExecutionInStack(e){return this.sequenceExecutionStack.find(t=>t.sequenceId===e)}startSequenceExecution(e){if(!this.config.enabled)return"";const t=`seq_${++this.sequenceIdCounter}_${Date.now()}`,s={sequenceId:t,startTime:Date.now(),totalDuration:0,trigger:e,actions:[],status:"running"};return this.sequenceExecutionStack.push(s),t}captureSequenceActionBefore(e,t,s,i,o){if(!this.config.enabled)return;const d=this.findExecutionInStack(e);if(!d)return;const g={index:t,handler:s,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,t,s,i,o,d){if(!this.config.enabled)return;const g=this.findExecutionInStack(e);if(!g)return;const h=g.actions.find(p=>p.index===t);if(!h)return;h.stateAfterAction={_global:this.safeClone(s._global),_local:this.safeClone(s._local),_isolated:s._isolated?this.safeClone(s._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,t){if(!this.config.enabled)return;const s=this.sequenceExecutionStack.findIndex(o=>o.sequenceId===e);if(s===-1)return;const i=this.sequenceExecutionStack[s];if(i.endTime=Date.now(),i.totalDuration=i.endTime-i.startTime,t){i.status="error",i.error={name:t.name,message:t.message,stack:t.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(s,1)}computeStateDiff(e,t){const s=[],i=[],o=[],d=new Set(Object.keys(e)),g=new Set(Object.keys(t));for(const h of g)d.has(h)||s.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=t[h];JSON.stringify(f)!==JSON.stringify(p)&&o.push({path:h,oldValue:f,newValue:p})}return{added:s,removed:i,changed:o}}getSequenceTrackingInfo(){const e=this.getSequenceStats(),t=this.sequenceExecutionStack.length>0?this.sequenceExecutionStack[this.sequenceExecutionStack.length-1]:void 0;return{executions:[...this.sequenceExecutions],currentExecution:t,stats:e}}getSequenceStats(){const e=this.sequenceExecutions,t=e.length,s=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=t>0?e.reduce((f,p)=>f+p.totalDuration,0)/t: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:t,successCount:s,errorCount:i,totalActions:o,avgDuration:d,topHandlers:h}}clearSequenceData(){this.sequenceExecutions=[],this.sequenceExecutionStack=[],this.sequenceIdCounter=0}getSequenceExecution(e){const t=this.findExecutionInStack(e);return t||this.sequenceExecutions.find(s=>s.sequenceId===e)}getRecentSequences(e=10){return this.sequenceExecutions.slice(-e)}registerStateCaptureForHandler(e,t,s){if(!this.config.enabled)return;const i=new Map,o=Date.now();for(const d of t)i.set(d,{value:this.safeClone(s[d]),capturedAt:o});this.stateCaptureRegistry.set(e,i)}detectStaleClosure(e,t,s,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 y=this.getValueByPath(s,f),x=g-p.capturedAt;if(!this.isDeepEqual(p.value,y)&&x>0){const w=this.createStaleClosureWarning(i,t,f,p.value,p.capturedAt,y,g,x,o);h.push(w),this.addStaleClosureWarning(w)}}return this.stateCaptureRegistry.delete(e),h}trackStaleClosureWarning(e){if(!this.config.enabled)return;const t=Date.now(),s=this.createStaleClosureWarning(e.type,e.location,e.capturedPath,e.capturedValue,e.capturedAt,e.currentValue,t,t-e.capturedAt,e.actionId,e.stackTrace);this.addStaleClosureWarning(s)}createStaleClosureWarning(e,t,s,i,o,d,g,h,f,p){const y=this.getStaleClosureSeverity(e,h),{description:x,suggestion:w,docLink:v}=this.getStaleClosureMessages(e,s,h);return{id:`stale_${++this.staleClosureIdCounter}_${Date.now()}`,timestamp:Date.now(),type:e,location:t,capturedState:{path:s,capturedValue:this.safeClone(i),capturedAt:o},currentState:{path:s,currentValue:this.safeClone(d),retrievedAt:g},timeDiff:h,severity:y,description:x,suggestion:w,docLink:v,actionId:f,stackTrace:p}}getStaleClosureSeverity(e,t){if(t>5e3)return"error";if(t>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,t,s){const i=s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`;switch(e){case"async-state-capture":return{description:`await 후 ${i} 경과 시점에 '${t}' 상태가 변경됨. 캡처된 상태 대신 최신 상태를 사용해야 함`,suggestion:"await 이후에는 G7Core.state.get()으로 최신 상태를 다시 조회하거나, useRef + getter 패턴을 사용하세요",docLink:"troubleshooting-state-closure.md"};case"callback-state-capture":return{description:`콜백에서 ${i} 전에 캡처된 '${t}' 상태를 사용 중. 최신 상태와 다름`,suggestion:"콜백에서 상태를 참조할 때는 stateRef.current 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};case"timeout-state-capture":return{description:`setTimeout/setInterval 콜백에서 '${t}' 상태가 ${i} 전 값 사용 중`,suggestion:"타이머 콜백 내에서는 G7Core.state.get()으로 최신 상태를 조회하세요",docLink:"troubleshooting-state-closure.md"};case"sequence-state-mismatch":return{description:`sequence 내 '${t}' 상태가 이전 액션 결과와 불일치. context.state 대신 캡처된 값 사용 의심`,suggestion:"sequence 내에서는 context.state 또는 $prev를 사용하여 최신 상태를 참조하세요",docLink:"troubleshooting-state-setstate.md"};case"event-handler-stale":return{description:`이벤트 핸들러에서 ${i} 전에 바인딩된 '${t}' 상태 사용 중`,suggestion:"이벤트 핸들러에서 상태를 참조할 때는 useRef 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};default:return{description:`'${t}' 상태에서 stale closure 감지됨 (${i} 경과)`,suggestion:"상태 참조 시 최신 값을 사용하는지 확인하세요"}}}addStaleClosureWarning(e){this.staleClosureWarnings.push(e),this.staleClosureWarnings.length>this.maxStaleClosureWarnings&&this.staleClosureWarnings.shift()}getValueByPath(e,t){const s=t.split(".");let i=e;for(const o of s){if(i==null)return;i=i[o]}return i}isDeepEqual(e,t){if(e===t)return!0;if(e===null||t===null)return e===t;if(typeof e!=typeof t)return!1;if(typeof e!="object")return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}getStaleClosureTrackingInfo(){const e=this.getStaleClosureStats();return{warnings:[...this.staleClosureWarnings],stats:e,timestamp:Date.now()}}getStaleClosureStats(){const e=this.staleClosureWarnings,t={"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)t[h.type]++;const s={info:0,warning:0,error:0};for(const h of e)s[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:t,warningsBySeverity:s,topLocations:o,topAffectedPaths:g}}clearStaleClosureData(){this.staleClosureWarnings=[],this.staleClosureIdCounter=0,this.stateCaptureRegistry.clear()}getRecentStaleClosureWarnings(e=10,t){let s=[...this.staleClosureWarnings];return t&&(s=s.filter(i=>i.severity===t)),s.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(s=>{try{return JSON.parse(JSON.stringify(s))}catch{return"[Unserializable]"}});const t={};for(const s of Object.keys(e))try{t[s]=JSON.parse(JSON.stringify(e[s]))}catch{t[s]="[Unserializable]"}return t}}};H(_r,"instance");let Ns=_r;const Wn=nt("LayoutLoader");class Es extends Error{constructor(e,t,s){super(e),this.code=t,this.details=s,this.name="LayoutLoaderError"}}class Mg{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&&(Wn.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.layoutCache.clear())}getCacheVersion(){return this.cacheVersion}async loadLayout(e,t){const s=`${e}:${t}`;if(this.layoutCache.has(s)){Wn.log("Loading layout from cache:",t);const o=await this.layoutCache.get(s),d=JSON.parse(JSON.stringify(o));return this.currentLayout=d,Ns.getInstance().trackLayoutLoad(t,e,d,"cache"),d}const i=this.fetchLayout(e,t);return this.layoutCache.set(s,i),i}async fetchLayout(e,t,s=!1){try{let i;t.startsWith("__preview__/")?i=`/api/layouts/preview/${t.replace("__preview__/","")}.json`:i=`/api/layouts/${e}/${t}.json`;const o=this.cacheVersion>0?`${i}?v=${this.cacheVersion}`:i;Wn.log("Fetching layout from API:",o);const d=Bs(),g=s?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&&!s&&g){Wn.log("Token invalid, removing and retrying without token"),d.removeToken();try{return await this.fetchLayout(e,t,!0)}catch(w){throw w instanceof Es&&w.details?.status===401?new Es(w.message,w.code,{...w.details,hadToken:!0}):w}}const x=p?.message||p?.error;throw new Es(`Failed to fetch layout: ${f.status} ${f.statusText}`,"FETCH_FAILED",{status:f.status,statusText:f.statusText,url:o,apiMessage:x})}const y=p.data||p;return this.validateLayoutData(y),this.currentLayout=y,Ns.getInstance().trackLayoutLoad(t,e,y,"api"),Wn.log("Layout fetched and cached successfully:",y.layout_name),y}catch(i){const o=`${e}:${t}`;throw this.layoutCache.delete(o),i instanceof Es?i:new Es("Failed to load layout","LOAD_FAILED",{originalError:i})}}prefetchLayout(e,t){return this.loadLayout(e,t)}validateLayoutData(e){if(!e.version)throw new Es("Layout data missing required field: version","VALIDATION_FAILED",{field:"version"});if(!e.layout_name)throw new Es("Layout data missing required field: layout_name","VALIDATION_FAILED",{field:"layout_name"});if(!Array.isArray(e.components))throw new Es('Layout data field "components" must be an array',"VALIDATION_FAILED",{field:"components",value:e.components});Wn.log("Layout data validation passed")}renderLayout(e,t){try{const s=t||this.currentLayout;if(!s)throw new Es("No layout data to render","NO_LAYOUT_DATA");Wn.log("Rendering layout:",s.layout_name),e.innerHTML="",this.renderComponents(e,s.components),Wn.log("Layout rendered successfully")}catch(s){Wn.error("Render error:",s),this.renderErrorState(e,s)}}renderComponents(e,t){for(const s of t){const i=this.renderComponent(s);i&&e.appendChild(i)}}renderComponent(e){try{if(!this.componentRegistry.getComponent(e.type))return Wn.warn(`Component not found: ${e.type}`),this.createPlaceholderElement(e.type);const s=document.createElement("div");return s.setAttribute("data-component",e.type),e.props&&Object.entries(e.props).forEach(([i,o])=>{s.setAttribute(`data-prop-${i}`,JSON.stringify(o))}),e.children&&e.children.length>0?this.renderComponents(s,e.children):e.text&&(s.textContent=e.text),s}catch(t){return Wn.error(`Error rendering component ${e.type}:`,t),this.createErrorElement(e.type,t)}}createPlaceholderElement(e){const t=document.createElement("div");return t.className="component-placeholder",t.setAttribute("data-component-type",e),t.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>
|
||
`,t}createErrorElement(e,t){const s=document.createElement("div");return s.className="component-error",s.setAttribute("data-component-type",e),s.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;">${t?.message||"Unknown error"}</p>
|
||
</div>
|
||
`,s}renderErrorState(e,t){const s=t instanceof Error?t.message:String(t),i=t instanceof Es?t.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;
|
||
">${s}</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>
|
||
`,Wn.error("Error state rendered:",i,s)}getCurrentLayout(){return this.currentLayout}clear(){this.currentLayout=null,this.layoutCache.clear(),Wn.log("Layout data and cache cleared")}}const Mj=nt("TranslationContext"),qy=j.createContext(null),Lc=({children:r,translationEngine:e,translationContext:t})=>{const s=j.useMemo(()=>(o,d)=>{if(d){const g="|"+Object.entries(d).map(([h,f])=>`${h}=${f}`).join("|");return e.translate(o,t,g)}return e.translate(o,t)},[e,t]),i=j.useMemo(()=>({translationEngine:e,translationContext:t,t:s}),[e,t,s]);return l.jsx(qy.Provider,{value:i,children:r})},$j=()=>{const r=j.useContext(qy);return r||(Mj.warn("TranslationProvider 외부에서 호출되었습니다. 키를 그대로 반환합니다."),{t:e=>e,translationEngine:null,translationContext:null})},Ia=nt("SlotContext"),Ij={registerToSlot:()=>{Ia.warn("SlotContext not available: registerToSlot called outside SlotProvider")},unregisterFromSlot:()=>{Ia.warn("SlotContext not available: unregisterFromSlot called outside SlotProvider")},getSlotComponents:()=>[],subscribeToSlot:()=>()=>{},clearAllSlots:()=>{},isEnabled:!1},zj=j.createContext(Ij),$g=({children:r})=>{const e=j.useRef(new Map),t=j.useRef(new Map),s=j.useCallback(p=>{const y=t.current.get(p);y&&y.forEach(x=>{try{x()}catch(w){Ia.error(`Slot subscriber error (slotId: ${p}):`,w)}})},[]),i=j.useCallback((p,y,x)=>{if(!p||!y){Ia.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(y);v&&v.registrationKey===x.registrationKey||(w.set(y,x),Ia.log(`Component registered to slot: ${y} -> ${p} (order: ${x.order})`),s(p))},[s]),o=j.useCallback((p,y)=>{const x=e.current.get(p);x&&x.has(y)&&(x.delete(y),Ia.log(`Component unregistered from slot: ${y} <- ${p}`),x.size===0&&e.current.delete(p),s(p))},[s]),d=j.useCallback(p=>{const y=e.current.get(p);return y?Array.from(y.values()).sort((x,w)=>x.order-w.order):[]},[]),g=j.useCallback((p,y)=>{t.current.has(p)||t.current.set(p,new Set);const x=t.current.get(p);return x.add(y),()=>{x.delete(y),x.size===0&&t.current.delete(p)}},[]),h=j.useCallback(()=>{e.current.forEach((p,y)=>{s(y)}),e.current.clear(),t.current.clear(),Ia.log("All slots cleared")},[s]),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,Ia.log("SlotContext exposed to window.__slotContextValue"))},[f]),l.jsx(zj.Provider,{value:f,children:r})};class Ig{constructor(){this.notificationCreatedEvent=".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"}listenForWhisper(e,t){return this.listen(".client-"+e,t)}notification(e){return this.listen(this.notificationCreatedEvent,e)}stopListeningForNotification(e){return this.stopListening(this.notificationCreatedEvent,e)}stopListeningForWhisper(e,t){return this.stopListening(".client-"+e,t)}}class Gy{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 Hj(r){try{new r}catch(e){if(e instanceof Error&&e.message.includes("is not a constructor"))return!1}return!0}class zg extends Ig{constructor(e,t,s){super(),this.name=t,this.pusher=e,this.options=s,this.eventFormatter=new Gy(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(e,t){return this.on(this.eventFormatter.format(e),t),this}listenToAll(e){return this.subscription.bind_global((t,s)=>{if(t.startsWith("pusher:"))return;let i=String(this.options.namespace??"").replace(/\./g,"\\"),o=t.startsWith(i)?t.substring(i.length+1):"."+t;e(o,s)}),this}stopListening(e,t){return t?this.subscription.unbind(this.eventFormatter.format(e),t):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",t=>{e(t)}),this}on(e,t){return this.subscription.bind(e,t),this}}class Fy extends zg{whisper(e,t){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,t),this}}class Pj extends zg{whisper(e,t){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,t),this}}class Uj extends Fy{here(e){return this.on("pusher:subscription_succeeded",t=>{e(Object.keys(t.members).map(s=>t.members[s]))}),this}joining(e){return this.on("pusher:member_added",t=>{e(t.info)}),this}whisper(e,t){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,t),this}leaving(e){return this.on("pusher:member_removed",t=>{e(t.info)}),this}}class Vy extends Ig{constructor(e,t,s){super(),this.events={},this.listeners={},this.name=t,this.socket=e,this.options=s,this.eventFormatter=new Gy(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,t){return this.on(this.eventFormatter.format(e),t),this}stopListening(e,t){return this.unbindEvent(this.eventFormatter.format(e),t),this}subscribed(e){return this.on("connect",t=>{e(t)}),this}error(e){return this}on(e,t){return this.listeners[e]=this.listeners[e]||[],this.events[e]||(this.events[e]=(s,i)=>{this.name===s&&this.listeners[e]&&this.listeners[e].forEach(o=>o(i))},this.socket.on(e,this.events[e])),this.listeners[e].push(t),this}unbind(){Object.keys(this.events).forEach(e=>{this.unbindEvent(e)})}unbindEvent(e,t){this.listeners[e]=this.listeners[e]||[],t&&(this.listeners[e]=this.listeners[e].filter(s=>s!==t)),(!t||this.listeners[e].length===0)&&(this.events[e]&&(this.socket.removeListener(e,this.events[e]),delete this.events[e]),delete this.listeners[e])}}class Ky extends Vy{whisper(e,t){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:t}),this}}class Bj extends Ky{here(e){return this.on("presence:subscribed",t=>{e(t.map(s=>s.user_info))}),this}joining(e){return this.on("presence:joining",t=>e(t.user_info)),this}whisper(e,t){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:t}),this}leaving(e){return this.on("presence:leaving",t=>e(t.user_info)),this}}class Mc extends Ig{subscribe(){}unsubscribe(){}listen(e,t){return this}listenToAll(e){return this}stopListening(e,t){return this}subscribed(e){return this}error(e){return this}on(e,t){return this}}class Wy extends Mc{whisper(e,t){return this}}class qj extends Mc{whisper(e,t){return this}}class Gj extends Wy{here(e){return this}joining(e){return this}whisper(e,t){return this}leaving(e){return this}}const Yy=class vw{constructor(e){this.setOptions(e),this.connect()}setOptions(e){this.options={...vw._defaultOptions,...e,broadcaster:e.broadcaster};let t=this.csrfToken();t&&(this.options.auth.headers["X-CSRF-TOKEN"]=t,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=t),t=this.options.bearerToken,t&&(this.options.auth.headers.Authorization="Bearer "+t,this.options.userAuthentication.headers.Authorization="Bearer "+t)}csrfToken(){var e,t;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"?((t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"))??null:null}};Yy._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let Hg=Yy;class $c extends Hg{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,t,s){return this.channel(e).listen(t,s)}channel(e){return this.channels[e]||(this.channels[e]=new zg(this.pusher,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new Fy(this.pusher,"private-"+e,this.options)),this.channels["private-"+e]}encryptedPrivateChannel(e){return this.channels["private-encrypted-"+e]||(this.channels["private-encrypted-"+e]=new Pj(this.pusher,"private-encrypted-"+e,this.options)),this.channels["private-encrypted-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new Uj(this.pusher,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"private-encrypted-"+e,"presence-"+e].forEach(t=>{this.leaveChannel(t)})}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 Fj extends Hg{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(t=>{t.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,t,s){return this.channel(e).listen(t,s)}channel(e){return this.channels[e]||(this.channels[e]=new Vy(this.socket,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new Ky(this.socket,"private-"+e,this.options)),this.channels["private-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new Bj(this.socket,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"presence-"+e].forEach(t=>{this.leaveChannel(t)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.socket.id}disconnect(){this.socket.disconnect()}}class Jy extends Hg{constructor(){super(...arguments),this.channels={}}connect(){}listen(e,t,s){return new Mc}channel(e){return new Mc}privateChannel(e){return new Wy}encryptedPrivateChannel(e){return new qj}presenceChannel(e){return new Gj}leave(e){}leaveChannel(e){}socketId(){return"fake-socket-id"}disconnect(){}}class Vj{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 $c({...this.options,cluster:""});else if(this.options.broadcaster==="pusher")this.connector=new $c(this.options);else if(this.options.broadcaster==="ably")this.connector=new $c({...this.options,cluster:"",broadcaster:"pusher"});else if(this.options.broadcaster==="socket.io")this.connector=new Fj(this.options);else if(this.options.broadcaster==="null")this.connector=new Jy(this.options);else if(typeof this.options.broadcaster=="function"&&Hj(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,t,s){return this.connector.listen(e,t,s)}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 $c||e instanceof Jy}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,t)=>{this.socketId()&&e.headers.set("X-Socket-ID",this.socketId()),t()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(e=>(this.socketId()&&(e.headers["X-Socket-Id"]=this.socketId()),e))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((e,t,s)=>{this.socketId()&&s.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",e=>{e.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}var Pg={exports:{}};/*!
|
||
* Pusher JavaScript Library v8.4.0
|
||
* https://pusher.com/
|
||
*
|
||
* Copyright 2020, Pusher
|
||
* Released under the MIT licence.
|
||
*/var Xy;function Kj(){return Xy||(Xy=1,(function(r,e){(function(s,i){r.exports=i()})(window,function(){return(function(t){var s={};function i(o){if(s[o])return s[o].exports;var d=s[o]={i:o,l:!1,exports:{}};return t[o].call(d.exports,d,d.exports,i),d.l=!0,d.exports}return i.m=t,i.c=s,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(t,s,i){var o=this&&this.__extends||(function(){var S=function(k,A){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,N){O.__proto__=N}||function(O,N){for(var D in N)N.hasOwnProperty(D)&&(O[D]=N[D])},S(k,A)};return function(k,A){S(k,A);function O(){this.constructor=k}k.prototype=A===null?Object.create(A):(O.prototype=A.prototype,new O)}})();Object.defineProperty(s,"__esModule",{value:!0});var d=256,g=(function(){function S(k){k===void 0&&(k="="),this._paddingCharacter=k}return S.prototype.encodedLength=function(k){return this._paddingCharacter?(k+2)/3*4|0:(k*8+5)/6|0},S.prototype.encode=function(k){for(var A="",O=0;O<k.length-2;O+=3){var N=k[O]<<16|k[O+1]<<8|k[O+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-O;if(D>0){var N=k[O]<<16|(D===2?k[O+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},S.prototype.maxDecodedLength=function(k){return this._paddingCharacter?k/4*3|0:(k*6+7)/8|0},S.prototype.decodedLength=function(k){return this.maxDecodedLength(k.length-this._getPaddingLength(k))},S.prototype.decode=function(k){if(k.length===0)return new Uint8Array(0);for(var A=this._getPaddingLength(k),O=k.length-A,N=new Uint8Array(this.maxDecodedLength(O)),D=0,$=0,M=0,z=0,K=0,ye=0,we=0;$<O-4;$+=4)z=this._decodeChar(k.charCodeAt($+0)),K=this._decodeChar(k.charCodeAt($+1)),ye=this._decodeChar(k.charCodeAt($+2)),we=this._decodeChar(k.charCodeAt($+3)),N[D++]=z<<2|K>>>4,N[D++]=K<<4|ye>>>2,N[D++]=ye<<6|we,M|=z&d,M|=K&d,M|=ye&d,M|=we&d;if($<O-1&&(z=this._decodeChar(k.charCodeAt($)),K=this._decodeChar(k.charCodeAt($+1)),N[D++]=z<<2|K>>>4,M|=z&d,M|=K&d),$<O-2&&(ye=this._decodeChar(k.charCodeAt($+2)),N[D++]=K<<4|ye>>>2,M|=ye&d),$<O-3&&(we=this._decodeChar(k.charCodeAt($+3)),N[D++]=ye<<6|we,M|=we&d),M!==0)throw new Error("Base64Coder: incorrect characters for decoding");return N},S.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)},S.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},S.prototype._getPaddingLength=function(k){var A=0;if(this._paddingCharacter){for(var O=k.length-1;O>=0&&k[O]===this._paddingCharacter;O--)A++;if(k.length<4||A>2)throw new Error("Base64Coder: incorrect padding")}return A},S})();s.Coder=g;var h=new g;function f(S){return h.encode(S)}s.encode=f;function p(S){return h.decode(S)}s.decode=p;var y=(function(S){o(k,S);function k(){return S!==null&&S.apply(this,arguments)||this}return k.prototype._encodeByte=function(A){var O=A;return O+=65,O+=25-A>>>8&6,O+=51-A>>>8&-75,O+=61-A>>>8&-13,O+=62-A>>>8&49,String.fromCharCode(O)},k.prototype._decodeChar=function(A){var O=d;return O+=(44-A&A-46)>>>8&-d+A-45+62,O+=(94-A&A-96)>>>8&-d+A-95+63,O+=(47-A&A-58)>>>8&-d+A-48+52,O+=(64-A&A-91)>>>8&-d+A-65+0,O+=(96-A&A-123)>>>8&-d+A-97+26,O},k})(g);s.URLSafeCoder=y;var x=new y;function w(S){return x.encode(S)}s.encodeURLSafe=w;function v(S){return x.decode(S)}s.decodeURLSafe=v,s.encodedLength=function(S){return h.encodedLength(S)},s.maxDecodedLength=function(S){return h.maxDecodedLength(S)},s.decodedLength=function(S){return h.decodedLength(S)}}),(function(t,s,i){Object.defineProperty(s,"__esModule",{value:!0});var o="utf8: invalid string",d="utf8: invalid source encoding";function g(p){for(var y=new Uint8Array(h(p)),x=0,w=0;w<p.length;w++){var v=p.charCodeAt(w);v<128?y[x++]=v:v<2048?(y[x++]=192|v>>6,y[x++]=128|v&63):v<55296?(y[x++]=224|v>>12,y[x++]=128|v>>6&63,y[x++]=128|v&63):(w++,v=(v&1023)<<10,v|=p.charCodeAt(w)&1023,v+=65536,y[x++]=240|v>>18,y[x++]=128|v>>12&63,y[x++]=128|v>>6&63,y[x++]=128|v&63)}return y}s.encode=g;function h(p){for(var y=0,x=0;x<p.length;x++){var w=p.charCodeAt(x);if(w<128)y+=1;else if(w<2048)y+=2;else if(w<55296)y+=3;else if(w<=57343){if(x>=p.length-1)throw new Error(o);x++,y+=4}else throw new Error(o)}return y}s.encodedLength=h;function f(p){for(var y=[],x=0;x<p.length;x++){var w=p[x];if(w&128){var v=void 0;if(w<224){if(x>=p.length)throw new Error(d);var S=p[++x];if((S&192)!==128)throw new Error(d);w=(w&31)<<6|S&63,v=128}else if(w<240){if(x>=p.length-1)throw new Error(d);var S=p[++x],k=p[++x];if((S&192)!==128||(k&192)!==128)throw new Error(d);w=(w&15)<<12|(S&63)<<6|k&63,v=2048}else if(w<248){if(x>=p.length-2)throw new Error(d);var S=p[++x],k=p[++x],A=p[++x];if((S&192)!==128||(k&192)!==128||(A&192)!==128)throw new Error(d);w=(w&15)<<18|(S&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,y.push(String.fromCharCode(55296|w>>10)),w=56320|w&1023}}y.push(String.fromCharCode(w))}return y.join("")}s.decode=f}),(function(t,s,i){t.exports=i(3).default}),(function(t,s,i){i.r(s);class o{constructor(C,_){this.lastId=0,this.prefix=C,this.name=_}create(C){this.lastId++;var _=this.lastId,I=this.prefix+_,P=this.name+"["+_+"]",fe=!1,Ne=function(){fe||(C.apply(null,arguments),fe=!0)};return this[_]=Ne,{number:_,id:I,name:P,callback:Ne}}remove(C){delete this[C.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(C){this.options=C,this.receivers=C.receivers||d,this.loading={}}load(C,_,I){var P=this;if(P.loading[C]&&P.loading[C].length>0)P.loading[C].push(I);else{P.loading[C]=[I];var fe=Xe.createScriptRequest(P.getPath(C,_)),Ne=P.receivers.create(function(He){if(P.receivers.remove(Ne),P.loading[C]){var Qe=P.loading[C];delete P.loading[C];for(var ut=function(Kt){Kt||fe.cleanup()},yt=0;yt<Qe.length;yt++)Qe[yt](He,ut)}});fe.send(Ne)}}getRoot(C){var _,I=Xe.getDocument().location.protocol;return C&&C.useTLS||I==="https:"?_=this.options.cdn_https:_=this.options.cdn_http,_.replace(/\/*$/,"")+"/"+this.options.version}getPath(C,_){return this.getRoot(_)+"/"+C+this.options.suffix+".js"}}var p=new o("_pusher_dependencies","Pusher.DependenciesReceivers"),y=new f({cdn_http:h.cdn_http,cdn_https:h.cdn_https,version:h.VERSION,suffix:h.dependency_suffix,receivers:p});const x={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 C="See:",_=x.urls[T];if(!_)return"";let I;return _.fullUrl?I=_.fullUrl:_.path&&(I=x.baseUrl+_.path),I?`${C} ${I}`:""}},S;(function(T){T.UserAuthentication="user-authentication",T.ChannelAuthorization="channel-authorization"})(S||(S={}));class k extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class O extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class $ extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class z extends Error{constructor(C){super(C),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(C,_){super(_),this.status=C,Object.setPrototypeOf(this,new.target.prototype)}}var we=function(T,C,_,I,P){const fe=Xe.createXHR();fe.open("POST",_.endpoint,!0),fe.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var Ne in _.headers)fe.setRequestHeader(Ne,_.headers[Ne]);if(_.headersProvider!=null){let He=_.headersProvider();for(var Ne in He)fe.setRequestHeader(Ne,He[Ne])}return fe.onreadystatechange=function(){if(fe.readyState===4)if(fe.status===200){let He,Qe=!1;try{He=JSON.parse(fe.responseText),Qe=!0}catch{P(new K(200,`JSON returned from ${I.toString()} endpoint was invalid, yet status code was 200. Data was: ${fe.responseText}`),null)}Qe&&P(null,He)}else{let He="";switch(I){case S.UserAuthentication:He=v.buildLogSuffix("authenticationEndpoint");break;case S.ChannelAuthorization:He=`Clients must be authorized to join private or presence channels. ${v.buildLogSuffix("authorizationEndpoint")}`;break}P(new K(fe.status,`Unable to retrieve auth string from ${I.toString()} endpoint - received status: ${fe.status} from ${_.endpoint}. ${He}`),null)}},fe.send(C),fe};function J(T){return he(je(T))}var ve=String.fromCharCode,le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",de=function(T){var C=T.charCodeAt(0);return C<128?T:C<2048?ve(192|C>>>6)+ve(128|C&63):ve(224|C>>>12&15)+ve(128|C>>>6&63)+ve(128|C&63)},je=function(T){return T.replace(/[^\x00-\x7F]/g,de)},W=function(T){var C=[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=[le.charAt(_>>>18),le.charAt(_>>>12&63),C>=2?"=":le.charAt(_>>>6&63),C>=1?"=":le.charAt(_&63)];return I.join("")},he=window.btoa||function(T){return T.replace(/[\s\S]{1,3}/g,W)};class ee{constructor(C,_,I,P){this.clear=_,this.timer=C(()=>{this.timer&&(this.timer=P(this.timer))},I)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var X=ee;function se(T){window.clearTimeout(T)}function R(T){window.clearInterval(T)}class q extends X{constructor(C,_){super(setTimeout,se,C,function(I){return _(),null})}}class re extends X{constructor(C,_){super(setInterval,R,C,function(I){return _(),I})}}var xe={now(){return Date.now?Date.now():new Date().valueOf()},defer(T){return new q(0,T)},method(T,...C){var _=Array.prototype.slice.call(arguments,1);return function(I){return I[T].apply(I,_.concat(arguments))}}},oe=xe;function ke(T,...C){for(var _=0;_<C.length;_++){var I=C[_];for(var P in I)I[P]&&I[P].constructor&&I[P].constructor===Object?T[P]=ke(T[P]||{},I[P]):T[P]=I[P]}return T}function Oe(){for(var T=["Pusher"],C=0;C<arguments.length;C++)typeof arguments[C]=="string"?T.push(arguments[C]):T.push(_t(arguments[C]));return T.join(" : ")}function De(T,C){var _=Array.prototype.indexOf;if(T===null)return-1;if(_&&T.indexOf===_)return T.indexOf(C);for(var I=0,P=T.length;I<P;I++)if(T[I]===C)return I;return-1}function qe(T,C){for(var _ in T)Object.prototype.hasOwnProperty.call(T,_)&&C(T[_],_,T)}function Ie(T){var C=[];return qe(T,function(_,I){C.push(I)}),C}function Nt(T){var C=[];return qe(T,function(_){C.push(_)}),C}function Rt(T,C,_){for(var I=0;I<T.length;I++)C.call(_||window,T[I],I,T)}function Xt(T,C){for(var _=[],I=0;I<T.length;I++)_.push(C(T[I],I,T,_));return _}function Mt(T,C){var _={};return qe(T,function(I,P){_[P]=C(I)}),_}function Qt(T,C){C=C||function(P){return!!P};for(var _=[],I=0;I<T.length;I++)C(T[I],I,T,_)&&_.push(T[I]);return _}function Et(T,C){var _={};return qe(T,function(I,P){(C&&C(I,P,T,_)||I)&&(_[P]=I)}),_}function Dn(T){var C=[];return qe(T,function(_,I){C.push([I,_])}),C}function Ce(T,C){for(var _=0;_<T.length;_++)if(C(T[_],_,T))return!0;return!1}function Ge(T,C){for(var _=0;_<T.length;_++)if(!C(T[_],_,T))return!1;return!0}function at(T){return Mt(T,function(C){return typeof C=="object"&&(C=_t(C)),encodeURIComponent(J(C.toString()))})}function pt(T){var C=Et(T,function(I){return I!==void 0}),_=Xt(Dn(at(C)),oe.method("join","=")).join("&");return _}function bt(T){var C=[],_=[];return(function I(P,fe){var Ne,He,Qe;switch(typeof P){case"object":if(!P)return null;for(Ne=0;Ne<C.length;Ne+=1)if(C[Ne]===P)return{$ref:_[Ne]};if(C.push(P),_.push(fe),Object.prototype.toString.apply(P)==="[object Array]")for(Qe=[],Ne=0;Ne<P.length;Ne+=1)Qe[Ne]=I(P[Ne],fe+"["+Ne+"]");else{Qe={};for(He in P)Object.prototype.hasOwnProperty.call(P,He)&&(Qe[He]=I(P[He],fe+"["+JSON.stringify(He)+"]"))}return Qe;case"number":case"string":case"boolean":return P}})(T,"$")}function _t(T){try{return JSON.stringify(T)}catch{return JSON.stringify(bt(T))}}class mt{constructor(){this.globalLog=C=>{window.console&&window.console.log&&window.console.log(C)}}debug(...C){this.log(this.globalLog,C)}warn(...C){this.log(this.globalLogWarn,C)}error(...C){this.log(this.globalLogError,C)}globalLogWarn(C){window.console&&window.console.warn?window.console.warn(C):this.globalLog(C)}globalLogError(C){window.console&&window.console.error?window.console.error(C):this.globalLogWarn(C)}log(C,..._){var I=Oe.apply(this,arguments);gl.log?gl.log(I):gl.logToConsole&&C.bind(this)(I)}}var tt=new mt,vn=function(T,C,_,I,P){(_.headers!==void 0||_.headersProvider!=null)&&tt.warn(`To send headers with the ${I.toString()} request, you must use AJAX, rather than JSONP.`);var fe=T.nextAuthCallbackID.toString();T.nextAuthCallbackID++;var Ne=T.getDocument(),He=Ne.createElement("script");T.auth_callbacks[fe]=function(yt){P(null,yt)};var Qe="Pusher.auth_callbacks['"+fe+"']";He.src=_.endpoint+"?callback="+encodeURIComponent(Qe)+"&"+C;var ut=Ne.getElementsByTagName("head")[0]||Ne.documentElement;ut.insertBefore(He,ut.firstChild)},wt=vn;class Tt{constructor(C){this.src=C}send(C){var _=this,I="Error loading "+_.src;_.script=document.createElement("script"),_.script.id=C.id,_.script.src=_.src,_.script.type="text/javascript",_.script.charset="UTF-8",_.script.addEventListener?(_.script.onerror=function(){C.callback(I)},_.script.onload=function(){C.callback(null)}):_.script.onreadystatechange=function(){(_.script.readyState==="loaded"||_.script.readyState==="complete")&&C.callback(null)},_.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(_.errorScript=document.createElement("script"),_.errorScript.id=C.id+"_error",_.errorScript.text=C.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 qt{constructor(C,_){this.url=C,this.data=_}send(C){if(!this.request){var _=pt(this.data),I=this.url+"/"+C.number+"?"+_;this.request=Xe.createScriptRequest(I),this.request.send(C)}}cleanup(){this.request&&this.request.cleanup()}}var Jn=function(T,C){return function(_,I){var P="http"+(C?"s":"")+"://",fe=P+(T.host||T.options.host)+T.options.path,Ne=Xe.createJSONPRequest(fe,_),He=Xe.ScriptReceivers.create(function(Qe,ut){d.remove(He),Ne.cleanup(),ut&&ut.host&&(T.host=ut.host),I&&I(Qe,ut)});Ne.send(He)}},un={name:"jsonp",getAgent:Jn},Rs=un;function ds(T,C,_){var I=T+(C.useTLS?"s":""),P=C.useTLS?C.hostTLS:C.hostNonTLS;return I+"://"+P+_}function V(T,C){var _="/app/"+T,I="?protocol="+h.PROTOCOL+"&client=js&version="+h.VERSION+(C?"&"+C:"");return _+I}var me={getInitial:function(T,C){var _=(C.httpPath||"")+V(T,"flash=false");return ds("ws",C,_)}},ue={getInitial:function(T,C){var _=(C.httpPath||"/pusher")+V(T);return ds("http",C,_)}},ne={getInitial:function(T,C){return ds("http",C,C.httpPath||"/pusher")},getPath:function(T,C){return V(T)}};class _e{constructor(){this._callbacks={}}get(C){return this._callbacks[Ae(C)]}add(C,_,I){var P=Ae(C);this._callbacks[P]=this._callbacks[P]||[],this._callbacks[P].push({fn:_,context:I})}remove(C,_,I){if(!C&&!_&&!I){this._callbacks={};return}var P=C?[Ae(C)]:Ie(this._callbacks);_||I?this.removeCallback(P,_,I):this.removeAllCallbacks(P)}removeCallback(C,_,I){Rt(C,function(P){this._callbacks[P]=Qt(this._callbacks[P]||[],function(fe){return _&&_!==fe.fn||I&&I!==fe.context}),this._callbacks[P].length===0&&delete this._callbacks[P]},this)}removeAllCallbacks(C){Rt(C,function(_){delete this._callbacks[_]},this)}}function Ae(T){return"_"+T}class Me{constructor(C){this.callbacks=new _e,this.global_callbacks=[],this.failThrough=C}bind(C,_,I){return this.callbacks.add(C,_,I),this}bind_global(C){return this.global_callbacks.push(C),this}unbind(C,_,I){return this.callbacks.remove(C,_,I),this}unbind_global(C){return C?(this.global_callbacks=Qt(this.global_callbacks||[],_=>_!==C),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(C,_,I){for(var P=0;P<this.global_callbacks.length;P++)this.global_callbacks[P](C,_);var fe=this.callbacks.get(C),Ne=[];if(I?Ne.push(_,I):_&&Ne.push(_),fe&&fe.length>0)for(var P=0;P<fe.length;P++)fe[P].fn.apply(fe[P].context||window,Ne);else this.failThrough&&this.failThrough(C,_);return this}}class ze extends Me{constructor(C,_,I,P,fe){super(),this.initialize=Xe.transportConnectionInitializer,this.hooks=C,this.name=_,this.priority=I,this.key=P,this.options=fe,this.state="new",this.timeline=fe.timeline,this.activityTimeout=fe.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 C=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(C,this.options)}catch(_){return oe.defer(()=>{this.onError(_),this.changeState("closed")}),!1}return this.bindListeners(),tt.debug("Connecting",{transport:this.name,url:C}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(C){return this.state==="open"?(oe.defer(()=>{this.socket&&this.socket.send(C)}),!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(C){this.emit("error",{type:"WebSocketError",error:C}),this.timeline.error(this.buildTimelineMessage({error:C.toString()}))}onClose(C){C?this.changeState("closed",{code:C.code,reason:C.reason,wasClean:C.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(C){this.emit("message",C)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=C=>{this.onError(C)},this.socket.onclose=C=>{this.onClose(C)},this.socket.onmessage=C=>{this.onMessage(C)},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(C,_){this.state=C,this.timeline.info(this.buildTimelineMessage({state:C,params:_})),this.emit(C,_)}buildTimelineMessage(C){return ke({cid:this.id},C)}}class Pe{constructor(C){this.hooks=C}isSupported(C){return this.hooks.isSupported(C)}createConnection(C,_,I,P){return new ze(this.hooks,C,_,I,P)}}var Te=new Pe({urls:me,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!Xe.getWebSocketAPI()},isSupported:function(){return!!Xe.getWebSocketAPI()},getSocket:function(T){return Xe.createWebSocket(T)}}),Fe={urls:ue,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},We=ke({getSocket:function(T){return Xe.HTTPFactory.createStreamingSocket(T)}},Fe),Je=ke({getSocket:function(T){return Xe.HTTPFactory.createPollingSocket(T)}},Fe),rt={isSupported:function(){return Xe.isXHRSupported()}},Ue=new Pe(ke({},We,rt)),Re=new Pe(ke({},Je,rt)),$e={ws:Te,xhr_streaming:Ue,xhr_polling:Re},lt=$e,Dt=new Pe({file:"sockjs",urls:ne,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(T,C){return new window.SockJS(T,null,{js_path:y.getPath("sockjs",{useTLS:C.useTLS}),ignore_null_origin:C.ignoreNullOrigin})},beforeOpen:function(T,C){T.send(JSON.stringify({path:C}))}}),tn={isSupported:function(T){var C=Xe.isXDRSupported(T.useTLS);return C}},xn=new Pe(ke({},We,tn)),Xn=new Pe(ke({},Je,tn));lt.xdr_streaming=xn,lt.xdr_polling=Xn,lt.sockjs=Dt;var Qn=lt;class Ws extends Me{constructor(){super();var C=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){C.emit("online")},!1),window.addEventListener("offline",function(){C.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var zn=new Ws;class gn{constructor(C,_,I){this.manager=C,this.transport=_,this.minPingDelay=I.minPingDelay,this.maxPingDelay=I.maxPingDelay,this.pingDelay=void 0}createConnection(C,_,I,P){P=ke({},P,{activityTimeout:this.pingDelay});var fe=this.transport.createConnection(C,_,I,P),Ne=null,He=function(){fe.unbind("open",He),fe.bind("closed",Qe),Ne=oe.now()},Qe=ut=>{if(fe.unbind("closed",Qe),ut.code===1002||ut.code===1003)this.manager.reportDeath();else if(!ut.wasClean&&Ne){var yt=oe.now()-Ne;yt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(yt/2,this.minPingDelay))}};return fe.bind("open",He),fe}isSupported(C){return this.manager.isAlive()&&this.transport.isSupported(C)}}const wn={decodeMessage:function(T){try{var C=JSON.parse(T.data),_=C.data;if(typeof _=="string")try{_=JSON.parse(C.data)}catch{}var I={event:C.event,channel:C.channel,data:_};return C.user_id&&(I.user_id=C.user_id),I}catch(P){throw{type:"MessageParseError",error:P,data:T.data}}},encodeMessage:function(T){return JSON.stringify(T)},processHandshake:function(T){var C=wn.decodeMessage(T);if(C.event==="pusher:connection_established"){if(!C.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:C.data.socket_id,activityTimeout:C.data.activity_timeout*1e3}}else{if(C.event==="pusher:error")return{action:this.getCloseAction(C.data),error:this.getCloseError(C.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 Hn=wn;class Jo extends Me{constructor(C,_){super(),this.id=C,this.transport=_,this.activityTimeout=_.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(C){return this.transport.send(C)}send_event(C,_,I){var P={event:C,data:_};return I&&(P.channel=I),tt.debug("Event sent",P),this.send(Hn.encodeMessage(P))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var C={message:I=>{var P;try{P=Hn.decodeMessage(I)}catch(fe){this.emit("error",{type:"MessageParseError",error:fe,data:I.data})}if(P!==void 0){switch(tt.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")}},_=()=>{qe(C,(I,P)=>{this.transport.unbind(P,I)})};qe(C,(I,P)=>{this.transport.bind(P,I)})}handleCloseEvent(C){var _=Hn.getCloseAction(C),I=Hn.getCloseError(C);I&&this.emit("error",I),_&&this.emit(_,{action:_,error:I})}}class bh{constructor(C,_){this.transport=C,this.callback=_,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=C=>{this.unbindListeners();var _;try{_=Hn.processHandshake(C)}catch(I){this.finish("error",{error:I}),this.transport.close();return}_.action==="connected"?this.finish("connected",{connection:new Jo(_.id,this.transport),activityTimeout:_.activityTimeout}):(this.finish(_.action,{error:_.error}),this.transport.close())},this.onClosed=C=>{this.unbindListeners();var _=Hn.getCloseAction(C)||"backoff",I=Hn.getCloseError(C);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(C,_){this.callback(ke({transport:this.transport,action:C},_))}}class vh{constructor(C,_){this.timeline=C,this.options=_||{}}send(C,_){this.timeline.isEmpty()||this.timeline.send(Xe.TimelineTransport.getAgent(this,C),_)}}class wi extends Me{constructor(C,_){super(function(I,P){tt.debug("No callbacks on "+C+" for "+I)}),this.name=C,this.pusher=_,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(C,_){return _(null,{auth:""})}trigger(C,_){if(C.indexOf("client-")!==0)throw new k("Event '"+C+"' does not start with 'client-'");if(!this.subscribed){var I=v.buildLogSuffix("triggeringClientEvents");tt.warn(`Client event triggered before channel 'subscription_succeeded' event . ${I}`)}return this.pusher.send_event(C,_,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(C){var _=C.event,I=C.data;if(_==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(C);else if(_==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(C);else if(_.indexOf("pusher_internal:")!==0){var P={};this.emit(_,I,P)}}handleSubscriptionSucceededEvent(C){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",C.data)}handleSubscriptionCountEvent(C){C.data.subscription_count&&(this.subscriptionCount=C.data.subscription_count),this.emit("pusher:subscription_count",C.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(C,_)=>{C?(this.subscriptionPending=!1,tt.error(C.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:C.message},C instanceof K?{status:C.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 ga extends wi{authorize(C,_){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:C},_)}}class Xo{constructor(){this.reset()}get(C){return Object.prototype.hasOwnProperty.call(this.members,C)?{id:C,info:this.members[C]}:null}each(C){qe(this.members,(_,I)=>{C(this.get(I))})}setMyID(C){this.myID=C}onSubscription(C){this.members=C.presence.hash,this.count=C.presence.count,this.me=this.get(this.myID)}addMember(C){return this.get(C.user_id)===null&&this.count++,this.members[C.user_id]=C.user_info,this.get(C.user_id)}removeMember(C){var _=this.get(C.user_id);return _&&(delete this.members[C.user_id],this.count--),_}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Ua=function(T,C,_,I){function P(fe){return fe instanceof _?fe:new _(function(Ne){Ne(fe)})}return new(_||(_=Promise))(function(fe,Ne){function He(yt){try{ut(I.next(yt))}catch(Kt){Ne(Kt)}}function Qe(yt){try{ut(I.throw(yt))}catch(Kt){Ne(Kt)}}function ut(yt){yt.done?fe(yt.value):P(yt.value).then(He,Qe)}ut((I=I.apply(T,C||[])).next())})};class Ba extends ga{constructor(C,_){super(C,_),this.members=new Xo}authorize(C,_){super.authorize(C,(I,P)=>Ua(this,void 0,void 0,function*(){if(!I)if(P=P,P.channel_data!=null){var fe=JSON.parse(P.channel_data);this.members.setMyID(fe.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 Ne=v.buildLogSuffix("authorizationEndpoint");tt.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${Ne}, or the user should be signed in.`),_("Invalid auth response");return}_(I,P)}))}handleEvent(C){var _=C.event;if(_.indexOf("pusher_internal:")===0)this.handleInternalEvent(C);else{var I=C.data,P={};C.user_id&&(P.user_id=C.user_id),this.emit(_,I,P)}}handleInternalEvent(C){var _=C.event,I=C.data;switch(_){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(C);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(C);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 fe=this.members.removeMember(I);fe&&this.emit("pusher:member_removed",fe);break}}handleSubscriptionSucceededEvent(C){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(C.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Tr=i(1),Ys=i(0);class nn extends ga{constructor(C,_,I){super(C,_),this.key=null,this.nacl=I}authorize(C,_){super.authorize(C,(I,P)=>{if(I){_(I,P);return}let fe=P.shared_secret;if(!fe){_(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(Ys.decode)(fe),delete P.shared_secret,_(null,P)})}trigger(C,_){throw new $("Client events are not currently supported for encrypted channels")}handleEvent(C){var _=C.event,I=C.data;if(_.indexOf("pusher_internal:")===0||_.indexOf("pusher:")===0){super.handleEvent(C);return}this.handleEncryptedEvent(_,I)}handleEncryptedEvent(C,_){if(!this.key){tt.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!_.ciphertext||!_.nonce){tt.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+_);return}let I=Object(Ys.decode)(_.ciphertext);if(I.length<this.nacl.secretbox.overheadLength){tt.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${I.length}`);return}let P=Object(Ys.decode)(_.nonce);if(P.length<this.nacl.secretbox.nonceLength){tt.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${P.length}`);return}let fe=this.nacl.secretbox.open(I,P,this.key);if(fe===null){tt.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,(Ne,He)=>{if(Ne){tt.error(`Failed to make a request to the authEndpoint: ${He}. Unable to fetch new key, so dropping encrypted event`);return}if(fe=this.nacl.secretbox.open(I,P,this.key),fe===null){tt.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(C,this.getDataToEmit(fe))});return}this.emit(C,this.getDataToEmit(fe))}getDataToEmit(C){let _=Object(Tr.decode)(C);try{return JSON.parse(_)}catch{return _}}}class md extends Me{constructor(C,_){super(),this.state="initialized",this.connection=null,this.key=C,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=Xe.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(C){return this.connection?this.connection.send(C):!1}send_event(C,_,I){return this.connection?this.connection.send_event(C,_,I):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var C=(_,I)=>{_?this.runner=this.strategy.connect(0,C):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,C)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var C=this.abandonConnection();C.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(C){this.timeline.info({action:"retry",delay:C}),C>0&&this.emit("connecting_in",Math.round(C/1e3)),this.retryTimer=new q(C||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(C){return ke({},C,{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(C){return ke({},C,{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 C=_=>I=>{I.error&&this.emit("error",{type:"WebSocketError",error:I.error}),_(I)};return{tls_only:C(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:C(()=>{this.disconnect()}),backoff:C(()=>{this.retryIn(1e3)}),retry:C(()=>{this.retryIn(0)})}}setConnection(C){this.connection=C;for(var _ in this.connectionCallbacks)this.connection.bind(_,this.connectionCallbacks[_]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var C in this.connectionCallbacks)this.connection.unbind(C,this.connectionCallbacks[C]);var _=this.connection;return this.connection=null,_}}updateState(C,_){var I=this.state;if(this.state=C,I!==C){var P=C;P==="connected"&&(P+=" with new socket ID "+_.socket_id),tt.debug("State changed",I+" -> "+P),this.timeline.info({state:C,params:_}),this.emit("state_change",{previous:I,current:C}),this.emit(C,_)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class yd{constructor(){this.channels={}}add(C,_){return this.channels[C]||(this.channels[C]=ha(C,_)),this.channels[C]}all(){return Nt(this.channels)}find(C){return this.channels[C]}remove(C){var _=this.channels[C];return delete this.channels[C],_}disconnect(){qe(this.channels,function(C){C.disconnect()})}}function ha(T,C){if(T.indexOf("private-encrypted-")===0){if(C.config.nacl)return Os.createEncryptedChannel(T,C,C.config.nacl);let _="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",I=v.buildLogSuffix("encryptedChannelSupport");throw new $(`${_}. ${I}`)}else{if(T.indexOf("private-")===0)return Os.createPrivateChannel(T,C);if(T.indexOf("presence-")===0)return Os.createPresenceChannel(T,C);if(T.indexOf("#")===0)throw new A('Cannot create a channel with name "'+T+'".');return Os.createChannel(T,C)}}var qa={createChannels(){return new yd},createConnectionManager(T,C){return new md(T,C)},createChannel(T,C){return new wi(T,C)},createPrivateChannel(T,C){return new ga(T,C)},createPresenceChannel(T,C){return new Ba(T,C)},createEncryptedChannel(T,C,_){return new nn(T,C,_)},createTimelineSender(T,C){return new vh(T,C)},createHandshake(T,C){return new bh(T,C)},createAssistantToTheTransportManager(T,C,_){return new gn(T,C,_)}},Os=qa;class Qo{constructor(C){this.options=C||{},this.livesLeft=this.options.lives||1/0}getAssistant(C){return Os.createAssistantToTheTransportManager(this,C,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Js{constructor(C,_){this.strategies=C,this.loop=!!_.loop,this.failFast=!!_.failFast,this.timeout=_.timeout,this.timeoutLimit=_.timeoutLimit}isSupported(){return Ce(this.strategies,oe.method("isSupported"))}connect(C,_){var I=this.strategies,P=0,fe=this.timeout,Ne=null,He=(Qe,ut)=>{ut?_(null,ut):(P=P+1,this.loop&&(P=P%I.length),P<I.length?(fe&&(fe=fe*2,this.timeoutLimit&&(fe=Math.min(fe,this.timeoutLimit))),Ne=this.tryStrategy(I[P],C,{timeout:fe,failFast:this.failFast},He)):_(!0))};return Ne=this.tryStrategy(I[P],C,{timeout:fe,failFast:this.failFast},He),{abort:function(){Ne.abort()},forceMinPriority:function(Qe){C=Qe,Ne&&Ne.forceMinPriority(Qe)}}}tryStrategy(C,_,I,P){var fe=null,Ne=null;return I.timeout>0&&(fe=new q(I.timeout,function(){Ne.abort(),P(!0)})),Ne=C.connect(_,function(He,Qe){He&&fe&&fe.isRunning()&&!I.failFast||(fe&&fe.ensureAborted(),P(He,Qe))}),{abort:function(){fe&&fe.ensureAborted(),Ne.abort()},forceMinPriority:function(He){Ne.forceMinPriority(He)}}}}class Zo{constructor(C){this.strategies=C}isSupported(){return Ce(this.strategies,oe.method("isSupported"))}connect(C,_){return Si(this.strategies,C,function(I,P){return function(fe,Ne){if(P[I].error=fe,fe){Ci(P)&&_(!0);return}Rt(P,function(He){He.forceMinPriority(Ne.transport.priority)}),_(null,Ne)}})}}function Si(T,C,_){var I=Xt(T,function(P,fe,Ne,He){return P.connect(C,_(fe,He))});return{abort:function(){Rt(I,Ls)},forceMinPriority:function(P){Rt(I,function(fe){fe.forceMinPriority(P)})}}}function Ci(T){return Ge(T,function(C){return!!C.error})}function Ls(T){!T.error&&!T.aborted&&(T.abort(),T.aborted=!0)}class Pn{constructor(C,_,I){this.strategy=C,this.transports=_,this.ttl=I.ttl||1800*1e3,this.usingTLS=I.useTLS,this.timeline=I.timeline}isSupported(){return this.strategy.isSupported()}connect(C,_){var I=this.usingTLS,P=wh(I),fe=P&&P.cacheSkipCount?P.cacheSkipCount:0,Ne=[this.strategy];if(P&&P.timestamp+this.ttl>=oe.now()){var He=this.transports[P.transport];He&&(["ws","wss"].includes(P.transport)||fe>3?(this.timeline.info({cached:!0,transport:P.transport,latency:P.latency}),Ne.push(new Js([He],{timeout:P.latency*2+1e3,failFast:!0}))):fe++)}var Qe=oe.now(),ut=Ne.pop().connect(C,function yt(Kt,Mr){Kt?(tl(I),Ne.length>0?(Qe=oe.now(),ut=Ne.pop().connect(C,yt)):_(Kt)):(el(I,Mr.transport.name,oe.now()-Qe,fe),_(null,Mr))});return{abort:function(){ut.abort()},forceMinPriority:function(yt){C=yt,ut&&ut.forceMinPriority(yt)}}}}function ji(T){return"pusherTransport"+(T?"TLS":"NonTLS")}function wh(T){var C=Xe.getLocalStorage();if(C)try{var _=C[ji(T)];if(_)return JSON.parse(_)}catch{tl(T)}return null}function el(T,C,_,I){var P=Xe.getLocalStorage();if(P)try{P[ji(T)]=_t({timestamp:oe.now(),transport:C,latency:_,cacheSkipCount:I})}catch{}}function tl(T){var C=Xe.getLocalStorage();if(C)try{delete C[ji(T)]}catch{}}class fa{constructor(C,{delay:_}){this.strategy=C,this.options={delay:_}}isSupported(){return this.strategy.isSupported()}connect(C,_){var I=this.strategy,P,fe=new q(this.options.delay,function(){P=I.connect(C,_)});return{abort:function(){fe.ensureAborted(),P&&P.abort()},forceMinPriority:function(Ne){C=Ne,P&&P.forceMinPriority(Ne)}}}}class Dr{constructor(C,_,I){this.test=C,this.trueBranch=_,this.falseBranch=I}isSupported(){var C=this.test()?this.trueBranch:this.falseBranch;return C.isSupported()}connect(C,_){var I=this.test()?this.trueBranch:this.falseBranch;return I.connect(C,_)}}class Un{constructor(C){this.strategy=C}isSupported(){return this.strategy.isSupported()}connect(C,_){var I=this.strategy.connect(C,function(P,fe){fe&&I.abort(),_(P,fe)});return I}}function pa(T){return function(){return T.isSupported()}}var xd=function(T,C,_){var I={};function P($r,Td,Dd,xl,bl){var vl=_(T,$r,Td,Dd,xl,bl);return I[$r]=vl,vl}var fe=Object.assign({},C,{hostNonTLS:T.wsHost+":"+T.wsPort,hostTLS:T.wsHost+":"+T.wssPort,httpPath:T.wsPath}),Ne=Object.assign({},fe,{useTLS:!0}),He=Object.assign({},C,{hostNonTLS:T.httpHost+":"+T.httpPort,hostTLS:T.httpHost+":"+T.httpsPort,httpPath:T.httpPath}),Qe={loop:!0,timeout:15e3,timeoutLimit:6e4},ut=new Qo({minPingDelay:1e4,maxPingDelay:T.activityTimeout}),yt=new Qo({lives:2,minPingDelay:1e4,maxPingDelay:T.activityTimeout}),Kt=P("ws","ws",3,fe,ut),Mr=P("wss","ws",3,Ne,ut),Ed=P("sockjs","sockjs",1,He),hl=P("xhr_streaming","xhr_streaming",1,He,yt),_d=P("xdr_streaming","xdr_streaming",1,He,yt),fl=P("xhr_polling","xhr_polling",1,He),Ya=P("xdr_polling","xdr_polling",1,He),Ad=new Js([Kt],Qe),zh=new Js([Mr],Qe),Hh=new Js([Ed],Qe),pl=new Js([new Dr(pa(hl),hl,_d)],Qe),ml=new Js([new Dr(pa(fl),fl,Ya)],Qe),Ja=new Js([new Dr(pa(pl),new Zo([pl,new fa(ml,{delay:4e3})]),ml)],Qe),ya=new Dr(pa(Ja),Ja,Hh),yl;return C.useTLS?yl=new Zo([Ad,new fa(ya,{delay:2e3})]):yl=new Zo([Ad,new fa(zh,{delay:2e3}),new fa(ya,{delay:5e3})]),new Pn(new Un(new Dr(pa(Kt),yl,ya)),I,{ttl:18e5,timeline:C.timeline,useTLS:C.useTLS})},nl=xd,Ga=(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"),y.load(T.hooks.file,{useTLS:T.options.useTLS},function(C,_){T.hooks.isInitialized()?(T.changeState("initialized"),_(!0)):(C&&T.onError(C),T.onClose(),_(!1))})):T.onClose()}),bd={getRequest:function(T){var C=new window.XDomainRequest;return C.ontimeout=function(){T.emit("error",new O),T.close()},C.onerror=function(_){T.emit("error",_),T.close()},C.onprogress=function(){C.responseText&&C.responseText.length>0&&T.onChunk(200,C.responseText)},C.onload=function(){C.responseText&&C.responseText.length>0&&T.onChunk(200,C.responseText),T.emit("finished",200),T.close()},C},abortRequest:function(T){T.ontimeout=T.onerror=T.onprogress=T.onload=null,T.abort()}},vd=bd;const Fa=256*1024;class Sh extends Me{constructor(C,_,I){super(),this.hooks=C,this.method=_,this.url=I}start(C){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},Xe.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(C)}close(){this.unloader&&(Xe.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(C,_){for(;;){var I=this.advanceBuffer(_);if(I)this.emit("chunk",{status:C,data:I});else break}this.isBufferTooLong(_)&&this.emit("buffer_too_long")}advanceBuffer(C){var _=C.slice(this.position),I=_.indexOf(`
|
||
`);return I!==-1?(this.position+=I+1,_.slice(0,I)):null}isBufferTooLong(C){return this.position===C.length&&C.length>Fa}}var ki;(function(T){T[T.CONNECTING=0]="CONNECTING",T[T.OPEN=1]="OPEN",T[T.CLOSED=3]="CLOSED"})(ki||(ki={}));var Xs=ki,sl=1;class Ch{constructor(C,_){this.hooks=C,this.session=Ei(1e3)+"/"+Va(8),this.location=jh(_),this.readyState=Xs.CONNECTING,this.openStream()}send(C){return this.sendRaw(JSON.stringify([C]))}ping(){this.hooks.sendHeartbeat(this)}close(C,_){this.onClose(C,_,!0)}sendRaw(C){if(this.readyState===Xs.OPEN)try{return Xe.createSocketRequest("POST",us(Ni(this.location,this.session))).start(C),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(C,_,I){this.closeStream(),this.readyState=Xs.CLOSED,this.onclose&&this.onclose({code:C,reason:_,wasClean:I})}onChunk(C){if(C.status===200){this.readyState===Xs.OPEN&&this.onActivity();var _,I=C.data.slice(0,1);switch(I){case"o":_=JSON.parse(C.data.slice(1)||"{}"),this.onOpen(_);break;case"a":_=JSON.parse(C.data.slice(1)||"[]");for(var P=0;P<_.length;P++)this.onEvent(_[P]);break;case"m":_=JSON.parse(C.data.slice(1)||"null"),this.onEvent(_);break;case"h":this.hooks.onHeartbeat(this);break;case"c":_=JSON.parse(C.data.slice(1)||"[]"),this.onClose(_[0],_[1],!0);break}}}onOpen(C){this.readyState===Xs.CONNECTING?(C&&C.hostname&&(this.location.base=al(this.location.base,C.hostname)),this.readyState=Xs.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(C){this.readyState===Xs.OPEN&&this.onmessage&&this.onmessage({data:C})}onActivity(){this.onactivity&&this.onactivity()}onError(C){this.onerror&&this.onerror(C)}openStream(){this.stream=Xe.createSocketRequest("POST",us(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",C=>{this.onChunk(C)}),this.stream.bind("finished",C=>{this.hooks.onFinished(this,C)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(C){oe.defer(()=>{this.onError(C),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function jh(T){var C=/([^\?]*)\/*(\??.*)/.exec(T);return{base:C[1],queryString:C[2]}}function Ni(T,C){return T.base+"/"+C+"/xhr_send"}function us(T){var C=T.indexOf("?")===-1?"?":"&";return T+C+"t="+ +new Date+"&n="+sl++}function al(T,C){var _=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(T);return _[1]+C+_[3]}function Ei(T){return Xe.randomInt(T)}function Va(T){for(var C=[],_=0;_<T;_++)C.push(Ei(32).toString(32));return C.join("")}var Ka=Ch,wd={getReceiveURL:function(T,C){return T.base+"/"+C+"/xhr_streaming"+T.queryString},onHeartbeat:function(T){T.sendRaw("[]")},sendHeartbeat:function(T){T.sendRaw("[]")},onFinished:function(T,C){T.onClose(1006,"Connection interrupted ("+C+")",!1)}},rl=wd,Sd={getReceiveURL:function(T,C){return T.base+"/"+C+"/xhr"+T.queryString},onHeartbeat:function(){},sendHeartbeat:function(T){T.sendRaw("[]")},onFinished:function(T,C){C===200?T.reconnect():T.onClose(1006,"Connection interrupted ("+C+")",!1)}},Rr=Sd,Ms={getRequest:function(T){var C=Xe.getXHRAPI(),_=new C;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()}},il=Ms,Or={createStreamingSocket(T){return this.createSocket(rl,T)},createPollingSocket(T){return this.createSocket(Rr,T)},createSocket(T,C){return new Ka(T,C)},createXHR(T,C){return this.createRequest(il,T,C)},createRequest(T,C,_){return new Sh(T,C,_)}},$s=Or;$s.createXDR=function(T,C){return this.createRequest(vd,T,C)};var ol=$s,_i={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:d,DependenciesReceivers:p,getDefaultStrategy:nl,Transports:Qn,transportConnectionInitializer:Ga,HTTPFactory:ol,TimelineTransport:Rs,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(T){window.Pusher=T;var C=()=>{this.onDocumentBody(T.ready)};window.JSON?C():y.load("json2",{},C)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:we,jsonp:wt}},onDocumentBody(T){document.body?T():setTimeout(()=>{this.onDocumentBody(T)},0)},createJSONPRequest(T,C){return new qt(T,C)},createScriptRequest(T){return new Tt(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 zn},createWebSocket(T){var C=this.getWebSocketAPI();return new C(T)},createSocketRequest(T,C){if(this.isXHRSupported())return this.HTTPFactory.createXHR(T,C);if(this.isXDRSupported(C.indexOf("https:")===0))return this.HTTPFactory.createXDR(T,C);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var T=this.getXHRAPI();return!!T&&new T().withCredentials!==void 0},isXDRSupported(T){var C=T?"https:":"http:",_=this.getProtocol();return!!window.XDomainRequest&&_===C},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)}},Xe=_i,Wa;(function(T){T[T.ERROR=3]="ERROR",T[T.INFO=6]="INFO",T[T.DEBUG=7]="DEBUG"})(Wa||(Wa={}));var ma=Wa;class Cd{constructor(C,_,I){this.key=C,this.session=_,this.events=[],this.options=I||{},this.sent=0,this.uniqueID=0}log(C,_){C<=this.options.level&&(this.events.push(ke({},_,{timestamp:oe.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(C){this.log(ma.ERROR,C)}info(C){this.log(ma.INFO,C)}debug(C){this.log(ma.DEBUG,C)}isEmpty(){return this.events.length===0}send(C,_){var I=ke({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=[],C(I,(P,fe)=>{P||this.sent++,_&&_(P,fe)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class _n{constructor(C,_,I,P){this.name=C,this.priority=_,this.transport=I,this.options=P||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(C,_){if(this.isSupported()){if(this.priority<C)return Qs(new N,_)}else return Qs(new z,_);var I=!1,P=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),fe=null,Ne=function(){P.unbind("initialized",Ne),P.connect()},He=function(){fe=Os.createHandshake(P,function(Kt){I=!0,yt(),_(null,Kt)})},Qe=function(Kt){yt(),_(Kt)},ut=function(){yt();var Kt;Kt=_t(P),_(new D(Kt))},yt=function(){P.unbind("initialized",Ne),P.unbind("open",He),P.unbind("error",Qe),P.unbind("closed",ut)};return P.bind("initialized",Ne),P.bind("open",He),P.bind("error",Qe),P.bind("closed",ut),P.initialize(),{abort:()=>{I||(yt(),fe?fe.close():P.close())},forceMinPriority:Kt=>{I||this.priority<Kt&&(fe?fe.close():P.close())}}}}function Qs(T,C){return oe.defer(function(){C(T)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Ai}=Xe;var Lr=function(T,C,_,I,P,fe){var Ne=Ai[_];if(!Ne)throw new M(_);var He=(!T.enabledTransports||De(T.enabledTransports,C)!==-1)&&(!T.disabledTransports||De(T.disabledTransports,C)===-1),Qe;return He?(P=Object.assign({ignoreNullOrigin:T.ignoreNullOrigin},P),Qe=new _n(C,I,fe?fe.getAssistant(Ne):Ne,P)):Qe=kh,Qe},kh={isSupported:function(){return!1},connect:function(T,C){var _=oe.defer(function(){C(new z)});return{abort:function(){_.ensureAborted()},forceMinPriority:function(){}}}};function ll(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&&tt.warn("The disableStats option is deprecated in favor of enableStats")}const cl=(T,C)=>{var _="socket_id="+encodeURIComponent(T.socketId);for(var I in C.params)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(C.params[I]);if(C.paramsProvider!=null){let P=C.paramsProvider();for(var I in P)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(P[I])}return _};var Di=T=>{if(typeof Xe.getAuthorizers()[T.transport]>"u")throw`'${T.transport}' is not a recognized auth transport`;return(C,_)=>{const I=cl(C,T);Xe.getAuthorizers()[T.transport](Xe,I,T,S.UserAuthentication,_)}};const jd=(T,C)=>{var _="socket_id="+encodeURIComponent(T.socketId);_+="&channel_name="+encodeURIComponent(T.channelName);for(var I in C.params)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(C.params[I]);if(C.paramsProvider!=null){let P=C.paramsProvider();for(var I in P)_+="&"+encodeURIComponent(I)+"="+encodeURIComponent(P[I])}return _};var Nh=T=>{if(typeof Xe.getAuthorizers()[T.transport]>"u")throw`'${T.transport}' is not a recognized auth transport`;return(C,_)=>{const I=jd(C,T);Xe.getAuthorizers()[T.transport](Xe,I,T,S.ChannelAuthorization,_)}};const Eh=(T,C,_)=>{const I={authTransport:C.transport,authEndpoint:C.endpoint,auth:{params:C.params,headers:C.headers}};return(P,fe)=>{const Ne=T.channel(P.channelName);_(Ne,I).authorize(P.socketId,fe)}};function dl(T,C){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:Rh(T),httpHost:_h(T),useTLS:Dh(T),wsHost:Ah(T),userAuthenticator:kd(T),channelAuthorizer:Lh(T,C)};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 _h(T){return T.httpHost?T.httpHost:T.cluster?`sockjs-${T.cluster}.pusher.com`:h.httpHost}function Ah(T){return T.wsHost?T.wsHost:Th(T.cluster)}function Th(T){return`ws-${T}.pusher.com`}function Dh(T){return Xe.getProtocol()==="https:"?!0:T.forceTLS!==!1}function Rh(T){return"enableStats"in T?T.enableStats:"disableStats"in T?!T.disableStats:!1}function kd(T){const C=Object.assign(Object.assign({},h.userAuthentication),T.userAuthentication);return"customHandler"in C&&C.customHandler!=null?C.customHandler:Di(C)}function Oh(T,C){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=Eh(C,_,T.authorizer))),_}function Lh(T,C){const _=Oh(T,C);return"customHandler"in _&&_.customHandler!=null?_.customHandler:Nh(_)}class Mh extends Me{constructor(C){super(function(_,I){tt.debug(`No callbacks on watchlist events for ${_}`)}),this.pusher=C,this.bindWatchlistInternalEvent()}handleEvent(C){C.data.events.forEach(_=>{this.emit(_.name,_)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",C=>{var _=C.event;_==="pusher_internal:watchlist_events"&&this.handleEvent(C)})}}function $h(){let T,C;return{promise:new Promise((I,P)=>{T=I,C=P}),resolve:T,reject:C}}var ul=$h;class Ih extends Me{constructor(C){super(function(_,I){tt.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(_){tt.warn(`Error during signin: ${_}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:I.auth,user_data:I.user_data})},this.pusher=C,this.pusher.connection.bind("state_change",({previous:_,current:I})=>{_!=="connected"&&I==="connected"&&this._signin(),_==="connected"&&I!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Mh(C),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(C){try{this.user_data=JSON.parse(C.user_data)}catch{tt.error(`Failed parsing user data after signin: ${C.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){tt.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const C=_=>{_.subscriptionPending&&_.subscriptionCancelled?_.reinstateSubscription():!_.subscriptionPending&&this.pusher.connection.state==="connected"&&_.subscribe()};this.serverToUserChannel=new wi(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((_,I)=>{_.indexOf("pusher_internal:")===0||_.indexOf("pusher:")===0||this.emit(_,I)}),C(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:C,resolve:_}=ul();C.done=!1;const I=()=>{C.done=!0};C.then(I).catch(I),this.signinDonePromise=C,this._signinDoneResolve=_}}class hn{static ready(){hn.isReady=!0;for(var C=0,_=hn.instances.length;C<_;C++)hn.instances[C].connect()}static getClientFeatures(){return Ie(Et({ws:Xe.Transports.ws},function(C){return C.isSupported({})}))}constructor(C,_){Nd(C),ll(_),this.key=C,this.config=dl(_,this),this.channels=Os.createChannels(),this.global_emitter=new Me,this.sessionID=Xe.randomInt(1e9),this.timeline=new Cd(this.key,this.sessionID,{cluster:this.config.cluster,features:hn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:ma.INFO,version:h.VERSION}),this.config.enableStats&&(this.timelineSender=Os.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+Xe.TimelineTransport.name}));var I=P=>Xe.getDefaultStrategy(this.config,P,Lr);this.connection=Os.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 fe=P.event,Ne=fe.indexOf("pusher_internal:")===0;if(P.channel){var He=this.channel(P.channel);He&&He.handleEvent(P)}Ne||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=>{tt.warn(P)}),hn.instances.push(this),this.timeline.info({instances:hn.instances.length}),this.user=new Ih(this),hn.isReady&&this.connect()}channel(C){return this.channels.find(C)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var C=this.connection.isUsingTLS(),_=this.timelineSender;this.timelineSenderTimer=new re(6e4,function(){_.send(C)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(C,_,I){return this.global_emitter.bind(C,_,I),this}unbind(C,_,I){return this.global_emitter.unbind(C,_,I),this}bind_global(C){return this.global_emitter.bind_global(C),this}unbind_global(C){return this.global_emitter.unbind_global(C),this}unbind_all(C){return this.global_emitter.unbind_all(),this}subscribeAll(){var C;for(C in this.channels.channels)this.channels.channels.hasOwnProperty(C)&&this.subscribe(C)}subscribe(C){var _=this.channels.add(C,this);return _.subscriptionPending&&_.subscriptionCancelled?_.reinstateSubscription():!_.subscriptionPending&&this.connection.state==="connected"&&_.subscribe(),_}unsubscribe(C){var _=this.channels.find(C);_&&_.subscriptionPending?_.cancelSubscription():(_=this.channels.remove(C),_&&_.subscribed&&_.unsubscribe())}send_event(C,_,I){return this.connection.send_event(C,_,I)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}hn.instances=[],hn.isReady=!1,hn.logToConsole=!1,hn.Runtime=Xe,hn.ScriptReceivers=Xe.ScriptReceivers,hn.DependenciesReceivers=Xe.DependenciesReceivers,hn.auth_callbacks=Xe.auth_callbacks;var gl=s.default=hn;function Nd(T){if(T==null)throw"You must pass your app key when you instantiate Pusher."}Xe.setup(hn)})])})})(Pg)),Pg.exports}var Wj=Kj();const Qy=aa(Wj),Ft=nt("WebSocketManager");class Yj{constructor(){H(this,"echo",null);H(this,"subscriptions",new Map);H(this,"initialized",!1);H(this,"config",null)}configure(e){if(this.initialized){Ft.warn("[WebSocketManager] 이미 초기화되어 설정을 변경할 수 없습니다.");return}this.config=e,Ft.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){Ft.warn("[WebSocketManager] WebSocket 설정이 없습니다. initTemplateApp에서 websocket 옵션을 전달해주세요.");return}const{appKey:e,host:t="localhost",port:s=80,scheme:i="https",authEndpoint:o="/api/broadcasting/auth"}=this.config,d=Number(s)||80,g=i==="https";Ft.log("[WebSocketManager] 연결 설정:",{host:t,port:d,scheme:i,useTLS:g,authEndpoint:o}),window.Pusher=Qy;const h=localStorage.getItem("auth_token"),f={wsHost:t,wsPort:d,wssPort:d,forceTLS:g,disableStats:!0,enabledTransports:["ws","wss"],cluster:"mt1",authEndpoint:o,auth:{headers:{Authorization:h?`Bearer ${h}`:"",Accept:"application/json"}}};Ft.log("[WebSocketManager] Pusher 옵션:",f);const p=new Qy(e,f);p.connection.bind("connecting",()=>{Ft.log("[WebSocketManager] 연결 시도 중...")}),p.connection.bind("connected",()=>{Ft.log("[WebSocketManager] 연결 성공! Socket ID:",p.connection.socket_id)}),p.connection.bind("failed",()=>{Ft.error("[WebSocketManager] 연결 실패 - WebSocket을 사용할 수 없습니다.")}),p.connection.bind("error",y=>{Ft.error("[WebSocketManager] 연결 오류:",y)}),p.connection.bind("state_change",y=>{Ft.log(`[WebSocketManager] 상태 변경: ${y.previous} → ${y.current}`)}),p.connection.bind("unavailable",()=>{Ft.error("[WebSocketManager] WebSocket 사용 불가 - 연결할 수 없습니다.")}),p.connection.bind("disconnected",()=>{Ft.warn("[WebSocketManager] 연결이 끊어졌습니다.")}),Ft.log("[WebSocketManager] 초기 연결 상태:",p.connection.state),this.echo=new Vj({broadcaster:"reverb",client:p}),Ft.log("[WebSocketManager] 연결 시작 시도..."),p.connect(),window.Echo=this.echo,this.initialized=!0,Ft.log("[WebSocketManager] Echo 초기화 완료")}subscribe(e,t,s,i={}){if(this.initialize(),!this.echo)return Ft.warn("[WebSocketManager] Echo가 초기화되지 않았습니다."),"";const{channelType:o="private"}=i,d=`${e}:${t}`;if(this.subscriptions.has(d))return Ft.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(`.${t}`,s),this.subscriptions.set(d,g),Ft.log(`[WebSocketManager] 구독 완료: ${d} (${o})`),d}unsubscribe(e){const t=this.subscriptions.get(e);if(!t)return;const s=e.lastIndexOf(":"),i=s>=0?e.substring(s+1):"";if(i)try{t.stopListening(`.${i}`)}catch(o){Ft.warn(`[WebSocketManager] stopListening 실패: ${e}`,o)}this.subscriptions.delete(e),Ft.log(`[WebSocketManager] 구독 해제: ${e}`)}leaveChannel(e){if(!this.echo)return;this.echo.leave(e);const t=[];this.subscriptions.forEach((s,i)=>{i.startsWith(`${e}:`)&&t.push(i)}),t.forEach(s=>this.subscriptions.delete(s)),Ft.log(`[WebSocketManager] 채널 구독 해제: ${e}`)}disconnect(){this.echo&&(this.echo.disconnect(),this.subscriptions.clear(),this.initialized=!1,Ft.log("[WebSocketManager] 연결 종료"))}getEcho(){return this.echo}isInitialized(){return this.initialized}isConfigured(){return this.config!==null&&!!this.config.appKey}getSubscriptionCount(){return this.subscriptions.size}}const Ic=new Yj,kt=nt("DataSourceManager"),Jj=new An;function zc(r,e){const t=r.match(/^\{\{(.+)\}\}$/);if(t){const s=t[1].trim();try{return Jj.evaluateExpression(s,e)}catch(i){return kt.error("Failed to evaluate param expression:",s,i),r}}return si(r,e,{skipCache:!0})}function Zy(r){const e={};for(const t of r.keys()){if(t in e)continue;const s=r.getAll(t);s.length>1?e[t]=s:s.length===1&&(t.endsWith("[]")?e[t]=s:e[t]=s[0])}return e}function Xj(){try{return window.G7Core?.devTools}catch{return}}const pd=class pd{constructor(e={}){H(this,"options");H(this,"dataCache",new Map);H(this,"bindingEngine");H(this,"globalHeaders",[]);this.options=e,this.bindingEngine=new An}setGlobalHeaders(e){this.globalHeaders=e||[]}matchesPattern(e,t){if(t==="*")return!0;const s=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${s}$`).test(e)}toFormData(e){const t=new FormData;for(const[s,i]of Object.entries(e))i instanceof File||i instanceof Blob?t.append(s,i):i!=null&&t.append(s,typeof i=="object"?JSON.stringify(i):String(i));return t}getMatchingGlobalHeaders(e,t){const s={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([o,d])=>{const g=zc(d,t);g!=null&&g!==""&&(s[o]=String(g))});return s}filterByCondition(e,t={}){const s=new Set,i=[];for(const o of e){if(s.has(o.id))continue;if(!o.if&&!o.conditions){s.add(o.id),i.push(o);continue}ni({if:o.if,conditions:o.conditions},t,this.bindingEngine,`data_source:${o.id}`)&&(s.add(o.id),i.push(o))}return i}checkErrorCondition(e,t){if(!e.errorCondition?.if||e.errorCondition?.errorCode===void 0)return null;try{const s={response:t};if(ni({if:e.errorCondition.if},s,this.bindingEngine,`errorCondition:${e.id}`))return kt.log(`errorCondition matched for ${e.id}, triggering error ${e.errorCondition.errorCode}`),e.errorCondition.errorCode}catch(s){kt.error(`Failed to evaluate errorCondition for ${e.id}:`,s)}return null}async fetchDataSources(e,t={},s=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,t,s,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 y={status:p,message:`Error condition matched for ${h.id}`,data:f},x=Cs(),w=x.resolve(p,{errorHandling:h.errorHandling,onError:h.onError});if(w.handler)try{await x.execute(w.handler,y)}catch(v){kt.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()}),kt.log(`Using fallback data for ${h.id} (errorCondition)`));return}if(h.onSuccess)try{const y={data:f,sourceId:h.id};await this.executeOnSuccessHandler(h.onSuccess,y)}catch(y){kt.error(`Error executing onSuccess handler for ${h.id}:`,y)}}catch(f){kt.error(`Failed to fetch data source: ${h.id}`,f);const p=f?.response?.status||f?.status||500,y=f?.response?.data,x=y?.message||f.message||"Unknown error",w={status:p,message:x,errors:y?.errors,data:y,statusText:f?.response?.statusText},v=Cs(),S=v.resolve(p,{errorHandling:h.errorHandling,onError:h.onError});if(S.handler)try{await v.execute(S.handler,w)}catch(k){kt.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()}),kt.log(`Using fallback data for ${h.id}`)),this.options.onError&&this.options.onError(f,h)}})),d}async fetchDataSourcesWithResults(e,t={},s=new URLSearchParams,i,o,d){if(e.some(p=>p.type==="websocket")){const p=e.filter(y=>y.type==="websocket").map(y=>y.id).join(", ");kt.warn(`fetchDataSourcesWithResults received WebSocket sources (caller should filter them out before calling): ${p}. WebSocket sources are event listeners, not data providers — they should not be passed to fetch.`)}const h=d?.ignoreAutoFetch?e.filter(p=>p.type!=="websocket"):e.filter(p=>p.auto_fetch!==!1&&p.type!=="websocket");return await Promise.all(h.map(async p=>{try{const y=await this.fetchDataSource(p,t,s,i,o);this.dataCache.set(p.id,{data:y,timestamp:Date.now()});const x=this.checkErrorCondition(p,y);if(x!==null){const w={status:x,message:`Error condition matched for ${p.id}`,data:y},v=Cs(),S=v.resolve(x,{errorHandling:p.errorHandling,onError:p.onError});let k=!1;if(S.handler)if(p.loading_strategy==="blocking")v.execute(S.handler,w).catch(A=>{kt.error(`Error executing errorCondition handler for ${p.id}:`,A)}),k=!0;else try{await v.execute(S.handler,w),k=!0}catch(A){kt.error(`Error executing errorCondition handler for ${p.id}:`,A)}return p.fallback!==void 0?(this.dataCache.set(p.id,{data:p.fallback,timestamp:Date.now()}),kt.log(`Using fallback data for ${p.id} (errorCondition)`),{id:p.id,state:"success",data:p.fallback}):{id:p.id,state:"error",error:new Error(`Error condition matched: ${x}`),errorCode:x,errorHandled:k}}if(p.onSuccess)try{const w={data:y,sourceId:p.id};await this.executeOnSuccessHandler(p.onSuccess,w)}catch(w){kt.error(`Error executing onSuccess handler for ${p.id}:`,w)}return{id:p.id,state:"success",data:y}}catch(y){kt.error(`Failed to fetch data source: ${p.id}`,y);const x=y?.response?.status||y?.status||500,w=y?.response?.data,v=w?.message||y.message||"Unknown error",S={status:x,message:v,errors:w?.errors,data:w,statusText:y?.response?.statusText},k=Cs(),A=k.resolve(x,{errorHandling:p.errorHandling,onError:p.onError});let O=!1;if(A.handler)if(p.loading_strategy==="blocking")k.execute(A.handler,S).catch(N=>{kt.error(`Error executing error handler for ${p.id}:`,N)}),O=!0;else try{await k.execute(A.handler,S),O=!0}catch(N){kt.error(`Error executing error handler for ${p.id}:`,N)}return p.fallback!==void 0?(this.dataCache.set(p.id,{data:p.fallback,timestamp:Date.now()}),kt.log(`Using fallback data for ${p.id}`),{id:p.id,state:"success",data:p.fallback}):(this.options.onError&&this.options.onError(y,p),{id:p.id,state:"error",error:y,errorCode:x,errorHandled:O})}}))}fetchDataSourcesInBackground(e,t={},s=new URLSearchParams,i){e.filter(d=>d.auto_fetch!==!1&&d.loading_strategy==="background"&&d.type!=="websocket").forEach(d=>{this.fetchDataSource(d,t,s).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=Cs(),y=p.resolve(h,{errorHandling:d.errorHandling,onError:d.onError});if(y.handler)try{await p.execute(y.handler,f)}catch(x){kt.error(`Error executing errorCondition handler for ${d.id}:`,x)}d.fallback!==void 0&&(this.dataCache.set(d.id,{data:d.fallback,timestamp:Date.now()}),kt.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){kt.error(`Error executing onSuccess handler for ${d.id}:`,f)}i&&i(d.id,g)}).catch(async g=>{kt.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",y={status:h,message:p,errors:f?.errors,data:f,statusText:g?.response?.statusText},x=Cs(),w=x.resolve(h,{errorHandling:d.errorHandling,onError:d.onError});if(w.handler)try{await x.execute(w.handler,y)}catch(v){kt.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()}),kt.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,t,s,i,o){switch(e.type){case"api":return this.fetchApiDataSource(e,t,s,i,o);case"static":return e.data;case"route_params":return t;case"query_params":return Zy(s);default:throw new Error(`Unknown data source type: ${e.type}`)}}async fetchApiDataSource(e,t,s,i,o){if(!e.endpoint)throw new Error(`API data source ${e.id} has no endpoint`);const d={route:t,query:Zy(s)};i&&(d._global=i),o&&(d._local=o);let g=si(e.endpoint,d,{skipCache:!0});const h=e.method||"GET",p=(e.contentType?typeof e.contentType=="string"&&e.contentType.includes("{{")?si(e.contentType,d,{skipCache:!0}):e.contentType:"application/json")==="multipart/form-data";let y=p?{...e.params||{}}:JSON.parse(JSON.stringify(e.params||{}));Object.entries(y).forEach(([v,S])=>{typeof S=="string"&&(y[v]=zc(S,d))}),Object.keys(y).forEach(v=>{y[v]===""&&delete y[v]});const x=Xj();let w=null;if(x?.isEnabled()){x.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(y).length>0){const S=new URLSearchParams;Object.entries(y).forEach(([A,O])=>{Array.isArray(O)?O.forEach(N=>S.append(A,String(N))):O!=null&&S.append(A,String(O))});const k=S.toString();v=k?`${g}?${k}`:g}w=x.trackRequest(v,h,{requestBody:h!=="GET"?y:void 0,dataSourceId:e.id}),x.trackDataSourceLoading(e.id)}try{let v;const S=e.auth_mode??(e.auth_required===!0?"required":"none"),k=qs.getInstance().isAuthenticated();if(S==="required"&&!k){kt.log(`[DataSourceManager] Skipping ${e.id}: auth_mode is 'required' but no token available`),x?.isEnabled()&&(x.trackDataSourceError(e.id,"Skipped: auth_mode required but not authenticated"),w&&x.failRequest(w,"Skipped: not authenticated"));const O=new Error("Auth required but not authenticated");throw O.response={status:401,statusText:"Unauthorized",data:null},O.status=401,O._authSkipped=!0,O}const A=S==="required"||S==="optional"&&k;if(A){const O=Bs(),N=g.startsWith("/api/")?g.substring(4):g.startsWith("/api")?g.substring(4)||"/":g;this.options.onError&&kt.log(`[DataSourceManager] Normalized endpoint: ${g} -> ${N}`);const D=this.getMatchingGlobalHeaders(g,d),$={};e.headers&&Object.entries(e.headers).forEach(([ye,we])=>{const J=zc(we,d);J!=null&&J!==""&&($[ye]=String(J))});const M={...D,...$},z=Object.keys(M).length>0,K=p?this.toFormData(y):y;switch(h){case"GET":v=await O.get(N,{params:y,...z&&{headers:M}});break;case"POST":z?v=await O.post(N,K,{headers:M}):v=await O.post(N,K);break;case"PUT":z?v=await O.put(N,K,{headers:M}):v=await O.put(N,K);break;case"PATCH":z?v=await O.patch(N,K,{headers:M}):v=await O.patch(N,K);break;case"DELETE":v=await O.delete(N,{params:y,...z&&{headers:M}});break;default:throw new Error(`Unsupported HTTP method: ${h}`)}}else{let O=g;if(h==="GET"){const K=new URLSearchParams(y).toString();O=K?`${g}?${K}`:g}const N={...p?{}:{"Content-Type":"application/json"},Accept:"application/json"};if(typeof window<"u"){const K=localStorage.getItem("g7_locale");K&&(N["Accept-Language"]=K)}const D=this.getMatchingGlobalHeaders(g,d);Object.assign(N,D),e.headers&&Object.entries(e.headers).forEach(([K,ye])=>{const we=zc(ye,d);we!=null&&we!==""&&(N[K]=String(we))});let $;h!=="GET"&&(p?($=this.toFormData(y),delete N["Content-Type"]):$=JSON.stringify(y));const M=await fetch(O,{method:h,headers:N,body:$});let z;try{z=await M.json()}catch{z=null}if(w&&x?.isEnabled()&&(x.completeRequest(w,M.status,z),w=null),!M.ok){x?.isEnabled()&&x.trackDataSourceError(e.id,`HTTP ${M.status}: ${M.statusText}`);const K=new Error(`HTTP error! status: ${M.status}`);throw K.response={status:M.status,statusText:M.statusText,data:z},K.status=M.status,K}v=z,x?.isEnabled()&&x.trackDataSourceLoaded(e.id,v)}return A&&w&&x?.isEnabled()&&(x.completeRequest(w,200,v),x.trackDataSourceLoaded(e.id,v)),v}catch(v){if(w&&x?.isEnabled()){const S=v;S?.response?x.completeRequest(w,S.response.status,S.response.data):x.failRequest(w,v instanceof Error?v.message:String(v)),x.trackDataSourceError(e.id,v instanceof Error?v.message:String(v))}throw v}}getCachedData(e){const t=this.dataCache.get(e);if(!t)return;if(Date.now()-t.timestamp>pd.DATA_CACHE_TTL){this.dataCache.delete(e);return}return t.data}clearCache(){this.dataCache.clear()}subscribeWebSockets(e,t,s={}){const i=[],o=e.filter(d=>d.type==="websocket");return o.length===0||o.forEach(d=>{if(!d.channel||!d.event){kt.warn(`WebSocket source ${d.id} missing channel or event`);return}let g,h;try{g=si(d.channel,s,{skipCache:!0}),h=si(d.event,s,{skipCache:!0})}catch(y){kt.error(`Failed to resolve WebSocket channel/event for source ${d.id}:`,y);return}const f=y=>!!(!y||y.trim()===""||y.includes("{{")||y.endsWith(".")||y.endsWith(":")||y.startsWith(".")||y.startsWith(":")||y.includes("..")||y.includes("::"));if(f(g)||f(h)){kt.warn(`WebSocket source ${d.id} has invalid channel/event after expression resolution, skipping. Original channel="${d.channel}", resolved="${g}". Original event="${d.event}", resolved="${h}". Available context keys: [${Object.keys(s).join(", ")}]`);return}const p=Ic.subscribe(g,h,y=>{const x=d.target_source||d.id;this.dataCache.set(x,{data:y,timestamp:Date.now()}),t(x,y)},{channelType:d.channel_type||"private"});p&&i.push(p)}),i}unsubscribeWebSockets(e){e.length!==0&&e.forEach(t=>{Ic.unsubscribe(t)})}async executeOnSuccessHandler(e,t){const s=Wm();if(!s){kt.warn("ActionDispatcher not available, skipping onSuccess handler");return}const i=Array.isArray(e)?e:[e];for(const o of i)try{await s.dispatchAction({type:"click",...o},{data:{response:t}})}catch(d){throw kt.error("Failed to execute onSuccess handler:",d),d}}};H(pd,"DATA_CACHE_TTL",3e5);let la=pd;new la;const Cr=nt("ModalDataSourceWrapper");function Qj(r,e){if(!r||!e)return r;const s=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 s){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 ex=({isOpen:r,modalId:e,dataSources:t,dataContext:s,globalStateUpdater:i,bindingEngine:o,debug:d=!1,children:g})=>{const[h,f]=j.useState(!1),[p,y]=j.useState(!1),x=j.useRef(!1),w=j.useRef(null);w.current||(w.current=new la);const v=j.useCallback(async()=>{if(!(!t||t.length===0)&&w.current){f(!0);try{const S=s.route||{},k=new URLSearchParams(window.location.search),A=t.map(N=>{let D={...N};if(N.endpoint&&o){const $=o.resolveBindings(N.endpoint,s,{skipCache:!0});D.endpoint=$}if(N.params&&o){const $={};Object.entries(N.params).forEach(([M,z])=>{typeof z=="string"?$[M]=o.resolveBindings(z,s,{skipCache:!0}):$[M]=z}),D.params=$}return D});d&&Cr.log(`[ModalDataSourceWrapper] Modal "${e}" fetching data sources:`,A.map(N=>({id:N.id,endpoint:N.endpoint})));const O=await w.current.fetchDataSourcesWithResults(A,S,k);i&&O.forEach(N=>{if(N.state==="success"&&N.data!==void 0){const D=A.find($=>$.id===N.id);if(D?.initGlobal){const $=N.data?.data??N.data,M=Array.isArray(D.initGlobal)?D.initGlobal:[D.initGlobal];for(const z of M)if(typeof z=="string")i({[z]:$}),d&&Cr.log(`[ModalDataSourceWrapper] Modal "${e}" initGlobal: ${N.id}.data -> _global.${z}`);else if(typeof z=="object"&&z.key){const{key:K,path:ye}=z,we=ye?Qj($,ye):$;i({[K]:we}),d&&Cr.log(`Modal "${e}" initGlobal: ${N.id}.data${ye?"."+ye:""} -> _global.${K}`)}}}else N.state==="error"&&Cr.error(`Modal "${e}" data source error:`,N.id,N.error)}),d&&Cr.log(`Modal "${e}" data sources fetched successfully`)}catch(S){Cr.error(`Modal "${e}" data source fetch error:`,S)}finally{f(!1),y(!0)}}},[t,s,i,o,e,d]);return j.useEffect(()=>{if(!t||t.length===0)return;const S=window.__templateApp;return S?.registerModalDataSources&&S.registerModalDataSources(e,t),()=>{S?.unregisterModalDataSources&&S.unregisterModalDataSources(e)}},[e,t]),j.useEffect(()=>{!r&&x.current&&(y(!1),d&&Cr.log(`[ModalDataSourceWrapper] Modal "${e}" closed, reset fetch state`)),r&&!x.current&&t&&t.length>0&&!p&&v(),x.current=r},[r,t,p,v,e,d]),l.jsx(l.Fragment,{children:g})};class Hc extends Error{constructor(t,s,i={}){super(s);H(this,"code");H(this,"userMessageKey");H(this,"showStack");H(this,"icon");H(this,"recoverable");this.name="TemplateEngineError",this.code=t,this.userMessageKey=s,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(t,s){if(!s||!t)return this.userMessageKey;try{return s.translate(this.userMessageKey,t)}catch{return this.userMessageKey}}}class Zj extends Hc{constructor(){super("TEMPLATE_NOT_FOUND","$t:core.errors.template_not_found",{showStack:!1,icon:"fa-paint-brush",recoverable:!1}),this.name="TemplateNotFoundError"}}function tx(r){if(r instanceof Hc)return r;if(r instanceof Error){const e=new Hc("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 Hc("TEMPLATE_INIT_ERROR","$t:core.errors.template_init_error",{showStack:!1,icon:"fa-circle-exclamation",recoverable:!0})}const hi=nt("Router");class ek{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,t){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(t)}async emit(e,...t){const s=this.eventHandlers.get(e);s&&await Promise.all(s.map(i=>i(...t)))}async loadRoutes(e){try{const t=e!==void 0&&e>0?`?v=${e}`:"",s=await fetch(`/api/templates/${this.templateIdentifier}/routes.json${t}`);if(!s.ok)throw new Error(`Failed to load routes: ${s.statusText}`);const i=await s.json();if(!i.success)throw new Error("Failed to load routes from API");if(i.data&&Array.isArray(i.data.routes))this.routes=i.data.routes,hi.log(`Loaded ${this.routes.length} routes${e?` (v=${e})`:""}`);else throw new Error("Invalid routes data format")}catch(t){throw hi.error("Error loading routes:",t),t}}setRoutes(e){this.routes=e,hi.log(`Set ${this.routes.length} routes`)}match(e){for(const t of this.routes){const s=this.matchPattern(t.path,e);if(s!==null)return{route:t,params:s}}return null}matchPattern(e,t){const s=[];let i=e.replace(/:([^/]+)/g,(h,f)=>(s.push(f),"([^/]+)"));i.startsWith("*/")&&(i="(?:/[^/]+)?"+i.slice(1)),i=i.replace(/\//g,"\\/");const o=new RegExp(`^${i}$`),d=t.match(o);if(!d)return null;const g={};return s.forEach((h,f)=>{g[h]=d[f+1]}),g}getRoutes(){return[...this.routes]}getAuthType(e,t){return e.auth_type?e.auth_type:t.startsWith("/admin")?"admin":"user"}async navigateToCurrentPath(){const e=window.location.pathname,t=window.location.search,s=this.match(e);if(!s){hi.warn(`No route matched for path: ${e}`),this.emit("routeNotFound",e);return}if(s.route.redirect){hi.log(`Redirecting from ${e} to ${s.route.redirect}`),this.navigate(s.route.redirect);return}if(s.route.auth_required){const d=this.getAuthType(s.route,e),g=qs.getInstance();let h=g.isAuthenticated()&&g.getAuthType()===d;if(h||(h=await g.checkAuth(d)),!h){const f=g.getLoginRedirectUrl(d,e+t);hi.log(`Not authenticated, redirecting to: ${f}`),window.location.href=f;return}}const i=new URLSearchParams(t),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:s.route.layout,endpoint:s.route.endpoint,params:{...s.route.params||{},...s.params},query:o,auth_required:s.route.auth_required,auth_type:s.route.auth_type,meta:s.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 t=this.pendingNavigation;this.executeNavigation(t)}}}}const tk=nt("ErrorDisplay");class nx{static render(e,t){const s=document.getElementById(e);if(!s){tk.error(`Container #${e} not found`);return}const i=t.debug&&t.showStack&&t.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;
|
||
`};s.innerHTML=`
|
||
<div style="${d.container}">
|
||
<div style="${d.card}">
|
||
<!-- 아이콘 -->
|
||
<div style="${d.iconContainer}">
|
||
<i class="fa-solid ${t.icon}" style="${d.icon}"></i>
|
||
</div>
|
||
|
||
<!-- 제목 -->
|
||
<h1 style="${d.title}">
|
||
${this.escapeHtml(t.title)}
|
||
</h1>
|
||
|
||
<!-- 사용자 메시지 -->
|
||
<p style="${d.message}">
|
||
${this.escapeHtml(t.message)}
|
||
</p>
|
||
|
||
<!-- 상세 메시지 (API 응답 등) -->
|
||
${t.detailMessage?`
|
||
<p style="${d.detailMessage}">
|
||
${this.escapeHtml(t.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(t.stackTrace)}</pre>
|
||
</div>
|
||
`:""}
|
||
|
||
<!-- 새로고침 버튼 (복구 가능할 때만) -->
|
||
${t.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,t,s,i=!1,o,d,g){let h,f;if(t.userMessageKey.startsWith("$t:"))if(d&&o)try{h=d.translate(t.userMessageKey,o)}catch{h=t.userMessageKey.replace("$t:","")}else h=t.userMessageKey.replace("$t:","");else h=t.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:s,message:h,detailMessage:f,icon:t.icon,showStack:t.showStack,stackTrace:t.stack,showReloadButton:t.recoverable,debug:i})}static escapeHtml(e){if(!e)return"";const t=document.createElement("div");return t.textContent=e,t.innerHTML}}const Vt=nt("ErrorPageHandler");class nk{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&&Vt.warn("Failed to load template config:",e.statusText),this.configLoaded=!0,null;const t=await e.json();if(!t.success||!t.data)return this.debug&&Vt.warn("Invalid template config response"),this.configLoaded=!0,null;const s=t.data;return!s.error_config||!s.error_config.layouts?(this.debug&&Vt.warn("No error_config found in template.json"),this.configLoaded=!0,null):(this.errorConfig=s.error_config,this.configLoaded=!0,this.debug&&Vt.log("Error config loaded:",this.errorConfig),this.errorConfig)}catch(e){return Vt.error("Failed to load error config:",e),this.configLoaded=!0,null}}async renderError(e,t="app"){try{const s=await this.loadConfig();if(!s)return this.debug&&Vt.warn("No error config available, cannot render error page"),!1;const i=s.layouts[e]||s.layouts[String(e)];if(!i)return this.debug&&Vt.warn(`No layout defined for error code: ${e}`),!1;this.debug&&Vt.log(`Loading error layout: ${i} for code: ${e}`);const o=await this.layoutLoader.loadLayout(this.templateId,i);if(!o)return this.debug&&Vt.error(`Failed to load error layout: ${i}`),!1;this.debug&&Vt.log("Error layout loaded:",o);let d={};const g=o.data_sources||[];if(g.length>0){this.debug&&Vt.log("Fetching data sources:",g.map(w=>w.id));const p=g.filter(w=>w.loading_strategy==="blocking"),y=g.filter(w=>!w.loading_strategy||w.loading_strategy==="progressive"),x=[...p,...y];if(x.length>0)try{d=await this.dataSourceManager.fetchDataSources(x,{},new URLSearchParams),this.debug&&Vt.log("Data sources fetched:",Object.keys(d))}catch(w){Vt.error("Failed to fetch data sources:",w)}}const h={};g.length>0&&(this.processInitOptions(g,d,h),this.debug&&Vt.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:t,layoutJson:o,dataContext:f,translationContext:{templateId:this.templateId,locale:this.locale}}),this.debug&&Vt.log(`Error page ${e} rendered successfully`),!0}catch(s){return Vt.error(`Failed to render error page ${e}:`,s),!1}}processInitOptions(e,t,s){for(const i of e){const o=t[i.id];if(!o)continue;const d=o?.data??o;if(i.initLocal){if(typeof i.initLocal=="string")s[i.initLocal]=d,Vt.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;s[g]=h?this.getValueByPath(d,h):d,Vt.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,Vt.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,Vt.log(`initGlobal: ${i.id}.data${p?"."+p:""} -> _global.${f}`)}}}}getValueByPath(e,t){return t.split(".").reduce((s,i)=>s?.[i],e)}updateGlobalState(e){this.globalState={...this.globalState,...e}}updateLocale(e){this.locale=e,this.debug&&Vt.log("Locale updated:",e)}isConfigLoaded(){return this.configLoaded}async hasErrorLayout(e){const t=await this.loadConfig();return t?!!(t.layouts[e]||t.layouts[String(e)]):!1}clearConfigCache(){this.errorConfig=null,this.configLoaded=!1,this.debug&&Vt.log("Config cache cleared")}}const $n=nt("ModuleAssetLoader");class sk{constructor(){H(this,"loadedAssets",new Map);H(this,"loadingPromises",new Map)}async loadActiveExtensionAssets(e){if(!e||e.length===0){$n.log("No module assets to load");return}const t=[...e].sort((o,d)=>o.priority-d.priority);$n.log("Loading module assets:",t.map(o=>o.identifier));const s=t.filter(o=>o.css).map(o=>this.loadCSS(o.identifier,o.css)),i=t.filter(o=>o.js).map(o=>this.loadJS(o.identifier,o.js));await Promise.all([...s,...i]),$n.log("All module assets loaded successfully")}async loadCSS(e,t){const s=`module-css-${e}`;if(document.getElementById(s)){$n.log(`CSS already loaded: ${e}`);return}return new Promise((i,o)=>{const d=document.createElement("link");d.rel="stylesheet",d.href=t,d.id=s,d.onload=()=>{$n.log(`CSS loaded: ${e}`),this.registerLoadedAsset(e,{type:"css",element:d}),i()},d.onerror=()=>{$n.warn(`Failed to load CSS: ${e} (${t})`),i()},document.head.appendChild(d)})}async loadJS(e,t){const s=`module-js-${e}`;if(document.getElementById(s)){$n.log(`JS already loaded: ${e}`);return}const i=this.loadingPromises.get(e);if(i)return $n.log(`JS already loading: ${e}`),i;const o=new Promise((d,g)=>{const h=document.createElement("script");h.src=t,h.id=s,h.async=!1,h.onload=()=>{$n.log(`JS loaded: ${e}`),this.registerLoadedAsset(e,{type:"js",element:h}),this.loadingPromises.delete(e),d()},h.onerror=()=>{$n.warn(`Failed to load JS: ${e} (${t})`),this.loadingPromises.delete(e),d()},document.head.appendChild(h)});return this.loadingPromises.set(e,o),o}registerLoadedAsset(e,t){const s=this.loadedAssets.get(e)||[];s.push(t),this.loadedAssets.set(e,s)}unloadExtensionAsset(e){const t=this.loadedAssets.get(e);if(!t||t.length===0){$n.log(`No assets to unload for: ${e}`);return}t.forEach(s=>{s.element.parentNode&&(s.element.parentNode.removeChild(s.element),$n.log(`${s.type.toUpperCase()} unloaded: ${e}`))}),this.loadedAssets.delete(e),$n.log(`All assets unloaded for: ${e}`)}unloadAllAssets(){Array.from(this.loadedAssets.keys()).forEach(t=>{this.unloadExtensionAsset(t)}),$n.log("All module assets unloaded")}isLoaded(e){return this.loadedAssets.has(e)}getLoadedModules(){return Array.from(this.loadedAssets.keys())}}let Ug=null;function ak(){return Ug||(Ug=new sk),Ug}function rk(){if(typeof window>"u")return[];const r=window.G7Config;if(!r?.moduleAssets)return[];const e=[];for(const[t,s]of Object.entries(r.moduleAssets)){const i=s;e.push({identifier:t,js:i.js,css:i.css,priority:i.priority,external:i.external})}return e}function ik(){if(typeof window>"u")return[];const r=window.G7Config;if(!r?.pluginAssets)return[];const e=[];for(const[t,s]of Object.entries(r.pluginAssets)){const i=s;e.push({identifier:t,js:i.js,css:i.css,priority:i.priority,external:i.external})}return e}const Bg=nt("SystemBannerManager");class Pc{static show(e){this.banners.set(e.id,e),this.render(),Bg.log(`Banner shown: ${e.id}`)}static hide(e){this.banners.delete(e)&&(this.render(),Bg.log(`Banner hidden: ${e}`))}static hideAll(){this.banners.clear(),this.render(),Bg.log("All banners hidden")}static detectLocale(){try{const t=window.G7Core;if(t?.locale?.current)return t.locale.current()}catch{}return(navigator.language||"ko").split("-")[0]}static resolveMessage(e,t){return typeof e=="string"?e:e[t]||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 t=Array.from(this.banners.values()).sort((i,o)=>(i.order??0)-(o.order??0)),s=this.detectLocale();e.innerHTML=t.map(i=>{const o=this.resolveMessage(i.message,s),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 t=document.getElementById("app");t&&(t.style.paddingTop=e>0?`${e}px`:"")}}H(Pc,"banners",new Map),H(Pc,"containerId","g7-system-banners");const G=nt("TemplateApp");function ok(r){const e={};for(const t of r.keys()){if(t in e)continue;const s=r.getAll(t);s.length>1?e[t]=s:s.length===1&&(t.endsWith("[]")?e[t]=s:e[t]=s[0])}return e}const Ds=class Ds{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 t=this.loadLocaleFromStorage(),s=t||e.locale||"ko";this.config={...e,locale:s},!t&&e.locale&&this.saveLocaleToStorage(e.locale)}loadG7Config(){if(typeof window<"u"&&window.G7Config){const e=window.G7Config;e.settings&&(this.globalState.settings=e.settings,G.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,G.log("Loaded plugin settings from G7Config:",Object.keys(e.plugins))),e.modules&&(this.globalState.modules=e.modules,G.log("Loaded module settings from G7Config:",Object.keys(e.modules))),e.appConfig&&(this.globalState.appConfig=e.appConfig,G.log("Loaded appConfig from G7Config:",Object.keys(e.appConfig)))}}resolveRouteExpressions(e){const t=new An,s={_global:this.globalState};return e.map(i=>{const o={...i};if(o.path&&o.path.includes("{{")){const d=o.path;o.path=t.resolveBindings(o.path,s),o.path=o.path.replace(/\/\/+/g,"/")||"/",o.path.includes("{{")&&(G.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=t.resolveBindings(o.redirect,s),o.redirect=o.redirect.replace(/\/\/+/g,"/")||"/",o.redirect.includes("{{")&&(G.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 t of e)try{const s=localStorage.getItem(t);s&&s!==localStorage.getItem(Ds.LOCALE_STORAGE_KEY)&&(localStorage.setItem(Ds.LOCALE_STORAGE_KEY,s),G.log(`Migrated locale from '${t}' to '${Ds.LOCALE_STORAGE_KEY}'`)),localStorage.removeItem(t)}catch(s){G.warn(`Failed to migrate locale key '${t}':`,s)}}async init(){try{lo.getInstance().setDebug(this.config.debug),G.log("Initializing with config:",this.config);const e=vs.getInstance(),t=qs.getInstance(),s=this.loadCacheVersionFromStorage()||0,[i,o,d,g,h]=await Promise.all([Io({templateId:this.config.templateId,templateType:this.config.templateType,locale:this.config.locale,debug:this.config.debug,cacheVersion:s}),e.loadComponents(this.config.templateId,this.config.templateType),fetch(`/api/templates/${this.config.templateId}/routes.json${s>0?`?v=${s}`:""}`).then(S=>{if(!S.ok)throw new Error(`Failed to load routes: ${S.statusText}`);return S.json()}).then(S=>{if(!S.success)throw new Error("Failed to load routes from API");return S.data}).catch(S=>{throw G.error("Error loading routes:",S),S}),t.preloadAuth(this.config.templateType==="admin"?"admin":"user"),fetch(`/api/templates/${this.config.templateId}/config.json`).then(S=>S.ok?S.json():null).then(S=>!S?.success||!S?.data?null:S.data).catch(S=>(G.warn("Error loading template config:",S),null))]);if(G.log("Template Engine initialized"),G.log("ComponentRegistry loaded"),G.log("Routes data loaded"),G.log("User info preloaded"),G.log("Template config loaded:",h),h?.cache_version!==void 0){const S=this.loadCacheVersionFromStorage();if(this.extensionCacheVersion=h.cache_version,this.saveCacheVersionToStorage(this.extensionCacheVersion),G.log("Extension cache version:",this.extensionCacheVersion),S!==null&&S!==this.extensionCacheVersion){G.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),G.log("Routes reloaded with new cache version"));try{const{TranslationEngine:A}=await Promise.resolve().then(()=>Gp),O=A.getInstance();O.setCacheVersion(this.extensionCacheVersion);const N=this.config.locale||"ko",D="en";await O.loadTranslations(this.config.templateId,N,"/api",!0),N!==D&&await O.loadTranslations(this.config.templateId,D,"/api",!0),G.log("Translations reloaded with new cache version")}catch(A){G.error("Failed to reload translations:",A)}}}h?.errorHandling&&(this.templateErrorHandling=h.errorHandling,Cs().setTemplateConfig(this.templateErrorHandling),G.log("Template errorHandling registered:",this.templateErrorHandling)),t.on("logout",()=>{G.log("User logged out")}),t.on("authStateChange",S=>{G.log("Auth state changed:",S)}),G.log("AuthManager event handlers registered");const f=Bs(),p=this.config.templateType==="admin"?"admin":"user",y=t.getConfig(p);f.setOnUnauthorized(()=>{G.log("Unauthorized - redirecting to login page"),f.removeToken();const S=window.location.pathname+window.location.search,k=t.getLoginRedirectUrl(p,S,"session_expired");window.location.href=k}),G.log("ApiClient onUnauthorized callback registered"),this.layoutLoader=new Mg(e),this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),G.log("LayoutLoader initialized:",this.layoutLoader);const x=new la({onUnauthorized:()=>{G.warn("Unauthorized request in error page")}});if(this.errorPageHandler=new nk({templateId:this.config.templateId,layoutLoader:this.layoutLoader,locale:this.config.locale,debug:this.config.debug,renderFunction:zo,dataSourceManager:x,globalState:this.globalState}),G.log("ErrorPageHandler initialized with DataSourceManager"),await this.handleServerError()){G.log("Server error handled, skipping normal initialization");return}if(this.router=new ek(this.config.templateId),Array.isArray(d.routes)){const S=this.resolveRouteExpressions(d.routes);this.router.setRoutes(S)}else throw new Error("Invalid routes data format");G.log("Router initialized:",this.router),G.log("Routes set:",this.router.getRoutes());const{getActionDispatcher:w}=await Promise.resolve().then(()=>Ks),v=w();v&&(v.setDefaultContext({navigate:S=>this.router?.navigate(S)}),v.setGlobalStateUpdater((S,k)=>this.setGlobalState(S,k)),G.log("Navigate function and setGlobalState injected to ActionDispatcher")),await this.loadExtensionAssets(),this.reinitializeTemplateHandlers(),this.router.on("routeChange",S=>this.handleRouteChange(S)),this.router.on("routeNotFound",S=>this.handleRouteNotFound(S)),this.router.navigateToCurrentPath(),G.log("Template App initialized successfully")}catch(e){G.error("Initialization failed:",e),this.showInitError(e)}}async loadExtensionAssets(){try{const e=ak(),t=rk();t.length>0&&(G.log("Loading module assets:",t.map(i=>i.identifier)),await e.loadActiveExtensionAssets(t));const s=ik();s.length>0&&(G.log("Loading plugin assets:",s.map(i=>i.identifier)),await e.loadActiveExtensionAssets(s)),(t.length>0||s.length>0)&&G.log("Extension assets loaded successfully")}catch(e){G.warn("Failed to load extension assets:",e)}}async handleRouteChange(e){const t=++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,window.__g7AutoBindingPaths=new Map;try{if(G.log("Route changed:",e,"requestId:",t),!this.layoutLoader)throw new Error("LayoutLoader is not initialized");if(!e.layout)throw new Error("Route layout is not defined");let s=e.layout;const i=s==="__preview__";i&&e.params?.token&&(s=`__preview__/${e.params.token}`);const o=await this.layoutLoader.loadLayout(this.config.templateId,s);if(t!==this.currentRouteChangeId){G.log("Route change cancelled (newer request exists):",t);return}G.log("Layout loaded:",o);const d=Cs();o.errorHandling?(d.setLayoutConfig(o.errorHandling),G.log("Layout errorHandling registered:",o.errorHandling)):d.clearLayoutConfig();const g=o.data_sources||[],h=e.query||{},f=new URLSearchParams;for(const[X,se]of Object.entries(h))if(Array.isArray(se))for(const R of se)f.append(X,R);else f.set(X,se);const p={route:e.params||{},query:h,_global:this.globalState};o.scripts&&Array.isArray(o.scripts)&&await this.loadLayoutScripts(o.scripts,p);const{DataSourceManager:y,getActionDispatcher:x}=await Promise.resolve().then(()=>Ks),w=new y;if(i){const X=x();X&&X.setPreviewMode(!0),this.setGlobalState({__isPreview:!0}),Pc.show({id:"preview-mode",message:{ko:"⚠ 미리보기 모드 — 페이지 이동이 비활성화됩니다",en:"⚠ Preview Mode — Navigation is disabled"},background:"linear-gradient(90deg, #f59e0b, #d97706)",color:"white"}),G.log("Preview mode activated")}else{const X=x();X?.isPreviewMode()&&(X.setPreviewMode(!1),Pc.hide("preview-mode"))}if(this.currentGlobalHeaders=o.globalHeaders||[],this.currentGlobalHeaders.length>0){w.setGlobalHeaders(this.currentGlobalHeaders);const X=x();X&&X.setGlobalHeaders(this.currentGlobalHeaders),G.log("globalHeaders set:",this.currentGlobalHeaders.map(se=>se.pattern))}if(o.named_actions&&Object.keys(o.named_actions).length>0){const X=x();X&&X.setNamedActions(o.named_actions)}const v=w.filterByCondition(g,p);g.length!==v.length&&G.log("Data sources filtered by condition:",{before:g.map(X=>X.id),after:v.map(X=>X.id)});const S=v.filter(X=>X.loading_strategy==="blocking"),k=v.filter(X=>(X.loading_strategy||"progressive")!=="blocking"&&X.type!=="websocket"),A=Array.isArray(o.transition_overlay?.wait_for)?o.transition_overlay.wait_for:[],O=A.length>0&&v.some(X=>A.includes(X.id)&&X.type!=="websocket"&&(X.loading_strategy||"progressive")!=="background");if((S.length>0||O)&&o.transition_overlay){const X=typeof o.transition_overlay=="boolean"?{enabled:o.transition_overlay,style:"opaque"}:o.transition_overlay;X.enabled&&X.style==="skeleton"&&X.skeleton?.component&&X.target?this.renderSkeletonOverlay(X.target,X.skeleton,o,X.fallback_target):X.enabled&&X.style==="spinner"&&X.target&&this.renderSpinnerOverlay(X.target,X.spinner,X.fallback_target)}let N={},D={},$={},M={};this.currentWebSocketSubscriptions.length>0&&(G.log("Unsubscribing previous WebSocket subscriptions:",this.currentWebSocketSubscriptions),w.unsubscribeWebSockets(this.currentWebSocketSubscriptions),this.currentWebSocketSubscriptions=[]),this.currentDataSources=v,this.currentRouteParams=e.params||{},this.currentQueryParams=f,G.log(`handleRouteChange #${t} - queryObject:`,h),G.log(`handleRouteChange #${t} - queryParams:`,f.toString()),S.length>0&&(G.log("Fetching blocking data sources:",S.map(se=>se.id)),(await w.fetchDataSourcesWithResults(S,e.params||{},f)).forEach(se=>{if(se.state==="success"&&se.data!==void 0)N[se.id]=se.data;else if(se.state==="error"&&se.error){const R=se.error,q=R.response?.data?.message;D[se.id]={message:q||se.error.message,status:R.response?.status||R.status}}}),this.processInitOptions(S,N,$,M),this.currentFetchedData={...N},G.log("Blocking data loaded:",Object.keys(N)),Object.keys(D).length>0&&G.log("Data source errors:",D),Object.keys($).length>0&&G.log("Local state init (blocking):",Object.keys($)),Object.keys(M).length>0&&G.log("Isolated state init (blocking):",Object.keys(M)));const z=k.length>0;if(z&&(Gs.setPending(!0),G.log("Transition started before rendering")),t!==this.currentRouteChangeId){G.log("Route change cancelled after blocking data (newer request exists):",t);return}const{getState:K}=await Promise.resolve().then(()=>Ks),ye=K().currentDataContext||{},we=k.map(X=>X.id),J={};if(z){we.forEach(se=>{ye[se]!==void 0?J[se]=ye[se]:J[se]=void 0});const X=Object.keys(J).filter(se=>J[se]!==void 0);X.length>0&&G.log("Preserving previous progressive data:",X),G.log("Progressive data sources initialized:",we)}const ve=o.defines||{},le={...J,...e.params,...N,route:{...e.params||{},path:e.path},query:h,_global:{...this.globalState},_globalSetState:X=>this.setGlobalState(X),_dataSourceErrors:Object.keys(D).length>0?D:void 0,_localInit:Object.keys($).length>0?$:void 0,_isolatedInit:Object.keys(M).length>0?M:void 0,_defines:Object.keys(ve).length>0?ve:void 0};if(o.computed&&Object.keys(o.computed).length>0){const X=this.calculateComputed(o.computed,le);Object.keys(X).length>0&&(le._computed=X,this.globalState._computed=X,G.log("Computed values calculated:",Object.keys(X))),le._computedDefinitions=o.computed}const de=o.layout_name||e.layout;this.currentLayoutName!==""&&this.currentLayoutName!==de&&(G.log("_local reset due to layout change:",{from:this.currentLayoutName,to:de}),this.globalState._local={}),this.currentLayoutName=de;const W=o.initLocal||o.state;if(W&&Object.keys(W).length>0){this.globalState._local||(this.globalState._local={});for(const[X,se]of Object.entries(W))this.globalState._local[X]===void 0&&(this.globalState._local[X]=JSON.parse(JSON.stringify(se)));le._local={...this.globalState._local},G.log("initLocal applied to _local:",Object.keys(W))}if(o.initGlobal&&Object.keys(o.initGlobal).length>0){for(const[X,se]of Object.entries(o.initGlobal))this.globalState[X]===void 0&&(this.globalState[X]=JSON.parse(JSON.stringify(se)));G.log("initGlobal applied to _global:",Object.keys(o.initGlobal))}if(o.initIsolated&&Object.keys(o.initIsolated).length>0){for(const[X,se]of Object.entries(o.initIsolated))M[X]===void 0&&(M[X]=JSON.parse(JSON.stringify(se)));G.log("initIsolated applied:",Object.keys(o.initIsolated))}le._global={...this.globalState,layoutWarnings:o.warnings||[]};const he=o.initActions||o.init_actions;if(he&&he.length>0){await this.executeInitActions(he,le),G.log("initActions executed before render");const X=this.globalState;if(X._local){if(Object.keys($).length>0){for(const[se,R]of Object.entries($))X._local[se]!==void 0?X._local[se]=this.deepMerge(X._local[se],R):X._local[se]=R;G.log("localInit merged into _local after initActions:",Object.keys($))}le._local=X._local,G.log("_local merged into dataContext:",X._local)}if(le._global={...this.globalState,layoutWarnings:o.warnings||[]},G.log("_global merged into dataContext after initActions"),o.computed&&Object.keys(o.computed).length>0){const se=this.calculateComputed(o.computed,le);Object.keys(se).length>0&&(le._computed=se,this.globalState._computed=se,G.log("Computed values recalculated after init_actions:",Object.keys(se)))}if(Object.keys(this.currentFetchedData).length>0){for(const[se,R]of Object.entries(this.currentFetchedData))le[se]=R;G.log("Fetched data sources merged into dataContext after initActions:",Object.keys(this.currentFetchedData))}}if(o.transition_overlay&&!this.skeletonOverlayContainer&&this.showTransitionOverlay(o.transition_overlay,o),await zo({containerId:"app",layoutJson:o,dataContext:le,translationContext:{templateId:this.config.templateId,locale:this.config.locale}}),G.log("Initial render complete with blocking data"),this.reattachSpinnerOverlay(),k.length>0){if(t!==this.currentRouteChangeId){G.log("Route change cancelled before progressive fetch (newer request exists):",t),Gs.setPending(!1),this.hideTransitionOverlay();return}G.log("Fetching progressive/background data sources:",k.map(R=>R.id));const{updateTemplateData:X,getState:se}=await Promise.resolve().then(()=>Ks);try{const R=k.map(async q=>{try{const xe=(await w.fetchDataSourcesWithResults([q],e.params||{},f,this.globalState))[0];if(!xe){G.log(`Data source ${q.id} skipped (no fetch result)`);return}if(t!==this.currentRouteChangeId){G.log(`Data source ${q.id} fetch cancelled (newer request exists)`);return}if(xe.state==="success"&&xe.data!==void 0){G.log(`Progressive data source loaded: ${q.id}`),this.currentFetchedData[q.id]=xe.data;const oe={};this.processInitOptions([q],{[q.id]:xe.data},oe);const ke=se();if(ke.bindingEngine){const De=[q.id];q.initGlobal&&De.push("_global"),q.initLocal&&De.push("_local"),ke.bindingEngine.invalidateCacheByKeys(De)}const Oe={[q.id]:xe.data};Object.keys(oe).length>0&&(Oe._localInit=oe,Object.assign($,oe)),q.initGlobal&&(Oe._global={...this.globalState}),X(Oe)}else if(xe.state==="error"&&xe.error){const oe=xe.error,ke=oe.response?.data?.message;D[q.id]={message:ke||xe.error.message,status:oe.response?.status||oe.status},G.log(`Progressive data source error: ${q.id}`,D[q.id]),X({[q.id]:null,_dataSourceErrors:{...D}})}}catch(re){G.error(`Failed to fetch data source: ${q.id}`,re)}});if(await Promise.all(R),t!==this.currentRouteChangeId){G.log("Route change cancelled after progressive fetch (newer request exists):",t);return}G.log("All progressive data sources loaded")}finally{Gs.setPending(!1),this.hideTransitionOverlay()}}else this.hideTransitionOverlay();const ee=v.filter(X=>X.type==="websocket");if(ee.length>0){G.log("Subscribing WebSocket data sources:",ee.map(q=>q.id));const{updateTemplateData:X,getState:se}=await Promise.resolve().then(()=>Ks),R={...this.currentFetchedData,...e.params,route:{...e.params||{},path:e.path},query:h,_global:{...this.globalState}};G.log("WebSocket binding context keys:",Object.keys(R)),this.currentWebSocketSubscriptions=w.subscribeWebSockets(v,(q,re)=>{G.log(`WebSocket data received for: ${q}`,re),this.currentFetchedData[q]=re;const xe=v.find(De=>De.id===q),oe=se();if(oe.bindingEngine){const De=[q];xe?.initGlobal&&De.push("_global"),xe?.initLocal&&De.push("_local"),oe.bindingEngine.invalidateCacheByKeys(De)}X({[q]:re});const Oe=v.find(De=>De.type==="websocket"&&(De.target_source||De.id)===q)?.onReceive;Array.isArray(Oe)&&Oe.length>0&&window.G7Core?.dispatch&&(async()=>{for(const qe of Oe)try{const Ie=this.getActionDispatcher?.();Ie&&await Ie.dispatchAction(qe,{navigate:this.getRouter?.()?(Nt,Rt)=>this.getRouter().navigate(Nt,Rt):void 0,setState:Nt=>this.setGlobalState(Nt),state:this.globalState,data:{...this.globalState,$args:[re],$event:re},_isDispatchFallbackContext:!0})}catch(Ie){G.error(`WebSocket onReceive action failed for ${q}:`,Ie)}})()},R),G.log("WebSocket subscriptions established:",this.currentWebSocketSubscriptions)}G.log("Layout rendered successfully")}catch(s){G.error("Route change handling failed:",s),this.hideTransitionOverlay(),this.showRouteError(s)}}processInitOptions(e,t,s,i){e.some(d=>d.refetchOnMount===!0&&d.initLocal)&&(s._forceLocalInit=Date.now(),G.log("refetchOnMount detected, forcing local state init")),e.forEach(d=>{const g=t[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 y=this.evaluateDefaults(d.initLocalDefaults,t);f={...y,...h},G.log(`initLocalDefaults applied for ${d.initLocal}:`,Object.keys(y))}const p=this.globalState._local?.[d.initLocal];p!==void 0&&typeof p=="object"&&typeof f=="object"?(s[d.initLocal]=this.deepMerge(p,f),G.log(`initLocal (merged): ${d.id}.data -> _local.${d.initLocal}`)):(s[d.initLocal]=f,G.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 y=p?this.extractValueByPathOrExpression(h,p,d.id):h;if(d.initLocalDefaults&&typeof d.initLocalDefaults=="object"){const w=this.evaluateDefaults(d.initLocalDefaults,t);y={...w,...y},G.log(`initLocalDefaults applied for ${f}:`,Object.keys(w))}const x=this.globalState._local?.[f];x!==void 0&&typeof x=="object"&&typeof y=="object"?(s[f]=this.deepMerge(x,y),G.log(`initLocal (merged): ${d.id}.data${p?"."+p:""} -> _local.${f}`)):(s[f]=y,G.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:y,sourcePath:x}of p){const w=this.extractValueByPathOrExpression(h,x,d.id);if(y.includes(".")){const v=y.split(".")[0];s[v]===void 0&&this.globalState._local?.[v]!==void 0&&(s[v]=JSON.parse(JSON.stringify(this.globalState._local[v]))),this.setValueAtPath(s,y,w,f),G.log(`initLocal map (${f}): ${d.id} ${x} -> _local.${y}`)}else{const v=this.globalState._local?.[y];f==="replace"?(s[y]=w,G.log(`initLocal map (replace): ${d.id} ${x} -> _local.${y}`)):f==="shallow"?v!==void 0&&typeof v=="object"&&typeof w=="object"?(s[y]={...v,...w},G.log(`initLocal map (shallow): ${d.id} ${x} -> _local.${y}`)):(s[y]=w,G.log(`initLocal map: ${d.id} ${x} -> _local.${y}`)):v!==void 0&&typeof v=="object"&&typeof w=="object"?(s[y]=this.deepMerge(v,w),G.log(`initLocal map (deep): ${d.id} ${x} -> _local.${y}`)):(s[y]=w,G.log(`initLocal map: ${d.id} ${x} -> _local.${y}`))}}}}if(d.initGlobal)if(typeof d.initGlobal=="object"&&!Array.isArray(d.initGlobal)&&!("key"in d.initGlobal))for(const[p,y]of Object.entries(d.initGlobal)){if(typeof y!="string"){G.warn(`initGlobal map value must be string, got ${typeof y} for key ${p}`);continue}const x=this.extractValueByPathOrExpression(h,y,d.id),w=this.globalState[p];w!==void 0&&typeof w=="object"&&typeof x=="object"?(this.globalState[p]=this.deepMerge(w,x),G.log(`initGlobal map (merged): ${d.id} ${y} -> _global.${p}`)):(this.globalState[p]=x,G.log(`initGlobal map: ${d.id} ${y} -> _global.${p}`))}else{const p=Array.isArray(d.initGlobal)?d.initGlobal:[d.initGlobal];for(const y of p)if(typeof y=="string"){const x=this.globalState[y];x!==void 0&&typeof x=="object"&&typeof h=="object"?(this.globalState[y]=this.deepMerge(x,h),G.log(`initGlobal (merged): ${d.id}.data -> _global.${y}`)):(this.globalState[y]=h,G.log(`initGlobal: ${d.id}.data -> _global.${y}`))}else if(typeof y=="object"&&y.key){const{key:x,path:w}=y,v=w?this.extractValueByPathOrExpression(h,w,d.id):h,S=this.globalState[x];S!==void 0&&typeof S=="object"&&typeof v=="object"?(this.globalState[x]=this.deepMerge(S,v),G.log(`initGlobal (merged): ${d.id}.data${w?"."+w:""} -> _global.${x}`)):(this.globalState[x]=v,G.log(`initGlobal: ${d.id}.data${w?"."+w:""} -> _global.${x}`))}}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),G.log(`initIsolated (merged): ${d.id}.data -> _isolated.${d.initIsolated}`)):(i[d.initIsolated]=h,G.log(`initIsolated: ${d.id}.data -> _isolated.${d.initIsolated}`))}else if(typeof d.initIsolated=="object"&&d.initIsolated.key){const{key:f,path:p}=d.initIsolated,y=p?this.extractValueByPathOrExpression(h,p,d.id):h,x=i[f];x!==void 0&&typeof x=="object"&&typeof y=="object"?(i[f]=this.deepMerge(x,y),G.log(`initIsolated (merged): ${d.id}.data${p?"."+p:""} -> _isolated.${f}`)):(i[f]=y,G.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"){G.warn(`initIsolated map value must be string, got ${typeof p} for key ${f}`);continue}const y=this.extractValueByPathOrExpression(h,p,d.id),x=i[f];x!==void 0&&typeof x=="object"&&typeof y=="object"?(i[f]=this.deepMerge(x,y),G.log(`initIsolated map (merged): ${d.id} ${p} -> _isolated.${f}`)):(i[f]=y,G.log(`initIsolated map: ${d.id} ${p} -> _isolated.${f}`))}}})}evaluateDefaults(e,t){const s={};for(const[i,o]of Object.entries(e))if(typeof o=="string"&&o.startsWith("{{")&&o.endsWith("}}")){const d=o.slice(2,-2).trim();s[i]=this.evaluateExpression(d,t)}else s[i]=o;return s}evaluateExpression(e,t){try{const s=e.split("??").map(i=>i.trim());for(const i of s){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(t,i);if(o!=null)return o}return}catch(s){G.warn(`Expression evaluation failed: ${e}`,s);return}}getNestedValue(e,t){const s=t.replace(/\?\./g,".");let i=e;const o=s.split(/\.(?![^\[]*\])/).flatMap(d=>{const g=d.match(/^([^\[]*)((?:\[\d+\])*)$/);if(g){const[,h,f]=g,p=[];h&&p.push(h);const y=f.match(/\[\d+\]/g);return y&&p.push(...y),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,t,s){const i=t.match(/^\{\{(.+)\}\}$/);if(i){const o=i[1].trim(),d=new An,g={data:e,_global:this.globalState,_local:this.globalState._local||{}};try{const h=d.evaluateExpression(o,g);return G.log(`initLocal/initGlobal expression evaluated: ${t} -> `,h),h}catch(h){G.warn(`initLocal/initGlobal expression evaluation failed for ${s}:`,t,h);return}}return this.getNestedValue(e,t)}async loadLayoutScripts(e,t){const s=[];for(const i of e){if((i.if!==void 0||i.conditions!==void 0)&&!ni({if:i.if,conditions:i.conditions},t,this.bindingEngine,`script:${i.id}`)){G.log(`Script skipped (condition not met): ${i.id}`);continue}if(document.getElementById(i.id)){G.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=()=>{G.log(`Script loaded successfully: ${i.id}`),g()},f.onerror=()=>{G.warn(`Failed to load script: ${i.id} (${i.src})`),g()},document.head.appendChild(f)});s.push(d)}s.length>0&&(await Promise.all(s),G.log(`All scripts loaded: ${e.filter(i=>!document.getElementById(i.id)||s.length>0).map(i=>i.id).join(", ")}`))}evaluateScriptCondition(e,t){try{if(e.startsWith("{{")&&e.endsWith("}}")){const s=e.slice(2,-2).trim();return new Function("ctx",`
|
||
with(ctx) {
|
||
try {
|
||
return Boolean(${s});
|
||
} catch (e) {
|
||
return false;
|
||
}
|
||
}
|
||
`)(t)}return!!e}catch(s){return G.warn(`Failed to evaluate script condition: ${e}`,s),!1}}showInitError(e){const t=tx(e);nx.renderFromError("app",t,"초기화 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}showTransitionOverlay(e,t){const s=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(!s.enabled)return;if(this.hideTransitionOverlay(),s.style==="skeleton"&&s.skeleton?.component&&s.target&&t){this.renderSkeletonOverlay(s.target,s.skeleton,t,s.fallback_target);return}if(s.style==="spinner"&&s.target){this.renderSpinnerOverlay(s.target,s.spinner,s.fallback_target);return}const i=document.documentElement.classList.contains("dark");let o,d="";switch(s.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(s.target){const g=`#${CSS.escape(s.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,t,s,i){const d=vs.getInstance().getComponent(t.component);if(!d){G.log(`Skeleton component "${t.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){G.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)",y=h==="fullpage"?"app":h==="fallback"?i:e,x=`#${CSS.escape(y)}`,w=document.createElement("style");w.id="g7-skeleton-overlay-style",w.textContent=`${x}{position:relative;z-index:0;}${x}::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,$=window.scrollY||document.documentElement.scrollTop;v.style.cssText=["position:absolute",`top:${N.top+$}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 S=s.components||[];let k;if(h==="fullpage")k=S;else{const N=h==="fallback"?i:e;k=this.findComponentChildrenById(S,N)}const A=Pu.createRoot(v);this.skeletonOverlayRoot=A,Ma.flushSync(()=>{A.render(Ke.createElement(d,{components:k,options:{animation:t.animation||"pulse",iteration_count:t.iteration_count||5}}))});const O=h==="fullpage"?"fullpage (#app)":h==="fallback"?`fallback (#${i})`:`target (#${e})`;G.log(`Skeleton overlay rendered [${O}] with "${t.component}" (${k.length} components)`)}findComponentChildrenById(e,t){const s=i=>{for(const o of i){if(o.id===t)return o.children||[];if(o.children&&Array.isArray(o.children)){const d=s(o.children);if(d!==null)return d}}return null};return s(e)||e}renderSpinnerOverlay(e,t,s){let i=document.getElementById(e),o="target";if(!i&&s&&(i=document.getElementById(s),o="fallback"),i||(i=document.getElementById("app"),o="fullpage"),!i){G.log(`Spinner overlay: no target found (target="#${e}", fallback="${s||"none"}"), falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}this.hideSkeletonOverlay();const d=o==="fullpage"?"app":o==="fallback"?s: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=t?.text||window.G7Core?.t?.("nav.loading")||"";this._spinnerState={target:e,fallbackTarget:s,spinnerConfig:t,resolvedText:f},this._mountSpinnerInTarget(i);const p=o==="fullpage"?"fullpage (#app)":o==="fallback"?`fallback (#${s})`:`target (#${e})`,y=t?.component||"default spinner";G.log(`Spinner overlay rendered [${p}] with "${y}"`)}_mountSpinnerInTarget(e){if(!this._spinnerState)return;const{spinnerConfig:t,resolvedText:s}=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,t?.component){const d=vs.getInstance().getComponent(t.component);if(d){const g=Pu.createRoot(i);this.skeletonOverlayRoot=g,Ma.flushSync(()=>{g.render(Ke.createElement(d,{options:{text:s}}))});return}G.log(`Spinner component "${t.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:t}=this._spinnerState;let s=document.getElementById(e);!s&&t&&(s=document.getElementById(t)),s||(s=document.getElementById("app")),s&&(this._mountSpinnerInTarget(s),G.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){if(e instanceof Es&&e.details?.status===401){const s=this.config.templateId||"",i=window.location.pathname,o=s.includes("admin")||i.startsWith("/admin")?"admin":"user",d=i+window.location.search,g=!!Bs().getToken()||e.details?.hadToken===!0,h=qs.getInstance().getLoginRedirectUrl(o,d,g?"session_expired":void 0);window.location.href=h;return}const t=tx(e);nx.renderFromError("app",t,"페이지 로딩 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}async handleServerError(){const e=window.G7Error;if(!e)return!1;G.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"))?(G.log(`${e.code} error page rendered successfully`),!0):(G.log(`Falling back to ErrorDisplay for ${e.code}`),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0)}catch(t){return G.error(`Failed to render ${e.code} page:`,t),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0}}async handleRouteNotFound(e){G.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"))){G.log("404 error page rendered successfully");return}G.log("Falling back to ErrorDisplay for 404"),this.showRouteError(new Error(`Page not found: ${e}`))}catch(t){G.error("Failed to render 404 page:",t),this.showRouteError(new Error(`Page not found: ${e}`))}}getRouter(){return this.router}getConfig(){return this.config}getLayoutLoader(){return this.layoutLoader}async reloadExtensionState(){G.log("reloadExtensionState: start");let e;try{const t=await fetch(`/api/templates/${this.config.templateId}/config.json?_=${Date.now()}`);if(t.ok){const s=await t.json();s?.success&&s?.data?.cache_version!==void 0&&(e=s.data.cache_version)}}catch(t){G.warn("reloadExtensionState: failed to fetch config.json",t)}e!==void 0&&e!==this.extensionCacheVersion&&(G.log(`reloadExtensionState: cache version ${this.extensionCacheVersion} -> ${e}`),this.extensionCacheVersion=e,this.saveCacheVersionToStorage(e));try{this.router&&(await this.router.loadRoutes(this.extensionCacheVersion),G.log("reloadExtensionState: routes reloaded"))}catch(t){G.error("reloadExtensionState: routes reload failed",t)}try{this.layoutLoader&&(this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),this.layoutLoader.clear(),G.log("reloadExtensionState: layout cache cleared"))}catch(t){G.error("reloadExtensionState: layout cache clear failed",t)}try{const{TranslationEngine:t}=await Promise.resolve().then(()=>Gp),s=t.getInstance();this.extensionCacheVersion>0&&s.setCacheVersion(this.extensionCacheVersion);const i=this.config.locale||"ko",o="en";await s.loadTranslations(this.config.templateId,i,"/api",!0),i!==o&&await s.loadTranslations(this.config.templateId,o,"/api",!0),G.log("reloadExtensionState: translations reloaded")}catch(t){G.error("reloadExtensionState: translations reload failed",t)}try{const t=await fetch(`/api/locales/active?_=${Date.now()}`);if(t.ok){const i=(await t.json())?.data?.locales;if(Array.isArray(i)&&i.length>0){const o=this.globalState.appConfig??{};this.setGlobalState({appConfig:{...o,supportedLocales:i}}),G.log("reloadExtensionState: supportedLocales refreshed",i)}}}catch(t){G.warn("reloadExtensionState: supportedLocales refresh failed",t)}G.log("reloadExtensionState: done")}getActionDispatcher(){return za().actionDispatcher}async changeLocale(e){try{if(G.log("Changing locale to:",e),this.config.locale===e){G.log("Locale is already",e);return}this.config.locale=e,this.saveLocaleToStorage(e),await this.saveLocaleToDatabase(e),this.layoutLoader&&(this.layoutLoader.clear(),G.log("Layout cache cleared")),this.errorPageHandler&&(this.errorPageHandler.updateLocale(e),G.log("ErrorPageHandler locale updated")),qc(),await Io({templateId:this.config.templateId,templateType:this.config.templateType,locale:e,debug:this.config.debug,cacheVersion:this.extensionCacheVersion}),G.log("Template Engine re-initialized with new locale");const{getActionDispatcher:t}=await Promise.resolve().then(()=>Ks),s=t();s&&(s.setDefaultContext({navigate:i=>this.router?.navigate(i)}),s.setGlobalStateUpdater((i,o)=>this.setGlobalState(i,o)),G.log("Navigate function and setGlobalState re-injected to ActionDispatcher")),this.reinitializeModuleHandlers(),G.log("Module handlers re-initialized"),this.reinitializeTemplateHandlers(),G.log("Template handlers re-initialized"),this.reinitializePluginHandlers(),G.log("Plugin handlers re-initialized"),this.router&&this.router.navigateToCurrentPath(),G.log("Locale changed successfully to",e)}catch(t){throw G.error("Failed to change locale:",t),t}}loadLocaleFromStorage(){try{return localStorage.getItem(Ds.LOCALE_STORAGE_KEY)}catch(e){return G.warn("Failed to load locale from storage:",e),null}}saveLocaleToStorage(e){try{localStorage.setItem(Ds.LOCALE_STORAGE_KEY,e)}catch(t){G.warn("Failed to save locale to storage:",t)}}async saveLocaleToDatabase(e){const t=localStorage.getItem("auth_token");if(!t){G.log("No auth token, skipping DB locale save");return}let s,i;if(this.config.localeApi)s=this.config.localeApi.endpoint,i=this.config.localeApi.method;else{const o=this.config.templateType==="admin";s=o?"/api/admin/users/me/language":"/api/user/profile/update-language",i=o?"PATCH":"POST"}try{const o=this.getXsrfToken(),d=await fetch(s,{method:i,headers:{"Content-Type":"application/json",Accept:"application/json",...o&&{"X-XSRF-TOKEN":o},Authorization:`Bearer ${t}`},credentials:"include",body:JSON.stringify({language:e})});d.ok?G.log("Locale saved to DB:",e):G.warn("Failed to save locale to DB (UI will still change):",d.statusText)}catch(o){G.warn("Failed to call locale API (UI will still change):",o)}}getXsrfToken(){if(typeof document>"u")return null;const t=`; ${document.cookie}`.split("; XSRF-TOKEN=");return t.length===2?decodeURIComponent(t.pop()?.split(";").shift()||""):null}loadCacheVersionFromStorage(){try{const e=localStorage.getItem(Ds.CACHE_VERSION_STORAGE_KEY);return e?parseInt(e,10):null}catch(e){return G.warn("Failed to load cache version from storage:",e),null}}saveCacheVersionToStorage(e){try{localStorage.setItem(Ds.CACHE_VERSION_STORAGE_KEY,String(e))}catch(t){G.warn("Failed to save cache version to storage:",t)}}reinitializeModuleHandlers(){if(typeof window>"u")return;const e="__",t=window;Object.keys(t).forEach(s=>{if(s.startsWith(e)&&typeof t[s]?.initModule=="function")try{t[s].initModule(),G.log(`Module handler re-initialized: ${s}`)}catch(i){G.warn(`Failed to re-initialize module handlers for ${s}:`,i)}})}reinitializeTemplateHandlers(){if(typeof window>"u")return;const e=window.G7TemplateHandlers;if(!e){G.warn("Template handlers not found on window.G7TemplateHandlers");return}const t=this.getActionDispatcher();if(!t){G.warn("ActionDispatcher not available for template handler registration");return}Object.entries(e).forEach(([s,i])=>{t.registerHandler(s,i)}),G.log(`${Object.keys(e).length} template handler(s) re-registered:`,Object.keys(e))}reinitializePluginHandlers(){if(typeof window>"u")return;const e="__",t=window;Object.keys(t).forEach(s=>{if(s.startsWith(e)&&typeof t[s]?.initPlugin=="function")try{t[s].initPlugin(),G.log(`Plugin handler re-initialized: ${s}`)}catch(i){G.warn(`Failed to re-initialize plugin handlers for ${s}:`,i)}})}getLocale(){return this.config.locale}getErrorPageHandler(){return this.errorPageHandler}getGlobalState(){return{...this.globalState}}setGlobalState(e,t){const s={...this.globalState};typeof e=="function"?this.globalState=e(this.globalState):this.globalState={...this.globalState,...e},G.log("Global state updated:",this.globalState),window.G7Core?.devTools?.captureStateSnapshot?.({source:"setGlobalState",prev:s,next:this.globalState}),this.globalStateListeners.forEach(o=>{o(this.globalState)}),t?.render!==!1&&Promise.resolve().then(()=>Ks).then(({updateTemplateData:o,getState:d})=>{const g=d();g.reactRoot&&g.currentLayoutJson&&o({_global:{...this.globalState},_local:this.globalState._local||{}})})}onGlobalStateChange(e){this.globalStateListeners.add(e)}offGlobalStateChange(e){this.globalStateListeners.delete(e)}async refetchDataSource(e,t){let s=this.currentDataSources.find(i=>i.id===e);if(!s)for(const[,i]of this.modalDataSources){const o=i.find(d=>d.id===e);if(o){s=o;break}}if(!s){G.warn(`Data source not found: ${e}`);return}G.log(`Refetching data source: ${e}`,t?.sync?"(sync mode)":"",t?.globalStateOverride?"(with global override)":"",t?.localStateOverride?"(with local override)":""),Gs.setPending(!0);try{const i=new la;this.currentGlobalHeaders.length>0&&i.setGlobalHeaders(this.currentGlobalHeaders);const o=za(),d=o.currentDataContext?._global||{},g=t?.globalStateOverride?{...d,...t.globalStateOverride}:d,h=o.currentDataContext?._local||{},f=t?.localStateOverride?{...h,...t.localStateOverride}:h,y=(await i.fetchDataSourcesWithResults([s],this.currentRouteParams,this.currentQueryParams,g,f,{ignoreAutoFetch:!0}))[0];if(y.state==="success"&&y.data!==void 0){this.currentFetchedData[e]=y.data;const x={};this.processInitOptions([s],{[e]:y.data},x);const w=za();if(w.bindingEngine){const S=[e];s.initGlobal&&S.push("_global"),s.initLocal&&S.push("_local"),w.bindingEngine.invalidateCacheByKeys(S)}const v={[e]:y.data};return Object.keys(x).length>0&&(v._localInit=x),s.initGlobal&&(v._global={...this.globalState}),pi(v,t?.sync?{sync:!0}:void 0),G.log(`Data source refetched successfully: ${e}`),y.data}else if(y.state==="error"){G.error(`Failed to refetch data source: ${e}`,y.error);return}}catch(i){G.error(`Error refetching data source: ${e}`,i);return}finally{Gs.setPending(!1)}}registerModalDataSources(e,t){this.modalDataSources.set(e,t),G.log(`Modal data sources registered: ${e} (${t.length} sources)`)}unregisterModalDataSources(e){this.modalDataSources.delete(e),G.log(`Modal data sources unregistered: ${e}`)}getDataSource(e){return this.currentFetchedData[e]}setDataSource(e,t,s){if(!e){G.warn("setDataSource: dataSourceId is required");return}const{merge:i=!1,sync:o=!1}=s||{};i&&this.currentFetchedData[e]?this.currentFetchedData[e]={...this.currentFetchedData[e],...t}:this.currentFetchedData[e]=t,Promise.resolve().then(()=>Ks).then(({updateTemplateData:d})=>{d({[e]:this.currentFetchedData[e]},o?{sync:!0}:void 0)}),G.log(`setDataSource: Updated ${e}`,i?"(merged)":"(replaced)")}updateDataSourceItem(e,t,s,i,o){const{idField:d="id",merge:g=!0,skipRender:h=!1}=o||{},f=this.currentFetchedData[e];if(!f)return G.warn(`updateDataSourceItem: DataSource '${e}' not found`),!1;const p=this.parseItemPath(t);let y=f;for(const v of p)if(y=y?.[v],y===void 0)return G.warn(`updateDataSourceItem: Path '${t}' not found in dataSource`),!1;if(!Array.isArray(y))return G.warn(`updateDataSourceItem: Target at '${t}' is not an array`),!1;const x=y.findIndex(v=>String(v[d])===String(s));if(x===-1)return G.warn(`updateDataSourceItem: Item with ${d}='${s}' not found`),!1;g?y[x]=this.deepMerge(y[x],i):y[x]={...y[x],...i};const w=window.G7Core?.devTools;return w?.isEnabled?.()&&w.trackDataSourceUpdate?.({dataSourceId:e,updateType:"partial",itemPath:t,itemId:s,updates:i,timestamp:Date.now()}),h||Promise.resolve().then(()=>Ks).then(({updateTemplateData:v})=>{v({[e]:this.currentFetchedData[e]},{sync:!1})}),G.log(`updateDataSourceItem: Updated ${e}.${t}[${d}=${s}]`),!0}parseItemPath(e){const t=[],s=/([^\.\[\]]+)|\[(\d+)\]/g;let i;for(;(i=s.exec(e))!==null;)i[1]!==void 0?t.push(i[1]):i[2]!==void 0&&t.push(parseInt(i[2],10));return t}deepMerge(e,t){if(t==null)return e;if(typeof t!="object"||Array.isArray(t))return t;const s={...e};for(const i of Object.keys(t))typeof t[i]=="object"&&t[i]!==null&&!Array.isArray(t[i])?s[i]=this.deepMerge(s[i]||{},t[i]):s[i]=t[i];return s}setValueAtPath(e,t,s,i="deep"){const o=t.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]=s:i==="shallow"?typeof h=="object"&&typeof s=="object"&&!Array.isArray(s)?d[g]={...h,...s}:d[g]=s:typeof h=="object"&&typeof s=="object"&&!Array.isArray(s)?d[g]=this.deepMerge(h,s):d[g]=s}flattenNestedObjectToMappings(e,t=""){const s=[];for(const[i,o]of Object.entries(e)){if(i==="_merge")continue;const d=t?`${t}.${i}`:i;typeof o=="string"?s.push({targetPath:d,sourcePath:o}):typeof o=="object"&&o!==null&&!Array.isArray(o)&&s.push(...this.flattenNestedObjectToMappings(o,d))}return s}async updateQueryParams(e,t){G.log("updateQueryParams:",e);const s=new URL(e,window.location.origin),i=new URLSearchParams(s.search);window.history.replaceState(null,"",e),G.log("URL updated via replaceState"),this.currentQueryParams=i,G.log("currentQueryParams updated:",Object.fromEntries(i.entries()));const o=this.currentDataSources.filter(y=>y.auto_fetch!==!1&&y.type!=="websocket");if(o.length===0){G.log("No auto_fetch data sources to refetch");return}G.log(`Refetching ${o.length} auto_fetch data sources`),Gs.setPending(!0);const d=za().currentLayoutJson,g=d?.transition_overlay,h=Array.isArray(g?.wait_for)?g.wait_for:[],f=o.some(y=>(y.loading_strategy||"progressive")==="blocking"),p=h.length>0&&o.some(y=>h.includes(y.id)&&y.type!=="websocket"&&(y.loading_strategy||"progressive")!=="background");if((f||p)&&g&&typeof g=="object"){const y=t?.transitionOverlayTarget||g.target;g.enabled&&g.style==="skeleton"&&g.skeleton?.component&&y?this.renderSkeletonOverlay(y,g.skeleton,d,g.fallback_target):g.enabled&&g.style==="spinner"&&y&&this.renderSpinnerOverlay(y,g.spinner,g.fallback_target)}try{const y=new la;this.currentGlobalHeaders.length>0&&y.setGlobalHeaders(this.currentGlobalHeaders);const x=za(),w=x.currentDataContext?._global||{},v=await y.fetchDataSourcesWithResults(o,this.currentRouteParams,this.currentQueryParams,w,void 0,{ignoreAutoFetch:!1}),S={},k={},A=new Map(o.map(O=>[O.id,O]));for(const O of v){const N=A.get(O.id);if(!N){G.warn(`Refetch result id not found in autoFetchDataSources: ${O.id}`);continue}const D=O.id;O.state==="success"&&O.data!==void 0?(this.currentFetchedData[D]=O.data,S[D]=O.data,this.processInitOptions([N],{[D]:O.data},k),G.log(`Data source refetched: ${D}`)):O.state==="error"&&G.error(`Failed to refetch data source: ${D}`,O.error)}if(x.bindingEngine){const O=Object.keys(S);O.push("query"),x.bindingEngine.invalidateCacheByKeys(O)}if(Object.keys(k).length>0&&(S._localInit=k),Object.keys(S).length>0){if(S.query=ok(this.currentQueryParams),x.currentLayoutJson?.computed&&Object.keys(x.currentLayoutJson.computed).length>0){const O={...x.currentDataContext,...S,query:S.query},N=this.calculateComputed(x.currentLayoutJson.computed,O);Object.keys(N).length>0&&(S._computed=N,this.globalState._computed=N,G.log("Computed values recalculated in updateQueryParams:",Object.keys(N)))}pi(S,{sync:!0}),G.log("Template data updated with new query params")}}catch(y){G.error("Error in updateQueryParams:",y)}finally{Gs.setPending(!1),this.hideTransitionOverlay()}}calculateComputed(e,t){const s={},i=new An;for(const[o,d]of Object.entries(e))try{let g;if(this.isComputedSwitchDefinition(d))g=i.resolveSwitch(d,t,{skipCache:!0});else if(typeof d=="string")if(d.startsWith("{{")&&d.endsWith("}}")){const h=d.slice(2,-2).trim();g=this.evaluateComputedExpression(h,t)}else g=d;s[o]=g,G.log(`Computed ${o}:`,g)}catch(g){G.warn(`Failed to calculate computed value: ${o}`,g),s[o]=void 0}return s}isComputedSwitchDefinition(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}evaluateComputedExpression(e,t){try{return new Function("ctx",`
|
||
with(ctx) {
|
||
try {
|
||
return ${e};
|
||
} catch (e) {
|
||
return undefined;
|
||
}
|
||
}
|
||
`)(t)}catch(s){G.warn(`Expression evaluation failed: ${e}`,s);return}}async executeInitActions(e,t={}){const{getActionDispatcher:s}=await Promise.resolve().then(()=>Ks),i=s();if(!i){G.warn("ActionDispatcher not available for init_actions");return}G.log("Executing init_actions:",e.map(g=>g.handler)),G.log("Init actions dataContext:",t),G.log("Init actions dataContext._global:",t._global);const o=e.map(g=>g.handler).filter(g=>g.includes("."));o.length>0&&await this.waitForHandlers(i,o);let d={...t};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),G.log(`Init action executed: ${g.handler}`);const y=this.globalState;d={...d,_global:{...y},_local:y._local||d._local||{}},G.log(`Data context refreshed after ${g.handler}:`,{cartKey:d._global?.cartKey})}catch(h){G.error(`Failed to execute init action: ${g.handler}`,h)}}async waitForHandlers(e,t,s=5e3){const i=Date.now(),o=50,d=()=>t.every(g=>e.customHandlers?.has(g));if(d()){G.log("All module handlers already registered");return}return G.log("Waiting for module handlers:",t),new Promise(g=>{const h=()=>{if(d()){G.log("All module handlers now registered"),g();return}if(Date.now()-i>=s){const f=t.filter(p=>!e.customHandlers?.has(p));G.warn("Timeout waiting for handlers:",f),g();return}setTimeout(h,o)};h()})}};H(Ds,"LOCALE_STORAGE_KEY","g7_locale"),H(Ds,"CACHE_VERSION_STORAGE_KEY","g7_cache_version");let Lo=Ds;function qg(r){const e=new Lo(r);return r.websocket&&(Ic.configure(r.websocket),G.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=qg,window.G7Core.dataSource={refetch:async(r,e)=>{const t=window.__templateApp;if(!t){G.warn("TemplateApp not initialized (G7Core.dataSource.refetch)");return}return t.refetchDataSource(r,e)},get:r=>{const e=window.__templateApp;if(!e){G.warn("TemplateApp not initialized (G7Core.dataSource.get)");return}return e.getDataSource(r)}});const Uc=[{id:"stale-closure",name:"Stale Closure",category:"state",symptoms:["이전 값이 전송됨","저장 시 오래된 데이터","API 호출 시 첫 값만 전송","클릭할 때마다 같은 값"],detector:r=>{const t=r.actionHistory.slice(-10).filter(s=>s.type==="apiCall");if(t.length<2)return!1;for(let s=1;s<t.length;s++){const i=JSON.stringify(t[s-1].params),o=JSON.stringify(t[s].params);if(i===o&&t[s].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(t=>t.type==="sequence").some(t=>t.children?.filter(s=>s.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(t=>t.dataKey?.startsWith("_global.")).length===0?!1:!r.stateHistory.some(t=>t.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 t=e.map(s=>s.url.split("?")[0]);return new Set(t).size<t.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 s=r.network.requestHistory.slice(-20).map(i=>`${i.method}:${i.url}`);return s.length!==new Set(s).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(s=>s.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(s=>s.type==="scroll"),t=r.actionHistory.some(s=>s.type==="appendDataSource");return!e&&!t&&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(t=>t.type==="appendDataSource");return e.length>=2&&e.some(t=>t.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(t=>!t.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 sx{constructor(){H(this,"devTools");this.devTools=Ns.getInstance()}analyze(e){const t=this.buildContext(),s=[];for(const i of Uc){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(t)}catch{}(o||d)&&s.push({rule:i,confidence:this.calculateConfidence(i,e,o,d),evidence:this.collectEvidence(i,t)})}return s.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(),t=[];for(const s of Uc)try{s.detector(e)&&t.push({rule:s,count:1})}catch{}return t.sort((s,i)=>i.count-s.count).map(s=>({id:s.rule.id,name:s.rule.name,description:s.rule.solution,frequency:s.count}))}getRulesByCategory(e){return Uc.filter(t=>t.category===e)}getAllRules(){return[...Uc]}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,t)=>this.checkLayoutHas(e,t)}}calculateConfidence(e,t,s,i){let o=e.probability;if(s){const d=t.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,t){const s=[];switch(e.category){case"state":t.stateHistory.length>0&&s.push(`상태 변경 이력: ${t.stateHistory.length}개`);break;case"cache":s.push(`캐시 히트율: ${((t.cacheStats.hitRate??0)*100).toFixed(1)}%`);break;case"lifecycle":t.lifecycle.orphanedListeners.length>0&&s.push(`정리되지 않은 리스너: ${t.lifecycle.orphanedListeners.length}개`);break;case"performance":s.push(`바인딩 평가 횟수: ${t.performance.bindingEvalCount}`);break;case"network":s.push(`진행 중인 요청: ${t.network.activeRequests.length}개`);break;case"form":s.push(`추적 중인 Form: ${t.form.length}개`);break}return s}checkLayoutHas(e,t){try{const i=window.G7Core?.getCurrentLayout?.();if(!i)return!1;const o=JSON.stringify(i);return o.includes(`"${e}":"${t}`)||o.includes(`"${e}": "${t}`)}catch{return!1}}}const lk=Object.freeze(Object.defineProperty({__proto__:null,DiagnosticEngine:sx},Symbol.toStringTag,{value:"Module"})),ck={dumpEndpoint:"/_boost/g7-debug/dump-state",logEndpoint:"/_boost/g7-debug/log",timeout:1e4,autoCapture:!1,autoCaptureInterval:3e4};class dk{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={...ck,...e},this.devTools=Ns.getInstance(),this.config.autoCapture&&this.startAutoCapture()}async dumpState(e=!1){const t=`${Date.now()}_${Math.random().toString(36).substring(2,9)}`,s=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[x,w]of Object.entries(d))try{const v=w(),S=this.safeStringify(v,x);S===null?(h.push(`${x}: 직렬화 실패`),g[x]=JSON.stringify({_error:`${x} 섹션 직렬화 실패`})):g[x]=S,f+=g[x].length}catch(v){const S=v instanceof Error?v.message:String(v);h.push(`${x}: ${S}`),g[x]=JSON.stringify({_error:`${x} 섹션 수집 실패: ${S}`}),f+=g[x].length}const p=Object.keys(g).length,y=p-h.length;try{return f<=this.BULK_THRESHOLD?(await this.sendBulkDump(g,s,e),console.log(`[G7DevTools] 상태 덤프 완료 - 일괄 전송 (${(f/1024).toFixed(1)}KB, ${y}/${p} 섹션 성공)`)):(await this.sendChunkedDump(t,g,s,e),console.log(`[G7DevTools] 상태 덤프 완료 - 분할 전송 (${(f/1024/1024).toFixed(2)}MB, ${y}/${p} 섹션 성공)`)),this.connected=!0,h.length>0&&console.warn("[G7DevTools] 일부 섹션 실패:",h.join(", ")),t}catch(x){throw this.connected=!1,console.error("[G7DevTools] 상태 덤프 실패:",x),x}}async sendBulkDump(e,t,s){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:t,saveHistory:s})}async sendChunkedDump(e,t,s,i){const o=Object.keys(t),d=o.length;for(let g=0;g<o.length;g++){const h=o[g],f=t[h],p=g===o.length-1;await this.sendChunkedSection(e,h,f,p,s,i,d)}}async sendChunkedSection(e,t,s,i,o,d,g){const h=this.splitIntoChunks(s),f=h.length;for(let p=0;p<h.length;p++){const y=p===h.length-1,x=h[p];await this.sendRequest(this.config.dumpEndpoint,{sessionId:e,sectionName:t,chunkData:x,chunkIndex:p,totalChunks:f,isLastChunk:y,isLastSection:i&&y,timestamp:o,saveHistory:d,totalSections:g})}}splitIntoChunks(e){const t=[];for(let s=0;s<e.length;s+=this.CHUNK_SIZE)t.push(e.slice(s,s+this.CHUNK_SIZE));return t.length>0?t:[""]}safeStringify(e,t){const s=new WeakSet;try{return JSON.stringify(e,(o,d)=>{if(typeof d=="object"&&d!==null){if(s.has(d))return"[Circular Reference]";s.add(d)}return typeof d=="function"?"[Function]":typeof d=="symbol"?"[Symbol]":typeof d=="bigint"?d.toString():d})}catch(i){return console.warn(`[G7DevTools] ${t} 직렬화 오류:`,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,t){const s={name:e.name,message:e.message,stack:e.stack,context:t,state:this.devTools.getState(),actions:this.devTools.getActionHistory().slice(-10),timestamp:Date.now()};console.log("[G7:ERROR]",JSON.stringify(s));try{await this.sendRequest(this.config.logEndpoint,{type:"error",data:s,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,t){const s=new AbortController,i=setTimeout(()=>s.abort(),this.config.timeout);try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify(t),signal:s.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 t=[/<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 t){const o=e.match(i);if(o)return(o[o.length-1]||o[1]).replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').trim().substring(0,200)}return e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().substring(0,200)||"Unknown server error"}destroy(){this.stopAutoCapture()}}let Gg=null;function ax(){return Gg||(Gg=new dk),Gg}const uk=`
|
||
#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;
|
||
}
|
||
`,gk=()=>{const r="g7-devtools-styles";if(document.getElementById(r))return;const e=document.createElement("style");e.id=r,e.textContent=uk,document.head.appendChild(e)},rx={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"},hk=700,fk=500,ix=400,ox=300,lx="g7-devtools-panel",Fg=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",pk=r=>r===null?"null":r===void 0?"undefined":Array.isArray(r)?`Array(${r.length})`:typeof r=="object"?`Object(${Object.keys(r).length})`:typeof r,mk=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):"",cx=()=>{try{const r=localStorage.getItem(lx);if(r)return JSON.parse(r)}catch(r){console.warn("[G7DevTools] 설정 로드 실패:",r)}return{}},dx=r=>{try{const t={...cx(),...r};localStorage.setItem(lx,JSON.stringify(t))}catch(e){console.warn("[G7DevTools] 설정 저장 실패:",e)}},fi=({keyName:r,value:e,path:t,expandedPaths:s,onToggle:i,searchTerm:o,depth:d=0})=>{const g=e!==null&&typeof e=="object",h=s.has(t),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)),y=w=>{w.stopPropagation(),g&&i(t)},x=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:y,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 ${Fg(e)}`,children:[f?"[":"{",!h&&l.jsx("span",{className:"g7dt-text-gray",style:{margin:"0 4px"},children:pk(e)}),!h&&(f?"]":"}")]}):l.jsx("span",{className:`g7dt-text-xs ${Fg(e)}`,children:mk(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:[x.map(([w,v])=>l.jsx(fi,{keyName:f?`[${w}]`:w,value:v,path:`${t}.${w}`,expandedPaths:s,onToggle:i,searchTerm:o,depth:d+1},`${t}.${w}`)),l.jsx("div",{className:"g7dt-ml-4 g7dt-text-xs",children:l.jsx("span",{className:Fg(e),children:f?"]":"}"})})]})]})},yk=({state:r,devTools:e})=>{const[t,s]=j.useState(new Set(["_global","_local","_computed","_isolated","$parent"])),[i,o]=j.useState(""),[d,g]=j.useState(!1),[h,f]=j.useState(!1),[p,y]=j.useState(null),x=j.useCallback(()=>{e&&y(e.getComputedDependencyTrackingInfo())},[e]);j.useEffect(()=>{if(h&&e){x();const M=setInterval(x,2e3);return()=>clearInterval(M)}},[h,e,x]);const w=M=>{switch(M){case"state-change":return"📊";case"prop-change":return"📥";case"dependency-change":return"🔗";case"manual":return"👆";case"initial":return"🚀";default:return"❓"}},v=j.useCallback(M=>{s(z=>{const K=new Set(z);return K.has(M)?K.delete(M):K.add(M),K})},[]),S=j.useCallback((M,z)=>{const K=[z];if(M!==null&&typeof M=="object")for(const[ye,we]of Object.entries(M))K.push(...S(we,`${z}.${ye}`));return K},[]),k=j.useCallback(()=>{if(d)s(new Set(["_global","_local","_computed","_isolated","$parent"]));else{const M=new Set;S(r._global,"_global").forEach(z=>M.add(z)),S(r._local,"_local").forEach(z=>M.add(z)),S(r._computed,"_computed").forEach(z=>M.add(z)),S(r._isolated,"_isolated").forEach(z=>M.add(z)),r.$parent&&S(r.$parent,"$parent").forEach(z=>M.add(z)),s(M)}g(!d)},[d,r,S]),A=Object.keys(r._global||{}).length,O=Object.keys(r._local||{}).length,N=Object.keys(r._computed||{}).length,D=Object.keys(r._isolated||{}).length,$=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:M=>o(M.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:t.has("_global")?"▼":"▶"}),l.jsx("span",{children:"_global"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",A,"개 키)"]})]}),t.has("_global")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._global||{}).map(([M,z])=>l.jsx(fi,{keyName:M,value:z,path:`_global.${M}`,expandedPaths:t,onToggle:v,searchTerm:i},`_global.${M}`))})]}),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:t.has("_local")?"▼":"▶"}),l.jsx("span",{children:"_local"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",O,"개 키)"]})]}),t.has("_local")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._local||{}).map(([M,z])=>l.jsx(fi,{keyName:M,value:z,path:`_local.${M}`,expandedPaths:t,onToggle:v,searchTerm:i},`_local.${M}`))})]}),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:t.has("_computed")?"▼":"▶"}),l.jsx("span",{children:"_computed"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",N,"개 키)"]})]}),t.has("_computed")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._computed||{}).map(([M,z])=>l.jsx(fi,{keyName:M,value:z,path:`_computed.${M}`,expandedPaths:t,onToggle:v,searchTerm:i},`_computed.${M}`))})]}),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:t.has("_isolated")?"▼":"▶"}),l.jsx("span",{children:"_isolated"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",D,"개 스코프)"]})]}),t.has("_isolated")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r._isolated||{}).map(([M,z])=>l.jsx(fi,{keyName:M,value:z,path:`_isolated.${M}`,expandedPaths:t,onToggle:v,searchTerm:i},`_isolated.${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:t.has("$parent")?"▼":"▶"}),l.jsx("span",{children:"$parent"}),l.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",$,"개 키)"]})]}),t.has("$parent")&&l.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(r.$parent||{}).map(([M,z])=>l.jsx(fi,{keyName:M,value:z,path:`$parent.${M}`,expandedPaths:t,onToggle:v,searchTerm:i},`$parent.${M}`))})]})]}),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((M,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:M.name}),l.jsxs("span",{className:"g7dt-text-muted",children:[M.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(M=>l.jsxs("div",{className:`g7dt-list-item ${M.valueChanged?"":"g7dt-border-yellow"}`,children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:w(M.trigger)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-purple g7dt-font-mono",children:M.computedName}),!M.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:[M.computationTime.toFixed(1),"ms"]})]}),M.triggeredBy&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["트리거: ",l.jsx("span",{className:"g7dt-text-blue",children:M.triggeredBy.path})]})]},M.id))})]})]})},xk=({actions:r,devTools:e})=>{const[t,s]=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 S=setInterval(p,2e3);return()=>clearInterval(S)}},[i,e,p]);const y=t?r.filter(S=>S.type.toLowerCase().includes(t.toLowerCase())||S.status===t):r,x=S=>{switch(S){case"success":return"g7dt-status-success";case"error":return"g7dt-status-error";case"started":return"g7dt-status-started";default:return"g7dt-status-default"}},w=S=>{switch(S){case"success":return"g7dt-badge-success";case"error":return"g7dt-badge-error";default:return"g7dt-badge-warning"}},v=h&&d?d.executions.find(S=>S.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:t,onChange:S=>s(S.target.value),className:"g7dt-input g7dt-flex-1"}),l.jsx("button",{onClick:()=>s(""),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(S=>l.jsx("div",{className:`g7dt-list-item g7dt-cursor-pointer ${h===S.id?"g7dt-selected":""} ${S.status==="error"?"g7dt-border-red":""}`,onClick:()=>f(h===S.id?null:S.id),children:l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:S.status==="completed"?"✅":S.status==="error"?"❌":"⏳"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-white",children:[S.actions.length,"개 액션"]}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[S.totalDuration.toFixed(0),"ms"]})]})},S.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((S,k)=>l.jsxs("div",{className:`g7dt-list-item ${S.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:["#",S.index+1]}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-font-mono",children:S.handler}),l.jsx("span",{className:`g7dt-text-xs ${S.status==="success"?"g7dt-text-green":"g7dt-text-red"}`,children:S.status==="success"?"✓":"✕"}),l.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[S.duration.toFixed(0),"ms"]})]}),S.stateChanges&&S.stateChanges.length>0&&l.jsxs("div",{className:"g7dt-mt-1",children:[l.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 변경:"}),S.stateChanges.slice(0,3).map((A,O)=>l.jsx("div",{className:"g7dt-text-xs g7dt-text-yellow g7dt-ml-2",children:A.path},O)),S.stateChanges.length>3&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-2",children:["...외 ",S.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:y.length===0?l.jsx("div",{className:"g7dt-empty-message",children:"액션 이력이 없습니다"}):y.slice(-30).reverse().map((S,k)=>l.jsxs("div",{className:`g7dt-action-item ${x(S.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:S.type}),l.jsx("span",{className:`g7dt-status-badge ${w(S.status)}`,children:S.status})]}),l.jsx("span",{className:"g7dt-text-gray",children:S.duration?`${S.duration.toFixed(2)}ms`:"-"})]}),S.error&&l.jsx("div",{className:"g7dt-error-box",children:S.error.message}),S.params&&Object.keys(S.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(S.params,null,2)})]})]},`${S.id}-${k}`))})})]})},bk=({stats:r,devTools:e})=>{const[t,s]=j.useState(null),[i,o]=j.useState(!1),d=j.useCallback(()=>{s(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*100).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*100}%`}})})]}),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&&t&&l.jsxs("div",{className:"g7dt-card",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["캐시 결정 로그 (",t.decisions.length,"개)"]}),t.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:t.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))})]})]})},vk=()=>{const[r,e]=j.useState([]),[t,s]=j.useState([]),[i,o]=j.useState(""),d=["이전 값이 전송됨","모든 행이 같은 값","상태가 업데이트 안됨","API 호출이 안됨","초기값이 없음","무한 로딩","Form 값이 저장 안됨","iteration 데이터 중복"],g=p=>{e(y=>y.includes(p)?y.filter(x=>x!==p):[...y,p])},h=()=>{i&&!r.includes(i)&&(e(p=>[...p,i]),o(""))},f=async()=>{const{DiagnosticEngine:p}=await Promise.resolve().then(()=>lk),x=new p().analyze(r);s(x)};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,"개 증상)"]}),t.length>0&&l.jsxs("div",{className:"g7dt-space-y-3",children:[l.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"진단 결과"}),t.slice(0,5).map((p,y)=>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})]},y))]})]})},wk=({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((t,s)=>l.jsxs("div",{className:"g7dt-warning-card",children:[l.jsx("div",{className:"g7dt-font-bold",children:t.type}),l.jsx("div",{className:"g7dt-text-lightgray",children:t.message}),l.jsx("div",{className:"g7dt-text-xs g7dt-text-gray g7dt-mt-1",children:t.suggestion})]},s))})]}),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((t,s)=>s[1]-t[1]).slice(0,10).map(([t,s])=>l.jsxs("div",{className:"g7dt-list-item",children:[l.jsx("span",{className:"g7dt-text-lightgray g7dt-truncate",children:t}),l.jsxs("span",{className:s>50?"g7dt-text-red":"g7dt-text-gray",children:[s,"회"]})]},t))})]})]})},Sk=({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(t=>l.jsxs("div",{className:"g7dt-list-item g7dt-text-xs",children:[l.jsx("span",{className:"g7dt-text-lightgray",children:t.name}),l.jsx("span",{className:"g7dt-text-gray",children:t.id})]},t.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((t,s)=>l.jsxs("div",{className:"g7dt-warning-card g7dt-text-xs",children:[l.jsx("span",{className:"g7dt-text-lightgray",children:t.type}),l.jsxs("span",{className:"g7dt-text-gray g7dt-ml-2",children:["on ",t.target]})]},s))})]})]})},Ck=({devTools:r})=>{const e=r.getNetworkInfo(),t=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"}},s=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:[s(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 ${t(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:t(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})]})]})}),s(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))})]})]})},jk=({devTools:r})=>{const e=r.getFormInfo(),[t,s]=j.useState(!1),[i,o]=j.useState(null),d=j.useCallback(()=>{o(r.getFormBindingValidationTrackingInfo())},[r]);j.useEffect(()=>{if(t){d();const f=setInterval(d,2e3);return()=>clearInterval(f)}},[t,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,y)=>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})]},y))}),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:()=>s(!t),className:`g7dt-tab-button ${t?"g7dt-tab-active":""}`,children:"🔍 Auto-Binding Check"})}),t&&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))})]})]})},kk=({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(t=>l.jsx("div",{className:`g7dt-condition-item ${t.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:t.expression}),l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{className:t.evaluatedValue?"g7dt-badge-success":"g7dt-badge-error",children:t.evaluatedValue?"true":"false"}),l.jsxs("span",{className:"g7dt-text-gray",children:[t.evaluationCount,"회"]})]})]})},t.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(t=>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:t.source}),l.jsxs("span",{className:t.sourceLength>0?"g7dt-badge-blue":"g7dt-badge-warning",children:[t.sourceLength,"개 항목"]})]}),l.jsxs("div",{className:"g7dt-text-gray",children:[l.jsxs("span",{className:"g7dt-mr-2",children:["item_var: ",t.itemVar]}),t.indexVar&&l.jsxs("span",{children:["index_var: ",t.indexVar]})]})]},t.id))})]}),(e.ifConditions.some(t=>t.evaluatedValue===!1&&t.evaluationCount>5)||e.iterations.some(t=>t.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(t=>t.evaluatedValue===!1&&t.evaluationCount>5).map(t=>l.jsxs("div",{className:"g7dt-text-lightgray",children:["⚠️ if 조건 항상 false: ",t.expression]},t.id)),e.iterations.filter(t=>t.sourceLength===0).map(t=>l.jsxs("div",{className:"g7dt-text-lightgray",children:["⚠️ iteration 소스 비어있음: ",t.source]},t.id))]})]})]})},Nk=({devTools:r})=>{const[e,t]=j.useState([]),[s,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),y=j.useCallback(()=>{const A=r.getExpressionInfo();t(A.expressions),i(A.stats)},[r]);j.useEffect(()=>{y();const A=r.watchExpressions(()=>{y()}),O=setInterval(y,2e3);return()=>{A(),clearInterval(O)}},[r,y]);const x=e.filter(A=>{if(g&&!A.warning)return!1;if(o){const O=o.toLowerCase();return A.expression.toLowerCase().includes(O)||A.componentName?.toLowerCase().includes(O)||A.propName?.toLowerCase().includes(O)||A.resultType.toLowerCase().includes(O)}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}},S=(A,O)=>O==="undefined"?"undefined":O==="null"?"null":O==="string"?`"${String(A).substring(0,50)}${String(A).length>50?"...":""}"`:O==="array"?`Array(${Array.isArray(A)?A.length:"?"})`:O==="object"?"Object{...}":String(A),k=()=>{r.clearExpressions(),t([]),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:s.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:s.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:s.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:[(s.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:[s.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(s.byType).length>0&&l.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:Object.entries(s.byType).map(([A,O])=>l.jsxs("span",{className:`g7dt-type-tag ${w(A)}`,children:[A,": ",O]},A))}),l.jsx("div",{className:"g7dt-space-y-1 g7dt-expr-list",children:x.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:o||g?"조건에 맞는 표현식이 없습니다":"추적된 표현식이 없습니다"}):x.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:S(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,O)=>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})]},O))})]})]})]}),Object.keys(s.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(s.byWarning).map(([A,O])=>l.jsxs("span",{className:"g7dt-warning-tag",children:[v(A),": ",O]},A))})]})]})},Ek=({devTools:r})=>{const e=r.getHandlers(),[t,s]=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:t?f.name.toLowerCase().includes(t.toLowerCase())||f.description?.toLowerCase().includes(t.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:t,onChange:f=>s(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]})]})},_k=({devTools:r})=>{const[e,t]=j.useState(r.getComponentEventInfo()),[s,i]=j.useState(null),o=j.useCallback(()=>{t(r.getComponentEventInfo())},[r]);j.useEffect(()=>{o();const g=setInterval(o,2e3);return()=>clearInterval(g)},[o]);const d=s?e.emitHistory.filter(g=>g.eventName===s):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:s===null?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:"전체"}),e.subscriptions.map(g=>l.jsxs("button",{onClick:()=>i(g.eventName),className:s===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:["발행 이력 ",s&&`(${s})`]}),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:"새로고침"})]})},Ak=({devTools:r})=>{const e=r.getDataSources(),[t,s]=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 y=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"❓"}},x=e.filter(k=>t==="all"?!0:k.status===t),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"}},S=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:()=>s(k),className:t===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:x.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-col-span-2 g7dt-py-4",children:"데이터소스가 없습니다"}):x.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))}),S&&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:S.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:S.endpoint||"-"})]}),S.dataPath&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"데이터 경로:"}),l.jsx("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:S.dataPath})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-gray",children:"상태:"}),l.jsx("span",{className:`g7dt-ml-2 g7dt-mini-badge ${v(S.status)}`,children:S.status})]}),S.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:S.itemCount})]}),S.keys&&S.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:[S.keys.slice(0,10).map(k=>l.jsx("span",{className:"g7dt-key-tag",children:k},k)),S.keys.length>10&&l.jsxs("span",{className:"g7dt-text-gray",children:["+",S.keys.length-10,"개"]})]})]}),S.dependencies&&S.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:S.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((O,N)=>l.jsxs("span",{className:"g7dt-badge g7dt-text-xs",title:`${O.inputPath} → ${O.outputPath}`,children:[y(O.step)," ",O.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))})]})]})]})},Tk=({devTools:r})=>{const[e,t]=j.useState(r.getStateRenderingInfo()),[s,i]=j.useState(null),[o,d]=j.useState(!1),[g,h]=j.useState(""),f=j.useCallback(()=>{t(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()))),y=s?e.logs.find(v=>v.setStateId===s):null,x=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:x.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:x.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:[x.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 S=v.renderedComponents.length>0,k=S?"✅":"⚠️",A=new Date(v.timestamp).toLocaleTimeString();return l.jsxs("div",{onClick:()=>i(v.setStateId),className:`g7dt-render-log-item ${s===v.setStateId?"g7dt-selected":S?"":"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:[S?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)})}),y&&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:y.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:y.setStateId})]}),y.triggeredBy&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"트리거:"}),l.jsxs("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:[y.triggeredBy.handlerType,y.triggeredBy.actionId&&` (${y.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(y.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(y.newValue,null,2)?.slice(0,200)})]}),y.renderedComponents.length>0?l.jsxs("div",{children:[l.jsxs("span",{className:"g7dt-text-muted",children:["렌더링된 컴포넌트 (",y.renderedComponents.length,"개):"]}),l.jsxs("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:[y.renderedComponents.slice(0,10).map((v,S)=>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"]})]},S)),y.renderedComponents.length>10&&l.jsxs("div",{className:"g7dt-text-muted g7dt-text-center",children:["... 외 ",y.renderedComponents.length-10,"개"]})]}),l.jsxs("div",{className:"g7dt-mt-2 g7dt-text-muted",children:["총 렌더 시간: ",y.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:"동일한 값으로 상태 설정"})]})]})]})]})]}),x.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:x.topRenderedComponents.slice(0,5).map((v,S)=>l.jsxs("span",{className:"g7dt-tag",children:[v.name,": ",l.jsx("span",{className:"g7dt-text-blue",children:v.count})]},S))})]}),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:"로그 초기화"})]})]})},Dk=({devTools:r})=>{const[e,t]=j.useState(null),[s,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{t(r.getStyleValidationInfo())},[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.issues.filter(y=>o==="all"?!0:y.type===o),f=s?e.issues.find(y=>y.componentId===s):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:y=>d(y.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(y=>{const x=y.type==="invisible-element"?"👁️":y.type==="tailwind-purging"?"🎨":"🌙",w=y.severity==="error"?"g7dt-severity-error":y.severity==="warning"?"g7dt-severity-warning":"g7dt-severity-info";return l.jsxs("div",{onClick:()=>i(y.componentId),className:`g7dt-style-issue-item ${w} ${s===y.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:[x," ",y.componentName]}),l.jsx("span",{className:y.severity==="error"?"g7dt-badge-error":y.severity==="warning"?"g7dt-badge-warning":"g7dt-badge-info",children:y.type})]}),l.jsx("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:y.description})]},y.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((y,x)=>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:y.componentName}),l.jsxs("span",{className:"g7dt-text-muted",children:[y.classes.length," classes"]})]}),y.classes.length>0&&l.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:[y.classes.slice(0,5).join(" "),y.classes.length>5&&"..."]})]},x))})]})]})},Rk=({devTools:r})=>{const[e,t]=j.useState(null),[s,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{t(r.getAuthDebugInfo())},[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.events.filter(x=>o==="all"?!0:x.type===o),f=s?e.events.find(x=>x.id===s):null,p=e.stats,y=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:["소스: ",y.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 ${y.isAuthenticated?"g7dt-text-green":"g7dt-text-red"}`,children:y.isAuthenticated?"✓ 인증됨":"✕ 미인증"})}),l.jsx("div",{className:"g7dt-text-center",children:l.jsx("div",{className:`g7dt-text-lg g7dt-font-bold ${y.tokens.hasAccessToken?"g7dt-text-green":"g7dt-text-yellow"}`,children:y.tokens.hasAccessToken?"✓ 토큰 유효":"⚠ 토큰 없음"})}),l.jsx("div",{className:"g7dt-text-center",children:l.jsx("div",{className:"g7dt-text-lg g7dt-font-bold g7dt-text-blue",children:y.user?.name||y.user?.email||"익명"})})]}),y.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:y.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:y.user.email,children:y.user.email})]}),y.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:y.user.name})]}),y.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:y.user.nickname})]}),y.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:y.user.phone})]}),y.user.status&&l.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[l.jsx("span",{className:"g7dt-text-muted",children:"상태:"}),l.jsx("span",{className:y.user.status==="active"?"g7dt-text-green":"g7dt-text-yellow",children:y.user.status})]}),y.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:y.user.locale})]})]}),y.user.roles&&y.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:y.user.roles.map((x,w)=>l.jsx("span",{className:"g7dt-role-tag",title:x.guard_name?`guard: ${x.guard_name}`:void 0,children:typeof x=="string"?x:x.name},w))})]}),y.user.permissions&&y.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:[y.user.permissions.slice(0,10).map((x,w)=>l.jsx("span",{className:"g7dt-perm-tag",title:x.guard_name?`guard: ${x.guard_name}`:void 0,children:typeof x=="string"?x:x.name},w)),y.user.permissions.length>10&&l.jsxs("span",{className:"g7dt-text-muted g7dt-text-xs",children:["+",y.user.permissions.length-10,"개"]})]})]}),l.jsxs("div",{className:"g7dt-mt-2 g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[y.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(y.user.created_at).toLocaleDateString()})]}),y.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(y.user.last_login_at).toLocaleString()})]}),y.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:y.tokens.storage})]}),y.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:y.tokens.accessTokenPreview})]})]})}),y.tokens.accessTokenExpiresAt&&l.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-2 g7dt-text-center",children:["토큰 만료: ",new Date(y.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:x=>d(x.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(x=>{const w=x.success?"✅":"❌",v=new Date(x.timestamp).toLocaleTimeString();return l.jsxs("div",{onClick:()=>i(x.id),className:`g7dt-auth-event-item ${s===x.id?"g7dt-selected":x.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," ",x.type]}),l.jsx("span",{className:"g7dt-text-muted",children:v})]}),x.error&&l.jsx("div",{className:"g7dt-text-red g7dt-mt-1 g7dt-truncate",children:x.error})]},x.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((x,w)=>l.jsxs("div",{className:"g7dt-header-item",children:[l.jsx("span",{className:"g7dt-text-blue g7dt-truncate g7dt-flex-1",children:x.url}),l.jsx("span",{className:`g7dt-ml-2 ${x.hasAuthHeader?"g7dt-text-green":"g7dt-text-yellow"}`,children:x.hasAuthHeader?`✓ ${x.headerType}`:"✕ 헤더 없음"}),x.responseStatus&&l.jsx("span",{className:`g7dt-ml-2 ${x.responseStatus<400?"g7dt-text-muted":"g7dt-text-red"}`,children:x.responseStatus})]},w))})]})]})},Ok=({devTools:r})=>{const[e,t]=j.useState([]),[s,i]=j.useState(null),[o,d]=j.useState(null),[g,h]=j.useState("all"),[f,p]=j.useState(""),[y,x]=j.useState(""),w=j.useCallback(()=>{const N=r.getLogInfo();t(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())||y&&!N.message.toLowerCase().includes(y.toLowerCase()))),S=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"}},O=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:[s&&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:s.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:s.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:s.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:s.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 ${s.recentErrors>0?"g7dt-text-red":"g7dt-text-green"}`,children:s.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 ${s.recentWarnings>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:s.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:y,onChange:N=>x(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":O(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)})}),S&&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(S.level),children:S.level.toUpperCase()})," ",l.jsxs("span",{className:"g7dt-text-purple",children:["[",S.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(S.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:S.message})]}),S.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(S.args,null,2)})]}),S.stack&&l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"스택 트레이스:"}),l.jsx("pre",{className:"g7dt-pre-stack g7dt-text-red",children:S.stack})]})]})]}),s&&Object.keys(s.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(s.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))})]})]})},Lk=({devTools:r})=>{const[e,t]=j.useState(r.getLayoutDebugInfo()),[s,i]=j.useState(!1),[o,d]=j.useState(null),[g,h]=j.useState(!1),[f,p]=j.useState({});j.useEffect(()=>{const A=setInterval(()=>{t(r.getLayoutDebugInfo())},1e3);return()=>clearInterval(A)},[r]),j.useEffect(()=>{(async()=>{try{const O=await fetch("/api/admin/permissions",{headers:{Authorization:`Bearer ${localStorage.getItem("auth_token")}`,Accept:"application/json"}});if(O.ok){const N=await O.json(),D={},$=M=>{M.forEach(z=>{D[z.identifier]=z.name,z.children?.length&&$(z.children)})};Object.values(N.data?.permissions||{}).forEach(M=>{M.permissions&&$(M.permissions)}),p(D)}}catch(O){console.warn("[G7DevTools] 권한 목록 조회 실패:",O)}})()},[]);const y=e.current,x=y?.layoutJson,w=e.history,v=e.stats,S=x?[{key:"components",label:"컴포넌트",count:Array.isArray(x.components)?x.components.length:0},{key:"data_sources",label:"데이터소스",count:Array.isArray(x.data_sources)?x.data_sources.length:0},{key:"computed",label:"Computed",count:x.computed?Object.keys(x.computed).length:0},{key:"defines",label:"Defines",count:x.defines?Object.keys(x.defines).length:0},{key:"slots",label:"Slots",count:x.slots?Object.keys(x.slots).length:0},{key:"modals",label:"Modals",count:x.modals?Object.keys(x.modals).length:0},{key:"init_actions",label:"초기화 액션",count:Array.isArray(x.init_actions)?x.init_actions.length:0},{key:"scripts",label:"스크립트",count:Array.isArray(x.scripts)?x.scripts.length:0},{key:"meta",label:"메타데이터",count:x.meta?Object.keys(x.meta).length:0},{key:"errorHandling",label:"에러핸들링",count:x.errorHandling?Object.keys(x.errorHandling).length:0},{key:"permissions",label:"권한",count:Array.isArray(x.permissions)?x.permissions.length:0}]:[],k=A=>{navigator.clipboard.writeText(JSON.stringify(A,null,2))};return y?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(x),className:"g7dt-btn-small",title:"전체 JSON 복사",children:"📋 복사"}),l.jsx("button",{onClick:()=>i(!s),className:"g7dt-btn-small",children:s?"요약 보기":"전체 보기"})]})]}),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:y.layoutPath})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"템플릿:"}),l.jsx("span",{className:"g7dt-ml-1 g7dt-text-blue",children:y.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:y.version||"-"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"g7dt-text-muted",children:"소스:"}),l.jsx("span",{className:`g7dt-ml-1 ${y.source==="cache"?"g7dt-text-green":"g7dt-text-yellow"}`,children:y.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:y.loadedAt?new Date(y.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:"권한:"}),x.permissions&&x.permissions.length>0?l.jsxs("span",{className:"g7dt-ml-1 g7dt-text-yellow",children:["🔒 ",x.permissions.map(A=>f[A]||A).join(", ")]}):x.permissions&&x.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:"미정의 (부모 상속)"})]})})]})]}),!s&&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:S.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))})]}),(s||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:s?"📄 전체 레이아웃 JSON":`📎 ${o} 섹션`}),l.jsx("button",{onClick:()=>{s?k(x):o&&x&&k(x[o])},className:"g7dt-btn-small",children:"복사"})]}),o==="permissions"&&!s?l.jsx("div",{className:"g7dt-text-xs",children:x.permissions&&x.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:x.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))})]}):x.permissions&&x.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(s?x:o&&x?x[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",{}),"페이지를 새로고침하거나 라우트를 변경해보세요."]})})},Mk=({devTools:r})=>{const[e,t]=j.useState(r.getChangeDetectionInfo()),[s,i]=j.useState(null),[o,d]=j.useState(!1),[g,h]=j.useState(new Set);j.useEffect(()=>{const N=setInterval(()=>{t(r.getChangeDetectionInfo())},500);return()=>clearInterval(N)},[r]);const{executionDetails:f,alerts:p,stats:y}=e,x=o?f.filter(N=>N.alerts.length>0||N.stateChanges.length===0):f,w=s?f.find(N=>N.executionId===s):null,v=N=>{h(D=>{const $=new Set(D);return $.has(N)?$.delete(N):$.add(N),$})},S=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"}},O=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:y.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:y.executionsWithStateChange})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"상태 변경 없음:"}),l.jsx("span",{className:y.executionsWithoutStateChange>0?"g7dt-text-yellow":"g7dt-text-gray",children:y.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:y.earlyReturnCount})]}),l.jsxs("div",{className:"g7dt-stat-item",children:[l.jsx("span",{className:"g7dt-text-muted",children:"알림:"}),l.jsx("span",{className:y.alertCount>0?"g7dt-text-red":"g7dt-text-gray",children:y.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:O(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:"경고만 표시"})]})]}),x.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:x.slice(-20).reverse().map(N=>l.jsxs("div",{className:`g7dt-list-item ${s===N.executionId?"g7dt-selected":""}`,onClick:()=>i(s===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:S(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:O(N.startTime)})]})]}),s===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,$)=>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,")"]})]},$))})]}),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 확인 → 조건문 검토 → 불변성 확인"})]})]})]})},$k=({devTools:r})=>{const[e,t]=j.useState(null),[s,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{t(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),y=s?h.find(v=>v.id===s):null,x=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,S])=>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:S})]},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 ${s===v.id?"g7dt-selected":""}`,onClick:()=>i(s===v.id?null:v.id),children:[l.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[l.jsx("span",{children:x(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))})]}),y&&l.jsxs("div",{className:"g7dt-card g7dt-border-yellow",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[x(y.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:y.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(y.type)," ",y.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:y.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(y.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(y.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:[y.timeDiff,"ms"]})]}),y.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:y.suggestion})]})]})]})]})},Ik=({devTools:r})=>{const[e,t]=j.useState(null),[s,i]=j.useState(null),[o,d]=j.useState("all"),g=j.useCallback(()=>{t(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),y=s?h.find(v=>v.id===s):null,x=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,S])=>l.jsxs("div",{className:`g7dt-badge g7dt-cursor-pointer ${o===v?"g7dt-badge-selected":""}`,onClick:()=>d(o===v?"all":v),children:[x(v)," ",v,": ",S]},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 S=v.accessAttempts?.some(A=>!A.found),k=v.mergedContext?.all||[];return l.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${s===v.id?"g7dt-selected":""} ${S?"g7dt-border-red":""}`,onClick:()=>i(s===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:x(v.componentType)}),l.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:v.componentId||v.componentType}),S&&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)})})]}),y&&l.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[l.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[x(y.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:y.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:y.depth})]})]}),y.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:y.componentId})]}),y.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:y.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:(y.mergedContext?.all||[]).map(v=>l.jsx("span",{className:"g7dt-badge g7dt-badge-blue g7dt-text-xs",children:v},v))})]}),y.ownContext?.added&&y.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:y.ownContext.added.map(v=>l.jsxs("span",{className:"g7dt-badge g7dt-badge-green g7dt-text-xs",children:["+ ",v]},v))})]}),y.accessAttempts&&y.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:y.accessAttempts.slice(0,10).map((v,S)=>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?"✓":"✕"})]},S))})]})]})]})]})},zk=({devTools:r})=>{const[e,t]=j.useState(null),[s,i]=j.useState(null),[o,d]=j.useState(null),[g,h]=j.useState("modals"),f=j.useCallback(()=>{t(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:y,relations:x,changeLogs:w,stats:v}=e,S=s?p.find(D=>D.modalId===s):null,k=o?y.find(D=>D.id===o):null,A=D=>{switch(D){case"isolated":return"🔒";case"shared":return"🔓";case"inherited":return"📥";default:return"❓"}},O=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,$])=>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:$})]},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,$])=>$>0).map(([D,$])=>l.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[l.jsxs("span",{children:[O(D)," ",D]}),l.jsx("span",{className:"g7dt-font-mono g7dt-text-red",children:$})]},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:["⚠️ 이슈 (",y.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 $=y.some(M=>M.modalId===D.modalId);return l.jsx("div",{className:`g7dt-list-item g7dt-cursor-pointer ${s===D.modalId?"g7dt-selected":""} ${$?"g7dt-border-red":""}`,onClick:()=>i(s===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}),$&&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:"이슈 목록"}),y.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:y.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:O(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))})]}),S&&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(S.scopeType)," 모달 상세: ",S.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(S.scopeType)," ",S.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:S.closedAt===null?"📭 열림":"📪 닫힘"})]})]}),S.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:S.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:S.stateChangeCount})]}),S.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:S.isolatedStateKeys.map(D=>l.jsxs("span",{className:"g7dt-badge g7dt-badge-red g7dt-text-xs",children:["🔒 ",D]},D))})]}),S.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:S.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:[O(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)})]})]})]}),x.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:x.map((D,$)=>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})]},$))})]})]})},Hk=({devTools:r})=>{const[e,t]=j.useState("definitions"),[s,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]),!s)return l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"데이터 로딩 중..."});const{definitions:h,refLogs:f,stats:p}=s,y=Object.keys(h),x=y.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:()=>t("definitions"),className:e==="definitions"?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:["정의 목록 (",y.length,")"]}),l.jsxs("button",{onClick:()=>t("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:x.length===0?l.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:y.length===0?"정의된 named_actions가 없습니다":"검색 결과 없음"}):x.map(v=>{const S=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:["→ ",S.handler]})]}),l.jsxs("span",{className:"g7dt-badge",title:"참조 횟수",children:[k,"회"]})]}),S.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(S.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))})]})},Pk=()=>{j.useEffect(()=>{gk()},[]);const r=j.useRef(cx()),[e,t]=j.useState(r.current.isOpen??!1),[s,i]=j.useState(!1),[o,d]=j.useState("state"),[g,h]=j.useState({_global:{},_local:{},_computed:{}}),[f,p]=j.useState([]),[y,x]=j.useState({hits:0,misses:0,entries:0,hitRate:0}),[w,v]=j.useState(!1),[S,k]=j.useState(r.current.position??{x:-1,y:-1}),[A,O]=j.useState(!1),N=j.useRef(null),D=j.useRef(null),[$,M]=j.useState(r.current.size??{width:hk,height:fk}),[z,K]=j.useState(!1),[ye,we]=j.useState(null),J=j.useRef(null),[ve,le]=j.useState(!1),de=j.useRef(null),je=Ns.getInstance(),W=ax();j.useEffect(()=>{if(S.x===-1&&S.y===-1){const q=window.innerWidth-$.width-16;k({x:q,y:16})}},[S,$.width]),j.useEffect(()=>{if(S.x===-1&&S.y===-1||A||z)return;const q=setTimeout(()=>{dx({position:S,size:$})},300);return()=>clearTimeout(q)},[S,$,A,z]),j.useEffect(()=>{dx({isOpen:e})},[e]);const he=j.useCallback(q=>{q.target.tagName!=="BUTTON"&&(O(!0),N.current={x:q.clientX,y:q.clientY,posX:S.x,posY:S.y},q.preventDefault())},[S]);j.useEffect(()=>{if(!A)return;const q=xe=>{if(!N.current)return;const oe=xe.clientX-N.current.x,ke=xe.clientY-N.current.y;let Oe=N.current.posX+oe,De=N.current.posY+ke;const qe=window.innerWidth-$.width,Ie=window.innerHeight-$.height;Oe=Math.max(0,Math.min(Oe,qe)),De=Math.max(0,Math.min(De,Ie)),k({x:Oe,y:De})},re=()=>{O(!1),N.current=null};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",re)}},[A,$.width,$.height]);const ee=j.useCallback(q=>re=>{re.preventDefault(),re.stopPropagation(),K(!0),we(q),J.current={x:re.clientX,y:re.clientY,width:$.width,height:$.height,posX:S.x,posY:S.y}},[$,S]);j.useEffect(()=>{if(!z||!ye)return;const q=xe=>{if(!J.current)return;const oe=xe.clientX-J.current.x,ke=xe.clientY-J.current.y;let Oe=J.current.width,De=J.current.height,qe=J.current.posX,Ie=J.current.posY;if(ye.includes("e")&&(Oe=Math.max(ix,J.current.width+oe)),ye.includes("w")){const Nt=Math.min(oe,J.current.width-ix);Oe=J.current.width-Nt,qe=J.current.posX+Nt}if(ye.includes("s")&&(De=Math.max(ox,J.current.height+ke)),ye.includes("n")){const Nt=Math.min(ke,J.current.height-ox);De=J.current.height-Nt,Ie=J.current.posY+Nt}Oe=Math.min(Oe,window.innerWidth-qe),De=Math.min(De,window.innerHeight-Ie),qe=Math.max(0,qe),Ie=Math.max(0,Ie),M({width:Oe,height:De}),k({x:qe,y:Ie})},re=()=>{K(!1),we(null),J.current=null};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",re)}},[z,ye]);const X=j.useCallback(()=>{ve?(de.current&&(k(de.current.position),M(de.current.size)),le(!1)):(de.current={position:S,size:$},k({x:0,y:0}),M({width:window.innerWidth,height:window.innerHeight}),le(!0))},[ve,S,$]),se=j.useCallback(()=>{je.isEnabled()&&(h(je.getState()),p(je.getActionHistory()),x(je.getCacheStats()),v(W.isConnected()))},[je,W]);j.useEffect(()=>{const q=re=>{re.ctrlKey&&re.shiftKey&&re.key==="G"&&(re.preventDefault(),t(xe=>!xe))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[]),j.useEffect(()=>{if(!e||!je.isEnabled())return;se();const q=je.watchState("*",()=>{h(je.getState())}),re=je.watchActions(()=>{p(je.getActionHistory()),x(je.getCacheStats())}),xe=setInterval(se,5e3);return()=>{q(),re(),clearInterval(xe)}},[e,je,se]);const R=async()=>{try{const q=await W.dumpState();console.log("[G7DevTools] 상태 덤프 완료:",q),v(!0)}catch(q){console.error("[G7DevTools] 상태 덤프 실패:",q),v(!1)}};return je.isEnabled()?e?s?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:()=>t(!1),className:"g7dt-btn g7dt-text-xs",children:"✕"})]})}):l.jsxs("div",{ref:D,className:`g7dt-panel ${ve?"maximized":""} ${z?"g7dt-resizing":""}`,style:{left:`${S.x>=0?S.x:0}px`,top:`${S.y>=0?S.y:0}px`,width:`${$.width}px`,height:`${$.height}px`},children:[!ve&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-nw",onMouseDown:ee("nw")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-ne",onMouseDown:ee("ne")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-sw",onMouseDown:ee("sw")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-se",onMouseDown:ee("se")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-h g7dt-resize-n",onMouseDown:ee("n")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-h g7dt-resize-s",onMouseDown:ee("s")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-v g7dt-resize-w",onMouseDown:ee("w")}),l.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-v g7dt-resize-e",onMouseDown:ee("e")})]}),l.jsxs("div",{className:`g7dt-header ${A?"dragging":""}`,onMouseDown:he,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:R,className:"g7dt-btn g7dt-btn-primary",title:"서버로 상태 덤프",children:"덤프"}),l.jsx("button",{onClick:se,className:"g7dt-btn",title:"새로고침",children:"↻"}),l.jsx("button",{onClick:X,className:"g7dt-btn",title:ve?"복원":"최대화",children:ve?"❐":"□"}),l.jsx("button",{onClick:()=>i(!0),className:"g7dt-btn",title:"최소화",children:"▼"}),l.jsx("button",{onClick:()=>t(!1),className:"g7dt-btn",children:"✕"})]})]}),l.jsx("div",{className:"g7dt-tabs",children:Object.keys(rx).map(q=>l.jsx("button",{onClick:()=>d(q),className:`g7dt-tab ${o===q?"active":""}`,children:rx[q]},q))}),l.jsxs("div",{className:"g7dt-content",children:[o==="state"&&l.jsx(yk,{state:g,devTools:je}),o==="actions"&&l.jsx(xk,{actions:f,devTools:je}),o==="cache"&&l.jsx(bk,{stats:y,devTools:je}),o==="diagnose"&&l.jsx(vk,{}),o==="performance"&&l.jsx(wk,{devTools:je}),o==="lifecycle"&&l.jsx(Sk,{devTools:je}),o==="network"&&l.jsx(Ck,{devTools:je}),o==="form"&&l.jsx(jk,{devTools:je}),o==="conditional"&&l.jsx(kk,{devTools:je}),o==="expression"&&l.jsx(Nk,{devTools:je}),o==="handlers"&&l.jsx(Ek,{devTools:je}),o==="events"&&l.jsx(_k,{devTools:je}),o==="datasources"&&l.jsx(Ak,{devTools:je}),o==="renders"&&l.jsx(Tk,{devTools:je}),o==="styles"&&l.jsx(Dk,{devTools:je}),o==="auth"&&l.jsx(Rk,{devTools:je}),o==="logs"&&l.jsx(Ok,{devTools:je}),o==="layout"&&l.jsx(Lk,{devTools:je}),o==="changedetection"&&l.jsx(Mk,{devTools:je}),o==="staleclosure"&&l.jsx($k,{devTools:je}),o==="nestedcontext"&&l.jsx(Ik,{devTools:je}),o==="modalscope"&&l.jsx(zk,{devTools:je}),o==="namedactions"&&l.jsx(Hk,{devTools:je})]}),l.jsxs("div",{className:"g7dt-footer",children:[l.jsx("span",{children:"Ctrl+Shift+G 토글 | 헤더 드래그로 이동"}),l.jsxs("span",{children:["액션: ",f.length," | 캐시 히트율: ",(y.hitRate*100).toFixed(1),"%"]})]})]}):l.jsx("button",{onClick:()=>t(!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:()=>t(!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},Uk=["display","visibility","opacity","position","zIndex","overflow","width","height","backgroundColor","color"],Ar=class Ar{constructor(){H(this,"enabled",!1);H(this,"trackedComponents",new Map);H(this,"mutationObserver",null);H(this,"scanInterval",null);H(this,"devTools");this.devTools=Ns.getInstance()}static getInstance(){return Ar.instance||(Ar.instance=new Ar),Ar.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,t,s){if(!this.enabled||!this.devTools.isEnabled()||!s)return;const i=this.extractClasses(s),o=this.getComputedStyles(s);this.devTools.trackComponentStyle(e,t,i,o),this.trackedComponents.set(e,{componentId:e,componentName:t,classes:i,computedStyles:o,element:new WeakRef(s),timestamp:Date.now()}),this.detectIssues(e,t,s,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,t,s,i,o){o.display==="none"&&this.addIssue({type:"invisible-element",componentId:e,componentName:t,property:"display",currentValue:"none",severity:"info",description:"요소가 display:none으로 숨겨져 있습니다",suggestion:"의도적인 숨김이 아니라면 조건부 렌더링(if)을 확인하세요"}),o.visibility==="hidden"&&this.addIssue({type:"invisible-element",componentId:e,componentName:t,property:"visibility",currentValue:"hidden",severity:"info",description:"요소가 visibility:hidden으로 숨겨져 있습니다",suggestion:"공간은 유지되지만 보이지 않습니다. 의도적인지 확인하세요"}),o.opacity==="0"&&this.addIssue({type:"invisible-element",componentId:e,componentName:t,property:"opacity",currentValue:"0",severity:"warning",description:"요소가 opacity:0으로 투명합니다",suggestion:"애니메이션 상태가 아니라면 스타일을 확인하세요"}),(o.width==="0px"||o.height==="0px")&&this.addIssue({type:"invisible-element",componentId:e,componentName:t,property:o.width==="0px"?"width":"height",currentValue:"0px",severity:"warning",description:"요소의 크기가 0입니다",suggestion:"컨텐츠가 있는데 크기가 0이라면 레이아웃 문제일 수 있습니다"}),o.overflow==="hidden"&&(s.scrollWidth>s.clientWidth||s.scrollHeight>s.clientHeight)&&this.addIssue({type:"overflow-hidden",componentId:e,componentName:t,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:t,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:t,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"),y=i.includes("portable:block")||i.includes("portable:flex"),x=i.includes("desktop:block")||i.includes("desktop:flex");p&&!f&&!y&&!x&&this.addIssue({type:"responsive-issue",componentId:e,componentName:t,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 t=window.getComputedStyle(e),s={};for(const i of Uk)s[i]=t.getPropertyValue(i.replace(/([A-Z])/g,"-$1").toLowerCase());return s}setupMutationObserver(){typeof MutationObserver>"u"||(this.mutationObserver=new MutationObserver(e=>{let t=!1;for(const s of e){if(s.type==="childList"&&s.addedNodes.length>0){t=!0;break}if(s.type==="attributes"&&(s.attributeName==="class"||s.attributeName==="style")){t=!0;break}}t&&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(t=>t.componentId===e)}clear(){this.trackedComponents.clear(),this.devTools.clearStyleValidationData()}};H(Ar,"instance",null);let Vg=Ar;function Bk(){return Vg.getInstance()}function qk(r={}){const{checked:e,value:t,name:s,type:i="checkbox"}=r,o={checked:e??!1,value:t??String(e??""),name:s??"",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 Gk(r={}){const{button:e=0,clientX:t=0,clientY:s=0}=r;return{button:e,clientX:t,clientY:s,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 Fk(){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 Vk(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 Kk={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 ux(r){const e=r.replace(/^(dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+/,"");for(const[t,s]of Object.entries(Kk))if(s.test(e))return t;return null}function gx(r){const e=r.match(/^((dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+)/);return e?e[1]:""}function Wk(r,e){if(!e||e.trim()==="")return r;if(!r||r.trim()==="")return e;const t=r.split(/\s+/).filter(Boolean),s=e.split(/\s+/).filter(Boolean),i=new Map;for(const d of s){const g=ux(d);if(g){const h=gx(d),f=`${g}:${h}`;i.set(f,d)}}return[...t.filter(d=>{const g=ux(d);if(!g)return!0;const h=gx(d),f=`${g}:${h}`;return!i.has(f)}),...s].join(" ")}function Yk(r){return Object.entries(r).filter(([,e])=>e).map(([e])=>e).join(" ")}function Jk(...r){return r.filter(e=>typeof e=="string"&&e.length>0).join(" ")}const Ee=nt("G7CoreGlobals");function Xk(){window.React=Ke,window.ReactDOM={...Uu,createPortal:Ma.createPortal,unstable_batchedUpdates:r=>r()},window.ReactJSXRuntime=p7,Ee.log("전역 객체 window.React, window.ReactDOM, window.ReactJSXRuntime에 노출됨")}function Qk(r){const e=new Map,t=Ns.getInstance();r.componentEvent={on:(s,i)=>(e.has(s)||e.set(s,new Set),e.get(s).add(i),t.trackEventSubscribe(s),()=>{e.get(s)?.delete(i),t.trackEventUnsubscribe(s)}),emit:async(s,i)=>{const o=e.get(s),d=o?.size??0;if(!o||o.size===0)return t.trackEventEmit(s,i,0),[];let g,h=[];try{h=await Promise.all(Array.from(o).map(async f=>{try{return await f(i)}catch(p){throw Ee.error(`componentEvent: Error in listener for "${s}":`,p),p}}))}catch(f){g=f instanceof Error?f:new Error(String(f))}if(t.trackEventEmit(s,i,d,h,g),g)throw g;return h},off:s=>{e.delete(s),t.trackEventOff(s)},clear:()=>{e.clear(),t.trackEventClear()}},Ee.log("전역 객체 window.G7Core.componentEvent에 노출됨")}function Zk(r,e){r.useTranslation=$j,r.t=(t,s)=>{const i=e.getState();if(!i.translationEngine||!i.translationContext)return t;if(s){const o="|"+Object.entries(s).map(([d,g])=>`${d}=${g}`).join("|");return i.translationEngine.translate(t,i.translationContext,o)}return i.translationEngine.translate(t,i.translationContext)},Ee.log("전역 객체 window.G7Core.useTranslation에 노출됨")}function eN(r,e){r.createChangeEvent=qk,r.createClickEvent=Gk,r.createSubmitEvent=Fk,r.createKeyboardEvent=Vk,r.uuid=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const s=Math.random()*16|0;return(t==="x"?s:s&3|8).toString(16)}),r.createLogger=nt,Ee.log("전역 객체 window.G7Core.createLogger에 노출됨"),r.renderItemChildren=(t,s,i,o,d)=>{const g=e.getState(),p={_global:window.__templateApp?.getGlobalState?.()||{},_local:s._local||{},_computed:s._computed||{},...s},y=new Set,x=(v,S)=>{const k=p._global?._remountKeys;return v&&k?.[v]&&!y.has(v)?(y.add(v),`${v}-remount-${k[v]}`):v||S},w={translationContext:g.translationContext,translationEngine:g.translationEngine,bindingEngine:g.bindingEngine,actionDispatcher:g.actionDispatcher,getRemountKey:x,...d};return po(t,p,i,o,w)},r.getComponentMap=()=>vs.getInstance().getComponentMap(),r.renderComponentLayout=(t,s,i)=>{if(!t||!Array.isArray(t)||t.length===0)return null;const o=vs.getInstance().getComponentMap(),d=e.getState(),h=window.__templateApp?.getGlobalState?.()||{},f={_global:h._global||{},_local:h._local||{},_computed:h._computed||{},...s},p=new Set,y=(x,w)=>{const v=f._global?._remountKeys;return x&&v?.[x]&&!p.has(x)?(p.add(x),`${x}-remount-${v[x]}`):x||w};return po(t,f,o,i,{translationContext:d.translationContext,translationEngine:d.translationEngine,bindingEngine:d.bindingEngine,actionDispatcher:d.actionDispatcher,getRemountKey:y})},r.renderExpandContent=t=>{const{children:s,row:i,expandContext:o,componentContext:d,keyPrefix:g}=t;if(!s||!Array.isArray(s)||s.length===0)return null;const h=t.componentMap||vs.getInstance().getComponentMap(),f=e.getState(),p=r.state?.get?.()||{},y=d?.stateRef?.current??d?.state??{},x={...p._local||{},...y},w=d?.computedRef?.current??p._computed??{},v=f.bindingEngine??r.getDataBindingEngine?.(),S={...p,_local:x,_computed:w,row:i,item:i,$item:i};let k={};if(o&&typeof o=="object"&&v)try{for(const[D,$]of Object.entries(o))if(typeof $=="string"){const M=$.match(/^\{\{([^}]+)\}\}$/);if(M){const z=M[1].trim();try{k[D]=v.evaluateExpression(z,S,{skipCache:!0})}catch{k[D]=void 0}}else k[D]=v.resolveBindings($,S,{skipCache:!0})}else k[D]=$}catch(D){Ee.warn("renderExpandContent: expandContext 평가 오류:",D)}const A={row:i,item:i,$item:i,_local:x,_global:p._global||{},_computed:p._computed||{},...k},O=new Set,N=(D,$)=>{const M=A._global?._remountKeys;return D&&M?.[D]&&!O.has(D)?(O.add(D),`${D}-remount-${M[D]}`):D||$};return po(s,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(s,i,o=void 0){if(s==null)return o;const d=Array.isArray(i)?i:[i];if(d.length===0)return s;let g=s;for(const h of d){if(g==null||h==null)return o;g=g[h]}return g??o},Ee.log("전역 객체 window.G7Core.renderItemChildren에 노출됨"),Ee.log("전역 객체 window.G7Core.renderComponentLayout에 노출됨"),Ee.log("전역 객체 window.G7Core.renderExpandContent에 노출됨"),Ee.log("전역 객체 window.G7Core.$get에 노출됨")}function tN(r){r.dispatch=async(e,t)=>{const s=window.__templateApp;if(!s)return Ee.warn("G7Core.dispatch: TemplateApp이 초기화되지 않았습니다."),{success:!1,error:new Error("TemplateApp이 초기화되지 않았습니다.")};const i=s.getActionDispatcher?.();if(!i)return Ee.warn("G7Core.dispatch: ActionDispatcher를 찾을 수 없습니다."),{success:!1,error:new Error("ActionDispatcher를 찾을 수 없습니다.")};const o=s.getRouter?.(),d=s.getGlobalState?.(),g=s.setGlobalState?.bind(s),f=t?.componentContext||window.__g7ActionContext,p=window.__g7PendingLocalState;let y=f?.state??d;p&&f&&(y=p,Ee.log("[dispatch] Using __g7PendingLocalState for context.state:",p));let x=f?.data??d;p&&f?.data?._local&&(x={...f.data,_local:p},Ee.log("[dispatch] Updated context.data._local with pendingLocalState"));const w={navigate:o?(v,S)=>o.navigate(v,S):void 0,setState:f?.setState??g,state:y,data:x,_isDispatchFallbackContext:!f?.setState};if(e.debounce){const v=e.debounceKey||`dispatch-${e.handler}`,S=typeof e.debounce=="number"?e.debounce:e.debounce.delay;return i.debouncedCall(v,S,()=>{const{debounce:k,debounceKey:A,...O}=e;i.dispatchAction(O,w)}),{success:!0,debounced:!0}}try{return await i.dispatchAction(e,w)}catch(v){return Ee.error("G7Core.dispatch: 액션 실행 오류:",v),{success:!1,error:v instanceof Error?v:new Error(String(v))}}},Ee.log("전역 객체 window.G7Core.dispatch에 노출됨")}function Mo(r){const e={};for(const[t,s]of Object.entries(r))if(t.includes(".")){const i=t.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]]=s}else e[t]=s;return e}function hx(r,e=""){const t=[];if(!r||typeof r!="object")return t;for(const s of Object.keys(r)){const i=e?`${e}.${s}`:s,o=r[s];o&&typeof o=="object"&&!Array.isArray(o)?t.push(...hx(o,i)):t.push(i)}return t}function nN(r){const e=Object.keys(r);return e.length>0&&e.every(t=>/^\d+$/.test(t))}function fx(r,e){const t={...r};for(const s of Object.keys(e))s in t?t[s]!==null&&typeof t[s]=="object"&&!Array.isArray(t[s])&&e[s]!==null&&typeof e[s]=="object"&&!Array.isArray(e[s])&&(t[s]=fx(t[s],e[s])):t[s]=e[s];return t}function os(r,e){if(Array.isArray(r)&&!Array.isArray(e)&&nN(e)){const s=Object.keys(e).map(o=>parseInt(o,10));if(!((s.length>0?Math.max(...s):0)>=r.length+s.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]=os(o[h],g):o[h]=g:h>=o.length&&(o[h]=g)}return o}}const t={...r};for(const[s,i]of Object.entries(e))i!==null&&typeof i=="object"&&!Array.isArray(i)?t[s]!==null&&typeof t[s]=="object"?t[s]=os(t[s],i):t[s]={...i}:t[s]=i;return t}function sN(r){r.state={get:()=>window.__templateApp?.getGlobalState?.()||{},set:(e,t)=>{const s=window.__templateApp;if(s?.setGlobalState&&s?.getGlobalState){const i=t?.merge||"deep",o=Mo(e);let d;if(i==="replace")d=o;else if(i==="shallow")d={...s.getGlobalState(),...o};else{const g=s.getGlobalState();d=os(g,o)}s.setGlobalState(d,{render:t?.render})}else Ee.warn("G7Core.state.set: TemplateApp이 초기화되지 않았습니다.")},setLocal:(e,t)=>{const s=window.__templateApp;if(t?.render===!1&&!t?.selfManaged){const k=window.__g7AutoBindingPaths;k&&k.size>0&&hx(Mo(e)).some(O=>k.has(O))&&(Ee.log("[setLocal] render:false + 자동바인딩 경로 겹침 감지 → render:true 자동 승격 (engine-v1.43.0)"),t={...t,render:!0})}if(t?.debounce){const k=s?.getActionDispatcher?.();if(k){const A=t.debounceKey||`setLocal-${Object.keys(e).join(",")}`,{debounce:O,debounceKey:N,...D}=t;k.debouncedCall(A,t.debounce,()=>{r.state.setLocal(e,D)});return}}const i=t?.scope??"current",o=t?.merge||"deep",d=window.__g7ActionContext,g=Mo(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(O=>o==="replace"?g:o==="shallow"?{...O||{},...g}:os(O||{},g)),Ee.log(`[setLocal] scope=${i}: 타겟 컨텍스트에 상태 업데이트 (mergeMode=${o})`,g);return}}Ee.warn(`[setLocal] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const h=window.__g7PendingLocalState,f=s?.getGlobalState?.()?._local||{},x=!((window.__g7LayoutContextStack||[]).length>0)&&d?.state?d.state:void 0,w=x?fx(f,x):f,v=h||w;let S;if(o==="replace"?S=g:o==="shallow"?S={...v,...g}:S=os(v,g),s?.setGlobalState&&(s.setGlobalState({_local:S},{render:t?.render}),Ee.log(`[setLocal] globalLocal updated via setGlobalState (mergeMode=${o}, render=${t?.render??!0}):`,g)),window.__g7PendingLocalState=S,Ee.log("[setLocal] __g7PendingLocalState updated:",S),window.__g7SequenceLocalSync=S,window.__g7LastSetLocalSnapshot=S,o==="replace")window.__g7ForcedLocalFields=g;else{const k=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=os(k,g)}if(Ee.log("[setLocal] __g7ForcedLocalFields updated:",g),o==="replace")window.__g7SetLocalOverrideKeys=g;else{const k=window.__g7SetLocalOverrideKeys||{};window.__g7SetLocalOverrideKeys=os(k,g)}Ee.log("[setLocal] __g7SetLocalOverrideKeys updated:",g),d?.setState&&d.setState(k=>o==="replace"?g:o==="shallow"?{...k||{},...g}:os(k||{},g)),s?.setGlobalState||Ee.warn("G7Core.state.setLocal: TemplateApp이 없습니다.")},getLocal:()=>{const s=(window.__templateApp?.getGlobalState?.()||{})._local||{},i=window.__g7PendingLocalState;if(i)return os(s,i);const o=window.__g7LastSetLocalSnapshot;return o&&o!==s?os(s,o):s},update:e=>{const t=window.__templateApp;if(t?.getGlobalState&&t?.setGlobalState){const s=t.getGlobalState(),i=e(s);t.setGlobalState(i)}else Ee.warn("G7Core.state.update: TemplateApp이 초기화되지 않았습니다.")},subscribe:e=>{const t=window.__templateApp;return t?.onGlobalStateChange?t.onGlobalStateChange(e):(Ee.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,t,s)=>{let i,o,d;typeof e=="string"?(i=e,o=t||{},d=s):(o=e,d=t&&typeof t=="object"&&"merge"in t?t:s);const g=d?.merge||"deep",h=Mo(o);if(i){const y=window.__g7IsolatedStates?.[i];y?.mergeState?y.mergeState(h,g):Ee.warn(`G7Core.state.setIsolated: scopeId '${i}'를 찾을 수 없습니다.`);return}const f=window.__g7ActionContext;f?.isolatedContext?.mergeState?f.isolatedContext.mergeState(h,g):Ee.warn("G7Core.state.setIsolated: 액션 컨텍스트에 isolatedContext가 없습니다.")},getParent:()=>{const e=window.__g7LayoutContextStack||[];if(e.length===0)return Ee.log("[getParent] 레이아웃 컨텍스트 스택이 비어있습니다."),null;const t=e[e.length-1];if(!t)return null;const s=t.dataContext||{};return{_local:t.state||s._local||{},_global:s._global||r.state.get()||{},setState:t.setState}},setParentLocal:(e,t,s)=>{const i=window.__g7LayoutContextStack||[];if(i.length===0){Ee.warn("[setParentLocal] 레이아웃 컨텍스트 스택이 비어있습니다.");return}const o=i[i.length-1];if(!o?.setState){Ee.warn("[setParentLocal] 부모 컨텍스트에 setState가 없습니다.");return}let d,g;typeof e=="string"?(d={[e]:t},g=s):(d=e,g=t&&typeof t=="object"&&"merge"in t?t:s);const h=g?.merge||"deep",f=Mo(d),p=o.state?._local!==void 0,y=p?o.state._local:o.state||{};let x;h==="replace"?x=f:h==="shallow"?x={...y,...f}:x=os(y,f),window.__g7PendingLocalState=x;const w=window.__templateApp;if(w?.setGlobalState&&w.setGlobalState({_local:x}),o.setState(x),p?o.state._local=x:o.state=x,o.dataContext&&(o.dataContext._local=x),h==="replace")window.__g7ForcedLocalFields=f;else{const v=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=os(v,f)}gg()},setParentGlobal:(e,t)=>{let s;typeof e=="string"?s={[e]:t}:s=e,r.state.set(s),Ee.log("[setParentGlobal] 전역 상태 업데이트:",s)}},window.__g7IsolatedStates||(window.__g7IsolatedStates={}),r.state.getGlobal=r.state.get,r.state.setGlobal=r.state.set,Ee.log("전역 객체 window.G7Core.state에 노출됨")}function aN(r){r.dataSource={get:e=>window.__templateApp?.getDataSource?.(e),set:(e,t,s)=>{const i=window.__templateApp;i?.setDataSource?i.setDataSource(e,t,s):Ee.warn("G7Core.dataSource.set: TemplateApp이 초기화되지 않았습니다.")},refetch:async(e,t)=>{const s=window.__templateApp;if(s?.refetchDataSource)return s.refetchDataSource(e,t);Ee.warn("G7Core.dataSource.refetch: TemplateApp이 초기화되지 않았습니다.")},updateItem:(e,t,s,i,o)=>{const d=window.__templateApp;return d?.updateDataSourceItem?d.updateDataSourceItem(e,t,s,i,o):(Ee.warn("G7Core.dataSource.updateItem: TemplateApp이 초기화되지 않았습니다."),!1)},updateData:(e,t,s,i="append")=>{const o=window.__templateApp;if(!o?.getDataSource||!o?.setDataSource)return Ee.warn("G7Core.dataSource.updateData: TemplateApp이 초기화되지 않았습니다."),!1;const d=o.getDataSource(e);if(!d)return Ee.warn(`G7Core.dataSource.updateData: 데이터 소스 '${e}'를 찾을 수 없습니다.`),!1;let g,h=d,f=null;if(t){const y=t.split(".");f=y.pop();for(const x of y)if(h&&typeof h=="object"&&x in h)h=h[x];else return Ee.warn(`G7Core.dataSource.updateData: 경로 '${t}'를 찾을 수 없습니다.`),!1;g=h[f]}else g=d;if(!Array.isArray(g))return Ee.warn("G7Core.dataSource.updateData: 대상 경로의 데이터가 배열이 아닙니다."),!1;if(!Array.isArray(s))return Ee.warn("G7Core.dataSource.updateData: newData가 배열이 아닙니다."),!1;const p=i==="prepend"?[...s,...g]:[...g,...s];return t&&f?(h[f]=p,o.setDataSource(e,d,{merge:!1})):o.setDataSource(e,p,{merge:!1}),Ee.log(`G7Core.dataSource.updateData: '${e}'에 ${s.length}개 항목 ${i==="prepend"?"앞에":"뒤에"} 추가됨`),!0}},Ee.log("전역 객체 window.G7Core.dataSource에 노출됨")}function rN(r,e){r.locale={current:()=>window.__templateApp?.getLocale?.()||"ko",supported:()=>{const s=window.__templateApp?.globalState?.appConfig?.supportedLocales;return Array.isArray(s)&&s.length>0?s:e.getState().templateMetadata?.locales||["ko","en"]},change:async t=>{const s=window.__templateApp;s?.changeLocale?await s.changeLocale(t):Ee.warn("G7Core.locale.change: TemplateApp이 초기화되지 않았습니다.")}},Ee.log("전역 객체 window.G7Core.locale에 노출됨")}function iN(r){r.toast={show:(e,t)=>{r.dispatch({handler:"toast",params:{message:e,type:t?.type||"info",...t?.duration&&{duration:t.duration}}})},success:(e,t)=>{r.toast.show(e,{type:"success",duration:t})},error:(e,t)=>{r.toast.show(e,{type:"error",duration:t})},warning:(e,t)=>{r.toast.show(e,{type:"warning",duration:t})},info:(e,t)=>{r.toast.show(e,{type:"info",duration:t})}},Ee.log("전역 객체 window.G7Core.toast에 노출됨")}function oN(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 t=r.state.get();return t._global?.activeModal===e||t._global?.modalStack?.includes(e)||!1},getStack:()=>r.state.get()._global?.modalStack||[]},Ee.log("전역 객체 window.G7Core.modal에 노출됨")}function lN(r){r.style={mergeClasses:Wk,conditionalClass:Yk,joinClasses:Jk},Ee.log("전역 객체 window.G7Core.style에 노출됨")}function cN(r,e){const{webSocketManager:t}=e;r.websocket={manager:t,subscribe:(s,i,o,d)=>t.subscribe(s,i,o,d),unsubscribe:s=>t.unsubscribe(s),leaveChannel:s=>t.leaveChannel(s),disconnect:()=>t.disconnect(),isInitialized:()=>t.isInitialized(),getSubscriptionCount:()=>t.getSubscriptionCount()},Ee.log("전역 객체 window.G7Core.websocket에 노출됨")}function dN(r,e){const{transitionManager:t}=e;r.navigation={isPending:()=>t?.getIsPending?.()||!1,onComplete:s=>{if(!t)return s(),()=>{};let i=t.getIsPending();const o=t.subscribe(d=>{d?i=!0:i&&(s(),o())});return o}},Ee.log("전역 객체 window.G7Core.navigation에 노출됨")}function uN(r){r.plugin={getSettings:e=>window.G7Config?.plugins?.[e],get:(e,t,s)=>window.G7Config?.plugins?.[e]?.[t]??s,getAll:()=>window.G7Config?.plugins??{}},Ee.log("전역 객체 window.G7Core.plugin에 노출됨")}function gN(r){r.module={getSettings:e=>window.G7Config?.modules?.[e],get:(e,t,s)=>window.G7Config?.modules?.[e]?.[t]??s,getAll:()=>window.G7Config?.modules??{}},Ee.log("전역 객체 window.G7Core.module에 노출됨")}function hN(r,e){const{transitionManager:t,responsiveManager:s}=e;r.AuthManager=qs,r.api=Bs(),r.TransitionManager=t,r.useTransitionState=Xm,r.ResponsiveManager=s,r.useResponsive=ey,r.useControllableState=C7,r.shallowArrayEqual=j7,r.shallowObjectEqual=ty,r.updateQueryParams=async(i,o)=>{const d=window.__templateApp;if(d?.updateQueryParams)return d.updateQueryParams(i,o);Ee.warn("G7Core.updateQueryParams: TemplateApp이 초기화되지 않았습니다.")},Ee.log("전역 객체 window.G7Core.AuthManager에 노출됨"),Ee.log("전역 객체 window.G7Core.api에 노출됨"),Ee.log("전역 객체 window.G7Core.ResponsiveManager에 노출됨"),Ee.log("전역 객체 window.G7Core.useResponsive에 노출됨"),Ee.log("전역 객체 window.G7Core.useControllableState에 노출됨"),Ee.log("전역 객체 window.G7Core.updateQueryParams에 노출됨")}function fN(r,e){r.getSlotContext=()=>window.__slotContextValue??null,r.getDynamicRenderer=()=>window.__DynamicRenderer??null,r.getComponentRegistry=()=>e.getComponentRegistry?.()??vs.getInstance(),r.getDataBindingEngine=()=>e.getDataBindingEngine?.()??e.getState().bindingEngine,r.getTranslationEngine=()=>e.getTranslationEngine?.()??e.getState().translationEngine,r.getActionDispatcher=()=>e.getActionDispatcher?.()??e.getState().actionDispatcher,Ee.log("전역 객체 window.G7Core 슬롯 API에 노출됨 (getSlotContext, getDynamicRenderer 등)")}function pN(r){let e=!1,t=null,s=null;r.wysiwyg={isEditMode:()=>e,setEditMode:(i,o)=>{e=!0,t=i,s=o,Ee.log(`위지윅 편집 모드 활성화: ${i} (${o})`)},clearEditMode:()=>{e=!1,t=null,s=null,Ee.log("위지윅 편집 모드 비활성화")},getCurrentLayoutName:()=>t,getCurrentTemplateId:()=>s,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},Ee.log("전역 객체 window.G7Core 위지윅 편집기 API에 노출됨 (wysiwyg)")}function mN(r){r.identity={setLauncher:cn.setLauncher.bind(cn),hasLauncher:cn.hasLauncher.bind(cn),redirectExternally:cn.redirectExternally.bind(cn),createDeferred:cn.createDeferred.bind(cn),resolveDeferred:cn.resolveDeferred.bind(cn),reset:cn.reset.bind(cn),redirectStashKey:hg},Ee.log("전역 객체 window.G7Core 본인인증(IDV) API에 노출됨 (identity)")}function yN(r){if(typeof window>"u")return;Xk(),window.G7Core||(window.G7Core={});const e=window.G7Core;Qk(e),hN(e,r),Zk(e,r),eN(e,r),tN(e),sN(e),aN(e),rN(e,r),iN(e),oN(e),lN(e),cN(e,r),dN(e,r),uN(e),gN(e),fN(e,r),pN(e),mN(e),Ee.log("G7Core 전역 객체 초기화 완료")}function xN(){const r=window.G7Core;if(!r){Ee.warn("G7Core가 초기화되지 않았습니다.");return}const e=()=>Ns.getInstance(),t={isEnabled:()=>{try{return e().isEnabled()}catch{return!1}},trackRender:s=>{try{e().isEnabled()&&e().trackRender(s)}catch{}},trackIteration:(s,i,o,d,g)=>{try{e().isEnabled()&&e().trackIteration(s,{source:i,itemVar:o,indexVar:d,sourceLength:g})}catch{}},trackIfCondition:(s,i,o,d)=>{try{e().isEnabled()&&e().trackIfCondition(s,i,o)}catch{}},trackMount:(s,i)=>{try{e().isEnabled()&&e().trackMount(s,{...i,id:s})}catch{}},trackUnmount:s=>{try{e().isEnabled()&&e().trackUnmount(s)}catch{}},trackExpressionEval:s=>{try{e().isEnabled()&&e().trackExpressionEval(s)}catch{}},trackBindingEval:s=>{try{e().isEnabled()&&e().trackBindingEval(s)}catch{}},recordCacheHit:()=>{try{e().isEnabled()&&e().recordCacheHit()}catch{}},recordCacheMiss:()=>{try{e().isEnabled()&&e().recordCacheMiss()}catch{}},trackHandlerRegistration:(s,i,o,d)=>{try{e().isEnabled()&&e().trackHandlerRegistration(s,i,o,d)}catch{}},trackHandlerUnregistration:s=>{try{e().isEnabled()&&e().trackHandlerUnregistration(s)}catch{}},logAction:s=>{try{e().isEnabled()&&e().logAction(s)}catch{}},trackRequest:(s,i)=>{try{return e().isEnabled()?e().trackRequest(s,i):""}catch{return""}},completeRequest:(s,i,o)=>{try{e().isEnabled()&&e().completeRequest(s,i,o)}catch{}},failRequest:(s,i)=>{try{e().isEnabled()&&e().failRequest(s,i)}catch{}},trackDataSourceDefinition:s=>{try{e().isEnabled()&&e().trackDataSourceDefinition(s)}catch{}},trackDataSourceLoading:s=>{try{e().isEnabled()&&e().trackDataSourceLoading(s)}catch{}},trackDataSourceLoaded:(s,i,o)=>{try{e().isEnabled()&&e().trackDataSourceLoaded(s,i,o)}catch{}},trackDataSourceError:(s,i)=>{try{e().isEnabled()&&e().trackDataSourceError(s,i)}catch{}},trackForm:(s,i,o)=>{try{e().isEnabled()&&e().trackForm(s,i,o)}catch{}},untrackForm:s=>{try{e().isEnabled()&&e().untrackForm(s)}catch{}},startStateChange:(s,i,o,d)=>{try{return e().isEnabled()?e().startStateChange(s,i,o,d):""}catch{return""}},completeStateChange:s=>{try{e().isEnabled()&&e().completeStateChange(s)}catch{}},trackComponentRender:(s,i,o,d,g,h)=>{try{e().isEnabled()&&e().trackComponentRender(s,i,o,d,g,h)}catch{}},updateLocalState:s=>{try{e().isEnabled()&&e().updateLocalState(s)}catch{}},updateComputedState:s=>{try{e().isEnabled()&&e().updateComputedState(s)}catch{}},updateParentContext:s=>{try{e().isEnabled()&&e().updateParentContext(s)}catch{}},trackComponentStateSource:(s,i,o,d)=>{try{e().isEnabled()&&e().trackComponentStateSource(s,i,o,d)}catch{}},trackDynamicState:(s,i)=>{try{e().isEnabled()&&e().trackDynamicState(s,i)}catch{}},trackContextFlow:(s,i,o,d,g,h)=>{try{e().isEnabled()&&e().trackContextFlow(s,i,o,d,g,h)}catch{}},trackComponentStyle:(s,i,o,d)=>{try{e().isEnabled()&&e().trackComponentStyle(s,i,o,d)}catch{}},trackAuthEvent:(s,i,o,d)=>{try{e().isEnabled()&&e().trackAuthEvent(s,i,o,d)}catch{}},trackAuthHeader:(s,i,o,d,g)=>{try{e().isEnabled()&&e().trackAuthHeader(s,i,o,d,g)}catch{}},trackLog:(s,i,o)=>{try{e().isEnabled()&&e().trackLog(s,i,o)}catch{}},trackAction:s=>{try{e().isEnabled()&&e().trackAction?.(s)}catch{}},trackDataSourceUpdate:s=>{try{e().isEnabled()&&e().trackDataSourceUpdate?.(s)}catch{}},startSequenceExecution:s=>{try{return e().isEnabled()?e().startSequenceExecution(s):""}catch{return""}},captureSequenceActionBefore:(s,i,o,d,g)=>{try{e().isEnabled()&&e().captureSequenceActionBefore(s,i,o,d,g)}catch{}},captureSequenceActionAfter:(s,i,o,d,g,h)=>{try{e().isEnabled()&&e().captureSequenceActionAfter(s,i,o,d,g,h)}catch{}},endSequenceExecution:(s,i)=>{try{e().isEnabled()&&e().endSequenceExecution(s,i)}catch{}},registerStateCaptureForHandler:(s,i,o)=>{try{e().isEnabled()&&e().registerStateCaptureForHandler(s,i,o)}catch{}},detectStaleClosure:(s,i,o,d,g)=>{try{return e().isEnabled()?e().detectStaleClosure(s,i,o,d,g):[]}catch{return[]}},trackStaleClosureWarning:s=>{try{e().isEnabled()&&e().trackStaleClosureWarning(s)}catch{}},trackModalOpen:s=>{try{e().isEnabled()&&e().trackModalOpen(s)}catch{}},trackModalClose:(s,i)=>{try{e().isEnabled()&&e().trackModalClose(s,i)}catch{}},trackModalStateChange:s=>{try{e().isEnabled()&&e().trackModalStateChange(s)}catch{}},trackNestedContext:s=>{try{return e().isEnabled()?e().trackNestedContext(s):""}catch{return""}},trackNestedContextAccess:(s,i)=>{try{e().isEnabled()&&e().trackNestedContextAccess(s,i)}catch{}},trackComputedProperty:(s,i,o,d,g,h,f)=>{try{e().isEnabled()&&e().trackComputedProperty(s,i,o,d,g,h,f)}catch{}},trackComputedRecalc:(s,i,o,d,g,h,f)=>{try{e().isEnabled()&&e().trackComputedRecalc(s,i,o,d,g,h,f)}catch{}},setNamedActionDefinitions:s=>{try{e().isEnabled()&&e().setNamedActionDefinitions(s)}catch{}},trackNamedActionRef:s=>{try{e().isEnabled()&&e().trackNamedActionRef(s)}catch{}}};r.devTools=t,Ee.log("G7Core.devTools 인터페이스 초기화 완료")}function bN(){const r=window.G7Core;if(!r){Ee.warn("G7Core가 초기화되지 않았습니다.");return}const e=Ns.getInstance();if(e.initialize(),!e.isEnabled()){window.G7DevTools={isEnabled:()=>!1,enable:()=>{Ee.log("환경설정 > 고급 설정 > 디버그 모드를 켜세요")}},Bp(),Ee.log("G7DevTools 비활성화됨 (디버그 모드 꺼짐)");return}xN(),Bp();try{Bk().enable(),Ee.log("StyleTracker 활성화됨")}catch(o){Ee.warn("StyleTracker 활성화 실패:",o)}const t=new sx,s=ax(),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){Ee.warn("DataBindingEngine이 없습니다.");return}return d.evaluateExpression(o,e.getState())},getCacheStats:()=>e.getCacheStats(),clearStats:()=>{e.resetCacheStats(),Ee.log("캐시 통계 초기화됨")}},diagnose:{analyze:o=>t.analyze(o),suggestFix:o=>t.suggestFix(o),getCommonIssues:()=>t.getCommonIssues(),getRulesByCategory:o=>t.getRulesByCategory(o)},server:{dumpState:o=>s.dumpState(o),sendLog:o=>s.sendLog(o),sendError:(o,d)=>s.sendError(o,d),isConnected:()=>s.isConnected(),testConnection:()=>s.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,Ee.log("G7DevTools 전역 객체 초기화 완료 (window.G7DevTools)"),vN()}function vN(){if(document.getElementById("g7-devtools-root")){Ee.log("DevToolsPanel 이미 렌더링됨");return}const r=document.createElement("div");r.id="g7-devtools-root",document.body.appendChild(r);try{Uu.createRoot(r).render(Ke.createElement(Pk)),Ee.log("DevToolsPanel UI 렌더링 완료")}catch(e){Ee.error("DevToolsPanel UI 렌더링 실패:",e)}}const et=nt("TemplateEngine"),ge={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 Bc=!1;const $o=[];async function wN(r){try{et.log("템플릿 메타데이터 로드 중...",r);const e=r.split("-").map(s=>s.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")).join(""),t=window[e];return t?.templateMetadata?(et.log("템플릿 메타데이터 로드 완료 (전역 변수)",t.templateMetadata),t.templateMetadata):(et.warn(`템플릿 번들에 메타데이터가 없습니다. 전역 변수: ${e}`),{identifier:r,locales:["ko","en"],name:{ko:r,en:r},description:{ko:"",en:""},version:"1.0.0",type:"admin"})}catch(e){return et.error("템플릿 메타데이터 로드 실패",e),{identifier:r,locales:["ko","en"],name:{ko:r,en:r},description:{ko:"",en:""},version:"1.0.0",type:"admin"}}}function px(){const e=(typeof window<"u"?window.__templateApp:void 0)?.globalState?.appConfig?.supportedLocales,t=ge.templateMetadata?.locales;return{$locale:ge.locale,$locales:Array.isArray(e)&&e.length>0?e:t||["ko","en"],$templateLocales:t||["ko","en"],$templateId:ge.templateId}}async function Io(r){try{if(et.log("템플릿 엔진 초기화 시작",r),ge.isInitialized)throw new Error("템플릿 엔진이 이미 초기화되었습니다. destroyTemplate()을 먼저 호출하세요.");if(!r.templateId)throw new Zj;Bc=r.debug??!1,typeof window<"u"&&(window.G7Config||(window.G7Config={}),window.G7Config.debug=Bc),bN(),ge.templateId=r.templateId,ge.locale=r.locale||"ko",et.log("엔진 인스턴스 생성 중..."),ge.registry=vs.getInstance(),ge.bindingEngine=new An,ge.translationEngine=br.getInstance(),r.cacheVersion!==void 0&&r.cacheVersion>0&&ge.translationEngine.setCacheVersion(r.cacheVersion),ge.translationContext={templateId:r.templateId,locale:ge.locale},ge.actionDispatcher=new Co({},ge.translationEngine,ge.translationContext),v7(ge.actionDispatcher),et.log("다국어 파일 로드 중...",r.templateId,ge.locale);const e="en",t=[ge.translationEngine.loadTranslations(r.templateId,ge.locale).then(()=>{et.log(`다국어 파일 로드 완료: ${ge.locale}`)}).catch(s=>{et.warn(`다국어 파일 로드 실패 (${ge.locale}):`,s instanceof Error?s.message:s)})];ge.locale!==e&&t.push(ge.translationEngine.loadTranslations(r.templateId,e).then(()=>{et.log(`폴백 다국어 파일 로드 완료: ${e}`)}).catch(s=>{et.warn(`폴백 다국어 파일 로드 실패 (${e}):`,s instanceof Error?s.message:s)})),await Promise.allSettled(t),et.log("템플릿 메타데이터 로드 중...",r.templateId),ge.templateMetadata=await wN(r.templateId),ge.isInitialized=!0,et.log("템플릿 엔진 초기화 완료 (ComponentRegistry는 별도 로드)")}catch(e){throw et.error("템플릿 엔진 초기화 실패",e),ge.isInitialized=!1,ge.registry=null,ge.bindingEngine=null,ge.translationEngine=null,ge.actionDispatcher=null,e}}async function zo(r){try{if(et.log("템플릿 렌더링 시작",r),!ge.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 t=px();ge.containerId=r.containerId,ge.currentLayoutJson=r.layoutJson,ge.currentDataContext={...t,...r.dataContext||{}},ge.translationContext=r.translationContext||{templateId:ge.templateId||"",locale:ge.locale},ge.reactRoot||(et.log("React Root 생성"),ge.reactRoot=Uu.createRoot(e));const s=yx();if(et.log("편집 모드:",s),s){await CN(r);return}const i=r.layoutJson.components||[];if(i.length===0){et.warn("렌더링할 컴포넌트가 없습니다.");return}const o=r.layoutJson.modals||[];if(et.log("modals 배열:",o),et.log("modals 개수:",o.length),et.log("DynamicRenderer로 렌더링 시작"),ge.reactRoot.render(Ke.createElement(Lc,{translationEngine:ge.translationEngine,translationContext:ge.translationContext},Ke.createElement(fg,null,Ke.createElement(pg,null,Ke.createElement($g,null,[...i.map((d,g)=>{const h=ge.currentLayoutJson?.layout_name||"";return Ke.createElement(Vs,{key:h&&!d._fromBase?`${d.id}_${h}`:d.id,componentDef:d,dataContext:ge.currentDataContext,translationContext:ge.translationContext,registry:ge.registry,bindingEngine:ge.bindingEngine,translationEngine:ge.translationEngine,actionDispatcher:ge.actionDispatcher,isRootRenderer:g===0,layoutKey:h})}),Ke.createElement(Vm,{key:"__modal_parent_context_provider"},o.map(d=>{const g=ge.currentDataContext._global?.modalStack||[],f=g.includes(d.id)||ge.currentDataContext._global?.activeModal===d.id,p=g.indexOf(d.id),y=p>=0?50+p:50,x=window.__g7LayoutContextStack||[],v=x[x.length-1]?.dataContext,S=Ke.createElement(Vs,{key:`modal_${d.id}_renderer`,componentDef:{...d,props:{...d.props,isOpen:f,style:{...d.props?.style,zIndex:y},onClose:ge.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ge.currentDataContext)}},dataContext:ge.currentDataContext,translationContext:ge.translationContext,registry:ge.registry,bindingEngine:ge.bindingEngine,translationEngine:ge.translationEngine,actionDispatcher:ge.actionDispatcher,parentDataContext:v});return d.data_sources&&d.data_sources.length>0?Ke.createElement(ex,{key:`modal_${d.id}`,isOpen:f,modalId:d.id,dataSources:d.data_sources,dataContext:ge.currentDataContext,globalStateUpdater:ge.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ge.bindingEngine,debug:Bc,children:S}):S}))]))))),et.log("템플릿 렌더링 완료"),$o.length>0){et.log(`대기 중인 데이터 업데이트 ${$o.length}건 적용`);const d=[...$o];$o.length=0;for(const{data:g,options:h}of d)pi(g,h)}}catch(e){throw et.error("템플릿 렌더링 실패",e),e}}function pi(r,e){try{if(et.log("템플릿 데이터 업데이트 시작",Object.keys(r)),yx()){et.log("편집 모드에서는 updateTemplateData를 건너뜁니다.");return}if(!ge.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다.");if(!ge.reactRoot||!ge.currentLayoutJson){et.log("React 미준비 - 데이터 업데이트 큐잉:",Object.keys(r)),$o.push({data:r,options:e});return}const t=px(),s={...ge.currentDataContext._global||{},...r._global||{}};ge.currentDataContext={...t,...ge.currentDataContext,...r,_global:s},s._local!==void 0&&(ge.currentDataContext._local=s._local),s._computed!==void 0&&(ge.currentDataContext._computed=s._computed);const i=ge.currentLayoutJson.components||[],o=ge.currentLayoutJson.modals||[];et.log("updateTemplateData - modals 배열:",o),et.log("updateTemplateData - modals 개수:",o.length),et.log("updateTemplateData - activeModal:",ge.currentDataContext._global?.activeModal);const d=()=>{ge.reactRoot.render(Ke.createElement(Lc,{translationEngine:ge.translationEngine,translationContext:ge.translationContext},Ke.createElement(fg,null,Ke.createElement(pg,null,Ke.createElement($g,null,[...i.map((g,h)=>{const f=ge.currentLayoutJson?.layout_name||"";return Ke.createElement(Vs,{key:f&&!g._fromBase?`${g.id}_${f}`:g.id,componentDef:g,dataContext:ge.currentDataContext,translationContext:ge.translationContext,registry:ge.registry,bindingEngine:ge.bindingEngine,translationEngine:ge.translationEngine,actionDispatcher:ge.actionDispatcher,isRootRenderer:h===0,layoutKey:f})}),Ke.createElement(Vm,{key:"__modal_parent_context_provider_update"},o.map(g=>{const h=ge.currentDataContext._global?.modalStack||[],p=h.includes(g.id)||ge.currentDataContext._global?.activeModal===g.id,y=h.indexOf(g.id),x=y>=0?50+y:50,w=window.__g7LayoutContextStack||[],S=w[w.length-1]?.dataContext,k=Ke.createElement(Vs,{key:`modal_${g.id}_renderer`,componentDef:{...g,props:{...g.props,isOpen:p,style:{...g.props?.style,zIndex:x},onClose:ge.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ge.currentDataContext)}},dataContext:ge.currentDataContext,translationContext:ge.translationContext,registry:ge.registry,bindingEngine:ge.bindingEngine,translationEngine:ge.translationEngine,actionDispatcher:ge.actionDispatcher,parentDataContext:S});return g.data_sources&&g.data_sources.length>0?Ke.createElement(ex,{key:`modal_${g.id}`,isOpen:p,modalId:g.id,dataSources:g.data_sources,dataContext:ge.currentDataContext,globalStateUpdater:ge.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ge.bindingEngine,debug:Bc,children:k}):k}))])))))};e?.sync?(et.log("재렌더링 시작 (sync mode - 즉시 렌더링)"),d()):(et.log("재렌더링 시작 (with startTransition)"),j.startTransition(()=>{d()})),et.log("템플릿 데이터 업데이트 완료")}catch(t){throw et.error("템플릿 데이터 업데이트 실패",t),t}}function qc(){try{et.log("템플릿 정리 시작"),ge.reactRoot&&(et.log("React Root 언마운트"),ge.reactRoot.unmount(),ge.reactRoot=null),ge.templateId=null,ge.locale="ko",ge.isInitialized=!1,ge.containerId=null,ge.currentLayoutJson=null,ge.currentDataContext={},ge.translationContext={templateId:"",locale:"ko"},ge.registry=null,ge.bindingEngine=null,ge.translationEngine=null,ge.actionDispatcher=null,ge.templateMetadata=null,et.log("템플릿 정리 완료")}catch(r){throw et.error("템플릿 정리 실패",r),r}}function za(){return Object.freeze({...ge})}function mx(){return ge.actionDispatcher}function yx(){if(typeof window>"u")return!1;const r=new URLSearchParams(window.location.search),e=r.get("mode"),t=r.get("template");return e==="edit"&&!!t}function SN(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("template")}async function CN(r){et.log("위지윅 편집기 렌더링 시작");try{const{WysiwygEditor:e}=await Promise.resolve().then(()=>l_),t=SN()||ge.templateId||"unknown",s=()=>{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=>{et.log("레이아웃 저장 완료:",o)};et.log("WysiwygEditor 렌더링",{templateId:t,layoutName:r.layoutJson?.layout_name}),ge.reactRoot.render(Ke.createElement(Lc,{translationEngine:ge.translationEngine,translationContext:ge.translationContext},Ke.createElement(e,{layoutData:r.layoutJson,templateId:t,onClose:s,onSaveComplete:i,initialEditMode:"visual",readOnly:!1}))),et.log("위지윅 편집기 렌더링 완료")}catch(e){throw et.error("위지윅 편집기 로드 실패:",e),ge.reactRoot.render(Ke.createElement("div",{className:"flex items-center justify-center h-screen bg-gray-100 dark:bg-gray-900"},Ke.createElement("div",{className:"text-center p-8 bg-white dark:bg-gray-800 rounded-lg shadow-lg"},Ke.createElement("h1",{className:"text-xl font-bold text-red-600 dark:text-red-400 mb-4"},"위지윅 편집기 로드 실패"),Ke.createElement("p",{className:"text-gray-600 dark:text-gray-400 mb-4"},"편집기를 불러오는 중 오류가 발생했습니다."),Ke.createElement("button",{className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",onClick:()=>window.location.reload()},"새로고침")))),e}}const Ho={initTemplateEngine:Io,renderTemplate:zo,updateTemplateData:pi,destroyTemplate:qc,getState:za};typeof window<"u"&&(window.G7Core||(window.G7Core={}),window.G7Core.TemplateEngine=Ho,yN({getState:()=>({translationEngine:ge.translationEngine,translationContext:ge.translationContext,bindingEngine:ge.bindingEngine,actionDispatcher:ge.actionDispatcher,templateMetadata:ge.templateMetadata}),transitionManager:Gs,responsiveManager:ti,webSocketManager:Ic}),et.log("전역 객체 window.G7Core.TemplateEngine에 노출됨"));const Ks=Object.freeze(Object.defineProperty({__proto__:null,DataSourceManager:la,LayoutLoader:Mg,TemplateApp:Lo,TemplateEngine:Ho,default:Ho,destroyTemplate:qc,getActionDispatcher:mx,getState:za,initTemplateApp:qg,initTemplateEngine:Io,renderTemplate:zo,updateTemplateData:pi},Symbol.toStringTag,{value:"Module"})),xx=r=>{let e;const t=new Set,s=(f,p)=>{const y=typeof f=="function"?f(e):f;if(!Object.is(y,e)){const x=e;e=p??(typeof y!="object"||y===null)?y:Object.assign({},e,y),t.forEach(w=>w(e,x))}},i=()=>e,g={setState:s,getState:i,getInitialState:()=>h,subscribe:f=>(t.add(f),()=>t.delete(f))},h=e=r(s,i,g);return g},jN=(r=>r?xx(r):xx),kN=r=>r;function NN(r,e=kN){const t=Ke.useSyncExternalStore(r.subscribe,Ke.useCallback(()=>e(r.getState()),[r,e]),Ke.useCallback(()=>e(r.getInitialState()),[r,e]));return Ke.useDebugValue(t),t}const bx=r=>{const e=jN(r),t=s=>NN(e,s);return Object.assign(t,e),t},EN=(r=>r?bx(r):bx);var vx=Symbol.for("immer-nothing"),wx=Symbol.for("immer-draftable"),Tn=Symbol.for("immer-state");function _s(r,...e){throw new Error(`[Immer] minified error nr: ${r}. Full error at: https://bit.ly/3cXEKWf`)}var Yn=Object,mi=Yn.getPrototypeOf,Gc="constructor",Fc="prototype",Kg="configurable",Vc="enumerable",Kc="writable",Po="value",Ha=r=>!!r&&!!r[Tn];function ca(r){return r?Cx(r)||Jc(r)||!!r[wx]||!!r[Gc]?.[wx]||Xc(r)||Qc(r):!1}var _N=Yn[Fc][Gc].toString(),Sx=new WeakMap;function Cx(r){if(!r||!Yg(r))return!1;const e=mi(r);if(e===null||e===Yn[Fc])return!0;const t=Yn.hasOwnProperty.call(e,Gc)&&e[Gc];if(t===Object)return!0;if(!yi(t))return!1;let s=Sx.get(t);return s===void 0&&(s=Function.toString.call(t),Sx.set(t,s)),s===_N}function Wc(r,e,t=!0){Uo(r)===0?(t?Reflect.ownKeys(r):Yn.keys(r)).forEach(i=>{e(i,r[i],r)}):r.forEach((s,i)=>e(i,s,r))}function Uo(r){const e=r[Tn];return e?e.type_:Jc(r)?1:Xc(r)?2:Qc(r)?3:0}var jx=(r,e,t=Uo(r))=>t===2?r.has(e):Yn[Fc].hasOwnProperty.call(r,e),Wg=(r,e,t=Uo(r))=>t===2?r.get(e):r[e],Yc=(r,e,t,s=Uo(r))=>{s===2?r.set(e,t):s===3?r.add(t):r[e]=t};function AN(r,e){return r===e?r!==0||1/r===1/e:r!==r&&e!==e}var Jc=Array.isArray,Xc=r=>r instanceof Map,Qc=r=>r instanceof Set,Yg=r=>typeof r=="object",yi=r=>typeof r=="function",Jg=r=>typeof r=="boolean";function TN(r){const e=+r;return Number.isInteger(e)&&String(e)===r}var da=r=>r.copy_||r.base_,Xg=r=>r.modified_?r.copy_:r.base_;function Qg(r,e){if(Xc(r))return new Map(r);if(Qc(r))return new Set(r);if(Jc(r))return Array[Fc].slice.call(r);const t=Cx(r);if(e===!0||e==="class_only"&&!t){const s=Yn.getOwnPropertyDescriptors(r);delete s[Tn];let i=Reflect.ownKeys(s);for(let o=0;o<i.length;o++){const d=i[o],g=s[d];g[Kc]===!1&&(g[Kc]=!0,g[Kg]=!0),(g.get||g.set)&&(s[d]={[Kg]:!0,[Kc]:!0,[Vc]:g[Vc],[Po]:r[d]})}return Yn.create(mi(r),s)}else{const s=mi(r);if(s!==null&&t)return{...r};const i=Yn.create(s);return Yn.assign(i,r)}}function Zg(r,e=!1){return ed(r)||Ha(r)||!ca(r)||(Uo(r)>1&&Yn.defineProperties(r,{set:Zc,add:Zc,clear:Zc,delete:Zc}),Yn.freeze(r),e&&Wc(r,(t,s)=>{Zg(s,!0)},!1)),r}function DN(){_s(2)}var Zc={[Po]:DN};function ed(r){return r===null||!Yg(r)?!0:Yn.isFrozen(r)}var td="MapSet",eh="Patches",kx="ArrayMethods",Nx={};function jr(r){const e=Nx[r];return e||_s(0,r),e}var Ex=r=>!!Nx[r],Bo,_x=()=>Bo,RN=(r,e)=>({drafts_:[],parent_:r,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ex(td)?jr(td):void 0,arrayMethodsPlugin_:Ex(kx)?jr(kx):void 0});function Ax(r,e){e&&(r.patchPlugin_=jr(eh),r.patches_=[],r.inversePatches_=[],r.patchListener_=e)}function th(r){nh(r),r.drafts_.forEach(ON),r.drafts_=null}function nh(r){r===Bo&&(Bo=r.parent_)}var Tx=r=>Bo=RN(Bo,r);function ON(r){const e=r[Tn];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Dx(r,e){e.unfinalizedDrafts_=e.drafts_.length;const t=e.drafts_[0];if(r!==void 0&&r!==t){t[Tn].modified_&&(th(e),_s(4)),ca(r)&&(r=Rx(e,r));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(t[Tn].base_,r,e)}else r=Rx(e,t);return LN(e,r,!0),th(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),r!==vx?r:void 0}function Rx(r,e){if(ed(e))return e;const t=e[Tn];if(!t)return sd(e,r.handledSet_,r);if(!nd(t,r))return e;if(!t.modified_)return t.base_;if(!t.finalized_){const{callbacks_:s}=t;if(s)for(;s.length>0;)s.pop()(r);Mx(t,r)}return t.copy_}function LN(r,e,t=!1){!r.parent_&&r.immer_.autoFreeze_&&r.canAutoFreeze_&&Zg(e,t)}function Ox(r){r.finalized_=!0,r.scope_.unfinalizedDrafts_--}var nd=(r,e)=>r.scope_===e,MN=[];function Lx(r,e,t,s){const i=da(r),o=r.type_;if(s!==void 0&&Wg(i,s,o)===e){Yc(i,s,t,o);return}if(!r.draftLocations_){const g=r.draftLocations_=new Map;Wc(i,(h,f)=>{if(Ha(f)){const p=g.get(f)||[];p.push(h),g.set(f,p)}})}const d=r.draftLocations_.get(e)??MN;for(const g of d)Yc(i,g,t,o)}function $N(r,e,t){r.callbacks_.push(function(i){const o=e;if(!o||!nd(o,i))return;i.mapSetPlugin_?.fixSetContents(o);const d=Xg(o);Lx(r,o.draft_??o,d,t),Mx(o,i)})}function Mx(r,e){if(r.modified_&&!r.finalized_&&(r.type_===3||r.type_===1&&r.allIndicesReassigned_||(r.assigned_?.size??0)>0)){const{patchPlugin_:s}=e;if(s){const i=s.getPath(r);i&&s.generatePatches_(r,i,e)}Ox(r)}}function IN(r,e,t){const{scope_:s}=r;if(Ha(t)){const i=t[Tn];nd(i,s)&&i.callbacks_.push(function(){rd(r);const d=Xg(i);Lx(r,t,d,e)})}else ca(t)&&r.callbacks_.push(function(){const o=da(r);r.type_===3?o.has(t)&&sd(t,s.handledSet_,s):Wg(o,e,r.type_)===t&&s.drafts_.length>1&&(r.assigned_.get(e)??!1)===!0&&r.copy_&&sd(Wg(r.copy_,e,r.type_),s.handledSet_,s)})}function sd(r,e,t){return!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||Ha(r)||e.has(r)||!ca(r)||ed(r)||(e.add(r),Wc(r,(s,i)=>{if(Ha(i)){const o=i[Tn];if(nd(o,t)){const d=Xg(o);Yc(r,s,d,r.type_),Ox(o)}}else ca(i)&&sd(i,e,t)})),r}function zN(r,e){const t=Jc(r),s={type_:t?1:0,scope_:e?e.scope_:_x(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:r,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=s,o=ad;t&&(i=[s],o=qo);const{revoke:d,proxy:g}=Proxy.revocable(i,o);return s.draft_=g,s.revoke_=d,[g,s]}var ad={get(r,e){if(e===Tn)return r;let t=r.scope_.arrayMethodsPlugin_;const s=r.type_===1&&typeof e=="string";if(s&&t?.isArrayOperationMethod(e))return t.createMethodInterceptor(r,e);const i=da(r);if(!jx(i,e,r.type_))return HN(r,i,e);const o=i[e];if(r.finalized_||!ca(o)||s&&r.operationMethod&&t?.isMutatingArrayMethod(r.operationMethod)&&TN(e))return o;if(o===sh(r.base_,e)){rd(r);const d=r.type_===1?+e:e,g=rh(r.scope_,o,r,d);return r.copy_[d]=g}return o},has(r,e){return e in da(r)},ownKeys(r){return Reflect.ownKeys(da(r))},set(r,e,t){const s=$x(da(r),e);if(s?.set)return s.set.call(r.draft_,t),!0;if(!r.modified_){const i=sh(da(r),e),o=i?.[Tn];if(o&&o.base_===t)return r.copy_[e]=t,r.assigned_.set(e,!1),!0;if(AN(t,i)&&(t!==void 0||jx(r.base_,e,r.type_)))return!0;rd(r),ah(r)}return r.copy_[e]===t&&(t!==void 0||e in r.copy_)||Number.isNaN(t)&&Number.isNaN(r.copy_[e])||(r.copy_[e]=t,r.assigned_.set(e,!0),IN(r,e,t)),!0},deleteProperty(r,e){return rd(r),sh(r.base_,e)!==void 0||e in r.base_?(r.assigned_.set(e,!1),ah(r)):r.assigned_.delete(e),r.copy_&&delete r.copy_[e],!0},getOwnPropertyDescriptor(r,e){const t=da(r),s=Reflect.getOwnPropertyDescriptor(t,e);return s&&{[Kc]:!0,[Kg]:r.type_!==1||e!=="length",[Vc]:s[Vc],[Po]:t[e]}},defineProperty(){_s(11)},getPrototypeOf(r){return mi(r.base_)},setPrototypeOf(){_s(12)}},qo={};for(let r in ad){let e=ad[r];qo[r]=function(){const t=arguments;return t[0]=t[0][0],e.apply(this,t)}}qo.deleteProperty=function(r,e){return qo.set.call(this,r,e,void 0)},qo.set=function(r,e,t){return ad.set.call(this,r[0],e,t,r[0])};function sh(r,e){const t=r[Tn];return(t?da(t):r)[e]}function HN(r,e,t){const s=$x(e,t);return s?Po in s?s[Po]:s.get?.call(r.draft_):void 0}function $x(r,e){if(!(e in r))return;let t=mi(r);for(;t;){const s=Object.getOwnPropertyDescriptor(t,e);if(s)return s;t=mi(t)}}function ah(r){r.modified_||(r.modified_=!0,r.parent_&&ah(r.parent_))}function rd(r){r.copy_||(r.assigned_=new Map,r.copy_=Qg(r.base_,r.scope_.immer_.useStrictShallowCopy_))}var PN=class{constructor(r){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,s)=>{if(yi(e)&&!yi(t)){const o=t;t=e;const d=this;return function(h=o,...f){return d.produce(h,p=>t.call(this,p,...f))}}yi(t)||_s(6),s!==void 0&&!yi(s)&&_s(7);let i;if(ca(e)){const o=Tx(this),d=rh(o,e,void 0);let g=!0;try{i=t(d),g=!1}finally{g?th(o):nh(o)}return Ax(o,s),Dx(i,o)}else if(!e||!Yg(e)){if(i=t(e),i===void 0&&(i=e),i===vx&&(i=void 0),this.autoFreeze_&&Zg(i,!0),s){const o=[],d=[];jr(eh).generateReplacementPatches_(e,i,{patches_:o,inversePatches_:d}),s(o,d)}return i}else _s(1,e)},this.produceWithPatches=(e,t)=>{if(yi(e))return(d,...g)=>this.produceWithPatches(d,h=>e(h,...g));let s,i;return[this.produce(e,t,(d,g)=>{s=d,i=g}),s,i]},Jg(r?.autoFreeze)&&this.setAutoFreeze(r.autoFreeze),Jg(r?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(r.useStrictShallowCopy),Jg(r?.useStrictIteration)&&this.setUseStrictIteration(r.useStrictIteration)}createDraft(r){ca(r)||_s(8),Ha(r)&&(r=UN(r));const e=Tx(this),t=rh(e,r,void 0);return t[Tn].isManual_=!0,nh(e),t}finishDraft(r,e){const t=r&&r[Tn];(!t||!t.isManual_)&&_s(9);const{scope_:s}=t;return Ax(s,e),Dx(void 0,s)}setAutoFreeze(r){this.autoFreeze_=r}setUseStrictShallowCopy(r){this.useStrictShallowCopy_=r}setUseStrictIteration(r){this.useStrictIteration_=r}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(r,e){let t;for(t=e.length-1;t>=0;t--){const i=e[t];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}t>-1&&(e=e.slice(t+1));const s=jr(eh).applyPatches_;return Ha(r)?s(r,e):this.produce(r,i=>s(i,e))}};function rh(r,e,t,s){const[i,o]=Xc(e)?jr(td).proxyMap_(e,t):Qc(e)?jr(td).proxySet_(e,t):zN(e,t);return(t?.scope_??_x()).drafts_.push(i),o.callbacks_=t?.callbacks_??[],o.key_=s,t&&s!==void 0?$N(t,o,s):o.callbacks_.push(function(h){h.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:f}=h;o.modified_&&f&&f.generatePatches_(o,[],h)}),i}function UN(r){return Ha(r)||_s(10,r),Ix(r)}function Ix(r){if(!ca(r)||ed(r))return r;const e=r[Tn];let t,s=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,t=Qg(r,e.scope_.immer_.useStrictShallowCopy_),s=e.scope_.immer_.shouldUseStrictIteration()}else t=Qg(r,!0);return Wc(t,(i,o)=>{Yc(t,i,Ix(o))},s),e&&(e.finalized_=!1),t}var BN=new PN,qN=BN.produce;const GN=r=>(e,t,s)=>(s.setState=(i,o,...d)=>{const g=typeof i=="function"?qN(i):i;return e(g,o,...d)},r(s.setState,t,s)),zx={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"},Go=new Map,id=r=>{const e=Go.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,s])=>[t,s.getState()])):{}},FN=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const s=Go.get(t.name);if(s)return{type:"tracked",store:r,...s};const i={connection:e.connect(t),stores:{}};return Go.set(t.name,i),{type:"tracked",store:r,...i}},VN=(r,e)=>{if(e===void 0)return;const t=Go.get(r);t&&(delete t.stores[e],Object.keys(t.stores).length===0&&Go.delete(r))},KN=r=>{var e,t;if(!r)return;const s=r.split(`
|
||
`),i=s.findIndex(d=>d.includes("api.setState"));if(i<0)return;const o=((e=s[i+1])==null?void 0:e.trim())||"";return(t=/.+ (.+) .+/.exec(o))==null?void 0:t[1]},WN=(r,e={})=>(t,s,i)=>{const{enabled:o,anonymousActionType:d,store:g,...h}=e;let f;try{f=(o??(zx?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!f)return r(t,s,i);const{connection:p,...y}=FN(g,f,h);let x=!0;i.setState=((S,k,A)=>{const O=t(S,k);if(!x)return O;const N=A===void 0?{type:d||KN(new Error().stack)||"anonymous"}:typeof A=="string"?{type:A}:A;return g===void 0?(p?.send(N,s()),O):(p?.send({...N,type:`${g}/${N.type}`},{...id(h.name),[g]:i.getState()}),O)}),i.devtools={cleanup:()=>{p&&typeof p.unsubscribe=="function"&&p.unsubscribe(),VN(h.name,g)}};const w=(...S)=>{const k=x;x=!1,t(...S),x=k},v=r(i.setState,s,i);if(y.type==="untracked"?p?.init(v):(y.stores[y.store]=i,p?.init(Object.fromEntries(Object.entries(y.stores).map(([S,k])=>[S,S===y.store?v:k.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let S=!1;const k=i.dispatch;i.dispatch=(...A)=>{(zx?"production":void 0)!=="production"&&A[0].type==="__setState"&&!S&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),S=!0),k(...A)}}return p.subscribe(S=>{var k;switch(S.type){case"ACTION":if(typeof S.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return ih(S.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 O=A.state[g];if(O==null)return;JSON.stringify(i.getState())!==JSON.stringify(O)&&w(O);return}i.dispatchFromDevtools&&typeof i.dispatch=="function"&&i.dispatch(A)});case"DISPATCH":switch(S.payload.type){case"RESET":return w(v),g===void 0?p?.init(i.getState()):p?.init(id(h.name));case"COMMIT":if(g===void 0){p?.init(i.getState());return}return p?.init(id(h.name));case"ROLLBACK":return ih(S.state,A=>{if(g===void 0){w(A),p?.init(i.getState());return}w(A[g]),p?.init(id(h.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return ih(S.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}=S.payload,O=(k=A.computedStates.slice(-1)[0])==null?void 0:k.state;if(!O)return;w(g===void 0?O:O[g]),p?.send(null,A);return}case"PAUSE_RECORDING":return x=!x}return}}),v},ih=(r,e)=>{let t;try{t=JSON.parse(r)}catch(s){console.error("[zustand devtools middleware] Could not parse the received json",s)}t!==void 0&&e(t)},YN={maxHistorySize:50};function Fo(r="component"){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${r.toLowerCase().replace(/[^a-z0-9]/g,"_")}_${e}_${t}`}function oh(r,e){for(const t of r)if(typeof t!="string"&&(t.id===e||t.children&&oh(t.children,e)))return!0;return!1}function kr(r,e,t=null,s=[]){for(let i=0;i<r.length;i++){const o=r[i];if(typeof o!="string"){if(o.id===e)return{component:o,parentId:t,index:i,path:[...s,o.id]};if(o.children){const d=kr(o.children,e,o.id,[...s,o.id]);if(d)return d}}}return null}function Vo(r,e,t,s){return t?r.map(i=>{if(typeof i=="string")return i;if(i.id===t)switch(s){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===t?s==="before"?(o.push(e),o.push(f)):s==="after"?(o.push(f),o.push(e)):o.push(f):o.push(f)}const d=Vo(o,e,t,s);if(JSON.stringify(d)!==JSON.stringify(i.children))return{...i,children:d}}return i}):[...r,e]}function od(r,e){return r.filter(t=>typeof t=="string"?!0:t.id!==e).map(t=>typeof t=="string"?t:t.children?{...t,children:od(t.children,e)}:t)}function ld(r,e,t){return r.map(s=>{if(typeof s=="string")return s;if(s.id===e){const i=t.props?{...s.props,...t.props}:s.props;return{...s,...t,props:i}}return s.children?{...s,children:ld(s.children,e,t)}:s})}function cd(r,e,t,s){const i=kr(r,e);if(!i||e===t||JN(r,e,t))return r;const o=i.component,d=od(r,e);return Vo(d,o,t,s)}function JN(r,e,t){const s=kr(r,e);if(!s)return!1;const i=s.component;return i.children?oh(i.children,t):!1}function lh(r){const e={...r,id:Fo(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(t=>typeof t=="string"?t:lh(t))),e}function Hx(r,e){const t=kr(r,e);if(!t)return null;const s=lh(t.component);return{components:Vo(r,s,e,"after"),newId:s.id}}function ch(r,e){if(!e)return null;const t=e.split(".");let s=r;for(let i=0;i<t.length;i++){const o=t[i];if(o==="children")if(typeof s=="object"&&!Array.isArray(s)&&s.children)s=s.children;else return null;else{const d=parseInt(o,10);if(isNaN(d))return null;if(Array.isArray(s)){const g=s[d];if(!g||typeof g=="string")return null;s=g}else return null}}return typeof s=="object"&&!Array.isArray(s)&&"name"in s?s:null}function Ko(r,e){const t=ch(r,e);if(!t)return null;if(t.id)return{components:r,id:t.id};const s=Fo(t.name);return{components:Px(r,e,{id:s}),id:s}}function Px(r,e,t){if(!e)return r;const s=e.split(".");function i(o,d){const g=s[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===s.length-1){const y={...f,...t,props:t.props?{...f.props,...t.props}:f.props};return[...o.slice(0,h),y,...o.slice(h+1)]}if(s[d+1]==="children"&&f.children){const y=i(f.children,d+2),x={...f,children:y};return[...o.slice(0,h),x,...o.slice(h+1)]}return o}return i(r,0)}const St=nt("EditorState"),XN={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:YN.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 QN(r,e,t){const s=await fetch(`/api/admin/templates/${r}/layouts/${t}`);if(!s.ok)throw new Error(`Failed to fetch layout: ${s.status} ${s.statusText}`);return(await s.json()).data}async function ZN(r,e,t,s){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:t,description:s})});if(!i.ok)throw new Error(`Failed to save layout: ${i.status} ${i.statusText}`)}async function eE(r,e){const t=await fetch(`/api/admin/templates/${r}/layouts/${e}/versions`);if(!t.ok)throw new Error(`Failed to fetch versions: ${t.status} ${t.statusText}`);return(await t.json()).data.map(i=>({...i,createdAt:new Date(i.created_at)}))}async function tE(r,e,t){const s=await fetch(`/api/admin/templates/${r}/layouts/${e}/versions/${t}/restore`,{method:"POST",headers:{Accept:"application/json"}});if(!s.ok)throw new Error(`Failed to restore version: ${s.status} ${s.statusText}`);return(await s.json()).data}async function nE(r){const e=await fetch(`/api/templates/${r}/components.json`);if(!e.ok)throw new Error(`Failed to fetch component metadata: ${e.status}`);const t=await e.json();return{basic:t.components.basic||[],composite:t.components.composite||[],layout:t.components.layout||[],extension:[]}}const Se=EN()(WN(GN((r,e)=>({...XN,loadLayout:async(t,s,i)=>{r(o=>{o.loadingState="loading",o.error=null});try{const o=await QN(t,s,i),d=await nE(t);r(g=>{g.layoutData=o,g.originalLayoutData=JSON.parse(JSON.stringify(o)),g.templateId=t,g.templateType=s,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}),St.log("Layout loaded:",i)}catch(o){const d=o instanceof Error?o.message:"Unknown error";throw r(g=>{g.loadingState="error",g.error=d}),St.error("Failed to load layout:",d),o}},saveLayout:async t=>{const{templateId:s,layoutName:i,layoutData:o}=e();if(!s||!i||!o)throw new Error("No layout loaded");r(d=>{d.loadingState="saving"});try{await ZN(s,i,o,t),r(d=>{d.originalLayoutData=JSON.parse(JSON.stringify(o)),d.hasChanges=!1,d.lastSavedAt=new Date,d.loadingState="loaded"}),St.log("Layout saved:",i)}catch(d){const g=d instanceof Error?d.message:"Unknown error";throw r(h=>{h.loadingState="error",h.error=g}),St.error("Failed to save layout:",g),d}},publishLayout:async()=>{await e().saveLayout("Published");try{await fetch("/api/admin/cache/refresh",{method:"POST"}),St.log("Cache refreshed after publish")}catch(t){St.warn("Cache refresh failed:",t)}},resetLayout:()=>{const{originalLayoutData:t}=e();t&&r(s=>{s.layoutData=JSON.parse(JSON.stringify(t)),s.hasChanges=!1,s.selectedComponentId=null,s.hoveredComponentId=null})},setLayoutData:(t,s)=>{St.log("Setting layout data directly:",{layoutName:t.layout_name,componentsCount:t.components?.length||0,templateId:s}),r(i=>{i.layoutData=t,i.originalLayoutData=JSON.parse(JSON.stringify(t)),i.templateId=s,i.loadingState="loaded",i.hasChanges=!1,t.extends&&(i.inheritanceInfo={parentLayout:t.extends,inheritedSlots:[],overridableSlots:Object.keys(t.slots||{}),depth:1}),i.history=[],i.historyIndex=-1})},updateLayoutMeta:t=>{const{layoutData:s}=e();s&&(St.log("Updating layout meta:",t),r(i=>{i.layoutData&&(t.permissions!==void 0&&(i.layoutData.permissions=t.permissions),t.version!==void 0&&(i.layoutData.version=t.version),t.layout_name!==void 0&&(i.layoutData.layout_name=t.layout_name),t.extends!==void 0&&(i.layoutData.extends=t.extends),i.hasChanges=!0)}))},selectComponent:t=>{r(s=>{let i=t;if(t?.startsWith("auto_path:")&&s.layoutData){const o=t.substring(10),d=Ko(s.layoutData.components,o);d&&(d.components!==s.layoutData.components&&(s.layoutData.components=d.components,St.log("Auto-assigned component ID:",d.id,"at path:",o)),i=d.id)}if(s.selectedComponentId=i,i&&s.layoutData){const o=kr(s.layoutData.components,i);o&&o.path.forEach(d=>{s.expandedTreeNodes.includes(d)||s.expandedTreeNodes.push(d)})}})},hoverComponent:t=>{r(s=>{s.hoveredComponentId=t})},setHoveredComponentId:t=>{r(s=>{s.hoveredComponentId=t})},addComponent:(t,s,i)=>{const{layoutData:o}=e();o&&(e().pushHistory("Add component"),r(d=>{if(!d.layoutData)return;const g={...t,id:Fo(t.name)};d.layoutData.components=Vo(d.layoutData.components,g,s,i),d.hasChanges=!0,d.selectedComponentId=g.id}))},deleteComponent:t=>{const{layoutData:s}=e();s&&(e().pushHistory("Delete component"),r(i=>{i.layoutData&&(i.layoutData.components=od(i.layoutData.components,t),i.hasChanges=!0,i.selectedComponentId===t&&(i.selectedComponentId=null))}))},duplicateComponent:t=>{const{layoutData:s}=e();s&&(e().pushHistory("Duplicate component"),r(i=>{if(!i.layoutData)return;const o=Hx(i.layoutData.components,t);o&&(i.layoutData.components=o.components,i.hasChanges=!0,i.selectedComponentId=o.newId)}))},moveComponent:(t,s,i)=>{const{layoutData:o}=e();o&&(e().pushHistory("Move component"),r(d=>{d.layoutData&&(d.layoutData.components=cd(d.layoutData.components,t,s,i),d.hasChanges=!0)}))},updateComponentProps:(t,s)=>{const{layoutData:i}=e();i&&(e().pushHistory("Update props"),r(o=>{o.layoutData&&(o.layoutData.components=ld(o.layoutData.components,t,{props:{...s}}),o.hasChanges=!0)}))},updateComponent:(t,s)=>{const{layoutData:i}=e();i&&(e().pushHistory("Update component"),r(o=>{o.layoutData&&(o.layoutData.components=ld(o.layoutData.components,t,s),o.hasChanges=!0)}))},ensureComponentId:t=>{const{layoutData:s}=e();if(!s)return null;const i=Ko(s.components,t);return i?(i.components!==s.components&&(e().pushHistory("Auto-assign component ID"),r(o=>{o.layoutData&&(o.layoutData.components=i.components,o.hasChanges=!0)}),St.log("Component ID auto-assigned:",i.id,"at path:",t)),i.id):(St.warn("ensureComponentId failed: component not found at path",t),null)},ensureComponentIdAndMove:(t,s,i)=>{const{layoutData:o}=e();if(!o)return!1;St.log("ensureComponentIdAndMove called:",{path:t,targetId:s,position:i});const d=Ko(o.components,t);if(!d)return St.warn("ensureComponentIdAndMove failed: component not found at path",t),!1;const g=d.id;if(St.log("ensureComponentIdAndMove: sourceId =",g),g===s)return St.log("ensureComponentIdAndMove: source and target are the same, skipping"),!1;const h=kr(d.components,s);return St.log("ensureComponentIdAndMove: targetResult =",h?"found":"NOT FOUND"),h?(e().pushHistory("Move component"),r(f=>{if(!f.layoutData)return;const p=cd(d.components,g,s,i);St.log("ensureComponentIdAndMove: move result components count =",p.length),f.layoutData.components=p,f.hasChanges=!0}),St.log("ensureComponentIdAndMove success:",g,"->",s,i),!0):(St.warn("ensureComponentIdAndMove: target not found in components",s),!1)},moveComponentByPaths:(t,s,i)=>{const{layoutData:o}=e();if(!o)return!1;if(St.log("moveComponentByPaths called:",{sourcePath:t,targetPath:s,position:i}),t===s)return St.log("moveComponentByPaths: source and target paths are the same, skipping"),!1;const d=o.components,g=Ko(d,t);if(!g)return St.warn("moveComponentByPaths: source not found at path",t),!1;const h=g.id,f=Ko(g.components,s);if(!f)return St.warn("moveComponentByPaths: target not found at path",s),!1;const p=f.id;return St.log("moveComponentByPaths: sourceId =",h,", targetId =",p),h===p?(St.log("moveComponentByPaths: source and target are the same component, skipping"),!1):(e().pushHistory("Move component"),r(y=>{if(!y.layoutData)return;const x=cd(f.components,h,p,i);St.log("moveComponentByPaths: move result components count =",x.length),y.layoutData.components=x,y.hasChanges=!0}),St.log("moveComponentByPaths success:",h,"->",p,i),!0)},updateComponentByPath:(t,s)=>{const{layoutData:i}=e();i&&(e().pushHistory("Update component by path"),r(o=>{o.layoutData&&(o.layoutData.components=Px(o.layoutData.components,t,s),o.hasChanges=!0)}))},undo:()=>{r(t=>{if(t.historyIndex<0||t.history.length===0)return;if(t.historyIndex===t.history.length-1&&t.layoutData){const i={layoutData:JSON.parse(JSON.stringify(t.layoutData)),description:"Current state",timestamp:Date.now()};t.history.push(i)}const s=t.history[t.historyIndex];s&&(t.layoutData=JSON.parse(JSON.stringify(s.layoutData)),t.historyIndex-=1,t.hasChanges=!0)})},redo:()=>{r(t=>{if(t.historyIndex>=t.history.length-1)return;t.historyIndex+=1;const s=t.history[t.historyIndex+1];s&&(t.layoutData=JSON.parse(JSON.stringify(s.layoutData)),t.hasChanges=!0)})},pushHistory:t=>{r(s=>{if(!s.layoutData)return;s.history=s.history.slice(0,s.historyIndex+1);const i={layoutData:JSON.parse(JSON.stringify(s.layoutData)),description:t,timestamp:Date.now()};for(s.history.push(i),s.historyIndex=s.history.length-1;s.history.length>s.maxHistorySize;)s.history.shift(),s.historyIndex-=1})},setEditMode:t=>{r(s=>{s.editMode=t})},setPreviewDevice:(t,s)=>{r(i=>{i.previewDevice=t,s!==void 0&&(i.customWidth=s)})},togglePreviewDarkMode:()=>{r(t=>{t.previewDarkMode=!t.previewDarkMode})},loadVersions:async()=>{const{templateId:t,layoutName:s}=e();if(!(!t||!s))try{const i=await eE(t,s);r(o=>{o.versions=i})}catch(i){St.error("Failed to load versions:",i)}},restoreVersion:async t=>{const{templateId:s,layoutName:i}=e();if(!(!s||!i))try{const o=await tE(s,i,t);r(d=>{d.layoutData=o,d.hasChanges=!0}),St.log("Version restored:",t)}catch(o){throw St.error("Failed to restore version:",o),o}},compareVersions:async(t,s)=>[],addDataSource:t=>{e().pushHistory("Add data source"),r(s=>{s.layoutData&&(s.layoutData.data_sources||(s.layoutData.data_sources=[]),s.layoutData.data_sources.push(t),s.hasChanges=!0)})},updateDataSource:(t,s)=>{e().pushHistory("Update data source"),r(i=>{if(!i.layoutData?.data_sources)return;const o=i.layoutData.data_sources.findIndex(d=>d.id===t);o!==-1&&(i.layoutData.data_sources[o]={...i.layoutData.data_sources[o],...s},i.hasChanges=!0)})},deleteDataSource:t=>{e().pushHistory("Delete data source"),r(s=>{s.layoutData?.data_sources&&(s.layoutData.data_sources=s.layoutData.data_sources.filter(i=>i.id!==t),s.hasChanges=!0)})},testDataSource:async t=>({success:!0,data:{}}),setMockData:(t,s)=>{r(i=>{i.mockDataContext[t]=s})},addModal:t=>{e().pushHistory("Add modal"),r(s=>{s.layoutData&&(s.layoutData.modals||(s.layoutData.modals=[]),s.layoutData.modals.push(t),s.hasChanges=!0)})},updateModal:(t,s)=>{e().pushHistory("Update modal"),r(i=>{if(!i.layoutData?.modals)return;const o=i.layoutData.modals.findIndex(d=>d.id===t);o!==-1&&(i.layoutData.modals[o]={...i.layoutData.modals[o],...s},i.hasChanges=!0)})},deleteModal:t=>{e().pushHistory("Delete modal"),r(s=>{s.layoutData?.modals&&(s.layoutData.modals=s.layoutData.modals.filter(i=>i.id!==t),s.hasChanges=!0)})},setActivePropertyTab:t=>{r(s=>{s.activePropertyTab=t})},toggleTreeNode:t=>{r(s=>{const i=s.expandedTreeNodes.indexOf(t);i===-1?s.expandedTreeNodes.push(t):s.expandedTreeNodes.splice(i,1)})},copyToClipboard:t=>{r(s=>{s.clipboard=JSON.parse(JSON.stringify(t))})},pasteFromClipboard:(t,s)=>{const{clipboard:i}=e();if(!i)return;const o={...JSON.parse(JSON.stringify(i)),id:Fo(i.name)};e().addComponent(o,t,s)},startDrag:t=>{r(s=>{s.draggingComponent=t})},dragOver:(t,s)=>{r(i=>{i.dropTargetId=t,i.dropPosition=s})},endDrag:()=>{r(t=>{t.draggingComponent=null,t.dropTargetId=null,t.dropPosition=null})},saveExtensionOverride:async(t,s)=>{St.log("Save extension override:",t)},restoreExtensionOverride:async t=>{St.log("Restore extension override:",t)}})),{name:"WysiwygEditorState"})),dd=r=>r.historyIndex>=0,ud=r=>r.historyIndex<r.history.length-1,ls=nt("EditorContext"),sE=j.createContext(null),aE={autoSave:!1,autoSaveInterval:3e4,maxHistorySize:50,snapToGrid:!1,gridSize:8,keyboardShortcuts:!0,accessibilityMode:!1};function Ux({children:r,config:e,autoInitialize:t=!1,templateId:s,templateType:i,layoutName:o,layoutData:d,initialEditMode:g="visual"}){const h=Se(ee=>ee.loadLayout),f=Se(ee=>ee.setLayoutData),p=Se(ee=>ee.setEditMode),y=Se(ee=>ee.layoutData),x=Se(ee=>ee.selectedComponentId),w=Se(ee=>ee.loadingState),v=Se(ee=>ee.error),S=Se(ee=>ee.hasChanges),k=Se(ee=>ee.undo),A=Se(ee=>ee.redo),O=Se(ee=>ee.saveLayout),N=Se(ee=>ee.deleteComponent),D=Se(ee=>ee.duplicateComponent),$=Se(ee=>ee.copyToClipboard),M=Se(ee=>ee.pasteFromClipboard),z=Se(ee=>ee.clipboard),K=Se(dd),ye=Se(ud),we=j.useMemo(()=>({...aE,...e}),[e]),J=w==="loaded",ve=w==="loading",le=w==="saving",de=j.useMemo(()=>{if(!y||!x)return null;const ee=(X,se)=>{for(const R of X)if(typeof R!="string"){if(R.id===se)return R;if(R.children){const q=ee(R.children,se);if(q)return q}}return null};return ee(y.components,x)},[y,x]),je=j.useCallback(async(ee,X,se)=>{ls.log("Initializing editor:",{tid:ee,ttype:X,lname:se}),await h(ee,X,se)},[h]),W=j.useCallback(()=>{ls.log("Deactivating editor")},[]);j.useEffect(()=>{d&&!y&&(ls.log("Setting initial layout data from props",{layoutName:d.layout_name,componentsCount:d.components?.length||0}),f(d,s||"unknown"),p(g))},[d,y,s,g,f,p]),j.useEffect(()=>{t&&s&&i&&o&&!d&&je(s,i,o).catch(ee=>{ls.error("Auto-initialize failed:",ee)})},[t,s,i,o,je,d]),j.useEffect(()=>{if(!we.keyboardShortcuts||!J)return;const ee=X=>{const se=X.target;if(se.tagName==="INPUT"||se.tagName==="TEXTAREA"||se.isContentEditable)return;const q=navigator.platform.toUpperCase().indexOf("MAC")>=0?X.metaKey:X.ctrlKey;if(q&&X.key==="z"&&!X.shiftKey){X.preventDefault(),K&&(k(),ls.log("Undo triggered"));return}if(q&&X.key==="z"&&X.shiftKey||q&&X.key==="y"){X.preventDefault(),ye&&(A(),ls.log("Redo triggered"));return}if(q&&X.key==="s"){X.preventDefault(),S&&O().catch(re=>{ls.error("Save failed:",re)});return}if((X.key==="Delete"||X.key==="Backspace")&&x){X.preventDefault(),N(x),ls.log("Delete triggered");return}if(q&&X.key==="d"&&x){X.preventDefault(),D(x),ls.log("Duplicate triggered");return}if(q&&X.key==="c"&&de){X.preventDefault(),$(de),ls.log("Copy triggered");return}if(q&&X.key==="v"&&z&&x){X.preventDefault(),M(x,"after"),ls.log("Paste triggered");return}if(X.key==="Escape"){const re=Se.getState().selectComponent;re(null);return}};return window.addEventListener("keydown",ee),()=>{window.removeEventListener("keydown",ee)}},[we.keyboardShortcuts,J,K,ye,S,x,de,z,k,A,O,N,D,$,M]),j.useEffect(()=>{if(!we.autoSave||!J||!S)return;const ee=setTimeout(()=>{O("Auto-save").catch(X=>{ls.error("Auto-save failed:",X)})},we.autoSaveInterval);return()=>{clearTimeout(ee)}},[we.autoSave,we.autoSaveInterval,J,S,O]),j.useEffect(()=>{if(!S)return;const ee=X=>{X.preventDefault(),X.returnValue=""};return window.addEventListener("beforeunload",ee),()=>{window.removeEventListener("beforeunload",ee)}},[S]);const he=j.useMemo(()=>({isEditorActive:J,config:we,initialize:je,deactivate:W,selectedComponent:de,layoutData:y,canUndo:K,canRedo:ye,hasChanges:S,isLoading:ve,isSaving:le,error:v}),[J,we,je,W,de,y,K,ye,S,ve,le,v]);return l.jsx(sE.Provider,{value:he,children:r})}const rE=500;function dh(r={}){const{debounceMs:e=rE}=r,t=Se(M=>M.history),s=Se(M=>M.historyIndex),i=Se(M=>M.undo),o=Se(M=>M.redo),d=Se(M=>M.pushHistory),g=Se(dd),h=Se(ud),f=j.useRef(null),p=j.useRef(null),y=j.useRef(null),x=j.useRef(!1),w=j.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),Se.setState({history:[],historyIndex:-1})},[]),v=j.useCallback(M=>{if(M<0||M>=t.length)return;const z=t[M];z&&Se.setState({layoutData:JSON.parse(JSON.stringify(z.layoutData)),historyIndex:M,hasChanges:!0})},[t]),S=j.useCallback(M=>{x.current||(f.current&&clearTimeout(f.current),p.current===M?f.current=setTimeout(()=>{d(M),f.current=null},e):(d(M),p.current=M))},[d,e]),k=j.useCallback(M=>{x.current||(x.current=!0,y.current=M,f.current&&(clearTimeout(f.current),f.current=null))},[]),A=j.useCallback(()=>{if(!x.current)return;const M=y.current||"Batch update";d(M),x.current=!1,y.current=null},[d]),O=j.useMemo(()=>s<0||s>=t.length?null:t[s],[t,s]),N=t.length,D=s+1,$=t.length-s-1;return{history:t,historyIndex:s,canUndo:g,canRedo:h,undo:i,redo:o,pushHistory:d,pushHistoryDebounced:S,startBatch:k,endBatch:A,isBatching:x.current,clearHistory:w,goToHistory:v,currentEntry:O,historySize:N,undoStackSize:D,redoStackSize:$}}const iE=({value:r,onChange:e,disabled:t=!1,placeholder:s="권한을 선택하세요"})=>{const[i,o]=j.useState({}),[d,g]=j.useState(!0),[h,f]=j.useState(null),[p,y]=j.useState(new Set(["admin"])),[x,w]=j.useState("");j.useEffect(()=>{(async()=>{try{g(!0),f(null);const M=await fetch("/api/admin/permissions",{headers:{Authorization:`Bearer ${localStorage.getItem("auth_token")}`,Accept:"application/json"}});if(!M.ok)throw new Error(`HTTP ${M.status}`);const z=await M.json();o(z.data?.data?.permissions||{})}catch(M){console.error("권한 목록 조회 실패:",M),f("권한 목록을 불러올 수 없습니다")}finally{g(!1)}})()},[]);const v=j.useCallback($=>{t||(r.includes($)?e(r.filter(M=>M!==$)):e([...r,$]))},[r,e,t]),S=j.useCallback($=>{y(M=>{const z=new Set(M);return z.has($)?z.delete($):z.add($),z})},[]),k=j.useCallback(()=>{if(t)return;const $=[],M=z=>{z.forEach(K=>{$.push(K.identifier),K.children?.length&&M(K.children)})};Object.values(i).forEach(z=>{z.permissions&&M(z.permissions)}),e($)},[i,e,t]),A=j.useCallback(()=>{t||e([])},[e,t]),O=j.useCallback($=>{if(!x.trim())return $;const M=x.toLowerCase(),z=K=>{const ye=K.name.toLowerCase().includes(M),we=K.identifier.toLowerCase().includes(M),J=K.children?.map(z).filter(Boolean);return ye||we||J&&J.length>0?{...K,children:J}:null};return $.map(z).filter(Boolean)},[x]),N=($,M=0)=>{const z=r.includes($.identifier),K=$.children&&$.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
|
||
${t?"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+M*16}px`},children:[l.jsx("input",{type:"checkbox",checked:z,onChange:()=>v($.identifier),disabled:t,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:[$.name,l.jsxs("span",{className:"ml-2 text-xs text-gray-500 dark:text-gray-400",children:["(",$.identifier,")"]})]})]}),K&&$.children?.map(ye=>N(ye,M+1))]},$.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:t,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",children:"전체 선택"}),l.jsx("button",{type:"button",onClick:A,disabled:t||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:x,onChange:$=>w($.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])=>{const z=O(M.permissions||[]);if(x&&z.length===0)return null;const K=p.has($);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:()=>S($),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:K?"▼":"▶"}),l.jsx("span",{children:M.label}),l.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-auto",children:[z.length,"개"]})]}),K&&l.jsx("div",{className:"pb-2",children:z.map(ye=>N(ye))})]},$)})}),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($=>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:$,children:[$,l.jsx("button",{type:"button",onClick:()=>v($),disabled:t,className:"hover:text-red-500",children:"×"})]},$)),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 조건으로 적용됩니다."})]})},oE=nt("LayoutSettingsModal");function lE({isOpen:r,onClose:e}){const t=Se(x=>x.layoutData),s=Se(x=>x.updateLayoutMeta),i=Se(x=>x.pushHistory),[o,d]=j.useState([]),[g,h]=j.useState(!1);j.useEffect(()=>{t&&r&&(d(t.permissions||[]),h(!1))},[t,r]);const f=j.useCallback(x=>{d(x),h(!0)},[]),p=j.useCallback(()=>{t&&(oE.log("Saving layout permissions:",o),i("레이아웃 권한 변경"),s({permissions:o}),h(!1),e())},[t,o,i,s,e]),y=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:y}),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:"레이아웃 설정"}),t&&l.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:[t.layout_name,t.version&&l.jsxs("span",{className:"ml-2 text-xs bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:["v",t.version]})]})]}),l.jsx("button",{onClick:y,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:t?.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:t?.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:t?.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:[t?.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(iE,{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:y,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 xi=nt("Toolbar");function uh({icon:r,label:e,onClick:t,disabled:s=!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:t,disabled:s||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 gh({icon:r,label:e,onClick:t,disabled:s=!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:t,disabled:s,title:e,children:l.jsx("span",{children:r})})}function cE({currentMode:r,onChange:e}){const t=[{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:t.map(s=>l.jsxs("button",{className:`flex items-center gap-1 px-3 py-1 text-sm rounded transition-colors ${r===s.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(s.id),title:`${s.label} 모드`,children:[l.jsx("span",{children:s.icon}),l.jsx("span",{className:"hidden md:inline",children:s.label})]},s.id))})}function dE({hasChanges:r,isSaving:e,lastSaved:t}){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:"변경사항 있음"})]}):t?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:["(",t.toLocaleTimeString(),")"]})]}):null}function uE({currentVersion:r,onVersionSelect:e}){const[t,s]=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:()=>s(!t),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:t?"▲":"▼"})]}),t&&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 Bx({className:r="",onClose:e,onSaveComplete:t}){const s=Se(we=>we.layoutData),i=Se(we=>we.editMode),o=Se(we=>we.hasChanges),d=Se(we=>we.loadingState),g=Se(we=>we.setEditMode),h=Se(we=>we.saveLayout),f=Se(dd),p=Se(ud),{undo:y,redo:x,undoStackSize:w,redoStackSize:v}=dh(),[S,k]=j.useState(void 0),[A,O]=j.useState(!1),N=d==="saving",D=j.useCallback(async()=>{try{await h("Manual save"),k(new Date),t?.(),xi.log("Layout saved")}catch(we){xi.error("Save failed:",we)}},[h,t]),$=j.useCallback(()=>{f&&(y(),xi.log("Undo performed"))},[f,y]),M=j.useCallback(()=>{p&&(x(),xi.log("Redo performed"))},[p,x]),z=j.useCallback(()=>{o&&!window.confirm("저장되지 않은 변경사항이 있습니다. 정말 닫으시겠습니까?")||e?.()},[o,e]),K=j.useCallback(async()=>{xi.log("Publish requested"),alert("발행 기능은 Phase 4에서 구현됩니다.")},[]),ye=j.useCallback(we=>{xi.log("Version selected:",we)},[]);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:"위지윅 편집기"}),s&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.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(gh,{icon:"↩️",label:`실행 취소 (${w})`,onClick:$,disabled:!f}),l.jsx(gh,{icon:"↪️",label:`다시 실행 (${v})`,onClick:M,disabled:!p})]}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsx(cE,{currentMode:i,onChange:g})]}),l.jsx("div",{className:"flex-1 flex justify-center",children:l.jsx(dE,{hasChanges:o,isSaving:N,lastSaved:S})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(uh,{icon:"⚙️",label:"환경설정",onClick:()=>O(!0)}),l.jsx(uE,{currentVersion:s?.version,onVersionSelect:ye}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsx(uh,{icon:"💾",label:"저장",onClick:D,disabled:!o,loading:N}),l.jsx(uh,{icon:"🚀",label:"발행",onClick:K,variant:"primary",disabled:o}),l.jsx("div",{className:"h-6 w-px bg-gray-200 dark:bg-gray-700"}),l.jsx(gh,{icon:"✕",label:"닫기",onClick:z})]}),l.jsx(lE,{isOpen:A,onClose:()=>O(!1)})]})}const bi=nt("LayoutTree");function gE(r){const e=r.split(".");return e.length===1?e[0]:e[0]+e.slice(1).map(t=>`.children.${t}`).join("")}function qx(r,e,t=""){for(let s=0;s<r.length;s++){const i=r[s];if(typeof i=="string")continue;const o=t?`${t}.${s}`:`${s}`,d=i.id||`tree_${o}`;if(d===e||i.id===e)return[d];if(i.children&&i.children.length>0){const g=qx(i.children,e,o);if(g)return[d,...g]}}return null}function hE(r,e){const t=r.props?._extensionSource,s=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:!!t,extensionSource:t,childCount:s,depth:e}}function fE(r){switch(r){case"basic":return"📦";case"composite":return"🧩";case"layout":return"📐";case"extension_point":return"🔌";default:return"📄"}}function pE(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 mE=Ke.memo(function r({component:e,depth:t,treePath:s,enableDragDrop:i,expandedNodes:o,onToggleExpand:d,onNodeClick:g,onNodeDoubleClick:h,onDragStart:f,onDragOver:p,onDrop:y,onDragEnd:x,draggedNodeId:w,dropTargetId:v,dropPosition:S}){const k=Se(se=>se.selectedComponentId),A=Se(se=>se.hoveredComponentId),O=Se(se=>se.setHoveredComponentId),N=e.id||`tree_${s}`,D=j.useMemo(()=>hE(e,t),[e,t]),$=e.children&&e.children.length>0,M=o.has(N),z=j.useMemo(()=>k?k===N||k===e.id:!1,[k,N,e.id]),K=A===N,ye=w===N,we=v===N,J=j.useCallback(se=>{se.stopPropagation(),g?.(N)},[N,g]),ve=j.useCallback(se=>{se.stopPropagation(),h?.(N)},[N,h]),le=j.useCallback(se=>{se.stopPropagation(),d(N)},[N,d]),de=j.useCallback(()=>{O(N)},[N,O]),je=j.useCallback(()=>{O(null)},[O]),W=j.useCallback(se=>{i&&f(se,N)},[N,i,f]),he=j.useCallback(se=>{i&&(se.preventDefault(),p(se,N))},[N,i,p]),ee=j.useCallback(se=>{if(!i)return;se.preventDefault();const R=se.currentTarget.getBoundingClientRect(),q=se.clientY-R.top,re=R.height;let xe;q<re*.25?xe="before":q>re*.75?xe="after":xe="inside",y(se,N,xe)},[N,i,y]),X=j.useMemo(()=>{const se=["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?se.push("bg-blue-100 dark:bg-blue-900"):K&&se.push("bg-gray-50 dark:bg-gray-800"),ye&&se.push("opacity-50"),we&&(S==="before"?se.push("border-t-2 border-blue-500"):S==="after"?se.push("border-b-2 border-blue-500"):S==="inside"&&se.push("ring-2 ring-blue-500")),se.join(" ")},[z,K,ye,we,S]);return l.jsxs("div",{className:"select-none",children:[l.jsxs("div",{className:X,style:{paddingLeft:`${t*16+8}px`},onClick:J,onDoubleClick:ve,onMouseEnter:de,onMouseLeave:je,draggable:i,onDragStart:W,onDragOver:he,onDrop:ee,onDragEnd:x,role:"treeitem","aria-selected":z,"aria-expanded":$?M:void 0,children:[$?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:le,"aria-label":M?"접기":"펼치기",children:M?"▼":"▶"}):l.jsx("span",{className:"w-4"}),l.jsx("span",{className:"text-sm",title:D.type,children:fE(D.type)}),l.jsx("span",{className:`text-sm font-medium ${pE(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.jsx("div",{role:"group",children:e.children.map((se,R)=>{if(typeof se=="string")return null;const q=`${s}.${R}`,re=se.id||`tree_${q}`;return l.jsx(r,{component:se,depth:t+1,treePath:q,enableDragDrop:i,expandedNodes:o,onToggleExpand:d,onNodeClick:g,onNodeDoubleClick:h,onDragStart:f,onDragOver:p,onDrop:y,onDragEnd:x,draggedNodeId:w,dropTargetId:v,dropPosition:S},re)})})]})}),yE=Ke.memo(function({x:e,y:t,nodeId:s,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),y=j.useMemo(()=>{if(!p)return null;const k=A=>{for(const O of A)if(typeof O!="string"){if(O.id===s)return O;if(O.children){const N=k(O.children);if(N)return N}}return null};return k(p.components)},[p,s]),x=j.useCallback(()=>{y&&(g(y),bi.log("Copied component:",s)),i()},[y,g,s,i]),w=j.useCallback(()=>{f&&(h(s,"inside"),bi.log("Pasted component inside:",s)),i()},[f,h,s,i]),v=j.useCallback(()=>{d(s),bi.log("Duplicated component:",s),i()},[d,s,i]),S=j.useCallback(()=>{o(s),bi.log("Deleted component:",s),i()},[o,s,i]);return Ke.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:t},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:x,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:S,children:"🗑️ 삭제"})]})});function Gx({className:r="",showContextMenu:e=!0,enableDragDrop:t=!0,onNodeClick:s,onNodeDoubleClick:i}){const o=Se(J=>J.layoutData),d=Se(J=>J.selectComponent),g=Se(J=>J.moveComponent),h=Se(J=>J.selectedComponentId),[f,p]=j.useState(new Set),[y,x]=j.useState(null),[w,v]=j.useState(null),[S,k]=j.useState(null),[A,O]=j.useState({visible:!1,x:0,y:0,nodeId:null});Ke.useEffect(()=>{if(o){const J=new Set;o.components.forEach((ve,le)=>{if(typeof ve!="string"){const je=ve.id||`tree_${le}`;J.add(je)}}),p(J)}},[o?.layout_name]),Ke.useEffect(()=>{if(!h||!o)return;const J=qx(o.components,h);J&&J.length>0&&p(ve=>{const le=new Set(ve);return J.slice(0,-1).forEach(de=>le.add(de)),le})},[h,o]);const N=j.useCallback(J=>{p(ve=>{const le=new Set(ve);return le.has(J)?le.delete(J):le.add(J),le})},[]),D=j.useCallback(J=>{let ve=J;if(J.startsWith("tree_")){const le=J.substring(5);ve=`auto_path:${gE(le)}`}d(ve),s?.(ve)},[d,s]),$=j.useCallback(J=>{if(!e)return;J.preventDefault();const le=J.target.closest('[role="treeitem"]');if(le){const de=le.getAttribute("data-node-id");de&&O({visible:!0,x:J.clientX,y:J.clientY,nodeId:de})}},[e]),M=j.useCallback((J,ve)=>{x(ve),J.dataTransfer.effectAllowed="move",J.dataTransfer.setData("text/plain",ve),bi.log("Drag start:",ve)},[]),z=j.useCallback((J,ve)=>{if(y===ve)return;const le=J.target.getBoundingClientRect(),de=J.clientY-le.top,je=le.height;let W;de<je*.25?W="before":de>je*.75?W="after":W="inside",v(ve),k(W)},[y]),K=j.useCallback((J,ve,le)=>{y&&y!==ve&&(g(y,ve,le),bi.log("Dropped:",y,"to",ve,le)),x(null),v(null),k(null)},[y,g]),ye=j.useCallback(()=>{x(null),v(null),k(null)},[]),we=j.useCallback(()=>{O({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:$,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((J,ve)=>{if(typeof J=="string")return null;const le=J,de=`${ve}`,je=le.id||`tree_${de}`;return l.jsx(mE,{component:le,depth:0,treePath:de,enableDragDrop:t,expandedNodes:f,onToggleExpand:N,onNodeClick:D,onNodeDoubleClick:i,onDragStart:M,onDragOver:z,onDrop:K,onDragEnd:ye,draggedNodeId:y,dropTargetId:w,dropPosition:S},je)})}),A.visible&&A.nodeId&&l.jsx(yE,{x:A.x,y:A.y,nodeId:A.nodeId,onClose:we})]}):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=nt("PreviewCanvas"),hh={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 xE({currentDevice:r,customWidth:e,onDeviceChange:t,onCustomWidthChange:s}){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=hh[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:()=>t(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=>s(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 bE({zoom:r,onZoomChange:e}){const t=[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:s=>e(parseInt(s.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:t.map(s=>l.jsxs("option",{value:s,children:[s,"%"]},s))}),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 vE({targetId:r,position:e,containerRef:t}){const[s,i]=j.useState(null);return j.useEffect(()=>{if(!r||!e||!t.current){i(null);return}const o=t.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,t]),!s||!e?null:e==="before"?l.jsx("div",{className:"absolute h-1 bg-blue-500 rounded pointer-events-none z-50",style:{left:s.x,top:s.y-2,width:s.width}}):e==="after"?l.jsx("div",{className:"absolute h-1 bg-blue-500 rounded pointer-events-none z-50",style:{left:s.x,top:s.y+s.height,width:s.width}}):l.jsx("div",{className:"absolute border-2 border-dashed border-blue-500 rounded pointer-events-none z-50",style:{left:s.x,top:s.y,width:s.width,height:s.height}})}function Fx(r,e){return r.querySelector(`[data-editor-id="${e}"]`)}function wE({selectedId:r,hoveredId:e,containerRef:t,zoom:s}){const[i,o]=j.useState(null),[d,g]=j.useState(null);return j.useEffect(()=>{if(!t.current)return;const h=()=>{const k=t.current;if(!k)return;const A=k.getBoundingClientRect(),O=k.scrollLeft,N=k.scrollTop;if(r){const D=Fx(k,r);if(D){const $=D.getBoundingClientRect();o(new DOMRect($.left-A.left+O,$.top-A.top+N,$.width,$.height))}else o(null)}else o(null);if(e&&e!==r){const D=Fx(k,e);if(D){const $=D.getBoundingClientRect();g(new DOMRect($.left-A.left+O,$.top-A.top+N,$.width,$.height))}else g(null)}else g(null)};h();let f,p=null;const y=350,x=k=>{p===null&&(p=k);const A=k-p;h(),A<y&&(f=requestAnimationFrame(x))};f=requestAnimationFrame(x);const w=new ResizeObserver(h);w.observe(t.current);const v=t.current;v.addEventListener("scroll",h),window.addEventListener("scroll",h,!0);const S=new MutationObserver(h);return S.observe(v,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(f),w.disconnect(),S.disconnect(),v?.removeEventListener("scroll",h),window.removeEventListener("scroll",h,!0)}},[r,e,t,s]),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 SE(){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 CE(){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 jE({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 kE({width:r,zoom:e,children:t}){const s=e/100,i=r*s;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(${s})`,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:t})]})}function fh({className:r="",showOverlay:e=!0,onComponentSelect:t,onComponentHover:s,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),y=Se(Ce=>Ce.selectedComponentId),x=Se(Ce=>Ce.hoveredComponentId),w=Se(Ce=>Ce.setPreviewDevice),v=Se(Ce=>Ce.selectComponent),S=Se(Ce=>Ce.setHoveredComponentId),k=Se(Ce=>Ce.mockDataContext),A=Se(Ce=>Ce.templateId),O=Se(Ce=>Ce.moveComponent),N=Se(Ce=>Ce.startDrag),D=Se(Ce=>Ce.dragOver),$=Se(Ce=>Ce.endDrag),M=Se(Ce=>Ce.dropTargetId),z=Se(Ce=>Ce.dropPosition),K=Se(Ce=>Ce.ensureComponentIdAndMove),ye=Se(Ce=>Ce.moveComponentByPaths),[we,J]=j.useState(100),[ve,le]=j.useState(!1),de=j.useRef(null),je=50,W=8,he=j.useRef(null),ee=j.useRef(null),X=j.useRef(null),se=j.useRef(null),R=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{he.current||(he.current=vs.getInstance(),A&&await he.current.loadComponents(A,"user")),ee.current||(ee.current=new An),X.current||(X.current=br.getInstance()),!se.current&&X.current&&(se.current=new Co({},X.current,R)),le(!0),yn.log("Editor engines initialized")}catch(Ge){yn.error("Failed to initialize engines:",Ge)}})()},[A,R]);const re=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 _t=`auto_path:${bt}`;v(_t),t?.(_t),yn.log("Component selected via DynamicRenderer:",Ce,"-> path:",bt);return}}v(Ce),t?.(Ce),yn.log("Component selected via DynamicRenderer:",Ce)},[v,t]),xe=j.useCallback((Ce,Ge)=>{yn.log("handleDynamicHover called:",Ce),S(Ce),s?.(Ce)},[S,s]),oe=j.useCallback((Ce,Ge)=>{if(!d){Ge.dataTransfer.effectAllowed="none";return}if(Ce.startsWith("auto_")){const mt=Ge.target.closest("[data-editor-path]")?.getAttribute("data-editor-path");if(mt){const tt=ch(d.components,mt);if(tt){N(tt),Ge.dataTransfer.effectAllowed="move",Ge.dataTransfer.setData("text/plain",`path:${mt}`),yn.log("Drag started (path-based):",mt);return}}yn.warn("Auto-generated component without valid path:",Ce),Ge.dataTransfer.effectAllowed="none";return}const at=(bt,_t)=>{for(const mt of bt){if(typeof mt=="string")continue;const tt=mt;if(tt.id===_t)return tt;if(tt.children){const vn=at(tt.children,_t);if(vn)return vn}}return null},pt=at(d.components,Ce);pt?(N(pt),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]),ke=j.useCallback(Ce=>{de.current&&(cancelAnimationFrame(de.current),de.current=null),$(),yn.log("Drag ended")},[$]),Oe=j.useMemo(()=>f==="custom"?p:hh[f].width,[f,p]),De=j.useCallback(Ce=>{w(Ce),yn.log("Device changed:",Ce)},[w]),qe=j.useCallback(Ce=>{w("custom",Ce),yn.log("Custom width changed:",Ce)},[w]),Ie=j.useCallback(Ce=>{const Ge=Ce.target;let at=null;if(Ge.hasAttribute("data-editor-id")?at=Ge:at=Ge.closest("[data-editor-id]"),at){const pt=at.getAttribute("data-editor-id");pt&&(v(pt),t?.(pt),yn.log("Component selected:",pt))}else v(null),t?.(null)},[v,t]),Nt=j.useCallback(Ce=>{const Ge=Ce.target;let at=null;if(Ge.hasAttribute("data-editor-id")?at=Ge:at=Ge.closest("[data-editor-id]"),at){const pt=at.getAttribute("data-editor-id");pt&&pt!==x&&(S(pt),s?.(pt))}},[x,S,s]),Rt=j.useCallback(()=>{S(null),s?.(null)},[S,s]),Xt=j.useCallback(Ce=>{Ce.preventDefault();const Ge=Ce.dataTransfer.getData("text/plain"),pt=Ce.target.closest("[data-editor-id]");if(pt&&Ge){let bt=pt.getAttribute("data-editor-id");const _t=pt.getAttribute("data-editor-path");if(bt?.startsWith("auto_")&&_t&&d?.components){const un=d.components,Rs=ch(un,_t);Rs?.id?bt=Rs.id:yn.log("Target is auto ID, will use path-based move")}const mt=pt.getBoundingClientRect(),tt=Ce.clientY-mt.top,vn=mt.height;let wt;tt<vn*.25?wt="before":tt>vn*.75?wt="after":wt="inside";const Tt=Ge.startsWith("path:"),qt=Tt?Ge.substring(5):null,Jn=bt?.startsWith("auto_");Tt&&_t&&Jn?(yn.log("Both source and target are path-based:",qt,"->",_t),qt&&_t&&qt!==_t&&ye(qt,_t,wt)&&(i?.(bt||"",wt),yn.log("Component moved (both path-based):",qt,"->",_t,wt))):Tt&&bt&&!Jn?qt&&K(qt,bt,wt)&&(i?.(bt,wt),yn.log("Component moved (source path, target id):",qt,"->",bt,wt)):!Tt&&bt&&Ge!==bt&&(O(Ge,bt,wt),i?.(bt,wt),yn.log("Component moved (id-based):",Ge,"->",bt,wt))}$()},[d,O,$,i,K,ye]),Mt=j.useCallback((Ce,Ge)=>{if(de.current)return;const at=()=>{Ce.scrollTop+=Ge,de.current=requestAnimationFrame(at)};de.current=requestAnimationFrame(at)},[]),Qt=j.useCallback(()=>{de.current&&(cancelAnimationFrame(de.current),de.current=null)},[]),Et=j.useCallback(Ce=>{Ce.preventDefault(),Ce.dataTransfer.dropEffect="move";const Ge=o.current;if(!Ge)return;const at=Ge.getBoundingClientRect(),pt=Ce.clientY;pt-at.top<je?Mt(Ge,-W):at.bottom-pt<je?Mt(Ge,W):Qt();const _t=Ce.target.closest("[data-editor-id]");if(_t){const mt=_t.getAttribute("data-editor-id");if(mt){const tt=_t.getBoundingClientRect(),vn=Ce.clientY-tt.top,wt=tt.height;let Tt;vn<wt*.25?Tt="before":vn>wt*.75?Tt="after":Tt="inside",D(mt,Tt)}}},[D,Mt,Qt,je,W]),Dn=()=>g==="loading"?l.jsx(CE,{}):h?l.jsx(jE,{message:h}):d?!ve||!he.current||!ee.current||!X.current||!se.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(Lc,{translationEngine:X.current,translationContext:R,children:l.jsx(fg,{children:l.jsx(pg,{overrideWidth:Oe,children:l.jsx($g,{children:d.components.map((Ce,Ge)=>{if(typeof Ce=="string")return null;const at=Ce;return l.jsx(Vs,{componentDef:at,dataContext:q,translationContext:R,onDragStart:oe,onDragEnd:ke,registry:he.current,bindingEngine:ee.current,translationEngine:X.current,actionDispatcher:se.current,isEditMode:!0,onComponentSelect:re,onComponentHover:xe,isRootRenderer:!0,componentPath:`${Ge}`},at.id||`component-${Ge}`)})})})})}):l.jsx(SE,{});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(xE,{currentDevice:f,customWidth:p,onDeviceChange:De,onCustomWidthChange:qe}),l.jsx(bE,{zoom:we,onZoomChange:J})]}),l.jsxs("div",{ref:o,className:"flex-1 overflow-auto p-8 relative",onClick:Ie,onMouseMove:Nt,onMouseLeave:Rt,onDrop:Xt,onDragOver:Et,children:[l.jsx(kE,{width:Oe,zoom:we,children:Dn()}),e&&d&&l.jsx(wE,{selectedId:y,hoveredId:x,containerRef:o,zoom:we}),M&&l.jsx(vE,{targetId:M,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:hh[f].width,"px"]}),l.jsxs("span",{children:["Zoom: ",we,"%"]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[y&&l.jsxs("span",{children:["선택됨: ",l.jsx("span",{className:"text-blue-500",children:y})]}),d&&l.jsxs("span",{children:[d.components.length,"개 컴포넌트"]})]})]})]})}const Vx={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 Wo(){const r=Se(y=>y.componentCategories),e=Se(y=>y.handlers),t=j.useMemo(()=>r?[...r.basic,...r.composite,...r.layout]:[],[r]),s=j.useMemo(()=>r?.extension||[],[r]),i=j.useCallback(y=>t.find(x=>x.name===y)||null,[t]),o=j.useCallback(y=>{if(Vx[y])return Vx[y];const x=i(y);return x?.props?x.props.map(w=>({name:w,type:"text",label:w,allowBinding:!0})):[{name:"className",type:"className",label:"CSS 클래스",allowBinding:!0}]},[i]),d=j.useCallback(y=>{const x=y.toLowerCase(),w=t.filter(S=>S.name.toLowerCase().includes(x)||S.description?.toLowerCase().includes(x)),v=s.filter(S=>S.name.toLowerCase().includes(x)||S.description?.toLowerCase().includes(x)||S.source.toLowerCase().includes(x));return[...w,...v]},[t,s]),g=j.useCallback(y=>r?y==="extension"?r.extension:r[y]:[],[r]),h=j.useCallback(y=>{const x=i(y);return x?.allowsChildren!==void 0?x.allowsChildren:x?.type==="layout"||x?.type==="composite"?!0:["Div","Span","Button","Form","Label","Link"].includes(y)},[i]),f=j.useCallback(y=>e.find(x=>x.name===y)||null,[e]),p=j.useCallback(y=>e.filter(x=>x.category===y),[e]);return{categories:r,allComponents:t,extensionComponents:s,handlers:e,getMetadata:i,getPropsSchema:o,searchComponents:d,filterByCategory:g,allowsChildren:h,getHandler:f,filterHandlersByCategory:p}}const Kx=nt("PropsEditor");function Wx({schema:r,value:e,onChange:t}){const[s,i]=j.useState(typeof e=="string"&&e.includes("{{")),o=j.useCallback(h=>{t(h.target.value)},[t]),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 ${s?"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(!s),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}),s&&l.jsxs("p",{className:"mt-1 text-xs text-blue-600 dark:text-blue-400",children:["바인딩 예시: ","{{users.data[0].name}}"]})]})}function NE({schema:r,value:e,onChange:t}){const s=j.useCallback(o=>{const d=parseFloat(o.target.value);t(isNaN(d)?void 0:d)},[t]),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:s,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 EE({schema:r,value:e,onChange:t}){const s=j.useCallback(o=>{t(o.target.checked)},[t]),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:s,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 _E({schema:r,value:e,onChange:t}){const s=j.useCallback(d=>{t(d.target.value||void 0)},[t]),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:s,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 AE({schema:r,value:e,onChange:t}){const s=j.useCallback(o=>{t(o.target.value)},[t]),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:s,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:s,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 TE({schema:r,value:e,onChange:t}){const s=j.useCallback(d=>{t(d.target.value)},[t]),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:s,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 DE({schema:r,value:e,onChange:t}){j.useCallback(i=>{t(i.target.value)},[t]);const s=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:s.replace(/^\{\{|\}\}$/g,""),onChange:i=>t(`{{${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 Yx({schema:r,value:e,onChange:t}){const[s,i]=j.useState(null),o=j.useCallback(g=>{const h=g.target.value;try{const f=JSON.parse(h);t(f),i(null)}catch{i("유효한 JSON이 아닙니다")}},[t]),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 ${s?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600"}`}),s&&l.jsx("p",{className:"mt-1 text-xs text-red-500 dark:text-red-400",children:s}),r.description&&!s&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r.description})]})}function RE(r,e,t){const s={schema:r,value:e,onChange:t};switch(r.type){case"text":case"textarea":return l.jsx(Wx,{...s});case"number":return l.jsx(NE,{...s});case"boolean":return l.jsx(EE,{...s});case"select":return l.jsx(_E,{...s});case"color":return l.jsx(AE,{...s});case"className":return l.jsx(TE,{...s});case"expression":return l.jsx(DE,{...s});case"object":return l.jsx(Yx,{...s});default:return l.jsx(Wx,{...s})}}function Jx({component:r,onChange:e}){const{getPropsSchema:t}=Wo(),s=j.useMemo(()=>t(r.name),[r.name,t]),i=r.props||{},o=j.useCallback((g,h)=>{const f={...i,[g]:h};(h===void 0||h==="")&&delete f[g],e({props:f}),Kx.log("Prop changed:",g,h)},[i,e]),d=j.useCallback(g=>{e({text:g||void 0}),Kx.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"}),s.length>0?s.map(g=>l.jsx("div",{children:RE(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(Yx,{schema:{name:"props",type:"object",label:"Props",description:"컴포넌트의 모든 속성을 JSON으로 직접 편집"},value:i,onChange:g=>{typeof g=="object"&&g!==null&&e({props:g})}})]})]})}function ph(r){const e=r.match(/\{\{(.+?)\}\}/);return e?e[1].trim():null}function gd(r){return typeof r=="string"&&r.includes("{{")}function mh(r){return`{{${r}}}`}function OE({sources:r,selectedPath:e,onSelect:t}){const[s,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(s===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:s===o.id?"▼":"▶"})]}),s===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:()=>t(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 LE({isOpen:r,propKey:e,currentValue:t,sources:s,onSave:i,onCancel:o}){const[d,g]=j.useState("simple"),[h,f]=j.useState(()=>ph(t)||""),[p,y]=j.useState(()=>ph(t)||""),x=j.useCallback(()=>{const v=d==="simple"?h:p;i(v?mh(v):"")},[d,h,p,i]),w=j.useCallback(v=>{f(v),y(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(OE,{sources:s,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:mh(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=>y(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:mh(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:x,children:"적용"})]})]})}):null}function ME({binding:r,onEdit:e,onRemove:t}){const s=ph(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}),s&&l.jsxs("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:["경로: ",l.jsx("code",{className:"font-mono",children:s})]})]}),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:t,title:"바인딩 제거",children:"🗑️"})]})]})})}function $E({component:r,onChange:e}){const[t,s]=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:y}=Wo(),x=y(r.name),w=j.useMemo(()=>{const N=[];return r.props&&Object.entries(r.props).forEach(([D,$])=>{gd($)&&N.push({key:D,value:$,type:"prop"})}),r.text&&gd(r.text)&&N.push({key:"text",value:r.text,type:"text"}),r.if&&gd(r.if)&&N.push({key:"if",value:r.if,type:"if"}),r.iteration?.source&&gd(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($=>$.type==="prop").map($=>$.key));return(x?.props?Object.keys(x.props):[]).filter($=>!N.has($))},[w,x]),S=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 $={};N==="text"?$.text=D||void 0:N==="if"?$.if=D||void 0:N==="iteration.source"?$.iteration=D?{...r.iteration,source:D,item_var:r.iteration?.item_var||"item"}:void 0:($.props={...r.props,[N]:D||void 0},!D&&$.props&&delete $.props[N]),e($),s(null),o(!1),g("")},[r,e]),A=j.useCallback(N=>{k(N.key,"")},[k]),O=j.useCallback(()=>{d&&(s(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(ME,{binding:N,onEdit:()=>s(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:O,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(LE,{isOpen:t!==null,propKey:t||"",currentValue:t&&w.find(N=>N.key===t)?.value||"",sources:S,onSave:N=>t&&k(t,N),onCancel:()=>s(null)})]})}const IE=[{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:"커스텀 액션"}],zE=[{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 HE({component:r,onChange:e}){const[t,s]=j.useState(null),[i,o]=j.useState(!1),d=j.useMemo(()=>r.actions||[],[r.actions]),g=j.useCallback(()=>{const x={type:"click",handler:"navigate",params:{}},w=[...d,x];e({actions:w}),s(w.length-1),o(!1)},[d,e]),h=j.useCallback(x=>{const w=d.filter((v,S)=>S!==x);e({actions:w.length>0?w:void 0}),t===x?s(null):t!==null&&t>x&&s(t-1)},[d,t,e]),f=j.useCallback((x,w)=>{const v=d.map((S,k)=>k===x?{...S,...w}:S);e({actions:v})},[d,e]),p=j.useCallback(x=>{const w=d[x],v=JSON.parse(JSON.stringify(w)),S=[...d.slice(0,x+1),v,...d.slice(x+1)];e({actions:S})},[d,e]),y=j.useCallback((x,w)=>{const v=w==="up"?x-1:x+1;if(v<0||v>=d.length)return;const S=[...d];[S[x],S[v]]=[S[v],S[x]],e({actions:S}),t===x?s(v):t===v&&s(x)},[d,t,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((x,w)=>l.jsx(PE,{action:x,index:w,isEditing:t===w,isFirst:w===0,isLast:w===d.length-1,onEdit:()=>s(t===w?null:w),onDelete:()=>h(w),onDuplicate:()=>p(w),onMove:v=>y(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 PE({action:r,index:e,isEditing:t,isFirst:s,isLast:i,onEdit:o,onDelete:d,onDuplicate:g,onMove:h,onUpdate:f}){const p=r.event||r.type||"click",y=!!r.event;return l.jsxs("div",{className:`rounded border transition-colors ${t?"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 ${y?"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:t?"▼":"▶"})]}),t&&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:x=>{const w=x.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:[zE.map(x=>l.jsxs("option",{value:x.value,children:[x.label," (",x.description,")"]},x.value)),l.jsx("option",{value:"custom",children:"커스텀 이벤트"})]})}),r.event&&l.jsx("input",{type:"text",value:r.event,onChange:x=>f({event:x.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:x=>f({handler:x.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:IE.map(x=>l.jsxs("option",{value:x.value,children:[x.label," - ",x.description]},x.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:x=>f({target:x.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(UE,{params:r.params||{},onChange:x=>f({params:x}),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:x=>f({confirm:x.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:x=>f({key:x.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(BE,{debounce:r.debounce,onChange:x=>f({debounce:x})}),(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:s,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 UE({params:r,onChange:e,handler:t}){const[s,i]=j.useState(""),[o,d]=j.useState(""),g=j.useMemo(()=>{switch(t){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[]}},[t]),h=j.useCallback(()=>{if(!s.trim())return;const x={...r,[s.trim()]:o};e(x),i(""),d("")},[r,s,o,e]),f=j.useCallback(x=>{const{[x]:w,...v}=r;e(v)},[r,e]),p=j.useCallback((x,w)=>{const v={...r,[x]:w};e(v)},[r,e]),y=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:"파라미터"}),y.length>0&&l.jsx("div",{className:"space-y-1 mb-2",children:y.map(([x,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:[x,":"]}),l.jsx("input",{type:"text",value:typeof w=="object"?JSON.stringify(w):String(w),onChange:v=>p(x,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(x),className:"text-red-500 hover:text-red-700 text-xs px-1",title:"삭제",children:"×"})]},x))}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("input",{type:"text",value:s,onChange:x=>i(x.target.value),placeholder:"키",list:`suggested-params-${t}`,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-${t}`,children:g.filter(x=>!r[x]).map(x=>l.jsx("option",{value:x},x))}),l.jsx("input",{type:"text",value:o,onChange:x=>d(x.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:x=>{x.key==="Enter"&&h()}}),l.jsx("button",{onClick:h,disabled:!s.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 BE({debounce:r,onChange:e}){const[t,s]=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(x=>{const w=parseInt(x,10);if(isNaN(w)||w<=0){e(void 0);return}e(t?{delay:w,leading:o,trailing:d}:w)},[t,o,d,e]),p=j.useCallback((x,w)=>{e({delay:i||300,leading:x==="leading"?w:o,trailing:x==="trailing"?w:d})},[i,o,d,e]),y=j.useCallback(()=>{!t&&g?e({delay:i,leading:!1,trailing:!0}):t&&g&&e(i),s(!t)},[t,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:x=>f(x.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:y,className:"text-xs text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-300",children:t?"▼ 고급 설정 숨기기":"▶ 고급 설정 보기"}),t&&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:x=>p("leading",x.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:x=>p("trailing",x.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 Xx=[{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 qE({component:r,onChange:e}){const[t,s]=j.useState(!1),[i,o]=j.useState(!1),d=Se(x=>x.layoutData),g=Se(x=>x.mockDataContext),h=j.useMemo(()=>{const x=[];return d?.data_sources&&d.data_sources.forEach(w=>{x.push({label:w.id,value:`{{${w.id}.data}}`,description:`데이터 소스: ${w.id}`})}),g._global&&Object.keys(g._global).forEach(w=>{Array.isArray(g._global[w])&&x.push({label:`_global.${w}`,value:`{{_global.${w}}}`,description:"전역 상태 배열"})}),g._local&&Object.keys(g._local).forEach(w=>{Array.isArray(g._local[w])&&x.push({label:`_local.${w}`,value:`{{_local.${w}}}`,description:"로컬 상태 배열"})}),x},[d,g]),f=j.useCallback(x=>{e({if:x||void 0})},[e]),p=j.useCallback(x=>{if(x===null)e({iteration:void 0});else{const w=r.iteration||{source:"",item_var:"item",index_var:"index"};e({iteration:{...w,...x}})}},[r.iteration,e]),y=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:x=>f(x.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:"빠른 입력:"}),Xx.slice(0,3).map(x=>l.jsx("button",{onClick:()=>f(x.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:x.description,children:x.label},x.value)),l.jsx("button",{onClick:()=>s(!t),className:"px-2 py-0.5 text-xs text-blue-600 dark:text-blue-400 hover:underline",children:t?"닫기":"더보기..."})]}),t&&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:Xx.map(x=>l.jsxs("button",{onClick:()=>{f(x.value),s(!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:x.label}),l.jsx("span",{className:"text-gray-500 dark:text-gray-400 ml-2",children:x.description}),l.jsx("code",{className:"block text-xs text-blue-600 dark:text-blue-400 mt-0.5",children:x.value})]},x.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:x=>p({source:x.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(x=>l.jsx("button",{onClick:()=>p({source:x.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:x.description,children:x.label},x.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:x=>p({item_var:x.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:x=>p({index_var:x.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:y,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 Qx=[{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:"모바일 + 태블릿"}],GE=[{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 FE({breakpointKey:r,label:e,range:t,icon:s,description:i,config:o,component:d,isOpen:g,onToggle:h,onChange:f}){const p=o!==void 0,{getMetadata:y}=Wo(),x=y(d.name),w=j.useCallback((O,N)=>{const D=o?.props||{};let $;if(N===""){const{[O]:M,...z}=D;$=z}else $={...D,[O]:N};Object.keys($).length===0&&!o?.text&&!o?.if?f(null):f({...o,props:$})},[o,f]),v=j.useCallback(O=>{if(O===""){const{text:N,...D}=o||{};Object.keys(D.props||{}).length===0&&!D.if?f(null):f(D)}else f({...o,text:O})},[o,f]),S=j.useCallback(O=>{if(O===""){const{if:N,...D}=o||{};Object.keys(D.props||{}).length===0&&!D.text?f(null):f(D)}else f({...o,if:O})},[o,f]),k=j.useCallback(()=>{f(p?null:{props:{}})},[p,f]),A=j.useCallback(O=>{const N=o?.props||{},D=N.className||"",$=D?`${D} ${O}`:O;f({...o,props:{...N,className:$}})},[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:s}),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:t}),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:O=>{O.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:O=>w("className",O.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:GE.slice(0,6).map(O=>l.jsx("button",{onClick:()=>A(O.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:O.value,children:O.label},O.value))})]}),x?.props?.filter(O=>O.name!=="className"&&O.name!=="children").slice(0,5).map(O=>l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:O.label||O.name}),O.type==="boolean"?l.jsxs("select",{value:o?.props?.[O.name]===void 0?"":String(o.props[O.name]),onChange:N=>{const D=N.target.value;D===""?w(O.name,""):w(O.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"})]}):O.type==="select"&&O.options?l.jsxs("select",{value:o?.props?.[O.name]||"",onChange:N=>w(O.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:"기본값"}),O.options.map(N=>l.jsx("option",{value:String(N.value),children:N.label},String(N.value)))]}):l.jsx("input",{type:O.type==="number"?"number":"text",value:o?.props?.[O.name]||"",onChange:N=>w(O.name,N.target.value),placeholder:d.props?.[O.name]?String(d.props[O.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"})]},O.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:O=>v(O.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:O=>S(O.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 VE({responsive:r,onChange:e,onAddRange:t,onRemoveRange:s}){const[i,o]=j.useState(""),[d,g]=j.useState(""),h=j.useMemo(()=>{if(!r)return[];const p=Qx.map(y=>y.key);return Object.keys(r).filter(y=>!p.includes(y))},[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;t(p),o(""),g("")},[i,d,t]);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:()=>s(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 KE({component:r,onChange:e}){const[t,s]=j.useState(new Set),[i,o]=j.useState(!1),d=r.responsive,g=j.useCallback(w=>{s(v=>{const S=new Set(v);return S.has(w)?S.delete(w):S.add(w),S})},[]),h=j.useCallback((w,v)=>{const S={...d||{}};v===null?delete S[w]:S[w]=v,Object.keys(S).length===0?e({responsive:void 0}):e({responsive:S})},[d,e]),f=j.useCallback(w=>{const v={...d||{}};v[w]={props:{}},e({responsive:v}),s(S=>new Set(S).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]),y=j.useCallback(()=>{e({responsive:void 0})},[e]),x=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:"브레이크포인트별로 다른 속성을 설정합니다."})]}),x>0&&l.jsx("button",{onClick:y,className:"text-xs text-red-500 hover:text-red-700",children:"모두 삭제"})]}),x>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:["📱 ",x,"개 브레이크포인트 활성화"]})}),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:"프리셋 브레이크포인트"}),Qx.map(w=>l.jsx(FE,{breakpointKey:w.key,label:w.label,range:w.range,icon:w.icon,description:w.description,config:d?.[w.key],component:r,isOpen:t.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(VE,{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)})]})]})}nt("ClassMapEditor");function WE({variantKey:r,variantClass:e,onKeyChange:t,onClassChange:s,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=>t(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=>s(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 Zx({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((t,s)=>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:t},s)),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 YE({value:r,onChange:e,label:t="classMap",description:s}){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(S=>{e({...r,base:S||void 0})},[r,e]),h=j.useCallback(S=>{e({...r,key:S||void 0})},[r,e]),f=j.useCallback(S=>{e({...r,default:S||void 0})},[r,e]),p=j.useCallback(()=>{const S=r?.variants||{},k=`variant_${Object.keys(S).length+1}`;e({...r,variants:{...S,[k]:""}})},[r,e]),y=j.useCallback((S,k)=>{if(!r?.variants||S===k)return;const A={...r.variants},O=A[S];delete A[S],A[k]=O,e({...r,variants:A})},[r,e]),x=j.useCallback((S,k)=>{e({...r,variants:{...r?.variants,[S]:k}})},[r,e]),w=j.useCallback(S=>{if(!r?.variants)return;const k={...r.variants};delete k[S],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:t}),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:S=>{S.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:S=>g(S.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(Zx,{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:S=>h(`{{${S.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(([S,k])=>l.jsx(WE,{variantKey:S,variantClass:k,onKeyChange:A=>y(S,A),onClassChange:A=>x(S,A),onDelete:()=>w(S)},S))}):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:S=>f(S.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(Zx,{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)})]})]}),s&&!i&&l.jsx("p",{className:"px-3 pb-2 text-xs text-gray-500 dark:text-gray-400",children:s})]})}nt("AdvancedEditor");function hd({title:r,badge:e,isExpanded:t,onToggle:s}){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:s,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 ${t?"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 JE({component:r,onChange:e}){const[t,s]=j.useState({basic:!0,classMap:!1,expressionHelpers:!1,rawJson:!1}),i=j.useCallback(f=>{s(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(hd,{title:"기본 설정",isExpanded:t.basic,onToggle:()=>i("basic")}),t.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(hd,{title:"classMap (조건부 스타일)",badge:h?"활성화":void 0,isExpanded:t.classMap,onToggle:()=>i("classMap")}),t.classMap&&l.jsx("div",{className:"mt-3",children:l.jsx(YE,{value:h,onChange:d,label:"조건부 클래스 매핑",description:"상태에 따라 다른 CSS 클래스를 적용합니다. 중첩 삼항 연산자 대신 사용하세요."})})]}),l.jsxs("div",{children:[l.jsx(hd,{title:"표현식 헬퍼",isExpanded:t.expressionHelpers,onToggle:()=>i("expressionHelpers")}),t.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(hd,{title:"Raw JSON",isExpanded:t.rawJson,onToggle:()=>i("rawJson")}),t.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 XE=[{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 QE({tab:r,isActive:e,onClick:t}){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:t,title:r.description,children:[l.jsx("span",{children:r.icon}),l.jsx("span",{className:"hidden lg:inline",children:r.label})]})}function ZE(){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 e_({component:r}){const{getMetadata:e}=Wo(),t=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})]}),t?.description&&l.jsx("p",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:t.description})]})}function eb({className:r=""}){const[e,t]=j.useState("props"),s=Se(p=>p.layoutData),i=Se(p=>p.selectedComponentId),o=Se(p=>p.updateComponentProps),d=Se(p=>p.updateComponent),g=j.useMemo(()=>{if(!s||!i)return null;const p=y=>{for(const x of y)if(typeof x!="string"){if(x.id===i)return x;if(x.children){const w=p(x.children);if(w)return w}}return null};return p(s.components)},[s,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(ZE,{})});const f=()=>{switch(e){case"props":return l.jsx(Jx,{component:g,onChange:h});case"bindings":return l.jsx($E,{component:g,onChange:h});case"actions":return l.jsx(HE,{component:g,onChange:h});case"conditions":return l.jsx(qE,{component:g,onChange:h});case"responsive":return l.jsx(KE,{component:g,onChange:h});case"advanced":return l.jsx(JE,{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(e_,{component:g}),l.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700 overflow-x-auto",children:XE.map(p=>l.jsx(QE,{tab:p,isActive:e===p.id,onClick:()=>t(p.id)},p.id))}),l.jsx("div",{className:"flex-1 overflow-auto",children:f()})]})}const Yo=nt("EditorOverlay");function t_({rect:r,componentId:e,onCopy:t,onDuplicate:s,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:t,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:s,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 n_({rect:r,position:e}){const t={position:"fixed",pointerEvents:"none",zIndex:40};return e==="before"?l.jsx("div",{style:{...t,left:r.left,top:r.top-2,width:r.width,height:4},className:"bg-blue-500"}):e==="after"?l.jsx("div",{style:{...t,left:r.left,top:r.bottom-2,width:r.width,height:4},className:"bg-blue-500"}):e==="inside"?l.jsx("div",{style:{...t,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 tb({rect:r,containerRect:e,type:t,label:s}){const i=t==="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"})]}),s&&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:s})]})}function yh({containerRef:r,enabled:e=!0,selectionMode:t=!0}){const s=j.useRef(null),i=Se(J=>J.layoutData),o=Se(J=>J.selectedComponentId),d=Se(J=>J.hoveredComponentId),g=Se(J=>J.selectComponent),h=Se(J=>J.setHoveredComponentId),f=Se(J=>J.deleteComponent),p=Se(J=>J.duplicateComponent),y=Se(J=>J.copyToClipboard);Se(J=>J.moveComponent);const[x,w]=j.useState([]),[v,S]=j.useState(null),[k,A]=j.useState({isDragging:!1,targetId:null,position:null,targetRect:null}),O=j.useCallback(()=>{if(!r.current||!i)return[];const J=r.current.querySelectorAll("[data-editor-id]"),ve=[],le=(de,je)=>{for(const W of de)if(typeof W!="string"){if(W.id===je)return W;if(W.children){const he=le(W.children,je);if(he)return he}}return null};return J.forEach(de=>{const je=de.getAttribute("data-editor-id");if(!je)return;const W=de.getBoundingClientRect(),he=le(i.components,je);he&&ve.push({id:je,rect:W,component:he,isSelected:je===o,isHovered:je===d})}),ve},[r,i,o,d]),N=j.useCallback(()=>{w(O()),r.current&&S(r.current.getBoundingClientRect())},[O,r]);j.useEffect(()=>{if(!e)return;N();const J=()=>{requestAnimationFrame(N)};window.addEventListener("resize",J),window.addEventListener("scroll",J,!0);const ve=new ResizeObserver(J);r.current&&ve.observe(r.current);const le=new MutationObserver(J);return r.current&&le.observe(r.current,{childList:!0,subtree:!0,attributes:!0}),()=>{window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0),ve.disconnect(),le.disconnect()}},[e,r,N]),j.useCallback(J=>{if(!t)return;const ve=J.target;if(s.current?.contains(ve))return;let le=null;if(ve.hasAttribute("data-editor-id")?le=ve:le=ve.closest("[data-editor-id]"),le){const de=le.getAttribute("data-editor-id");de&&(g(de),J.preventDefault(),J.stopPropagation())}else g(null)},[t,g]),j.useCallback(J=>{const ve=J.target;if(s.current?.contains(ve))return;let le=null;if(ve.hasAttribute("data-editor-id")?le=ve:le=ve.closest("[data-editor-id]"),le){const de=le.getAttribute("data-editor-id");de&&de!==d&&h(de)}else d&&h(null)},[d,h]),j.useCallback(()=>{h(null)},[h]);const D=j.useCallback(()=>{if(!o)return;const J=x.find(ve=>ve.id===o);J&&(y(J.component),Yo.log("Copied:",o))},[o,x,y]),$=j.useCallback(()=>{o&&(p(o),Yo.log("Duplicated:",o))},[o,p]),M=j.useCallback(()=>{o&&(f(o),Yo.log("Deleted:",o))},[o,f]),z=j.useCallback(()=>{o&&Yo.log("Move up:",o)},[o]),K=j.useCallback(()=>{o&&Yo.log("Move down:",o)},[o]),ye=j.useMemo(()=>x.find(J=>J.isSelected),[x]),we=j.useMemo(()=>x.find(J=>J.isHovered&&!J.isSelected),[x]);return e?l.jsx(l.Fragment,{children:l.jsxs("div",{ref:s,className:"absolute inset-0 pointer-events-none z-20",children:[we&&l.jsx(tb,{rect:we.rect,containerRect:v,type:"hovered",label:we.component.name}),ye&&l.jsxs(l.Fragment,{children:[l.jsx(tb,{rect:ye.rect,containerRect:v,type:"selected",label:ye.component.name}),l.jsx("div",{className:"pointer-events-auto",children:l.jsx(t_,{rect:ye.rect,componentId:ye.id,onCopy:D,onDuplicate:$,onDelete:M,onMoveUp:z,onMoveDown:K})})]}),k.isDragging&&k.targetRect&&k.position&&l.jsx(n_,{rect:k.targetRect,position:k.position})]})}):null}const ua=nt("WysiwygEditor"),s_={leftPanel:280,rightPanel:320,bottomPanel:200},xh=200,a_=400,r_=500,i_=400;function fd({direction:r,onResize:e}){const[t,s]=j.useState(!1),i=j.useRef(0),o=j.useCallback(g=>{g.preventDefault(),s(!0),i.current=r==="horizontal"?g.clientX:g.clientY;const h=p=>{const y=r==="horizontal"?p.clientX:p.clientY,x=y-i.current;i.current=y,e(x)},f=()=>{s(!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 ${t?"bg-blue-500 dark:bg-blue-500":""}`,onMouseDown:o})}function o_({onClose:r,onSaveComplete:e,readOnly:t=!1,className:s=""}){const i=Se(le=>le.layoutData),o=Se(le=>le.editMode),d=Se(le=>le.selectedComponentId),g=Se(le=>le.saveLayout),h=Se(le=>le.selectComponent),f=Se(le=>le.deleteComponent),p=Se(le=>le.duplicateComponent),{undo:y,redo:x,canUndo:w,canRedo:v}=dh(),[S,k]=j.useState(s_),[A,O]=j.useState(!0),[N,D]=j.useState(!0),[$,M]=j.useState(!0),z=j.useRef(null);j.useEffect(()=>{const le=de=>{if(de.target instanceof HTMLInputElement||de.target instanceof HTMLTextAreaElement||de.target.contentEditable==="true")return;const W=navigator.platform.toUpperCase().indexOf("MAC")>=0?de.metaKey:de.ctrlKey;if(W&&de.key==="z"&&!de.shiftKey){de.preventDefault(),w&&(y(),ua.log("Keyboard shortcut: Undo"));return}if(W&&de.key==="z"&&de.shiftKey){de.preventDefault(),v&&(x(),ua.log("Keyboard shortcut: Redo"));return}if(W&&de.key==="y"){de.preventDefault(),v&&(x(),ua.log("Keyboard shortcut: Redo (Y)"));return}if(W&&de.key==="s"){de.preventDefault(),t||(K(),ua.log("Keyboard shortcut: Save"));return}if((de.key==="Delete"||de.key==="Backspace")&&d){de.preventDefault(),t||(f(d),ua.log("Keyboard shortcut: Delete"));return}if(W&&de.key==="d"&&d){de.preventDefault(),t||(p(d),ua.log("Keyboard shortcut: Duplicate"));return}if(de.key==="Escape"){de.preventDefault(),h(null),ua.log("Keyboard shortcut: Deselect");return}if(W&&de.key==="1"){de.preventDefault(),O(he=>!he);return}if(W&&de.key==="2"){de.preventDefault(),D(he=>!he);return}if(W&&de.key==="3"){de.preventDefault(),M(he=>!he);return}};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[w,v,y,x,d,h,f,p,t]);const K=j.useCallback(async()=>{try{await g("Manual save"),i&&e&&e(i),ua.log("Layout saved successfully")}catch(le){ua.error("Failed to save layout:",le)}},[g,i,e]),ye=j.useCallback(le=>{k(de=>({...de,leftPanel:Math.min(a_,Math.max(xh,de.leftPanel+le))}))},[]),we=j.useCallback(le=>{k(de=>({...de,rightPanel:Math.min(r_,Math.max(xh,de.rightPanel-le))}))},[]),J=j.useCallback(le=>{k(de=>({...de,bottomPanel:Math.min(i_,Math.max(xh,de.bottomPanel-le))}))},[]),ve=()=>{switch(o){case"visual":return l.jsxs("div",{ref:z,className:"relative flex-1 overflow-hidden",children:[l.jsx(fh,{showOverlay:!t}),!t&&l.jsx(yh,{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(fh,{showOverlay:!t}),!t&&l.jsx(yh,{containerRef:z})]}),l.jsx(fd,{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 ${s}`,children:[l.jsx(Bx,{onClose:r,onSaveComplete:K}),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:S.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:()=>O(!1),title:"패널 닫기",children:"✕"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:l.jsx(Gx,{enableDragDrop:!t})})]})}),l.jsx(fd,{direction:"horizontal",onResize:ye})]}),l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[ve(),$&&l.jsxs(l.Fragment,{children:[l.jsx(fd,{direction:"vertical",onResize:J}),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:S.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:()=>M(!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(fd,{direction:"horizontal",onResize:we}),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:S.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(eb,{})})]})})]})]}),(!A||!N||!$)&&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:()=>O(!0),children:"📑 트리"}),!$&&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:()=>M(!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:"⚙️ 속성"})]}),t&&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 nb({layoutData:r,templateId:e,onClose:t,onSaveComplete:s,onPublishComplete:i,initialEditMode:o="visual",readOnly:d=!1,className:g=""}){return l.jsx(Ux,{layoutData:r,templateId:e,initialEditMode:o,children:l.jsx(o_,{onClose:t,onSaveComplete:s,readOnly:d,className:g})})}const l_=Object.freeze(Object.defineProperty({__proto__:null,EditorOverlay:yh,EditorProvider:Ux,LayoutTree:Gx,PreviewCanvas:fh,PropertyPanel:eb,PropsEditor:Jx,Toolbar:Bx,WysiwygEditor:nb,addComponentToLayout:Vo,deepCloneComponent:lh,default:nb,duplicateComponentInLayout:Hx,findComponentById:kr,generateUniqueId:Fo,isIdDuplicate:oh,moveComponentInLayout:cd,removeComponentFromLayout:od,selectCanRedo:ud,selectCanUndo:dd,updateComponentInLayout:ld,useComponentMetadata:Wo,useEditorState:Se,useHistory:dh},Symbol.toStringTag,{value:"Module"}));ln.DataSourceManager=la,ln.LayoutLoader=Mg,ln.TemplateApp=Lo,ln.TemplateEngine=Ho,ln.default=Ho,ln.destroyTemplate=qc,ln.getActionDispatcher=mx,ln.getState=za,ln.initTemplateApp=qg,ln.initTemplateEngine=Io,ln.renderTemplate=zo,ln.updateTemplateData=pi,Object.defineProperties(ln,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.G7Core=this.G7Core||{});
|
||
//# sourceMappingURL=template-engine.min.js.map
|