nginx 의 정규식 location 은 프리픽스 location 보다 먼저 매칭되므로, `location ~* \.(js|css|json)$` 블록이 있는 서버에서는 확장자 붙은 동적 엔드포인트가 `try_files ... /index.php` 폴백이 실행될 기회 없이 404 가 된다. aaPanel/CyberPanel/Plesk 기본 템플릿에 들어있어 드물지 않으며, 관리자 화면조차 뜨지 않아 "서버 설정을 고치세요" 안내가 순환 참조가 된다. 관례를 깬 쪽이 G7 이므로 해소 책임도 G7 에 두고, 두 형태를 모두 서빙한 뒤 환경에 따라 택일한다. 확장자 형태는 영구 유지한다 — 제거하면 URL 을 하드코딩한 서드파티 확장이 깨진다. - 라우트: dualSuffix / dualSuffixSegment / dualAsset 매크로로 23개 엔드포인트와 프로브를 이중 등록. 확장자 형태를 먼저 등록한다 — 확장자 없는 쪽이 더 느슨한 패턴이라 순서가 뒤집히면 `.json` 요청까지 삼킨다 - URL 생성: 서버 App\Support\AssetUrl, 프론트 core/support/assetUrl.ts 로 집약. 기본 모드에서 생성 결과는 치환 이전과 문자열까지 동일하다 (쿼리 순서 포함 — 순서가 바뀌면 의미는 같아도 HTTP 캐시 키가 갈린다) - 자가 복구: 부트스트랩 자산 로드 실패 시 확장자 없는 형태로 1회 단방향 전환. 역방향 금지 + 기존 재시도 예산 공유로 무한 왕복을 막는다 - 감지·전환: 인스톨러 프로브(설치 시 확정) / 관리자 환경설정 일반 탭 / g7:asset-url-mode. 판정은 상태코드가 아니라 매직 토큰 + Content-Type 으로 한다. 상태코드만 보면 "404 대신 200 + 에러 HTML" 환경에서 영원히 오판한다 - 봇은 JavaScript 를 실행하지 않아 자가 복구가 닿지 않으므로, 모드 변경 시 SEO 프리렌더 캐시를 비워 재생성시킨다 가드: audit 룰 2종(dynamic-route-static-extension / asset-url-builder-required), Playwright 6건(정적 블록 가로채기 시뮬레이션), 루프 방지 불변식 L1~L9 전수 red 증명. 부수 정리: 양 Composer 에 중복돼 있던 확장 에셋 수집 123줄을 트레이트로 통합하고, 자산 확장자 화이트리스트 누락(.map)과 경로 정규화 우회 가능성을 함께 교정. sir.kr 커뮤니티의 hang 님께서 제보해주셨습니다.
245 lines
742 KiB
JavaScript
245 lines
742 KiB
JavaScript
var Qx=Object.defineProperty;var Zx=(Vt,Wa,Ya)=>Wa in Vt?Qx(Vt,Wa,{enumerable:!0,configurable:!0,writable:!0,value:Ya}):Vt[Wa]=Ya;var $=(Vt,Wa,Ya)=>Zx(Vt,typeof Wa!="symbol"?Wa+"":Wa,Ya);(function(Vt){"use strict";function Wa(o,e){for(var a=0;a<e.length;a++){const r=e[a];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in o)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(o,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function Ya(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Gu={exports:{}},Ke={};var Lg;function OS(){if(Lg)return Ke;Lg=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function S(x){return x===null||typeof x!="object"?null:(x=v&&x[v]||x["@@iterator"],typeof x=="function"?x:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,T={};function L(x,K,re){this.props=x,this.context=K,this.refs=T,this.updater=re||E}L.prototype.isReactComponent={},L.prototype.setState=function(x,K){if(typeof x!="object"&&typeof x!="function"&&x!=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,x,K,"setState")},L.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function M(){}M.prototype=L.prototype;function R(x,K,re){this.props=x,this.context=K,this.refs=T,this.updater=re||E}var D=R.prototype=new M;D.constructor=R,A(D,L.prototype),D.isPureReactComponent=!0;var U=Array.isArray;function j(){}var P={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ge(x,K,re){var de=re.ref;return{$$typeof:o,type:x,key:K,ref:de!==void 0?de:null,props:re}}function Ee(x,K){return ge(x.type,K,x.props)}function Ce(x){return typeof x=="object"&&x!==null&&x.$$typeof===o}function $e(x){var K={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(re){return K[re]})}var Pe=/\/+/g;function Xe(x,K){return typeof x=="object"&&x!==null&&x.key!=null?$e(""+x.key):K.toString(36)}function ht(x){switch(x.status){case"fulfilled":return x.value;case"rejected":throw x.reason;default:switch(typeof x.status=="string"?x.then(j,j):(x.status="pending",x.then(function(K){x.status==="pending"&&(x.status="fulfilled",x.value=K)},function(K){x.status==="pending"&&(x.status="rejected",x.reason=K)})),x.status){case"fulfilled":return x.value;case"rejected":throw x.reason}}throw x}function Q(x,K,re,de,se){var me=typeof x;(me==="undefined"||me==="boolean")&&(x=null);var Ne=!1;if(x===null)Ne=!0;else switch(me){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(x.$$typeof){case o:case e:Ne=!0;break;case m:return Ne=x._init,Q(Ne(x._payload),K,re,de,se)}}if(Ne)return se=se(x),Ne=de===""?"."+Xe(x,0):de,U(se)?(re="",Ne!=null&&(re=Ne.replace(Pe,"$&/")+"/"),Q(se,K,re,"",function(Ae){return Ae})):se!=null&&(Ce(se)&&(se=Ee(se,re+(se.key==null||x&&x.key===se.key?"":(""+se.key).replace(Pe,"$&/")+"/")+Ne)),K.push(se)),1;Ne=0;var ve=de===""?".":de+":";if(U(x))for(var He=0;He<x.length;He++)de=x[He],me=ve+Xe(de,He),Ne+=Q(de,K,re,me,se);else if(He=S(x),typeof He=="function")for(x=He.call(x),He=0;!(de=x.next()).done;)de=de.value,me=ve+Xe(de,He++),Ne+=Q(de,K,re,me,se);else if(me==="object"){if(typeof x.then=="function")return Q(ht(x),K,re,de,se);throw K=String(x),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function fe(x,K,re){if(x==null)return x;var de=[],se=0;return Q(x,de,"","",function(me){return K.call(re,me,se++)}),de}function ye(x){if(x._status===-1){var K=x._result;K=K(),K.then(function(re){(x._status===0||x._status===-1)&&(x._status=1,x._result=re)},function(re){(x._status===0||x._status===-1)&&(x._status=2,x._result=re)}),x._status===-1&&(x._status=0,x._result=K)}if(x._status===1)return x._result.default;throw x._result}var te=typeof reportError=="function"?reportError:function(x){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof x=="object"&&x!==null&&typeof x.message=="string"?String(x.message):String(x),error:x});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",x);return}console.error(x)},he={map:fe,forEach:function(x,K,re){fe(x,function(){K.apply(this,arguments)},re)},count:function(x){var K=0;return fe(x,function(){K++}),K},toArray:function(x){return fe(x,function(K){return K})||[]},only:function(x){if(!Ce(x))throw Error("React.Children.only expected to receive a single React element child.");return x}};return Ke.Activity=b,Ke.Children=he,Ke.Component=L,Ke.Fragment=a,Ke.Profiler=i,Ke.PureComponent=R,Ke.StrictMode=r,Ke.Suspense=f,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(x){return P.H.useMemoCache(x)}},Ke.cache=function(x){return function(){return x.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(x,K,re){if(x==null)throw Error("The argument must be a React element, but you passed "+x+".");var de=A({},x.props),se=x.key;if(K!=null)for(me in K.key!==void 0&&(se=""+K.key),K)!X.call(K,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&K.ref===void 0||(de[me]=K[me]);var me=arguments.length-2;if(me===1)de.children=re;else if(1<me){for(var Ne=Array(me),ve=0;ve<me;ve++)Ne[ve]=arguments[ve+2];de.children=Ne}return ge(x.type,se,de)},Ke.createContext=function(x){return x={$$typeof:u,_currentValue:x,_currentValue2:x,_threadCount:0,Provider:null,Consumer:null},x.Provider=x,x.Consumer={$$typeof:l,_context:x},x},Ke.createElement=function(x,K,re){var de,se={},me=null;if(K!=null)for(de in K.key!==void 0&&(me=""+K.key),K)X.call(K,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(se[de]=K[de]);var Ne=arguments.length-2;if(Ne===1)se.children=re;else if(1<Ne){for(var ve=Array(Ne),He=0;He<Ne;He++)ve[He]=arguments[He+2];se.children=ve}if(x&&x.defaultProps)for(de in Ne=x.defaultProps,Ne)se[de]===void 0&&(se[de]=Ne[de]);return ge(x,me,se)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(x){return{$$typeof:d,render:x}},Ke.isValidElement=Ce,Ke.lazy=function(x){return{$$typeof:m,_payload:{_status:-1,_result:x},_init:ye}},Ke.memo=function(x,K){return{$$typeof:g,type:x,compare:K===void 0?null:K}},Ke.startTransition=function(x){var K=P.T,re={};P.T=re;try{var de=x(),se=P.S;se!==null&&se(re,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(j,te)}catch(me){te(me)}finally{K!==null&&re.types!==null&&(K.types=re.types),P.T=K}},Ke.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Ke.use=function(x){return P.H.use(x)},Ke.useActionState=function(x,K,re){return P.H.useActionState(x,K,re)},Ke.useCallback=function(x,K){return P.H.useCallback(x,K)},Ke.useContext=function(x){return P.H.useContext(x)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(x,K){return P.H.useDeferredValue(x,K)},Ke.useEffect=function(x,K){return P.H.useEffect(x,K)},Ke.useEffectEvent=function(x){return P.H.useEffectEvent(x)},Ke.useId=function(){return P.H.useId()},Ke.useImperativeHandle=function(x,K,re){return P.H.useImperativeHandle(x,K,re)},Ke.useInsertionEffect=function(x,K){return P.H.useInsertionEffect(x,K)},Ke.useLayoutEffect=function(x,K){return P.H.useLayoutEffect(x,K)},Ke.useMemo=function(x,K){return P.H.useMemo(x,K)},Ke.useOptimistic=function(x,K){return P.H.useOptimistic(x,K)},Ke.useReducer=function(x,K,re){return P.H.useReducer(x,K,re)},Ke.useRef=function(x){return P.H.useRef(x)},Ke.useState=function(x){return P.H.useState(x)},Ke.useSyncExternalStore=function(x,K,re){return P.H.useSyncExternalStore(x,K,re)},Ke.useTransition=function(){return P.H.useTransition()},Ke.version="19.2.6",Ke}var Mg;function Vu(){return Mg||(Mg=1,Gu.exports=OS()),Gu.exports}var N=Vu();const Ye=Ya(N);var Fu={exports:{}},Gs={},Ku={exports:{}},Wu={};var $g;function LS(){return $g||($g=1,(function(o){function e(Q,fe){var ye=Q.length;Q.push(fe);e:for(;0<ye;){var te=ye-1>>>1,he=Q[te];if(0<i(he,fe))Q[te]=fe,Q[ye]=he,ye=te;else break e}}function a(Q){return Q.length===0?null:Q[0]}function r(Q){if(Q.length===0)return null;var fe=Q[0],ye=Q.pop();if(ye!==fe){Q[0]=ye;e:for(var te=0,he=Q.length,x=he>>>1;te<x;){var K=2*(te+1)-1,re=Q[K],de=K+1,se=Q[de];if(0>i(re,ye))de<he&&0>i(se,re)?(Q[te]=se,Q[de]=ye,te=de):(Q[te]=re,Q[K]=ye,te=K);else if(de<he&&0>i(se,ye))Q[te]=se,Q[de]=ye,te=de;else break e}}return fe}function i(Q,fe){var ye=Q.sortIndex-fe.sortIndex;return ye!==0?ye:Q.id-fe.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;o.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();o.unstable_now=function(){return u.now()-d}}var f=[],g=[],m=1,b=null,v=3,S=!1,E=!1,A=!1,T=!1,L=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function D(Q){for(var fe=a(g);fe!==null;){if(fe.callback===null)r(g);else if(fe.startTime<=Q)r(g),fe.sortIndex=fe.expirationTime,e(f,fe);else break;fe=a(g)}}function U(Q){if(A=!1,D(Q),!E)if(a(f)!==null)E=!0,j||(j=!0,$e());else{var fe=a(g);fe!==null&&ht(U,fe.startTime-Q)}}var j=!1,P=-1,X=5,ge=-1;function Ee(){return T?!0:!(o.unstable_now()-ge<X)}function Ce(){if(T=!1,j){var Q=o.unstable_now();ge=Q;var fe=!0;try{e:{E=!1,A&&(A=!1,M(P),P=-1),S=!0;var ye=v;try{t:{for(D(Q),b=a(f);b!==null&&!(b.expirationTime>Q&&Ee());){var te=b.callback;if(typeof te=="function"){b.callback=null,v=b.priorityLevel;var he=te(b.expirationTime<=Q);if(Q=o.unstable_now(),typeof he=="function"){b.callback=he,D(Q),fe=!0;break t}b===a(f)&&r(f),D(Q)}else r(f);b=a(f)}if(b!==null)fe=!0;else{var x=a(g);x!==null&&ht(U,x.startTime-Q),fe=!1}}break e}finally{b=null,v=ye,S=!1}fe=void 0}}finally{fe?$e():j=!1}}}var $e;if(typeof R=="function")$e=function(){R(Ce)};else if(typeof MessageChannel<"u"){var Pe=new MessageChannel,Xe=Pe.port2;Pe.port1.onmessage=Ce,$e=function(){Xe.postMessage(null)}}else $e=function(){L(Ce,0)};function ht(Q,fe){P=L(function(){Q(o.unstable_now())},fe)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(Q){Q.callback=null},o.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Q?Math.floor(1e3/Q):5},o.unstable_getCurrentPriorityLevel=function(){return v},o.unstable_next=function(Q){switch(v){case 1:case 2:case 3:var fe=3;break;default:fe=v}var ye=v;v=fe;try{return Q()}finally{v=ye}},o.unstable_requestPaint=function(){T=!0},o.unstable_runWithPriority=function(Q,fe){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var ye=v;v=Q;try{return fe()}finally{v=ye}},o.unstable_scheduleCallback=function(Q,fe,ye){var te=o.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?te+ye:te):ye=te,Q){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=ye+he,Q={id:m++,callback:fe,priorityLevel:Q,startTime:ye,expirationTime:he,sortIndex:-1},ye>te?(Q.sortIndex=ye,e(g,Q),a(f)===null&&Q===a(g)&&(A?(M(P),P=-1):A=!0,ht(U,ye-te))):(Q.sortIndex=he,e(f,Q),E||S||(E=!0,j||(j=!0,$e()))),Q},o.unstable_shouldYield=Ee,o.unstable_wrapCallback=function(Q){var fe=v;return function(){var ye=v;v=fe;try{return Q.apply(this,arguments)}finally{v=ye}}}})(Wu)),Wu}var Ng;function MS(){return Ng||(Ng=1,Ku.exports=LS()),Ku.exports}var Yu={exports:{}},mn={};var Ig;function $S(){if(Ig)return mn;Ig=1;var o=Vu();function e(f){var g="https://react.dev/errors/"+f;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)g+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(e(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(f,g,m){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:b==null?null:""+b,children:f,containerInfo:g,implementation:m}}var u=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,g){if(f==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,mn.createPortal=function(f,g){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(e(299));return l(f,g,null,m)},mn.flushSync=function(f){var g=u.T,m=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=g,r.p=m,r.d.f()}},mn.preconnect=function(f,g){typeof f=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,r.d.C(f,g))},mn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},mn.preinit=function(f,g){if(typeof f=="string"&&g&&typeof g.as=="string"){var m=g.as,b=d(m,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,S=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;m==="style"?r.d.S(f,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:S}):m==="script"&&r.d.X(f,{crossOrigin:b,integrity:v,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},mn.preinitModule=function(f,g){if(typeof f=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var m=d(g.as,g.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&r.d.M(f)},mn.preload=function(f,g){if(typeof f=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var m=g.as,b=d(m,g.crossOrigin);r.d.L(f,m,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},mn.preloadModule=function(f,g){if(typeof f=="string")if(g){var m=d(g.as,g.crossOrigin);r.d.m(f,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:m,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else r.d.m(f)},mn.requestFormReset=function(f){r.d.r(f)},mn.unstable_batchedUpdates=function(f,g){return f(g)},mn.useFormState=function(f,g,m){return u.H.useFormState(f,g,m)},mn.useFormStatus=function(){return u.H.useHostTransitionStatus()},mn.version="19.2.6",mn}var Hg;function zg(){if(Hg)return Yu.exports;Hg=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),Yu.exports=$S(),Yu.exports}var jg;function NS(){if(jg)return Gs;jg=1;var o=MS(),e=Vu(),a=zg();function r(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function l(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function u(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function d(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function f(t){if(l(t)!==t)throw Error(r(188))}function g(t){var n=t.alternate;if(!n){if(n=l(t),n===null)throw Error(r(188));return n!==t?null:t}for(var s=t,c=n;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(c=h.return,c!==null){s=c;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return f(h),t;if(p===c)return f(h),n;p=p.sibling}throw Error(r(188))}if(s.return!==c.return)s=h,c=p;else{for(var w=!1,k=h.child;k;){if(k===s){w=!0,s=h,c=p;break}if(k===c){w=!0,c=h,s=p;break}k=k.sibling}if(!w){for(k=p.child;k;){if(k===s){w=!0,s=p,c=h;break}if(k===c){w=!0,c=p,s=h;break}k=k.sibling}if(!w)throw Error(r(189))}}if(s.alternate!==c)throw Error(r(190))}if(s.tag!==3)throw Error(r(188));return s.stateNode.current===s?t:n}function m(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=m(t),n!==null)return n;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),R=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ge=Symbol.for("react.activity"),Ee=Symbol.for("react.memo_cache_sentinel"),Ce=Symbol.iterator;function $e(t){return t===null||typeof t!="object"?null:(t=Ce&&t[Ce]||t["@@iterator"],typeof t=="function"?t:null)}var Pe=Symbol.for("react.client.reference");function Xe(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Pe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case L:return"Profiler";case T:return"StrictMode";case U:return"Suspense";case j:return"SuspenseList";case ge:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case R:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case D:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return n=t.displayName||null,n!==null?n:Xe(t.type)||"Memo";case X:n=t._payload,t=t._init;try{return Xe(t(n))}catch{}}return null}var ht=Array.isArray,Q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},te=[],he=-1;function x(t){return{current:t}}function K(t){0>he||(t.current=te[he],te[he]=null,he--)}function re(t,n){he++,te[he]=t.current,t.current=n}var de=x(null),se=x(null),me=x(null),Ne=x(null);function ve(t,n){switch(re(me,n),re(se,t),re(de,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Jv(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Jv(n),t=Qv(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(de),re(de,t)}function He(){K(de),K(se),K(me)}function Ae(t){t.memoizedState!==null&&re(Ne,t);var n=de.current,s=Qv(n,t.type);n!==s&&(re(se,t),re(de,s))}function Et(t){se.current===t&&(K(de),K(se)),Ne.current===t&&(K(Ne),Sl._currentValue=ye)}var Rt,_t;function ft(t){if(Rt===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);Rt=n&&n[1]||"",_t=-1<s.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Rt+t+_t}var un=!1;function gt(t,n){if(!t||un)return"";un=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ee){var J=ee}Reflect.construct(t,[],ue)}else{try{ue.call()}catch(ee){J=ee}t.call(ue.prototype)}}else{try{throw Error()}catch(ee){J=ee}(ue=t())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ee){if(ee&&J&&typeof ee.stack=="string")return[ee.stack,J.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=c.DetermineComponentFrameRoot(),w=p[0],k=p[1];if(w&&k){var z=w.split(`
|
||
`),Y=k.split(`
|
||
`);for(h=c=0;c<z.length&&!z[c].includes("DetermineComponentFrameRoot");)c++;for(;h<Y.length&&!Y[h].includes("DetermineComponentFrameRoot");)h++;if(c===z.length||h===Y.length)for(c=z.length-1,h=Y.length-1;1<=c&&0<=h&&z[c]!==Y[h];)h--;for(;1<=c&&0<=h;c--,h--)if(z[c]!==Y[h]){if(c!==1||h!==1)do if(c--,h--,0>h||z[c]!==Y[h]){var ae=`
|
||
`+z[c].replace(" at new "," at ");return t.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",t.displayName)),ae}while(1<=c&&0<=h);break}}}finally{un=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?ft(s):""}function ja(t,n){switch(t.tag){case 26:case 27:case 5:return ft(t.type);case 16:return ft("Lazy");case 13:return t.child!==n&&n!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return gt(t.type,!1);case 11:return gt(t.type.render,!1);case 1:return gt(t.type,!0);case 31:return ft("Activity");default:return""}}function kn(t){try{var n="",s=null;do n+=ja(t,s),s=t,t=t.return;while(t);return n}catch(c){return`
|
||
Error generating stack: `+c.message+`
|
||
`+c.stack}}var Dn=Object.prototype.hasOwnProperty,jt=o.unstable_scheduleCallback,On=o.unstable_cancelCallback,ea=o.unstable_shouldYield,Ua=o.unstable_requestPaint,Ft=o.unstable_now,Dr=o.unstable_getCurrentPriorityLevel,er=o.unstable_ImmediatePriority,bn=o.unstable_UserBlockingPriority,en=o.unstable_NormalPriority,et=o.unstable_LowPriority,ta=o.unstable_IdlePriority,En=o.log,tr=o.unstable_setDisableYieldValue,Ea=null,tn=null;function _n(t){if(typeof En=="function"&&tr(t),tn&&typeof tn.setStrictMode=="function")try{tn.setStrictMode(Ea,t)}catch{}}var q=Math.clz32?Math.clz32:Z,ce=Math.log,le=Math.LN2;function Z(t){return t>>>=0,t===0?32:31-(ce(t)/le|0)|0}var be=256,Se=262144,Re=4194304;function xe(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function je(t,n,s){var c=t.pendingLanes;if(c===0)return 0;var h=0,p=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var k=c&134217727;return k!==0?(c=k&~p,c!==0?h=xe(c):(w&=k,w!==0?h=xe(w):s||(s=k&~t,s!==0&&(h=xe(s))))):(k=c&~p,k!==0?h=xe(k):w!==0?h=xe(w):s||(s=c&~t,s!==0&&(h=xe(s)))),h===0?0:n!==0&&n!==h&&(n&p)===0&&(p=h&-h,s=n&-n,p>=s||p===32&&(s&4194048)!==0)?n:h}function ze(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Le(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 ke(){var t=Re;return Re<<=1,(Re&62914560)===0&&(Re=4194304),t}function We(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function Fe(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _e(t,n,s,c,h,p){var w=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var k=t.entanglements,z=t.expirationTimes,Y=t.hiddenUpdates;for(s=w&~s;0<s;){var ae=31-q(s),ue=1<<ae;k[ae]=0,z[ae]=-1;var J=Y[ae];if(J!==null)for(Y[ae]=null,ae=0;ae<J.length;ae++){var ee=J[ae];ee!==null&&(ee.lane&=-536870913)}s&=~ue}c!==0&&Te(t,c,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(w&~n))}function Te(t,n,s){t.pendingLanes|=n,t.suspendedLanes&=~n;var c=31-q(n);t.entangledLanes|=n,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function Ue(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var c=31-q(s),h=1<<c;h&n|t[c]&n&&(t[c]|=n),s&=~h}}function st(t,n){var s=n&-n;return s=(s&42)!==0?1:Dt(s),(s&(t.suspendedLanes|n))!==0?0:s}function Dt(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function nn(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Kt(){var t=fe.p;return t!==0?t:(t=window.event,t===void 0?32:wS(t.type))}function qn(t,n){var s=fe.p;try{return fe.p=t,n()}finally{fe.p=s}}var Ln=Math.random().toString(36).slice(2),an="__reactFiber$"+Ln,vn="__reactProps$"+Ln,Or="__reactContainer$"+Ln,To="__reactEvents$"+Ln,gf="__reactListeners$"+Ln,bc="__reactHandles$"+Ln,Ba="__reactResources$"+Ln,yi="__reactMarker$"+Ln;function Ro(t){delete t[an],delete t[vn],delete t[To],delete t[gf],delete t[bc]}function Lr(t){var n=t[an];if(n)return n;for(var s=t.parentNode;s;){if(n=s[Or]||s[an]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(t=iS(t);t!==null;){if(s=t[an])return s;t=iS(t)}return n}t=s,s=t.parentNode}return null}function Pa(t){if(t=t[an]||t[Or]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function nr(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(r(33))}function Mr(t){var n=t[Ba];return n||(n=t[Ba]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Wt(t){t[yi]=!0}var vc=new Set,Sc={};function _a(t,n){$r(t,n),$r(t+"Capture",n)}function $r(t,n){for(Sc[t]=n,t=0;t<n.length;t++)vc.add(n[t])}var pf=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]*$"),wc={},Cc={};function mf(t){return Dn.call(Cc,t)?!0:Dn.call(wc,t)?!1:pf.test(t)?Cc[t]=!0:(wc[t]=!0,!1)}function Mn(t,n,s){if(mf(n))if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var c=n.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+s)}}function bi(t,n,s){if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+s)}}function dn(t,n,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(n,s,""+c)}}function Sn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ec(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function yf(t,n,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var h=c.get,p=c.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){s=""+w,p.call(this,w)}}),Object.defineProperty(t,n,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(w){s=""+w},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function ko(t){if(!t._valueTracker){var n=Ec(t)?"checked":"value";t._valueTracker=yf(t,n,""+t[n])}}function _c(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),c="";return t&&(c=Ec(t)?t.checked?"true":"false":t.value),t=c,t!==s?(n.setValue(t),!0):!1}function Nr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var bf=/[\n"\\]/g;function $n(t){return t.replace(bf,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function us(t,n,s,c,h,p,w,k){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Sn(n)):t.value!==""+Sn(n)&&(t.value=""+Sn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?ar(t,w,Sn(n)):s!=null?ar(t,w,Sn(s)):c!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?t.name=""+Sn(k):t.removeAttribute("name")}function vi(t,n,s,c,h,p,w,k){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),n!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){ko(t);return}s=s!=null?""+Sn(s):"",n=n!=null?""+Sn(n):s,k||n===t.value||(t.value=n),t.defaultValue=n}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=k?t.checked:!!c,t.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),ko(t)}function ar(t,n,s){n==="number"&&Nr(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function Ir(t,n,s,c){if(t=t.options,n){n={};for(var h=0;h<s.length;h++)n["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=n.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&c&&(t[s].defaultSelected=!0)}else{for(s=""+Sn(s),n=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,c&&(t[h].defaultSelected=!0);return}n!==null||t[h].disabled||(n=t[h])}n!==null&&(n.selected=!0)}}function Hr(t,n,s){if(n!=null&&(n=""+Sn(n),n!==t.value&&(t.value=n),s==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=s!=null?""+Sn(s):""}function Ac(t,n,s,c){if(n==null){if(c!=null){if(s!=null)throw Error(r(92));if(ht(c)){if(1<c.length)throw Error(r(93));c=c[0]}s=c}s==null&&(s=""),n=s}s=Sn(n),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),ko(t)}function zr(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var vf=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 xc(t,n,s){var c=n.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":c?t.setProperty(n,s):typeof s!="number"||s===0||vf.has(n)?n==="float"?t.cssFloat=s:t[n]=(""+s).trim():t[n]=s+"px"}function Tc(t,n,s){if(n!=null&&typeof n!="object")throw Error(r(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||n!=null&&n.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var h in n)c=n[h],n.hasOwnProperty(h)&&s[h]!==c&&xc(t,h,c)}else for(var p in n)n.hasOwnProperty(p)&&xc(t,p,n[p])}function Do(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Sf=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"]]),Oo=/^[\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 na(t){return Oo.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Aa(){}var Lo=null;function Mo(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var jr=null,rr=null;function Rc(t){var n=Pa(t);if(n&&(t=n.stateNode)){var s=t[vn]||null;e:switch(t=n.stateNode,n.type){case"input":if(us(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),n=s.name,s.type==="radio"&&n!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+$n(""+n)+'"][type="radio"]'),n=0;n<s.length;n++){var c=s[n];if(c!==t&&c.form===t.form){var h=c[vn]||null;if(!h)throw Error(r(90));us(c,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<s.length;n++)c=s[n],c.form===t.form&&_c(c)}break e;case"textarea":Hr(t,s.value,s.defaultValue);break e;case"select":n=s.value,n!=null&&Ir(t,!!s.multiple,n,!1)}}}var ds=!1;function kc(t,n,s){if(ds)return t(n,s);ds=!0;try{var c=t(n);return c}finally{if(ds=!1,(jr!==null||rr!==null)&&(Cu(),jr&&(n=jr,t=rr,rr=jr=null,Rc(n),t)))for(n=0;n<t.length;n++)Rc(t[n])}}function Si(t,n){var s=t.stateNode;if(s===null)return null;var c=s[vn]||null;if(c===null)return null;s=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(r(231,n,typeof s));return s}var xa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$o=!1;if(xa)try{var wi={};Object.defineProperty(wi,"passive",{get:function(){$o=!0}}),window.addEventListener("test",wi,wi),window.removeEventListener("test",wi,wi)}catch{$o=!1}var qa=null,No=null,fs=null;function Dc(){if(fs)return fs;var t,n=No,s=n.length,c,h="value"in qa?qa.value:qa.textContent,p=h.length;for(t=0;t<s&&n[t]===h[t];t++);var w=s-t;for(c=1;c<=w&&n[s-c]===h[p-c];c++);return fs=h.slice(t,1<c?1-c:void 0)}function Ci(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Io(){return!0}function Oc(){return!1}function Be(t){function n(s,c,h,p,w){this._reactName=s,this._targetInst=h,this.type=c,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var k in t)t.hasOwnProperty(k)&&(s=t[k],this[k]=s?s(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Io:Oc,this.isPropagationStopped=Oc,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Io)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Io)},persist:function(){},isPersistent:Io}),n}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ir=Be(Ta),Ei=b({},Ta,{view:0,detail:0}),wf=Be(Ei),hs,Ho,_i,gs=b({},Ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jo,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==_i&&(_i&&t.type==="mousemove"?(hs=t.screenX-_i.screenX,Ho=t.screenY-_i.screenY):Ho=hs=0,_i=t),hs)},movementY:function(t){return"movementY"in t?t.movementY:Ho}}),Lc=Be(gs),Cf=b({},gs,{dataTransfer:0}),hy=Be(Cf),Ef=b({},Ei,{relatedTarget:0}),zo=Be(Ef),gy=b({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),_f=Be(gy),Af=b({},Ta,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Mc=Be(Af),xf=b({},Ta,{data:0}),$c=Be(xf),Tf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Rf={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"},kf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nc(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=kf[t])?!!n[t]:!1}function jo(){return Nc}var Df=b({},Ei,{key:function(t){if(t.key){var n=Tf[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Ci(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Rf[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jo,charCode:function(t){return t.type==="keypress"?Ci(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ci(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Of=Be(Df),Lf=b({},gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ic=Be(Lf),Mf=b({},Ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jo}),$f=Be(Mf),rn=b({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),ps=Be(rn),Nf=b({},gs,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),_=Be(Nf),y=b({},Ta,{newState:0,oldState:0}),C=Be(y),O=[9,13,27,32],I=xa&&"CompositionEvent"in window,ne=null;xa&&"documentMode"in document&&(ne=document.documentMode);var pe=xa&&"TextEvent"in window&&!ne,Me=xa&&(!I||ne&&8<ne&&11>=ne),Ve=" ",ot=!1;function pt(t,n){switch(t){case"keyup":return O.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ra=!1;function If(t,n){switch(t){case"compositionend":return Nt(n);case"keypress":return n.which!==32?null:(ot=!0,Ve);case"textInput":return t=n.data,t===Ve&&ot?null:t;default:return null}}function Hc(t,n){if(Ra)return t==="compositionend"||!I&&pt(t,n)?(t=Dc(),fs=No=qa=null,Ra=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Me&&n.locale!=="ko"?null:n.data;default:return null}}var Hf={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 Uo(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Hf[t.type]:n==="textarea"}function zc(t,n,s,c){jr?rr?rr.push(c):rr=[c]:jr=c,n=ku(n,"onChange"),0<n.length&&(s=new ir("onChange","change",null,s,c),t.push({event:s,listeners:n}))}var Ur=null,Ai=null;function zf(t){Vv(t,0)}function xi(t){var n=nr(t);if(_c(n))return t}function Bo(t,n){if(t==="change")return n}var Po=!1;if(xa){var Ti;if(xa){var Ri="oninput"in document;if(!Ri){var qo=document.createElement("div");qo.setAttribute("oninput","return;"),Ri=typeof qo.oninput=="function"}Ti=Ri}else Ti=!1;Po=Ti&&(!document.documentMode||9<document.documentMode)}function jc(){Ur&&(Ur.detachEvent("onpropertychange",Uc),Ai=Ur=null)}function Uc(t){if(t.propertyName==="value"&&xi(Ai)){var n=[];zc(n,Ai,t,Mo(t)),kc(zf,n)}}function jf(t,n,s){t==="focusin"?(jc(),Ur=n,Ai=s,Ur.attachEvent("onpropertychange",Uc)):t==="focusout"&&jc()}function Uf(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return xi(Ai)}function Bc(t,n){if(t==="click")return xi(n)}function kA(t,n){if(t==="input"||t==="change")return xi(n)}function DA(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Gn=typeof Object.is=="function"?Object.is:DA;function Go(t,n){if(Gn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),c=Object.keys(n);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var h=s[c];if(!Dn.call(n,h)||!Gn(t[h],n[h]))return!1}return!0}function py(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function my(t,n){var s=py(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=n&&c>=n)return{node:s,offset:n-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=py(s)}}function yy(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?yy(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function by(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Nr(t.document);n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=Nr(t.document)}return n}function Bf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var OA=xa&&"documentMode"in document&&11>=document.documentMode,ms=null,Pf=null,Vo=null,qf=!1;function vy(t,n,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;qf||ms==null||ms!==Nr(c)||(c=ms,"selectionStart"in c&&Bf(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Vo&&Go(Vo,c)||(Vo=c,c=ku(Pf,"onSelect"),0<c.length&&(n=new ir("onSelect","select",null,n,s),t.push({event:n,listeners:c}),n.target=ms)))}function ki(t,n){var s={};return s[t.toLowerCase()]=n.toLowerCase(),s["Webkit"+t]="webkit"+n,s["Moz"+t]="moz"+n,s}var ys={animationend:ki("Animation","AnimationEnd"),animationiteration:ki("Animation","AnimationIteration"),animationstart:ki("Animation","AnimationStart"),transitionrun:ki("Transition","TransitionRun"),transitionstart:ki("Transition","TransitionStart"),transitioncancel:ki("Transition","TransitionCancel"),transitionend:ki("Transition","TransitionEnd")},Gf={},Sy={};xa&&(Sy=document.createElement("div").style,"AnimationEvent"in window||(delete ys.animationend.animation,delete ys.animationiteration.animation,delete ys.animationstart.animation),"TransitionEvent"in window||delete ys.transitionend.transition);function Di(t){if(Gf[t])return Gf[t];if(!ys[t])return t;var n=ys[t],s;for(s in n)if(n.hasOwnProperty(s)&&s in Sy)return Gf[t]=n[s];return t}var wy=Di("animationend"),Cy=Di("animationiteration"),Ey=Di("animationstart"),LA=Di("transitionrun"),MA=Di("transitionstart"),$A=Di("transitioncancel"),_y=Di("transitionend"),Ay=new Map,Vf="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(" ");Vf.push("scrollEnd");function ka(t,n){Ay.set(t,n),_a(n,[t])}var Pc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},aa=[],bs=0,Ff=0;function qc(){for(var t=bs,n=Ff=bs=0;n<t;){var s=aa[n];aa[n++]=null;var c=aa[n];aa[n++]=null;var h=aa[n];aa[n++]=null;var p=aa[n];if(aa[n++]=null,c!==null&&h!==null){var w=c.pending;w===null?h.next=h:(h.next=w.next,w.next=h),c.pending=h}p!==0&&xy(s,h,p)}}function Gc(t,n,s,c){aa[bs++]=t,aa[bs++]=n,aa[bs++]=s,aa[bs++]=c,Ff|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function Kf(t,n,s,c){return Gc(t,n,s,c),Vc(t)}function Oi(t,n){return Gc(t,null,null,n),Vc(t)}function xy(t,n,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,c=p.alternate,c!==null&&(c.childLanes|=s),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&n!==null&&(h=31-q(s),t=p.hiddenUpdates,c=t[h],c===null?t[h]=[n]:c.push(n),n.lane=s|536870912),p):null}function Vc(t){if(50<hl)throw hl=0,ng=null,Error(r(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var vs={};function NA(t,n,s,c){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vn(t,n,s,c){return new NA(t,n,s,c)}function Wf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function sr(t,n){var s=t.alternate;return s===null?(s=Vn(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Ty(t,n){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,n=s.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Fc(t,n,s,c,h,p){var w=0;if(c=t,typeof t=="function")Wf(t)&&(w=1);else if(typeof t=="string")w=Ux(t,s,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ge:return t=Vn(31,s,n,h),t.elementType=ge,t.lanes=p,t;case A:return Li(s.children,h,p,n);case T:w=8,h|=24;break;case L:return t=Vn(12,s,n,h|2),t.elementType=L,t.lanes=p,t;case U:return t=Vn(13,s,n,h),t.elementType=U,t.lanes=p,t;case j:return t=Vn(19,s,n,h),t.elementType=j,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case R:w=10;break e;case M:w=9;break e;case D:w=11;break e;case P:w=14;break e;case X:w=16,c=null;break e}w=29,s=Error(r(130,t===null?"null":typeof t,"")),c=null}return n=Vn(w,s,n,h),n.elementType=t,n.type=c,n.lanes=p,n}function Li(t,n,s,c){return t=Vn(7,t,c,n),t.lanes=s,t}function Yf(t,n,s){return t=Vn(6,t,null,n),t.lanes=s,t}function Ry(t){var n=Vn(18,null,null,0);return n.stateNode=t,n}function Xf(t,n,s){return n=Vn(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var ky=new WeakMap;function ra(t,n){if(typeof t=="object"&&t!==null){var s=ky.get(t);return s!==void 0?s:(n={value:t,source:n,stack:kn(n)},ky.set(t,n),n)}return{value:t,source:n,stack:kn(n)}}var Ss=[],ws=0,Kc=null,Fo=0,ia=[],sa=0,Br=null,Ga=1,Va="";function or(t,n){Ss[ws++]=Fo,Ss[ws++]=Kc,Kc=t,Fo=n}function Dy(t,n,s){ia[sa++]=Ga,ia[sa++]=Va,ia[sa++]=Br,Br=t;var c=Ga;t=Va;var h=32-q(c)-1;c&=~(1<<h),s+=1;var p=32-q(n)+h;if(30<p){var w=h-h%5;p=(c&(1<<w)-1).toString(32),c>>=w,h-=w,Ga=1<<32-q(n)+h|s<<h|c,Va=p+t}else Ga=1<<p|s<<h|c,Va=t}function Jf(t){t.return!==null&&(or(t,1),Dy(t,1,0))}function Qf(t){for(;t===Kc;)Kc=Ss[--ws],Ss[ws]=null,Fo=Ss[--ws],Ss[ws]=null;for(;t===Br;)Br=ia[--sa],ia[sa]=null,Va=ia[--sa],ia[sa]=null,Ga=ia[--sa],ia[sa]=null}function Oy(t,n){ia[sa++]=Ga,ia[sa++]=Va,ia[sa++]=Br,Ga=n.id,Va=n.overflow,Br=t}var fn=null,Ot=null,lt=!1,Pr=null,oa=!1,Zf=Error(r(519));function qr(t){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ko(ra(n,t)),Zf}function Ly(t){var n=t.stateNode,s=t.type,c=t.memoizedProps;switch(n[an]=t,n[vn]=c,s){case"dialog":nt("cancel",n),nt("close",n);break;case"iframe":case"object":case"embed":nt("load",n);break;case"video":case"audio":for(s=0;s<pl.length;s++)nt(pl[s],n);break;case"source":nt("error",n);break;case"img":case"image":case"link":nt("error",n),nt("load",n);break;case"details":nt("toggle",n);break;case"input":nt("invalid",n),vi(n,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":nt("invalid",n);break;case"textarea":nt("invalid",n),Ac(n,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||n.textContent===""+s||c.suppressHydrationWarning===!0||Yv(n.textContent,s)?(c.popover!=null&&(nt("beforetoggle",n),nt("toggle",n)),c.onScroll!=null&&nt("scroll",n),c.onScrollEnd!=null&&nt("scrollend",n),c.onClick!=null&&(n.onclick=Aa),n=!0):n=!1,n||qr(t,!0)}function My(t){for(fn=t.return;fn;)switch(fn.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:fn=fn.return}}function Cs(t){if(t!==fn)return!1;if(!lt)return My(t),lt=!0,!1;var n=t.tag,s;if((s=n!==3&&n!==27)&&((s=n===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||yg(t.type,t.memoizedProps)),s=!s),s&&Ot&&qr(t),My(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));Ot=rS(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));Ot=rS(t)}else n===27?(n=Ot,ai(t.type)?(t=Cg,Cg=null,Ot=t):Ot=n):Ot=fn?ca(t.stateNode.nextSibling):null;return!0}function Mi(){Ot=fn=null,lt=!1}function eh(){var t=Pr;return t!==null&&(zn===null?zn=t:zn.push.apply(zn,t),Pr=null),t}function Ko(t){Pr===null?Pr=[t]:Pr.push(t)}var th=x(null),$i=null,lr=null;function Gr(t,n,s){re(th,n._currentValue),n._currentValue=s}function cr(t){t._currentValue=th.current,K(th)}function nh(t,n,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),t===s)break;t=t.return}}function ah(t,n,s,c){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=h;for(var z=0;z<n.length;z++)if(k.context===n[z]){p.lanes|=s,k=p.alternate,k!==null&&(k.lanes|=s),nh(p.return,s,t),c||(w=null);break e}p=k.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(r(341));w.lanes|=s,p=w.alternate,p!==null&&(p.lanes|=s),nh(w,s,t),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===t){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Es(t,n,s,c){t=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var k=h.type;Gn(h.pendingProps.value,w.value)||(t!==null?t.push(k):t=[k])}}else if(h===Ne.current){if(w=h.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Sl):t=[Sl])}h=h.return}t!==null&&ah(n,t,s,c),n.flags|=262144}function Wc(t){for(t=t.firstContext;t!==null;){if(!Gn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ni(t){$i=t,lr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function hn(t){return $y($i,t)}function Yc(t,n){return $i===null&&Ni(t),$y(t,n)}function $y(t,n){var s=n._currentValue;if(n={context:n,memoizedValue:s,next:null},lr===null){if(t===null)throw Error(r(308));lr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else lr=lr.next=n;return s}var IA=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){n.aborted=!0,t.forEach(function(s){return s()})}},HA=o.unstable_scheduleCallback,zA=o.unstable_NormalPriority,Yt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rh(){return{controller:new IA,data:new Map,refCount:0}}function Wo(t){t.refCount--,t.refCount===0&&HA(zA,function(){t.controller.abort()})}var Yo=null,ih=0,_s=0,As=null;function jA(t,n){if(Yo===null){var s=Yo=[];ih=0,_s=lg(),As={status:"pending",value:void 0,then:function(c){s.push(c)}}}return ih++,n.then(Ny,Ny),n}function Ny(){if(--ih===0&&Yo!==null){As!==null&&(As.status="fulfilled");var t=Yo;Yo=null,_s=0,As=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function UA(t,n){var s=[],c={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){c.status="fulfilled",c.value=n;for(var h=0;h<s.length;h++)(0,s[h])(n)},function(h){for(c.status="rejected",c.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),c}var Iy=Q.S;Q.S=function(t,n){vv=Ft(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&jA(t,n),Iy!==null&&Iy(t,n)};var Ii=x(null);function sh(){var t=Ii.current;return t!==null?t:kt.pooledCache}function Xc(t,n){n===null?re(Ii,Ii.current):re(Ii,n.pool)}function Hy(){var t=sh();return t===null?null:{parent:Yt._currentValue,pool:t}}var xs=Error(r(460)),oh=Error(r(474)),Jc=Error(r(542)),Qc={then:function(){}};function zy(t){return t=t.status,t==="fulfilled"||t==="rejected"}function jy(t,n,s){switch(s=t[s],s===void 0?t.push(n):s!==n&&(n.then(Aa,Aa),n=s),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,By(t),t;default:if(typeof n.status=="string")n.then(Aa,Aa);else{if(t=kt,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=n,t.status="pending",t.then(function(c){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=c}},function(c){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=c}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,By(t),t}throw zi=n,xs}}function Hi(t){try{var n=t._init;return n(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(zi=s,xs):s}}var zi=null;function Uy(){if(zi===null)throw Error(r(459));var t=zi;return zi=null,t}function By(t){if(t===xs||t===Jc)throw Error(r(483))}var Ts=null,Xo=0;function Zc(t){var n=Xo;return Xo+=1,Ts===null&&(Ts=[]),jy(Ts,t,n)}function Jo(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function eu(t,n){throw n.$$typeof===v?Error(r(525)):(t=Object.prototype.toString.call(n),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Py(t){function n(V,G){if(t){var W=V.deletions;W===null?(V.deletions=[G],V.flags|=16):W.push(G)}}function s(V,G){if(!t)return null;for(;G!==null;)n(V,G),G=G.sibling;return null}function c(V){for(var G=new Map;V!==null;)V.key!==null?G.set(V.key,V):G.set(V.index,V),V=V.sibling;return G}function h(V,G){return V=sr(V,G),V.index=0,V.sibling=null,V}function p(V,G,W){return V.index=W,t?(W=V.alternate,W!==null?(W=W.index,W<G?(V.flags|=67108866,G):W):(V.flags|=67108866,G)):(V.flags|=1048576,G)}function w(V){return t&&V.alternate===null&&(V.flags|=67108866),V}function k(V,G,W,oe){return G===null||G.tag!==6?(G=Yf(W,V.mode,oe),G.return=V,G):(G=h(G,W),G.return=V,G)}function z(V,G,W,oe){var qe=W.type;return qe===A?ae(V,G,W.props.children,oe,W.key):G!==null&&(G.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===X&&Hi(qe)===G.type)?(G=h(G,W.props),Jo(G,W),G.return=V,G):(G=Fc(W.type,W.key,W.props,null,V.mode,oe),Jo(G,W),G.return=V,G)}function Y(V,G,W,oe){return G===null||G.tag!==4||G.stateNode.containerInfo!==W.containerInfo||G.stateNode.implementation!==W.implementation?(G=Xf(W,V.mode,oe),G.return=V,G):(G=h(G,W.children||[]),G.return=V,G)}function ae(V,G,W,oe,qe){return G===null||G.tag!==7?(G=Li(W,V.mode,oe,qe),G.return=V,G):(G=h(G,W),G.return=V,G)}function ue(V,G,W){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Yf(""+G,V.mode,W),G.return=V,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case S:return W=Fc(G.type,G.key,G.props,null,V.mode,W),Jo(W,G),W.return=V,W;case E:return G=Xf(G,V.mode,W),G.return=V,G;case X:return G=Hi(G),ue(V,G,W)}if(ht(G)||$e(G))return G=Li(G,V.mode,W,null),G.return=V,G;if(typeof G.then=="function")return ue(V,Zc(G),W);if(G.$$typeof===R)return ue(V,Yc(V,G),W);eu(V,G)}return null}function J(V,G,W,oe){var qe=G!==null?G.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return qe!==null?null:k(V,G,""+W,oe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return W.key===qe?z(V,G,W,oe):null;case E:return W.key===qe?Y(V,G,W,oe):null;case X:return W=Hi(W),J(V,G,W,oe)}if(ht(W)||$e(W))return qe!==null?null:ae(V,G,W,oe,null);if(typeof W.then=="function")return J(V,G,Zc(W),oe);if(W.$$typeof===R)return J(V,G,Yc(V,W),oe);eu(V,W)}return null}function ee(V,G,W,oe,qe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return V=V.get(W)||null,k(G,V,""+oe,qe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return V=V.get(oe.key===null?W:oe.key)||null,z(G,V,oe,qe);case E:return V=V.get(oe.key===null?W:oe.key)||null,Y(G,V,oe,qe);case X:return oe=Hi(oe),ee(V,G,W,oe,qe)}if(ht(oe)||$e(oe))return V=V.get(W)||null,ae(G,V,oe,qe,null);if(typeof oe.then=="function")return ee(V,G,W,Zc(oe),qe);if(oe.$$typeof===R)return ee(V,G,W,Yc(G,oe),qe);eu(G,oe)}return null}function De(V,G,W,oe){for(var qe=null,mt=null,Ie=G,Qe=G=0,rt=null;Ie!==null&&Qe<W.length;Qe++){Ie.index>Qe?(rt=Ie,Ie=null):rt=Ie.sibling;var yt=J(V,Ie,W[Qe],oe);if(yt===null){Ie===null&&(Ie=rt);break}t&&Ie&&yt.alternate===null&&n(V,Ie),G=p(yt,G,Qe),mt===null?qe=yt:mt.sibling=yt,mt=yt,Ie=rt}if(Qe===W.length)return s(V,Ie),lt&&or(V,Qe),qe;if(Ie===null){for(;Qe<W.length;Qe++)Ie=ue(V,W[Qe],oe),Ie!==null&&(G=p(Ie,G,Qe),mt===null?qe=Ie:mt.sibling=Ie,mt=Ie);return lt&&or(V,Qe),qe}for(Ie=c(Ie);Qe<W.length;Qe++)rt=ee(Ie,V,Qe,W[Qe],oe),rt!==null&&(t&&rt.alternate!==null&&Ie.delete(rt.key===null?Qe:rt.key),G=p(rt,G,Qe),mt===null?qe=rt:mt.sibling=rt,mt=rt);return t&&Ie.forEach(function(li){return n(V,li)}),lt&&or(V,Qe),qe}function Ge(V,G,W,oe){if(W==null)throw Error(r(151));for(var qe=null,mt=null,Ie=G,Qe=G=0,rt=null,yt=W.next();Ie!==null&&!yt.done;Qe++,yt=W.next()){Ie.index>Qe?(rt=Ie,Ie=null):rt=Ie.sibling;var li=J(V,Ie,yt.value,oe);if(li===null){Ie===null&&(Ie=rt);break}t&&Ie&&li.alternate===null&&n(V,Ie),G=p(li,G,Qe),mt===null?qe=li:mt.sibling=li,mt=li,Ie=rt}if(yt.done)return s(V,Ie),lt&&or(V,Qe),qe;if(Ie===null){for(;!yt.done;Qe++,yt=W.next())yt=ue(V,yt.value,oe),yt!==null&&(G=p(yt,G,Qe),mt===null?qe=yt:mt.sibling=yt,mt=yt);return lt&&or(V,Qe),qe}for(Ie=c(Ie);!yt.done;Qe++,yt=W.next())yt=ee(Ie,V,Qe,yt.value,oe),yt!==null&&(t&&yt.alternate!==null&&Ie.delete(yt.key===null?Qe:yt.key),G=p(yt,G,Qe),mt===null?qe=yt:mt.sibling=yt,mt=yt);return t&&Ie.forEach(function(Jx){return n(V,Jx)}),lt&&or(V,Qe),qe}function Tt(V,G,W,oe){if(typeof W=="object"&&W!==null&&W.type===A&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case S:e:{for(var qe=W.key;G!==null;){if(G.key===qe){if(qe=W.type,qe===A){if(G.tag===7){s(V,G.sibling),oe=h(G,W.props.children),oe.return=V,V=oe;break e}}else if(G.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===X&&Hi(qe)===G.type){s(V,G.sibling),oe=h(G,W.props),Jo(oe,W),oe.return=V,V=oe;break e}s(V,G);break}else n(V,G);G=G.sibling}W.type===A?(oe=Li(W.props.children,V.mode,oe,W.key),oe.return=V,V=oe):(oe=Fc(W.type,W.key,W.props,null,V.mode,oe),Jo(oe,W),oe.return=V,V=oe)}return w(V);case E:e:{for(qe=W.key;G!==null;){if(G.key===qe)if(G.tag===4&&G.stateNode.containerInfo===W.containerInfo&&G.stateNode.implementation===W.implementation){s(V,G.sibling),oe=h(G,W.children||[]),oe.return=V,V=oe;break e}else{s(V,G);break}else n(V,G);G=G.sibling}oe=Xf(W,V.mode,oe),oe.return=V,V=oe}return w(V);case X:return W=Hi(W),Tt(V,G,W,oe)}if(ht(W))return De(V,G,W,oe);if($e(W)){if(qe=$e(W),typeof qe!="function")throw Error(r(150));return W=qe.call(W),Ge(V,G,W,oe)}if(typeof W.then=="function")return Tt(V,G,Zc(W),oe);if(W.$$typeof===R)return Tt(V,G,Yc(V,W),oe);eu(V,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,G!==null&&G.tag===6?(s(V,G.sibling),oe=h(G,W),oe.return=V,V=oe):(s(V,G),oe=Yf(W,V.mode,oe),oe.return=V,V=oe),w(V)):s(V,G)}return function(V,G,W,oe){try{Xo=0;var qe=Tt(V,G,W,oe);return Ts=null,qe}catch(Ie){if(Ie===xs||Ie===Jc)throw Ie;var mt=Vn(29,Ie,null,V.mode);return mt.lanes=oe,mt.return=V,mt}}}var ji=Py(!0),qy=Py(!1),Vr=!1;function lh(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ch(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Fr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Kr(t,n,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(vt&2)!==0){var h=c.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),c.pending=n,n=Vc(t),xy(t,null,s),n}return Gc(t,c,n,s),Vc(t)}function Qo(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194048)!==0)){var c=n.lanes;c&=t.pendingLanes,s|=c,n.lanes=s,Ue(t,s)}}function uh(t,n){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var w={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,s=s.next}while(s!==null);p===null?h=p=n:p=p.next=n}else h=p=n;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}var dh=!1;function Zo(){if(dh){var t=As;if(t!==null)throw t}}function el(t,n,s,c){dh=!1;var h=t.updateQueue;Vr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,k=h.shared.pending;if(k!==null){h.shared.pending=null;var z=k,Y=z.next;z.next=null,w===null?p=Y:w.next=Y,w=z;var ae=t.alternate;ae!==null&&(ae=ae.updateQueue,k=ae.lastBaseUpdate,k!==w&&(k===null?ae.firstBaseUpdate=Y:k.next=Y,ae.lastBaseUpdate=z))}if(p!==null){var ue=h.baseState;w=0,ae=Y=z=null,k=p;do{var J=k.lane&-536870913,ee=J!==k.lane;if(ee?(at&J)===J:(c&J)===J){J!==0&&J===_s&&(dh=!0),ae!==null&&(ae=ae.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var De=t,Ge=k;J=n;var Tt=s;switch(Ge.tag){case 1:if(De=Ge.payload,typeof De=="function"){ue=De.call(Tt,ue,J);break e}ue=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ge.payload,J=typeof De=="function"?De.call(Tt,ue,J):De,J==null)break e;ue=b({},ue,J);break e;case 2:Vr=!0}}J=k.callback,J!==null&&(t.flags|=64,ee&&(t.flags|=8192),ee=h.callbacks,ee===null?h.callbacks=[J]:ee.push(J))}else ee={lane:J,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ae===null?(Y=ae=ee,z=ue):ae=ae.next=ee,w|=J;if(k=k.next,k===null){if(k=h.shared.pending,k===null)break;ee=k,k=ee.next,ee.next=null,h.lastBaseUpdate=ee,h.shared.pending=null}}while(!0);ae===null&&(z=ue),h.baseState=z,h.firstBaseUpdate=Y,h.lastBaseUpdate=ae,p===null&&(h.shared.lanes=0),Qr|=w,t.lanes=w,t.memoizedState=ue}}function Gy(t,n){if(typeof t!="function")throw Error(r(191,t));t.call(n)}function Vy(t,n){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)Gy(s[t],n)}var Rs=x(null),tu=x(0);function Fy(t,n){t=br,re(tu,t),re(Rs,n),br=t|n.baseLanes}function fh(){re(tu,br),re(Rs,Rs.current)}function hh(){br=tu.current,K(Rs),K(tu)}var Fn=x(null),la=null;function Wr(t){var n=t.alternate;re(qt,qt.current&1),re(Fn,t),la===null&&(n===null||Rs.current!==null||n.memoizedState!==null)&&(la=t)}function gh(t){re(qt,qt.current),re(Fn,t),la===null&&(la=t)}function Ky(t){t.tag===22?(re(qt,qt.current),re(Fn,t),la===null&&(la=t)):Yr()}function Yr(){re(qt,qt.current),re(Fn,Fn.current)}function Kn(t){K(Fn),la===t&&(la=null),K(qt)}var qt=x(0);function nu(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Sg(s)||wg(s)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ur=0,Je=null,At=null,Xt=null,au=!1,ks=!1,Ui=!1,ru=0,tl=0,Ds=null,BA=0;function Ut(){throw Error(r(321))}function ph(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!Gn(t[s],n[s]))return!1;return!0}function mh(t,n,s,c,h,p){return ur=p,Je=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Q.H=t===null||t.memoizedState===null?Db:Oh,Ui=!1,p=s(c,h),Ui=!1,ks&&(p=Yy(n,s,c,h)),Wy(t),p}function Wy(t){Q.H=rl;var n=At!==null&&At.next!==null;if(ur=0,Xt=At=Je=null,au=!1,tl=0,Ds=null,n)throw Error(r(300));t===null||Jt||(t=t.dependencies,t!==null&&Wc(t)&&(Jt=!0))}function Yy(t,n,s,c){Je=t;var h=0;do{if(ks&&(Ds=null),tl=0,ks=!1,25<=h)throw Error(r(301));if(h+=1,Xt=At=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}Q.H=Ob,p=n(s,c)}while(ks);return p}function PA(){var t=Q.H,n=t.useState()[0];return n=typeof n.then=="function"?nl(n):n,t=t.useState()[0],(At!==null?At.memoizedState:null)!==t&&(Je.flags|=1024),n}function yh(){var t=ru!==0;return ru=0,t}function bh(t,n,s){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~s}function vh(t){if(au){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}au=!1}ur=0,Xt=At=Je=null,ks=!1,tl=ru=0,Ds=null}function An(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Je.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Gt(){if(At===null){var t=Je.alternate;t=t!==null?t.memoizedState:null}else t=At.next;var n=Xt===null?Je.memoizedState:Xt.next;if(n!==null)Xt=n,At=t;else{if(t===null)throw Je.alternate===null?Error(r(467)):Error(r(310));At=t,t={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},Xt===null?Je.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function iu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function nl(t){var n=tl;return tl+=1,Ds===null&&(Ds=[]),t=jy(Ds,t,n),n=Je,(Xt===null?n.memoizedState:Xt.next)===null&&(n=n.alternate,Q.H=n===null||n.memoizedState===null?Db:Oh),t}function su(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return nl(t);if(t.$$typeof===R)return hn(t)}throw Error(r(438,String(t)))}function Sh(t){var n=null,s=Je.updateQueue;if(s!==null&&(n=s.memoCache),n==null){var c=Je.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(n={data:c.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),s===null&&(s=iu(),Je.updateQueue=s),s.memoCache=n,s=n.data[n.index],s===void 0)for(s=n.data[n.index]=Array(t),c=0;c<t;c++)s[c]=Ee;return n.index++,s}function dr(t,n){return typeof n=="function"?n(t):n}function ou(t){var n=Gt();return wh(n,At,t)}function wh(t,n,s){var c=t.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var h=t.baseQueue,p=c.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,c.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{n=h.next;var k=w=null,z=null,Y=n,ae=!1;do{var ue=Y.lane&-536870913;if(ue!==Y.lane?(at&ue)===ue:(ur&ue)===ue){var J=Y.revertLane;if(J===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ue===_s&&(ae=!0);else if((ur&J)===J){Y=Y.next,J===_s&&(ae=!0);continue}else ue={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(k=z=ue,w=p):z=z.next=ue,Je.lanes|=J,Qr|=J;ue=Y.action,Ui&&s(p,ue),p=Y.hasEagerState?Y.eagerState:s(p,ue)}else J={lane:ue,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(k=z=J,w=p):z=z.next=J,Je.lanes|=ue,Qr|=ue;Y=Y.next}while(Y!==null&&Y!==n);if(z===null?w=p:z.next=k,!Gn(p,t.memoizedState)&&(Jt=!0,ae&&(s=As,s!==null)))throw s;t.memoizedState=p,t.baseState=w,t.baseQueue=z,c.lastRenderedState=p}return h===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function Ch(t){var n=Gt(),s=n.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=t;var c=s.dispatch,h=s.pending,p=n.memoizedState;if(h!==null){s.pending=null;var w=h=h.next;do p=t(p,w.action),w=w.next;while(w!==h);Gn(p,n.memoizedState)||(Jt=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),s.lastRenderedState=p}return[p,c]}function Xy(t,n,s){var c=Je,h=Gt(),p=lt;if(p){if(s===void 0)throw Error(r(407));s=s()}else s=n();var w=!Gn((At||h).memoizedState,s);if(w&&(h.memoizedState=s,Jt=!0),h=h.queue,Ah(Zy.bind(null,c,h,t),[t]),h.getSnapshot!==n||w||Xt!==null&&Xt.memoizedState.tag&1){if(c.flags|=2048,Os(9,{destroy:void 0},Qy.bind(null,c,h,s,n),null),kt===null)throw Error(r(349));p||(ur&127)!==0||Jy(c,n,s)}return s}function Jy(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=Je.updateQueue,n===null?(n=iu(),Je.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function Qy(t,n,s,c){n.value=s,n.getSnapshot=c,eb(n)&&tb(t)}function Zy(t,n,s){return s(function(){eb(n)&&tb(t)})}function eb(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!Gn(t,s)}catch{return!0}}function tb(t){var n=Oi(t,2);n!==null&&jn(n,t,2)}function Eh(t){var n=An();if(typeof t=="function"){var s=t;if(t=s(),Ui){_n(!0);try{s()}finally{_n(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dr,lastRenderedState:t},n}function nb(t,n,s,c){return t.baseState=s,wh(t,At,typeof c=="function"?c:dr)}function qA(t,n,s,c,h){if(uu(t))throw Error(r(485));if(t=n.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};Q.T!==null?s(!0):p.isTransition=!1,c(p),s=n.pending,s===null?(p.next=n.pending=p,ab(n,p)):(p.next=s.next,n.pending=s.next=p)}}function ab(t,n){var s=n.action,c=n.payload,h=t.state;if(n.isTransition){var p=Q.T,w={};Q.T=w;try{var k=s(h,c),z=Q.S;z!==null&&z(w,k),rb(t,n,k)}catch(Y){_h(t,n,Y)}finally{p!==null&&w.types!==null&&(p.types=w.types),Q.T=p}}else try{p=s(h,c),rb(t,n,p)}catch(Y){_h(t,n,Y)}}function rb(t,n,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){ib(t,n,c)},function(c){return _h(t,n,c)}):ib(t,n,s)}function ib(t,n,s){n.status="fulfilled",n.value=s,sb(n),t.state=s,n=t.pending,n!==null&&(s=n.next,s===n?t.pending=null:(s=s.next,n.next=s,ab(t,s)))}function _h(t,n,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do n.status="rejected",n.reason=s,sb(n),n=n.next;while(n!==c)}t.action=null}function sb(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function ob(t,n){return n}function lb(t,n){if(lt){var s=kt.formState;if(s!==null){e:{var c=Je;if(lt){if(Ot){t:{for(var h=Ot,p=oa;h.nodeType!==8;){if(!p){h=null;break t}if(h=ca(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ot=ca(h.nextSibling),c=h.data==="F!";break e}}qr(c)}c=!1}c&&(n=s[0])}}return s=An(),s.memoizedState=s.baseState=n,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ob,lastRenderedState:n},s.queue=c,s=Tb.bind(null,Je,c),c.dispatch=s,c=Eh(!1),p=Dh.bind(null,Je,!1,c.queue),c=An(),h={state:n,dispatch:null,action:t,pending:null},c.queue=h,s=qA.bind(null,Je,h,p,s),h.dispatch=s,c.memoizedState=t,[n,s,!1]}function cb(t){var n=Gt();return ub(n,At,t)}function ub(t,n,s){if(n=wh(t,n,ob)[0],t=ou(dr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var c=nl(n)}catch(w){throw w===xs?Jc:w}else c=n;n=Gt();var h=n.queue,p=h.dispatch;return s!==n.memoizedState&&(Je.flags|=2048,Os(9,{destroy:void 0},GA.bind(null,h,s),null)),[c,p,t]}function GA(t,n){t.action=n}function db(t){var n=Gt(),s=At;if(s!==null)return ub(n,s,t);Gt(),n=n.memoizedState,s=Gt();var c=s.queue.dispatch;return s.memoizedState=t,[n,c,!1]}function Os(t,n,s,c){return t={tag:t,create:s,deps:c,inst:n,next:null},n=Je.updateQueue,n===null&&(n=iu(),Je.updateQueue=n),s=n.lastEffect,s===null?n.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,n.lastEffect=t),t}function fb(){return Gt().memoizedState}function lu(t,n,s,c){var h=An();Je.flags|=t,h.memoizedState=Os(1|n,{destroy:void 0},s,c===void 0?null:c)}function cu(t,n,s,c){var h=Gt();c=c===void 0?null:c;var p=h.memoizedState.inst;At!==null&&c!==null&&ph(c,At.memoizedState.deps)?h.memoizedState=Os(n,p,s,c):(Je.flags|=t,h.memoizedState=Os(1|n,p,s,c))}function hb(t,n){lu(8390656,8,t,n)}function Ah(t,n){cu(2048,8,t,n)}function VA(t){Je.flags|=4;var n=Je.updateQueue;if(n===null)n=iu(),Je.updateQueue=n,n.events=[t];else{var s=n.events;s===null?n.events=[t]:s.push(t)}}function gb(t){var n=Gt().memoizedState;return VA({ref:n,nextImpl:t}),function(){if((vt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function pb(t,n){return cu(4,2,t,n)}function mb(t,n){return cu(4,4,t,n)}function yb(t,n){if(typeof n=="function"){t=t();var s=n(t);return function(){typeof s=="function"?s():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function bb(t,n,s){s=s!=null?s.concat([t]):null,cu(4,4,yb.bind(null,n,t),s)}function xh(){}function vb(t,n){var s=Gt();n=n===void 0?null:n;var c=s.memoizedState;return n!==null&&ph(n,c[1])?c[0]:(s.memoizedState=[t,n],t)}function Sb(t,n){var s=Gt();n=n===void 0?null:n;var c=s.memoizedState;if(n!==null&&ph(n,c[1]))return c[0];if(c=t(),Ui){_n(!0);try{t()}finally{_n(!1)}}return s.memoizedState=[c,n],c}function Th(t,n,s){return s===void 0||(ur&1073741824)!==0&&(at&261930)===0?t.memoizedState=n:(t.memoizedState=s,t=wv(),Je.lanes|=t,Qr|=t,s)}function wb(t,n,s,c){return Gn(s,n)?s:Rs.current!==null?(t=Th(t,s,c),Gn(t,n)||(Jt=!0),t):(ur&42)===0||(ur&1073741824)!==0&&(at&261930)===0?(Jt=!0,t.memoizedState=s):(t=wv(),Je.lanes|=t,Qr|=t,n)}function Cb(t,n,s,c,h){var p=fe.p;fe.p=p!==0&&8>p?p:8;var w=Q.T,k={};Q.T=k,Dh(t,!1,n,s);try{var z=h(),Y=Q.S;if(Y!==null&&Y(k,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var ae=UA(z,c);al(t,n,ae,Xn(t))}else al(t,n,c,Xn(t))}catch(ue){al(t,n,{then:function(){},status:"rejected",reason:ue},Xn())}finally{fe.p=p,w!==null&&k.types!==null&&(w.types=k.types),Q.T=w}}function FA(){}function Rh(t,n,s,c){if(t.tag!==5)throw Error(r(476));var h=Eb(t).queue;Cb(t,h,n,ye,s===null?FA:function(){return _b(t),s(c)})}function Eb(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dr,lastRenderedState:ye},next:null};var s={};return n.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dr,lastRenderedState:s},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function _b(t){var n=Eb(t);n.next===null&&(n=t.alternate.memoizedState),al(t,n.next.queue,{},Xn())}function kh(){return hn(Sl)}function Ab(){return Gt().memoizedState}function xb(){return Gt().memoizedState}function KA(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var s=Xn();t=Fr(s);var c=Kr(n,t,s);c!==null&&(jn(c,n,s),Qo(c,n,s)),n={cache:rh()},t.payload=n;return}n=n.return}}function WA(t,n,s){var c=Xn();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},uu(t)?Rb(n,s):(s=Kf(t,n,s,c),s!==null&&(jn(s,t,c),kb(s,n,c)))}function Tb(t,n,s){var c=Xn();al(t,n,s,c)}function al(t,n,s,c){var h={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(uu(t))Rb(n,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,k=p(w,s);if(h.hasEagerState=!0,h.eagerState=k,Gn(k,w))return Gc(t,n,h,0),kt===null&&qc(),!1}catch{}if(s=Kf(t,n,h,c),s!==null)return jn(s,t,c),kb(s,n,c),!0}return!1}function Dh(t,n,s,c){if(c={lane:2,revertLane:lg(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},uu(t)){if(n)throw Error(r(479))}else n=Kf(t,s,c,2),n!==null&&jn(n,t,2)}function uu(t){var n=t.alternate;return t===Je||n!==null&&n===Je}function Rb(t,n){ks=au=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function kb(t,n,s){if((s&4194048)!==0){var c=n.lanes;c&=t.pendingLanes,s|=c,n.lanes=s,Ue(t,s)}}var rl={readContext:hn,use:su,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useLayoutEffect:Ut,useInsertionEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useSyncExternalStore:Ut,useId:Ut,useHostTransitionStatus:Ut,useFormState:Ut,useActionState:Ut,useOptimistic:Ut,useMemoCache:Ut,useCacheRefresh:Ut};rl.useEffectEvent=Ut;var Db={readContext:hn,use:su,useCallback:function(t,n){return An().memoizedState=[t,n===void 0?null:n],t},useContext:hn,useEffect:hb,useImperativeHandle:function(t,n,s){s=s!=null?s.concat([t]):null,lu(4194308,4,yb.bind(null,n,t),s)},useLayoutEffect:function(t,n){return lu(4194308,4,t,n)},useInsertionEffect:function(t,n){lu(4,2,t,n)},useMemo:function(t,n){var s=An();n=n===void 0?null:n;var c=t();if(Ui){_n(!0);try{t()}finally{_n(!1)}}return s.memoizedState=[c,n],c},useReducer:function(t,n,s){var c=An();if(s!==void 0){var h=s(n);if(Ui){_n(!0);try{s(n)}finally{_n(!1)}}}else h=n;return c.memoizedState=c.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},c.queue=t,t=t.dispatch=WA.bind(null,Je,t),[c.memoizedState,t]},useRef:function(t){var n=An();return t={current:t},n.memoizedState=t},useState:function(t){t=Eh(t);var n=t.queue,s=Tb.bind(null,Je,n);return n.dispatch=s,[t.memoizedState,s]},useDebugValue:xh,useDeferredValue:function(t,n){var s=An();return Th(s,t,n)},useTransition:function(){var t=Eh(!1);return t=Cb.bind(null,Je,t.queue,!0,!1),An().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,s){var c=Je,h=An();if(lt){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),kt===null)throw Error(r(349));(at&127)!==0||Jy(c,n,s)}h.memoizedState=s;var p={value:s,getSnapshot:n};return h.queue=p,hb(Zy.bind(null,c,p,t),[t]),c.flags|=2048,Os(9,{destroy:void 0},Qy.bind(null,c,p,s,n),null),s},useId:function(){var t=An(),n=kt.identifierPrefix;if(lt){var s=Va,c=Ga;s=(c&~(1<<32-q(c)-1)).toString(32)+s,n="_"+n+"R_"+s,s=ru++,0<s&&(n+="H"+s.toString(32)),n+="_"}else s=BA++,n="_"+n+"r_"+s.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:kh,useFormState:lb,useActionState:lb,useOptimistic:function(t){var n=An();n.memoizedState=n.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=s,n=Dh.bind(null,Je,!0,s),s.dispatch=n,[t,n]},useMemoCache:Sh,useCacheRefresh:function(){return An().memoizedState=KA.bind(null,Je)},useEffectEvent:function(t){var n=An(),s={impl:t};return n.memoizedState=s,function(){if((vt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}},Oh={readContext:hn,use:su,useCallback:vb,useContext:hn,useEffect:Ah,useImperativeHandle:bb,useInsertionEffect:pb,useLayoutEffect:mb,useMemo:Sb,useReducer:ou,useRef:fb,useState:function(){return ou(dr)},useDebugValue:xh,useDeferredValue:function(t,n){var s=Gt();return wb(s,At.memoizedState,t,n)},useTransition:function(){var t=ou(dr)[0],n=Gt().memoizedState;return[typeof t=="boolean"?t:nl(t),n]},useSyncExternalStore:Xy,useId:Ab,useHostTransitionStatus:kh,useFormState:cb,useActionState:cb,useOptimistic:function(t,n){var s=Gt();return nb(s,At,t,n)},useMemoCache:Sh,useCacheRefresh:xb};Oh.useEffectEvent=gb;var Ob={readContext:hn,use:su,useCallback:vb,useContext:hn,useEffect:Ah,useImperativeHandle:bb,useInsertionEffect:pb,useLayoutEffect:mb,useMemo:Sb,useReducer:Ch,useRef:fb,useState:function(){return Ch(dr)},useDebugValue:xh,useDeferredValue:function(t,n){var s=Gt();return At===null?Th(s,t,n):wb(s,At.memoizedState,t,n)},useTransition:function(){var t=Ch(dr)[0],n=Gt().memoizedState;return[typeof t=="boolean"?t:nl(t),n]},useSyncExternalStore:Xy,useId:Ab,useHostTransitionStatus:kh,useFormState:db,useActionState:db,useOptimistic:function(t,n){var s=Gt();return At!==null?nb(s,At,t,n):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Sh,useCacheRefresh:xb};Ob.useEffectEvent=gb;function Lh(t,n,s,c){n=t.memoizedState,s=s(c,n),s=s==null?n:b({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Mh={enqueueSetState:function(t,n,s){t=t._reactInternals;var c=Xn(),h=Fr(c);h.payload=n,s!=null&&(h.callback=s),n=Kr(t,h,c),n!==null&&(jn(n,t,c),Qo(n,t,c))},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var c=Xn(),h=Fr(c);h.tag=1,h.payload=n,s!=null&&(h.callback=s),n=Kr(t,h,c),n!==null&&(jn(n,t,c),Qo(n,t,c))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=Xn(),c=Fr(s);c.tag=2,n!=null&&(c.callback=n),n=Kr(t,c,s),n!==null&&(jn(n,t,s),Qo(n,t,s))}};function Lb(t,n,s,c,h,p,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,p,w):n.prototype&&n.prototype.isPureReactComponent?!Go(s,c)||!Go(h,p):!0}function Mb(t,n,s,c){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,c),n.state!==t&&Mh.enqueueReplaceState(n,n.state,null)}function Bi(t,n){var s=n;if("ref"in n){s={};for(var c in n)c!=="ref"&&(s[c]=n[c])}if(t=t.defaultProps){s===n&&(s=b({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function $b(t){Pc(t)}function Nb(t){console.error(t)}function Ib(t){Pc(t)}function du(t,n){try{var s=t.onUncaughtError;s(n.value,{componentStack:n.stack})}catch(c){setTimeout(function(){throw c})}}function Hb(t,n,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function $h(t,n,s){return s=Fr(s),s.tag=3,s.payload={element:null},s.callback=function(){du(t,n)},s}function zb(t){return t=Fr(t),t.tag=3,t}function jb(t,n,s,c){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=c.value;t.payload=function(){return h(p)},t.callback=function(){Hb(n,s,c)}}var w=s.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){Hb(n,s,c),typeof h!="function"&&(Zr===null?Zr=new Set([this]):Zr.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function YA(t,n,s,c,h){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(n=s.alternate,n!==null&&Es(n,s,h,!0),s=Fn.current,s!==null){switch(s.tag){case 31:case 13:return la===null?Eu():s.alternate===null&&Bt===0&&(Bt=3),s.flags&=-257,s.flags|=65536,s.lanes=h,c===Qc?s.flags|=16384:(n=s.updateQueue,n===null?s.updateQueue=new Set([c]):n.add(c),ig(t,c,h)),!1;case 22:return s.flags|=65536,c===Qc?s.flags|=16384:(n=s.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=n):(s=n.retryQueue,s===null?n.retryQueue=new Set([c]):s.add(c)),ig(t,c,h)),!1}throw Error(r(435,s.tag))}return ig(t,c,h),Eu(),!1}if(lt)return n=Fn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,c!==Zf&&(t=Error(r(422),{cause:c}),Ko(ra(t,s)))):(c!==Zf&&(n=Error(r(423),{cause:c}),Ko(ra(n,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,c=ra(c,s),h=$h(t.stateNode,c,h),uh(t,h),Bt!==4&&(Bt=2)),!1;var p=Error(r(520),{cause:c});if(p=ra(p,s),fl===null?fl=[p]:fl.push(p),Bt!==4&&(Bt=2),n===null)return!0;c=ra(c,s),s=n;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=$h(s.stateNode,c,t),uh(s,t),!1;case 1:if(n=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Zr===null||!Zr.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=zb(h),jb(h,t,s,c),uh(s,h),!1}s=s.return}while(s!==null);return!1}var Nh=Error(r(461)),Jt=!1;function gn(t,n,s,c){n.child=t===null?qy(n,null,s,c):ji(n,t.child,s,c)}function Ub(t,n,s,c,h){s=s.render;var p=n.ref;if("ref"in c){var w={};for(var k in c)k!=="ref"&&(w[k]=c[k])}else w=c;return Ni(n),c=mh(t,n,s,w,p,h),k=yh(),t!==null&&!Jt?(bh(t,n,h),fr(t,n,h)):(lt&&k&&Jf(n),n.flags|=1,gn(t,n,c,h),n.child)}function Bb(t,n,s,c,h){if(t===null){var p=s.type;return typeof p=="function"&&!Wf(p)&&p.defaultProps===void 0&&s.compare===null?(n.tag=15,n.type=p,Pb(t,n,p,c,h)):(t=Fc(s.type,null,c,n,n.mode,h),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!qh(t,h)){var w=p.memoizedProps;if(s=s.compare,s=s!==null?s:Go,s(w,c)&&t.ref===n.ref)return fr(t,n,h)}return n.flags|=1,t=sr(p,c),t.ref=n.ref,t.return=n,n.child=t}function Pb(t,n,s,c,h){if(t!==null){var p=t.memoizedProps;if(Go(p,c)&&t.ref===n.ref)if(Jt=!1,n.pendingProps=c=p,qh(t,h))(t.flags&131072)!==0&&(Jt=!0);else return n.lanes=t.lanes,fr(t,n,h)}return Ih(t,n,s,c,h)}function qb(t,n,s,c){var h=c.children,p=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|s:s,t!==null){for(c=n.child=t.child,h=0;c!==null;)h=h|c.lanes|c.childLanes,c=c.sibling;c=h&~p}else c=0,n.child=null;return Gb(t,n,p,s,c)}if((s&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Xc(n,p!==null?p.cachePool:null),p!==null?Fy(n,p):fh(),Ky(n);else return c=n.lanes=536870912,Gb(t,n,p!==null?p.baseLanes|s:s,s,c)}else p!==null?(Xc(n,p.cachePool),Fy(n,p),Yr(),n.memoizedState=null):(t!==null&&Xc(n,null),fh(),Yr());return gn(t,n,h,s),n.child}function il(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Gb(t,n,s,c,h){var p=sh();return p=p===null?null:{parent:Yt._currentValue,pool:p},n.memoizedState={baseLanes:s,cachePool:p},t!==null&&Xc(n,null),fh(),Ky(n),t!==null&&Es(t,n,c,!0),n.childLanes=h,null}function fu(t,n){return n=gu({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Vb(t,n,s){return ji(n,t.child,null,s),t=fu(n,n.pendingProps),t.flags|=2,Kn(n),n.memoizedState=null,t}function XA(t,n,s){var c=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(lt){if(c.mode==="hidden")return t=fu(n,c),n.lanes=536870912,il(null,t);if(gh(n),(t=Ot)?(t=aS(t,oa),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Br!==null?{id:Ga,overflow:Va}:null,retryLane:536870912,hydrationErrors:null},s=Ry(t),s.return=n,n.child=s,fn=n,Ot=null)):t=null,t===null)throw qr(n);return n.lanes=536870912,null}return fu(n,c)}var p=t.memoizedState;if(p!==null){var w=p.dehydrated;if(gh(n),h)if(n.flags&256)n.flags&=-257,n=Vb(t,n,s);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(r(558));else if(Jt||Es(t,n,s,!1),h=(s&t.childLanes)!==0,Jt||h){if(c=kt,c!==null&&(w=st(c,s),w!==0&&w!==p.retryLane))throw p.retryLane=w,Oi(t,w),jn(c,t,w),Nh;Eu(),n=Vb(t,n,s)}else t=p.treeContext,Ot=ca(w.nextSibling),fn=n,lt=!0,Pr=null,oa=!1,t!==null&&Oy(n,t),n=fu(n,c),n.flags|=4096;return n}return t=sr(t.child,{mode:c.mode,children:c.children}),t.ref=n.ref,n.child=t,t.return=n,t}function hu(t,n){var s=n.ref;if(s===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(r(284));(t===null||t.ref!==s)&&(n.flags|=4194816)}}function Ih(t,n,s,c,h){return Ni(n),s=mh(t,n,s,c,void 0,h),c=yh(),t!==null&&!Jt?(bh(t,n,h),fr(t,n,h)):(lt&&c&&Jf(n),n.flags|=1,gn(t,n,s,h),n.child)}function Fb(t,n,s,c,h,p){return Ni(n),n.updateQueue=null,s=Yy(n,c,s,h),Wy(t),c=yh(),t!==null&&!Jt?(bh(t,n,p),fr(t,n,p)):(lt&&c&&Jf(n),n.flags|=1,gn(t,n,s,p),n.child)}function Kb(t,n,s,c,h){if(Ni(n),n.stateNode===null){var p=vs,w=s.contextType;typeof w=="object"&&w!==null&&(p=hn(w)),p=new s(c,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Mh,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=c,p.state=n.memoizedState,p.refs={},lh(n),w=s.contextType,p.context=typeof w=="object"&&w!==null?hn(w):vs,p.state=n.memoizedState,w=s.getDerivedStateFromProps,typeof w=="function"&&(Lh(n,s,w,c),p.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Mh.enqueueReplaceState(p,p.state,null),el(n,c,p,h),Zo(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),c=!0}else if(t===null){p=n.stateNode;var k=n.memoizedProps,z=Bi(s,k);p.props=z;var Y=p.context,ae=s.contextType;w=vs,typeof ae=="object"&&ae!==null&&(w=hn(ae));var ue=s.getDerivedStateFromProps;ae=typeof ue=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=n.pendingProps!==k,ae||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||Y!==w)&&Mb(n,p,c,w),Vr=!1;var J=n.memoizedState;p.state=J,el(n,c,p,h),Zo(),Y=n.memoizedState,k||J!==Y||Vr?(typeof ue=="function"&&(Lh(n,s,ue,c),Y=n.memoizedState),(z=Vr||Lb(n,s,z,c,J,Y,w))?(ae||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=Y),p.props=c,p.state=Y,p.context=w,c=z):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{p=n.stateNode,ch(t,n),w=n.memoizedProps,ae=Bi(s,w),p.props=ae,ue=n.pendingProps,J=p.context,Y=s.contextType,z=vs,typeof Y=="object"&&Y!==null&&(z=hn(Y)),k=s.getDerivedStateFromProps,(Y=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ue||J!==z)&&Mb(n,p,c,z),Vr=!1,J=n.memoizedState,p.state=J,el(n,c,p,h),Zo();var ee=n.memoizedState;w!==ue||J!==ee||Vr||t!==null&&t.dependencies!==null&&Wc(t.dependencies)?(typeof k=="function"&&(Lh(n,s,k,c),ee=n.memoizedState),(ae=Vr||Lb(n,s,ae,c,J,ee,z)||t!==null&&t.dependencies!==null&&Wc(t.dependencies))?(Y||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(c,ee,z),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(c,ee,z)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=ee),p.props=c,p.state=ee,p.context=z,c=ae):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=1024),c=!1)}return p=c,hu(t,n),c=(n.flags&128)!==0,p||c?(p=n.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,t!==null&&c?(n.child=ji(n,t.child,null,h),n.child=ji(n,null,s,h)):gn(t,n,s,h),n.memoizedState=p.state,t=n.child):t=fr(t,n,h),t}function Wb(t,n,s,c){return Mi(),n.flags|=256,gn(t,n,s,c),n.child}var Hh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zh(t){return{baseLanes:t,cachePool:Hy()}}function jh(t,n,s){return t=t!==null?t.childLanes&~s:0,n&&(t|=Yn),t}function Yb(t,n,s){var c=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=t!==null&&t.memoizedState===null?!1:(qt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,t===null){if(lt){if(h?Wr(n):Yr(),(t=Ot)?(t=aS(t,oa),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Br!==null?{id:Ga,overflow:Va}:null,retryLane:536870912,hydrationErrors:null},s=Ry(t),s.return=n,n.child=s,fn=n,Ot=null)):t=null,t===null)throw qr(n);return wg(t)?n.lanes=32:n.lanes=536870912,null}var k=c.children;return c=c.fallback,h?(Yr(),h=n.mode,k=gu({mode:"hidden",children:k},h),c=Li(c,h,s,null),k.return=n,c.return=n,k.sibling=c,n.child=k,c=n.child,c.memoizedState=zh(s),c.childLanes=jh(t,w,s),n.memoizedState=Hh,il(null,c)):(Wr(n),Uh(n,k))}var z=t.memoizedState;if(z!==null&&(k=z.dehydrated,k!==null)){if(p)n.flags&256?(Wr(n),n.flags&=-257,n=Bh(t,n,s)):n.memoizedState!==null?(Yr(),n.child=t.child,n.flags|=128,n=null):(Yr(),k=c.fallback,h=n.mode,c=gu({mode:"visible",children:c.children},h),k=Li(k,h,s,null),k.flags|=2,c.return=n,k.return=n,c.sibling=k,n.child=c,ji(n,t.child,null,s),c=n.child,c.memoizedState=zh(s),c.childLanes=jh(t,w,s),n.memoizedState=Hh,n=il(null,c));else if(Wr(n),wg(k)){if(w=k.nextSibling&&k.nextSibling.dataset,w)var Y=w.dgst;w=Y,c=Error(r(419)),c.stack="",c.digest=w,Ko({value:c,source:null,stack:null}),n=Bh(t,n,s)}else if(Jt||Es(t,n,s,!1),w=(s&t.childLanes)!==0,Jt||w){if(w=kt,w!==null&&(c=st(w,s),c!==0&&c!==z.retryLane))throw z.retryLane=c,Oi(t,c),jn(w,t,c),Nh;Sg(k)||Eu(),n=Bh(t,n,s)}else Sg(k)?(n.flags|=192,n.child=t.child,n=null):(t=z.treeContext,Ot=ca(k.nextSibling),fn=n,lt=!0,Pr=null,oa=!1,t!==null&&Oy(n,t),n=Uh(n,c.children),n.flags|=4096);return n}return h?(Yr(),k=c.fallback,h=n.mode,z=t.child,Y=z.sibling,c=sr(z,{mode:"hidden",children:c.children}),c.subtreeFlags=z.subtreeFlags&65011712,Y!==null?k=sr(Y,k):(k=Li(k,h,s,null),k.flags|=2),k.return=n,c.return=n,c.sibling=k,n.child=c,il(null,c),c=n.child,k=t.child.memoizedState,k===null?k=zh(s):(h=k.cachePool,h!==null?(z=Yt._currentValue,h=h.parent!==z?{parent:z,pool:z}:h):h=Hy(),k={baseLanes:k.baseLanes|s,cachePool:h}),c.memoizedState=k,c.childLanes=jh(t,w,s),n.memoizedState=Hh,il(t.child,c)):(Wr(n),s=t.child,t=s.sibling,s=sr(s,{mode:"visible",children:c.children}),s.return=n,s.sibling=null,t!==null&&(w=n.deletions,w===null?(n.deletions=[t],n.flags|=16):w.push(t)),n.child=s,n.memoizedState=null,s)}function Uh(t,n){return n=gu({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function gu(t,n){return t=Vn(22,t,null,n),t.lanes=0,t}function Bh(t,n,s){return ji(n,t.child,null,s),t=Uh(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Xb(t,n,s){t.lanes|=n;var c=t.alternate;c!==null&&(c.lanes|=n),nh(t.return,n,s)}function Ph(t,n,s,c,h,p){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=s,w.tailMode=h,w.treeForkCount=p)}function Jb(t,n,s){var c=n.pendingProps,h=c.revealOrder,p=c.tail;c=c.children;var w=qt.current,k=(w&2)!==0;if(k?(w=w&1|2,n.flags|=128):w&=1,re(qt,w),gn(t,n,c,s),c=lt?Fo:0,!k&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Xb(t,s,n);else if(t.tag===19)Xb(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(s=n.child,h=null;s!==null;)t=s.alternate,t!==null&&nu(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=n.child,n.child=null):(h=s.sibling,s.sibling=null),Ph(n,!1,h,s,p,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,h=n.child,n.child=null;h!==null;){if(t=h.alternate,t!==null&&nu(t)===null){n.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}Ph(n,!0,s,null,p,c);break;case"together":Ph(n,!1,null,null,void 0,c);break;default:n.memoizedState=null}return n.child}function fr(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),Qr|=n.lanes,(s&n.childLanes)===0)if(t!==null){if(Es(t,n,s,!1),(s&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(r(153));if(n.child!==null){for(t=n.child,s=sr(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=sr(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function qh(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Wc(t)))}function JA(t,n,s){switch(n.tag){case 3:ve(n,n.stateNode.containerInfo),Gr(n,Yt,t.memoizedState.cache),Mi();break;case 27:case 5:Ae(n);break;case 4:ve(n,n.stateNode.containerInfo);break;case 10:Gr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,gh(n),null;break;case 13:var c=n.memoizedState;if(c!==null)return c.dehydrated!==null?(Wr(n),n.flags|=128,null):(s&n.child.childLanes)!==0?Yb(t,n,s):(Wr(n),t=fr(t,n,s),t!==null?t.sibling:null);Wr(n);break;case 19:var h=(t.flags&128)!==0;if(c=(s&n.childLanes)!==0,c||(Es(t,n,s,!1),c=(s&n.childLanes)!==0),h){if(c)return Jb(t,n,s);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),re(qt,qt.current),c)break;return null;case 22:return n.lanes=0,qb(t,n,s,n.pendingProps);case 24:Gr(n,Yt,t.memoizedState.cache)}return fr(t,n,s)}function Qb(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps)Jt=!0;else{if(!qh(t,s)&&(n.flags&128)===0)return Jt=!1,JA(t,n,s);Jt=(t.flags&131072)!==0}else Jt=!1,lt&&(n.flags&1048576)!==0&&Dy(n,Fo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var c=n.pendingProps;if(t=Hi(n.elementType),n.type=t,typeof t=="function")Wf(t)?(c=Bi(t,c),n.tag=1,n=Kb(null,n,t,c,s)):(n.tag=0,n=Ih(null,n,t,c,s));else{if(t!=null){var h=t.$$typeof;if(h===D){n.tag=11,n=Ub(null,n,t,c,s);break e}else if(h===P){n.tag=14,n=Bb(null,n,t,c,s);break e}}throw n=Xe(t)||t,Error(r(306,n,""))}}return n;case 0:return Ih(t,n,n.type,n.pendingProps,s);case 1:return c=n.type,h=Bi(c,n.pendingProps),Kb(t,n,c,h,s);case 3:e:{if(ve(n,n.stateNode.containerInfo),t===null)throw Error(r(387));c=n.pendingProps;var p=n.memoizedState;h=p.element,ch(t,n),el(n,c,null,s);var w=n.memoizedState;if(c=w.cache,Gr(n,Yt,c),c!==p.cache&&ah(n,[Yt],s,!0),Zo(),c=w.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Wb(t,n,c,s);break e}else if(c!==h){h=ra(Error(r(424)),n),Ko(h),n=Wb(t,n,c,s);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Ot=ca(t.firstChild),fn=n,lt=!0,Pr=null,oa=!0,s=qy(n,null,c,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Mi(),c===h){n=fr(t,n,s);break e}gn(t,n,c,s)}n=n.child}return n;case 26:return hu(t,n),t===null?(s=cS(n.type,null,n.pendingProps,null))?n.memoizedState=s:lt||(s=n.type,t=n.pendingProps,c=Du(me.current).createElement(s),c[an]=n,c[vn]=t,pn(c,s,t),Wt(c),n.stateNode=c):n.memoizedState=cS(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return Ae(n),t===null&<&&(c=n.stateNode=sS(n.type,n.pendingProps,me.current),fn=n,oa=!0,h=Ot,ai(n.type)?(Cg=h,Ot=ca(c.firstChild)):Ot=h),gn(t,n,n.pendingProps.children,s),hu(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&<&&((h=c=Ot)&&(c=Tx(c,n.type,n.pendingProps,oa),c!==null?(n.stateNode=c,fn=n,Ot=ca(c.firstChild),oa=!1,h=!0):h=!1),h||qr(n)),Ae(n),h=n.type,p=n.pendingProps,w=t!==null?t.memoizedProps:null,c=p.children,yg(h,p)?c=null:w!==null&&yg(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=mh(t,n,PA,null,null,s),Sl._currentValue=h),hu(t,n),gn(t,n,c,s),n.child;case 6:return t===null&<&&((t=s=Ot)&&(s=Rx(s,n.pendingProps,oa),s!==null?(n.stateNode=s,fn=n,Ot=null,t=!0):t=!1),t||qr(n)),null;case 13:return Yb(t,n,s);case 4:return ve(n,n.stateNode.containerInfo),c=n.pendingProps,t===null?n.child=ji(n,null,c,s):gn(t,n,c,s),n.child;case 11:return Ub(t,n,n.type,n.pendingProps,s);case 7:return gn(t,n,n.pendingProps,s),n.child;case 8:return gn(t,n,n.pendingProps.children,s),n.child;case 12:return gn(t,n,n.pendingProps.children,s),n.child;case 10:return c=n.pendingProps,Gr(n,n.type,c.value),gn(t,n,c.children,s),n.child;case 9:return h=n.type._context,c=n.pendingProps.children,Ni(n),h=hn(h),c=c(h),n.flags|=1,gn(t,n,c,s),n.child;case 14:return Bb(t,n,n.type,n.pendingProps,s);case 15:return Pb(t,n,n.type,n.pendingProps,s);case 19:return Jb(t,n,s);case 31:return XA(t,n,s);case 22:return qb(t,n,s,n.pendingProps);case 24:return Ni(n),c=hn(Yt),t===null?(h=sh(),h===null&&(h=kt,p=rh(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),n.memoizedState={parent:c,cache:h},lh(n),Gr(n,Yt,h)):((t.lanes&s)!==0&&(ch(t,n),el(n,null,null,s),Zo()),h=t.memoizedState,p=n.memoizedState,h.parent!==c?(h={parent:c,cache:c},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),Gr(n,Yt,c)):(c=p.cache,Gr(n,Yt,c),c!==h.cache&&ah(n,[Yt],s,!0))),gn(t,n,n.pendingProps.children,s),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function hr(t){t.flags|=4}function Gh(t,n,s,c,h){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(Av())t.flags|=8192;else throw zi=Qc,oh}else t.flags&=-16777217}function Zb(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!gS(n))if(Av())t.flags|=8192;else throw zi=Qc,oh}function pu(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?ke():536870912,t.lanes|=n,Ns|=n)}function sl(t,n){if(!lt)switch(t.tailMode){case"hidden":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function Lt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(n)for(var h=t.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags&65011712,c|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=c,t.childLanes=s,n}function QA(t,n,s){var c=n.pendingProps;switch(Qf(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(n),null;case 1:return Lt(n),null;case 3:return s=n.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),n.memoizedState.cache!==c&&(n.flags|=2048),cr(Yt),He(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Cs(n)?hr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,eh())),Lt(n),null;case 26:var h=n.type,p=n.memoizedState;return t===null?(hr(n),p!==null?(Lt(n),Zb(n,p)):(Lt(n),Gh(n,h,null,c,s))):p?p!==t.memoizedState?(hr(n),Lt(n),Zb(n,p)):(Lt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==c&&hr(n),Lt(n),Gh(n,h,t,c,s)),null;case 27:if(Et(n),s=me.current,h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&hr(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Lt(n),null}t=de.current,Cs(n)?Ly(n):(t=sS(h,c,s),n.stateNode=t,hr(n))}return Lt(n),null;case 5:if(Et(n),h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&hr(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Lt(n),null}if(p=de.current,Cs(n))Ly(n);else{var w=Du(me.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?w.createElement(h,{is:c.is}):w.createElement(h)}}p[an]=n,p[vn]=c;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(pn(p,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&hr(n)}}return Lt(n),Gh(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,s),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==c&&hr(n);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(t=me.current,Cs(n)){if(t=n.stateNode,s=n.memoizedProps,c=null,h=fn,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}t[an]=n,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||Yv(t.nodeValue,s)),t||qr(n,!0)}else t=Du(t).createTextNode(c),t[an]=n,n.stateNode=t}return Lt(n),null;case 31:if(s=n.memoizedState,t===null||t.memoizedState!==null){if(c=Cs(n),s!==null){if(t===null){if(!c)throw Error(r(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[an]=n}else Mi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),t=!1}else s=eh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return n.flags&256?(Kn(n),n):(Kn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return Lt(n),null;case 13:if(c=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Cs(n),c!==null&&c.dehydrated!==null){if(t===null){if(!h)throw Error(r(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[an]=n}else Mi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),h=!1}else h=eh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Kn(n),n):(Kn(n),null)}return Kn(n),(n.flags&128)!==0?(n.lanes=s,n):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=n.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==h&&(c.flags|=2048)),s!==t&&s&&(n.child.flags|=8192),pu(n,n.updateQueue),Lt(n),null);case 4:return He(),t===null&&fg(n.stateNode.containerInfo),Lt(n),null;case 10:return cr(n.type),Lt(n),null;case 19:if(K(qt),c=n.memoizedState,c===null)return Lt(n),null;if(h=(n.flags&128)!==0,p=c.rendering,p===null)if(h)sl(c,!1);else{if(Bt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(p=nu(t),p!==null){for(n.flags|=128,sl(c,!1),t=p.updateQueue,n.updateQueue=t,pu(n,t),n.subtreeFlags=0,t=s,s=n.child;s!==null;)Ty(s,t),s=s.sibling;return re(qt,qt.current&1|2),lt&&or(n,c.treeForkCount),n.child}t=t.sibling}c.tail!==null&&Ft()>Su&&(n.flags|=128,h=!0,sl(c,!1),n.lanes=4194304)}else{if(!h)if(t=nu(p),t!==null){if(n.flags|=128,h=!0,t=t.updateQueue,n.updateQueue=t,pu(n,t),sl(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!lt)return Lt(n),null}else 2*Ft()-c.renderingStartTime>Su&&s!==536870912&&(n.flags|=128,h=!0,sl(c,!1),n.lanes=4194304);c.isBackwards?(p.sibling=n.child,n.child=p):(t=c.last,t!==null?t.sibling=p:n.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Ft(),t.sibling=null,s=qt.current,re(qt,h?s&1|2:s&1),lt&&or(n,c.treeForkCount),t):(Lt(n),null);case 22:case 23:return Kn(n),hh(),c=n.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(n.flags|=8192):c&&(n.flags|=8192),c?(s&536870912)!==0&&(n.flags&128)===0&&(Lt(n),n.subtreeFlags&6&&(n.flags|=8192)):Lt(n),s=n.updateQueue,s!==null&&pu(n,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==s&&(n.flags|=2048),t!==null&&K(Ii),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),cr(Yt),Lt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function ZA(t,n){switch(Qf(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return cr(Yt),He(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Et(n),null;case 31:if(n.memoizedState!==null){if(Kn(n),n.alternate===null)throw Error(r(340));Mi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Kn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Mi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return K(qt),null;case 4:return He(),null;case 10:return cr(n.type),null;case 22:case 23:return Kn(n),hh(),t!==null&&K(Ii),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return cr(Yt),null;case 25:return null;default:return null}}function ev(t,n){switch(Qf(n),n.tag){case 3:cr(Yt),He();break;case 26:case 27:case 5:Et(n);break;case 4:He();break;case 31:n.memoizedState!==null&&Kn(n);break;case 13:Kn(n);break;case 19:K(qt);break;case 10:cr(n.type);break;case 22:case 23:Kn(n),hh(),t!==null&&K(Ii);break;case 24:cr(Yt)}}function ol(t,n){try{var s=n.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var h=c.next;s=h;do{if((s.tag&t)===t){c=void 0;var p=s.create,w=s.inst;c=p(),w.destroy=c}s=s.next}while(s!==h)}}catch(k){Ct(n,n.return,k)}}function Xr(t,n,s){try{var c=n.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&t)===t){var w=c.inst,k=w.destroy;if(k!==void 0){w.destroy=void 0,h=n;var z=s,Y=k;try{Y()}catch(ae){Ct(h,z,ae)}}}c=c.next}while(c!==p)}}catch(ae){Ct(n,n.return,ae)}}function tv(t){var n=t.updateQueue;if(n!==null){var s=t.stateNode;try{Vy(n,s)}catch(c){Ct(t,t.return,c)}}}function nv(t,n,s){s.props=Bi(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){Ct(t,n,c)}}function ll(t,n){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(h){Ct(t,n,h)}}function Fa(t,n){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(h){Ct(t,n,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){Ct(t,n,h)}else s.current=null}function av(t){var n=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(h){Ct(t,t.return,h)}}function Vh(t,n,s){try{var c=t.stateNode;wx(c,t.type,s,n),c[vn]=n}catch(h){Ct(t,t.return,h)}}function rv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ai(t.type)||t.tag===4}function Fh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||rv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ai(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Kh(t,n,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,n?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,n):(n=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,n.appendChild(t),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=Aa));else if(c!==4&&(c===27&&ai(t.type)&&(s=t.stateNode,n=null),t=t.child,t!==null))for(Kh(t,n,s),t=t.sibling;t!==null;)Kh(t,n,s),t=t.sibling}function mu(t,n,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,n?s.insertBefore(t,n):s.appendChild(t);else if(c!==4&&(c===27&&ai(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(mu(t,n,s),t=t.sibling;t!==null;)mu(t,n,s),t=t.sibling}function iv(t){var n=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);pn(n,c,s),n[an]=t,n[vn]=s}catch(p){Ct(t,t.return,p)}}var gr=!1,Qt=!1,Wh=!1,sv=typeof WeakSet=="function"?WeakSet:Set,cn=null;function ex(t,n){if(t=t.containerInfo,pg=Hu,t=by(t),Bf(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var w=0,k=-1,z=-1,Y=0,ae=0,ue=t,J=null;t:for(;;){for(var ee;ue!==s||h!==0&&ue.nodeType!==3||(k=w+h),ue!==p||c!==0&&ue.nodeType!==3||(z=w+c),ue.nodeType===3&&(w+=ue.nodeValue.length),(ee=ue.firstChild)!==null;)J=ue,ue=ee;for(;;){if(ue===t)break t;if(J===s&&++Y===h&&(k=w),J===p&&++ae===c&&(z=w),(ee=ue.nextSibling)!==null)break;ue=J,J=ue.parentNode}ue=ee}s=k===-1||z===-1?null:{start:k,end:z}}else s=null}s=s||{start:0,end:0}}else s=null;for(mg={focusedElem:t,selectionRange:s},Hu=!1,cn=n;cn!==null;)if(n=cn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,cn=t;else for(;cn!==null;){switch(n=cn,p=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=n,h=p.memoizedProps,p=p.memoizedState,c=s.stateNode;try{var De=Bi(s.type,h);t=c.getSnapshotBeforeUpdate(De,p),c.__reactInternalSnapshotBeforeUpdate=t}catch(Ge){Ct(s,s.return,Ge)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,s=t.nodeType,s===9)vg(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":vg(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(r(163))}if(t=n.sibling,t!==null){t.return=n.return,cn=t;break}cn=n.return}}function ov(t,n,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:mr(t,s),c&4&&ol(5,s);break;case 1:if(mr(t,s),c&4)if(t=s.stateNode,n===null)try{t.componentDidMount()}catch(w){Ct(s,s.return,w)}else{var h=Bi(s.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(h,n,t.__reactInternalSnapshotBeforeUpdate)}catch(w){Ct(s,s.return,w)}}c&64&&tv(s),c&512&&ll(s,s.return);break;case 3:if(mr(t,s),c&64&&(t=s.updateQueue,t!==null)){if(n=null,s.child!==null)switch(s.child.tag){case 27:case 5:n=s.child.stateNode;break;case 1:n=s.child.stateNode}try{Vy(t,n)}catch(w){Ct(s,s.return,w)}}break;case 27:n===null&&c&4&&iv(s);case 26:case 5:mr(t,s),n===null&&c&4&&av(s),c&512&&ll(s,s.return);break;case 12:mr(t,s);break;case 31:mr(t,s),c&4&&uv(t,s);break;case 13:mr(t,s),c&4&&dv(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=cx.bind(null,s),kx(t,s))));break;case 22:if(c=s.memoizedState!==null||gr,!c){n=n!==null&&n.memoizedState!==null||Qt,h=gr;var p=Qt;gr=c,(Qt=n)&&!p?yr(t,s,(s.subtreeFlags&8772)!==0):mr(t,s),gr=h,Qt=p}break;case 30:break;default:mr(t,s)}}function lv(t){var n=t.alternate;n!==null&&(t.alternate=null,lv(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Ro(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Mt=null,Nn=!1;function pr(t,n,s){for(s=s.child;s!==null;)cv(t,n,s),s=s.sibling}function cv(t,n,s){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Ea,s)}catch{}switch(s.tag){case 26:Qt||Fa(s,n),pr(t,n,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Qt||Fa(s,n);var c=Mt,h=Nn;ai(s.type)&&(Mt=s.stateNode,Nn=!1),pr(t,n,s),yl(s.stateNode),Mt=c,Nn=h;break;case 5:Qt||Fa(s,n);case 6:if(c=Mt,h=Nn,Mt=null,pr(t,n,s),Mt=c,Nn=h,Mt!==null)if(Nn)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(s.stateNode)}catch(p){Ct(s,n,p)}else try{Mt.removeChild(s.stateNode)}catch(p){Ct(s,n,p)}break;case 18:Mt!==null&&(Nn?(t=Mt,tS(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),qs(t)):tS(Mt,s.stateNode));break;case 4:c=Mt,h=Nn,Mt=s.stateNode.containerInfo,Nn=!0,pr(t,n,s),Mt=c,Nn=h;break;case 0:case 11:case 14:case 15:Xr(2,s,n),Qt||Xr(4,s,n),pr(t,n,s);break;case 1:Qt||(Fa(s,n),c=s.stateNode,typeof c.componentWillUnmount=="function"&&nv(s,n,c)),pr(t,n,s);break;case 21:pr(t,n,s);break;case 22:Qt=(c=Qt)||s.memoizedState!==null,pr(t,n,s),Qt=c;break;default:pr(t,n,s)}}function uv(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{qs(t)}catch(s){Ct(n,n.return,s)}}}function dv(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{qs(t)}catch(s){Ct(n,n.return,s)}}function tx(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new sv),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new sv),n;default:throw Error(r(435,t.tag))}}function yu(t,n){var s=tx(t);n.forEach(function(c){if(!s.has(c)){s.add(c);var h=ux.bind(null,t,c);c.then(h,h)}})}function In(t,n){var s=n.deletions;if(s!==null)for(var c=0;c<s.length;c++){var h=s[c],p=t,w=n,k=w;e:for(;k!==null;){switch(k.tag){case 27:if(ai(k.type)){Mt=k.stateNode,Nn=!1;break e}break;case 5:Mt=k.stateNode,Nn=!1;break e;case 3:case 4:Mt=k.stateNode.containerInfo,Nn=!0;break e}k=k.return}if(Mt===null)throw Error(r(160));cv(p,w,h),Mt=null,Nn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)fv(n,t),n=n.sibling}var Da=null;function fv(t,n){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:In(n,t),Hn(t),c&4&&(Xr(3,t,t.return),ol(3,t),Xr(5,t,t.return));break;case 1:In(n,t),Hn(t),c&512&&(Qt||s===null||Fa(s,s.return)),c&64&&gr&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var h=Da;if(In(n,t),Hn(t),c&512&&(Qt||s===null||Fa(s,s.return)),c&4){var p=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(c){case"title":p=h.getElementsByTagName("title")[0],(!p||p[yi]||p[an]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(c),h.head.insertBefore(p,h.querySelector("head > title"))),pn(p,c,s),p[an]=t,Wt(p),c=p;break e;case"link":var w=fS("link","href",h).get(c+(s.href||""));if(w){for(var k=0;k<w.length;k++)if(p=w[k],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){w.splice(k,1);break t}}p=h.createElement(c),pn(p,c,s),h.head.appendChild(p);break;case"meta":if(w=fS("meta","content",h).get(c+(s.content||""))){for(k=0;k<w.length;k++)if(p=w[k],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){w.splice(k,1);break t}}p=h.createElement(c),pn(p,c,s),h.head.appendChild(p);break;default:throw Error(r(468,c))}p[an]=t,Wt(p),c=p}t.stateNode=c}else hS(h,t.type,t.stateNode);else t.stateNode=dS(h,c,t.memoizedProps);else p!==c?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,c===null?hS(h,t.type,t.stateNode):dS(h,c,t.memoizedProps)):c===null&&t.stateNode!==null&&Vh(t,t.memoizedProps,s.memoizedProps)}break;case 27:In(n,t),Hn(t),c&512&&(Qt||s===null||Fa(s,s.return)),s!==null&&c&4&&Vh(t,t.memoizedProps,s.memoizedProps);break;case 5:if(In(n,t),Hn(t),c&512&&(Qt||s===null||Fa(s,s.return)),t.flags&32){h=t.stateNode;try{zr(h,"")}catch(De){Ct(t,t.return,De)}}c&4&&t.stateNode!=null&&(h=t.memoizedProps,Vh(t,h,s!==null?s.memoizedProps:h)),c&1024&&(Wh=!0);break;case 6:if(In(n,t),Hn(t),c&4){if(t.stateNode===null)throw Error(r(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(De){Ct(t,t.return,De)}}break;case 3:if(Mu=null,h=Da,Da=Ou(n.containerInfo),In(n,t),Da=h,Hn(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{qs(n.containerInfo)}catch(De){Ct(t,t.return,De)}Wh&&(Wh=!1,hv(t));break;case 4:c=Da,Da=Ou(t.stateNode.containerInfo),In(n,t),Hn(t),Da=c;break;case 12:In(n,t),Hn(t);break;case 31:In(n,t),Hn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,yu(t,c)));break;case 13:In(n,t),Hn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(vu=Ft()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,yu(t,c)));break;case 22:h=t.memoizedState!==null;var z=s!==null&&s.memoizedState!==null,Y=gr,ae=Qt;if(gr=Y||h,Qt=ae||z,In(n,t),Qt=ae,gr=Y,Hn(t),c&8192)e:for(n=t.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(s===null||z||gr||Qt||Pi(t)),s=null,n=t;;){if(n.tag===5||n.tag===26){if(s===null){z=s=n;try{if(p=z.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{k=z.stateNode;var ue=z.memoizedProps.style,J=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;k.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(De){Ct(z,z.return,De)}}}else if(n.tag===6){if(s===null){z=n;try{z.stateNode.nodeValue=h?"":z.memoizedProps}catch(De){Ct(z,z.return,De)}}}else if(n.tag===18){if(s===null){z=n;try{var ee=z.stateNode;h?nS(ee,!0):nS(z.stateNode,!1)}catch(De){Ct(z,z.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;s===n&&(s=null),n=n.return}s===n&&(s=null),n.sibling.return=n.return,n=n.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,yu(t,s))));break;case 19:In(n,t),Hn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,yu(t,c)));break;case 30:break;case 21:break;default:In(n,t),Hn(t)}}function Hn(t){var n=t.flags;if(n&2){try{for(var s,c=t.return;c!==null;){if(rv(c)){s=c;break}c=c.return}if(s==null)throw Error(r(160));switch(s.tag){case 27:var h=s.stateNode,p=Fh(t);mu(t,p,h);break;case 5:var w=s.stateNode;s.flags&32&&(zr(w,""),s.flags&=-33);var k=Fh(t);mu(t,k,w);break;case 3:case 4:var z=s.stateNode.containerInfo,Y=Fh(t);Kh(t,Y,z);break;default:throw Error(r(161))}}catch(ae){Ct(t,t.return,ae)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function hv(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;hv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function mr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)ov(t,n.alternate,n),n=n.sibling}function Pi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Xr(4,n,n.return),Pi(n);break;case 1:Fa(n,n.return);var s=n.stateNode;typeof s.componentWillUnmount=="function"&&nv(n,n.return,s),Pi(n);break;case 27:yl(n.stateNode);case 26:case 5:Fa(n,n.return),Pi(n);break;case 22:n.memoizedState===null&&Pi(n);break;case 30:Pi(n);break;default:Pi(n)}t=t.sibling}}function yr(t,n,s){for(s=s&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var c=n.alternate,h=t,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:yr(h,p,s),ol(4,p);break;case 1:if(yr(h,p,s),c=p,h=c.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(Y){Ct(c,c.return,Y)}if(c=p,h=c.updateQueue,h!==null){var k=c.stateNode;try{var z=h.shared.hiddenCallbacks;if(z!==null)for(h.shared.hiddenCallbacks=null,h=0;h<z.length;h++)Gy(z[h],k)}catch(Y){Ct(c,c.return,Y)}}s&&w&64&&tv(p),ll(p,p.return);break;case 27:iv(p);case 26:case 5:yr(h,p,s),s&&c===null&&w&4&&av(p),ll(p,p.return);break;case 12:yr(h,p,s);break;case 31:yr(h,p,s),s&&w&4&&uv(h,p);break;case 13:yr(h,p,s),s&&w&4&&dv(h,p);break;case 22:p.memoizedState===null&&yr(h,p,s),ll(p,p.return);break;case 30:break;default:yr(h,p,s)}n=n.sibling}}function Yh(t,n){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Wo(s))}function Xh(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Wo(t))}function Oa(t,n,s,c){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)gv(t,n,s,c),n=n.sibling}function gv(t,n,s,c){var h=n.flags;switch(n.tag){case 0:case 11:case 15:Oa(t,n,s,c),h&2048&&ol(9,n);break;case 1:Oa(t,n,s,c);break;case 3:Oa(t,n,s,c),h&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Wo(t)));break;case 12:if(h&2048){Oa(t,n,s,c),t=n.stateNode;try{var p=n.memoizedProps,w=p.id,k=p.onPostCommit;typeof k=="function"&&k(w,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(z){Ct(n,n.return,z)}}else Oa(t,n,s,c);break;case 31:Oa(t,n,s,c);break;case 13:Oa(t,n,s,c);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?Oa(t,n,s,c):cl(t,n):p._visibility&2?Oa(t,n,s,c):(p._visibility|=2,Ls(t,n,s,c,(n.subtreeFlags&10256)!==0||!1)),h&2048&&Yh(w,n);break;case 24:Oa(t,n,s,c),h&2048&&Xh(n.alternate,n);break;default:Oa(t,n,s,c)}}function Ls(t,n,s,c,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=t,w=n,k=s,z=c,Y=w.flags;switch(w.tag){case 0:case 11:case 15:Ls(p,w,k,z,h),ol(8,w);break;case 23:break;case 22:var ae=w.stateNode;w.memoizedState!==null?ae._visibility&2?Ls(p,w,k,z,h):cl(p,w):(ae._visibility|=2,Ls(p,w,k,z,h)),h&&Y&2048&&Yh(w.alternate,w);break;case 24:Ls(p,w,k,z,h),h&&Y&2048&&Xh(w.alternate,w);break;default:Ls(p,w,k,z,h)}n=n.sibling}}function cl(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var s=t,c=n,h=c.flags;switch(c.tag){case 22:cl(s,c),h&2048&&Yh(c.alternate,c);break;case 24:cl(s,c),h&2048&&Xh(c.alternate,c);break;default:cl(s,c)}n=n.sibling}}var ul=8192;function Ms(t,n,s){if(t.subtreeFlags&ul)for(t=t.child;t!==null;)pv(t,n,s),t=t.sibling}function pv(t,n,s){switch(t.tag){case 26:Ms(t,n,s),t.flags&ul&&t.memoizedState!==null&&Bx(s,Da,t.memoizedState,t.memoizedProps);break;case 5:Ms(t,n,s);break;case 3:case 4:var c=Da;Da=Ou(t.stateNode.containerInfo),Ms(t,n,s),Da=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=ul,ul=16777216,Ms(t,n,s),ul=c):Ms(t,n,s));break;default:Ms(t,n,s)}}function mv(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function dl(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var c=n[s];cn=c,bv(c,t)}mv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)yv(t),t=t.sibling}function yv(t){switch(t.tag){case 0:case 11:case 15:dl(t),t.flags&2048&&Xr(9,t,t.return);break;case 3:dl(t);break;case 12:dl(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,bu(t)):dl(t);break;default:dl(t)}}function bu(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var c=n[s];cn=c,bv(c,t)}mv(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Xr(8,n,n.return),bu(n);break;case 22:s=n.stateNode,s._visibility&2&&(s._visibility&=-3,bu(n));break;default:bu(n)}t=t.sibling}}function bv(t,n){for(;cn!==null;){var s=cn;switch(s.tag){case 0:case 11:case 15:Xr(8,s,n);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Wo(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,cn=c;else e:for(s=t;cn!==null;){c=cn;var h=c.sibling,p=c.return;if(lv(c),c===s){cn=null;break e}if(h!==null){h.return=p,cn=h;break e}cn=p}}}var nx={getCacheForType:function(t){var n=hn(Yt),s=n.data.get(t);return s===void 0&&(s=t(),n.data.set(t,s)),s},cacheSignal:function(){return hn(Yt).controller.signal}},ax=typeof WeakMap=="function"?WeakMap:Map,vt=0,kt=null,tt=null,at=0,wt=0,Wn=null,Jr=!1,$s=!1,Jh=!1,br=0,Bt=0,Qr=0,qi=0,Qh=0,Yn=0,Ns=0,fl=null,zn=null,Zh=!1,vu=0,vv=0,Su=1/0,wu=null,Zr=null,sn=0,ei=null,Is=null,vr=0,eg=0,tg=null,Sv=null,hl=0,ng=null;function Xn(){return(vt&2)!==0&&at!==0?at&-at:Q.T!==null?lg():Kt()}function wv(){if(Yn===0)if((at&536870912)===0||lt){var t=Se;Se<<=1,(Se&3932160)===0&&(Se=262144),Yn=t}else Yn=536870912;return t=Fn.current,t!==null&&(t.flags|=32),Yn}function jn(t,n,s){(t===kt&&(wt===2||wt===9)||t.cancelPendingCommit!==null)&&(Hs(t,0),ti(t,at,Yn,!1)),Fe(t,s),((vt&2)===0||t!==kt)&&(t===kt&&((vt&2)===0&&(qi|=s),Bt===4&&ti(t,at,Yn,!1)),Ka(t))}function Cv(t,n,s){if((vt&6)!==0)throw Error(r(327));var c=!s&&(n&127)===0&&(n&t.expiredLanes)===0||ze(t,n),h=c?sx(t,n):rg(t,n,!0),p=c;do{if(h===0){$s&&!c&&ti(t,n,0,!1);break}else{if(s=t.current.alternate,p&&!rx(s)){h=rg(t,n,!1),p=!1;continue}if(h===2){if(p=n,t.errorRecoveryDisabledLanes&p)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var k=t;h=fl;var z=k.current.memoizedState.isDehydrated;if(z&&(Hs(k,w).flags|=256),w=rg(k,w,!1),w!==2){if(Jh&&!z){k.errorRecoveryDisabledLanes|=p,qi|=p,h=4;break e}p=zn,zn=h,p!==null&&(zn===null?zn=p:zn.push.apply(zn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Hs(t,0),ti(t,n,0,!0);break}e:{switch(c=t,p=h,p){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:ti(c,n,Yn,!Jr);break e;case 2:zn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(h=vu+300-Ft(),10<h)){if(ti(c,n,Yn,!Jr),je(c,0,!0)!==0)break e;vr=n,c.timeoutHandle=Zv(Ev.bind(null,c,s,zn,wu,Zh,n,Yn,qi,Ns,Jr,p,"Throttled",-0,0),h);break e}Ev(c,s,zn,wu,Zh,n,Yn,qi,Ns,Jr,p,null,-0,0)}}break}while(!0);Ka(t)}function Ev(t,n,s,c,h,p,w,k,z,Y,ae,ue,J,ee){if(t.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Aa},pv(n,p,ue);var De=(p&62914560)===p?vu-Ft():(p&4194048)===p?vv-Ft():0;if(De=Px(ue,De),De!==null){vr=p,t.cancelPendingCommit=De(Ov.bind(null,t,n,p,s,c,h,w,k,z,ae,ue,null,J,ee)),ti(t,p,w,!Y);return}}Ov(t,n,p,s,c,h,w,k,z)}function rx(t){for(var n=t;;){var s=n.tag;if((s===0||s===11||s===15)&&n.flags&16384&&(s=n.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var h=s[c],p=h.getSnapshot;h=h.value;try{if(!Gn(p(),h))return!1}catch{return!1}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ti(t,n,s,c){n&=~Qh,n&=~qi,t.suspendedLanes|=n,t.pingedLanes&=~n,c&&(t.warmLanes|=n),c=t.expirationTimes;for(var h=n;0<h;){var p=31-q(h),w=1<<p;c[p]=-1,h&=~w}s!==0&&Te(t,s,n)}function Cu(){return(vt&6)===0?(gl(0),!1):!0}function ag(){if(tt!==null){if(wt===0)var t=tt.return;else t=tt,lr=$i=null,vh(t),Ts=null,Xo=0,t=tt;for(;t!==null;)ev(t.alternate,t),t=t.return;tt=null}}function Hs(t,n){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,_x(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),vr=0,ag(),kt=t,tt=s=sr(t.current,null),at=n,wt=0,Wn=null,Jr=!1,$s=ze(t,n),Jh=!1,Ns=Yn=Qh=qi=Qr=Bt=0,zn=fl=null,Zh=!1,(n&8)!==0&&(n|=n&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=n;0<c;){var h=31-q(c),p=1<<h;n|=t[h],c&=~p}return br=n,qc(),s}function _v(t,n){Je=null,Q.H=rl,n===xs||n===Jc?(n=Uy(),wt=3):n===oh?(n=Uy(),wt=4):wt=n===Nh?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Wn=n,tt===null&&(Bt=1,du(t,ra(n,t.current)))}function Av(){var t=Fn.current;return t===null?!0:(at&4194048)===at?la===null:(at&62914560)===at||(at&536870912)!==0?t===la:!1}function xv(){var t=Q.H;return Q.H=rl,t===null?rl:t}function Tv(){var t=Q.A;return Q.A=nx,t}function Eu(){Bt=4,Jr||(at&4194048)!==at&&Fn.current!==null||($s=!0),(Qr&134217727)===0&&(qi&134217727)===0||kt===null||ti(kt,at,Yn,!1)}function rg(t,n,s){var c=vt;vt|=2;var h=xv(),p=Tv();(kt!==t||at!==n)&&(wu=null,Hs(t,n)),n=!1;var w=Bt;e:do try{if(wt!==0&&tt!==null){var k=tt,z=Wn;switch(wt){case 8:ag(),w=6;break e;case 3:case 2:case 9:case 6:Fn.current===null&&(n=!0);var Y=wt;if(wt=0,Wn=null,zs(t,k,z,Y),s&&$s){w=0;break e}break;default:Y=wt,wt=0,Wn=null,zs(t,k,z,Y)}}ix(),w=Bt;break}catch(ae){_v(t,ae)}while(!0);return n&&t.shellSuspendCounter++,lr=$i=null,vt=c,Q.H=h,Q.A=p,tt===null&&(kt=null,at=0,qc()),w}function ix(){for(;tt!==null;)Rv(tt)}function sx(t,n){var s=vt;vt|=2;var c=xv(),h=Tv();kt!==t||at!==n?(wu=null,Su=Ft()+500,Hs(t,n)):$s=ze(t,n);e:do try{if(wt!==0&&tt!==null){n=tt;var p=Wn;t:switch(wt){case 1:wt=0,Wn=null,zs(t,n,p,1);break;case 2:case 9:if(zy(p)){wt=0,Wn=null,kv(n);break}n=function(){wt!==2&&wt!==9||kt!==t||(wt=7),Ka(t)},p.then(n,n);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:zy(p)?(wt=0,Wn=null,kv(n)):(wt=0,Wn=null,zs(t,n,p,7));break;case 5:var w=null;switch(tt.tag){case 26:w=tt.memoizedState;case 5:case 27:var k=tt;if(w?gS(w):k.stateNode.complete){wt=0,Wn=null;var z=k.sibling;if(z!==null)tt=z;else{var Y=k.return;Y!==null?(tt=Y,_u(Y)):tt=null}break t}}wt=0,Wn=null,zs(t,n,p,5);break;case 6:wt=0,Wn=null,zs(t,n,p,6);break;case 8:ag(),Bt=6;break e;default:throw Error(r(462))}}ox();break}catch(ae){_v(t,ae)}while(!0);return lr=$i=null,Q.H=c,Q.A=h,vt=s,tt!==null?0:(kt=null,at=0,qc(),Bt)}function ox(){for(;tt!==null&&!ea();)Rv(tt)}function Rv(t){var n=Qb(t.alternate,t,br);t.memoizedProps=t.pendingProps,n===null?_u(t):tt=n}function kv(t){var n=t,s=n.alternate;switch(n.tag){case 15:case 0:n=Fb(s,n,n.pendingProps,n.type,void 0,at);break;case 11:n=Fb(s,n,n.pendingProps,n.type.render,n.ref,at);break;case 5:vh(n);default:ev(s,n),n=tt=Ty(n,br),n=Qb(s,n,br)}t.memoizedProps=t.pendingProps,n===null?_u(t):tt=n}function zs(t,n,s,c){lr=$i=null,vh(n),Ts=null,Xo=0;var h=n.return;try{if(YA(t,h,n,s,at)){Bt=1,du(t,ra(s,t.current)),tt=null;return}}catch(p){if(h!==null)throw tt=h,p;Bt=1,du(t,ra(s,t.current)),tt=null;return}n.flags&32768?(lt||c===1?t=!0:$s||(at&536870912)!==0?t=!1:(Jr=t=!0,(c===2||c===9||c===3||c===6)&&(c=Fn.current,c!==null&&c.tag===13&&(c.flags|=16384))),Dv(n,t)):_u(n)}function _u(t){var n=t;do{if((n.flags&32768)!==0){Dv(n,Jr);return}t=n.return;var s=QA(n.alternate,n,br);if(s!==null){tt=s;return}if(n=n.sibling,n!==null){tt=n;return}tt=n=t}while(n!==null);Bt===0&&(Bt=5)}function Dv(t,n){do{var s=ZA(t.alternate,t);if(s!==null){s.flags&=32767,tt=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!n&&(t=t.sibling,t!==null)){tt=t;return}tt=t=s}while(t!==null);Bt=6,tt=null}function Ov(t,n,s,c,h,p,w,k,z){t.cancelPendingCommit=null;do Au();while(sn!==0);if((vt&6)!==0)throw Error(r(327));if(n!==null){if(n===t.current)throw Error(r(177));if(p=n.lanes|n.childLanes,p|=Ff,_e(t,s,p,w,k,z),t===kt&&(tt=kt=null,at=0),Is=n,ei=t,vr=s,eg=p,tg=h,Sv=c,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,dx(en,function(){return Iv(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||c){c=Q.T,Q.T=null,h=fe.p,fe.p=2,w=vt,vt|=4;try{ex(t,n,s)}finally{vt=w,fe.p=h,Q.T=c}}sn=1,Lv(),Mv(),$v()}}function Lv(){if(sn===1){sn=0;var t=ei,n=Is,s=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||s){s=Q.T,Q.T=null;var c=fe.p;fe.p=2;var h=vt;vt|=4;try{fv(n,t);var p=mg,w=by(t.containerInfo),k=p.focusedElem,z=p.selectionRange;if(w!==k&&k&&k.ownerDocument&&yy(k.ownerDocument.documentElement,k)){if(z!==null&&Bf(k)){var Y=z.start,ae=z.end;if(ae===void 0&&(ae=Y),"selectionStart"in k)k.selectionStart=Y,k.selectionEnd=Math.min(ae,k.value.length);else{var ue=k.ownerDocument||document,J=ue&&ue.defaultView||window;if(J.getSelection){var ee=J.getSelection(),De=k.textContent.length,Ge=Math.min(z.start,De),Tt=z.end===void 0?Ge:Math.min(z.end,De);!ee.extend&&Ge>Tt&&(w=Tt,Tt=Ge,Ge=w);var V=my(k,Ge),G=my(k,Tt);if(V&&G&&(ee.rangeCount!==1||ee.anchorNode!==V.node||ee.anchorOffset!==V.offset||ee.focusNode!==G.node||ee.focusOffset!==G.offset)){var W=ue.createRange();W.setStart(V.node,V.offset),ee.removeAllRanges(),Ge>Tt?(ee.addRange(W),ee.extend(G.node,G.offset)):(W.setEnd(G.node,G.offset),ee.addRange(W))}}}}for(ue=[],ee=k;ee=ee.parentNode;)ee.nodeType===1&&ue.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ue.length;k++){var oe=ue[k];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Hu=!!pg,mg=pg=null}finally{vt=h,fe.p=c,Q.T=s}}t.current=n,sn=2}}function Mv(){if(sn===2){sn=0;var t=ei,n=Is,s=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||s){s=Q.T,Q.T=null;var c=fe.p;fe.p=2;var h=vt;vt|=4;try{ov(t,n.alternate,n)}finally{vt=h,fe.p=c,Q.T=s}}sn=3}}function $v(){if(sn===4||sn===3){sn=0,Ua();var t=ei,n=Is,s=vr,c=Sv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?sn=5:(sn=0,Is=ei=null,Nv(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Zr=null),nn(s),n=n.stateNode,tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Ea,n,void 0,(n.current.flags&128)===128)}catch{}if(c!==null){n=Q.T,h=fe.p,fe.p=2,Q.T=null;try{for(var p=t.onRecoverableError,w=0;w<c.length;w++){var k=c[w];p(k.value,{componentStack:k.stack})}}finally{Q.T=n,fe.p=h}}(vr&3)!==0&&Au(),Ka(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===ng?hl++:(hl=0,ng=t):hl=0,gl(0)}}function Nv(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Wo(n)))}function Au(){return Lv(),Mv(),$v(),Iv()}function Iv(){if(sn!==5)return!1;var t=ei,n=eg;eg=0;var s=nn(vr),c=Q.T,h=fe.p;try{fe.p=32>s?32:s,Q.T=null,s=tg,tg=null;var p=ei,w=vr;if(sn=0,Is=ei=null,vr=0,(vt&6)!==0)throw Error(r(331));var k=vt;if(vt|=4,yv(p.current),gv(p,p.current,w,s),vt=k,gl(0,!1),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Ea,p)}catch{}return!0}finally{fe.p=h,Q.T=c,Nv(t,n)}}function Hv(t,n,s){n=ra(s,n),n=$h(t.stateNode,n,2),t=Kr(t,n,2),t!==null&&(Fe(t,2),Ka(t))}function Ct(t,n,s){if(t.tag===3)Hv(t,t,s);else for(;n!==null;){if(n.tag===3){Hv(n,t,s);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Zr===null||!Zr.has(c))){t=ra(s,t),s=zb(2),c=Kr(n,s,2),c!==null&&(jb(s,c,n,t),Fe(c,2),Ka(c));break}}n=n.return}}function ig(t,n,s){var c=t.pingCache;if(c===null){c=t.pingCache=new ax;var h=new Set;c.set(n,h)}else h=c.get(n),h===void 0&&(h=new Set,c.set(n,h));h.has(s)||(Jh=!0,h.add(s),t=lx.bind(null,t,n,s),n.then(t,t))}function lx(t,n,s){var c=t.pingCache;c!==null&&c.delete(n),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,kt===t&&(at&s)===s&&(Bt===4||Bt===3&&(at&62914560)===at&&300>Ft()-vu?(vt&2)===0&&Hs(t,0):Qh|=s,Ns===at&&(Ns=0)),Ka(t)}function zv(t,n){n===0&&(n=ke()),t=Oi(t,n),t!==null&&(Fe(t,n),Ka(t))}function cx(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),zv(t,s)}function ux(t,n){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(n),zv(t,s)}function dx(t,n){return jt(t,n)}var xu=null,js=null,sg=!1,Tu=!1,og=!1,ni=0;function Ka(t){t!==js&&t.next===null&&(js===null?xu=js=t:js=js.next=t),Tu=!0,sg||(sg=!0,hx())}function gl(t,n){if(!og&&Tu){og=!0;do for(var s=!1,c=xu;c!==null;){if(t!==0){var h=c.pendingLanes;if(h===0)var p=0;else{var w=c.suspendedLanes,k=c.pingedLanes;p=(1<<31-q(42|t)+1)-1,p&=h&~(w&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,Pv(c,p))}else p=at,p=je(c,c===kt?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||ze(c,p)||(s=!0,Pv(c,p));c=c.next}while(s);og=!1}}function fx(){jv()}function jv(){Tu=sg=!1;var t=0;ni!==0&&Ex()&&(t=ni);for(var n=Ft(),s=null,c=xu;c!==null;){var h=c.next,p=Uv(c,n);p===0?(c.next=null,s===null?xu=h:s.next=h,h===null&&(js=s)):(s=c,(t!==0||(p&3)!==0)&&(Tu=!0)),c=h}sn!==0&&sn!==5||gl(t),ni!==0&&(ni=0)}function Uv(t,n){for(var s=t.suspendedLanes,c=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var w=31-q(p),k=1<<w,z=h[w];z===-1?((k&s)===0||(k&c)!==0)&&(h[w]=Le(k,n)):z<=n&&(t.expiredLanes|=k),p&=~k}if(n=kt,s=at,s=je(t,t===n?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===n&&(wt===2||wt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&On(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||ze(t,s)){if(n=s&-s,n===t.callbackPriority)return n;switch(c!==null&&On(c),nn(s)){case 2:case 8:s=bn;break;case 32:s=en;break;case 268435456:s=ta;break;default:s=en}return c=Bv.bind(null,t),s=jt(s,c),t.callbackPriority=n,t.callbackNode=s,n}return c!==null&&c!==null&&On(c),t.callbackPriority=2,t.callbackNode=null,2}function Bv(t,n){if(sn!==0&&sn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Au()&&t.callbackNode!==s)return null;var c=at;return c=je(t,t===kt?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(Cv(t,c,n),Uv(t,Ft()),t.callbackNode!=null&&t.callbackNode===s?Bv.bind(null,t):null)}function Pv(t,n){if(Au())return null;Cv(t,n,!0)}function hx(){Ax(function(){(vt&6)!==0?jt(er,fx):jv()})}function lg(){if(ni===0){var t=_s;t===0&&(t=be,be<<=1,(be&261888)===0&&(be=256)),ni=t}return ni}function qv(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:na(""+t)}function Gv(t,n){var s=n.ownerDocument.createElement("input");return s.name=n.name,s.value=n.value,t.id&&s.setAttribute("form",t.id),n.parentNode.insertBefore(s,n),t=new FormData(t),s.parentNode.removeChild(s),t}function gx(t,n,s,c,h){if(n==="submit"&&s&&s.stateNode===h){var p=qv((h[vn]||null).action),w=c.submitter;w&&(n=(n=w[vn]||null)?qv(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var k=new ir("action","action",null,c,h);t.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(ni!==0){var z=w?Gv(h,w):new FormData(h);Rh(s,{pending:!0,data:z,method:h.method,action:p},null,z)}}else typeof p=="function"&&(k.preventDefault(),z=w?Gv(h,w):new FormData(h),Rh(s,{pending:!0,data:z,method:h.method,action:p},p,z))},currentTarget:h}]})}}for(var cg=0;cg<Vf.length;cg++){var ug=Vf[cg],px=ug.toLowerCase(),mx=ug[0].toUpperCase()+ug.slice(1);ka(px,"on"+mx)}ka(wy,"onAnimationEnd"),ka(Cy,"onAnimationIteration"),ka(Ey,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(LA,"onTransitionRun"),ka(MA,"onTransitionStart"),ka($A,"onTransitionCancel"),ka(_y,"onTransitionEnd"),$r("onMouseEnter",["mouseout","mouseover"]),$r("onMouseLeave",["mouseout","mouseover"]),$r("onPointerEnter",["pointerout","pointerover"]),$r("onPointerLeave",["pointerout","pointerover"]),_a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),_a("onBeforeInput",["compositionend","keypress","textInput","paste"]),_a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pl="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(" "),yx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pl));function Vv(t,n){n=(n&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],h=c.event;c=c.listeners;e:{var p=void 0;if(n)for(var w=c.length-1;0<=w;w--){var k=c[w],z=k.instance,Y=k.currentTarget;if(k=k.listener,z!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=Y;try{p(h)}catch(ae){Pc(ae)}h.currentTarget=null,p=z}else for(w=0;w<c.length;w++){if(k=c[w],z=k.instance,Y=k.currentTarget,k=k.listener,z!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=Y;try{p(h)}catch(ae){Pc(ae)}h.currentTarget=null,p=z}}}}function nt(t,n){var s=n[To];s===void 0&&(s=n[To]=new Set);var c=t+"__bubble";s.has(c)||(Fv(n,t,2,!1),s.add(c))}function dg(t,n,s){var c=0;n&&(c|=4),Fv(s,t,c,n)}var Ru="_reactListening"+Math.random().toString(36).slice(2);function fg(t){if(!t[Ru]){t[Ru]=!0,vc.forEach(function(s){s!=="selectionchange"&&(yx.has(s)||dg(s,!1,t),dg(s,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Ru]||(n[Ru]=!0,dg("selectionchange",!1,n))}}function Fv(t,n,s,c){switch(wS(n)){case 2:var h=Vx;break;case 8:h=Fx;break;default:h=Tg}s=h.bind(null,n,s,t),h=void 0,!$o||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),c?h!==void 0?t.addEventListener(n,s,{capture:!0,passive:h}):t.addEventListener(n,s,!0):h!==void 0?t.addEventListener(n,s,{passive:h}):t.addEventListener(n,s,!1)}function hg(t,n,s,c,h){var p=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var k=c.stateNode.containerInfo;if(k===h)break;if(w===4)for(w=c.return;w!==null;){var z=w.tag;if((z===3||z===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;k!==null;){if(w=Lr(k),w===null)return;if(z=w.tag,z===5||z===6||z===26||z===27){c=p=w;continue e}k=k.parentNode}}c=c.return}kc(function(){var Y=p,ae=Mo(s),ue=[];e:{var J=Ay.get(t);if(J!==void 0){var ee=ir,De=t;switch(t){case"keypress":if(Ci(s)===0)break e;case"keydown":case"keyup":ee=Of;break;case"focusin":De="focus",ee=zo;break;case"focusout":De="blur",ee=zo;break;case"beforeblur":case"afterblur":ee=zo;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=Lc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=hy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=$f;break;case wy:case Cy:case Ey:ee=_f;break;case _y:ee=ps;break;case"scroll":case"scrollend":ee=wf;break;case"wheel":ee=_;break;case"copy":case"cut":case"paste":ee=Mc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Ic;break;case"toggle":case"beforetoggle":ee=C}var Ge=(n&4)!==0,Tt=!Ge&&(t==="scroll"||t==="scrollend"),V=Ge?J!==null?J+"Capture":null:J;Ge=[];for(var G=Y,W;G!==null;){var oe=G;if(W=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||W===null||V===null||(oe=Si(G,V),oe!=null&&Ge.push(ml(G,oe,W))),Tt)break;G=G.return}0<Ge.length&&(J=new ee(J,De,null,s,ae),ue.push({event:J,listeners:Ge}))}}if((n&7)===0){e:{if(J=t==="mouseover"||t==="pointerover",ee=t==="mouseout"||t==="pointerout",J&&s!==Lo&&(De=s.relatedTarget||s.fromElement)&&(Lr(De)||De[Or]))break e;if((ee||J)&&(J=ae.window===ae?ae:(J=ae.ownerDocument)?J.defaultView||J.parentWindow:window,ee?(De=s.relatedTarget||s.toElement,ee=Y,De=De?Lr(De):null,De!==null&&(Tt=l(De),Ge=De.tag,De!==Tt||Ge!==5&&Ge!==27&&Ge!==6)&&(De=null)):(ee=null,De=Y),ee!==De)){if(Ge=Lc,oe="onMouseLeave",V="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Ge=Ic,oe="onPointerLeave",V="onPointerEnter",G="pointer"),Tt=ee==null?J:nr(ee),W=De==null?J:nr(De),J=new Ge(oe,G+"leave",ee,s,ae),J.target=Tt,J.relatedTarget=W,oe=null,Lr(ae)===Y&&(Ge=new Ge(V,G+"enter",De,s,ae),Ge.target=W,Ge.relatedTarget=Tt,oe=Ge),Tt=oe,ee&&De)t:{for(Ge=bx,V=ee,G=De,W=0,oe=V;oe;oe=Ge(oe))W++;oe=0;for(var qe=G;qe;qe=Ge(qe))oe++;for(;0<W-oe;)V=Ge(V),W--;for(;0<oe-W;)G=Ge(G),oe--;for(;W--;){if(V===G||G!==null&&V===G.alternate){Ge=V;break t}V=Ge(V),G=Ge(G)}Ge=null}else Ge=null;ee!==null&&Kv(ue,J,ee,Ge,!1),De!==null&&Tt!==null&&Kv(ue,Tt,De,Ge,!0)}}e:{if(J=Y?nr(Y):window,ee=J.nodeName&&J.nodeName.toLowerCase(),ee==="select"||ee==="input"&&J.type==="file")var mt=Bo;else if(Uo(J))if(Po)mt=kA;else{mt=Uf;var Ie=jf}else ee=J.nodeName,!ee||ee.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Y&&Do(Y.elementType)&&(mt=Bo):mt=Bc;if(mt&&(mt=mt(t,Y))){zc(ue,mt,s,ae);break e}Ie&&Ie(t,J,Y),t==="focusout"&&Y&&J.type==="number"&&Y.memoizedProps.value!=null&&ar(J,"number",J.value)}switch(Ie=Y?nr(Y):window,t){case"focusin":(Uo(Ie)||Ie.contentEditable==="true")&&(ms=Ie,Pf=Y,Vo=null);break;case"focusout":Vo=Pf=ms=null;break;case"mousedown":qf=!0;break;case"contextmenu":case"mouseup":case"dragend":qf=!1,vy(ue,s,ae);break;case"selectionchange":if(OA)break;case"keydown":case"keyup":vy(ue,s,ae)}var Qe;if(I)e:{switch(t){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else Ra?pt(t,s)&&(rt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(rt="onCompositionStart");rt&&(Me&&s.locale!=="ko"&&(Ra||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Ra&&(Qe=Dc()):(qa=ae,No="value"in qa?qa.value:qa.textContent,Ra=!0)),Ie=ku(Y,rt),0<Ie.length&&(rt=new $c(rt,t,null,s,ae),ue.push({event:rt,listeners:Ie}),Qe?rt.data=Qe:(Qe=Nt(s),Qe!==null&&(rt.data=Qe)))),(Qe=pe?If(t,s):Hc(t,s))&&(rt=ku(Y,"onBeforeInput"),0<rt.length&&(Ie=new $c("onBeforeInput","beforeinput",null,s,ae),ue.push({event:Ie,listeners:rt}),Ie.data=Qe)),gx(ue,t,Y,s,ae)}Vv(ue,n)})}function ml(t,n,s){return{instance:t,listener:n,currentTarget:s}}function ku(t,n){for(var s=n+"Capture",c=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Si(t,s),h!=null&&c.unshift(ml(t,h,p)),h=Si(t,n),h!=null&&c.push(ml(t,h,p))),t.tag===3)return c;t=t.return}return[]}function bx(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Kv(t,n,s,c,h){for(var p=n._reactName,w=[];s!==null&&s!==c;){var k=s,z=k.alternate,Y=k.stateNode;if(k=k.tag,z!==null&&z===c)break;k!==5&&k!==26&&k!==27||Y===null||(z=Y,h?(Y=Si(s,p),Y!=null&&w.unshift(ml(s,Y,z))):h||(Y=Si(s,p),Y!=null&&w.push(ml(s,Y,z)))),s=s.return}w.length!==0&&t.push({event:n,listeners:w})}var vx=/\r\n?/g,Sx=/\u0000|\uFFFD/g;function Wv(t){return(typeof t=="string"?t:""+t).replace(vx,`
|
||
`).replace(Sx,"")}function Yv(t,n){return n=Wv(n),Wv(t)===n}function xt(t,n,s,c,h,p){switch(s){case"children":typeof c=="string"?n==="body"||n==="textarea"&&c===""||zr(t,c):(typeof c=="number"||typeof c=="bigint")&&n!=="body"&&zr(t,""+c);break;case"className":bi(t,"class",c);break;case"tabIndex":bi(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":bi(t,s,c);break;case"style":Tc(t,c,p);break;case"data":if(n!=="object"){bi(t,"data",c);break}case"src":case"href":if(c===""&&(n!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=na(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"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 p=="function"&&(s==="formAction"?(n!=="input"&&xt(t,n,"name",h.name,h,null),xt(t,n,"formEncType",h.formEncType,h,null),xt(t,n,"formMethod",h.formMethod,h,null),xt(t,n,"formTarget",h.formTarget,h,null)):(xt(t,n,"encType",h.encType,h,null),xt(t,n,"method",h.method,h,null),xt(t,n,"target",h.target,h,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=na(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=Aa);break;case"onScroll":c!=null&&nt("scroll",t);break;case"onScrollEnd":c!=null&&nt("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(s=c.__html,s!=null){if(h.children!=null)throw Error(r(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=na(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":nt("beforetoggle",t),nt("toggle",t),Mn(t,"popover",c);break;case"xlinkActuate":dn(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":dn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":dn(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":dn(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":dn(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":dn(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":dn(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":dn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":dn(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Mn(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Sf.get(s)||s,Mn(t,s,c))}}function gg(t,n,s,c,h,p){switch(s){case"style":Tc(t,c,p);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(s=c.__html,s!=null){if(h.children!=null)throw Error(r(60));t.innerHTML=s}}break;case"children":typeof c=="string"?zr(t,c):(typeof c=="number"||typeof c=="bigint")&&zr(t,""+c);break;case"onScroll":c!=null&&nt("scroll",t);break;case"onScrollEnd":c!=null&&nt("scrollend",t);break;case"onClick":c!=null&&(t.onclick=Aa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sc.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),n=s.slice(2,h?s.length-7:void 0),p=t[vn]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(n,p,h),typeof c=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(n,c,h);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):Mn(t,s,c)}}}function pn(t,n,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",t),nt("load",t);var c=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var w=s[p];if(w!=null)switch(p){case"src":c=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:xt(t,n,p,w,s,null)}}h&&xt(t,n,"srcSet",s.srcSet,s,null),c&&xt(t,n,"src",s.src,s,null);return;case"input":nt("invalid",t);var k=p=w=h=null,z=null,Y=null;for(c in s)if(s.hasOwnProperty(c)){var ae=s[c];if(ae!=null)switch(c){case"name":h=ae;break;case"type":w=ae;break;case"checked":z=ae;break;case"defaultChecked":Y=ae;break;case"value":p=ae;break;case"defaultValue":k=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,n));break;default:xt(t,n,c,ae,s,null)}}vi(t,p,k,z,Y,w,h,!1);return;case"select":nt("invalid",t),c=w=p=null;for(h in s)if(s.hasOwnProperty(h)&&(k=s[h],k!=null))switch(h){case"value":p=k;break;case"defaultValue":w=k;break;case"multiple":c=k;default:xt(t,n,h,k,s,null)}n=p,s=w,t.multiple=!!c,n!=null?Ir(t,!!c,n,!1):s!=null&&Ir(t,!!c,s,!0);return;case"textarea":nt("invalid",t),p=h=c=null;for(w in s)if(s.hasOwnProperty(w)&&(k=s[w],k!=null))switch(w){case"value":c=k;break;case"defaultValue":h=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:xt(t,n,w,k,s,null)}Ac(t,c,h,p);return;case"option":for(z in s)s.hasOwnProperty(z)&&(c=s[z],c!=null)&&(z==="selected"?t.selected=c&&typeof c!="function"&&typeof c!="symbol":xt(t,n,z,c,s,null));return;case"dialog":nt("beforetoggle",t),nt("toggle",t),nt("cancel",t),nt("close",t);break;case"iframe":case"object":nt("load",t);break;case"video":case"audio":for(c=0;c<pl.length;c++)nt(pl[c],t);break;case"image":nt("error",t),nt("load",t);break;case"details":nt("toggle",t);break;case"embed":case"source":case"link":nt("error",t),nt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in s)if(s.hasOwnProperty(Y)&&(c=s[Y],c!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:xt(t,n,Y,c,s,null)}return;default:if(Do(n)){for(ae in s)s.hasOwnProperty(ae)&&(c=s[ae],c!==void 0&&gg(t,n,ae,c,s,void 0));return}}for(k in s)s.hasOwnProperty(k)&&(c=s[k],c!=null&&xt(t,n,k,c,s,null))}function wx(t,n,s,c){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,k=null,z=null,Y=null,ae=null;for(ee in s){var ue=s[ee];if(s.hasOwnProperty(ee)&&ue!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":z=ue;default:c.hasOwnProperty(ee)||xt(t,n,ee,null,c,ue)}}for(var J in c){var ee=c[J];if(ue=s[J],c.hasOwnProperty(J)&&(ee!=null||ue!=null))switch(J){case"type":p=ee;break;case"name":h=ee;break;case"checked":Y=ee;break;case"defaultChecked":ae=ee;break;case"value":w=ee;break;case"defaultValue":k=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,n));break;default:ee!==ue&&xt(t,n,J,ee,c,ue)}}us(t,w,k,z,Y,ae,p,h);return;case"select":ee=w=k=J=null;for(p in s)if(z=s[p],s.hasOwnProperty(p)&&z!=null)switch(p){case"value":break;case"multiple":ee=z;default:c.hasOwnProperty(p)||xt(t,n,p,null,c,z)}for(h in c)if(p=c[h],z=s[h],c.hasOwnProperty(h)&&(p!=null||z!=null))switch(h){case"value":J=p;break;case"defaultValue":k=p;break;case"multiple":w=p;default:p!==z&&xt(t,n,h,p,c,z)}n=k,s=w,c=ee,J!=null?Ir(t,!!s,J,!1):!!c!=!!s&&(n!=null?Ir(t,!!s,n,!0):Ir(t,!!s,s?[]:"",!1));return;case"textarea":ee=J=null;for(k in s)if(h=s[k],s.hasOwnProperty(k)&&h!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:xt(t,n,k,null,c,h)}for(w in c)if(h=c[w],p=s[w],c.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":J=h;break;case"defaultValue":ee=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(r(91));break;default:h!==p&&xt(t,n,w,h,c,p)}Hr(t,J,ee);return;case"option":for(var De in s)J=s[De],s.hasOwnProperty(De)&&J!=null&&!c.hasOwnProperty(De)&&(De==="selected"?t.selected=!1:xt(t,n,De,null,c,J));for(z in c)J=c[z],ee=s[z],c.hasOwnProperty(z)&&J!==ee&&(J!=null||ee!=null)&&(z==="selected"?t.selected=J&&typeof J!="function"&&typeof J!="symbol":xt(t,n,z,J,c,ee));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 Ge in s)J=s[Ge],s.hasOwnProperty(Ge)&&J!=null&&!c.hasOwnProperty(Ge)&&xt(t,n,Ge,null,c,J);for(Y in c)if(J=c[Y],ee=s[Y],c.hasOwnProperty(Y)&&J!==ee&&(J!=null||ee!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:xt(t,n,Y,J,c,ee)}return;default:if(Do(n)){for(var Tt in s)J=s[Tt],s.hasOwnProperty(Tt)&&J!==void 0&&!c.hasOwnProperty(Tt)&&gg(t,n,Tt,void 0,c,J);for(ae in c)J=c[ae],ee=s[ae],!c.hasOwnProperty(ae)||J===ee||J===void 0&&ee===void 0||gg(t,n,ae,J,c,ee);return}}for(var V in s)J=s[V],s.hasOwnProperty(V)&&J!=null&&!c.hasOwnProperty(V)&&xt(t,n,V,null,c,J);for(ue in c)J=c[ue],ee=s[ue],!c.hasOwnProperty(ue)||J===ee||J==null&&ee==null||xt(t,n,ue,J,c,ee)}function Xv(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Cx(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var h=s[c],p=h.transferSize,w=h.initiatorType,k=h.duration;if(p&&k&&Xv(w)){for(w=0,k=h.responseEnd,c+=1;c<s.length;c++){var z=s[c],Y=z.startTime;if(Y>k)break;var ae=z.transferSize,ue=z.initiatorType;ae&&Xv(ue)&&(z=z.responseEnd,w+=ae*(z<k?1:(k-Y)/(z-Y)))}if(--c,n+=8*(p+w)/(h.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var pg=null,mg=null;function Du(t){return t.nodeType===9?t:t.ownerDocument}function Jv(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Qv(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function yg(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var bg=null;function Ex(){var t=window.event;return t&&t.type==="popstate"?t===bg?!1:(bg=t,!0):(bg=null,!1)}var Zv=typeof setTimeout=="function"?setTimeout:void 0,_x=typeof clearTimeout=="function"?clearTimeout:void 0,eS=typeof Promise=="function"?Promise:void 0,Ax=typeof queueMicrotask=="function"?queueMicrotask:typeof eS<"u"?function(t){return eS.resolve(null).then(t).catch(xx)}:Zv;function xx(t){setTimeout(function(){throw t})}function ai(t){return t==="head"}function tS(t,n){var s=n,c=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(h),qs(n);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")yl(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,yl(s);for(var p=s.firstChild;p;){var w=p.nextSibling,k=p.nodeName;p[yi]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=w}}else s==="body"&&yl(t.ownerDocument.body);s=h}while(s);qs(n)}function nS(t,n){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?n?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(n?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function vg(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var s=n;switch(n=n.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":vg(s),Ro(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function Tx(t,n,s,c){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[yi])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=ca(t.nextSibling),t===null)break}return null}function Rx(t,n,s){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=ca(t.nextSibling),t===null))return null;return t}function aS(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=ca(t.nextSibling),t===null))return null;return t}function Sg(t){return t.data==="$?"||t.data==="$~"}function wg(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function kx(t,n){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||s.readyState!=="loading")n();else{var c=function(){n(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function ca(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Cg=null;function rS(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(n===0)return ca(t.nextSibling);n--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||n++}t=t.nextSibling}return null}function iS(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(n===0)return t;n--}else s!=="/$"&&s!=="/&"||n++}t=t.previousSibling}return null}function sS(t,n,s){switch(n=Du(s),t){case"html":if(t=n.documentElement,!t)throw Error(r(452));return t;case"head":if(t=n.head,!t)throw Error(r(453));return t;case"body":if(t=n.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function yl(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Ro(t)}var ua=new Map,oS=new Set;function Ou(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Sr=fe.d;fe.d={f:Dx,r:Ox,D:Lx,C:Mx,L:$x,m:Nx,X:Hx,S:Ix,M:zx};function Dx(){var t=Sr.f(),n=Cu();return t||n}function Ox(t){var n=Pa(t);n!==null&&n.tag===5&&n.type==="form"?_b(n):Sr.r(t)}var Us=typeof document>"u"?null:document;function lS(t,n,s){var c=Us;if(c&&typeof n=="string"&&n){var h=$n(n);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),oS.has(h)||(oS.add(h),t={rel:t,crossOrigin:s,href:n},c.querySelector(h)===null&&(n=c.createElement("link"),pn(n,"link",t),Wt(n),c.head.appendChild(n)))}}function Lx(t){Sr.D(t),lS("dns-prefetch",t,null)}function Mx(t,n){Sr.C(t,n),lS("preconnect",t,n)}function $x(t,n,s){Sr.L(t,n,s);var c=Us;if(c&&t&&n){var h='link[rel="preload"][as="'+$n(n)+'"]';n==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+$n(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+$n(s.imageSizes)+'"]')):h+='[href="'+$n(t)+'"]';var p=h;switch(n){case"style":p=Bs(t);break;case"script":p=Ps(t)}ua.has(p)||(t=b({rel:"preload",href:n==="image"&&s&&s.imageSrcSet?void 0:t,as:n},s),ua.set(p,t),c.querySelector(h)!==null||n==="style"&&c.querySelector(bl(p))||n==="script"&&c.querySelector(vl(p))||(n=c.createElement("link"),pn(n,"link",t),Wt(n),c.head.appendChild(n)))}}function Nx(t,n){Sr.m(t,n);var s=Us;if(s&&t){var c=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+$n(c)+'"][href="'+$n(t)+'"]',p=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ps(t)}if(!ua.has(p)&&(t=b({rel:"modulepreload",href:t},n),ua.set(p,t),s.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(vl(p)))return}c=s.createElement("link"),pn(c,"link",t),Wt(c),s.head.appendChild(c)}}}function Ix(t,n,s){Sr.S(t,n,s);var c=Us;if(c&&t){var h=Mr(c).hoistableStyles,p=Bs(t);n=n||"default";var w=h.get(p);if(!w){var k={loading:0,preload:null};if(w=c.querySelector(bl(p)))k.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":n},s),(s=ua.get(p))&&Eg(t,s);var z=w=c.createElement("link");Wt(z),pn(z,"link",t),z._p=new Promise(function(Y,ae){z.onload=Y,z.onerror=ae}),z.addEventListener("load",function(){k.loading|=1}),z.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Lu(w,n,c)}w={type:"stylesheet",instance:w,count:1,state:k},h.set(p,w)}}}function Hx(t,n){Sr.X(t,n);var s=Us;if(s&&t){var c=Mr(s).hoistableScripts,h=Ps(t),p=c.get(h);p||(p=s.querySelector(vl(h)),p||(t=b({src:t,async:!0},n),(n=ua.get(h))&&_g(t,n),p=s.createElement("script"),Wt(p),pn(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function zx(t,n){Sr.M(t,n);var s=Us;if(s&&t){var c=Mr(s).hoistableScripts,h=Ps(t),p=c.get(h);p||(p=s.querySelector(vl(h)),p||(t=b({src:t,async:!0,type:"module"},n),(n=ua.get(h))&&_g(t,n),p=s.createElement("script"),Wt(p),pn(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function cS(t,n,s,c){var h=(h=me.current)?Ou(h):null;if(!h)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(n=Bs(s.href),s=Mr(h).hoistableStyles,c=s.get(n),c||(c={type:"style",instance:null,count:0,state:null},s.set(n,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Bs(s.href);var p=Mr(h).hoistableStyles,w=p.get(t);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,w),(p=h.querySelector(bl(t)))&&!p._p&&(w.instance=p,w.state.loading=5),ua.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ua.set(t,s),p||jx(h,t,s,w.state))),n&&c===null)throw Error(r(528,""));return w}if(n&&c!==null)throw Error(r(529,""));return null;case"script":return n=s.async,s=s.src,typeof s=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ps(s),s=Mr(h).hoistableScripts,c=s.get(n),c||(c={type:"script",instance:null,count:0,state:null},s.set(n,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Bs(t){return'href="'+$n(t)+'"'}function bl(t){return'link[rel="stylesheet"]['+t+"]"}function uS(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function jx(t,n,s,c){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?c.loading=1:(n=t.createElement("link"),c.preload=n,n.addEventListener("load",function(){return c.loading|=1}),n.addEventListener("error",function(){return c.loading|=2}),pn(n,"link",s),Wt(n),t.head.appendChild(n))}function Ps(t){return'[src="'+$n(t)+'"]'}function vl(t){return"script[async]"+t}function dS(t,n,s){if(n.count++,n.instance===null)switch(n.type){case"style":var c=t.querySelector('style[data-href~="'+$n(s.href)+'"]');if(c)return n.instance=c,Wt(c),c;var h=b({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Wt(c),pn(c,"style",h),Lu(c,s.precedence,t),n.instance=c;case"stylesheet":h=Bs(s.href);var p=t.querySelector(bl(h));if(p)return n.state.loading|=4,n.instance=p,Wt(p),p;c=uS(s),(h=ua.get(h))&&Eg(c,h),p=(t.ownerDocument||t).createElement("link"),Wt(p);var w=p;return w._p=new Promise(function(k,z){w.onload=k,w.onerror=z}),pn(p,"link",c),n.state.loading|=4,Lu(p,s.precedence,t),n.instance=p;case"script":return p=Ps(s.src),(h=t.querySelector(vl(p)))?(n.instance=h,Wt(h),h):(c=s,(h=ua.get(p))&&(c=b({},s),_g(c,h)),t=t.ownerDocument||t,h=t.createElement("script"),Wt(h),pn(h,"link",c),t.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(c=n.instance,n.state.loading|=4,Lu(c,s.precedence,t));return n.instance}function Lu(t,n,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,p=h,w=0;w<c.length;w++){var k=c[w];if(k.dataset.precedence===n)p=k;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(n=s.nodeType===9?s.head:s,n.insertBefore(t,n.firstChild))}function Eg(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function _g(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Mu=null;function fS(t,n,s){if(Mu===null){var c=new Map,h=Mu=new Map;h.set(s,c)}else h=Mu,c=h.get(s),c||(c=new Map,h.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[yi]||p[an]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=t+w;var k=c.get(w);k?k.push(p):c.set(w,[p])}}return c}function hS(t,n,s){t=t.ownerDocument||t,t.head.insertBefore(s,n==="title"?t.querySelector("head > title"):null)}function Ux(t,n,s){if(s===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function gS(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Bx(t,n,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Bs(c.href),p=n.querySelector(bl(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=$u.bind(t),n.then(t,t)),s.state.loading|=4,s.instance=p,Wt(p);return}p=n.ownerDocument||n,c=uS(c),(h=ua.get(h))&&Eg(c,h),p=p.createElement("link"),Wt(p);var w=p;w._p=new Promise(function(k,z){w.onload=k,w.onerror=z}),pn(p,"link",c),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,n),(n=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=$u.bind(t),n.addEventListener("load",s),n.addEventListener("error",s))}}var Ag=0;function Px(t,n){return t.stylesheets&&t.count===0&&Iu(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&Iu(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+n);0<t.imgBytes&&Ag===0&&(Ag=62500*Cx());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Iu(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>Ag?50:800)+n);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function $u(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Iu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Nu=null;function Iu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Nu=new Map,n.forEach(qx,t),Nu=null,$u.call(t))}function qx(t,n){if(!(n.state.loading&4)){var s=Nu.get(t);if(s)var c=s.get(null);else{s=new Map,Nu.set(t,s);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(s.set(w.dataset.precedence,w),c=w)}c&&s.set(null,c)}h=n.instance,w=h.getAttribute("data-precedence"),p=s.get(w)||c,p===c&&s.set(null,h),s.set(w,h),this.count++,c=$u.bind(this),h.addEventListener("load",c),h.addEventListener("error",c),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),n.state.loading|=4}}var Sl={$$typeof:R,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function Gx(t,n,s,c,h,p,w,k,z){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=We(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=We(0),this.hiddenUpdates=We(null),this.identifierPrefix=c,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function pS(t,n,s,c,h,p,w,k,z,Y,ae,ue){return t=new Gx(t,n,s,w,z,Y,ae,ue,k),n=1,p===!0&&(n|=24),p=Vn(3,null,null,n),t.current=p,p.stateNode=t,n=rh(),n.refCount++,t.pooledCache=n,n.refCount++,p.memoizedState={element:c,isDehydrated:s,cache:n},lh(p),t}function mS(t){return t?(t=vs,t):vs}function yS(t,n,s,c,h,p){h=mS(h),c.context===null?c.context=h:c.pendingContext=h,c=Fr(n),c.payload={element:s},p=p===void 0?null:p,p!==null&&(c.callback=p),s=Kr(t,c,n),s!==null&&(jn(s,t,n),Qo(s,t,n))}function bS(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function xg(t,n){bS(t,n),(t=t.alternate)&&bS(t,n)}function vS(t){if(t.tag===13||t.tag===31){var n=Oi(t,67108864);n!==null&&jn(n,t,67108864),xg(t,67108864)}}function SS(t){if(t.tag===13||t.tag===31){var n=Xn();n=Dt(n);var s=Oi(t,n);s!==null&&jn(s,t,n),xg(t,n)}}var Hu=!0;function Vx(t,n,s,c){var h=Q.T;Q.T=null;var p=fe.p;try{fe.p=2,Tg(t,n,s,c)}finally{fe.p=p,Q.T=h}}function Fx(t,n,s,c){var h=Q.T;Q.T=null;var p=fe.p;try{fe.p=8,Tg(t,n,s,c)}finally{fe.p=p,Q.T=h}}function Tg(t,n,s,c){if(Hu){var h=Rg(c);if(h===null)hg(t,n,c,zu,s),CS(t,c);else if(Wx(h,t,n,s,c))c.stopPropagation();else if(CS(t,c),n&4&&-1<Kx.indexOf(t)){for(;h!==null;){var p=Pa(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=xe(p.pendingLanes);if(w!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;w;){var z=1<<31-q(w);k.entanglements[1]|=z,w&=~z}Ka(p),(vt&6)===0&&(Su=Ft()+500,gl(0))}}break;case 31:case 13:k=Oi(p,2),k!==null&&jn(k,p,2),Cu(),xg(p,2)}if(p=Rg(c),p===null&&hg(t,n,c,zu,s),p===h)break;h=p}h!==null&&c.stopPropagation()}else hg(t,n,c,null,s)}}function Rg(t){return t=Mo(t),kg(t)}var zu=null;function kg(t){if(zu=null,t=Lr(t),t!==null){var n=l(t);if(n===null)t=null;else{var s=n.tag;if(s===13){if(t=u(n),t!==null)return t;t=null}else if(s===31){if(t=d(n),t!==null)return t;t=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return zu=t,null}function wS(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Dr()){case er:return 2;case bn:return 8;case en:case et:return 32;case ta:return 268435456;default:return 32}default:return 32}}var Dg=!1,ri=null,ii=null,si=null,wl=new Map,Cl=new Map,oi=[],Kx="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 CS(t,n){switch(t){case"focusin":case"focusout":ri=null;break;case"dragenter":case"dragleave":ii=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":wl.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cl.delete(n.pointerId)}}function El(t,n,s,c,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:n,domEventName:s,eventSystemFlags:c,nativeEvent:p,targetContainers:[h]},n!==null&&(n=Pa(n),n!==null&&vS(n)),t):(t.eventSystemFlags|=c,n=t.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),t)}function Wx(t,n,s,c,h){switch(n){case"focusin":return ri=El(ri,t,n,s,c,h),!0;case"dragenter":return ii=El(ii,t,n,s,c,h),!0;case"mouseover":return si=El(si,t,n,s,c,h),!0;case"pointerover":var p=h.pointerId;return wl.set(p,El(wl.get(p)||null,t,n,s,c,h)),!0;case"gotpointercapture":return p=h.pointerId,Cl.set(p,El(Cl.get(p)||null,t,n,s,c,h)),!0}return!1}function ES(t){var n=Lr(t.target);if(n!==null){var s=l(n);if(s!==null){if(n=s.tag,n===13){if(n=u(s),n!==null){t.blockedOn=n,qn(t.priority,function(){SS(s)});return}}else if(n===31){if(n=d(s),n!==null){t.blockedOn=n,qn(t.priority,function(){SS(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ju(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var s=Rg(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);Lo=c,s.target.dispatchEvent(c),Lo=null}else return n=Pa(s),n!==null&&vS(n),t.blockedOn=s,!1;n.shift()}return!0}function _S(t,n,s){ju(t)&&s.delete(n)}function Yx(){Dg=!1,ri!==null&&ju(ri)&&(ri=null),ii!==null&&ju(ii)&&(ii=null),si!==null&&ju(si)&&(si=null),wl.forEach(_S),Cl.forEach(_S)}function Uu(t,n){t.blockedOn===n&&(t.blockedOn=null,Dg||(Dg=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,Yx)))}var Bu=null;function AS(t){Bu!==t&&(Bu=t,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){Bu===t&&(Bu=null);for(var n=0;n<t.length;n+=3){var s=t[n],c=t[n+1],h=t[n+2];if(typeof c!="function"){if(kg(c||s)===null)continue;break}var p=Pa(s);p!==null&&(t.splice(n,3),n-=3,Rh(p,{pending:!0,data:h,method:s.method,action:c},c,h))}}))}function qs(t){function n(z){return Uu(z,t)}ri!==null&&Uu(ri,t),ii!==null&&Uu(ii,t),si!==null&&Uu(si,t),wl.forEach(n),Cl.forEach(n);for(var s=0;s<oi.length;s++){var c=oi[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<oi.length&&(s=oi[0],s.blockedOn===null);)ES(s),s.blockedOn===null&&oi.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var h=s[c],p=s[c+1],w=h[vn]||null;if(typeof p=="function")w||AS(s);else if(w){var k=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[vn]||null)k=w.formAction;else if(kg(h)!==null)continue}else k=w.action;typeof k=="function"?s[c+1]=k:(s.splice(c,3),c-=3),AS(s)}}}function xS(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Og(t){this._internalRoot=t}Pu.prototype.render=Og.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(r(409));var s=n.current,c=Xn();yS(s,c,t,n,null,null)},Pu.prototype.unmount=Og.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;yS(t.current,2,null,t,null,null),Cu(),n[Or]=null}};function Pu(t){this._internalRoot=t}Pu.prototype.unstable_scheduleHydration=function(t){if(t){var n=Kt();t={blockedOn:null,target:t,priority:n};for(var s=0;s<oi.length&&n!==0&&n<oi[s].priority;s++);oi.splice(s,0,t),s===0&&ES(t)}};var TS=e.version;if(TS!=="19.2.6")throw Error(r(527,TS,"19.2.6"));fe.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=g(n),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var Xx={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:Q,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qu.isDisabled&&qu.supportsFiber)try{Ea=qu.inject(Xx),tn=qu}catch{}}return Gs.createRoot=function(t,n){if(!i(t))throw Error(r(299));var s=!1,c="",h=$b,p=Nb,w=Ib;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=pS(t,1,!1,null,null,s,c,null,h,p,w,xS),t[Or]=n.current,fg(t),new Og(n)},Gs.hydrateRoot=function(t,n,s){if(!i(t))throw Error(r(299));var c=!1,h="",p=$b,w=Nb,k=Ib,z=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(w=s.onCaughtError),s.onRecoverableError!==void 0&&(k=s.onRecoverableError),s.formState!==void 0&&(z=s.formState)),n=pS(t,1,!0,n,s??null,c,h,z,p,w,k,xS),n.context=mS(null),s=n.current,c=Xn(),c=Dt(c),h=Fr(c),h.callback=null,Kr(s,h,c),s=c,n.current.lanes=s,Fe(n,s),Ka(n),t[Or]=n.current,fg(t),new Pu(n)},Gs.version="19.2.6",Gs}var Ug;function IS(){if(Ug)return Fu.exports;Ug=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),Fu.exports=NS(),Fu.exports}var Xu=IS();const Ju=Ya(Xu),Vs=[],HS=50;let Qu=!1;function Bg(){try{return window.G7Core?.devTools}catch{return}}function Gi(o,e,a){const r=Bg();if(Qu&&r?.isEnabled?.()){r.trackLog?.(o,e,a);return}Qu||(o==="error"||o==="warn")&&Vs.length<HS&&Vs.push({level:o,prefix:e,args:a,timestamp:Date.now()})}function Zu(){Qu=!0;const o=Bg();if(!o?.isEnabled?.()){Vs.length=0;return}for(const e of Vs)o.trackLog?.(e.level,e.prefix,e.args);Vs.length=0}const gi=class gi{constructor(){$(this,"debug");$(this,"prefix","[TemplateEngine]");this.debug=!1}static getInstance(){return gi.instance||(gi.instance=new gi),gi.instance}setDebug(e){this.debug=e}isDebugEnabled(){return this.debug}log(...e){this.debug&&console.log(this.prefix,...e),Gi("log","TemplateEngine",e)}error(...e){this.debug&&console.error(this.prefix,...e),Gi("error","TemplateEngine",e)}warn(...e){this.debug&&console.warn(this.prefix,...e),Gi("warn","TemplateEngine",e)}};$(gi,"instance");let Fs=gi;function ct(o){const e=`[${o}]`,a=Fs.getInstance();return{log:(...r)=>{a.isDebugEnabled()&&console.log(e,...r),Gi("log",o,r)},warn:(...r)=>{a.isDebugEnabled()&&console.warn(e,...r),Gi("warn",o,r)},error:(...r)=>{a.isDebugEnabled()&&console.error(e,...r),Gi("error",o,r)}}}Fs.getInstance();const Vi=ct("networkResilience"),Pg=2,qg=300,Gg=2e3,zS=15e3;function Vg(o){return o?.name==="AbortError"}function jS(o){return Vg(o)?!1:o instanceof TypeError}let _l=!1,Fg=!1;function ed(){return _l}function US(){typeof window>"u"||Fg||(Fg=!0,window.addEventListener("pagehide",()=>{_l=!0}),window.addEventListener("pageshow",o=>{o.persisted&&(_l=!1)}),window.addEventListener("beforeunload",()=>{_l=!0}))}function Kg(o,e,a){const r=Math.min(e*Math.pow(2,o),a),i=r*.25*(Math.random()*2-1);return Math.max(0,Math.round(r+i))}function Wg(o){return new Promise(e=>setTimeout(e,o))}async function Al(o,e={}){const{retries:a=Pg,baseDelayMs:r=qg,maxDelayMs:i=Gg,timeoutMs:l=zS,label:u=o,init:d}=e,f=a+1;let g;for(let m=0;m<f;m++){let b=!1,v;const S=l>0?new AbortController:null;try{const E={...d};if(S){const T=d?.signal;T&&(T.aborted?S.abort():T.addEventListener("abort",()=>S.abort(),{once:!0})),E.signal=S.signal,v=setTimeout(()=>{b=!0,S.abort()},l)}return await fetch(o,E)}catch(E){if(g=E,Vg(E)&&!b||!(b||jS(E)))throw E;if(ed())throw Vi.warn(`Document unloading, aborting retries: ${u}`),E;if(m===f-1)throw Vi.warn(`All ${f} attempts failed: ${u}`,E),E;const L=Kg(m,r,i);Vi.warn(`Network failure (attempt ${m+1}/${f}), retrying in ${L}ms: ${u}`),await Wg(L)}finally{v!==void 0&&clearTimeout(v)}}throw g}async function Yg(o,e={},a={}){const{retries:r=Pg,baseDelayMs:i=qg,maxDelayMs:l=Gg,label:u=o}=a,d=r+1;for(let f=0;f<d;f++)try{await BS(o,e);return}catch(g){if(e.id&&document.getElementById(e.id)?.remove(),ed())throw Vi.warn(`Document unloading, aborting script retries: ${u}`),g;if(f===d-1)throw Vi.warn(`All ${d} script attempts failed: ${u}`),g;const b=Kg(f,i,l);Vi.warn(`Script load failed (attempt ${f+1}/${d}), retrying in ${b}ms: ${u}`),await Wg(b)}}function BS(o,e){return new Promise((a,r)=>{const i=document.createElement("script");i.src=o,i.async=!1;for(const[l,u]of Object.entries(e))l==="id"?i.id=u:i.setAttribute(l,u);i.onload=()=>a(),i.onerror=()=>r(new Error(`Failed to load script: ${o}`)),document.head.appendChild(i)})}const Xg="extension",Fi="extensionless",PS="file";function qS(){const o=globalThis?.G7Config;if(globalThis?.__g7AssetUrlMode===Fi)return Fi;const a=o?.assetUrlMode;return a===Fi||a===Xg?a:o?.settings?.general?.asset_url_mode===Fi?Fi:Xg}function Jg(){return qS()===Fi}function La(o,e,a,r){const i=o.replace(/\/+$/,""),l=e.replace(/^\.+/,""),u=Jg()?i:`${i}.${l}`,d=[];return r&&d.push(r.replace(/^[?&]+/,"")),a!=null&&a!==""&&d.push(`v=${a}`),d.length>0?`${u}?${d.join("&")}`:u}function wr(o){if(!o||!Jg())return o;const e=globalThis?.location?.origin,a=e&&o.startsWith(e)?o.slice(e.length):o;if(!a.startsWith("/api/"))return o;const[r,i]=GS(a),l=r.match(/^\/api\/(modules|plugins)\/bundle\.(js|css)$/);if(l)return Qg(`/api/${l[1]}/bundle/${l[2]}`,i);const u=r.match(/^\/api\/(templates|modules|plugins)\/assets\/([^/]+)\/(.+)$/);if(u){const[,f,g,m]=u,b=`${PS}=${encodeURIComponent(decodeURIComponent(m))}`;return`/api/${f}/assets/${g}?${b}${i?`&${i}`:""}`}const d=r.match(/^(\/api\/.+)\.(json|js|css)$/);return d?Qg(d[1],i):o}function GS(o){const e=o.indexOf("?");return e===-1?[o,""]:[o.slice(0,e),o.slice(e+1)]}function Qg(o,e){return e?`${o}?${e}`:o}const Ma=ct("ComponentRegistry");class on extends Error{constructor(a,r,i){super(a);$(this,"code");$(this,"details");this.code=r,this.details=i,this.name="ComponentRegistryError"}}const Pn=class Pn{constructor(){$(this,"registry",{});$(this,"manifest",null);$(this,"loadingState","idle");$(this,"error",null);$(this,"templateId",null);$(this,"templateType",null)}static getInstance(){return Pn.instance||(Pn.instance=new Pn),Pn.instance}static createIsolatedInstance(){return new Pn}static resetInstance(){Pn.instance=null}async loadComponents(e,a){if(this.loadingState==="loading")throw new on("Components are already being loaded","LOADING_IN_PROGRESS");if(this.loadingState==="loaded"&&this.templateId===e&&this.templateType===a){Ma.log("Components already loaded for template:",e,a);return}this.loadingState="loading",this.templateId=e,this.templateType=a,this.error=null;try{await this.loadManifest(),await this.loadComponentBundle(),this.loadingState="loaded",Ma.log("Successfully loaded components:",Object.keys(this.registry).length)}catch(r){throw this.loadingState="error",this.error=r instanceof Error?r:new Error(String(r)),new on(`Failed to load components: ${this.error.message}`,"LOAD_FAILED",{originalError:this.error})}}async loadManifest(){try{if(!this.templateId)throw new on("Template ID not set","TEMPLATE_ID_NOT_SET");const e=`${this.templateId}:${this.templateType}`;if(Pn.manifestCache.has(e)){this.manifest=Pn.manifestCache.get(e),Ma.log("Manifest loaded from cache:",this.manifest.templateId);return}const a=La(`/api/templates/${this.templateId}/components`,"json"),r=await Al(a,{label:"components.json"});if(!r.ok)throw new on(`Failed to fetch manifest: ${r.status} ${r.statusText}`,"MANIFEST_FETCH_FAILED",{status:r.status,statusText:r.statusText});const i=await r.json();this.validateManifest(i),this.manifest=i,Pn.manifestCache.set(e,i),Ma.log("Manifest loaded and cached:",i.templateId)}catch(e){throw e instanceof on?e:new on("Failed to load component manifest","MANIFEST_LOAD_FAILED",{originalError:e})}}validateManifest(e){if(!e.version)throw new on("Manifest missing required field: version","MANIFEST_INVALID",{field:"version"});if(!e.templateId)throw new on("Manifest missing required field: templateId","MANIFEST_INVALID",{field:"templateId"});if(!e.components||typeof e.components!="object")throw new on("Manifest missing required field: components","MANIFEST_INVALID",{field:"components"});const a=["basic","composite","layout"];for(const r of a){if(!Array.isArray(e.components[r]))throw new on(`Manifest field 'components.${r}' must be an array`,"MANIFEST_INVALID",{field:`components.${r}`,value:e.components[r]});e.components[r].forEach((i,l)=>{if(!i.name||typeof i.name!="string")throw new on(`Invalid component metadata at ${r}[${l}]: missing or invalid 'name'`,"MANIFEST_INVALID",{type:r,index:l,metadata:i});if(!i.type||typeof i.type!="string")throw new on(`Invalid component metadata at ${r}[${l}]: missing or invalid 'type'`,"MANIFEST_INVALID",{type:r,index:l,metadata:i})})}Ma.log("Manifest validation passed")}async loadComponentBundle(){try{if(!this.templateId)throw new on("Template ID not set","TEMPLATE_ID_NOT_SET");const e=this.getGlobalVariableName(),a=window[e];if(!a||typeof a!="object")throw new on(`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(a),Ma.log("Component bundle loaded from global variable:",e)}catch(e){throw e instanceof on?e:new on("Failed to load component bundle","BUNDLE_LOAD_FAILED",{originalError:e})}}getGlobalVariableName(){if(!this.templateId)throw new on("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 on("Manifest not loaded","MANIFEST_NOT_LOADED");const a=["basic","composite","layout"];for(const r of a){const i=this.manifest.components[r]||[];for(const l of i){const u=l.name,d=e[u];if(!d){Ma.warn(`Component '${u}' not found in bundle`);continue}this.registerComponent(u,d,l)}}}registerComponent(e,a,r){this.registry[e]&&Ma.warn(`Component '${e}' already registered, overwriting`);const i=Ye.memo(a);this.registry[e]={component:i,metadata:r},Ma.log(`[ComponentRegistry] Registered component: ${e} (${r.type})`)}getComponent(e){const a=this.registry[e];return a?a.component:null}getMetadata(e){const a=this.registry[e];return a?a.metadata:null}hasComponent(e){return e in this.registry}getComponentsByType(e){return Object.entries(this.registry).filter(([a,r])=>r.metadata.type===e).map(([a,r])=>a)}getAllComponents(){return Object.keys(this.registry)}getComponentMap(){const e={};for(const[a,r]of Object.entries(this.registry))e[a]=r.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,Ma.log("Registry cleared")}};$(Pn,"instance",null),$(Pn,"manifestCache",new Map);let da=Pn;const Zg=ct("TranslationEngine");class td extends Error{constructor(a,r,i){super(a);$(this,"key");$(this,"locale");this.key=r,this.locale=i,this.name="TranslationError"}}const Rn=class Rn{constructor(e={}){$(this,"cache",new Map);$(this,"translations",new Map);$(this,"options");$(this,"cacheVersion",0);this.options={defaultLocale:e.defaultLocale||"ko",fallbackLocale:e.fallbackLocale||"en",cacheTTL:e.cacheTTL||3e5}}static getInstance(e={}){return Rn.instance||(Rn.instance=new Rn(e)),Rn.instance}static resetInstance(){Rn.instance=null}setCacheVersion(e){this.cacheVersion!==e&&(Zg.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.cache.clear())}getCacheVersion(){return this.cacheVersion}async loadTranslations(e,a,r="/api",i=!1){const l=`${e}:${a}`;if(!i){const u=this.getFromCache(l);if(u)return this.translations.set(l,u),u}try{const u=[];i&&u.push(`_=${Date.now()}`);const d=La(`${r}/templates/${e}/lang/${a}`,"json",this.cacheVersion>0?this.cacheVersion:null,u.length>0?u.join("&"):void 0),f=await fetch(d);if(!f.ok)throw new td(`Failed to load translations: ${f.statusText}`,void 0,a);const m=await f.json();return this.saveToCache(l,m),this.translations.set(l,m),m}catch(u){throw new td(`Failed to fetch translations for ${a}: ${u instanceof Error?u.message:String(u)}`,void 0,a)}}resolveTranslations(e,a,r){let i=e;const l=5;let u=0;for(;u<l&&i.includes("=$t:");){const d=i;if(i=i.replace(Rn.NESTED_TRANSLATION_PARAM_PATTERN,(f,g,m)=>"="+this.translate(m,a,void 0,r)),i===d)break;u++}return i.replace(Rn.TRANSLATION_PATTERN,(d,f,g)=>{const{cleanedParams:m,trailing:b}=this.separateTrailingText(g);return this.translate(f,a,m,r)+b})}translate(e,a,r,i){const l=this.getTranslation(e,a),u=r&&this.cleanParamsStr(r);if(u){const d=this.parseParams(u,i);return this.replaceParams(l,d)}return l}getTranslation(e,a){const{templateId:r,locale:i}=a,l=`${r}:${i}`,u=this.translations.get(l);if(u){const d=this.getNestedValue(u,e);if(d!==null)return d}if(i!==this.options.fallbackLocale){const d=`${r}:${this.options.fallbackLocale}`,f=this.translations.get(d);if(f){const g=this.getNestedValue(f,e);if(g!==null)return g}}return e}getNestedValue(e,a){const r=a.split(".");let i=e;for(const l of r){if(i==null||typeof i!="object")return null;i=i[l]}return typeof i=="string"?i:null}setTranslationValue(e,a,r,i){const l=`${e}:${a}`,u=this.translations.get(l)??{},d=r.split(".");let f=u;for(let g=0;g<d.length-1;g+=1){const m=d[g],b=f[m];(b==null||typeof b!="object"||Array.isArray(b))&&(f[m]={}),f=f[m]}f[d[d.length-1]]=i,this.translations.set(l,u)}parseParams(e,a){const r={},i=e.startsWith("|")?e.slice(1):e,l=[],d=i.replace(/\{\{(?:[^}]|\}(?!\}))*\}\}/g,f=>(l.push(f),`__PLACEHOLDER_${l.length-1}__`)).matchAll(Rn.PARAM_PATTERN);for(const f of d){const[,g,m]=f,b=m.replace(/__PLACEHOLDER_(\d+)__/g,(v,S)=>l[parseInt(S,10)]);r[g.trim()]=this.resolveParamValue(b.trim(),a)}return r}resolveParamValue(e,a){if(e.startsWith("{{")&&e.endsWith("}}")){const r=e.slice(2,-2).trim();if(/[|&()[\]!?:+\-*/%<>=\s]/.test(r)&&a)try{const u=new Function(...Object.keys(a),`return ${r}`)(...Object.values(a));return String(u??"")}catch(l){return Zg.error("Expression evaluation failed:",r,l),""}else{const l=this.getNestedDataValue(a,r);return String(l??"")}}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 r=e.match(/(\s+[^\p{L}\w=|&\s][^\p{L}\w=]*\s*)$/u);return r?{cleanedParams:e.slice(0,-r[1].length),trailing:r[1]}:{cleanedParams:e,trailing:""}}cleanParamsStr(e){return this.separateTrailingText(e).cleanedParams||""}getNestedDataValue(e,a){if(!e)return;const r=a.split(".");let i=e;for(const l of r){if(i==null)return;i=i[l]}return i}replaceParams(e,a){let r=e;for(const[i,l]of Object.entries(a)){const u=new RegExp(`\\{\\{${i}\\}\\}`,"g");r=r.replace(u,String(l));const d=new RegExp(`\\{${i}\\}`,"g");r=r.replace(d,String(l))}return r}getFromCache(e){const a=this.cache.get(e);return a?Date.now()-a.timestamp>this.options.cacheTTL?(this.cache.delete(e),null):a.data:null}saveToCache(e,a){this.cache.set(e,{data:a,timestamp:Date.now()})}clearCache(){this.cache.clear(),this.translations.clear()}pruneCache(){const e=Date.now(),a=[];for(const[r,i]of this.cache.entries())e-i.timestamp>this.options.cacheTTL&&a.push(r);for(const r of a)this.cache.delete(r)}getCacheStats(){const e=Date.now();let a=0;for(const r of this.cache.values())e-r.timestamp>this.options.cacheTTL&&a++;return{size:this.cache.size,expired:a}}};$(Rn,"instance",null),$(Rn,"TRANSLATION_PATTERN",/\$t:(?:defer:)?([a-zA-Z0-9._-]+)(\|(?:(?!\$t:).)+)?/g),$(Rn,"NESTED_TRANSLATION_PARAM_PATTERN",/=(\$t:([a-zA-Z0-9._-]+))(?=[|&\s]|$)/g),$(Rn,"PARAM_PATTERN",/([^=|&]+)=([^|&]+)/g);let Cr=Rn,nd=null;function VS(o){return nd||(nd=new Cr(o)),nd}const ep=Object.freeze(Object.defineProperty({__proto__:null,TranslationEngine:Cr,TranslationError:td,getTranslationEngine:VS},Symbol.toStringTag,{value:"Module"})),Ki=ct("PipeRegistry");function tp(o,e){const a=o.getFullYear(),r=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0"),l=String(o.getHours()).padStart(2,"0"),u=String(o.getMinutes()).padStart(2,"0"),d=String(o.getSeconds()).padStart(2,"0");return e.replace("YYYY",String(a)).replace("YY",String(a).slice(-2)).replace("MM",r).replace("M",String(o.getMonth()+1)).replace("DD",i).replace("D",String(o.getDate())).replace("HH",l).replace("H",String(o.getHours())).replace("mm",u).replace("m",String(o.getMinutes())).replace("ss",d).replace("s",String(o.getSeconds()))}function FS(o,e="ko"){const r=new Date().getTime()-o.getTime(),i=Math.floor(r/1e3),l=Math.floor(i/60),u=Math.floor(l/60),d=Math.floor(u/24),f=Math.floor(d/7),g=Math.floor(d/30),m=Math.floor(d/365);return e==="ko"?i<60?"방금 전":l<60?`${l}분 전`:u<24?`${u}시간 전`:d<7?`${d}일 전`:f<4?`${f}주 전`:g<12?`${g}개월 전`:`${m}년 전`:i<60?"just now":l<60?`${l} minute${l===1?"":"s"} ago`:u<24?`${u} hour${u===1?"":"s"} ago`:d<7?`${d} day${d===1?"":"s"} ago`:f<4?`${f} week${f===1?"":"s"} ago`:g<12?`${g} month${g===1?"":"s"} ago`:`${m} year${m===1?"":"s"} ago`}function ad(o){if(o==null)return null;if(o instanceof Date)return o;if(typeof o=="number")return new Date(o);if(typeof o=="string"){const e=new Date(o);return isNaN(e.getTime())?null:e}return null}const Ks={date:{fn:(o,e="YYYY-MM-DD")=>{const a=ad(o);return a?tp(a,e):""},description:"날짜 포맷 (기본: YYYY-MM-DD)"},datetime:{fn:(o,e="YYYY-MM-DD HH:mm")=>{const a=ad(o);return a?tp(a,e):""},description:"날짜+시간 포맷 (기본: YYYY-MM-DD HH:mm)"},relativeTime:{fn:(o,e="ko")=>{const a=ad(o);return a?FS(a,e):""},description:'상대 시간 표시 (예: "3분 전")'},number:{fn:(o,e)=>{const a=Number(o);if(isNaN(a))return String(o??"");const r={};return e!==void 0&&(r.minimumFractionDigits=e,r.maximumFractionDigits=e),a.toLocaleString(void 0,r)},description:"숫자 포맷 (천단위 구분, 선택적 소수점)"},truncate:{fn:(o,e=100,a="...")=>typeof o!="string"?String(o??""):o.length<=e?o:o.slice(0,e)+a,description:'문자열 자르기 (기본: 100자, 접미사: "...")'},uppercase:{fn:o=>typeof o!="string"?String(o??""):o.toUpperCase(),description:"대문자 변환"},lowercase:{fn:o=>typeof o!="string"?String(o??""):o.toLowerCase(),description:"소문자 변환"},stripHtml:{fn:o=>typeof o!="string"?String(o??""):o.replace(/<[^>]*>/g,""),description:"HTML 태그 제거"},default:{fn:(o,e="")=>o==null||o===""?e:o,description:"기본값 설정 (null, undefined, 빈문자열 시)"},fallback:{fn:(o,e)=>o??e,description:"폴백 값 설정 (null, undefined 시만)"},first:{fn:o=>{if(Array.isArray(o))return o[0]},description:"배열의 첫 번째 요소"},last:{fn:o=>{if(Array.isArray(o))return o[o.length-1]},description:"배열의 마지막 요소"},join:{fn:(o,e=", ")=>Array.isArray(o)?o.join(e):"",description:'배열을 문자열로 결합 (기본 구분자: ", ")'},length:{fn:o=>Array.isArray(o)||typeof o=="string"?o.length:0,description:"배열/문자열 길이"},filterBy:{fn:(o,e,a)=>Array.isArray(o)?Array.isArray(e)?o.filter(r=>{const i=a?r?.[a]:r;return e.includes(i)}):o:[],description:"배열 필터링 (allowList에 포함된 항목만 반환)"},keys:{fn:o=>o==null||typeof o!="object"?[]:Object.keys(o),description:"객체의 키 배열"},values:{fn:o=>o==null||typeof o!="object"?[]:Object.values(o),description:"객체의 값 배열"},json:{fn:(o,e)=>{try{return JSON.stringify(o,null,e)}catch{return""}},description:"JSON 문자열로 변환"},localized:{fn:(o,e)=>o==null?"":typeof o=="string"?o:typeof o!="object"?String(o):o[e||"ko"]||o.ko||o.en||Object.values(o)[0]||"",description:"다국어 객체에서 로케일에 맞는 값 추출"}},Wi=new Map,pi=class pi{static getInstance(){return pi.instance||(pi.instance=new pi),pi.instance}register(e,a,r){if(Ks[e]){Ki.warn(`[PipeRegistry] 내장 파이프를 덮어쓸 수 없습니다: ${e}`);return}Wi.set(e,{fn:a,description:r}),Ki.log(`[PipeRegistry] 커스텀 파이프 등록됨: ${e}`)}unregister(e){if(Ks[e])return Ki.warn(`[PipeRegistry] 내장 파이프는 해제할 수 없습니다: ${e}`),!1;const a=Wi.delete(e);return a&&Ki.log(`[PipeRegistry] 커스텀 파이프 해제됨: ${e}`),a}get(e){const a=Ks[e];return a?a.fn:Wi.get(e)?.fn}has(e){return!!Ks[e]||Wi.has(e)}execute(e,a,r=[]){const i=this.get(e);if(!i)return Ki.warn(`[PipeRegistry] 알 수 없는 파이프: ${e}`),a;try{return i(a,...r)}catch(l){return Ki.error(`[PipeRegistry] 파이프 실행 오류 (${e}):`,l),a}}list(){const e=[];for(const[a,r]of Object.entries(Ks))e.push({name:a,description:r.description,type:"built-in"});for(const[a,r]of Wi.entries())e.push({name:a,description:r.description,type:"custom"});return e.sort((a,r)=>a.name.localeCompare(r.name))}clearCustomPipes(){Wi.clear()}};$(pi,"instance",null);let xl=pi;xl.getInstance();function KS(o){const e=o.trim(),a=e.indexOf("(");if(a===-1)return{name:e,args:[]};const r=e.slice(0,a).trim(),i=e.slice(a+1,-1);if(!i.trim())return{name:r,args:[]};const l=[];let u="",d=null,f=0;for(let g=0;g<i.length;g++){const m=i[g];if((g>0?i[g-1]:"")==="\\"){u+=m;continue}if((m==='"'||m==="'")&&!d){d=m;continue}if(m===d){d=null;continue}if(d){u+=m;continue}if(m==="("||m==="["||m==="{"){f++,u+=m;continue}if(m===")"||m==="]"||m==="}"){f--,u+=m;continue}if(m===","&&f===0){l.push(np(u.trim())),u="";continue}u+=m}return u.trim()&&l.push(np(u.trim())),{name:r,args:l}}function np(o){if(o==="null")return null;if(o==="undefined")return;if(o==="true")return!0;if(o==="false")return!1;const e=Number(o);return!isNaN(e)&&o!==""?e:o}function WS(o){const e=[];let a="",r=null,i=0;for(let l=0;l<o.length;l++){const u=o[l],d=l>0?o[l-1]:"",f=l<o.length-1?o[l+1]:"";if(d==="\\"){a+=u;continue}if((u==='"'||u==="'")&&!r){r=u,a+=u;continue}if(u===r){r=null,a+=u;continue}if(r){a+=u;continue}if(u==="("||u==="["||u==="{"){i++,a+=u;continue}if(u===")"||u==="]"||u==="}"){i--,a+=u;continue}if(u==="|"&&f!=="|"&&d!=="|"&&i===0){e.push(a.trim()),a="";continue}a+=u}return a.trim()&&e.push(a.trim()),e.length===0?[o,[]]:[e[0],e.slice(1)]}function ap(o){let e=null,a=0;for(let r=0;r<o.length;r++){const i=o[r],l=r>0?o[r-1]:"",u=r<o.length-1?o[r+1]:"";if(l!=="\\"){if((i==='"'||i==="'")&&!e){e=i;continue}if(i===e){e=null;continue}if(!e){if(i==="("||i==="["||i==="{"){a++;continue}if(i===")"||i==="]"||i==="}"){a--;continue}if(i==="|"&&u!=="|"&&l!=="|"&&a===0)return!0}}}return!1}function YS(o,e){const a=xl.getInstance();let r=o;for(const i of e){const l=KS(i);r=a.execute(l.name,r,l.args)}return r}const Er="raw:",Tl="",Ws="",_r="";function Ys(o){return Tl+o+Ws}function rp(o){return o.length>=2&&o.charCodeAt(0)===64976&&o.charCodeAt(o.length-1)===64977}function ip(o){return o.includes(Tl)}function sp(o){return o.slice(1,-1)}function Xs(o){if(typeof o=="string")return Ys(o);if(Array.isArray(o))return o.map(Xs);if(o&&typeof o=="object"){const e={};for(const[a,r]of Object.entries(o))e[a]=Xs(r);return e}return o}const Js=ct("DataBindingEngine");function Rl(){try{return window.G7Core?.devTools}catch{return}}class rd extends Error{constructor(a,r,i){super(a);$(this,"path");$(this,"context");this.path=r,this.context=i,this.name="DataBindingError"}}const Sa=class Sa{constructor(e){$(this,"cache",new Map);$(this,"expressionFnCache",new Map);$(this,"renderCycleCache",new Map);$(this,"currentRenderCycleId",0);$(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,a){this.isRenderCycleCacheActive()&&this.renderCycleCache.set(e,a)}resolveBindings(e,a,r,i){const l={...this.defaultOptions,...r},u=Rl(),d=a._computed&&!a.$computed?{...a,$computed:a._computed}:a;return e.replace(Sa.BINDING_PATTERN,(f,g)=>{const m=g.trim();let b=!1,v=m;if(m.startsWith(Er)&&(b=!0,v=m.slice(Er.length)),ap(v)){const R=u?.isEnabled()?performance.now():0;try{const[D,U]=WS(v);let j,P=!1;const X=/[?:|&!+\-*/<>=()]/.test(D)||/\[['"]/.test(D),ge=D.startsWith("_global")||D.startsWith("_local")||D.startsWith("_isolated")||D.startsWith("$parent");if(l.skipCache)X?j=this.evaluateExpression(D,d):j=this.resolvePath(D,d,l);else if(X){const $e=this.getFromRenderCycleCache(`expr:${D}`);$e!==void 0?(j=$e,P=!0):(j=this.evaluateExpression(D,d),this.saveToRenderCycleCache(`expr:${D}`,j))}else if(ge){const $e=this.getFromRenderCycleCache(D);$e!==void 0?(j=$e,P=!0):(j=this.resolvePath(D,d,l),this.saveToRenderCycleCache(D,j))}else{const $e=this.getFromCache(D);$e!==void 0?(j=$e,P=!0):(j=this.resolvePath(D,d,l),this.saveToCache(D,j))}const Ee=YS(j,U);if(u?.isEnabled()){const $e=performance.now()-R;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(Ee),resultType:this.getResultType(Ee),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:P,duration:$e,method:"resolveBindings",skipCache:l.skipCache})}const Ce=this.formatValue(Ee);return b?Ys(Ce):Ce}catch(D){return Js.error("Pipe expression evaluation failed:",v,D),f}}if(/[?:&!+\-*/<>=()]/.test(v)||/\|\|/.test(v)||/\[['"]/.test(v)){const R=u?.isEnabled()?performance.now():0;try{let D,U=!1;if(l.skipCache)D=this.evaluateExpression(v,d);else{const P=`expr:${v}`,X=this.getFromRenderCycleCache(P);X!==void 0?(D=X,U=!0):(D=this.evaluateExpression(v,d),this.saveToRenderCycleCache(P,D))}if(u?.isEnabled()){const P=performance.now()-R;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(D),resultType:this.getResultType(D),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:U,duration:P,method:"resolveBindings",skipCache:l.skipCache})}const j=this.formatValue(D);return b?Ys(j):j}catch(D){return Js.error("Expression evaluation failed:",v,D),f}}if(l.skipCache){const R=u?.isEnabled()?performance.now():0,D=this.resolvePath(v,d,l);if(u?.isEnabled()){const j=performance.now()-R;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(D),resultType:this.getResultType(D),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:j,method:"resolveBindings",skipCache:!0})}const U=this.formatValue(D);return b?Ys(U):U}const E=v.startsWith("_global")||v.startsWith("_local")||v.startsWith("_isolated")||v.startsWith("$parent"),A=u?.isEnabled()?performance.now():0;let T,L=!1;if(E){const R=this.getFromRenderCycleCache(v);R!==void 0?(T=R,L=!0):(T=this.resolvePath(v,d,l),this.saveToRenderCycleCache(v,T))}else{const R=this.getFromCache(v);R!==void 0?(T=R,L=!0):(T=this.resolvePath(v,d,l),this.saveToCache(v,T))}if(u?.isEnabled()){const R=performance.now()-A;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(T),resultType:this.getResultType(T),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:L,duration:R,method:"resolveBindings",skipCache:l.skipCache})}const M=this.formatValue(T);return b?Ys(M):M})}resolve(e,a,r,i){const l={...this.defaultOptions,...r},u=Rl(),d=u?.isEnabled()?performance.now():0;if(l.skipCache){const b=this.resolvePath(e,a,l);return u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(b),resultType:this.getResultType(b),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:performance.now()-d,method:"resolve",skipCache:!0}),b}const f=e.startsWith("_global")||e.startsWith("_local")||e.startsWith("_isolated")||e.startsWith("$parent");let g=!1;if(f){const b=this.getFromRenderCycleCache(e);if(b!==void 0)return g=!0,u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(b),resultType:this.getResultType(b),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-d,method:"resolve",skipCache:l.skipCache}),b}else{const b=this.getFromCache(e);if(b!==void 0)return g=!0,u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(b),resultType:this.getResultType(b),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-d,method:"resolve",skipCache:l.skipCache}),b}const m=this.resolvePath(e,a,l);return f?this.saveToRenderCycleCache(e,m):this.saveToCache(e,m),u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(m),resultType:this.getResultType(m),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:g,duration:performance.now()-d,method:"resolve",skipCache:l.skipCache}),m}resolvePath(e,a,r,i=0,l=new WeakSet){if(r.maxDepth&&i>r.maxDepth){if(r.detectCircular)throw new rd(`Maximum depth exceeded (${r.maxDepth}). Possible circular reference.`,e,a);return r.defaultValue}const u=this.parsePath(e);let d=a;for(let f=0;f<u.length;f++){const g=u[f];if(d==null){if(r.nullSafe)return r.defaultValue;throw new rd(`Cannot read property '${g}' of ${d}`,e,a)}if(r.detectCircular&&typeof d=="object"){if(l.has(d))throw new rd(`Circular reference detected at path: ${u.slice(0,f+1).join(".")}`,e,a);l.add(d)}d=d[g],e==="_global.toasts"&&Js.log(`[DataBindingEngine] segment: ${g}, current:`,d)}return d!==void 0?d:r.defaultValue}parsePath(e){const a=[];let r;for(Sa.PATH_SEGMENT_PATTERN.lastIndex=0;(r=Sa.PATH_SEGMENT_PATTERN.exec(e))!==null;){const i=r[1]||r[2];i&&a.push(i)}return a}formatValue(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return"[Object]"}return String(e)}getFromCache(e){const a=this.cache.get(e),r=Rl();if(!a){r?.isEnabled()&&r.recordCacheMiss();return}if(Date.now()-a.timestamp>Sa.CACHE_EXPIRY){this.cache.delete(e),r?.isEnabled()&&r.recordCacheMiss();return}return r?.isEnabled()&&r.recordCacheHit(),a.value}saveToCache(e,a){this.cache.set(e,{value:a,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}extractSingleBinding(e){if(!e.startsWith("{{")||!e.endsWith("}}")||e.length<5)return null;const a=e.slice(2,-2);let r=0;for(let i=0;i<a.length-1;i++){const l=a[i];if(l==="{")r++;else if(l==="}"){if(r>0)r--;else if(a[i+1]==="}")return null}}return a}resolveObject(e,a,r){if(this.isSwitchExpression(e)){const d=e;return this.resolveSwitch(d,a,r)}if(this.isActionDefinition(e))return{...e};if("iteration"in e)return{...e};const i={},u=[...["cellChildren","expandChildren","expandContext","render"],...r?.skipBindingKeys||[]];for(const[d,f]of Object.entries(e)){if(u.includes(d)){i[d]=f;continue}if(typeof f=="string"){const g=this.extractSingleBinding(f);if(g!==null){const m=g.trim();let b=!1,v=m;m.startsWith(Er)&&(b=!0,v=m.slice(Er.length));const E=/[?:|&!+\-*/<>=()]/.test(v)||/\[['"]/.test(v)?this.evaluateExpression(v,a,r):this.resolve(v,a,r);i[d]=b&&E!=null?Xs(E):E}else i[d]=this.resolveBindings(f,a,r)}else Array.isArray(f)?i[d]=f.map(g=>typeof g=="string"?this.resolveBindings(g,a,r):typeof g=="object"&&g!==null?this.resolveObject(g,a,r):g):f&&typeof f=="object"?i[d]=this.resolveObject(f,a,r):i[d]=f}return i}clearCache(){this.cache.clear(),this.expressionFnCache.clear()}invalidateCacheByKeys(e){for(const a of this.cache.keys())for(const r of e)if(a===r||a.startsWith(`${r}.`)||a.startsWith(`${r}[`)){this.cache.delete(a);break}}pruneCache(){const e=Date.now();for(const[a,r]of this.cache.entries())e-r.timestamp>Sa.CACHE_EXPIRY&&this.cache.delete(a)}getCacheStats(){const e=Date.now();let a=0;for(const r of this.cache.values())e-r.timestamp>Sa.CACHE_EXPIRY&&a++;return{size:this.cache.size,expired:a}}evaluateExpression(e,a,r){const i=Rl(),l=i?.isEnabled()?performance.now():0;i?.isEnabled()&&i.trackBindingEval();try{let u=this.preprocessOptionalChaining(e);u=this.preprocessTranslationTokens(u);const d=this.extractVariablesFromExpression(u),f={...a};for(const D of d)D in f||(f[D]=void 0);a._computed&&!f.$computed&&(f.$computed=a._computed);let g=a.$templateId,m=a.$locale;if(typeof window<"u"&&(!g||!m)){const D=window.__templateApp?.getConfig?.();g??(g=D?.templateId),m??(m=D?.locale)}const b=m||"ko";f.$localized=(D,U)=>{if(D==null&&!U)return"";if(typeof D=="string")return D;if(D&&typeof D=="object"&&D[b])return D[b];if(U&&typeof U=="string"){const j=f.$t?f.$t(U):U;if(j&&j!==U)return j}return D&&typeof D=="object"?D.ko||D.en||Object.values(D)[0]||"":D==null?"":String(D)};const v=typeof window<"u"?window.G7Core:void 0;f.$uuid=()=>v?.uuid?v.uuid():typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,D=>{const U=Math.random()*16|0;return(D==="x"?U:U&3|8).toString(16)});const S={templateId:g||"",locale:b};f.$t=D=>{if(!D||typeof D!="string")return"";try{return Cr.getInstance().translate(D,S)}catch(U){return Js.warn("$t() translation failed for key:",D,U),D}},f.$get=(D,U,j=void 0)=>{if(D==null)return j;const P=Array.isArray(U)?U:[U];if(P.length===0)return D;let X=D;for(const ge of P){if(X==null||ge==null)return j;X=X[ge]}return X??j};const E=Object.keys(f),A=Object.values(f),T=`${u}|${E.join(",")}`;let L=this.expressionFnCache.get(T);const M=!!L;L||(L=new Function(...E,`return (${u});`),this.expressionFnCache.set(T,L));const R=L(...A);if(i?.isEnabled()){const D=performance.now()-l;i.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(R),resultType:this.getResultType(R),componentId:r?.componentId,componentName:r?.componentName,propName:r?.propName,fromCache:M,duration:D,method:"evaluateExpression",skipCache:r?.skipCache})}return R}catch(u){throw new Error(`Failed to evaluate expression "${e}": ${u instanceof Error?u.message:String(u)}`)}}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 a=Object.keys(e);return a.length>20?`{Object(${a.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,(a,r,i,l)=>`$t('${l}')`),e.replace(/(?<!['"]\s*)(\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*)(?!\s*['"])/g,'"$1"')}preprocessOptionalChaining(e){const a=[];let r=e.replace(/(['"])(?:(?!\1|\\).|\\.)*\1/g,l=>(a.push(l),`__STRING_LITERAL_${a.length-1}__`));const i=[];return r=r.replace(/\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*(?:\|[^'"\s,)]+)?/g,l=>(i.push(l),`__TRANSLATION_TOKEN_${i.length-1}__`)),r=r.replace(/([a-zA-Z_$][a-zA-Z0-9_$]*)\.(?!\?)/g,"$1?."),r=r.replace(/__TRANSLATION_TOKEN_(\d+)__/g,(l,u)=>i[parseInt(u,10)]),r=r.replace(/__STRING_LITERAL_(\d+)__/g,(l,u)=>a[parseInt(u,10)]),r}extractVariablesFromExpression(e){const a=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","Set","Map","WeakSet","WeakMap","Symbol","Promise","BigInt","Error","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]),r=/(?<![.\w$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,i=new Set;let l;for(;(l=r.exec(e))!==null;){const u=l[1];a.has(u)||i.add(u)}return Array.from(i)}isSwitchExpression(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}resolveSwitch(e,a,r){const i={...r,skipCache:!0};let l;try{l=this.resolveBindings(e.$switch,a,i)?.toString()?.trim()??""}catch(d){Js.warn("resolveSwitch: $switch 키 평가 실패:",e.$switch,d),l=""}let u;if(l&&e.$cases&&l in e.$cases)u=e.$cases[l];else if("$default"in e)u=e.$default;else return;return typeof u=="string"?u.includes("{{")?this.resolveBindings(u,a,i):u:u!==null&&typeof u=="object"?this.resolveObject(u,a,i):u}};$(Sa,"BINDING_PATTERN",/\{\{([^}]+)\}\}/g),$(Sa,"PATH_SEGMENT_PATTERN",/([^.[\]]+)|\[(\d+)\]/g),$(Sa,"CACHE_EXPIRY",3e4);let wn=Sa;const XS=new wn,kl={mobile:{min:0,max:767},tablet:{min:768,max:1023},desktop:{min:1024,max:1/0},portable:{min:0,max:1023}},Dl=new Map;function JS(o,e){let a=null;return((...r)=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{o(...r)},e)})}class QS{constructor(){$(this,"subscribers",new Set);$(this,"currentWidth",1024);$(this,"debouncedHandler",null);$(this,"isInitialized",!1);this.initialize()}initialize(){typeof window>"u"||(this.currentWidth=window.innerWidth,this.isInitialized=!0,this.debouncedHandler=JS(()=>{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(Dl.has(e))return Dl.get(e)??null;let a=null;if(kl[e])a={...kl[e]};else{const r=e.match(/^(-?\d*)-(-?\d*)$/);if(r){const[,i,l]=r,u=i===""?0:parseInt(i,10),d=l===""?1/0:parseInt(l,10);!isNaN(u)&&!isNaN(d)&&u<=d&&(a={min:u,max:d})}}return Dl.set(e,a),a}getMatchingKey(e,a){const r=[];for(const i of Object.keys(e)){const l=this.parseRange(i);l&&a>=l.min&&a<=l.max&&r.push({key:i,range:l,isPreset:!!kl[i]})}return r.length===0?null:(r.sort((i,l)=>{if(i.isPreset!==l.isPreset)return i.isPreset?1:-1;const u=i.range.max-i.range.min,d=l.range.max-l.range.min;return u-d}),r[0].key)}matches(e){const a=this.parseRange(e);return a?this.currentWidth>=a.min&&this.currentWidth<=a.max:!1}clearSubscribers(){this.subscribers.clear()}destroy(){this.debouncedHandler&&typeof window<"u"&&window.removeEventListener("resize",this.debouncedHandler),this.clearSubscribers(),Dl.clear()}_setWidthForTesting(e){this.currentWidth=e,this.notifySubscribers()}}const ci=new QS,Ol=ct("ConditionEvaluator");function ZS(o){switch(o){case"true":return{value:!0};case"false":return{value:!1};case"null":return{value:null};case"undefined":return{value:void 0};default:return}}function ew(o){return/[?:|&!+\-*/<>=()]/.test(o)}function tw(o){if(!o.startsWith("{{")||!o.endsWith("}}"))return null;const e=o.slice(2,-2);let a=null,r=0;for(let i=0;i<e.length;i++){const l=e[i];if((i>0?e[i-1]:"")!=="\\"&&((l==='"'||l==="'")&&!a?a=l:l===a&&(a=null),!a&&(l==="{"&&r++,l==="}"&&r--,r<0)))return null}return r===0?e.trim():null}function nw(o,e,a){if(!o)return!0;try{const r=tw(o);let i;if(r!==null){const l=ZS(r);l!==void 0?i=l.value:ew(r)?i=a.evaluateExpression(r,e):i=a.resolve(r,e,{skipCache:!0})}else i=a.resolveBindings(o,e,{skipCache:!0});if(typeof i=="string"){const l=i.toLowerCase().trim();if(l==="false"||l==="0"||l===""||l==="null"||l==="undefined")return!1}return!!i}catch(r){return Ol.warn(`evaluateStringCondition: 조건 평가 실패: ${o}`,r),!1}}function Ll(o,e,a){if(typeof o=="string")return nw(o,e,a);if("and"in o){if(!Array.isArray(o.and)||o.and.length===0)return Ol.warn("evaluateConditionExpression: AND 그룹이 비어있습니다"),!0;for(const r of o.and)if(!Ll(r,e,a))return!1;return!0}if("or"in o){if(!Array.isArray(o.or)||o.or.length===0)return Ol.warn("evaluateConditionExpression: OR 그룹이 비어있습니다"),!1;for(const r of o.or)if(Ll(r,e,a))return!0;return!1}return Ol.warn("evaluateConditionExpression: 알 수 없는 조건 형식",o),!1}function op(o,e,a){if(!Array.isArray(o)||o.length===0)return{matched:!1,branchIndex:-1};for(let r=0;r<o.length;r++){const i=o[r];if(i.if===void 0)return{matched:!0,branchIndex:r};if(Ll(i.if,e,a))return{matched:!0,branchIndex:r}}return{matched:!1,branchIndex:-1}}function aw(o){return typeof o=="string"?!0:o&&typeof o=="object"?"and"in o||"or"in o:!1}function rw(o){if(!Array.isArray(o)||o.length===0)return!1;const e=o[0];return!e||typeof e!="object"?!1:"if"in e||"then"in e}const Xa=ct("RenderHelpers"),iw=new Map([["true",!0],["false",!1],["null",null]]);function lp(){try{return window.G7Core?.devTools}catch{return}}const cp=new wn;function id(o){return/[?:|&!+\-*/<>=()[\]{}]/.test(o)}function up(o){if(!o.startsWith("{{")||!o.endsWith("}}"))return null;const e=o.slice(2,-2);let a=null,r=0;for(let i=0;i<e.length;i++){const l=e[i];if((i>0?e[i-1]:"")!=="\\"&&((l==='"'||l==="'")&&!a?a=l:l===a&&(a=null),!a&&(l==="{"&&r++,l==="}"&&r--,r<0)))return null}return r===0?e.trim():null}function sd(o,e,a){let r=o;if(o.startsWith("{{")&&o.endsWith("}}")&&(r=o.slice(2,-2).trim()),id(r))try{return a.evaluateExpression(r,e)}catch(i){Xa.warn(`resolveIterationSource: 표현식 평가 실패: ${o}`,i);return}return a.resolve(r,e,{skipCache:!0})}function sw(o,e){const a={...o};if(e?.parentDataContext)for(const[r,i]of Object.entries(e.parentDataContext))r in a||(a[r]=i);if(e?.state){const r=a._local||{};a._local={...r,...e.state}}return e?.isolatedContext?.state&&(a._isolated=e.isolatedContext.state),a}function od(o,e,a,r){if(!e||!Array.isArray(e)||e.length===0)return o;const i=r?.actionDispatcher??Zp(),l={...o,actions:e},u=i.bindActionsToProps(l,a,r?.componentContext);return delete u.actions,u}function dp(o,e,a,r){if(typeof o=="boolean")return o;if(!o)return!0;try{const i=up(o);let l;if(i!==null){const u=iw.get(i);u!==void 0?l=u:id(i)?l=a.evaluateExpression(i,e):l=a.resolve(i,e,{skipCache:!0})}else l=a.resolveBindings(o,e,{skipCache:!0});if(typeof l=="string"){const u=l.toLowerCase().trim();if(u==="false"||u==="0"||u===""||u==="null"||u==="undefined")return!1}return!!l}catch(i){return Xa.warn(`evaluateIfCondition: 조건 평가 실패 (컴포넌트: ${r||"unknown"}):`,i),!1}}function Yi(o,e,a,r){if(o.if!==void 0)return dp(o.if,e,a,r);if(o.condition!==void 0)return dp(o.condition,e,a,r);if(o.conditions===void 0)return!0;const i=o.conditions;try{return aw(i)?Ll(i,e,a):rw(i)?op(i,e,a).matched:(Xa.warn(`evaluateRenderCondition: 알 수 없는 conditions 형식 (컴포넌트: ${r||"unknown"})`),!0)}catch(l){return Xa.warn(`evaluateRenderCondition: conditions 평가 실패 (컴포넌트: ${r||"unknown"}):`,l),!1}}function fp(o){if(!o.responsive)return o;const e=ci.getWidth(),a=ci.getMatchingKey(o.responsive,e);if(!a)return o;const r=o.responsive[a];return{...o,props:{...o.props,...r.props},children:r.children??o.children,text:r.text??o.text,if:r.if??o.if,iteration:r.iteration??o.iteration}}function Qs(o,e,a,r,i){if(!o||o.length===0)return[];const l=i?.bindingEngine??new wn,u=i?.translationEngine??Cr.getInstance(),d=i?.translationContext??{templateId:"",locale:"ko"},f=sw(e,i?.componentContext),g=(v,S)=>{if(typeof v=="string"){if(rp(v))return sp(v);if(ip(v)){const A=[],T=v.replace(new RegExp(`${Tl}([^${Ws}]*)${Ws}`,"g"),(M,R)=>(A.push(R),`${_r}${A.length-1}${_r}`));let L=T;return/\$t:[a-zA-Z0-9._-]+/.test(T)&&(L=u.resolveTranslations(T,d,S)),L.replace(new RegExp(`${_r}(\\d+)${_r}`,"g"),(M,R)=>A[parseInt(R)])}if(v.startsWith("$t:defer:")){const A="$t:"+v.slice(9);return u.resolveTranslations(A,d,S)}if(v.startsWith("$t:"))return u.resolveTranslations(v,d,S);const E=up(v);if(E!==null){let A=!1,T=E;E.startsWith(Er)&&(A=!0,T=E.slice(Er.length));let L;if(id(T))try{L=l.evaluateExpression(T,S)}catch(M){Xa.warn("renderItemChildren: 표현식 평가 실패:",M);return}else L=l.resolve(T,S,{skipCache:!0});return!A&&typeof L=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(L)&&(L=u.resolveTranslations(L,d,S)),A&&L!=null?Xs(L):L}if(v.includes("{{")){const A=l.resolveBindings(v,S,{skipCache:!0});return typeof A=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(A)?u.resolveTranslations(A,d,S):A}return v}if(Array.isArray(v))return v.map(E=>g(E,S));if(v&&typeof v=="object"){const E={};for(const[A,T]of Object.entries(v))E[A]=g(T,S);return E}return v},m=(v,S)=>{if(!v)return{};const E={};for(const[A,T]of Object.entries(v))E[A]=g(T,S);return E},b=(v,S,E)=>{const A=fp(v),T=A.iteration;if(!T)return[];const L=sd(T.source,E,l);if(!Array.isArray(L))return Xa.warn(`renderItemChildren: iteration.source가 배열이 아닙니다: ${T.source}`),[];const M=lp();if(M?.isEnabled()){const D=`${S}-iteration`;M.trackIteration(D,T.source,T.item_var,T.index_var,L.length)}const R=a[A.name];return R?L.flatMap((D,U)=>{const j={...E,[T.item_var]:D,[`${T.item_var}_index`]:U,...T.index_var?{[T.index_var]:U}:{}},P=Yi({if:A.if,condition:A.condition,conditions:A.conditions},j,l,A.id);if(A.if&&M?.isEnabled()){const Xe=`${S}-iter-${U}-if`;M.trackIfCondition(Xe,A.if,P,A.name)}if(!P)return[];const X=A.id?String(g(A.id,j)):void 0,ge=`${S}-iter-${U}`,Ee=i?.getRemountKey?i.getRemountKey(X,ge):ge,Ce=m(A.props,j),$e=od(Ce,A.actions,j,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let Pe=null;return A.text!==void 0?Pe=g(A.text,j):A.children&&A.children.length>0&&(Pe=Qs(A.children,j,a,Ee,i)),M?.isEnabled()&&M.trackRender(A.name),[Ye.createElement(R,{key:Ee,...$e},Pe)]}):(Xa.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${A.name}`),[])};return o.flatMap((v,S)=>{const E=fp(v),A=E.id?String(g(E.id,f)):void 0,T=r?`${r}-${A||S}`:A||`child-${S}`,L=i?.getRemountKey?i.getRemountKey(A,T):T;if(E.iteration)return b(E,L,f);const M=Yi({if:E.if,condition:E.condition,conditions:E.conditions},f,l,E.id),R=lp();if(E.if&&R?.isEnabled()){const X=`${L}-if`;R.trackIfCondition(X,E.if,M,E.name)}if(!M)return[];const D=a[E.name];if(!D)return Xa.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${E.name}`),[];const U=m(E.props,f),j=od(U,E.actions,f,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let P=null;return E.text!==void 0?P=g(E.text,f):E.children&&E.children.length>0&&(P=Qs(E.children,f,a,L,i)),R?.isEnabled()&&R.trackRender(E.name),[Ye.createElement(D,{key:L,...j},P)]})}function Xi(o,e,a,r){let i,l;return a instanceof wn?(i=a,l=r):(i=cp,l=a),i.resolveBindings(o,e,l)}function ow(o,e,a,r){const i=a??cp,l={skipCache:!0,...r};let u;try{u=i.resolveBindings(o.key,e,{skipCache:l.skipCache})?.toString()?.trim()??""}catch(g){Xa.warn("resolveClassMap: key 평가 실패:",o.key,g),u=""}let d="";u&&o.variants&&u in o.variants?d=o.variants[u]:o.default&&(d=o.default);const f=[];return o.base?.trim()&&f.push(o.base.trim()),d?.trim()&&f.push(d.trim()),f.join(" ")}function hp(o,e){return function(){return o.apply(e,arguments)}}const{toString:lw}=Object.prototype,{getPrototypeOf:Ml}=Object,{iterator:$l,toStringTag:gp}=Symbol,Nl=(o=>e=>{const a=lw.call(e);return o[a]||(o[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),fa=o=>(o=o.toLowerCase(),e=>Nl(e)===o),Il=o=>e=>typeof e===o,{isArray:Ji}=Array,Qi=Il("undefined");function Zs(o){return o!==null&&!Qi(o)&&o.constructor!==null&&!Qi(o.constructor)&&xn(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const pp=fa("ArrayBuffer");function cw(o){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&pp(o.buffer),e}const uw=Il("string"),xn=Il("function"),mp=Il("number"),eo=o=>o!==null&&typeof o=="object",dw=o=>o===!0||o===!1,Hl=o=>{if(Nl(o)!=="object")return!1;const e=Ml(o);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(gp in o)&&!($l in o)},fw=o=>{if(!eo(o)||Zs(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},hw=fa("Date"),gw=fa("File"),pw=o=>!!(o&&typeof o.uri<"u"),mw=o=>o&&typeof o.getParts<"u",yw=fa("Blob"),bw=fa("FileList"),vw=o=>eo(o)&&xn(o.pipe);function Sw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const yp=Sw(),bp=typeof yp.FormData<"u"?yp.FormData:void 0,ww=o=>{if(!o)return!1;if(bp&&o instanceof bp)return!0;const e=Ml(o);if(!e||e===Object.prototype||!xn(o.append))return!1;const a=Nl(o);return a==="formdata"||a==="object"&&xn(o.toString)&&o.toString()==="[object FormData]"},Cw=fa("URLSearchParams"),[Ew,_w,Aw,xw]=["ReadableStream","Request","Response","Headers"].map(fa),Tw=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function to(o,e,{allOwnKeys:a=!1}={}){if(o===null||typeof o>"u")return;let r,i;if(typeof o!="object"&&(o=[o]),Ji(o))for(r=0,i=o.length;r<i;r++)e.call(null,o[r],r,o);else{if(Zs(o))return;const l=a?Object.getOwnPropertyNames(o):Object.keys(o),u=l.length;let d;for(r=0;r<u;r++)d=l[r],e.call(null,o[d],d,o)}}function vp(o,e){if(Zs(o))return null;e=e.toLowerCase();const a=Object.keys(o);let r=a.length,i;for(;r-- >0;)if(i=a[r],e===i.toLowerCase())return i;return null}const ui=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Sp=o=>!Qi(o)&&o!==ui;function ld(...o){const{caseless:e,skipUndefined:a}=Sp(this)&&this||{},r={},i=(l,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const d=e&&vp(r,u)||u,f=cd(r,d)?r[d]:void 0;Hl(f)&&Hl(l)?r[d]=ld(f,l):Hl(l)?r[d]=ld({},l):Ji(l)?r[d]=l.slice():(!a||!Qi(l))&&(r[d]=l)};for(let l=0,u=o.length;l<u;l++)o[l]&&to(o[l],i);return r}const Rw=(o,e,a,{allOwnKeys:r}={})=>(to(e,(i,l)=>{a&&xn(i)?Object.defineProperty(o,l,{__proto__:null,value:hp(i,a),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(o,l,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),o),kw=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),Dw=(o,e,a,r)=>{o.prototype=Object.create(e.prototype,r),Object.defineProperty(o.prototype,"constructor",{__proto__:null,value:o,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(o,"super",{__proto__:null,value:e.prototype}),a&&Object.assign(o.prototype,a)},Ow=(o,e,a,r)=>{let i,l,u;const d={};if(e=e||{},o==null)return e;do{for(i=Object.getOwnPropertyNames(o),l=i.length;l-- >0;)u=i[l],(!r||r(u,o,e))&&!d[u]&&(e[u]=o[u],d[u]=!0);o=a!==!1&&Ml(o)}while(o&&(!a||a(o,e))&&o!==Object.prototype);return e},Lw=(o,e,a)=>{o=String(o),(a===void 0||a>o.length)&&(a=o.length),a-=e.length;const r=o.indexOf(e,a);return r!==-1&&r===a},Mw=o=>{if(!o)return null;if(Ji(o))return o;let e=o.length;if(!mp(e))return null;const a=new Array(e);for(;e-- >0;)a[e]=o[e];return a},$w=(o=>e=>o&&e instanceof o)(typeof Uint8Array<"u"&&Ml(Uint8Array)),Nw=(o,e)=>{const r=(o&&o[$l]).call(o);let i;for(;(i=r.next())&&!i.done;){const l=i.value;e.call(o,l[0],l[1])}},Iw=(o,e)=>{let a;const r=[];for(;(a=o.exec(e))!==null;)r.push(a);return r},Hw=fa("HTMLFormElement"),zw=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,r,i){return r.toUpperCase()+i}),cd=(({hasOwnProperty:o})=>(e,a)=>o.call(e,a))(Object.prototype),jw=fa("RegExp"),wp=(o,e)=>{const a=Object.getOwnPropertyDescriptors(o),r={};to(a,(i,l)=>{let u;(u=e(i,l,o))!==!1&&(r[l]=u||i)}),Object.defineProperties(o,r)},Uw=o=>{wp(o,(e,a)=>{if(xn(o)&&["arguments","caller","callee"].includes(a))return!1;const r=o[a];if(xn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},Bw=(o,e)=>{const a={},r=i=>{i.forEach(l=>{a[l]=!0})};return Ji(o)?r(o):r(String(o).split(e)),a},Pw=()=>{},qw=(o,e)=>o!=null&&Number.isFinite(o=+o)?o:e;function Gw(o){return!!(o&&xn(o.append)&&o[gp]==="FormData"&&o[$l])}const Vw=o=>{const e=new WeakSet,a=r=>{if(eo(r)){if(e.has(r))return;if(Zs(r))return r;if(!("toJSON"in r)){e.add(r);const i=Ji(r)?[]:{};return to(r,(l,u)=>{const d=a(l);!Qi(d)&&(i[u]=d)}),e.delete(r),i}}return r};return a(o)},Fw=fa("AsyncFunction"),Kw=o=>o&&(eo(o)||xn(o))&&xn(o.then)&&xn(o.catch),Cp=((o,e)=>o?setImmediate:e?((a,r)=>(ui.addEventListener("message",({source:i,data:l})=>{i===ui&&l===a&&r.length&&r.shift()()},!1),i=>{r.push(i),ui.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",xn(ui.postMessage)),Ww=typeof queueMicrotask<"u"?queueMicrotask.bind(ui):typeof process<"u"&&process.nextTick||Cp,F={isArray:Ji,isArrayBuffer:pp,isBuffer:Zs,isFormData:ww,isArrayBufferView:cw,isString:uw,isNumber:mp,isBoolean:dw,isObject:eo,isPlainObject:Hl,isEmptyObject:fw,isReadableStream:Ew,isRequest:_w,isResponse:Aw,isHeaders:xw,isUndefined:Qi,isDate:hw,isFile:gw,isReactNativeBlob:pw,isReactNative:mw,isBlob:yw,isRegExp:jw,isFunction:xn,isStream:vw,isURLSearchParams:Cw,isTypedArray:$w,isFileList:bw,forEach:to,merge:ld,extend:Rw,trim:Tw,stripBOM:kw,inherits:Dw,toFlatObject:Ow,kindOf:Nl,kindOfTest:fa,endsWith:Lw,toArray:Mw,forEachEntry:Nw,matchAll:Iw,isHTMLForm:Hw,hasOwnProperty:cd,hasOwnProp:cd,reduceDescriptors:wp,freezeMethods:Uw,toObjectSet:Bw,toCamelCase:zw,noop:Pw,toFiniteNumber:qw,findKey:vp,global:ui,isContextDefined:Sp,isSpecCompliantForm:Gw,toJSONObject:Vw,isAsyncFn:Fw,isThenable:Kw,setImmediate:Cp,asap:Ww,isIterable:o=>o!=null&&xn(o[$l])},Yw=F.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"]),Xw=o=>{const e={};let a,r,i;return o&&o.split(`
|
||
`).forEach(function(u){i=u.indexOf(":"),a=u.substring(0,i).trim().toLowerCase(),r=u.substring(i+1).trim(),!(!a||e[a]&&Yw[a])&&(a==="set-cookie"?e[a]?e[a].push(r):e[a]=[r]:e[a]=e[a]?e[a]+", "+r:r)}),e};function Jw(o){let e=0,a=o.length;for(;e<a;){const r=o.charCodeAt(e);if(r!==9&&r!==32)break;e+=1}for(;a>e;){const r=o.charCodeAt(a-1);if(r!==9&&r!==32)break;a-=1}return e===0&&a===o.length?o:o.slice(e,a)}const Qw=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Zw=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ud(o,e){return F.isArray(o)?o.map(a=>ud(a,e)):Jw(String(o).replace(e,""))}const e0=o=>ud(o,Qw),t0=o=>ud(o,Zw);function Ep(o){const e=Object.create(null);return F.forEach(o.toJSON(),(a,r)=>{e[r]=t0(a)}),e}const _p=Symbol("internals");function no(o){return o&&String(o).trim().toLowerCase()}function zl(o){return o===!1||o==null?o:F.isArray(o)?o.map(zl):e0(String(o))}function n0(o){const e=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=a.exec(o);)e[r[1]]=r[2];return e}const a0=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function dd(o,e,a,r,i){if(F.isFunction(r))return r.call(this,e,a);if(i&&(e=a),!!F.isString(e)){if(F.isString(r))return e.indexOf(r)!==-1;if(F.isRegExp(r))return r.test(e)}}function r0(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,a,r)=>a.toUpperCase()+r)}function i0(o,e){const a=F.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(o,r+a,{__proto__:null,value:function(i,l,u){return this[r].call(this,e,i,l,u)},configurable:!0})})}let Cn=class{constructor(e){e&&this.set(e)}set(e,a,r){const i=this;function l(d,f,g){const m=no(f);if(!m)throw new Error("header name must be a non-empty string");const b=F.findKey(i,m);(!b||i[b]===void 0||g===!0||g===void 0&&i[b]!==!1)&&(i[b||f]=zl(d))}const u=(d,f)=>F.forEach(d,(g,m)=>l(g,m,f));if(F.isPlainObject(e)||e instanceof this.constructor)u(e,a);else if(F.isString(e)&&(e=e.trim())&&!a0(e))u(Xw(e),a);else if(F.isObject(e)&&F.isIterable(e)){let d={},f,g;for(const m of e){if(!F.isArray(m))throw TypeError("Object iterator must return a key-value pair");d[g=m[0]]=(f=d[g])?F.isArray(f)?[...f,m[1]]:[f,m[1]]:m[1]}u(d,a)}else e!=null&&l(a,e,r);return this}get(e,a){if(e=no(e),e){const r=F.findKey(this,e);if(r){const i=this[r];if(!a)return i;if(a===!0)return n0(i);if(F.isFunction(a))return a.call(this,i,r);if(F.isRegExp(a))return a.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,a){if(e=no(e),e){const r=F.findKey(this,e);return!!(r&&this[r]!==void 0&&(!a||dd(this,this[r],r,a)))}return!1}delete(e,a){const r=this;let i=!1;function l(u){if(u=no(u),u){const d=F.findKey(r,u);d&&(!a||dd(r,r[d],d,a))&&(delete r[d],i=!0)}}return F.isArray(e)?e.forEach(l):l(e),i}clear(e){const a=Object.keys(this);let r=a.length,i=!1;for(;r--;){const l=a[r];(!e||dd(this,this[l],l,e,!0))&&(delete this[l],i=!0)}return i}normalize(e){const a=this,r={};return F.forEach(this,(i,l)=>{const u=F.findKey(r,l);if(u){a[u]=zl(i),delete a[l];return}const d=e?r0(l):String(l).trim();d!==l&&delete a[l],a[d]=zl(i),r[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const a=Object.create(null);return F.forEach(this,(r,i)=>{r!=null&&r!==!1&&(a[i]=e&&F.isArray(r)?r.join(", "):r)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,a])=>e+": "+a).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,...a){const r=new this(e);return a.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[_p]=this[_p]={accessors:{}}).accessors,i=this.prototype;function l(u){const d=no(u);r[d]||(i0(i,u),r[d]=!0)}return F.isArray(e)?e.forEach(l):l(e),this}};Cn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),F.reduceDescriptors(Cn.prototype,({value:o},e)=>{let a=e[0].toUpperCase()+e.slice(1);return{get:()=>o,set(r){this[a]=r}}}),F.freezeMethods(Cn);const s0="[REDACTED ****]";function o0(o){if(F.hasOwnProp(o,"toJSON"))return!0;let e=Object.getPrototypeOf(o);for(;e&&e!==Object.prototype;){if(F.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function l0(o,e){const a=new Set(e.map(l=>String(l).toLowerCase())),r=[],i=l=>{if(l===null||typeof l!="object"||F.isBuffer(l))return l;if(r.indexOf(l)!==-1)return;l instanceof Cn&&(l=l.toJSON()),r.push(l);let u;if(F.isArray(l))u=[],l.forEach((d,f)=>{const g=i(d);F.isUndefined(g)||(u[f]=g)});else{if(!F.isPlainObject(l)&&o0(l))return r.pop(),l;u=Object.create(null);for(const[d,f]of Object.entries(l)){const g=a.has(d.toLowerCase())?s0:i(f);F.isUndefined(g)||(u[d]=g)}}return r.pop(),u};return i(o)}let Oe=class RS extends Error{static from(e,a,r,i,l,u){const d=new RS(e.message,a||e.code,r,i,l);return d.cause=e,d.name=e.name,e.status!=null&&d.status==null&&(d.status=e.status),u&&Object.assign(d,u),d}constructor(e,a,r,i,l){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,a&&(this.code=a),r&&(this.config=r),i&&(this.request=i),l&&(this.response=l,this.status=l.status)}toJSON(){const e=this.config,a=e&&F.hasOwnProp(e,"redact")?e.redact:void 0,r=F.isArray(a)&&a.length>0?l0(e,a):F.toJSONObject(e);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:r,code:this.code,status:this.status}}};Oe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Oe.ERR_BAD_OPTION="ERR_BAD_OPTION",Oe.ECONNABORTED="ECONNABORTED",Oe.ETIMEDOUT="ETIMEDOUT",Oe.ECONNREFUSED="ECONNREFUSED",Oe.ERR_NETWORK="ERR_NETWORK",Oe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Oe.ERR_DEPRECATED="ERR_DEPRECATED",Oe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Oe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Oe.ERR_CANCELED="ERR_CANCELED",Oe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Oe.ERR_INVALID_URL="ERR_INVALID_URL",Oe.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const c0=null;function fd(o){return F.isPlainObject(o)||F.isArray(o)}function Ap(o){return F.endsWith(o,"[]")?o.slice(0,-2):o}function hd(o,e,a){return o?o.concat(e).map(function(i,l){return i=Ap(i),!a&&l?"["+i+"]":i}).join(a?".":""):e}function u0(o){return F.isArray(o)&&!o.some(fd)}const d0=F.toFlatObject(F,{},null,function(e){return/^is[A-Z]/.test(e)});function jl(o,e,a){if(!F.isObject(o))throw new TypeError("target must be an object");e=e||new FormData,a=F.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,L){return!F.isUndefined(L[T])});const r=a.metaTokens,i=a.visitor||b,l=a.dots,u=a.indexes,d=a.Blob||typeof Blob<"u"&&Blob,f=a.maxDepth===void 0?100:a.maxDepth,g=d&&F.isSpecCompliantForm(e);if(!F.isFunction(i))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(F.isDate(A))return A.toISOString();if(F.isBoolean(A))return A.toString();if(!g&&F.isBlob(A))throw new Oe("Blob is not supported. Use a Buffer instead.");return F.isArrayBuffer(A)||F.isTypedArray(A)?g&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function b(A,T,L){let M=A;if(F.isReactNative(e)&&F.isReactNativeBlob(A))return e.append(hd(L,T,l),m(A)),!1;if(A&&!L&&typeof A=="object"){if(F.endsWith(T,"{}"))T=r?T:T.slice(0,-2),A=JSON.stringify(A);else if(F.isArray(A)&&u0(A)||(F.isFileList(A)||F.endsWith(T,"[]"))&&(M=F.toArray(A)))return T=Ap(T),M.forEach(function(D,U){!(F.isUndefined(D)||D===null)&&e.append(u===!0?hd([T],U,l):u===null?T:T+"[]",m(D))}),!1}return fd(A)?!0:(e.append(hd(L,T,l),m(A)),!1)}const v=[],S=Object.assign(d0,{defaultVisitor:b,convertValue:m,isVisitable:fd});function E(A,T,L=0){if(!F.isUndefined(A)){if(L>f)throw new Oe("Object is too deeply nested ("+L+" levels). Max depth: "+f,Oe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+T.join("."));v.push(A),F.forEach(A,function(R,D){(!(F.isUndefined(R)||R===null)&&i.call(e,R,F.isString(D)?D.trim():D,T,S))===!0&&E(R,T?T.concat(D):[D],L+1)}),v.pop()}}if(!F.isObject(o))throw new TypeError("data must be an object");return E(o),e}function xp(o){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(o).replace(/[!'()~]|%20/g,function(r){return e[r]})}function gd(o,e){this._pairs=[],o&&jl(o,this,e)}const Tp=gd.prototype;Tp.append=function(e,a){this._pairs.push([e,a])},Tp.toString=function(e){const a=e?function(r){return e.call(this,r,xp)}:xp;return this._pairs.map(function(i){return a(i[0])+"="+a(i[1])},"").join("&")};function f0(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Rp(o,e,a){if(!e)return o;const r=a&&a.encode||f0,i=F.isFunction(a)?{serialize:a}:a,l=i&&i.serialize;let u;if(l?u=l(e,i):u=F.isURLSearchParams(e)?e.toString():new gd(e,i).toString(r),u){const d=o.indexOf("#");d!==-1&&(o=o.slice(0,d)),o+=(o.indexOf("?")===-1?"?":"&")+u}return o}class kp{constructor(){this.handlers=[]}use(e,a,r){return this.handlers.push({fulfilled:e,rejected:a,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){F.forEach(this.handlers,function(r){r!==null&&e(r)})}}const pd={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},h0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:gd,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},md=typeof window<"u"&&typeof document<"u",yd=typeof navigator=="object"&&navigator||void 0,g0=md&&(!yd||["ReactNative","NativeScript","NS"].indexOf(yd.product)<0),p0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",m0=md&&window.location.href||"http://localhost",yn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:md,hasStandardBrowserEnv:g0,hasStandardBrowserWebWorkerEnv:p0,navigator:yd,origin:m0},Symbol.toStringTag,{value:"Module"})),...h0};function y0(o,e){return jl(o,new yn.classes.URLSearchParams,{visitor:function(a,r,i,l){return yn.isNode&&F.isBuffer(a)?(this.append(r,a.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...e})}function b0(o){return F.matchAll(/\w+|\[(\w*)]/g,o).map(e=>e[0]==="[]"?"":e[1]||e[0])}function v0(o){const e={},a=Object.keys(o);let r;const i=a.length;let l;for(r=0;r<i;r++)l=a[r],e[l]=o[l];return e}function Dp(o){function e(a,r,i,l){let u=a[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),f=l>=a.length;return u=!u&&F.isArray(i)?i.length:u,f?(F.hasOwnProp(i,u)?i[u]=F.isArray(i[u])?i[u].concat(r):[i[u],r]:i[u]=r,!d):((!F.hasOwnProp(i,u)||!F.isObject(i[u]))&&(i[u]=[]),e(a,r,i[u],l)&&F.isArray(i[u])&&(i[u]=v0(i[u])),!d)}if(F.isFormData(o)&&F.isFunction(o.entries)){const a={};return F.forEachEntry(o,(r,i)=>{e(b0(r),i,a,0)}),a}return null}const Zi=(o,e)=>o!=null&&F.hasOwnProp(o,e)?o[e]:void 0;function S0(o,e,a){if(F.isString(o))try{return(e||JSON.parse)(o),F.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(a||JSON.stringify)(o)}const ao={transitional:pd,adapter:["xhr","http","fetch"],transformRequest:[function(e,a){const r=a.getContentType()||"",i=r.indexOf("application/json")>-1,l=F.isObject(e);if(l&&F.isHTMLForm(e)&&(e=new FormData(e)),F.isFormData(e))return i?JSON.stringify(Dp(e)):e;if(F.isArrayBuffer(e)||F.isBuffer(e)||F.isStream(e)||F.isFile(e)||F.isBlob(e)||F.isReadableStream(e))return e;if(F.isArrayBufferView(e))return e.buffer;if(F.isURLSearchParams(e))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(l){const f=Zi(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return y0(e,f).toString();if((d=F.isFileList(e))||r.indexOf("multipart/form-data")>-1){const g=Zi(this,"env"),m=g&&g.FormData;return jl(d?{"files[]":e}:e,m&&new m,f)}}return l||i?(a.setContentType("application/json",!1),S0(e)):e}],transformResponse:[function(e){const a=Zi(this,"transitional")||ao.transitional,r=a&&a.forcedJSONParsing,i=Zi(this,"responseType"),l=i==="json";if(F.isResponse(e)||F.isReadableStream(e))return e;if(e&&F.isString(e)&&(r&&!i||l)){const d=!(a&&a.silentJSONParsing)&&l;try{return JSON.parse(e,Zi(this,"parseReviver"))}catch(f){if(d)throw f.name==="SyntaxError"?Oe.from(f,Oe.ERR_BAD_RESPONSE,this,null,Zi(this,"response")):f}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yn.classes.FormData,Blob:yn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};F.forEach(["delete","get","head","post","put","patch","query"],o=>{ao.headers[o]={}});function bd(o,e){const a=this||ao,r=e||a,i=Cn.from(r.headers);let l=r.data;return F.forEach(o,function(d){l=d.call(a,l,i.normalize(),e?e.status:void 0)}),i.normalize(),l}function Op(o){return!!(o&&o.__CANCEL__)}let ro=class extends Oe{constructor(e,a,r){super(e??"canceled",Oe.ERR_CANCELED,a,r),this.name="CanceledError",this.__CANCEL__=!0}};function Lp(o,e,a){const r=a.config.validateStatus;!a.status||!r||r(a.status)?o(a):e(new Oe("Request failed with status code "+a.status,a.status>=400&&a.status<500?Oe.ERR_BAD_REQUEST:Oe.ERR_BAD_RESPONSE,a.config,a.request,a))}function w0(o){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(o);return e&&e[1]||""}function C0(o,e){o=o||10;const a=new Array(o),r=new Array(o);let i=0,l=0,u;return e=e!==void 0?e:1e3,function(f){const g=Date.now(),m=r[l];u||(u=g),a[i]=f,r[i]=g;let b=l,v=0;for(;b!==i;)v+=a[b++],b=b%o;if(i=(i+1)%o,i===l&&(l=(l+1)%o),g-u<e)return;const S=m&&g-m;return S?Math.round(v*1e3/S):void 0}}function E0(o,e){let a=0,r=1e3/e,i,l;const u=(g,m=Date.now())=>{a=m,i=null,l&&(clearTimeout(l),l=null),o(...g)};return[(...g)=>{const m=Date.now(),b=m-a;b>=r?u(g,m):(i=g,l||(l=setTimeout(()=>{l=null,u(i)},r-b)))},()=>i&&u(i)]}const Ul=(o,e,a=3)=>{let r=0;const i=C0(50,250);return E0(l=>{if(!l||typeof l.loaded!="number")return;const u=l.loaded,d=l.lengthComputable?l.total:void 0,f=d!=null?Math.min(u,d):u,g=Math.max(0,f-r),m=i(g);r=Math.max(r,f);const b={loaded:f,total:d,progress:d?f/d:void 0,bytes:g,rate:m||void 0,estimated:m&&d?(d-f)/m:void 0,event:l,lengthComputable:d!=null,[e?"download":"upload"]:!0};o(b)},a)},Mp=(o,e)=>{const a=o!=null;return[r=>e[0]({lengthComputable:a,total:o,loaded:r}),e[1]]},$p=o=>(...e)=>F.asap(()=>o(...e)),_0=yn.hasStandardBrowserEnv?((o,e)=>a=>(a=new URL(a,yn.origin),o.protocol===a.protocol&&o.host===a.host&&(e||o.port===a.port)))(new URL(yn.origin),yn.navigator&&/(msie|trident)/i.test(yn.navigator.userAgent)):()=>!0,A0=yn.hasStandardBrowserEnv?{write(o,e,a,r,i,l,u){if(typeof document>"u")return;const d=[`${o}=${encodeURIComponent(e)}`];F.isNumber(a)&&d.push(`expires=${new Date(a).toUTCString()}`),F.isString(r)&&d.push(`path=${r}`),F.isString(i)&&d.push(`domain=${i}`),l===!0&&d.push("secure"),F.isString(u)&&d.push(`SameSite=${u}`),document.cookie=d.join("; ")},read(o){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let a=0;a<e.length;a++){const r=e[a].replace(/^\s+/,""),i=r.indexOf("=");if(i!==-1&&r.slice(0,i)===o)return decodeURIComponent(r.slice(i+1))}return null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function x0(o){return typeof o!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function T0(o,e){return e?o.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):o}function Np(o,e,a){let r=!x0(e);return o&&(r||a===!1)?T0(o,e):e}const Ip=o=>o instanceof Cn?{...o}:o;function di(o,e){e=e||{};const a=Object.create(null);Object.defineProperty(a,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(g,m,b,v){return F.isPlainObject(g)&&F.isPlainObject(m)?F.merge.call({caseless:v},g,m):F.isPlainObject(m)?F.merge({},m):F.isArray(m)?m.slice():m}function i(g,m,b,v){if(F.isUndefined(m)){if(!F.isUndefined(g))return r(void 0,g,b,v)}else return r(g,m,b,v)}function l(g,m){if(!F.isUndefined(m))return r(void 0,m)}function u(g,m){if(F.isUndefined(m)){if(!F.isUndefined(g))return r(void 0,g)}else return r(void 0,m)}function d(g,m,b){if(F.hasOwnProp(e,b))return r(g,m);if(F.hasOwnProp(o,b))return r(void 0,g)}const f={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,allowedSocketPaths:u,responseEncoding:u,validateStatus:d,headers:(g,m,b)=>i(Ip(g),Ip(m),b,!0)};return F.forEach(Object.keys({...o,...e}),function(m){if(m==="__proto__"||m==="constructor"||m==="prototype")return;const b=F.hasOwnProp(f,m)?f[m]:i,v=F.hasOwnProp(o,m)?o[m]:void 0,S=F.hasOwnProp(e,m)?e[m]:void 0,E=b(v,S,m);F.isUndefined(E)&&b!==d||(a[m]=E)}),a}const R0=["content-type","content-length"];function k0(o,e,a){if(a!=="content-only"){o.set(e);return}Object.entries(e).forEach(([r,i])=>{R0.includes(r.toLowerCase())&&o.set(r,i)})}const D0=o=>encodeURIComponent(o).replace(/%([0-9A-F]{2})/gi,(e,a)=>String.fromCharCode(parseInt(a,16))),Hp=o=>{const e=di({},o),a=v=>F.hasOwnProp(e,v)?e[v]:void 0,r=a("data");let i=a("withXSRFToken");const l=a("xsrfHeaderName"),u=a("xsrfCookieName");let d=a("headers");const f=a("auth"),g=a("baseURL"),m=a("allowAbsoluteUrls"),b=a("url");if(e.headers=d=Cn.from(d),e.url=Rp(Np(g,b,m),o.params,o.paramsSerializer),f&&d.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?D0(f.password):""))),F.isFormData(r)&&(yn.hasStandardBrowserEnv||yn.hasStandardBrowserWebWorkerEnv?d.setContentType(void 0):F.isFunction(r.getHeaders)&&k0(d,r.getHeaders(),a("formDataHeaderPolicy"))),yn.hasStandardBrowserEnv&&(F.isFunction(i)&&(i=i(e)),i===!0||i==null&&_0(e.url))){const S=l&&u&&A0.read(u);S&&d.set(l,S)}return e},O0=typeof XMLHttpRequest<"u"&&function(o){return new Promise(function(a,r){const i=Hp(o);let l=i.data;const u=Cn.from(i.headers).normalize();let{responseType:d,onUploadProgress:f,onDownloadProgress:g}=i,m,b,v,S,E;function A(){S&&S(),E&&E(),i.cancelToken&&i.cancelToken.unsubscribe(m),i.signal&&i.signal.removeEventListener("abort",m)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function L(){if(!T)return;const R=Cn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),U={data:!d||d==="text"||d==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:R,config:o,request:T};Lp(function(P){a(P),A()},function(P){r(P),A()},U),T=null}"onloadend"in T?T.onloadend=L:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.startsWith("file:"))||setTimeout(L)},T.onabort=function(){T&&(r(new Oe("Request aborted",Oe.ECONNABORTED,o,T)),A(),T=null)},T.onerror=function(D){const U=D&&D.message?D.message:"Network Error",j=new Oe(U,Oe.ERR_NETWORK,o,T);j.event=D||null,r(j),A(),T=null},T.ontimeout=function(){let D=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const U=i.transitional||pd;i.timeoutErrorMessage&&(D=i.timeoutErrorMessage),r(new Oe(D,U.clarifyTimeoutError?Oe.ETIMEDOUT:Oe.ECONNABORTED,o,T)),A(),T=null},l===void 0&&u.setContentType(null),"setRequestHeader"in T&&F.forEach(Ep(u),function(D,U){T.setRequestHeader(U,D)}),F.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),d&&d!=="json"&&(T.responseType=i.responseType),g&&([v,E]=Ul(g,!0),T.addEventListener("progress",v)),f&&T.upload&&([b,S]=Ul(f),T.upload.addEventListener("progress",b),T.upload.addEventListener("loadend",S)),(i.cancelToken||i.signal)&&(m=R=>{T&&(r(!R||R.type?new ro(null,o,T):R),T.abort(),A(),T=null)},i.cancelToken&&i.cancelToken.subscribe(m),i.signal&&(i.signal.aborted?m():i.signal.addEventListener("abort",m)));const M=w0(i.url);if(M&&!yn.protocols.includes(M)){r(new Oe("Unsupported protocol "+M+":",Oe.ERR_BAD_REQUEST,o));return}T.send(l||null)})},L0=(o,e)=>{if(o=o?o.filter(Boolean):[],!e&&!o.length)return;const a=new AbortController;let r=!1;const i=function(f){if(!r){r=!0,u();const g=f instanceof Error?f:this.reason;a.abort(g instanceof Oe?g:new ro(g instanceof Error?g.message:g))}};let l=e&&setTimeout(()=>{l=null,i(new Oe(`timeout of ${e}ms exceeded`,Oe.ETIMEDOUT))},e);const u=()=>{o&&(l&&clearTimeout(l),l=null,o.forEach(f=>{f.unsubscribe?f.unsubscribe(i):f.removeEventListener("abort",i)}),o=null)};o.forEach(f=>f.addEventListener("abort",i));const{signal:d}=a;return d.unsubscribe=()=>F.asap(u),d},M0=function*(o,e){let a=o.byteLength;if(a<e){yield o;return}let r=0,i;for(;r<a;)i=r+e,yield o.slice(r,i),r=i},$0=async function*(o,e){for await(const a of N0(o))yield*M0(a,e)},N0=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const e=o.getReader();try{for(;;){const{done:a,value:r}=await e.read();if(a)break;yield r}}finally{await e.cancel()}},zp=(o,e,a,r)=>{const i=$0(o,e);let l=0,u,d=f=>{u||(u=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:g,value:m}=await i.next();if(g){d(),f.close();return}let b=m.byteLength;if(a){let v=l+=b;a(v)}f.enqueue(new Uint8Array(m))}catch(g){throw d(g),g}},cancel(f){return d(f),i.return()}},{highWaterMark:2})};function I0(o){if(!o||typeof o!="string"||!o.startsWith("data:"))return 0;const e=o.indexOf(",");if(e<0)return 0;const a=o.slice(5,e),r=o.slice(e+1);if(/;base64/i.test(a)){let u=r.length;const d=r.length;for(let S=0;S<d;S++)if(r.charCodeAt(S)===37&&S+2<d){const E=r.charCodeAt(S+1),A=r.charCodeAt(S+2);(E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102)&&(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102)&&(u-=2,S+=2)}let f=0,g=d-1;const m=S=>S>=2&&r.charCodeAt(S-2)===37&&r.charCodeAt(S-1)===51&&(r.charCodeAt(S)===68||r.charCodeAt(S)===100);g>=0&&(r.charCodeAt(g)===61?(f++,g--):m(g)&&(f++,g-=3)),f===1&&g>=0&&(r.charCodeAt(g)===61||m(g))&&f++;const v=Math.floor(u/4)*3-(f||0);return v>0?v:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(r,"utf8");let l=0;for(let u=0,d=r.length;u<d;u++){const f=r.charCodeAt(u);if(f<128)l+=1;else if(f<2048)l+=2;else if(f>=55296&&f<=56319&&u+1<d){const g=r.charCodeAt(u+1);g>=56320&&g<=57343?(l+=4,u++):l+=3}else l+=3}return l}const vd="1.16.1",jp=64*1024,{isFunction:Bl}=F,Up=(o,...e)=>{try{return!!o(...e)}catch{return!1}},H0=o=>{const e=F.global!==void 0&&F.global!==null?F.global:globalThis,{ReadableStream:a,TextEncoder:r}=e;o=F.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},o);const{fetch:i,Request:l,Response:u}=o,d=i?Bl(i):typeof fetch=="function",f=Bl(l),g=Bl(u);if(!d)return!1;const m=d&&Bl(a),b=d&&(typeof r=="function"?(L=>M=>L.encode(M))(new r):async L=>new Uint8Array(await new l(L).arrayBuffer())),v=f&&m&&Up(()=>{let L=!1;const M=new l(yn.origin,{body:new a,method:"POST",get duplex(){return L=!0,"half"}}),R=M.headers.has("Content-Type");return M.body!=null&&M.body.cancel(),L&&!R}),S=g&&m&&Up(()=>F.isReadableStream(new u("").body)),E={stream:S&&(L=>L.body)};d&&["text","arrayBuffer","blob","formData","stream"].forEach(L=>{!E[L]&&(E[L]=(M,R)=>{let D=M&&M[L];if(D)return D.call(M);throw new Oe(`Response type '${L}' is not supported`,Oe.ERR_NOT_SUPPORT,R)})});const A=async L=>{if(L==null)return 0;if(F.isBlob(L))return L.size;if(F.isSpecCompliantForm(L))return(await new l(yn.origin,{method:"POST",body:L}).arrayBuffer()).byteLength;if(F.isArrayBufferView(L)||F.isArrayBuffer(L))return L.byteLength;if(F.isURLSearchParams(L)&&(L=L+""),F.isString(L))return(await b(L)).byteLength},T=async(L,M)=>{const R=F.toFiniteNumber(L.getContentLength());return R??A(M)};return async L=>{let{url:M,method:R,data:D,signal:U,cancelToken:j,timeout:P,onDownloadProgress:X,onUploadProgress:ge,responseType:Ee,headers:Ce,withCredentials:$e="same-origin",fetchOptions:Pe,maxContentLength:Xe,maxBodyLength:ht}=Hp(L);const Q=F.isNumber(Xe)&&Xe>-1,fe=F.isNumber(ht)&&ht>-1;let ye=i||fetch;Ee=Ee?(Ee+"").toLowerCase():"text";let te=L0([U,j&&j.toAbortSignal()],P),he=null;const x=te&&te.unsubscribe&&(()=>{te.unsubscribe()});let K;try{if(Q&&typeof M=="string"&&M.startsWith("data:")&&I0(M)>Xe)throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he);if(fe&&R!=="get"&&R!=="head"){const ve=await T(Ce,D);if(typeof ve=="number"&&isFinite(ve)&&ve>ht)throw new Oe("Request body larger than maxBodyLength limit",Oe.ERR_BAD_REQUEST,L,he)}if(ge&&v&&R!=="get"&&R!=="head"&&(K=await T(Ce,D))!==0){let ve=new l(M,{method:"POST",body:D,duplex:"half"}),He;if(F.isFormData(D)&&(He=ve.headers.get("content-type"))&&Ce.setContentType(He),ve.body){const[Ae,Et]=Mp(K,Ul($p(ge)));D=zp(ve.body,jp,Ae,Et)}}F.isString($e)||($e=$e?"include":"omit");const re=f&&"credentials"in l.prototype;if(F.isFormData(D)){const ve=Ce.getContentType();ve&&/^multipart\/form-data/i.test(ve)&&!/boundary=/i.test(ve)&&Ce.delete("content-type")}Ce.set("User-Agent","axios/"+vd,!1);const de={...Pe,signal:te,method:R.toUpperCase(),headers:Ep(Ce.normalize()),body:D,duplex:"half",credentials:re?$e:void 0};he=f&&new l(M,de);let se=await(f?ye(he,Pe):ye(M,de));if(Q){const ve=F.toFiniteNumber(se.headers.get("content-length"));if(ve!=null&&ve>Xe)throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he)}const me=S&&(Ee==="stream"||Ee==="response");if(S&&se.body&&(X||Q||me&&x)){const ve={};["status","statusText","headers"].forEach(ft=>{ve[ft]=se[ft]});const He=F.toFiniteNumber(se.headers.get("content-length")),[Ae,Et]=X&&Mp(He,Ul($p(X),!0))||[];let Rt=0;const _t=ft=>{if(Q&&(Rt=ft,Rt>Xe))throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he);Ae&&Ae(ft)};se=new u(zp(se.body,jp,_t,()=>{Et&&Et(),x&&x()}),ve)}Ee=Ee||"text";let Ne=await E[F.findKey(E,Ee)||"text"](se,L);if(Q&&!S&&!me){let ve;if(Ne!=null&&(typeof Ne.byteLength=="number"?ve=Ne.byteLength:typeof Ne.size=="number"?ve=Ne.size:typeof Ne=="string"&&(ve=typeof r=="function"?new r().encode(Ne).byteLength:Ne.length)),typeof ve=="number"&&ve>Xe)throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he)}return!me&&x&&x(),await new Promise((ve,He)=>{Lp(ve,He,{data:Ne,headers:Cn.from(se.headers),status:se.status,statusText:se.statusText,config:L,request:he})})}catch(re){if(x&&x(),te&&te.aborted&&te.reason instanceof Oe){const de=te.reason;throw de.config=L,he&&(de.request=he),re!==de&&(de.cause=re),de}throw re&&re.name==="TypeError"&&/Load failed|fetch/i.test(re.message)?Object.assign(new Oe("Network Error",Oe.ERR_NETWORK,L,he,re&&re.response),{cause:re.cause||re}):Oe.from(re,re&&re.code,L,he,re&&re.response)}}},z0=new Map,Bp=o=>{let e=o&&o.env||{};const{fetch:a,Request:r,Response:i}=e,l=[r,i,a];let u=l.length,d=u,f,g,m=z0;for(;d--;)f=l[d],g=m.get(f),g===void 0&&m.set(f,g=d?new Map:H0(e)),m=g;return g};Bp();const Sd={http:c0,xhr:O0,fetch:{get:Bp}};F.forEach(Sd,(o,e)=>{if(o){try{Object.defineProperty(o,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(o,"adapterName",{__proto__:null,value:e})}});const Pp=o=>`- ${o}`,j0=o=>F.isFunction(o)||o===null||o===!1;function U0(o,e){o=F.isArray(o)?o:[o];const{length:a}=o;let r,i;const l={};for(let u=0;u<a;u++){r=o[u];let d;if(i=r,!j0(r)&&(i=Sd[(d=String(r)).toLowerCase()],i===void 0))throw new Oe(`Unknown adapter '${d}'`);if(i&&(F.isFunction(i)||(i=i.get(e))))break;l[d||"#"+u]=i}if(!i){const u=Object.entries(l).map(([f,g])=>`adapter ${f} `+(g===!1?"is not supported by the environment":"is not available in the build"));let d=a?u.length>1?`since :
|
||
`+u.map(Pp).join(`
|
||
`):" "+Pp(u[0]):"as no adapter specified";throw new Oe("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return i}const qp={getAdapter:U0,adapters:Sd};function wd(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new ro(null,o)}function Gp(o){return wd(o),o.headers=Cn.from(o.headers),o.data=bd.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),qp.getAdapter(o.adapter||ao.adapter,o)(o).then(function(r){wd(o),o.response=r;try{r.data=bd.call(o,o.transformResponse,r)}finally{delete o.response}return r.headers=Cn.from(r.headers),r},function(r){if(!Op(r)&&(wd(o),r&&r.response)){o.response=r.response;try{r.response.data=bd.call(o,o.transformResponse,r.response)}finally{delete o.response}r.response.headers=Cn.from(r.response.headers)}return Promise.reject(r)})}const Pl={};["object","boolean","number","function","string","symbol"].forEach((o,e)=>{Pl[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});const Vp={};Pl.transitional=function(e,a,r){function i(l,u){return"[Axios v"+vd+"] Transitional option '"+l+"'"+u+(r?". "+r:"")}return(l,u,d)=>{if(e===!1)throw new Oe(i(u," has been removed"+(a?" in "+a:"")),Oe.ERR_DEPRECATED);return a&&!Vp[u]&&(Vp[u]=!0,console.warn(i(u," has been deprecated since v"+a+" and will be removed in the near future"))),e?e(l,u,d):!0}},Pl.spelling=function(e){return(a,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function B0(o,e,a){if(typeof o!="object")throw new Oe("options must be an object",Oe.ERR_BAD_OPTION_VALUE);const r=Object.keys(o);let i=r.length;for(;i-- >0;){const l=r[i],u=Object.prototype.hasOwnProperty.call(e,l)?e[l]:void 0;if(u){const d=o[l],f=d===void 0||u(d,l,o);if(f!==!0)throw new Oe("option "+l+" must be "+f,Oe.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Oe("Unknown option "+l,Oe.ERR_BAD_OPTION)}}const ql={assertOptions:B0,validators:Pl},Jn=ql.validators;let fi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new kp,response:new kp}}async request(e,a){try{return await this._request(e,a)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const l=(()=>{if(!i.stack)return"";const u=i.stack.indexOf(`
|
||
`);return u===-1?"":i.stack.slice(u+1)})();try{if(!r.stack)r.stack=l;else if(l){const u=l.indexOf(`
|
||
`),d=u===-1?-1:l.indexOf(`
|
||
`,u+1),f=d===-1?"":l.slice(d+1);String(r.stack).endsWith(f)||(r.stack+=`
|
||
`+l)}}catch{}}throw r}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=di(this.defaults,a);const{transitional:r,paramsSerializer:i,headers:l}=a;r!==void 0&&ql.assertOptions(r,{silentJSONParsing:Jn.transitional(Jn.boolean),forcedJSONParsing:Jn.transitional(Jn.boolean),clarifyTimeoutError:Jn.transitional(Jn.boolean),legacyInterceptorReqResOrdering:Jn.transitional(Jn.boolean)},!1),i!=null&&(F.isFunction(i)?a.paramsSerializer={serialize:i}:ql.assertOptions(i,{encode:Jn.function,serialize:Jn.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),ql.assertOptions(a,{baseUrl:Jn.spelling("baseURL"),withXsrfToken:Jn.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let u=l&&F.merge(l.common,l[a.method]);l&&F.forEach(["delete","get","head","post","put","patch","query","common"],E=>{delete l[E]}),a.headers=Cn.concat(u,l);const d=[];let f=!0;this.interceptors.request.forEach(function(A){if(typeof A.runWhen=="function"&&A.runWhen(a)===!1)return;f=f&&A.synchronous;const T=a.transitional||pd;T&&T.legacyInterceptorReqResOrdering?d.unshift(A.fulfilled,A.rejected):d.push(A.fulfilled,A.rejected)});const g=[];this.interceptors.response.forEach(function(A){g.push(A.fulfilled,A.rejected)});let m,b=0,v;if(!f){const E=[Gp.bind(this),void 0];for(E.unshift(...d),E.push(...g),v=E.length,m=Promise.resolve(a);b<v;)m=m.then(E[b++],E[b++]);return m}v=d.length;let S=a;for(;b<v;){const E=d[b++],A=d[b++];try{S=E(S)}catch(T){A.call(this,T);break}}try{m=Gp.call(this,S)}catch(E){return Promise.reject(E)}for(b=0,v=g.length;b<v;)m=m.then(g[b++],g[b++]);return m}getUri(e){e=di(this.defaults,e);const a=Np(e.baseURL,e.url,e.allowAbsoluteUrls);return Rp(a,e.params,e.paramsSerializer)}};F.forEach(["delete","get","head","options"],function(e){fi.prototype[e]=function(a,r){return this.request(di(r||{},{method:e,url:a,data:(r||{}).data}))}}),F.forEach(["post","put","patch","query"],function(e){function a(r){return function(l,u,d){return this.request(di(d||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}fi.prototype[e]=a(),e!=="query"&&(fi.prototype[e+"Form"]=a(!0))});let P0=class kS{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(l){a=l});const r=this;this.promise.then(i=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](i);r._listeners=null}),this.promise.then=i=>{let l;const u=new Promise(d=>{r.subscribe(d),l=d}).then(i);return u.cancel=function(){r.unsubscribe(l)},u},e(function(l,u,d){r.reason||(r.reason=new ro(l,u,d),a(r.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 a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const e=new AbortController,a=r=>{e.abort(r)};return this.subscribe(a),e.signal.unsubscribe=()=>this.unsubscribe(a),e.signal}static source(){let e;return{token:new kS(function(i){e=i}),cancel:e}}};function q0(o){return function(a){return o.apply(null,a)}}function G0(o){return F.isObject(o)&&o.isAxiosError===!0}const Cd={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Cd).forEach(([o,e])=>{Cd[e]=o});function Fp(o){const e=new fi(o),a=hp(fi.prototype.request,e);return F.extend(a,fi.prototype,e,{allOwnKeys:!0}),F.extend(a,e,null,{allOwnKeys:!0}),a.create=function(i){return Fp(di(o,i))},a}const Pt=Fp(ao);Pt.Axios=fi,Pt.CanceledError=ro,Pt.CancelToken=P0,Pt.isCancel=Op,Pt.VERSION=vd,Pt.toFormData=jl,Pt.AxiosError=Oe,Pt.Cancel=Pt.CanceledError,Pt.all=function(e){return Promise.all(e)},Pt.spread=q0,Pt.isAxiosError=G0,Pt.mergeConfig=di,Pt.AxiosHeaders=Cn,Pt.formToJSON=o=>Dp(F.isHTMLForm(o)?new FormData(o):o),Pt.getAdapter=qp.getAdapter,Pt.HttpStatusCode=Cd,Pt.default=Pt;const{Axios:sT,AxiosError:oT,CanceledError:lT,isCancel:cT,CancelToken:uT,VERSION:dT,all:fT,Cancel:hT,isAxiosError:gT,spread:pT,toFormData:mT,AxiosHeaders:yT,HttpStatusCode:bT,formToJSON:vT,getAdapter:ST,mergeConfig:wT,create:CT}=Pt,Ed="g7.identity.redirectStash",Gl=ct("IdentityGuardInterceptor");class St{static setLauncher(e){this.launcher=e}static hasLauncher(){return this.launcher!==null}static markDomainNoticeShown(){this.domainNoticeShown=!0}static consumeDomainNoticeShown(){const e=this.domainNoticeShown;return this.domainNoticeShown=!1,e}static resolveDeferred(e){const a=this.deferredResolver;if(!a){Gl.warn("IdentityGuardInterceptor.resolveDeferred 호출됐지만 대기 중인 launcher 가 없습니다. 모달이 launcher 외부에서 열렸는지 확인하세요.");return}this.deferredResolver=null,a(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,a){return e===428&&typeof a=="object"&&a!==null&&a.error_code==="identity_verification_required"}static async handle(e,a,r){this.domainNoticeShown=!1;const i=this.launcher??F0,u=!!(r&&(r.email||r.phone))?{...e.verification,target:r}:e.verification,d=await i(u);if(d.status!=="verified")return null;const f=u.return_request;if(!f)return null;const g=V0(f.url,d.token);return fetch(g,{method:f.method,headers:a?.headers??{Accept:"application/json","Content-Type":"application/json"},body:a?.body,credentials:a?.credentials??"same-origin"})}static redirectExternally(e){const a=e.redirect_url;if(!a)return Gl.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 r={return_url:window.location.href,payload:e,stashed_at:Date.now()};try{window.sessionStorage?.setItem(Ed,JSON.stringify(r))}catch(i){Gl.warn("sessionStorage 접근 실패 — stash 없이 redirect 합니다.",i)}window.location.href=a}return new Promise(()=>{})}static reset(){if(this.deferredResolver){const e=this.deferredResolver;this.deferredResolver=null;try{e({status:"cancelled"})}catch{}}this.launcher=null,this.domainNoticeShown=!1}}$(St,"launcher",null),$(St,"deferredResolver",null),$(St,"domainNoticeShown",!1);function V0(o,e){if(!e)return o;try{const a=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(o,a);return r.searchParams.set("verification_token",e),/^https?:\/\//i.test(o)?r.toString():`${r.pathname}${r.search}${r.hash}`}catch{const a=o.includes("?")?"&":"?";return`${o}${a}verification_token=${encodeURIComponent(e)}`}}const F0=async o=>{if(typeof window>"u")return{status:"cancelled"};if(o.render_hint==="external_redirect"||o.redirect_url)return St.redirectExternally(o);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 a=window.location.href,r={return_url:a,payload:o,stashed_at:Date.now()};try{window.sessionStorage?.setItem(Ed,JSON.stringify(r))}catch{}const i=`/identity/challenge?return=${encodeURIComponent(a)}`;try{await e.dispatch({handler:"navigate",params:{path:i}})}catch(l){Gl.warn("navigate 실패 — window.location 으로 폴백",l),window.location.href=i}return new Promise(()=>{})},K0=ct("ApiClient");function _d(){return typeof window<"u"&&window.__G7_DEVTOOLS__?window.__G7_DEVTOOLS__:null}class W0{constructor(e={}){$(this,"client");$(this,"config");$(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=Pt.create({baseURL:this.config.baseURL,timeout:this.config.timeout,headers:{"Content-Type":"application/json",Accept:"application/json"},paramsSerializer:{serialize:a=>{const r=[];for(const[i,l]of Object.entries(a))if(l!=null)if(Array.isArray(l)){const u=i.endsWith("[]")?i:`${i}[]`;for(const d of l)r.push(`${encodeURIComponent(u)}=${encodeURIComponent(String(d))}`)}else r.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(l))}`);return r.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 a=this.getToken();if(a&&e.headers&&(e.headers.Authorization=`Bearer ${a}`),typeof window<"u"&&e.headers){const i=localStorage.getItem("g7_locale");i&&(e.headers["Accept-Language"]=i)}const r=_d();if(r?.isEnabled()){const i=this.buildFullUrl(e),l=(e.method||"GET").toUpperCase(),u=r.trackRequest(i,l,{requestBody:e.data});e._devToolsRequestId=u}return e},e=>Promise.reject(e)),this.client.interceptors.response.use(e=>{const a=e.config,r=a._devToolsRequestId;if(r){const i=_d();i?.isEnabled()&&i.completeRequest(r,e.status,e.data),a._devToolsRequestId=null}return e},async e=>{const a=e.config,r=a?.url||"",l=["/auth/","/layouts/"].some(u=>r.includes(u));if(e.response?.status===401&&!a?._retry&&!l){if(a._retry=!0,await ha.getInstance().refreshToken()){const f=this.getToken();return f&&(a.headers.Authorization=`Bearer ${f}`),a._devToolsRequestId=null,this.client(a)}return this.completeDevToolsRequest(a,e),this.removeToken(),this.config.onUnauthorized&&this.config.onUnauthorized(),Promise.reject(e)}if(e.response?.status===401&&l)return this.completeDevToolsRequest(a,e),Promise.reject(e);if(St.isIdentityRequired(e.response?.status,e.response?.data)){this.completeDevToolsRequest(a,e);const u={},d=a?.headers??{};for(const[v,S]of Object.entries(d))typeof S=="string"&&(u[v]=S);let f;a?.data!==void 0&&a?.data!==null&&(f=typeof a.data=="string"?a.data:JSON.stringify(a.data),u["Content-Type"]=u["Content-Type"]??"application/json");const g=a?.identity_target,m=await St.handle(e.response.data,{headers:u,body:f,credentials:"same-origin"},g);if(!m)return Promise.reject(e);let b=null;try{b=await m.json()}catch{b=null}return m.ok?{...e.response,status:m.status,data:b}:Promise.reject(Object.assign(new Error("replay failed"),{response:{status:m.status,data:b}}))}return e.response?.status===403?(this.completeDevToolsRequest(a,e),this.callOnError(e),Promise.reject(e)):(this.completeDevToolsRequest(a,e),e.response&&this.callOnError(e),Promise.reject(e))})}async get(e,a){return(await this.client.get(e,a)).data}async post(e,a,r){return(await this.client.post(e,a,r)).data}async put(e,a,r){return(await this.client.put(e,a,r)).data}async patch(e,a,r){return(await this.client.patch(e,a,r)).data}async delete(e,a){return(await this.client.delete(e,a)).data}getInstance(){return this.client}setOnUnauthorized(e){this.config.onUnauthorized=e}setOnError(e){this.config.onError=e}completeDevToolsRequest(e,a){if(!e?._devToolsRequestId)return;const r=_d();if(!r?.isEnabled())return;const i=e._devToolsRequestId;e._devToolsRequestId=null,a.response?r.completeRequest(i,a.response.status,a.response.data):a.request?r.failRequest(i,a.message||"Network error"):r.failRequest(i,a.message||"Request error")}buildFullUrl(e){let a=e.url||"";if(e.baseURL&&!a.startsWith("http")&&(a=`${e.baseURL}${a.startsWith("/")?"":"/"}${a}`),e.params&&typeof e.params=="object"){const r=e.params,i=[];for(const[l,u]of Object.entries(r))if(u!=null)if(Array.isArray(u)){const d=l.endsWith("[]")?l:`${l}[]`;for(const f of u)i.push(`${encodeURIComponent(d)}=${encodeURIComponent(String(f))}`)}else i.push(`${encodeURIComponent(l)}=${encodeURIComponent(String(u))}`);i.length>0&&(a+=(a.includes("?")?"&":"?")+i.join("&"))}return a}callOnError(e){if(!this.config.onError)return;const a={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(a)}catch(r){K0.error("Error in onError handler:",r)}}}let Ad=null;function $a(){return Ad||(Ad=new W0),Ad}const io=ct("AuthManager");function es(o,e,a,r){try{window.G7Core?.devTools?.trackAuthEvent?.(o,e,a,r)}catch{}}const Vl={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"}},wa=class wa{constructor(){$(this,"state");$(this,"config");$(this,"isRefreshing",!1);$(this,"refreshPromise",null);$(this,"eventHandlers",new Map);this.state={isAuthenticated:!1,user:null,type:null},this.config=new Map,this.config.set("admin",Vl.admin),this.config.set("user",Vl.user)}static getInstance(){return wa.instance||(wa.instance=new wa),wa.instance}on(e,a){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(a)}emit(e,...a){const r=this.eventHandlers.get(e);r&&r.forEach(i=>i(...a))}isAuthenticated(){return this.state.isAuthenticated}getUser(){return this.state.user}getAuthType(){return this.state.type}async checkAuth(e){const a=$a();if(!a.getToken())return this.clearState(),!1;const i=this.config.get(e);if(!i)return io.error(`Unknown auth type: ${e}`),!1;try{const l=await a.get(i.userEndpoint);return l.success&&l.data?(this.state={isAuthenticated:!0,user:l.data,type:e},this.emit("authStateChange",this.state),!0):(this.clearState(),!1)}catch(l){return l.response?.status===401&&await this.refreshToken()?this.checkAuth(e):(this.clearState(),!1)}}async preloadAuth(e){try{return await this.checkAuth(e)}catch(a){return io.warn(`Preload auth failed for type ${e}:`,a),!1}}async login(e,a,r){const i=$a();if(!this.config.get(e))throw new Error(`Unknown auth type: ${e}`);const u=e==="admin"?Vl.admin.loginEndpoint:Vl.user.loginEndpoint;try{const d=r?.headers?{headers:r.headers}:void 0,f=await i.post(u,a,d);if(f.success&&f.data){i.setToken(f.data.token);const g=f.data.user.language,m=localStorage.getItem(wa.LOCALE_STORAGE_KEY),b=g&&g!==m;if(g)try{localStorage.setItem(wa.LOCALE_STORAGE_KEY,g)}catch(v){io.warn("Failed to save user language to localStorage:",v)}return this.state={isAuthenticated:!0,user:f.data.user,type:e},this.emit("login",this.state),this.emit("authStateChange",this.state),es("login",!0,void 0,{userId:f.data.user.uuid,email:f.data.user.email,type:e}),b&&window.__templateApp&&window.__templateApp.changeLocale(g),f.data.user}throw new Error("Login failed")}catch(d){this.clearState();const f=d.response?.data?.message,g=new Error(f||d.message||"Login failed");throw g.response=d.response,g.status=d.response?.status,es("login",!1,g.message,{type:e,status:d.response?.status}),g}}async logout(){const e=$a(),a=this.state.type?this.config.get(this.state.type):null;try{a&&await e.post(a.logoutEndpoint)}catch(r){io.warn("Logout API call failed:",r)}finally{e.removeToken();const r={...this.state};if(this.clearState(),this.emit("logout",r),this.emit("authStateChange",this.state),es("logout",!0,void 0,{previousType:r.type}),a&&r.type){const i=window.location.pathname+window.location.search;window.location.href=this.getLoginRedirectUrl(r.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 a=this.config.get(e);if(!a)return!1;const r=$a();try{const i=await r.post(a.refreshEndpoint);return i.success&&i.data?.token?(r.setToken(i.data.token),this.emit("tokenRefreshed"),es("token-refresh",!0,void 0,{type:e}),!0):(es("token-refresh",!1,"No token in response",{type:e}),!1)}catch(i){return io.error("Token refresh failed:",i),es("token-refresh",!1,i instanceof Error?i.message:"Unknown error",{type:e}),!1}}getLoginRedirectUrl(e,a,r){const i=this.config.get(e);if(!i)return"/login";const l=encodeURIComponent(a);let u=`${i.loginPath}?redirect=${l}`;return r&&(u+=`&reason=${encodeURIComponent(r)}`),u}updateConfig(e,a){if(a.loginPath!==void 0){const i=a.loginPath;if(!i.startsWith("/")||i.startsWith("//"))throw new Error(`AuthManager.updateConfig: loginPath must be a same-origin path starting with '/' (got: ${i})`)}const r=this.config.get(e);r&&this.config.set(e,{...r,...a})}getRedirectUrl(e){const r=this.config.get(e)?.defaultPath||"/",l=new URLSearchParams(window.location.search).get("redirect");if(l)try{const u=decodeURIComponent(l);if(u.startsWith("/"))return u}catch{}return r}getConfig(e){return this.config.get(e)}clearState(){this.state={isAuthenticated:!1,user:null,type:null}}static resetInstance(){wa.instance=null}};$(wa,"instance"),$(wa,"LOCALE_STORAGE_KEY","g7_locale");let ha=wa;const Kp={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}}"}}},Ja={findHandler(o,e){if(o){if(o[e])return o[e];if(o[String(e)])return o[String(e)];if(o.default)return o.default}},normalizeOnError(o){return o?Array.isArray(o)?o:[o]:[]},injectErrorCode(o,e,a){if(o.handler!=="showErrorPage"||o.params?.errorCode!==void 0)return o;const r=typeof e=="string"?parseInt(e,10):e,i=isNaN(r)?a:r;return i===void 0?o:{...o,params:{...o.params,errorCode:i}}}},ga=ct("ErrorHandlingResolver"),kr=class kr{constructor(){$(this,"templateErrorHandling",null);$(this,"layoutErrorHandling",null);$(this,"executeAction",null)}static getInstance(){return kr.instance||(kr.instance=new kr),kr.instance}static resetInstance(){kr.instance=null}setTemplateConfig(e){this.templateErrorHandling=e,ga.log("Template config set:",e)}setLayoutConfig(e){this.layoutErrorHandling=e,ga.log("Layout config set:",e)}setActionExecutor(e){this.executeAction=e}resolve(e,a={}){const{errorHandling:r,onError:i}=a;ga.log("Resolving error:",e,{hasActionErrorHandling:!!r,hasActionOnError:!!i,hasLayoutConfig:!!this.layoutErrorHandling,hasTemplateConfig:!!this.templateErrorHandling});let l=Ja.findHandler(r,e);if(l){const u=this.getMatchedKey(r,e);return{handler:Ja.injectErrorCode(l,u,e),level:"action",matchedKey:u}}if(i){const u=Ja.normalizeOnError(i);if(u.length>0)return{handler:u.length===1?u[0]:{handler:"sequence",actions:u},level:"action",matchedKey:"onError"}}if(l=Ja.findHandler(this.layoutErrorHandling||void 0,e),l){const u=this.getMatchedKey(this.layoutErrorHandling,e);return{handler:Ja.injectErrorCode(l,u,e),level:"layout",matchedKey:u}}if(l=Ja.findHandler(this.templateErrorHandling||void 0,e),l){const u=this.getMatchedKey(this.templateErrorHandling,e);return{handler:Ja.injectErrorCode(l,u,e),level:"template",matchedKey:u}}if(l=Ja.findHandler(Kp,e),l){const u=this.getMatchedKey(Kp,e);return{handler:Ja.injectErrorCode(l,u,e),level:"system",matchedKey:u}}return{handler:null,level:null,matchedKey:null}}async execute(e,a){if(!this.executeAction){ga.error("Action executor is not set");return}ga.log("Executing handler:",e.handler,{errorContext:a});try{return await this.executeAction(e,{error:a})}catch(r){throw ga.error("Failed to execute handler:",r),r}}async resolveAndExecute(e,a,r={}){const i=this.resolve(e,r);if(ga.log("Resolve result:",{errorCode:e,handler:i.handler?.handler,level:i.level,matchedKey:i.matchedKey}),!i.handler)return ga.warn("No handler found for error:",e),{handled:!1};try{return{handled:!0,result:await this.execute(i.handler,a)}}catch(l){return ga.error("Handler execution failed:",l),{handled:!1}}}getMatchedKey(e,a){return e[a]?a:e[String(a)]?String(a):"default"}clearLayoutConfig(){this.layoutErrorHandling=null,ga.log("Layout config cleared")}clearAllConfig(){this.templateErrorHandling=null,this.layoutErrorHandling=null,ga.log("All config cleared")}getConfigStatus(){return{hasTemplate:this.templateErrorHandling!==null,hasLayout:this.layoutErrorHandling!==null,hasExecutor:this.executeAction!==null}}};$(kr,"instance",null);let xd=kr;function pa(){return xd.getInstance()}var Td={exports:{}},so={};var Wp;function Y0(){if(Wp)return so;Wp=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function a(r,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:o,type:r,key:u,ref:i!==void 0?i:null,props:l}}return so.Fragment=e,so.jsx=a,so.jsxs=a,so}var Yp;function X0(){return Yp||(Yp=1,Td.exports=Y0()),Td.exports}var ut=X0();const J0=Wa({__proto__:null,default:Ya(ut)},[ut]),Rd=ct("ParentContextProvider"),Xp=N.createContext(null);let Fl=null;function kd(){Fl?(Rd.log("[triggerModalParentUpdate] 모달 부모 컨텍스트 업데이트 트리거"),Fl()):Rd.warn("[triggerModalParentUpdate] Provider가 아직 마운트되지 않음")}const Jp=({children:o})=>{const[e,a]=N.useState(0),r=N.useRef(!0),i=N.useCallback(()=>{const u=window.__g7LayoutContextStack||[];return u[u.length-1]?.dataContext},[]);N.useEffect(()=>(r.current=!0,Fl=()=>{r.current&&(a(u=>u+1),Rd.log("[ParentContextProvider] 버전 업데이트됨"))},()=>{r.current=!1,Fl=null}),[]);const l={version:e,getParentDataContext:i};return ut.jsx(Xp.Provider,{value:l,children:o})};function Q0(){return N.useContext(Xp)}const H=ct("ActionDispatcher"),Qp=new Set(["navigate","navigateBack","navigateForward","replaceUrl","refresh","logout"]),Z0=new Set(["redirect"]);function Un(){try{return window.G7Core?.devTools}catch{return}}class It extends Error{constructor(a,r,i){super(a);$(this,"action");$(this,"originalError");$(this,"unknownHandler",!1);this.action=r,this.originalError=i,this.name="ActionError"}}const cs=class cs{constructor(e={},a,r){$(this,"bindingEngine");$(this,"translationEngine");$(this,"translationContext");$(this,"customHandlers",new Map);$(this,"defaultContext");$(this,"globalStateUpdater");$(this,"errorHandlingSetup",!1);$(this,"debounceTimers",new Map);$(this,"pendingDebounceFlushers",new Map);$(this,"debounceAccumulatedValues",new Map);$(this,"globalHeaders",[]);$(this,"namedActions",{});$(this,"previewMode",!1);$(this,"intervals",new Map);this.bindingEngine=new wn,this.translationEngine=a,this.translationContext=r,this.defaultContext=e,this.registerDefaultHandlers(),this.setupErrorHandling()}setGlobalHeaders(e){this.globalHeaders=e||[]}setNamedActions(e){this.namedActions=e||{};const a=Un();a?.isEnabled?.()&&a.setNamedActionDefinitions?.(this.namedActions),H.log("[setNamedActions] registered:",Object.keys(this.namedActions))}getNamedActions(){return this.namedActions}setPreviewMode(e){this.previewMode=e,H.log("Preview mode:",e?"enabled":"disabled")}isPreviewMode(){return this.previewMode}static getPreviewSuppressedHandlers(){return Qp}static getPreviewSuppressedLayoutFeatures(){return Z0}resolveActionRef(e){if(!e.actionRef)return e;const a=this.namedActions[e.actionRef];if(!a)return H.warn(`[resolveActionRef] named action not found: "${e.actionRef}"`),e;const r=Un();r?.isEnabled?.()&&r.trackNamedActionRef?.({actionRefName:e.actionRef,resolvedHandler:a.handler,timestamp:Date.now()});const{actionRef:i,type:l,key:u,event:d,...f}=e,g={...a,...Object.fromEntries(Object.entries(f).filter(([,m])=>m!==void 0)),type:l??a.type};return u!==void 0&&(g.key=u),d!==void 0&&(g.event=d),g}matchesPattern(e,a){if(a==="*")return!0;const r=a.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${r}$`).test(e)}getMatchingGlobalHeaders(e,a){const r={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([l,u])=>{const d=Xi(u,a,{skipCache:!0});d!=null&&d!==""&&(r[l]=String(d))});return r}setupErrorHandling(){if(this.errorHandlingSetup)return;pa().setActionExecutor(async(a,r)=>{const i={type:"click",handler:a.handler,target:a.target,params:a.params,actions:a.actions},l={data:{...this.defaultContext.data,error:r.error}};return await this.dispatchAction(i,l)}),this.errorHandlingSetup=!0}registerDefaultHandlers(){this.registerHandler("refetchDataSource",async(a,r)=>{const i=a.params?.dataSourceId,l=a.params?.sync;if(!i){H.warn("refetchDataSource: dataSourceId is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.refetch){const u=window.G7Core?.state?.get?.()||{},d={...r.state?._global,...u},f=window.G7Core?.state?.getLocal?.()||{},g=r.data?._local||r.state||{},m={...f,...g},b=r.isolatedContext?.state;H.log("[refetchDataSource] localStateOverride:",m),await window.G7Core.dataSource.refetch(i,{...l?{sync:!0}:{},...d?{globalStateOverride:d}:{},...m?{localStateOverride:m}:{},...b?{isolatedStateOverride:b}:{}})}else H.warn("refetchDataSource: G7Core.dataSource.refetch is not available")}),this.registerHandler("appendDataSource",async(a,r)=>{const{dataSourceId:i,dataPath:l,newData:u}=a.params||{};if(!i){H.warn("appendDataSource: dataSourceId is required");return}if(u===void 0){H.warn("appendDataSource: newData is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.updateData){if(!Array.isArray(u)){H.warn("appendDataSource: newData must be an array, got:",typeof u,u);return}await window.G7Core.dataSource.updateData(i,l||null,u,"append")}else H.warn("appendDataSource: G7Core.dataSource.updateData is not available")}),this.registerHandler("updateDataSource",async(a,r)=>{const{dataSourceId:i,data:l,merge:u=!1}=a.params||{};if(!i){H.warn("updateDataSource: dataSourceId is required");return}if(l===void 0){H.warn("updateDataSource: data is required");return}typeof window<"u"&&window.G7Core?.dataSource?.set?(H.log(`[updateDataSource] Updating dataSource '${i}' with:`,l),window.G7Core.dataSource.set(i,l,{merge:u})):H.warn("updateDataSource: G7Core.dataSource.set is not available")}),this.registerHandler("scrollIntoView",async(a,r)=>{const{selector:i,behavior:l="smooth",block:u="nearest",inline:d="nearest",waitForElement:f=!1,timeout:g=2e3,delay:m=0,retryCount:b=0,retryInterval:v=50,scrollContainer:S}=a.params||{};if(!i){H.warn("scrollIntoView: selector is required");return}if(typeof window>"u"||typeof document>"u"){H.warn("scrollIntoView: window/document is not available");return}let E=null;if(f){if(E=await new Promise(A=>{const T=document.querySelector(i);if(T){A(T);return}const L=setTimeout(()=>{M.disconnect(),A(null)},g),M=new MutationObserver(()=>{const R=document.querySelector(i);R&&(clearTimeout(L),M.disconnect(),A(R))});M.observe(document.body,{childList:!0,subtree:!0})}),!E){H.warn(`scrollIntoView: element not found for selector "${i}" after ${g}ms timeout`);return}}else{m>0&&await new Promise(T=>setTimeout(T,m)),E=document.querySelector(i);let A=0;for(;!E&&A<b;)await new Promise(T=>setTimeout(T,v)),E=document.querySelector(i),A++;if(!E){H.warn(`scrollIntoView: element not found for selector "${i}" after ${A+1} attempts`);return}}if(S){const A=document.querySelector(S);if(!A){H.warn(`scrollIntoView: container not found for selector "${S}"`);return}const T=E.getBoundingClientRect(),L=A.getBoundingClientRect(),M=T.top-L.top+A.scrollTop,R=M+T.height;let D;switch(u){case"start":D=M;break;case"center":D=M-A.clientHeight/2+T.height/2;break;case"end":D=R-A.clientHeight;break;default:const U=T.top<L.top,j=T.bottom>L.bottom;if(U)D=M;else if(j)D=R-A.clientHeight;else return;break}A.scrollTo({top:Math.max(0,D),behavior:l});return}E.scrollIntoView({behavior:l,block:u,inline:d})}),this.registerHandler("reloadExtensions",async(a,r)=>{if(typeof window>"u"){H.warn("reloadExtensions: window is not available");return}const i=window.__templateApp;if(!i){H.warn("reloadExtensions: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState()}catch(d){throw H.error("reloadExtensions: reloadExtensionState failed",d),d}else H.warn("reloadExtensions: TemplateApp.reloadExtensionState unavailable");const{moduleInfo:l,pluginInfo:u}=a.params||{};if(l)try{await this.executeAction({handler:"reloadModuleHandlers",params:a.params},r)}catch(d){H.error("reloadExtensions: reloadModuleHandlers failed",d)}if(u)try{await this.executeAction({handler:"reloadPluginHandlers",params:a.params},r)}catch(d){H.error("reloadExtensions: reloadPluginHandlers failed",d)}H.log("reloadExtensions: done")}),this.registerHandler("reloadRoutes",async(a,r)=>{if(typeof window>"u"){H.warn("reloadRoutes: window is not available");return}const i=window.__templateApp;if(!i){H.warn("reloadRoutes: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState(),H.log("reloadRoutes: delegated to reloadExtensionState")}catch(l){throw H.error("reloadRoutes: Failed to reload routes",l),l}else{const l=i.getRouter?.();l&&(await l.loadRoutes(),H.log("reloadRoutes: Routes reloaded (legacy fallback)"))}}),this.registerHandler("refresh",async(a,r)=>{if(typeof window>"u"){H.warn("refresh: window is not available");return}const i=Number(a.params?.delayMs??0);i>0&&await new Promise(l=>setTimeout(l,i)),window.location.reload()}),this.registerHandler("remount",async(a,r)=>{const{componentId:i}=a.params||{};if(!i){H.warn("remount: componentId parameter is required");return}if(!this.globalStateUpdater){H.warn("remount: globalStateUpdater is not set");return}const d=(window.G7Core?.state?.get()||{})._global?._remountKeys||{},f=d[i]||0;this.globalStateUpdater({_remountKeys:{...d,[i]:f+1}}),H.log(`remount: ${i} key incremented to ${f+1}`)}),this.registerHandler("reloadTranslations",async(a,r)=>{if(typeof window>"u"){H.warn("reloadTranslations: window is not available");return}const i=window.__templateApp;if(!i){H.warn("reloadTranslations: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState(),H.log("reloadTranslations: delegated to reloadExtensionState")}catch(l){throw H.error("reloadTranslations: Failed to reload translations",l),l}}),this.registerHandler("reloadModuleHandlers",async(a,r)=>{if(typeof window>"u"){H.warn("reloadModuleHandlers: window is not available");return}const{moduleInfo:i,action:l}=a.params||{};if(!i){H.warn("reloadModuleHandlers: moduleInfo is required");return}const u=i.data||i;if(!u.identifier){H.warn("reloadModuleHandlers: moduleInfo with identifier is required");return}if(!l||l!=="add"&&l!=="remove"){H.warn('reloadModuleHandlers: action must be "add" or "remove"');return}const d=window.G7Config;if(!d){H.warn("reloadModuleHandlers: G7Config not available");return}const f=u.identifier;try{if(l==="add"){if(u.assets&&(d.moduleAssets=d.moduleAssets||{},d.moduleAssets[f]=u.assets,H.log(`reloadModuleHandlers: Added assets for ${f}`),u.assets.js)){const g=u.assets.js,m=`module-${f}`;if(document.getElementById(m)){H.warn(`reloadModuleHandlers: Script ${m} already loaded`);return}const b=document.createElement("script");if(b.id=m,b.src=g,b.async=!0,await new Promise((v,S)=>{b.onload=()=>{H.log(`reloadModuleHandlers: Script loaded successfully for ${f}`),v()},b.onerror=()=>{H.error(`reloadModuleHandlers: Failed to load script for ${f}`),S(new Error(`Failed to load module script: ${g}`))},document.head.appendChild(b)}),u.assets.css){const v=u.assets.css,S=`module-css-${f}`;if(!document.getElementById(S)){const E=document.createElement("link");E.id=S,E.rel="stylesheet",E.href=v,document.head.appendChild(E),H.log(`reloadModuleHandlers: CSS loaded for ${f}`)}}}}else if(l==="remove"){d.moduleAssets&&d.moduleAssets[f]&&(delete d.moduleAssets[f],H.log(`reloadModuleHandlers: Removed assets for ${f}`));const g=`module-${f}`,m=document.getElementById(g);m&&(m.remove(),H.log(`reloadModuleHandlers: Removed script for ${f}`));const b=`module-css-${f}`,v=document.getElementById(b);v&&(v.remove(),H.log(`reloadModuleHandlers: Removed CSS for ${f}`))}}catch(g){throw H.error(`reloadModuleHandlers: Failed to ${l} module assets`,g),g}}),this.registerHandler("reloadPluginHandlers",async(a,r)=>{if(typeof window>"u"){H.warn("reloadPluginHandlers: window is not available");return}const{pluginInfo:i,action:l}=a.params||{};if(!i){H.warn("reloadPluginHandlers: pluginInfo is required");return}const u=i.data||i;if(!u.identifier){H.warn("reloadPluginHandlers: pluginInfo with identifier is required");return}if(!l||l!=="add"&&l!=="remove"){H.warn('reloadPluginHandlers: action must be "add" or "remove"');return}const d=window.G7Config;if(!d){H.warn("reloadPluginHandlers: G7Config not available");return}const f=u.identifier;try{if(l==="add"){if(u.assets&&(d.pluginAssets=d.pluginAssets||{},d.pluginAssets[f]=u.assets,H.log(`reloadPluginHandlers: Added assets for ${f}`),u.assets.js)){const g=u.assets.js,m=`plugin-${f}`;if(document.getElementById(m)){H.warn(`reloadPluginHandlers: Script ${m} already loaded`);return}const b=document.createElement("script");if(b.id=m,b.src=g,b.async=!0,await new Promise((v,S)=>{b.onload=()=>{H.log(`reloadPluginHandlers: Script loaded successfully for ${f}`),v()},b.onerror=()=>{H.error(`reloadPluginHandlers: Failed to load script for ${f}`),S(new Error(`Failed to load plugin script: ${g}`))},document.head.appendChild(b)}),u.assets.css){const v=u.assets.css,S=`plugin-css-${f}`;if(!document.getElementById(S)){const E=document.createElement("link");E.id=S,E.rel="stylesheet",E.href=v,document.head.appendChild(E),H.log(`reloadPluginHandlers: CSS loaded for ${f}`)}}}}else if(l==="remove"){d.pluginAssets&&d.pluginAssets[f]&&(delete d.pluginAssets[f],H.log(`reloadPluginHandlers: Removed assets for ${f}`));const g=`plugin-${f}`,m=document.getElementById(g);m&&(m.remove(),H.log(`reloadPluginHandlers: Removed script for ${f}`));const b=`plugin-css-${f}`,v=document.getElementById(b);v&&(v.remove(),H.log(`reloadPluginHandlers: Removed CSS for ${f}`))}}catch(g){throw H.error(`reloadPluginHandlers: Failed to ${l} plugin assets`,g),g}});let e=!1;this.registerHandler("showErrorPage",async(a,r)=>{if(e){H.log("showErrorPage: Already active, skipping duplicate call");return}if(e=!0,typeof window>"u"){e=!1,H.warn("showErrorPage: window is not available");return}const i=window.__templateApp;if(!i){e=!1,H.warn("showErrorPage: TemplateApp not initialized");return}const l=i.getErrorPageHandler?.();if(!l){e=!1,H.warn("showErrorPage: ErrorPageHandler not available");return}const u=a.params?.errorCode||500,d=a.params?.target||"content";let f=a.params?.containerId;f||(f=d==="full"?"app":"main_content"),H.log("showErrorPage:",{errorCode:u,target:d,containerId:f});const g=(m,b=6e4)=>new Promise((v,S)=>{const E=document.getElementById(m);if(E){v(E);return}H.log(`showErrorPage: Waiting for container #${m}...`);let A;const T=new MutationObserver((L,M)=>{const R=document.getElementById(m);R&&(H.log(`showErrorPage: Container #${m} found`),M.disconnect(),clearTimeout(A),v(R))});T.observe(document.body,{childList:!0,subtree:!0}),A=setTimeout(()=>{T.disconnect(),S(new Error(`Container #${m} not found within ${b}ms`))},b)});try{await g(f);const m=pa(),b=m.layoutErrorHandling;m.clearLayoutConfig();try{await l.renderError(u,f)||H.warn(`showErrorPage: Failed to render error page for code ${u}`)}finally{m.setLayoutConfig(b)}}catch(m){throw H.error("showErrorPage: Error rendering error page:",m),m}finally{e=!1}}),this.registerHandler("emitEvent",async(a,r)=>{const i=a.params?.event,l=a.params?.data;if(!i){H.warn("emitEvent: event parameter is required");return}if(typeof window>"u"){H.warn("emitEvent: window is not available");return}const u=window.G7Core;if(!u?.componentEvent?.emit){H.warn("emitEvent: G7Core.componentEvent is not available");return}try{H.log(`emitEvent: Emitting "${i}"`,l);const d={...l,_context:{data:r.data,state:r.state}},f=await u.componentEvent.emit(i,d);if(!f||f.length===0?H.warn(`emitEvent: No listeners found for "${i}"`):H.log(`emitEvent: Event "${i}" completed with ${f.length} listener(s)`,f),this.globalStateUpdater){const g=(u?.state?.get()||{})._local||{},m={event:i,success:!0,data:f.length===1?f[0]:f,listeners:f.length};this.globalStateUpdater({_local:{...g,_eventResult:m}});const b=r.state&&typeof r.state=="object"&&!Array.isArray(r.state)?r.state:g;window.__g7SequenceLocalSync={...b,_eventResult:m}}}catch(d){if(H.error(`emitEvent: Event "${i}" failed`,d),this.globalStateUpdater){const f=u?.state?.get()||{};this.globalStateUpdater({_local:{...f._local,_eventResult:{event:i,success:!1,error:d instanceof Error?d.message:String(d)}}})}throw d}}),this.registerHandler("updateProductField",async(a,r)=>{const{productId:i,field:l,value:u}=a.params||{};if(!i||!l){H.warn("updateProductField: productId and field are required");return}if(typeof window>"u"){H.warn("updateProductField: window is not available");return}const d=window.G7Core;if(!d?.state?.get||!this.globalStateUpdater){H.warn("updateProductField: G7Core.state or globalStateUpdater is not available");return}try{const f=d.state.get()||{},m=(f.products?.data?.data||[]).map(v=>v.id===i?{...v,[l]:u,_modified:!0}:v),b=new Set(f._local?.modifiedProductIds||[]);b.add(i),this.globalStateUpdater({products:{...f.products,data:{...f.products?.data,data:m}},_local:{...f._local,modifiedProductIds:Array.from(b)}}),H.log(`updateProductField: Updated product ${i}, field: ${l}, value:`,u)}catch(f){throw H.error("updateProductField: Error updating product field",f),f}}),this.registerHandler("updateOptionField",async(a,r)=>{const{productId:i,optionId:l,field:u,value:d}=a.params||{};if(!i||!l||!u){H.warn("updateOptionField: productId, optionId and field are required");return}if(typeof window>"u"){H.warn("updateOptionField: window is not available");return}const f=window.G7Core;if(!f?.state?.get||!this.globalStateUpdater){H.warn("updateOptionField: G7Core.state or globalStateUpdater is not available");return}try{const g=f.state.get()||{},b=(g.products?.data?.data||[]).map(S=>{if(S.id===i&&S.options){const E=S.options.map(A=>A.id===l?{...A,[u]:d,_modified:!0}:A);return{...S,options:E,_modified:!0}}return S}),v=new Set(g._local?.modifiedProductIds||[]);v.add(i),this.globalStateUpdater({products:{...g.products,data:{...g.products?.data,data:b}},_local:{...g._local,modifiedProductIds:Array.from(v)}}),H.log(`updateOptionField: Updated product ${i} option ${l}, field: ${u}, value:`,d)}catch(g){throw H.error("updateOptionField: Error updating option field",g),g}}),this.registerHandler("setLocale",async(a,r)=>{const i=a.target;if(!i||typeof i!="string"){H.warn("setLocale: Invalid locale:",i);return}const l=window.__templateApp;if(l&&typeof l.changeLocale=="function")try{await l.changeLocale(i),H.log("setLocale: Locale changed to",i)}catch(u){H.error("setLocale: Failed to change locale:",u),window.location.reload()}else{H.warn("setLocale: TemplateApp not found, falling back to page reload");try{localStorage.setItem("g7_locale",i)}catch{}window.location.reload()}}),this.registerHandler("suppress",async()=>{H.log("suppress: Error intentionally suppressed")}),this.registerBuiltInHandlerMetadata()}registerBuiltInHandlerMetadata(){const e=Un();if(!e?.isEnabled())return;const a=[{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 r of a)e.trackHandlerRegistration(r.name,"built-in",r.description)}createHandler(e,a,r){H.log("createHandler called for:",e.handler,e.type);const i=window.__g7DevTools,l=Date.now(),u=r?.state?{...r.state}:null,d=`handler_${e.handler}_${l}`;return async f=>{if(H.log("Handler invoked for:",e.handler,"event:",f.type),i?.isEnabled?.()&&u){const m=window.G7Core?.state?.getLocal?.()??r?.state??{},b=Date.now()-l;for(const v of Object.keys(u)){const S=u[v],E=m[v];S!==E&&b>100&&(i.trackStaleClosureWarning?.({type:"event-handler-stale",location:`createHandler(${e.handler})`,capturedPath:`_local.${v}`,capturedValue:S,capturedAt:l,currentValue:E,actionId:d,stackTrace:new Error().stack}),H.warn(`[Stale Closure] _local.${v} changed after handler creation:`,`captured="${S}" → current="${E}" (${b}ms ago)`))}}try{f.type!=="change"&&f.preventDefault();let g={};if(f.type==="submit"&&f.target instanceof HTMLFormElement){const v=f.target;new FormData(v).forEach((E,A)=>{g[A]=E})}const m={...this.defaultContext,data:{...a,form:g,_local:r?.state||{},$event:f},event:f,...r&&{state:r.state,setState:r.setState},isolatedContext:r?.isolatedContext};if(e.confirm){let v=this.resolveValue(e.confirm,m.data);if(this.translationEngine&&this.translationContext&&v.startsWith("$t:")&&(v=this.translationEngine.resolveTranslations(v,this.translationContext,m.data)),!confirm(v))return}const b=window.__g7ActionContext;window.__g7ActionContext={...r,data:m.data};try{await this.executeAction(e,m)}finally{window.__g7ActionContext=b}}catch(g){if(H.error("Action execution failed:",g),e.onError){const m=g instanceof It&&g.originalError?g.originalError:g,b={...this.defaultContext,data:{...a,error:m,_local:r?.state||{},$event:f},event:f,...r&&{state:r.state,setState:r.setState}},v=Array.isArray(e.onError)?e.onError:[e.onError];for(const S of v)await this.executeAction(S,b)}}}}generateActionId(e,a){const r=e.handler,i=a||"no-target",l=Date.now(),u=Math.random().toString(36).substring(2,9);return`${r}_${i.replace(/[^a-zA-Z0-9]/g,"_")}_${l}_${u}`}async executeAction(e,a){if(e=this.resolveActionRef(e),typeof e.handler=="string"&&e.handler.includes("{{")){const f=this.evaluateExpression(e.handler,a.data);e={...e,handler:f==null?"":String(f)}}const r=Un(),i=r?.isEnabled()?`action_${Date.now()}_${Math.random().toString(36).substring(2,11)}`:void 0,l=performance.now();let u;if(i&&r&&r.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),context:this.sanitizeForDevTools({hasState:!!a.state,hasSetState:!!a.setState,dataKeys:a.data?Object.keys(a.data):[]}),startTime:l,status:"started"}),e.if!==void 0)try{const f=this.resolveValue(e.if,a.data),g=f===!0||f==="true"||f&&f!=="false"&&f!=="0"&&f!==!1;if(H.log("[executeAction] if condition result:",e.handler,g),!g)return i&&r&&r.logAction({id:i,type:e.handler,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"success",result:{skipped:!0,reason:"if condition false"}}),{success:!0,data:void 0}}catch(f){return H.error("[executeAction] if condition error:",e.handler,f),i&&r&&r.logAction({id:i,type:e.handler,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"error",error:{name:"ConditionEvaluationError",message:f instanceof Error?f.message:String(f),stack:f instanceof Error?f.stack:void 0}}),{success:!0,data:void 0}}let d;try{const f=this.resolveParams(e.params,a.data);i&&(u=this.sanitizeForDevTools(f));const g=e.target?this.resolveValue(e.target,a.data):void 0;if(e.handler==="apiCall"&&a.setState){d=this.generateActionId(e,g);const b=a.state?.loadingActions||{};a.setState({loadingActions:{...b,[d]:!0}})}if(this.previewMode&&Qp.has(e.handler))return H.warn(`Preview mode: "${e.handler}" suppressed`,g||f),i&&r&&r.logAction({id:i,type:e.handler,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"skipped",metadata:{reason:"preview_mode_suppressed"}}),{success:!0,data:void 0};let m;switch(e.handler){case"ensureIdentityVerified":m=await this.handleEnsureIdentityVerified(f);break;case"resolveIdentityChallenge":m=this.handleResolveIdentityChallenge(f);break;case"navigate":const b=f.path||g;m=await this.handleNavigate(b,f,a);break;case"navigateBack":m=await this.handleNavigateBack();break;case"navigateForward":m=await this.handleNavigateForward();break;case"openWindow":{const E=f.path||g;m=await this.handleOpenWindow(E,f);break}case"replaceUrl":{const E=f.path||g||window.location.pathname;m=await this.handleReplaceUrl(E,f);break}case"apiCall":if(e.onSuccess&&r?.isEnabled()&&i){const E=window.G7Core,A={};if(E?.state?.get){const T=E.state.get();A._global=T}a.state&&(A._local=a.state),r.registerStateCaptureForHandler?.(i,["_global","_local"],A)}const v=e.auth_mode??(e.auth_required?"required":"none"),S=e.identity_target?this.resolveParams(e.identity_target,a.data):void 0;m=await this.handleApiCall(g,f,a,v,S);break;case"login":m=await this.handleLogin(g,f,a);break;case"logout":m=await this.handleLogout(g,a);break;case"setState":H.log("[executeAction] setState resolvedParams:",f),m=await this.handleSetState(e.render!==void 0?{...f,__render:e.render}:f,a);break;case"setError":m=await this.handleSetError(g,f,a);break;case"openModal":m=await this.handleOpenModal(g,a);break;case"closeModal":m=await this.handleCloseModal(a);break;case"showAlert":m=await this.handleShowAlert(g,a);break;case"toast":m=await this.handleToast(f,a);break;case"switch":m=await this.handleSwitch(e,a);break;case"conditions":m=await this.handleConditions(e,a);break;case"sequence":m=await this.handleSequence(e,a);break;case"parallel":m=await this.handleParallel(e,a);break;case"startInterval":m=this.handleStartInterval(f,a);break;case"stopInterval":m=this.handleStopInterval(f);break;case"loadScript":m=await this.handleLoadScript(f,e,a);break;case"callExternal":m=await this.handleCallExternal(f,e,a);break;case"callExternalEmbed":m=await this.handleCallExternalEmbed(f,e,a);break;case"saveToLocalStorage":m=await this.handleSaveToLocalStorage(f,a);break;case"loadFromLocalStorage":m=await this.handleLoadFromLocalStorage(f,a);break;default:m=await this.handleCustomAction({...e,target:g,params:f},a);break}if(e.resultTo&&m!==void 0){const{target:b,key:v,merge:S}=e.resultTo,E=this.resolveValue(v,a.data),A=S==="replace"?"replace":S==="shallow"?"shallow":"deep";if(b==="_local"&&a.setState){const T=this.buildNestedUpdate(E,m),L=A!=="deep"?{...T,__mergeMode:A}:T;a.setState(L),H.log(`[resultTo] Saved to _local.${E} (merge=${A}):`,m)}else if(b==="_local"&&this.globalStateUpdater){const M=(window.G7Core?.state?.get()||{})._local||{},R=this.buildNestedUpdate(E,m);let D;A==="replace"?D=R:A==="shallow"?D={...M,...R}:D=this.deepMergeWithState(R,M),this.globalStateUpdater({_local:D}),H.log(`[resultTo] Saved to _local.${E} via globalStateUpdater (merge=${A}):`,m)}else if(b==="_global"&&this.globalStateUpdater){const T=this.buildNestedUpdate(E,m);this.globalStateUpdater(T),H.log(`[resultTo] Saved to _global.${E}:`,m)}else if(b==="_isolated"&&a.isolatedContext){const T=this.buildNestedUpdate(E,m);a.isolatedContext.mergeState(T,A),H.log(`[resultTo] Saved to _isolated.${E} (merge=${A}):`,m)}else H.warn(`[resultTo] Cannot save result: target=${b}, setState=${!!a.setState}, globalStateUpdater=${!!this.globalStateUpdater}, isolatedContext=${!!a.isolatedContext}`)}if(e.onSuccess){if(r?.isEnabled()&&i&&e.handler==="apiCall"){const S=window.G7Core,E={};S?.state?.get&&(E._global=S.state.get()),a.state&&(E._local=a.state),r.detectStaleClosure?.(i,`${e.handler} → onSuccess`,E,"callback-state-capture",i)}const b={...a,data:{...a.data,result:m,response:m}},v=Array.isArray(e.onSuccess)?e.onSuccess:[e.onSuccess];v.length>1?await this.handleSequence({handler:"sequence",type:"click",actions:v},b):v.length===1&&await this.executeAction(v[0],b)}return i&&r&&r.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),resolvedParams:u,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"success",result:this.sanitizeForDevTools(m)}),{success:!0,data:m}}catch(f){const g=f instanceof It?f:new It(`Failed to execute action: ${e.handler}`,e,f instanceof Error?f:void 0),m=g.originalError?.response||{},b=m.data||{},v=g.originalError?.status||m.status||500,S=b.message||g.message,E={status:v,message:S,errors:b.errors||m.errors,data:b,statusText:g.originalError?.statusText,error_code:b.error_code??m.error_code};if(g.unknownHandler)throw H.warn(`Unknown action handler "${e.handler}" — skipped (extension not loaded?). Not surfaced to the user.`),g;const T=pa().resolve(v,{errorHandling:e.errorHandling,onError:e.onError});if(T.handler){if(r?.isEnabled()&&i&&e.handler==="apiCall"){const M=window.G7Core,R={};M?.state?.get&&(R._global=M.state.get()),a.state&&(R._local=a.state),r.detectStaleClosure?.(i,`${e.handler} → onError`,R,"callback-state-capture",i)}const L={...a,data:{...a.data,error:E}};try{const M={type:"click",handler:T.handler.handler,target:T.handler.target,params:T.handler.params,actions:T.handler.actions};return await this.executeAction(M,L),{success:!1,error:g}}catch(M){return H.error("Error executing error handler:",M),{success:!1,error:g}}}throw i&&r&&r.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),resolvedParams:u,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"error",error:{name:g.name,message:g.message,stack:g.stack}}),g}finally{if(e.handler==="apiCall"&&a.setState&&d){const f=a.state?.loadingActions||{},{[d]:g,...m}=f;a.setState({loadingActions:m})}}}async handleNavigate(e,a,r){let i=e;if(a.query)if(a.mergeQuery===!0)i=this.buildMergedQueryPath(e,a.query);else{const u=new URLSearchParams;for(const[f,g]of Object.entries(a.query))if(g!=null&&g!=="")if(Array.isArray(g)){const m=f.endsWith("[]")?f:`${f}[]`;for(const b of g)b!=null&&b!==""&&u.append(m,String(b))}else u.set(f,String(g));const d=u.toString();d&&(i=`${e}?${d}`)}if(H.log("handleNavigate:",{target:e,params:a,finalPath:i,replace:a.replace,windowLocationSearch:window.location.search}),a.replace===!0){const u=window.G7Core;if(u?.updateQueryParams){const d=typeof a.transition_overlay_target=="string"?a.transition_overlay_target:void 0;await u.updateQueryParams(i,d?{transitionOverlayTarget:d}:void 0),H.log("handleNavigate: Used updateQueryParams for replace mode",d?{transitionOverlayTarget:d}:void 0),this.applyScrollOption(a.scroll,a.scrollBehavior,"top");return}H.warn("handleNavigate: G7Core.updateQueryParams not available, falling back to React Router")}const l=this.resolveNavigateFallbackAction(i,a);if(l){H.warn(`handleNavigate: No route matched, falling back to "${l.handler}"`),await this.dispatchAction({type:"click",handler:l.handler,params:l.params},r),this.applyScrollOption(a.scroll,a.scrollBehavior,"top");return}if(!r.navigate)throw new It("Navigate function is not provided in context");r.navigate(i,{replace:a.replace===!0}),this.applyScrollOption(a.scroll,a.scrollBehavior,"top")}resolveNavigateFallbackAction(e,a){const r=a.fallback;if(r===!1||a.replace===!0)return null;const l=window.__templateApp?.getRouter?.();if(!l||typeof l.match!="function"||typeof l.getRoutes=="function"&&l.getRoutes().length===0)return null;const u=e.split("?")[0];return l.match(u)?null:this.resolveNavigateFallback(r,e,a)}resolveNavigateFallback(e,a,r){return e==null?{handler:"openWindow",params:{path:a,target:"_self"}}:typeof e=="string"?{handler:e,params:{path:a}}:typeof e=="object"&&typeof e.handler=="string"?{handler:e.handler,params:{path:a,...e.params||{}}}:(H.warn("resolveNavigateFallback: unrecognized fallback option, using openWindow",e),{handler:"openWindow",params:{path:a,target:"_blank"}})}applyScrollOption(e,a,r){const i=e===void 0?r:e;if(i==="preserve")return;const l=a==="smooth"?"smooth":"instant",u=b=>{if(typeof b!="object"||b===null)return!1;const v=b;return"container"in v||"to"in v||"block"in v||"offset"in v},d=(b,v,S=0)=>{b===window?window.scrollTo({top:v,left:S,behavior:l}):b.scrollTo({top:v,left:S,behavior:l})},f=(b,v,S,E)=>{if(v===window){b.scrollIntoView({behavior:l,block:S}),E&&window.scrollBy({top:-E,left:0,behavior:l});return}const A=v,T=b.getBoundingClientRect(),L=A.getBoundingClientRect(),M=A.scrollTop+(T.top-L.top);let R;S==="center"?R=M-(A.clientHeight-b.clientHeight)/2:S==="end"?R=M-(A.clientHeight-b.clientHeight):R=M,R-=E,A.scrollTo({top:Math.max(0,R),left:0,behavior:l})},g=()=>{window.scrollTo({top:0,left:0,behavior:l});const b=document.getElementById("app")??document.body;if(!b)return;b.querySelectorAll("*").forEach(S=>{if(S.scrollTop===0&&S.scrollLeft===0)return;const E=window.getComputedStyle(S),A=E.overflowY,T=E.overflowX;(A==="auto"||A==="scroll"||T==="auto"||T==="scroll")&&S.scrollTo({top:0,left:0,behavior:l})})},m=()=>{try{if(u(i)){const b=i,v=b.block??"start",S=typeof b.offset=="number"?b.offset:0;let E=window;if(typeof b.container=="string"&&b.container.length>0){const T=document.querySelector(b.container);if(!T){H.warn(`applyScrollOption: container not found: ${b.container}`);return}E=T}const A=b.to??"top";if(A==="top"){E===window?g():d(E,0);return}if(typeof A=="number"){d(E,A-S);return}if(typeof A=="object"&&A!==null&&("x"in A||"y"in A)){const{x:T=0,y:L=0}=A;d(E,L-S,T);return}if(typeof A=="string"&&(A.startsWith("#")||A.startsWith("."))){const T=document.querySelector(A);T?f(T,E,v,S):H.warn(`applyScrollOption: target element not found: ${A}`);return}H.warn('applyScrollOption: invalid "to" value in extended form',A);return}if(i==="top"){g();return}if(typeof i=="number"){window.scrollTo({top:i,left:0,behavior:l});return}if(typeof i=="object"&&i!==null&&("x"in i||"y"in i)){const{x:b=0,y:v=0}=i;window.scrollTo({top:v,left:b,behavior:l});return}if(typeof i=="string"&&(i.startsWith("#")||i.startsWith("."))){const b=document.querySelector(i);b&&b.scrollIntoView({behavior:l,block:"start"});return}}catch(b){H.warn("applyScrollOption: failed to apply scroll",b)}};typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(m):m()}async handleOpenWindow(e,a){let r=e;if(a.query){const l=new URLSearchParams;for(const[d,f]of Object.entries(a.query))f!=null&&f!==""&&l.set(d,String(f));const u=l.toString();u&&(r=`${e}?${u}`)}const i=a.target==="_self"?"_self":"_blank";H.log("handleOpenWindow:",{target:e,params:a,finalPath:r,windowTarget:i}),i==="_self"?window.location.assign(r):window.open(r,"_blank")}async handleNavigateBack(){H.log("handleNavigateBack"),window.history.back()}async handleNavigateForward(){H.log("handleNavigateForward"),window.history.forward()}async handleReplaceUrl(e,a){let r=e;if(a.query)if(a.mergeQuery===!0)r=this.buildMergedQueryPath(e,a.query);else{const i=new URLSearchParams;for(const[u,d]of Object.entries(a.query))if(d!=null&&d!=="")if(Array.isArray(d)){const f=u.endsWith("[]")?u:`${u}[]`;for(const g of d)g!=null&&g!==""&&i.append(f,String(g))}else i.set(u,String(d));const l=i.toString();l&&(r=`${e}?${l}`)}H.log("handleReplaceUrl:",{target:e,params:a,finalPath:r}),window.history.replaceState(null,"",r),this.applyScrollOption(a.scroll,a.scrollBehavior,"preserve")}buildMergedQueryPath(e,a){const r=new URLSearchParams(window.location.search);for(const[u,d]of Object.entries(a))if(d==null||d==="")r.delete(u);else if(Array.isArray(d)){const f=u.endsWith("[]")?u:`${u}[]`;r.delete(u),r.delete(f);for(const g of d)g!=null&&g!==""&&r.append(f,String(g))}else r.set(u,String(d));const i=r.toString(),l=e.split("?")[0];return i?`${l}?${i}`:l}async ensureCsrfToken(){try{await fetch("/sanctum/csrf-cookie",{credentials:"include"})}catch(e){throw new It("Failed to fetch CSRF token",void 0,e instanceof Error?e:void 0)}}getCsrfTokenFromCookie(){const r=`; ${document.cookie}`.split("; XSRF-TOKEN=");if(r.length===2){const i=r.pop()?.split(";").shift();return i?decodeURIComponent(i):null}return null}buildQueryString(e){const a=new URLSearchParams;for(const[r,i]of Object.entries(e))if(!(i==null||i===""))if(Array.isArray(i))for(const l of i)l!=null&&l!==""&&a.append(`${r}[]`,String(l));else typeof i=="object"?a.append(r,JSON.stringify(i)):a.append(r,String(i));return a.toString()}async handleEnsureIdentityVerified(e){const a=typeof e.purpose=="string"?e.purpose:"sensitive_action",r=e.target&&typeof e.target=="object"?e.target:void 0;return await St.handle({success:!1,error_code:"identity_verification_required",message:"",verification:{policy_key:e.policy_key??"",purpose:a,provider_id:e.provider_id??null,render_hint:e.render_hint??null,return_request:null}},void 0,r)!==null}handleResolveIdentityChallenge(e){const a=typeof e.result=="string"?e.result:"cancelled";let r;switch(a){case"verified":{const i=typeof e.token=="string"?e.token:"";if(!i){H.warn("resolveIdentityChallenge: result=verified 인데 token 이 비어있습니다. failed 로 강등합니다."),r={status:"failed",failureCode:"MISSING_TOKEN"};break}r={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:"",l=typeof e.expiresAt=="string"?e.expiresAt:"";if(!i||!l){H.warn("resolveIdentityChallenge: result=pending 인데 pollUrl/expiresAt 누락 — failed 로 강등합니다."),r={status:"failed",failureCode:"MALFORMED_PENDING"};break}r={status:"pending",pollUrl:i,pollIntervalMs:typeof e.pollIntervalMs=="number"?e.pollIntervalMs:void 0,expiresAt:l};break}case"failed":r={status:"failed",failureCode:typeof e.failureCode=="string"?e.failureCode:"UNKNOWN",reason:typeof e.reason=="string"?e.reason:void 0};break;default:r={status:"cancelled"};break}return St.resolveDeferred(r),!0}async handleApiCall(e,a,r,i="none",l){const{method:u="GET",body:d,headers:f,contentType:g}=a;u!=="GET"&&u!=="HEAD"&&await this.ensureCsrfToken();const m=this.getCsrfTokenFromCookie();let b={};if(i==="required"||i==="optional"){const X=$a().getToken();X&&(b={Authorization:`Bearer ${X}`})}let v=e;const S=a.query||(u==="GET"?d:null);if(S&&typeof S=="object"){const P=this.buildQueryString(S);if(P){const X=e.includes("?")?"&":"?";v=`${e}${X}${P}`}}const E=window.G7Core?.state?.getGlobal?.()||r.state?._global||{},A=window.G7Core?.state?.getLocal?.()||r.state?._local||{},T={_global:E,_local:A},L=this.getMatchingGlobalHeaders(e,T),M={};if(typeof window<"u"){const P=localStorage.getItem("g7_locale");P&&(M["Accept-Language"]=P)}const R=g==="multipart/form-data",D={method:u,headers:{...R?{}:{"Content-Type":"application/json"},Accept:"application/json",...M,...m&&{"X-XSRF-TOKEN":m},...b,...L,...f},credentials:"include"};if(d&&u!=="GET")if(R){const P=new FormData;for(const[X,ge]of Object.entries(d))ge instanceof File||ge instanceof Blob?P.append(X,ge):ge!=null&&P.append(X,typeof ge=="object"?JSON.stringify(ge):String(ge));D.body=P}else D.body=JSON.stringify(d);const U=Un();let j=null;U?.isEnabled()&&(j=U.trackRequest(v,u));try{let P=await fetch(v,D),X;try{X=await P.json()}catch{X=null}if(St.isIdentityRequired(P.status,X)){const ge=await St.handle(X,{body:D.body,headers:D.headers,credentials:D.credentials},l);if(ge){P=ge;try{X=await P.json()}catch{X=null}}}if(j&&U?.isEnabled()&&(U.completeRequest(j,P.status,X),j=null),!P.ok){const ge=X||{},Ee=new Error(ge.message||`API call failed: ${P.statusText}`);throw Ee.response=ge,Ee.status=P.status,Ee.statusText=P.statusText,new It(ge.message||`API call failed: ${P.statusText}`,void 0,Ee)}return X}catch(P){throw j&&U?.isEnabled()&&U.failRequest(j,P instanceof Error?P.message:String(P)),P}}async handleLogin(e,a,r){const{body:i}=a;if(!i||!i.email||!i.password)throw new It("Login requires email and password in body params");const l=e==="user"?"user":"admin",u=l==="admin"?"/api/auth/admin/login":"/api/auth/login",d=window.G7Core?.state?.getGlobal?.()||r.state?._global||{},f=window.G7Core?.state?.getLocal?.()||r.state?._local||{},g={_global:d,_local:f},m=this.getMatchingGlobalHeaders(u,g),b=ha.getInstance();try{const v=Object.keys(m).length>0?{headers:m}:void 0;return{user:await b.login(l,{email:i.email,password:i.password},v)}}catch(v){const S=v.message||"Login failed",E=new Error(S);throw E.response=v.response?.data||{},E.status=v.status||v.response?.status||500,new It(S,void 0,E)}}async handleLogout(e,a){await ha.getInstance().logout()}async handleSetState(e,a){H.log("[handleSetState] START, params:",e);const{target:r="component",scope:i,merge:l,__render:u,...d}=e,f=Un(),g=window.G7Core;if(typeof r=="string"&&(r.startsWith("$parent.")||r.startsWith("$root.")))return this.handleParentScopeSetState(r,d,l,a);const m=a.state&&Object.keys(a.state).length>0?a.state:g?.state?.get()||{},b=r==="global"?"_global":r.startsWith("_local.")?r:"_local",v=b==="_global"?m._global:b.startsWith("_local.")?this.getNestedProperty(m._local||{},b.slice(7)):m._local,S=f?.isEnabled()?f.startStateChange(b,v,d,{actionId:a.actionId,handlerType:"setState",source:`target=${r}`}):void 0,E=l==="replace"?"replace":l==="shallow"?"shallow":"deep",A=E!=="deep"?{...d,__mergeMode:E,...S?{__setStateId:S}:{}}:{...d,...S?{__setStateId:S}:{}};if(r==="global"){if(!this.globalStateUpdater){H.warn("Global state updater is not set"),S&&f&&f.completeStateChange(S);return}const T=g?.state?.get()||{},{__setStateId:L,__mergeMode:M,...R}=A,D=E==="deep"?this.deepMergeWithState(R,T):R,U={...D,...S?{__setStateId:S}:{},...E!=="deep"?{__mergeMode:E}:{}};return H.log("setState global:",U),this.globalStateUpdater(U,{render:u}),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"global",...E!=="deep"?{__mergeMode:E}:{},...D}}else if(r==="isolated"){const T=a.isolatedContext;if(T){const{__mergeMode:L,__setStateId:M,...R}=A;return T.mergeState(R,E),H.log("[handleSetState] isolated state updated:",R,"mergeMode:",E),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"isolated",...R}}else if(H.warn('[handleSetState] isolated target used but no IsolatedStateContext found. Make sure the component has "isolatedState" attribute. Falling back to local state.'),a.setState){const M=window.__g7PendingLocalState||a.state||{},R=E==="deep"?this.deepMergeWithState(A,M):A;return a.setState(R),S&&f&&setTimeout(()=>f.completeStateChange(S),0),R}else throw S&&f&&f.completeStateChange(S),new It("isolated target used but no IsolatedStateContext found and no setState function in context")}else if(r==="local"||r==="component"||r==="_local"){if(i==="parent"||i==="root"){const L=window.__g7LayoutContextStack||[];if(L.length>0){const M=i==="parent"?L[L.length-1]:L[0];if(M?.setState){const{__mergeMode:R,__setStateId:D,...U}=A,j=E==="deep"?this.deepMergeWithState(U,M.state||{}):U;return H.log(`[handleSetState] scope=${i}: 타겟 컨텍스트에 상태 업데이트`,j),M.setState(j),S&&f&&setTimeout(()=>f.completeStateChange(S),0),j}}H.warn(`[handleSetState] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const T=a.setState&&!a._isDispatchFallbackContext;if(H.log("[handleSetState] isRealComponentContext:",T,"context.setState:",!!a.setState,"_isDispatchFallbackContext:",a._isDispatchFallbackContext),T){H.log("[handleSetState] Using COMPONENT setState path"),H.log("[handleSetState] resolvedPayload:",A),H.log("[handleSetState] context.state:",a.state),H.log("[handleSetState] mergeMode:",E);const M=window.__g7PendingLocalState||a.state||{},R=E==="deep"?this.deepMergeWithState(A,{}):A;H.log("[handleSetState] convertedPayload (변경 필드만, dot notation 변환):",R),a.setState(R);const D=E==="deep"?this.deepMergeWithState(A,M):E==="shallow"?{...a.state||{},...A}:A,{__mergeMode:U,__setStateId:j,...P}=D;window.__g7PendingLocalState=P,H.log("[handleSetState] __g7PendingLocalState updated:",P),this.globalStateUpdater&&(this.globalStateUpdater({_local:P},{render:!1}),H.log("[handleSetState] _global._local synced (render:false):",P));const{__mergeMode:X,__setStateId:ge,...Ee}=A;if(E==="replace")window.__g7ForcedLocalFields=Ee;else{const Ce=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=this.deepMergeWithState(Ee,Ce)}return H.log("[handleSetState] __g7ForcedLocalFields updated:",Ee),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"local",...D}}else if(this.globalStateUpdater){H.log("[handleSetState] Using GLOBAL STATE UPDATER path for _local");const M=window.__g7PendingLocalState||m._local||{};H.log("[handleSetState] currentLocal (with pending):",M);const R=E==="deep"?this.deepMergeWithState(A,M):A;return H.log("[handleSetState] finalLocal (merged):",R),this.globalStateUpdater({_local:R},{render:u}),window.__g7PendingLocalState=R,H.log("[handleSetState] __g7PendingLocalState updated for globalStateUpdater path"),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"local",...R}}else throw S&&f&&f.completeStateChange(S),new It("setState function is not provided in context and globalStateUpdater is not set")}else if(r.startsWith("_local.")){const T=r.slice(7),{__mergeMode:L,__setStateId:M,...R}=A,D=R.value!==void 0?R.value:Object.values(R)[0];if(a.setState){const j=window.__g7PendingLocalState||a.state||{},P=this.createNestedUpdate(T,D,j),X={...j,...P};return a.setState(P),S&&f&&setTimeout(()=>f.completeStateChange(S),0),X}else throw S&&f&&f.completeStateChange(S),new It("setState function is not provided in context")}else{if(!a.setState)throw S&&f&&f.completeStateChange(S),new It("setState function is not provided in context");const L=window.__g7PendingLocalState||a.state||{},M=E==="deep"?this.deepMergeWithState(A,L):A;return a.setState(M),S&&f&&setTimeout(()=>f.completeStateChange(S),0),M}}async handleParentScopeSetState(e,a,r,i){const l=Un(),u=window.G7Core,d=r==="replace"?"replace":r==="shallow"?"shallow":"deep",f=e.startsWith("$parent."),g=f?"$parent.":"$root.",m=e.slice(g.length);let b,v;if(m==="_local"||m==="_global")b=m,v=void 0;else if(m.startsWith("_local."))b="_local",v=m.slice(7);else if(m.startsWith("_global."))b="_global",v=m.slice(8);else{H.warn(`[handleParentScopeSetState] 지원하지 않는 타겟 형식: ${e}. _local 또는 _global으로 시작해야 합니다.`);return}const S=window.__g7LayoutContextStack||[];if(S.length===0){H.warn(`[handleParentScopeSetState] 레이아웃 컨텍스트 스택이 비어있습니다. target=${e}`);return}const E=f?S[S.length-1]:S[0];if(!E){H.warn(`[handleParentScopeSetState] 타겟 컨텍스트를 찾을 수 없습니다. target=${e}`);return}const A=b==="_global"?E.state?._global:E.state?._local,T=l?.isEnabled()?l.startStateChange(e,A,a,{actionId:i.actionId,handlerType:"setState",source:`target=${e}`}):void 0,{__mergeMode:L,__setStateId:M,...R}=a;if(b==="_global"){if(!this.globalStateUpdater){H.warn("[handleParentScopeSetState] globalStateUpdater가 설정되지 않았습니다."),T&&l&&l.completeStateChange(T);return}const D=u?.state?.get()||{};if(v){const U=R.value!==void 0?R.value:Object.values(R)[0],j=this.createNestedUpdate(v,U,D),P={...D,...j};H.log(`[handleParentScopeSetState] ${e}: 전역 상태 중첩 경로 업데이트`,P),this.globalStateUpdater(P)}else{const U=d==="deep"?this.deepMergeWithState(R,D):R;H.log(`[handleParentScopeSetState] ${e}: 전역 상태 업데이트 (mergeMode=${d})`,U),this.globalStateUpdater(d!=="deep"?{...U,__mergeMode:d}:U)}return T&&l&&setTimeout(()=>l.completeStateChange(T),0),{__target:e,...R}}else{if(!E.setState){H.warn(`[handleParentScopeSetState] 타겟 컨텍스트에 setState가 없습니다. target=${e}`),T&&l&&l.completeStateChange(T);return}const D=E.state||{};if(v){const U=R.value!==void 0?R.value:Object.values(R)[0],j=this.createNestedUpdate(v,U,D),P={...D,...j};return H.log(`[handleParentScopeSetState] ${e}: 로컬 상태 중첩 경로 업데이트`,j),E.setState(j),E.state=P,E.dataContext&&(E.dataContext._local=P),kd(),T&&l&&setTimeout(()=>l.completeStateChange(T),0),P}else{const U=d!=="deep"?{...R,__mergeMode:d}:R,j=d==="replace"?R:d==="shallow"?{...D,...R}:this.deepMergeWithState(R,D);return H.log(`[handleParentScopeSetState] ${e}: 로컬 상태 업데이트 (mergeMode=${d})`,j),E.setState(U),E.state=j,E.dataContext&&(E.dataContext._local=j),kd(),T&&l&&setTimeout(()=>l.completeStateChange(T),0),j}}}deepMergeWithState(e,a){const r=["errors"];let i=e;if("..."in e){const u=e["..."];if(u&&typeof u=="object"&&!Array.isArray(u)){const{"...":d,...f}=e;i={...u,...f}}else{const{"...":d,...f}=e;i=f}}const l={...a};for(const[u,d]of Object.entries(i)){if(r.includes(u)){l[u]=d;continue}if(u.includes(".")&&u!=="..."){const f=this.createNestedUpdate(u,d,l);this.deepMergeInto(l,f,l);continue}if(d!==null&&typeof d=="object"&&!Array.isArray(d)&&Object.getPrototypeOf(d)!==Object.prototype&&Object.getPrototypeOf(d)!==null){l[u]=d;continue}d!==null&&typeof d=="object"&&!Array.isArray(d)&&a[u]!==null&&typeof a[u]=="object"&&!Array.isArray(a[u])?l[u]=this.deepMergeWithState(d,a[u]):l[u]=d}return l}deepMergeInto(e,a,r){for(const[i,l]of Object.entries(a)){if(l===null){e[i]=l;continue}if(e[i]===null){e[i]=l;continue}typeof l=="object"&&!Array.isArray(l)&&e[i]!==void 0&&e[i]!==null&&typeof e[i]=="object"&&!Array.isArray(e[i])?(e[i]===r[i]&&(e[i]={...e[i]}),this.deepMergeInto(e[i],l,r[i]||{})):typeof l=="object"&&!Array.isArray(l)&&e[i]===void 0&&r[i]!==null&&typeof r[i]=="object"&&!Array.isArray(r[i])?e[i]={...r[i],...l}:e[i]=l}}createNestedUpdate(e,a,r){const i=e.split(".");if(i.length===1)return{[i[0]]:a};const l={};let u=l,d=r;for(let f=0;f<i.length-1;f++){const g=i[f],m=d?.[g],b=m!=null&&typeof m=="object"&&!Array.isArray(m);b?u[g]={...m}:u[g]={},u=u[g],d=b?m:{}}return u[i[i.length-1]]=a,l}buildNestedUpdate(e,a){const r=e.split(".");if(r.length===1)return{[r[0]]:a};const i={};let l=i;for(let u=0;u<r.length-1;u++)l[r[u]]={},l=l[r[u]];return l[r[r.length-1]]=a,i}async handleSetError(e,a,r){let i=e;i=this.resolveValue(i,r.data),this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,r.data));const l=a?.stateTarget||"local";l==="isolated"&&r.isolatedContext?(r.isolatedContext.mergeState({apiError:i}),H.log("[handleSetError] Error set to isolated state:",i)):l==="global"&&this.globalStateUpdater?(this.globalStateUpdater({apiError:i}),H.log("[handleSetError] Error set to global state:",i)):r.setState?(r.setState({apiError:i}),H.log("[handleSetError] Error set to local state:",i)):H.warn("[handleSetError] Cannot set error: no state updater available")}async handleOpenModal(e,a){if(!this.globalStateUpdater){H.warn("Global state updater is not set for openModal");return}const r=a.data?._global?.modalStack||[];if(r.includes(e)){H.warn(`Modal "${e}" is already open`);return}const i=window.G7Core,l=a.setState&&a.state!==void 0,u=l?void 0:i?.state?.getLocal?.()||{},d=!l&&u!==void 0&&this.globalStateUpdater;if(l||d){const m=window.__g7LayoutContextStack||[],b=l?a.state:u,v=l?a.setState:S=>{this.globalStateUpdater({_local:S})};m.push({state:b,setState:v,dataContext:{_local:b||a.data?._local,_global:l?a.data?._global:a.data?._global||i?.state?.get?.(),_computed:a.data?._computed}}),window.__g7LayoutContextStack=m,H.log(`[handleOpenModal] 레이아웃 컨텍스트 스택에 push, 스택 크기: ${m.length}, state:`,b,l?"(direct)":"(fallback via G7Core)")}else H.warn(`[handleOpenModal] 컨텍스트 스택에 push 실패 - setState: ${!!a.setState}, state: ${a.state!==void 0}, G7Core: ${!!i?.state?.getLocal}`);const f=[...r,e];this.globalStateUpdater({modalStack:f,activeModal:e});const g=Un();if(g?.isEnabled()){const m=r.length>0?r[r.length-1]:void 0;g.trackModalOpen?.({modalId:e,modalName:e,scopeType:"isolated",parentModalId:m,initialState:a.state?{...a.state}:{}})}}async handleCloseModal(e){if(!this.globalStateUpdater){H.warn("Global state updater is not set for closeModal");return}const a=e?.data?._global?.modalStack||[],r=a.length>0?a[a.length-1]:null,i=a.slice(0,-1),l=i.length>0?i[i.length-1]:null,u=window.__g7LayoutContextStack||[];if(u.length>0){const d=u[u.length-1];d&&(d.dataContext=void 0),u.pop(),window.__g7LayoutContextStack=u,H.log(`[handleCloseModal] 레이아웃 컨텍스트 스택에서 pop, 스택 크기: ${u.length}`)}if(r){const d=Un();d?.isEnabled()&&d.trackModalClose?.(r,e?.state)}this.globalStateUpdater({modalStack:i,activeModal:l})}async handleShowAlert(e,a){let r=e;this.translationEngine&&this.translationContext&&e.startsWith("$t:")&&(r=this.translationEngine.resolveTranslations(e,this.translationContext,a.data)),alert(r)}async handleToast(e,a){const{type:r="info",message:i,icon:l,duration:u}=e;if(r==="error"){const f=a.data?.error;if((f?.error_code==="identity_verification_required"||f?.data?.error_code==="identity_verification_required")&&St.consumeDomainNoticeShown()){H.log("[Toast] IDV 도메인 안내 표출됨 — 중복 가드 토스트 1건 skip");return}}let d=i;if(this.translationEngine&&this.translationContext&&i?.startsWith("$t:")&&(d=this.translationEngine.resolveTranslations(i,this.translationContext,a.data)),this.globalStateUpdater){const g={id:`toast_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,type:r,message:d,...l&&{icon:l},...u&&{duration:u}},S=[...window.G7Core?.state?.get()?.toasts||[],g];this.globalStateUpdater({toasts:S})}else H.log(`[Toast ${r}] ${d}`)}async handleSwitch(e,a){const{cases:r}=e;if(!r){H.warn("switch handler requires cases property");return}const i=this.resolveParams(e.params,a.data);let l;if(i?.value!==void 0?(l=i.value,H.log("switch handler: using params.value as case key:",l)):(l=a.data?.$args?.[0],H.log("switch handler: using $args[0] as case key:",l)),l==null){if(r.default)return H.log("switch handler: case key is undefined, using default case"),await this.executeAction(r.default,a);H.warn("switch handler: case key is not defined and no default case");return}const u=String(l);let d=r[u];if(!d&&r.default&&(H.log(`switch handler: no case found for key "${u}", using default case`),d=r.default),!d){H.warn(`switch handler: no case found for key "${u}" and no default case`);return}return await this.executeAction(d,a)}async handleConditions(e,a){const{conditions:r}=e;if(!r||!Array.isArray(r)){H.warn("conditions handler requires conditions array");return}const i=a.data||{},l=op(r,i,this.bindingEngine);if(!l.matched){H.log("conditions handler: no matching branch found");return}const u=r[l.branchIndex];if(H.log(`conditions handler: matched branch ${l.branchIndex}`),!u.then){H.warn('conditions handler: matched branch has no "then" action');return}return Array.isArray(u.then)?await this.handleSequence({...e,actions:u.then},a):await this.executeAction(u.then,a)}handleStartInterval(e,a){const r=typeof e.id=="string"?e.id:"",i=Number(e.intervalMs??1e3),l=Array.isArray(e.actions)?e.actions:[];if(r===""||!l.length||i<=0)return H.warn("startInterval requires non-empty id, positive intervalMs, and actions array"),{success:!1};const u=this.intervals.get(r);u&&(clearInterval(u),this.intervals.delete(r));const d=setInterval(()=>{for(const f of l)this.executeAction(f,a).catch(g=>{H.error(`[startInterval:${r}] tick action failed`,g)})},i);return this.intervals.set(r,d),{success:!0,id:r}}handleStopInterval(e){const a=typeof e.id=="string"?e.id:"";if(a==="")return H.warn("stopInterval requires id parameter"),{success:!1};const r=this.intervals.get(a);return r&&(clearInterval(r),this.intervals.delete(a)),{success:!0,id:a}}stopAllIntervals(){for(const e of this.intervals.values())clearInterval(e);this.intervals.clear()}async handleSequence(e,a){const r=e.actions||e.params?.actions;if(!r||!Array.isArray(r)||r.length===0)return H.warn("sequence handler requires non-empty actions array"),[];const i=Un(),l=i?.isEnabled()&&i.startSequenceExecution?.({eventType:e.type})||"";window.__g7SequenceLocalSync=void 0;const u=[];let d,f=a.state?{...a.state}:{},g=a.isolatedContext?.state?{...a.isolatedContext.state}:{},m=a.data?._computed||{};const b=window.G7Core,v=()=>({_global:b?.state?.get()||{},_local:{...f},_isolated:Object.keys(g).length>0?{...g}:void 0});for(let S=0;S<r.length;S++){const E=r[S],A=Date.now();l&&i?.isEnabled()&&i.captureSequenceActionBefore?.(l,S,E.handler||"unknown",E.params||{},v());const T={...a,state:f,data:{...a.data,_local:f,_computed:m,$computed:m,$prev:d,$results:[...u],_isolated:g},isolatedContext:a.isolatedContext?{...a.isolatedContext,state:g}:null};try{const L=await this.executeAction(E,T);if(d=L.data,u.push(L.data),E.handler==="setState"&&L.data!==void 0){if(L.data.__target==="global"){const{__target:R,__mergeMode:D,...U}=L.data;D==="replace"?f={...f,_global:U}:f={...f,_global:{...f._global||{},...U}},H.log("[handleSequence] global state synchronized (mergeMode=%s):",D||"deep",f._global)}else if(L.data.__target==="isolated"){const{__target:R,__mergeMode:D,...U}=L.data;D==="replace"?g=U:g={...g,...U},H.log("[handleSequence] isolated state synchronized (mergeMode=%s):",D||"deep",g)}else if(L.data.__target==="local"){const{__target:R,__mergeMode:D,__setStateId:U,...j}=L.data;D==="replace"?f=j:f={...f,...j},H.log("[handleSequence] local state synchronized (mergeMode=%s):",D||"deep",f)}else f=L.data,H.log("[handleSequence] state synchronized (legacy):",f);const M=a.data?._computedDefinitions;if(M&&Object.keys(M).length>0){const R={},D={...a.data,_local:f,_computed:R,$computed:R,_isolated:g};for(const[U,j]of Object.entries(M))if(typeof j=="string"){const P=j.trim();if(P.startsWith("{{")&&P.endsWith("}}"))try{const X=P.slice(2,-2).trim();R[U]=this.bindingEngine.evaluateExpression(X,D,{skipCache:!0})}catch{R[U]=m[U]}}m=R,H.log("[handleSequence] _computed recalculated after setState:",m)}}if(E.handler!=="setState"){const M=window.__g7SequenceLocalSync;if(M&&M!==f){f=M,window.__g7SequenceLocalSync=void 0,H.log("[handleSequence] currentState synchronized from __g7SequenceLocalSync after custom handler:",E.handler);const R=a.data?._computedDefinitions;if(R&&Object.keys(R).length>0){const D={},U={...a.data,_local:f,_computed:D,$computed:D,_isolated:g};for(const[j,P]of Object.entries(R))if(typeof P=="string"){const X=P.trim();if(X.startsWith("{{")&&X.endsWith("}}"))try{const ge=X.slice(2,-2).trim();D[j]=this.bindingEngine.evaluateExpression(ge,U,{skipCache:!0})}catch{D[j]=m[j]}}m=D,H.log("[handleSequence] _computed recalculated after custom handler:",m)}}}l&&i?.isEnabled()&&i.captureSequenceActionAfter?.(l,S,v(),Date.now()-A,L.data)}catch(L){throw l&&i?.isEnabled()&&(i.captureSequenceActionAfter?.(l,S,v(),Date.now()-A,void 0,L),i.endSequenceExecution?.(l,L)),H.error(`sequence handler: action[${S}] failed:`,L),L}}return window.__g7SequenceLocalSync=void 0,l&&i?.isEnabled()&&i.endSequenceExecution?.(l),u}async handleParallel(e,a){const r=e.actions||e.params?.actions;if(!r||!Array.isArray(r)||r.length===0)return H.warn("parallel handler requires non-empty actions array"),[];H.log(`parallel handler: executing ${r.length} actions in parallel`);const i=a.isolatedContext?{...a.isolatedContext,state:{...a.isolatedContext.state}}:null,l=r.map((f,g)=>{const m={...a,isolatedContext:i};return this.executeAction(f,m).catch(b=>{throw H.error(`parallel handler: action[${g}] failed:`,b),b})}),u=await Promise.allSettled(l),d=u.filter(f=>f.status==="rejected").length;return d>0&&H.warn(`parallel handler: ${d}/${r.length} actions failed`),u}async handleLoadScript(e,a,r){const{src:i,id:l,async:u=!0,defer:d=!1}=e;if(!i)throw new It('loadScript handler requires "src" parameter',a);const f=l||`script_${i.replace(/[^a-zA-Z0-9]/g,"_")}`;return cs.loadedScripts.has(f)?(H.log(`loadScript: script already loaded, skipping: ${f}`),a.onLoad&&await this.executeAction(a.onLoad,r),!0):document.getElementById(f)?(H.log(`loadScript: script element already exists: ${f}`),cs.loadedScripts.add(f),a.onLoad&&await this.executeAction(a.onLoad,r),!0):(H.log(`loadScript: loading script: ${i}`),new Promise((m,b)=>{const v=document.createElement("script");v.id=f,v.src=i,v.async=u,v.defer=d,v.onload=async()=>{if(H.log(`loadScript: script loaded successfully: ${f}`),cs.loadedScripts.add(f),a.onLoad)try{await this.executeAction(a.onLoad,r)}catch(S){H.error("loadScript: onLoad action failed:",S)}m(!0)},v.onerror=S=>{H.error(`loadScript: failed to load script: ${i}`,S),b(new It(`Failed to load script: ${i}`,a))},document.head.appendChild(v)}))}async handleCallExternal(e,a,r){const i=e.constructor,l=e.args||{},u=e.method,d=e.methodArgs||[],f=e.callbackEvent,g=e.embedTarget,m=e.callbackSetState,b=e.callbackAction;if(!i)throw new It('callExternal handler requires "constructor" parameter',a);const v=this.getNestedProperty(window,i);if(!v||typeof v!="function")throw new It(`Constructor not found or not a function: ${i}. Make sure the script is loaded first using loadScript handler.`,a);H.log(`callExternal: calling constructor ${i}`);const S={...l};for(const[A,T]of Object.entries(l))T===!0&&(S[A]=L=>{if(H.log(`callExternal: callback triggered for ${A}`,L),f&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(f,L),m&&r.setState){const M=U=>{const j={};for(const[P,X]of Object.entries(U))typeof X=="string"?j[P]=this.getNestedProperty(L,X):typeof X=="object"&&X!==null&&(j[P]=M(X));return j},R=M(m);H.log("callExternal: callbackSetState mapping result",R);const D=this.deepMergeWithState(R,r.state||{});H.log("callExternal: merged with existing state",D),r.setState(D)}else f&&r.setState&&r.setState({[`${f.replace(/:/g,"_")}_result`]:L});if(b){const M={...r,data:{...r.data,$event:L}},R=Array.isArray(b)?b:[b];for(const D of R)try{this.executeAction(D,M)}catch(U){H.error("callExternal: callbackAction failed:",U)}}});const E=new v(S);if(u&&typeof E[u]=="function"){if(H.log(`callExternal: calling method ${u}`),u==="embed"&&g){const A=document.querySelector(g);if(A)return E[u](A,...d);throw new It(`Embed target element not found: ${g}`,a)}return E[u](...d)}return E}async handleCallExternalEmbed(e,a,r){const i=e.constructor,l=e.args||{},u=e.callbackSetState,d=e.callbackEvent,f=e.layerClassName,g=e.callbackAction;if(!i)throw new It('callExternalEmbed handler requires "constructor" parameter',a);const m=this.getNestedProperty(window,i);if(!m||typeof m!="function")throw new It(`Constructor not found or not a function: ${i}. Make sure the script is loaded first.`,a);H.log(`callExternalEmbed: creating layer for ${i}`);const{layer:b,closeLayer:v}=this.createEmbedLayer(f),S={...l};for(const[A,T]of Object.entries(l))T===!0&&(S[A]=L=>{if(H.log(`callExternalEmbed: callback triggered for ${A}`,L),v(),d&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(d,L),u&&r.setState){const M=U=>{const j={};for(const[P,X]of Object.entries(U))typeof X=="string"?j[P]=this.getNestedProperty(L,X):typeof X=="object"&&X!==null&&(j[P]=M(X));return j},R=M(u);H.log("callExternalEmbed: callbackSetState mapping result",R);const D=this.deepMergeWithState(R,r.state||{});H.log("callExternalEmbed: merged with existing state",D),r.setState(D)}if(g){const M={...r,data:{...r.data,$event:L}},R=Array.isArray(g)?g:[g];for(const D of R)try{this.executeAction(D,M)}catch(U){H.error("callExternalEmbed: callbackAction failed:",U)}}});const E=new m(S);if(typeof E.embed=="function")E.embed(b),H.log("callExternalEmbed: embedded in layer");else throw v(),new It(`Constructor ${i} does not have embed method`,a);return E}isImeComposing(e){return e?.isComposing===!0||e?.keyCode===229}createEmbedLayer(e){const a=document.createElement("div");a.id="g7-embed-overlay",a.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 r=document.createElement("div");r.id="g7-embed-layer",r.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&&(r.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 l=()=>{a.parentNode&&a.parentNode.removeChild(a)};i.onclick=l;const u=d=>{this.isImeComposing(d)||d.key==="Escape"&&(l(),document.removeEventListener("keydown",u))};return document.addEventListener("keydown",u),a.onclick=d=>{d.target===a&&l()},r.appendChild(i),a.appendChild(r),document.body.appendChild(a),{overlay:a,layer:r,closeLayer:l}}getNestedProperty(e,a){return a.split(".").reduce((r,i)=>r&&r[i]!==void 0?r[i]:void 0,e)}async handleSaveToLocalStorage(e,a){const{key:r,value:i}=e;if(!r)return H.error("saveToLocalStorage: key parameter is required"),!1;try{const l=typeof i=="string"?i:JSON.stringify(i);return localStorage.setItem(r,l),H.log(`saveToLocalStorage: saved ${r}`,i),!0}catch(l){return H.error("saveToLocalStorage: failed to save",{key:r,error:l}),!1}}async handleLoadFromLocalStorage(e,a){const{key:r,target:i,stateKey:l,defaultValue:u}=e;if(!r)return H.error("loadFromLocalStorage: key parameter is required"),u;try{const d=localStorage.getItem(r);if(d===null)return H.log(`loadFromLocalStorage: no value found for ${r}, using default`),l&&a.setState&&a.setState({[l]:u}),u;let f;try{f=JSON.parse(d)}catch{f=d}return H.log(`loadFromLocalStorage: loaded ${r}`,f),l&&a.setState&&a.setState({[l]:f}),f}catch(d){return H.error("loadFromLocalStorage: failed to load",{key:r,error:d}),u}}async handleCustomAction(e,a){const r=this.customHandlers.get(e.handler);if(!r){if(this.previewMode){H.warn(`[Preview] Unknown action handler "${e.handler}" — skipped (preview mode)`);return}const i=new It(`Unknown action handler: ${e.handler}`,e);throw i.unknownHandler=!0,i}return await r(e,a)}resolveParams(e,a){if(!e)return{};const r={};for(const[i,l]of Object.entries(e))i.includes("{{")&&H.warn(`[resolveParams] setState params의 키에 표현식이 포함되어 있습니다: "${i}". 키는 해석되지 않습니다. 배열 항목 수정은 .map()/.filter() 패턴을 사용하세요.`),typeof l=="string"&&l.includes("{{")?r[i]=this.evaluateExpression(l,a):typeof l=="string"?r[i]=l:Array.isArray(l)?r[i]=l.map(u=>typeof u=="string"&&u.includes("{{")?this.evaluateExpression(u,a):u):typeof l=="object"&&l!==null&&!Array.isArray(l)&&Object.getPrototypeOf(l)!==Object.prototype&&Object.getPrototypeOf(l)!==null?r[i]=l:typeof l=="object"&&l!==null?r[i]=this.resolveParams(l,a):r[i]=l;return r}resolveValue(e,a){return a?this.bindingEngine.resolveBindings(e,a,{skipCache:!0}):e}evaluateExpressions(e,a){let r={};for(const[i,l]of Object.entries(e))if(i==="..."){let u=l;typeof l=="string"&&l.includes("{{")&&(u=this.evaluateExpression(l,a)),u&&typeof u=="object"&&!Array.isArray(u)&&(r={...r,...u})}else typeof l=="string"&&l.includes("{{")?r[i]=this.evaluateExpression(l,a):typeof l=="object"&&l!==null&&!Array.isArray(l)?r[i]=this.evaluateExpressions(l,a):r[i]=l;return r}evaluateExpressionsIfNeeded(e,a){const r={};for(const[i,l]of Object.entries(e))typeof l=="string"&&l.includes("{{")?r[i]=this.evaluateExpression(l,a):r[i]=l;return r}evaluateExpression(e,a){if(!a)return e;const r=e.match(/^\{\{(.+)\}\}$/);if(!(r&&!r[1].includes("}}")&&!r[1].includes("{{"))){let d=a;if(e.includes("_global")){const g=window.G7Core?.state?.get()?._global;g&&(d={...a,_global:g})}if(e.includes("_computed")||e.includes("$computed")){const g=window.__g7ActionContext?.computedRef?.current;g&&Object.keys(g).length>0&&(d={...d,_computed:g,$computed:g})}return this.bindingEngine.resolveBindings(e,d,{skipCache:!0})}let l=r[1].trim();l=l.replace(/\$args\.(\d+)/g,"$args[$1]");let u=a;if(l.includes("_global")){const f=window.G7Core?.state?.get()?._global;f&&(u={...a,_global:f})}if(l.includes("_computed")||l.includes("$computed")){const f=window.__g7ActionContext?.computedRef?.current;f&&Object.keys(f).length>0&&(u={...u,_computed:f,$computed:f})}l.includes("_global.modules")&&(H.log("[evaluateExpression] expression:",l),H.log("[evaluateExpression] dataContext._global:",u._global),H.log("[evaluateExpression] dataContext._global?.modules:",u._global?.modules));try{const d=this.bindingEngine.evaluateExpression(l,u);return l.includes("_global.modules")&&H.log("[evaluateExpression] result:",d),typeof d=="string"&&d.startsWith("$t:")&&this.translationEngine&&this.translationContext?this.translationEngine.resolveTranslations(d,this.translationContext,a):d}catch(d){return H.error("Expression evaluation failed:",e,d),e}}setDefaultContext(e){this.defaultContext={...this.defaultContext,...e}}setGlobalStateUpdater(e){this.globalStateUpdater=e}getGlobalStateUpdater(){return this.globalStateUpdater}async dispatchAction(e,a){const r={...this.defaultContext,...a,data:{...this.defaultContext.data,...a?.data}};if(e.confirm){let i=this.resolveValue(e.confirm,r.data);if(this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,r.data)),!confirm(i))return{success:!1}}try{return await this.executeAction(e,r)}catch(i){if(H.error("dispatchAction failed:",i),e.onError){const l=i instanceof It&&i.originalError?{message:i.originalError.message,response:i.originalError.response}:{message:i instanceof Error?i.message:String(i)},u={...r,data:{...r.data,error:l}},d=Array.isArray(e.onError)?e.onError:[e.onError];for(const f of d)await this.executeAction(f,u)}return{success:!1,error:i instanceof Error?i:new Error(String(i))}}}registerHandler(e,a,r){this.customHandlers.set(e,a);const i=Un();i?.isEnabled()&&i.trackHandlerRegistration(e,r?.category??"custom",r?.description,r?.source)}unregisterHandler(e){this.customHandlers.delete(e);const a=Un();a?.isEnabled()&&a.trackHandlerUnregistration(e)}getRegisteredHandlers(){return Array.from(this.customHandlers.keys())}getHandler(e){return this.customHandlers.get(e)}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 a=e.target;if(a&&!("tagName"in a)){const l={type:e.type??"custom",target:{value:a.value,name:a.name??""}};return e._changedKeys&&(l._changedKeys=e._changedKeys),l}const i=a?{value:a.value,name:a.name??"",checked:a.checked??!1,type:a.type??"",tagName:a.tagName}:{};if(e.type==="scroll"&&a){const l=a;i.scrollHeight=l.scrollHeight??0,i.scrollTop=l.scrollTop??0,i.clientHeight=l.clientHeight??0,i.scrollLeft=l.scrollLeft??0,i.clientWidth=l.clientWidth??0,i.scrollWidth=l.scrollWidth??0}return{type:e.type,target:a?i:null}}executeDebouncedAction(e,a,r,i,l){const u={...r,$event:a,$args:l},d={type:a.type,target:a.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(e,u,i)(d)}handleDebouncedAction(e,a,r,i,l,u){const d=this.normalizeDebounceConfig(e.debounce),f=l||`default-${e.handler}-${Date.now()}`,g=this.extractEventData(a),m=g._changedKeys;if(m&&Array.isArray(m)&&g?.target?.value&&typeof g.target.value=="object"&&!Array.isArray(g.target.value)){const E=this.debounceAccumulatedValues.get(f);if(E){const A={...E};for(const T of m)A[T]=g.target.value[T];g.target.value=A}this.debounceAccumulatedValues.set(f,g.target.value)}const b=this.debounceTimers.get(f);b&&(clearTimeout(b),this.debounceTimers.delete(f));const v=Un();v?.isEnabled()&&v.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"pending",params:e.params,debounce:{delay:d.delay,status:"pending",scheduledAt:Date.now()}});const S=!this.debounceTimers.has(f+"_leading");if(d.leading&&S&&(this.debounceTimers.set(f+"_leading",setTimeout(()=>{},0)),this.executeDebouncedAction(e,g,r,i,u),v?.isEnabled()&&v.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"success",params:e.params,debounce:{delay:d.delay,status:"executed",executedAt:Date.now(),mode:"leading"}})),d.trailing){const E=()=>{this.executeDebouncedAction(e,g,r,i,u),v?.isEnabled()&&v.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"success",params:e.params,debounce:{delay:d.delay,status:"executed",executedAt:Date.now(),mode:"trailing"}})},A=setTimeout(()=>{this.debounceTimers.delete(f),this.debounceTimers.delete(f+"_leading"),this.pendingDebounceFlushers.delete(f),this.debounceAccumulatedValues.delete(f),E()},d.delay);this.debounceTimers.set(f,A),this.pendingDebounceFlushers.set(f,E)}}clearDebounceTimers(e){if(e)for(const[a,r]of this.debounceTimers)a.startsWith(e+"-")&&(clearTimeout(r),this.debounceTimers.delete(a),this.pendingDebounceFlushers.delete(a),this.debounceAccumulatedValues.delete(a));else{for(const a of this.debounceTimers.values())clearTimeout(a);this.debounceTimers.clear(),this.pendingDebounceFlushers.clear(),this.debounceAccumulatedValues.clear()}}debouncedCall(e,a,r){const i=this.debounceTimers.get(e);i&&(clearTimeout(i),this.debounceTimers.delete(e));const l=setTimeout(()=>{this.debounceTimers.delete(e),this.pendingDebounceFlushers.delete(e),r()},a);this.debounceTimers.set(e,l),this.pendingDebounceFlushers.set(e,r)}flushPendingDebounceTimers(){if(this.pendingDebounceFlushers.size===0)return;const e=new Map(this.pendingDebounceFlushers);for(const[a,r]of e){const i=this.debounceTimers.get(a);i&&(clearTimeout(i),this.debounceTimers.delete(a)),this.debounceTimers.delete(a+"_leading"),this.pendingDebounceFlushers.delete(a),r()}this.globalStateUpdater&&this.globalStateUpdater({})}bindActionsToProps(e,a,r){const i={...e};if(e.actions&&Array.isArray(e.actions)){const l=new Map;for(const m of e.actions){const b=this.resolveActionRef(m),v=b.event||this.getEventHandlerName(b.type);l.has(v)||l.set(v,[]),l.get(v).push(b)}const u=e.name||e.id||"unknown",d=l.has("onDrop"),f=l.has("onDragOver"),g=l.has("onDragEnter");d&&!f&&(i.onDragOver=m=>{m.preventDefault()}),d&&!g&&(i.onDragEnter=m=>{m.preventDefault()});for(const[m,b]of l)i[m]=(...v)=>{for(const S of b){const E=v[0],A=E&&typeof E=="object"&&"preventDefault"in E;if(A&&(m==="onDragOver"||m==="onDrop")&&E.preventDefault(),A&&S.key&&"key"in E){if(this.isImeComposing(E)){H.log("Key filter skipped (IME composing):",S.key);continue}if(E.key!==S.key){H.log("Key filter not matched:",S.key,"actual:",E.key);continue}H.log("Key filter matched:",S.key)}if(S.debounce){const T=`${u}-${S.handler}-${m}`,L=E&&typeof E=="object"&&!("preventDefault"in E)&&"target"in E&&E.target!==null;let M;if(A)M=E;else if(L){const D={type:"custom",target:E.target,preventDefault:()=>{},stopPropagation:()=>{}};E._changedKeys&&(D._changedKeys=E._changedKeys),M=D}else M=new Event("custom");const R=S.event?{...a,$args:v}:a;this.handleDebouncedAction(S,M,R,r,T,v)}else if(this.flushPendingDebounceTimers(),S.event){const T={...a,$args:v},L=A?E:new Event("custom");this.createHandler(S,T,r)(L)}else if(A)this.createHandler(S,a,r)(E);else if(E&&typeof E=="object"&&!("preventDefault"in E)&&"target"in E&&E.target!==null){const L={type:"custom",target:E.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(S,a,r)(L)}}}}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,a=5){const r=new WeakSet,i=(l,u)=>{if(l==null||typeof l=="string"||typeof l=="number"||typeof l=="boolean")return l;if(u>a)return"[Max Depth Exceeded]";if(typeof l=="function")return`[Function: ${l.name||"anonymous"}]`;if(l instanceof Element)return`[Element: ${l.tagName}${l.className?"."+l.className.split(" ").join("."):""}]`;if(l instanceof Event)return`[Event: ${l.type}]`;if(Array.isArray(l)){if(r.has(l))return"[Circular Array]";r.add(l);const d=l.slice(0,10).map(f=>i(f,u+1));return l.length>10&&d.push(`... ${l.length-10} more items`),d}if(typeof l=="object"){if(r.has(l))return"[Circular Reference]";r.add(l);const d={},f=Object.keys(l),g=f.slice(0,20);for(const m of g)try{d[m]=i(l[m],u+1)}catch{d[m]="[Error accessing property]"}return f.length>20&&(d["..."]=`${f.length-20} more properties`),d}return String(l)};return i(e,0)}};$(cs,"loadedScripts",new Set);let oo=cs,Kl=null;function Zp(o){return Kl||(Kl=new oo(o)),Kl}function eC(o){Kl=o}const em=ct("TransitionManager");class tC{constructor(){$(this,"isPending",!1);$(this,"subscribers",new Set)}setPending(e){this.isPending!==e&&(em.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(){em.log("notifySubscribers:",{isPending:this.isPending,subscriberCount:this.subscribers.size}),this.subscribers.forEach(e=>{e(this.isPending)})}clearSubscribers(){this.subscribers.clear()}}const Na=new tC,Wl=ct("TransitionContext"),tm=N.createContext({isTransitioning:!1}),Dd=({children:o})=>{const[e,a]=N.useState(()=>{const i=Na.getIsPending();return Wl.log("Initial state:",i),i});N.useEffect(()=>{Wl.log("Subscribing to TransitionManager");const i=Na.subscribe(l=>{Wl.log("Received isPending update:",l),a(l)});return()=>{Wl.log("Unsubscribing from TransitionManager"),i()}},[]);const r=N.useMemo(()=>({isTransitioning:e}),[e]);return ut.jsx(tm.Provider,{value:r,children:o})},nm=()=>N.useContext(tm),Yl="__g7LocalInitTracking";function Od(){const o=globalThis;return o[Yl]||(o[Yl]={hash:"",timestamp:void 0,consumed:void 0}),o[Yl]}function nC(){const o=globalThis;o[Yl]={hash:"",timestamp:void 0,consumed:void 0}}function aC(o){Od().consumed=o}function rC(o){return Od().consumed===o}function iC(o,e){return typeof o=="number"&&typeof e=="number"?Math.max(o,e):e??o}function sC(o,e){if(e===void 0)return o;if(!(o!==null&&typeof o=="object"&&e!==null&&typeof e=="object"&&!rC(o)))return e;const{_forceLocalInit:r,...i}=o,{_forceLocalInit:l,...u}=e,d={...i,...u},f=iC(r,l);return f!==void 0&&(d._forceLocalInit=f),d}function oC(o){return o<768?"mobile":o<1024?"tablet":"desktop"}function am(o){const e=oC(o);return{width:o,isMobile:e==="mobile",isTablet:e==="tablet",isDesktop:e==="desktop",matchedPreset:e}}const Ld=N.createContext(am(1024)),Xl=({children:o,overrideWidth:e})=>{const[a,r]=N.useState(()=>ci.getWidth());N.useEffect(()=>{const u=ci.subscribe(d=>{r(d)});return()=>{u()}},[]);const i=e??a,l=N.useMemo(()=>am(i),[i]);return ut.jsx(Ld.Provider,{value:l,children:o})},Md=()=>N.useContext(Ld);window.G7Core?.createLogger?.("Core:State");function lC(o,e,a,r){const{syncOnControlledChange:i=!0,isEqual:l}=r??{},u=o!==void 0;N.useRef(u);const[d,f]=N.useState(o!==void 0?o:e),g=d,m=N.useRef(o),b=N.useRef(!1);N.useEffect(()=>{if(b.current){m.current=o;return}i&&u&&o!==m.current&&(l?!l(d,o):d!==o)&&f(o),m.current=o},[o,u,i,l,d]);const v=N.useCallback(S=>{const E=typeof S=="function"?S(g):S;(l?l(g,E):g===E)||(b.current=!0,f(E),a?.(E),requestAnimationFrame(()=>{b.current=!1}))},[g,u,a,l]);return[g,v]}function cC(o,e){return o===e?!0:o.length!==e.length?!1:o.every((a,r)=>a===e[r])}function rm(o,e){if(o===e)return!0;const a=Object.keys(o),r=Object.keys(e);return a.length!==r.length?!1:a.every(i=>o[i]===e[i])}const im=N.createContext({}),uC=({children:o,value:e})=>ut.jsx(im.Provider,{value:e,children:o}),dC=()=>N.useContext(im),fC=(o,e)=>{if(!o)return;const a=e.split(".");let r=o;for(const i of a){if(r==null)return;r=r[i]}return r},hC=(o,e,a)=>{const r=e.split(".");if(r.length===1)return{...o,[r[0]]:a};const i={...o};let l=i;for(let u=0;u<r.length-1;u++){const d=r[u],f=r[u+1],g=/^\d+$/.test(f);Array.isArray(l[d])&&!g?l[d]={...l[d]}:Array.isArray(l[d])?l[d]=[...l[d]]:g?l[d]=Array.isArray(l[d])?[...l[d]]:[]:l[d]={...l[d]||{}},l=l[d]}return l[r[r.length-1]]=a,i},ts=ct("IsolatedStateContext"),gC={state:{},setState:()=>{ts.warn("IsolatedStateContext not available: setState called outside IsolatedStateProvider")},getState:()=>{},mergeState:()=>{ts.warn("IsolatedStateContext not available: mergeState called outside IsolatedStateProvider")},stateRef:{current:{}},scopeId:""},sm=N.createContext(gC);let pC=0;function mC(){return`isolated-${++pC}-${Date.now().toString(36)}`}function om(o,e){if(e==null)return o;if(typeof e!="object"||Array.isArray(e))return e;const a={...o};for(const r of Object.keys(e)){const i=e[r],l=o?.[r];i!==null&&typeof i=="object"&&!Array.isArray(i)&&l!==null&&typeof l=="object"&&!Array.isArray(l)?a[r]=om(l,i):a[r]=i}return a}function yC(o,e){return e?e.split(".").reduce((a,r)=>a?.[r],o):o}function bC(o,e,a){const r=e.split("."),i={...o};let l=i;for(let u=0;u<r.length-1;u++){const d=r[u];l[d]={...l[d]},l=l[d]}return l[r[r.length-1]]=a,i}const vC=({initialState:o={},scopeId:e,children:a})=>{const i=N.useRef(e||mC()).current,[l,u]=N.useState(o),d=N.useRef(l);d.current=l;const f=N.useCallback(S=>yC(d.current,S),[]),g=N.useCallback((S,E)=>{u(A=>{const T=bC(A,S,E);return ts.log(`[${i}] setState: ${S} =`,E),T})},[i]),m=N.useCallback((S,E="deep")=>{u(A=>{let T;return E==="replace"?T=S:E==="shallow"?T={...A,...S}:T=om(A,S),ts.log(`[${i}] mergeState (${E}):`,S),T})},[i]),b=N.useMemo(()=>({state:l,setState:g,getState:f,mergeState:m,stateRef:d,scopeId:i}),[l,g,f,m,i]),v=N.useMemo(()=>({state:d.current,setState:g,getState:f,mergeState:m}),[g,f,m]);return N.useEffect(()=>{const S=window.G7Core,E=window.__g7IsolatedStates||{};return window.__g7IsolatedStates||(window.__g7IsolatedStates=E),E[i]=v,S&&(S._isolatedStates||(S._isolatedStates={}),S._isolatedStates[i]=l),S?.devTools?.isEnabled?.()&&S.devTools.emit?.("isolated:created",{id:i,state:l}),ts.log(`[${i}] IsolatedStateProvider mounted with initial state:`,l),()=>{delete E[i],S?._isolatedStates&&delete S._isolatedStates[i],S?.devTools?.isEnabled?.()&&S.devTools.emit?.("isolated:destroyed",{id:i}),ts.log(`[${i}] IsolatedStateProvider unmounted`)}},[i,v]),N.useEffect(()=>{const S=window.G7Core,E=window.__g7IsolatedStates;E?.[i]&&(E[i].state=l),S?._isolatedStates&&(S._isolatedStates[i]=l),S?.devTools?.isEnabled?.()&&S.devTools.emit?.("isolated:updated",{id:i,state:l})},[l,i]),ut.jsx(sm.Provider,{value:b,children:a})},SC=()=>{const o=N.useContext(sm);return o.scopeId?o:null};var Ar=zg();function wC(){for(var o=arguments.length,e=new Array(o),a=0;a<o;a++)e[a]=arguments[a];return N.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const Jl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ns(o){const e=Object.prototype.toString.call(o);return e==="[object Window]"||e==="[object global]"}function $d(o){return"nodeType"in o}function Tn(o){var e,a;return o?ns(o)?o:$d(o)&&(e=(a=o.ownerDocument)==null?void 0:a.defaultView)!=null?e:window:window}function Nd(o){const{Document:e}=Tn(o);return o instanceof e}function lo(o){return ns(o)?!1:o instanceof Tn(o).HTMLElement}function lm(o){return o instanceof Tn(o).SVGElement}function as(o){return o?ns(o)?o.document:$d(o)?Nd(o)?o:lo(o)||lm(o)?o.ownerDocument:document:document:document}const Ia=Jl?N.useLayoutEffect:N.useEffect;function Id(o){const e=N.useRef(o);return Ia(()=>{e.current=o}),N.useCallback(function(){for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function CC(){const o=N.useRef(null),e=N.useCallback((r,i)=>{o.current=setInterval(r,i)},[]),a=N.useCallback(()=>{o.current!==null&&(clearInterval(o.current),o.current=null)},[]);return[e,a]}function co(o,e){e===void 0&&(e=[o]);const a=N.useRef(o);return Ia(()=>{a.current!==o&&(a.current=o)},e),a}function uo(o,e){const a=N.useRef();return N.useMemo(()=>{const r=o(a.current);return a.current=r,r},[...e])}function Ql(o){const e=Id(o),a=N.useRef(null),r=N.useCallback(i=>{i!==a.current&&e?.(i,a.current),a.current=i},[]);return[a,r]}function Hd(o){const e=N.useRef();return N.useEffect(()=>{e.current=o},[o]),e.current}let zd={};function fo(o,e){return N.useMemo(()=>{if(e)return e;const a=zd[o]==null?0:zd[o]+1;return zd[o]=a,o+"-"+a},[o,e])}function cm(o){return function(e){for(var a=arguments.length,r=new Array(a>1?a-1:0),i=1;i<a;i++)r[i-1]=arguments[i];return r.reduce((l,u)=>{const d=Object.entries(u);for(const[f,g]of d){const m=l[f];m!=null&&(l[f]=m+o*g)}return l},{...e})}}const rs=cm(1),ho=cm(-1);function EC(o){return"clientX"in o&&"clientY"in o}function jd(o){if(!o)return!1;const{KeyboardEvent:e}=Tn(o.target);return e&&o instanceof e}function _C(o){if(!o)return!1;const{TouchEvent:e}=Tn(o.target);return e&&o instanceof e}function Ud(o){if(_C(o)){if(o.touches&&o.touches.length){const{clientX:e,clientY:a}=o.touches[0];return{x:e,y:a}}else if(o.changedTouches&&o.changedTouches.length){const{clientX:e,clientY:a}=o.changedTouches[0];return{x:e,y:a}}}return EC(o)?{x:o.clientX,y:o.clientY}:null}const go=Object.freeze({Translate:{toString(o){if(!o)return;const{x:e,y:a}=o;return"translate3d("+(e?Math.round(e):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(o){if(!o)return;const{scaleX:e,scaleY:a}=o;return"scaleX("+e+") scaleY("+a+")"}},Transform:{toString(o){if(o)return[go.Translate.toString(o),go.Scale.toString(o)].join(" ")}},Transition:{toString(o){let{property:e,duration:a,easing:r}=o;return e+" "+a+"ms "+r}}}),um="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function AC(o){return o.matches(um)?o:o.querySelector(um)}const xC={display:"none"};function TC(o){let{id:e,value:a}=o;return Ye.createElement("div",{id:e,style:xC},a)}function RC(o){let{id:e,announcement:a,ariaLiveType:r="assertive"}=o;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 Ye.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},a)}function kC(){const[o,e]=N.useState("");return{announce:N.useCallback(r=>{r!=null&&e(r)},[]),announcement:o}}const dm=N.createContext(null);function DC(o){const e=N.useContext(dm);N.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(o)},[o,e])}function OC(){const[o]=N.useState(()=>new Set),e=N.useCallback(r=>(o.add(r),()=>o.delete(r)),[o]);return[N.useCallback(r=>{let{type:i,event:l}=r;o.forEach(u=>{var d;return(d=u[i])==null?void 0:d.call(u,l)})},[o]),e]}const LC={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.
|
||
`},MC={onDragStart(o){let{active:e}=o;return"Picked up draggable item "+e.id+"."},onDragOver(o){let{active:e,over:a}=o;return a?"Draggable item "+e.id+" was moved over droppable area "+a.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(o){let{active:e,over:a}=o;return a?"Draggable item "+e.id+" was dropped over droppable area "+a.id:"Draggable item "+e.id+" was dropped."},onDragCancel(o){let{active:e}=o;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function $C(o){let{announcements:e=MC,container:a,hiddenTextDescribedById:r,screenReaderInstructions:i=LC}=o;const{announce:l,announcement:u}=kC(),d=fo("DndLiveRegion"),[f,g]=N.useState(!1);if(N.useEffect(()=>{g(!0)},[]),DC(N.useMemo(()=>({onDragStart(b){let{active:v}=b;l(e.onDragStart({active:v}))},onDragMove(b){let{active:v,over:S}=b;e.onDragMove&&l(e.onDragMove({active:v,over:S}))},onDragOver(b){let{active:v,over:S}=b;l(e.onDragOver({active:v,over:S}))},onDragEnd(b){let{active:v,over:S}=b;l(e.onDragEnd({active:v,over:S}))},onDragCancel(b){let{active:v,over:S}=b;l(e.onDragCancel({active:v,over:S}))}}),[l,e])),!f)return null;const m=Ye.createElement(Ye.Fragment,null,Ye.createElement(TC,{id:r,value:i.draggable}),Ye.createElement(RC,{id:d,announcement:u}));return a?Ar.createPortal(m,a):m}var Zt;(function(o){o.DragStart="dragStart",o.DragMove="dragMove",o.DragEnd="dragEnd",o.DragCancel="dragCancel",o.DragOver="dragOver",o.RegisterDroppable="registerDroppable",o.SetDroppableDisabled="setDroppableDisabled",o.UnregisterDroppable="unregisterDroppable"})(Zt||(Zt={}));function Zl(){}function fm(o,e){return N.useMemo(()=>({sensor:o,options:e??{}}),[o,e])}function NC(){for(var o=arguments.length,e=new Array(o),a=0;a<o;a++)e[a]=arguments[a];return N.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const ma=Object.freeze({x:0,y:0});function hm(o,e){return Math.sqrt(Math.pow(o.x-e.x,2)+Math.pow(o.y-e.y,2))}function gm(o,e){let{data:{value:a}}=o,{data:{value:r}}=e;return a-r}function IC(o,e){let{data:{value:a}}=o,{data:{value:r}}=e;return r-a}function pm(o){let{left:e,top:a,height:r,width:i}=o;return[{x:e,y:a},{x:e+i,y:a},{x:e,y:a+r},{x:e+i,y:a+r}]}function mm(o,e){if(!o||o.length===0)return null;const[a]=o;return a[e]}function ym(o,e,a){return e===void 0&&(e=o.left),a===void 0&&(a=o.top),{x:e+o.width*.5,y:a+o.height*.5}}const HC=o=>{let{collisionRect:e,droppableRects:a,droppableContainers:r}=o;const i=ym(e,e.left,e.top),l=[];for(const u of r){const{id:d}=u,f=a.get(d);if(f){const g=hm(ym(f),i);l.push({id:d,data:{droppableContainer:u,value:g}})}}return l.sort(gm)},zC=o=>{let{collisionRect:e,droppableRects:a,droppableContainers:r}=o;const i=pm(e),l=[];for(const u of r){const{id:d}=u,f=a.get(d);if(f){const g=pm(f),m=i.reduce((v,S,E)=>v+hm(g[E],S),0),b=Number((m/4).toFixed(4));l.push({id:d,data:{droppableContainer:u,value:b}})}}return l.sort(gm)};function jC(o,e){const a=Math.max(e.top,o.top),r=Math.max(e.left,o.left),i=Math.min(e.left+e.width,o.left+o.width),l=Math.min(e.top+e.height,o.top+o.height),u=i-r,d=l-a;if(r<i&&a<l){const f=e.width*e.height,g=o.width*o.height,m=u*d,b=m/(f+g-m);return Number(b.toFixed(4))}return 0}const UC=o=>{let{collisionRect:e,droppableRects:a,droppableContainers:r}=o;const i=[];for(const l of r){const{id:u}=l,d=a.get(u);if(d){const f=jC(d,e);f>0&&i.push({id:u,data:{droppableContainer:l,value:f}})}}return i.sort(IC)};function BC(o,e,a){return{...o,scaleX:e&&a?e.width/a.width:1,scaleY:e&&a?e.height/a.height:1}}function bm(o,e){return o&&e?{x:o.left-e.left,y:o.top-e.top}:ma}function PC(o){return function(a){for(var r=arguments.length,i=new Array(r>1?r-1:0),l=1;l<r;l++)i[l-1]=arguments[l];return i.reduce((u,d)=>({...u,top:u.top+o*d.y,bottom:u.bottom+o*d.y,left:u.left+o*d.x,right:u.right+o*d.x}),{...a})}}const qC=PC(1);function GC(o){if(o.startsWith("matrix3d(")){const e=o.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(o.startsWith("matrix(")){const e=o.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function VC(o,e,a){const r=GC(e);if(!r)return o;const{scaleX:i,scaleY:l,x:u,y:d}=r,f=o.left-u-(1-i)*parseFloat(a),g=o.top-d-(1-l)*parseFloat(a.slice(a.indexOf(" ")+1)),m=i?o.width/i:o.width,b=l?o.height/l:o.height;return{width:m,height:b,top:g,right:f+m,bottom:g+b,left:f}}const FC={ignoreTransform:!1};function is(o,e){e===void 0&&(e=FC);let a=o.getBoundingClientRect();if(e.ignoreTransform){const{transform:g,transformOrigin:m}=Tn(o).getComputedStyle(o);g&&(a=VC(a,g,m))}const{top:r,left:i,width:l,height:u,bottom:d,right:f}=a;return{top:r,left:i,width:l,height:u,bottom:d,right:f}}function vm(o){return is(o,{ignoreTransform:!0})}function KC(o){const e=o.innerWidth,a=o.innerHeight;return{top:0,left:0,right:e,bottom:a,width:e,height:a}}function WC(o,e){return e===void 0&&(e=Tn(o).getComputedStyle(o)),e.position==="fixed"}function YC(o,e){e===void 0&&(e=Tn(o).getComputedStyle(o));const a=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const l=e[i];return typeof l=="string"?a.test(l):!1})}function ec(o,e){const a=[];function r(i){if(e!=null&&a.length>=e||!i)return a;if(Nd(i)&&i.scrollingElement!=null&&!a.includes(i.scrollingElement))return a.push(i.scrollingElement),a;if(!lo(i)||lm(i)||a.includes(i))return a;const l=Tn(o).getComputedStyle(i);return i!==o&&YC(i,l)&&a.push(i),WC(i,l)?a:r(i.parentNode)}return o?r(o):a}function Sm(o){const[e]=ec(o,1);return e??null}function Bd(o){return!Jl||!o?null:ns(o)?o:$d(o)?Nd(o)||o===as(o).scrollingElement?window:lo(o)?o:null:null}function wm(o){return ns(o)?o.scrollX:o.scrollLeft}function Cm(o){return ns(o)?o.scrollY:o.scrollTop}function Pd(o){return{x:wm(o),y:Cm(o)}}var ln;(function(o){o[o.Forward=1]="Forward",o[o.Backward=-1]="Backward"})(ln||(ln={}));function Em(o){return!Jl||!o?!1:o===document.scrollingElement}function _m(o){const e={x:0,y:0},a=Em(o)?{height:window.innerHeight,width:window.innerWidth}:{height:o.clientHeight,width:o.clientWidth},r={x:o.scrollWidth-a.width,y:o.scrollHeight-a.height},i=o.scrollTop<=e.y,l=o.scrollLeft<=e.x,u=o.scrollTop>=r.y,d=o.scrollLeft>=r.x;return{isTop:i,isLeft:l,isBottom:u,isRight:d,maxScroll:r,minScroll:e}}const XC={x:.2,y:.2};function JC(o,e,a,r,i){let{top:l,left:u,right:d,bottom:f}=a;r===void 0&&(r=10),i===void 0&&(i=XC);const{isTop:g,isBottom:m,isLeft:b,isRight:v}=_m(o),S={x:0,y:0},E={x:0,y:0},A={height:e.height*i.y,width:e.width*i.x};return!g&&l<=e.top+A.height?(S.y=ln.Backward,E.y=r*Math.abs((e.top+A.height-l)/A.height)):!m&&f>=e.bottom-A.height&&(S.y=ln.Forward,E.y=r*Math.abs((e.bottom-A.height-f)/A.height)),!v&&d>=e.right-A.width?(S.x=ln.Forward,E.x=r*Math.abs((e.right-A.width-d)/A.width)):!b&&u<=e.left+A.width&&(S.x=ln.Backward,E.x=r*Math.abs((e.left+A.width-u)/A.width)),{direction:S,speed:E}}function QC(o){if(o===document.scrollingElement){const{innerWidth:l,innerHeight:u}=window;return{top:0,left:0,right:l,bottom:u,width:l,height:u}}const{top:e,left:a,right:r,bottom:i}=o.getBoundingClientRect();return{top:e,left:a,right:r,bottom:i,width:o.clientWidth,height:o.clientHeight}}function Am(o){return o.reduce((e,a)=>rs(e,Pd(a)),ma)}function ZC(o){return o.reduce((e,a)=>e+wm(a),0)}function eE(o){return o.reduce((e,a)=>e+Cm(a),0)}function tE(o,e){if(e===void 0&&(e=is),!o)return;const{top:a,left:r,bottom:i,right:l}=e(o);Sm(o)&&(i<=0||l<=0||a>=window.innerHeight||r>=window.innerWidth)&&o.scrollIntoView({block:"center",inline:"center"})}const nE=[["x",["left","right"],ZC],["y",["top","bottom"],eE]];class qd{constructor(e,a){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 r=ec(a),i=Am(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[l,u,d]of nE)for(const f of u)Object.defineProperty(this,f,{get:()=>{const g=d(r),m=i[l]-g;return this.rect[f]+m},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class po{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(a=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...a)})},this.target=e}add(e,a,r){var i;(i=this.target)==null||i.addEventListener(e,a,r),this.listeners.push([e,a,r])}}function aE(o){const{EventTarget:e}=Tn(o);return o instanceof e?o:as(o)}function Gd(o,e){const a=Math.abs(o.x),r=Math.abs(o.y);return typeof e=="number"?Math.sqrt(a**2+r**2)>e:"x"in e&&"y"in e?a>e.x&&r>e.y:"x"in e?a>e.x:"y"in e?r>e.y:!1}var Qn;(function(o){o.Click="click",o.DragStart="dragstart",o.Keydown="keydown",o.ContextMenu="contextmenu",o.Resize="resize",o.SelectionChange="selectionchange",o.VisibilityChange="visibilitychange"})(Qn||(Qn={}));function xm(o){o.preventDefault()}function rE(o){o.stopPropagation()}var it;(function(o){o.Space="Space",o.Down="ArrowDown",o.Right="ArrowRight",o.Left="ArrowLeft",o.Up="ArrowUp",o.Esc="Escape",o.Enter="Enter",o.Tab="Tab"})(it||(it={}));const Tm={start:[it.Space,it.Enter],cancel:[it.Esc],end:[it.Space,it.Enter,it.Tab]},iE=(o,e)=>{let{currentCoordinates:a}=e;switch(o.code){case it.Right:return{...a,x:a.x+25};case it.Left:return{...a,x:a.x-25};case it.Down:return{...a,y:a.y+25};case it.Up:return{...a,y:a.y-25}}};class Vd{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:a}}=e;this.props=e,this.listeners=new po(as(a)),this.windowListeners=new po(Tn(a)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qn.Resize,this.handleCancel),this.windowListeners.add(Qn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:a}=this.props,r=e.node.current;r&&tE(r),a(ma)}handleKeyDown(e){if(jd(e)){const{active:a,context:r,options:i}=this.props,{keyboardCodes:l=Tm,coordinateGetter:u=iE,scrollBehavior:d="smooth"}=i,{code:f}=e;if(l.end.includes(f)){this.handleEnd(e);return}if(l.cancel.includes(f)){this.handleCancel(e);return}const{collisionRect:g}=r.current,m=g?{x:g.left,y:g.top}:ma;this.referenceCoordinates||(this.referenceCoordinates=m);const b=u(e,{active:a,context:r.current,currentCoordinates:m});if(b){const v=ho(b,m),S={x:0,y:0},{scrollableAncestors:E}=r.current;for(const A of E){const T=e.code,{isTop:L,isRight:M,isLeft:R,isBottom:D,maxScroll:U,minScroll:j}=_m(A),P=QC(A),X={x:Math.min(T===it.Right?P.right-P.width/2:P.right,Math.max(T===it.Right?P.left:P.left+P.width/2,b.x)),y:Math.min(T===it.Down?P.bottom-P.height/2:P.bottom,Math.max(T===it.Down?P.top:P.top+P.height/2,b.y))},ge=T===it.Right&&!M||T===it.Left&&!R,Ee=T===it.Down&&!D||T===it.Up&&!L;if(ge&&X.x!==b.x){const Ce=A.scrollLeft+v.x,$e=T===it.Right&&Ce<=U.x||T===it.Left&&Ce>=j.x;if($e&&!v.y){A.scrollTo({left:Ce,behavior:d});return}$e?S.x=A.scrollLeft-Ce:S.x=T===it.Right?A.scrollLeft-U.x:A.scrollLeft-j.x,S.x&&A.scrollBy({left:-S.x,behavior:d});break}else if(Ee&&X.y!==b.y){const Ce=A.scrollTop+v.y,$e=T===it.Down&&Ce<=U.y||T===it.Up&&Ce>=j.y;if($e&&!v.x){A.scrollTo({top:Ce,behavior:d});return}$e?S.y=A.scrollTop-Ce:S.y=T===it.Down?A.scrollTop-U.y:A.scrollTop-j.y,S.y&&A.scrollBy({top:-S.y,behavior:d});break}}this.handleMove(e,rs(ho(b,this.referenceCoordinates),S))}}}handleMove(e,a){const{onMove:r}=this.props;e.preventDefault(),r(a)}handleEnd(e){const{onEnd:a}=this.props;e.preventDefault(),this.detach(),a()}handleCancel(e){const{onCancel:a}=this.props;e.preventDefault(),this.detach(),a()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Vd.activators=[{eventName:"onKeyDown",handler:(o,e,a)=>{let{keyboardCodes:r=Tm,onActivation:i}=e,{active:l}=a;const{code:u}=o.nativeEvent;if(r.start.includes(u)){const d=l.activatorNode.current;return d&&o.target!==d?!1:(o.preventDefault(),i?.({event:o.nativeEvent}),!0)}return!1}}];function Rm(o){return!!(o&&"distance"in o)}function km(o){return!!(o&&"delay"in o)}class Fd{constructor(e,a,r){var i;r===void 0&&(r=aE(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=a;const{event:l}=e,{target:u}=l;this.props=e,this.events=a,this.document=as(u),this.documentListeners=new po(this.document),this.listeners=new po(r),this.windowListeners=new po(Tn(u)),this.initialCoordinates=(i=Ud(l))!=null?i:ma,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:a,bypassActivationConstraint:r}}}=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(Qn.Resize,this.handleCancel),this.windowListeners.add(Qn.DragStart,xm),this.windowListeners.add(Qn.VisibilityChange,this.handleCancel),this.windowListeners.add(Qn.ContextMenu,xm),this.documentListeners.add(Qn.Keydown,this.handleKeydown),a){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(km(a)){this.timeoutId=setTimeout(this.handleStart,a.delay),this.handlePending(a);return}if(Rm(a)){this.handlePending(a);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,a){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,a)}handleStart(){const{initialCoordinates:e}=this,{onStart:a}=this.props;e&&(this.activated=!0,this.documentListeners.add(Qn.Click,rE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qn.SelectionChange,this.removeTextSelection),a(e))}handleMove(e){var a;const{activated:r,initialCoordinates:i,props:l}=this,{onMove:u,options:{activationConstraint:d}}=l;if(!i)return;const f=(a=Ud(e))!=null?a:ma,g=ho(i,f);if(!r&&d){if(Rm(d)){if(d.tolerance!=null&&Gd(g,d.tolerance))return this.handleCancel();if(Gd(g,d.distance))return this.handleStart()}if(km(d)&&Gd(g,d.tolerance))return this.handleCancel();this.handlePending(d,g);return}e.cancelable&&e.preventDefault(),u(f)}handleEnd(){const{onAbort:e,onEnd:a}=this.props;this.detach(),this.activated||e(this.props.active),a()}handleCancel(){const{onAbort:e,onCancel:a}=this.props;this.detach(),this.activated||e(this.props.active),a()}handleKeydown(e){e.code===it.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const sE={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Kd extends Fd{constructor(e){const{event:a}=e,r=as(a.target);super(e,sE,r)}}Kd.activators=[{eventName:"onPointerDown",handler:(o,e)=>{let{nativeEvent:a}=o,{onActivation:r}=e;return!a.isPrimary||a.button!==0?!1:(r?.({event:a}),!0)}}];const oE={move:{name:"mousemove"},end:{name:"mouseup"}};var Wd;(function(o){o[o.RightClick=2]="RightClick"})(Wd||(Wd={}));class lE extends Fd{constructor(e){super(e,oE,as(e.event.target))}}lE.activators=[{eventName:"onMouseDown",handler:(o,e)=>{let{nativeEvent:a}=o,{onActivation:r}=e;return a.button===Wd.RightClick?!1:(r?.({event:a}),!0)}}];const Yd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class cE extends Fd{constructor(e){super(e,Yd)}static setup(){return window.addEventListener(Yd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Yd.move.name,e)};function e(){}}}cE.activators=[{eventName:"onTouchStart",handler:(o,e)=>{let{nativeEvent:a}=o,{onActivation:r}=e;const{touches:i}=a;return i.length>1?!1:(r?.({event:a}),!0)}}];var mo;(function(o){o[o.Pointer=0]="Pointer",o[o.DraggableRect=1]="DraggableRect"})(mo||(mo={}));var tc;(function(o){o[o.TreeOrder=0]="TreeOrder",o[o.ReversedTreeOrder=1]="ReversedTreeOrder"})(tc||(tc={}));function uE(o){let{acceleration:e,activator:a=mo.Pointer,canScroll:r,draggingRect:i,enabled:l,interval:u=5,order:d=tc.TreeOrder,pointerCoordinates:f,scrollableAncestors:g,scrollableAncestorRects:m,delta:b,threshold:v}=o;const S=fE({delta:b,disabled:!l}),[E,A]=CC(),T=N.useRef({x:0,y:0}),L=N.useRef({x:0,y:0}),M=N.useMemo(()=>{switch(a){case mo.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case mo.DraggableRect:return i}},[a,i,f]),R=N.useRef(null),D=N.useCallback(()=>{const j=R.current;if(!j)return;const P=T.current.x*L.current.x,X=T.current.y*L.current.y;j.scrollBy(P,X)},[]),U=N.useMemo(()=>d===tc.TreeOrder?[...g].reverse():g,[d,g]);N.useEffect(()=>{if(!l||!g.length||!M){A();return}for(const j of U){if(r?.(j)===!1)continue;const P=g.indexOf(j),X=m[P];if(!X)continue;const{direction:ge,speed:Ee}=JC(j,X,M,e,v);for(const Ce of["x","y"])S[Ce][ge[Ce]]||(Ee[Ce]=0,ge[Ce]=0);if(Ee.x>0||Ee.y>0){A(),R.current=j,E(D,u),T.current=Ee,L.current=ge;return}}T.current={x:0,y:0},L.current={x:0,y:0},A()},[e,D,r,A,l,u,JSON.stringify(M),JSON.stringify(S),E,g,U,m,JSON.stringify(v)])}const dE={x:{[ln.Backward]:!1,[ln.Forward]:!1},y:{[ln.Backward]:!1,[ln.Forward]:!1}};function fE(o){let{delta:e,disabled:a}=o;const r=Hd(e);return uo(i=>{if(a||!r||!i)return dE;const l={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ln.Backward]:i.x[ln.Backward]||l.x===-1,[ln.Forward]:i.x[ln.Forward]||l.x===1},y:{[ln.Backward]:i.y[ln.Backward]||l.y===-1,[ln.Forward]:i.y[ln.Forward]||l.y===1}}},[a,e,r])}function hE(o,e){const a=e!=null?o.get(e):void 0,r=a?a.node.current:null;return uo(i=>{var l;return e==null?null:(l=r??i)!=null?l:null},[r,e])}function gE(o,e){return N.useMemo(()=>o.reduce((a,r)=>{const{sensor:i}=r,l=i.activators.map(u=>({eventName:u.eventName,handler:e(u.handler,r)}));return[...a,...l]},[]),[o,e])}var yo;(function(o){o[o.Always=0]="Always",o[o.BeforeDragging=1]="BeforeDragging",o[o.WhileDragging=2]="WhileDragging"})(yo||(yo={}));var Xd;(function(o){o.Optimized="optimized"})(Xd||(Xd={}));const Dm=new Map;function pE(o,e){let{dragging:a,dependencies:r,config:i}=e;const[l,u]=N.useState(null),{frequency:d,measure:f,strategy:g}=i,m=N.useRef(o),b=T(),v=co(b),S=N.useCallback(function(L){L===void 0&&(L=[]),!v.current&&u(M=>M===null?L:M.concat(L.filter(R=>!M.includes(R))))},[v]),E=N.useRef(null),A=uo(L=>{if(b&&!a)return Dm;if(!L||L===Dm||m.current!==o||l!=null){const M=new Map;for(let R of o){if(!R)continue;if(l&&l.length>0&&!l.includes(R.id)&&R.rect.current){M.set(R.id,R.rect.current);continue}const D=R.node.current,U=D?new qd(f(D),D):null;R.rect.current=U,U&&M.set(R.id,U)}return M}return L},[o,l,a,b,f]);return N.useEffect(()=>{m.current=o},[o]),N.useEffect(()=>{b||S()},[a,b]),N.useEffect(()=>{l&&l.length>0&&u(null)},[JSON.stringify(l)]),N.useEffect(()=>{b||typeof d!="number"||E.current!==null||(E.current=setTimeout(()=>{S(),E.current=null},d))},[d,b,S,...r]),{droppableRects:A,measureDroppableContainers:S,measuringScheduled:l!=null};function T(){switch(g){case yo.Always:return!1;case yo.BeforeDragging:return a;default:return!a}}}function Om(o,e){return uo(a=>o?a||(typeof e=="function"?e(o):o):null,[e,o])}function mE(o,e){return Om(o,e)}function yE(o){let{callback:e,disabled:a}=o;const r=Id(e),i=N.useMemo(()=>{if(a||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(r)},[r,a]);return N.useEffect(()=>()=>i?.disconnect(),[i]),i}function nc(o){let{callback:e,disabled:a}=o;const r=Id(e),i=N.useMemo(()=>{if(a||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(r)},[a]);return N.useEffect(()=>()=>i?.disconnect(),[i]),i}function bE(o){return new qd(is(o),o)}function Lm(o,e,a){e===void 0&&(e=bE);const[r,i]=N.useState(null);function l(){i(f=>{if(!o)return null;if(o.isConnected===!1){var g;return(g=f??a)!=null?g:null}const m=e(o);return JSON.stringify(f)===JSON.stringify(m)?f:m})}const u=yE({callback(f){if(o)for(const g of f){const{type:m,target:b}=g;if(m==="childList"&&b instanceof HTMLElement&&b.contains(o)){l();break}}}}),d=nc({callback:l});return Ia(()=>{l(),o?(d?.observe(o),u?.observe(document.body,{childList:!0,subtree:!0})):(d?.disconnect(),u?.disconnect())},[o]),r}function vE(o){const e=Om(o);return bm(o,e)}const Mm=[];function SE(o){const e=N.useRef(o),a=uo(r=>o?r&&r!==Mm&&o&&e.current&&o.parentNode===e.current.parentNode?r:ec(o):Mm,[o]);return N.useEffect(()=>{e.current=o},[o]),a}function wE(o){const[e,a]=N.useState(null),r=N.useRef(o),i=N.useCallback(l=>{const u=Bd(l.target);u&&a(d=>d?(d.set(u,Pd(u)),new Map(d)):null)},[]);return N.useEffect(()=>{const l=r.current;if(o!==l){u(l);const d=o.map(f=>{const g=Bd(f);return g?(g.addEventListener("scroll",i,{passive:!0}),[g,Pd(g)]):null}).filter(f=>f!=null);a(d.length?new Map(d):null),r.current=o}return()=>{u(o),u(l)};function u(d){d.forEach(f=>{const g=Bd(f);g?.removeEventListener("scroll",i)})}},[i,o]),N.useMemo(()=>o.length?e?Array.from(e.values()).reduce((l,u)=>rs(l,u),ma):Am(o):ma,[o,e])}function $m(o,e){e===void 0&&(e=[]);const a=N.useRef(null);return N.useEffect(()=>{a.current=null},e),N.useEffect(()=>{const r=o!==ma;r&&!a.current&&(a.current=o),!r&&a.current&&(a.current=null)},[o]),a.current?ho(o,a.current):ma}function CE(o){N.useEffect(()=>{if(!Jl)return;const e=o.map(a=>{let{sensor:r}=a;return r.setup==null?void 0:r.setup()});return()=>{for(const a of e)a?.()}},o.map(e=>{let{sensor:a}=e;return a}))}function EE(o,e){return N.useMemo(()=>o.reduce((a,r)=>{let{eventName:i,handler:l}=r;return a[i]=u=>{l(u,e)},a},{}),[o,e])}function Nm(o){return N.useMemo(()=>o?KC(o):null,[o])}const Im=[];function _E(o,e){e===void 0&&(e=is);const[a]=o,r=Nm(a?Tn(a):null),[i,l]=N.useState(Im);function u(){l(()=>o.length?o.map(f=>Em(f)?r:new qd(e(f),f)):Im)}const d=nc({callback:u});return Ia(()=>{d?.disconnect(),u(),o.forEach(f=>d?.observe(f))},[o]),i}function AE(o){if(!o)return null;if(o.children.length>1)return o;const e=o.children[0];return lo(e)?e:o}function xE(o){let{measure:e}=o;const[a,r]=N.useState(null),i=N.useCallback(g=>{for(const{target:m}of g)if(lo(m)){r(b=>{const v=e(m);return b?{...b,width:v.width,height:v.height}:v});break}},[e]),l=nc({callback:i}),u=N.useCallback(g=>{const m=AE(g);l?.disconnect(),m&&l?.observe(m),r(m?e(m):null)},[e,l]),[d,f]=Ql(u);return N.useMemo(()=>({nodeRef:d,rect:a,setRef:f}),[a,d,f])}const TE=[{sensor:Kd,options:{}},{sensor:Vd,options:{}}],RE={current:{}},ac={draggable:{measure:vm},droppable:{measure:vm,strategy:yo.WhileDragging,frequency:Xd.Optimized},dragOverlay:{measure:is}};class bo extends Map{get(e){var a;return e!=null&&(a=super.get(e))!=null?a:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:a}=e;return!a})}getNodeFor(e){var a,r;return(a=(r=this.get(e))==null?void 0:r.node.current)!=null?a:void 0}}const kE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Zl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ac,measureDroppableContainers:Zl,windowRect:null,measuringScheduled:!1},DE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Zl,draggableNodes:new Map,over:null,measureDroppableContainers:Zl},rc=N.createContext(DE),Hm=N.createContext(kE);function OE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bo}}}function LE(o,e){switch(e.type){case Zt.DragStart:return{...o,draggable:{...o.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Zt.DragMove:return o.draggable.active==null?o:{...o,draggable:{...o.draggable,translate:{x:e.coordinates.x-o.draggable.initialCoordinates.x,y:e.coordinates.y-o.draggable.initialCoordinates.y}}};case Zt.DragEnd:case Zt.DragCancel:return{...o,draggable:{...o.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zt.RegisterDroppable:{const{element:a}=e,{id:r}=a,i=new bo(o.droppable.containers);return i.set(r,a),{...o,droppable:{...o.droppable,containers:i}}}case Zt.SetDroppableDisabled:{const{id:a,key:r,disabled:i}=e,l=o.droppable.containers.get(a);if(!l||r!==l.key)return o;const u=new bo(o.droppable.containers);return u.set(a,{...l,disabled:i}),{...o,droppable:{...o.droppable,containers:u}}}case Zt.UnregisterDroppable:{const{id:a,key:r}=e,i=o.droppable.containers.get(a);if(!i||r!==i.key)return o;const l=new bo(o.droppable.containers);return l.delete(a),{...o,droppable:{...o.droppable,containers:l}}}default:return o}}function ME(o){let{disabled:e}=o;const{active:a,activatorEvent:r,draggableNodes:i}=N.useContext(rc),l=Hd(r),u=Hd(a?.id);return N.useEffect(()=>{if(!e&&!r&&l&&u!=null){if(!jd(l)||document.activeElement===l.target)return;const d=i.get(u);if(!d)return;const{activatorNode:f,node:g}=d;if(!f.current&&!g.current)return;requestAnimationFrame(()=>{for(const m of[f.current,g.current]){if(!m)continue;const b=AC(m);if(b){b.focus();break}}})}},[r,e,i,u,l]),null}function $E(o,e){let{transform:a,...r}=e;return o!=null&&o.length?o.reduce((i,l)=>l({transform:i,...r}),a):a}function NE(o){return N.useMemo(()=>({draggable:{...ac.draggable,...o?.draggable},droppable:{...ac.droppable,...o?.droppable},dragOverlay:{...ac.dragOverlay,...o?.dragOverlay}}),[o?.draggable,o?.droppable,o?.dragOverlay])}function IE(o){let{activeNode:e,measure:a,initialRect:r,config:i=!0}=o;const l=N.useRef(!1),{x:u,y:d}=typeof i=="boolean"?{x:i,y:i}:i;Ia(()=>{if(!u&&!d||!e){l.current=!1;return}if(l.current||!r)return;const g=e?.node.current;if(!g||g.isConnected===!1)return;const m=a(g),b=bm(m,r);if(u||(b.x=0),d||(b.y=0),l.current=!0,Math.abs(b.x)>0||Math.abs(b.y)>0){const v=Sm(g);v&&v.scrollBy({top:b.y,left:b.x})}},[e,u,d,r,a])}const zm=N.createContext({...ma,scaleX:1,scaleY:1});var xr;(function(o){o[o.Uninitialized=0]="Uninitialized",o[o.Initializing=1]="Initializing",o[o.Initialized=2]="Initialized"})(xr||(xr={}));const HE=N.memo(function(e){var a,r,i,l;let{id:u,accessibility:d,autoScroll:f=!0,children:g,sensors:m=TE,collisionDetection:b=UC,measuring:v,modifiers:S,...E}=e;const A=N.useReducer(LE,void 0,OE),[T,L]=A,[M,R]=OC(),[D,U]=N.useState(xr.Uninitialized),j=D===xr.Initialized,{draggable:{active:P,nodes:X,translate:ge},droppable:{containers:Ee}}=T,Ce=P!=null?X.get(P):null,$e=N.useRef({initial:null,translated:null}),Pe=N.useMemo(()=>{var Re;return P!=null?{id:P,data:(Re=Ce?.data)!=null?Re:RE,rect:$e}:null},[P,Ce]),Xe=N.useRef(null),[ht,Q]=N.useState(null),[fe,ye]=N.useState(null),te=co(E,Object.values(E)),he=fo("DndDescribedBy",u),x=N.useMemo(()=>Ee.getEnabled(),[Ee]),K=NE(v),{droppableRects:re,measureDroppableContainers:de,measuringScheduled:se}=pE(x,{dragging:j,dependencies:[ge.x,ge.y],config:K.droppable}),me=hE(X,P),Ne=N.useMemo(()=>fe?Ud(fe):null,[fe]),ve=Se(),He=mE(me,K.draggable.measure);IE({activeNode:P!=null?X.get(P):null,config:ve.layoutShiftCompensation,initialRect:He,measure:K.draggable.measure});const Ae=Lm(me,K.draggable.measure,He),Et=Lm(me?me.parentElement:null),Rt=N.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:X,draggingNode:null,draggingNodeRect:null,droppableContainers:Ee,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_t=Ee.getNodeFor((a=Rt.current.over)==null?void 0:a.id),ft=xE({measure:K.dragOverlay.measure}),un=(r=ft.nodeRef.current)!=null?r:me,gt=j?(i=ft.rect)!=null?i:Ae:null,ja=!!(ft.nodeRef.current&&ft.rect),kn=vE(ja?null:Ae),Dn=Nm(un?Tn(un):null),jt=SE(j?_t??me:null),On=_E(jt),ea=$E(S,{transform:{x:ge.x-kn.x,y:ge.y-kn.y,scaleX:1,scaleY:1},activatorEvent:fe,active:Pe,activeNodeRect:Ae,containerNodeRect:Et,draggingNodeRect:gt,over:Rt.current.over,overlayNodeRect:ft.rect,scrollableAncestors:jt,scrollableAncestorRects:On,windowRect:Dn}),Ua=Ne?rs(Ne,ge):null,Ft=wE(jt),Dr=$m(Ft),er=$m(Ft,[Ae]),bn=rs(ea,Dr),en=gt?qC(gt,ea):null,et=Pe&&en?b({active:Pe,collisionRect:en,droppableRects:re,droppableContainers:x,pointerCoordinates:Ua}):null,ta=mm(et,"id"),[En,tr]=N.useState(null),Ea=ja?ea:rs(ea,er),tn=BC(Ea,(l=En?.rect)!=null?l:null,Ae),_n=N.useRef(null),q=N.useCallback((Re,xe)=>{let{sensor:je,options:ze}=xe;if(Xe.current==null)return;const Le=X.get(Xe.current);if(!Le)return;const ke=Re.nativeEvent,We=new je({active:Xe.current,activeNode:Le,event:ke,options:ze,context:Rt,onAbort(_e){if(!X.get(_e))return;const{onDragAbort:Ue}=te.current,st={id:_e};Ue?.(st),M({type:"onDragAbort",event:st})},onPending(_e,Te,Ue,st){if(!X.get(_e))return;const{onDragPending:nn}=te.current,Kt={id:_e,constraint:Te,initialCoordinates:Ue,offset:st};nn?.(Kt),M({type:"onDragPending",event:Kt})},onStart(_e){const Te=Xe.current;if(Te==null)return;const Ue=X.get(Te);if(!Ue)return;const{onDragStart:st}=te.current,Dt={activatorEvent:ke,active:{id:Te,data:Ue.data,rect:$e}};Ar.unstable_batchedUpdates(()=>{st?.(Dt),U(xr.Initializing),L({type:Zt.DragStart,initialCoordinates:_e,active:Te}),M({type:"onDragStart",event:Dt}),Q(_n.current),ye(ke)})},onMove(_e){L({type:Zt.DragMove,coordinates:_e})},onEnd:Fe(Zt.DragEnd),onCancel:Fe(Zt.DragCancel)});_n.current=We;function Fe(_e){return async function(){const{active:Ue,collisions:st,over:Dt,scrollAdjustedTranslate:nn}=Rt.current;let Kt=null;if(Ue&&nn){const{cancelDrop:qn}=te.current;Kt={activatorEvent:ke,active:Ue,collisions:st,delta:nn,over:Dt},_e===Zt.DragEnd&&typeof qn=="function"&&await Promise.resolve(qn(Kt))&&(_e=Zt.DragCancel)}Xe.current=null,Ar.unstable_batchedUpdates(()=>{L({type:_e}),U(xr.Uninitialized),tr(null),Q(null),ye(null),_n.current=null;const qn=_e===Zt.DragEnd?"onDragEnd":"onDragCancel";if(Kt){const Ln=te.current[qn];Ln?.(Kt),M({type:qn,event:Kt})}})}}},[X]),ce=N.useCallback((Re,xe)=>(je,ze)=>{const Le=je.nativeEvent,ke=X.get(ze);if(Xe.current!==null||!ke||Le.dndKit||Le.defaultPrevented)return;const We={active:ke};Re(je,xe.options,We)===!0&&(Le.dndKit={capturedBy:xe.sensor},Xe.current=ze,q(je,xe))},[X,q]),le=gE(m,ce);CE(m),Ia(()=>{Ae&&D===xr.Initializing&&U(xr.Initialized)},[Ae,D]),N.useEffect(()=>{const{onDragMove:Re}=te.current,{active:xe,activatorEvent:je,collisions:ze,over:Le}=Rt.current;if(!xe||!je)return;const ke={active:xe,activatorEvent:je,collisions:ze,delta:{x:bn.x,y:bn.y},over:Le};Ar.unstable_batchedUpdates(()=>{Re?.(ke),M({type:"onDragMove",event:ke})})},[bn.x,bn.y]),N.useEffect(()=>{const{active:Re,activatorEvent:xe,collisions:je,droppableContainers:ze,scrollAdjustedTranslate:Le}=Rt.current;if(!Re||Xe.current==null||!xe||!Le)return;const{onDragOver:ke}=te.current,We=ze.get(ta),Fe=We&&We.rect.current?{id:We.id,rect:We.rect.current,data:We.data,disabled:We.disabled}:null,_e={active:Re,activatorEvent:xe,collisions:je,delta:{x:Le.x,y:Le.y},over:Fe};Ar.unstable_batchedUpdates(()=>{tr(Fe),ke?.(_e),M({type:"onDragOver",event:_e})})},[ta]),Ia(()=>{Rt.current={activatorEvent:fe,active:Pe,activeNode:me,collisionRect:en,collisions:et,droppableRects:re,draggableNodes:X,draggingNode:un,draggingNodeRect:gt,droppableContainers:Ee,over:En,scrollableAncestors:jt,scrollAdjustedTranslate:bn},$e.current={initial:gt,translated:en}},[Pe,me,et,en,X,un,gt,re,Ee,En,jt,bn]),uE({...ve,delta:ge,draggingRect:en,pointerCoordinates:Ua,scrollableAncestors:jt,scrollableAncestorRects:On});const Z=N.useMemo(()=>({active:Pe,activeNode:me,activeNodeRect:Ae,activatorEvent:fe,collisions:et,containerNodeRect:Et,dragOverlay:ft,draggableNodes:X,droppableContainers:Ee,droppableRects:re,over:En,measureDroppableContainers:de,scrollableAncestors:jt,scrollableAncestorRects:On,measuringConfiguration:K,measuringScheduled:se,windowRect:Dn}),[Pe,me,Ae,fe,et,Et,ft,X,Ee,re,En,de,jt,On,K,se,Dn]),be=N.useMemo(()=>({activatorEvent:fe,activators:le,active:Pe,activeNodeRect:Ae,ariaDescribedById:{draggable:he},dispatch:L,draggableNodes:X,over:En,measureDroppableContainers:de}),[fe,le,Pe,Ae,L,he,X,En,de]);return Ye.createElement(dm.Provider,{value:R},Ye.createElement(rc.Provider,{value:be},Ye.createElement(Hm.Provider,{value:Z},Ye.createElement(zm.Provider,{value:tn},g)),Ye.createElement(ME,{disabled:d?.restoreFocus===!1})),Ye.createElement($C,{...d,hiddenTextDescribedById:he}));function Se(){const Re=ht?.autoScrollEnabled===!1,xe=typeof f=="object"?f.enabled===!1:f===!1,je=j&&!Re&&!xe;return typeof f=="object"?{...f,enabled:je}:{enabled:je}}}),zE=N.createContext(null),jm="button",jE="Draggable";function UE(o){let{id:e,data:a,disabled:r=!1,attributes:i}=o;const l=fo(jE),{activators:u,activatorEvent:d,active:f,activeNodeRect:g,ariaDescribedById:m,draggableNodes:b,over:v}=N.useContext(rc),{role:S=jm,roleDescription:E="draggable",tabIndex:A=0}=i??{},T=f?.id===e,L=N.useContext(T?zm:zE),[M,R]=Ql(),[D,U]=Ql(),j=EE(u,e),P=co(a);Ia(()=>(b.set(e,{id:e,key:l,node:M,activatorNode:D,data:P}),()=>{const ge=b.get(e);ge&&ge.key===l&&b.delete(e)}),[b,e]);const X=N.useMemo(()=>({role:S,tabIndex:A,"aria-disabled":r,"aria-pressed":T&&S===jm?!0:void 0,"aria-roledescription":E,"aria-describedby":m.draggable}),[r,S,A,T,E,m.draggable]);return{active:f,activatorEvent:d,activeNodeRect:g,attributes:X,isDragging:T,listeners:r?void 0:j,node:M,over:v,setNodeRef:R,setActivatorNodeRef:U,transform:L}}function BE(){return N.useContext(Hm)}const PE="Droppable",qE={timeout:25};function GE(o){let{data:e,disabled:a=!1,id:r,resizeObserverConfig:i}=o;const l=fo(PE),{active:u,dispatch:d,over:f,measureDroppableContainers:g}=N.useContext(rc),m=N.useRef({disabled:a}),b=N.useRef(!1),v=N.useRef(null),S=N.useRef(null),{disabled:E,updateMeasurementsFor:A,timeout:T}={...qE,...i},L=co(A??r),M=N.useCallback(()=>{if(!b.current){b.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(L.current)?L.current:[L.current]),S.current=null},T)},[T]),R=nc({callback:M,disabled:E||!u}),D=N.useCallback((X,ge)=>{R&&(ge&&(R.unobserve(ge),b.current=!1),X&&R.observe(X))},[R]),[U,j]=Ql(D),P=co(e);return N.useEffect(()=>{!R||!U.current||(R.disconnect(),b.current=!1,R.observe(U.current))},[U,R]),N.useEffect(()=>(d({type:Zt.RegisterDroppable,element:{id:r,key:l,disabled:a,node:U,rect:v,data:P}}),()=>d({type:Zt.UnregisterDroppable,key:l,id:r})),[r]),N.useEffect(()=>{a!==m.current.disabled&&(d({type:Zt.SetDroppableDisabled,id:r,key:l,disabled:a}),m.current.disabled=a)},[r,l,a,d]),{active:u,rect:v,isOver:f?.id===r,node:U,over:f,setNodeRef:j}}function Jd(o,e,a){const r=o.slice();return r.splice(a<0?r.length+a:a,0,r.splice(e,1)[0]),r}function VE(o,e){return o.reduce((a,r,i)=>{const l=e.get(r);return l&&(a[i]=l),a},Array(o.length))}function ic(o){return o!==null&&o>=0}function FE(o,e){if(o===e)return!0;if(o.length!==e.length)return!1;for(let a=0;a<o.length;a++)if(o[a]!==e[a])return!1;return!0}function KE(o){return typeof o=="boolean"?{draggable:o,droppable:o}:o}const sc={scaleX:1,scaleY:1},WE=o=>{var e;let{rects:a,activeNodeRect:r,activeIndex:i,overIndex:l,index:u}=o;const d=(e=a[i])!=null?e:r;if(!d)return null;const f=YE(a,u,i);if(u===i){const g=a[l];return g?{x:i<l?g.left+g.width-(d.left+d.width):g.left-d.left,y:0,...sc}:null}return u>i&&u<=l?{x:-d.width-f,y:0,...sc}:u<i&&u>=l?{x:d.width+f,y:0,...sc}:{x:0,y:0,...sc}};function YE(o,e,a){const r=o[e],i=o[e-1],l=o[e+1];return!r||!i&&!l?0:a<e?i?r.left-(i.left+i.width):l.left-(r.left+r.width):l?l.left-(r.left+r.width):r.left-(i.left+i.width)}const Qd=o=>{let{rects:e,activeIndex:a,overIndex:r,index:i}=o;const l=Jd(e,r,a),u=e[i],d=l[i];return!d||!u?null:{x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height}},oc={scaleX:1,scaleY:1},XE=o=>{var e;let{activeIndex:a,activeNodeRect:r,index:i,rects:l,overIndex:u}=o;const d=(e=l[a])!=null?e:r;if(!d)return null;if(i===a){const g=l[u];return g?{x:0,y:a<u?g.top+g.height-(d.top+d.height):g.top-d.top,...oc}:null}const f=JE(l,i,a);return i>a&&i<=u?{x:0,y:-d.height-f,...oc}:i<a&&i>=u?{x:0,y:d.height+f,...oc}:{x:0,y:0,...oc}};function JE(o,e,a){const r=o[e],i=o[e-1],l=o[e+1];return r?a<e?i?r.top-(i.top+i.height):l?l.top-(r.top+r.height):0:l?l.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const Um="Sortable",Bm=Ye.createContext({activeIndex:-1,containerId:Um,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qd,disabled:{draggable:!1,droppable:!1}});function QE(o){let{children:e,id:a,items:r,strategy:i=Qd,disabled:l=!1}=o;const{active:u,dragOverlay:d,droppableRects:f,over:g,measureDroppableContainers:m}=BE(),b=fo(Um,a),v=d.rect!==null,S=N.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),E=u!=null,A=u?S.indexOf(u.id):-1,T=g?S.indexOf(g.id):-1,L=N.useRef(S),M=!FE(S,L.current),R=T!==-1&&A===-1||M,D=KE(l);Ia(()=>{M&&E&&m(S)},[M,S,E,m]),N.useEffect(()=>{L.current=S},[S]);const U=N.useMemo(()=>({activeIndex:A,containerId:b,disabled:D,disableTransforms:R,items:S,overIndex:T,useDragOverlay:v,sortedRects:VE(S,f),strategy:i}),[A,b,D.draggable,D.droppable,R,S,T,f,v,i]);return Ye.createElement(Bm.Provider,{value:U},e)}const ZE=o=>{let{id:e,items:a,activeIndex:r,overIndex:i}=o;return Jd(a,r,i).indexOf(e)},e_=o=>{let{containerId:e,isSorting:a,wasDragging:r,index:i,items:l,newIndex:u,previousItems:d,previousContainerId:f,transition:g}=o;return!g||!r||d!==l&&i===u?!1:a?!0:u!==i&&e===f},t_={duration:200,easing:"ease"},Pm="transform",n_=go.Transition.toString({property:Pm,duration:0,easing:"linear"}),a_={roleDescription:"sortable"};function r_(o){let{disabled:e,index:a,node:r,rect:i}=o;const[l,u]=N.useState(null),d=N.useRef(a);return Ia(()=>{if(!e&&a!==d.current&&r.current){const f=i.current;if(f){const g=is(r.current,{ignoreTransform:!0}),m={x:f.left-g.left,y:f.top-g.top,scaleX:f.width/g.width,scaleY:f.height/g.height};(m.x||m.y)&&u(m)}}a!==d.current&&(d.current=a)},[e,a,r,i]),N.useEffect(()=>{l&&u(null)},[l]),l}function i_(o){let{animateLayoutChanges:e=e_,attributes:a,disabled:r,data:i,getNewIndex:l=ZE,id:u,strategy:d,resizeObserverConfig:f,transition:g=t_}=o;const{items:m,containerId:b,activeIndex:v,disabled:S,disableTransforms:E,sortedRects:A,overIndex:T,useDragOverlay:L,strategy:M}=N.useContext(Bm),R=s_(r,S),D=m.indexOf(u),U=N.useMemo(()=>({sortable:{containerId:b,index:D,items:m},...i}),[b,i,D,m]),j=N.useMemo(()=>m.slice(m.indexOf(u)),[m,u]),{rect:P,node:X,isOver:ge,setNodeRef:Ee}=GE({id:u,data:U,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...f}}),{active:Ce,activatorEvent:$e,activeNodeRect:Pe,attributes:Xe,setNodeRef:ht,listeners:Q,isDragging:fe,over:ye,setActivatorNodeRef:te,transform:he}=UE({id:u,data:U,attributes:{...a_,...a},disabled:R.draggable}),x=wC(Ee,ht),K=!!Ce,re=K&&!E&&ic(v)&&ic(T),de=!L&&fe,se=de&&re?he:null,Ne=re?se??(d??M)({rects:A,activeNodeRect:Pe,activeIndex:v,overIndex:T,index:D}):null,ve=ic(v)&&ic(T)?l({id:u,items:m,activeIndex:v,overIndex:T}):D,He=Ce?.id,Ae=N.useRef({activeId:He,items:m,newIndex:ve,containerId:b}),Et=m!==Ae.current.items,Rt=e({active:Ce,containerId:b,isDragging:fe,isSorting:K,id:u,index:D,items:m,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:g,wasDragging:Ae.current.activeId!=null}),_t=r_({disabled:!Rt,index:D,node:X,rect:P});return N.useEffect(()=>{K&&Ae.current.newIndex!==ve&&(Ae.current.newIndex=ve),b!==Ae.current.containerId&&(Ae.current.containerId=b),m!==Ae.current.items&&(Ae.current.items=m)},[K,ve,b,m]),N.useEffect(()=>{if(He===Ae.current.activeId)return;if(He!=null&&Ae.current.activeId==null){Ae.current.activeId=He;return}const un=setTimeout(()=>{Ae.current.activeId=He},50);return()=>clearTimeout(un)},[He]),{active:Ce,activeIndex:v,attributes:Xe,data:U,rect:P,index:D,newIndex:ve,items:m,isOver:ge,isSorting:K,isDragging:fe,listeners:Q,node:X,overIndex:T,over:ye,setNodeRef:x,setActivatorNodeRef:te,setDroppableNodeRef:Ee,setDraggableNodeRef:ht,transform:_t??Ne,transition:ft()};function ft(){if(_t||Et&&Ae.current.newIndex===D)return n_;if(!(de&&!jd($e)||!g)&&(K||Rt))return go.Transition.toString({...g,property:Pm})}}function s_(o,e){var a,r;return typeof o=="boolean"?{draggable:o,droppable:!1}:{draggable:(a=o?.draggable)!=null?a:e.draggable,droppable:(r=o?.droppable)!=null?r:e.droppable}}function lc(o){if(!o)return!1;const e=o.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const o_=[it.Down,it.Right,it.Up,it.Left],l_=(o,e)=>{let{context:{active:a,collisionRect:r,droppableRects:i,droppableContainers:l,over:u,scrollableAncestors:d}}=e;if(o_.includes(o.code)){if(o.preventDefault(),!a||!r)return;const f=[];l.getEnabled().forEach(b=>{if(!b||b!=null&&b.disabled)return;const v=i.get(b.id);if(v)switch(o.code){case it.Down:r.top<v.top&&f.push(b);break;case it.Up:r.top>v.top&&f.push(b);break;case it.Left:r.left>v.left&&f.push(b);break;case it.Right:r.left<v.left&&f.push(b);break}});const g=zC({collisionRect:r,droppableRects:i,droppableContainers:f});let m=mm(g,"id");if(m===u?.id&&g.length>1&&(m=g[1].id),m!=null){const b=l.get(a.id),v=l.get(m),S=v?i.get(v.id):null,E=v?.node.current;if(E&&S&&b&&v){const T=ec(E).some((j,P)=>d[P]!==j),L=qm(b,v),M=c_(b,v),R=T||!L?{x:0,y:0}:{x:M?r.width-S.width:0,y:M?r.height-S.height:0},D={x:S.left,y:S.top};return R.x&&R.y?D:ho(D,R)}}}};function qm(o,e){return!lc(o)||!lc(e)?!1:o.data.current.sortable.containerId===e.data.current.sortable.containerId}function c_(o,e){return!lc(o)||!lc(e)||!qm(o,e)?!1:o.data.current.sortable.index<e.data.current.sortable.index}const u_={verticalList:XE,horizontalList:WE,rectSorting:Qd},d_=({items:o,itemKey:e,strategy:a,children:r,onSortEnd:i,onSortStart:l,sortVersion:u})=>{const d=N.useId(),f=N.useRef({inProgress:!1,lastSortTime:0,lastActiveId:null}),g=NC(fm(Kd,{activationConstraint:{distance:5}}),fm(Vd,{coordinateGetter:l_})),m=N.useCallback(S=>{f.current={inProgress:!0,lastSortTime:Date.now(),lastActiveId:S.active.id},l?.({activeId:S.active.id})},[l]),b=N.useCallback(S=>{const{active:E,over:A}=S,T=Date.now();if(!A||E.id===A.id){f.current.inProgress=!1;return}const{lastSortTime:L,lastActiveId:M,inProgress:R}=f.current;if(M===E.id&&T-L<500&&!R)return;f.current={inProgress:!1,lastSortTime:T,lastActiveId:E.id};const D=o.findIndex(j=>String(j[e])===String(E.id)),U=o.findIndex(j=>String(j[e])===String(A.id));if(D!==-1&&U!==-1&&D!==U){const j=Jd(o,D,U);i?.(j,{oldIndex:D,newIndex:U})}},[o,e,i]),v=o.map(S=>String(S[e]));return ut.jsx(HE,{id:d,sensors:g,collisionDetection:HC,onDragStart:m,onDragEnd:b,children:ut.jsx(QE,{items:v,strategy:u_[a],children:r})},u!==void 0?`${d}-v${u}`:d)},Gm=N.createContext(null),f_=({value:o,children:e})=>ut.jsx(Gm.Provider,{value:o,children:e}),h_=()=>N.useContext(Gm),g_=({id:o,handle:e,as:a="div",children:r})=>{const{attributes:i,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:g}=i_({id:o}),m={transform:go.Transform.toString(d),transition:f,opacity:g?.5:1,position:"relative"};return ut.jsx(a,{ref:u,style:m,...i,...e?{}:l,"data-sortable-item":!0,"data-sortable-id":String(o),"data-dragging":g,children:ut.jsx(f_,{value:{listeners:l,handle:e,isDragging:g},children:r})})},dt=ct("DynamicRenderer");function Qa(){try{return window.G7Core?.devTools}catch{return}}function Zd(o,e,a,r){if(typeof o=="string"){if(/\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*/.test(o))try{return e.resolveTranslations(o,a,r)}catch{return o}return o}if(Array.isArray(o))return o.map(i=>Zd(i,e,a,r));if(o&&typeof o=="object"){const i={};for(const[l,u]of Object.entries(o))i[l]=Zd(u,e,a,r);return i}return o}function p_(o){const e=Object.keys(o);return e.length>0&&e.every(a=>/^\d+$/.test(a))}const ya=(o,e)=>{const a=["errors"],r={...o};for(const i of Object.keys(e)){const l=e[i],u=o[i];if(l===null){r[i]=null;continue}if(a.includes(i)){r[i]=l;continue}if(Array.isArray(l)){r[i]=l;continue}if(Array.isArray(u)&&l!==null&&typeof l=="object"&&!Array.isArray(l)&&p_(l)){const d=Object.keys(l).map(g=>parseInt(g,10));if((d.length>0?Math.max(...d):0)>=u.length+d.length+10)r[i]={...l};else{const g=[...u];for(const[m,b]of Object.entries(l)){const v=parseInt(m,10);v>=0&&v<g.length?b!==null&&typeof b=="object"&&!Array.isArray(b)&&g[v]!==null&&typeof g[v]=="object"?g[v]=ya(g[v],b):g[v]=b:v>=g.length&&(g[v]=b)}r[i]=g}}else l!==null&&typeof l=="object"&&u!==null&&typeof u=="object"&&!Array.isArray(u)?r[i]=ya(u,l):r[i]=l}return r},Vm=(o,e)=>{const a={...o};for(const r of Object.keys(e)){if(!(r in a))continue;const i=e[r],l=a[r];if(i!==null&&typeof i=="object"&&!Array.isArray(i)&&l!==null&&typeof l=="object"&&!Array.isArray(l)){const u=Vm(l,i);Object.keys(u).length===0?delete a[r]:a[r]=u}else delete a[r]}return a},m_=o=>{const e={},a=o.split(";").filter(r=>r.trim());for(const r of a){const i=r.indexOf(":");if(i===-1)continue;const l=r.substring(0,i).trim(),u=r.substring(i+1).trim();if(l&&u){const d=l.replace(/-([a-z])/g,(f,g)=>g.toUpperCase());e[d]=u}}return e};class y_ extends N.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,a){dt.error(`컴포넌트 렌더링 에러 (ID: ${this.props.componentId}, Name: ${this.props.componentName}):`,e,a)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ut.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:[ut.jsx("div",{className:"font-semibold mb-1",children:"컴포넌트 로드 실패"}),ut.jsxs("div",{className:"text-xs opacity-80",children:[this.props.componentName&&`[${this.props.componentName}] `,"데이터를 표시할 수 없습니다."]}),this.state.error&&ut.jsxs("details",{className:"mt-2",children:[ut.jsx("summary",{className:"cursor-pointer text-xs opacity-70 hover:opacity-100",children:"상세 정보"}),ut.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 Ha=N.memo(({componentDef:o,dataContext:e,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:d,parentFormContextProp:f,parentDataContext:g,isRootRenderer:m=!1,isInsideIteration:b=!1,isEditMode:v=!1,onComponentSelect:S,onComponentHover:E,onDragStart:A,onDragEnd:T,componentPath:L,layoutKey:M})=>{const[R,D]=N.useState({loadingActions:{}});N.useLayoutEffect(()=>{d||(i.startRenderCycle(),window.__g7SetLocalOverrideKeys||(window.__g7ForcedLocalFields=void 0),window.__g7PendingLocalState=null)});const U=N.useRef(null);N.useLayoutEffect(()=>{if(!d&&e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:q,_merge:ce,...le}=e._localInit,Z=`${JSON.stringify(le)}:${q||"no-force"}`;if(U.current!==Z){U.current=Z;const be=ce||"shallow",Re=window.G7Core?.state?.get?.()?._local||{},xe=window.__g7PendingLocalState||{},je={...Re,...xe};be==="replace"?window.__g7PendingLocalState={loadingActions:je.loadingActions||{},...le,hasChanges:!1}:be==="deep"?window.__g7PendingLocalState=ya(je,{...le,hasChanges:!1}):window.__g7PendingLocalState={...je,...le,hasChanges:!1};const ze=window.__g7SetLocalOverrideKeys;ze&&typeof ze=="object"&&(be==="replace"?window.__g7SetLocalOverrideKeys={...le,hasChanges:!1}:window.__g7SetLocalOverrideKeys=ya(ze,{...le,hasChanges:!1}))}}}),N.useLayoutEffect(()=>{if(!d){const q=window.__g7SetLocalOverrideKeys;if(q){D(be=>Vm(be,q));const ce=q,le=window.__g7ForcedLocalFields,Z=window.__g7LastSetLocalSnapshot;queueMicrotask(()=>{window.__g7SetLocalOverrideKeys===ce&&(window.__g7SetLocalOverrideKeys=void 0),window.__g7ForcedLocalFields===le&&(window.__g7ForcedLocalFields=void 0),window.__g7LastSetLocalSnapshot===Z&&(window.__g7LastSetLocalSnapshot=void 0)})}}},[e._local]);const j=N.useRef(M);N.useEffect(()=>{o._fromBase&&M&&j.current!==M&&(j.current=M,D({loadingActions:{}}))},[M,o._fromBase]);const P=N.useRef(""),X=N.useRef(!1),ge=N.useRef(null),Ee=N.useRef({}),Ce=N.useRef({}),$e=N.useRef(g),Pe=SC(),Xe=Q0(),ht=Xe?.getParentDataContext()??g;N.useEffect(()=>{if(e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:q,...ce}=e._localInit,le=JSON.stringify(ce),Z=q!==void 0,be=Od(),Se=`${le}:${q||"no-force"}`;if(be.hash!==Se){be.hash=Se,be.timestamp=q,P.current=le,Z&&(X.current=!0);const{_merge:je,...ze}=ce,Le=je||"shallow";if(D(ke=>Le==="replace"?{loadingActions:ke.loadingActions||{},...ze,hasChanges:!1}:Le==="deep"?ya(ke,{...ze,hasChanges:!1}):{...ke,...ze,hasChanges:!1}),e._globalSetState){const ke=e._global?._local||{};let We;Le==="replace"?We={...ze,hasChanges:!1}:Le==="deep"?We=ya(ke,{...ze,hasChanges:!1}):We={...ke,...ze,hasChanges:!1},e._globalSetState({_local:We})}i.invalidateCacheByKeys(["_local"]),dt.log("_localInit applied (data changed):",Object.keys(ce))}ge.current=e._localInit,aC(e._localInit)}},[e._localInit,g,i]);const{isTransitioning:Q}=nm(),fe=dC(),ye=f??fe,{width:te}=Md(),he=h_(),x=N.useMemo(()=>{let q=o;if(o.type==="iterator"&&o.data){const{data:Z,itemName:be,indexName:Se,...Re}=o;q={...Re,iteration:{source:Z,item_var:be||"item",index_var:Se}}}if(!q.responsive)return q;const ce=ci.getMatchingKey(q.responsive,te);if(!ce)return q;const le=q.responsive[ce];return{...q,props:{...q.props,...le.props},children:le.children??q.children,text:le.text??q.text,if:le.if??q.if,iteration:le.iteration??q.iteration,__responsiveChildrenKey:le.children!==void 0?ce:void 0}},[o,te]),K=N.useCallback(q=>{const ce=q?.__setStateId;if(D(le=>{const Z=window.__g7PendingLocalState,Se=window.__g7SetLocalOverrideKeys||Z,Re=Se?ya(le,Se):le;if(typeof q=="function"){const ke=q(Re);return ya(Re,ke)}const{__mergeMode:xe,__setStateId:je,...ze}=q;let Le;if(xe==="replace"?Le=ze:xe==="shallow"?Le={...Re,...ze}:Le=ya(Re,ze),xe!==void 0){const ke=window.__g7ForcedLocalFields;ke&&(window.__g7ForcedLocalFields={...ke,...ze})}return Le}),ce){const le=Qa();if(le?.isEnabled()){const Z=x.id||"unknown",be=x.name||"Unknown";setTimeout(()=>{le.trackComponentRender?.(Z,be,0,["_local"],[]),le.completeStateChange?.(ce)},0)}}},[x.id,x.name]),re=d?.state??R,de=d?.setState??K,se=N.useMemo(()=>{const q=e._localInit&&e._localInit!==ge.current;let ce;q&&e._local?ce=e._local:ce=e._local?ya(e._local,re):re;const le=window.__g7ForcedLocalFields;le&&(ce=ya(ce,le));const Z={...e,_local:ce},be=e._computedDefinitions;if(be&&Object.keys(be).length>0){const Se=new wn,Re={...Z,...Pe?{_isolated:Pe.state}:{}},xe={},je=Qa(),ze=je?.isEnabled()??!1;for(const[Le,ke]of Object.entries(be)){const We=ze?Date.now():0,Fe=ze?e._computed?.[Le]:void 0;let _e;try{if(typeof ke=="string")if(ke.startsWith("{{")&&ke.endsWith("}}")){const Te=ke.slice(2,-2).trim(),Ue=Se.evaluateExpression(Te,Re,{skipCache:!0});xe[Le]=Ue}else xe[Le]=ke;else if(ke&&typeof ke=="object"&&"$switch"in ke){const Te=Se.resolveSwitch(ke,Re,{skipCache:!0});xe[Le]=Te}}catch(Te){dt.warn(`Failed to recalculate computed value: ${Le}`,Te),xe[Le]=e._computed?.[Le],_e=Te instanceof Error?Te.message:String(Te)}if(ze&&(_e||Fe!==xe[Le])){const Ue=Date.now()-We;je.trackComputedProperty?.(Le,typeof ke=="string"?ke:JSON.stringify(ke),[{type:"_local",path:"_local",value:Z._local}],xe[Le],Ue,x.id,_e),Fe!==xe[Le]&&je.trackComputedRecalc?.(Le,"dependency-change",Fe,xe[Le],Ue,{type:"_local",path:"_local"},x.id)}}Z._computed=xe}if(Pe&&(Z._isolated=Pe.state),ht&&(Z.$parent=ht),o.extensionPointProps){const Se=i.resolveObject(o.extensionPointProps,Z,b?{skipCache:!0}:void 0);Z.extensionPointProps=v&&l?Zd(Se,l,a,Z):Se}return o.extensionPointCallbacks&&(Z.extensionPointCallbacks=o.extensionPointCallbacks),v&&(Z.$templateId===void 0&&a?.templateId&&(Z.$templateId=a.templateId),Z.$locale===void 0&&a?.locale&&(Z.$locale=a.locale)),Z},[e,re,Pe?.state,ht,Xe?.version,o.extensionPointProps,o.extensionPointCallbacks]);Ee.current=se._local,Ce.current=se._computed||{},$e.current=ht,N.useEffect(()=>{const q=Qa();if(!q?.isEnabled())return;const ce=se._local;ce&&q.updateLocalState(ce);const le=se._computed;le&&q.updateComputedState(le),ht&&q.updateParentContext?.(ht);const Z=x.id||`comp-${Date.now()}`,be=x.name||"Unknown",Se={global:Object.keys(e._global||{}),local:Object.keys(ce||{}),context:d?Object.keys(d.state||{}):[]},Re={type:d?"componentContext":"dynamicState",hasComponentContext:!!d,parentId:d?"parent":void 0};q.trackComponentStateSource?.(Z,be,Se,Re),re&&Object.keys(re).length>0&&q.trackDynamicState?.(Z,re);const xe=!!(x.expandChildren||x.props?.expandChildren);q.trackContextFlow?.(Z,be,!!d,xe,!0)},[se._local,e,x.id,x.name,d,re,x.expandChildren,x.props?.expandChildren,ht]);const me=N.useMemo(()=>({state:{...se._local},setState:de,stateRef:Ee,computedRef:Ce,isolatedContext:Pe,parentDataContext:se}),[se._local,de,R,Pe,se]),Ne=N.useMemo(()=>{const q=Yi({if:x.if,condition:x.condition,conditions:x.conditions},se,i,x.id);if(x.if||x.condition!==void 0||x.conditions){const le=Qa();le?.isEnabled()&&x.if&&le.trackIfCondition(x.id||`if-${Date.now()}`,x.if,q)}return q},[x.if,x.conditions,se,i,x.id]),ve=N.useMemo(()=>{if(!x.slot)return null;const q=x.slot;if(q.startsWith("{{")&&q.endsWith("}}")){const ce=q.slice(2,-2).trim();try{const le={componentId:x.id,componentName:x.name,propName:"slot"},Z=i.evaluateExpression(ce,se,le);return dt.log(`[Slot] 표현식 평가: "${ce}" => "${Z}" (컴포넌트: ${x.id})`),typeof Z=="string"?Z:null}catch(le){return dt.warn(`slot 표현식 평가 실패 (컴포넌트: ${x.id}):`,le),null}}return dt.log(`[Slot] 정적 슬롯 ID: "${q}" (컴포넌트: ${x.id})`),q},[x.slot,x.id,se,i]),He=N.useMemo(()=>!ve||!x.id?"":`${x.id}-${ve}-${JSON.stringify(x.slotOrder??0)}`,[ve,x.id,x.slotOrder]),Ae=N.useRef(null);N.useEffect(()=>{const q=window.__slotContextValue,ce=q?.isEnabled??!1;if(x.slot&&dt.log(`[Slot Registration] 컴포넌트: ${x.id}, isSlotEnabled: ${ce}, shouldRender: ${Ne}, resolvedSlotId: ${ve}`),!ce||!Ne){x.slot&&dt.log(`[Slot Registration] 등록 스킵 - isSlotEnabled: ${ce}, shouldRender: ${Ne}`),Ae.current&&x.id&&q&&(q.unregisterFromSlot(Ae.current,x.id),Ae.current=null);return}if(!ve||!x.id){x.slot&&dt.log(`[Slot Registration] 등록 스킵 - resolvedSlotId: ${ve}, id: ${x.id}`),Ae.current&&x.id&&q&&(q.unregisterFromSlot(Ae.current,x.id),Ae.current=null);return}Ae.current&&Ae.current!==ve&&q.unregisterFromSlot(Ae.current,x.id);const le={...x,slot:void 0,slotOrder:void 0};return q.registerToSlot(ve,x.id,{componentDef:le,dataContext:e,order:x.slotOrder??0,parentFormContext:f??null,getParentComponentContext:()=>me,translationContext:a,registrationKey:He}),Ae.current=ve,()=>{const Z=window.__slotContextValue;ve&&x.id&&Z&&Z.unregisterFromSlot(ve,x.id)}},[Ne,ve,x,e,f,me,a,He]);const Et=N.useCallback(q=>{if(typeof q=="string"){if(rp(q))return sp(q);if(ip(q)){const ce=[],le=q.replace(new RegExp(`${Tl}([^${Ws}]*)${Ws}`,"g"),(be,Se)=>(ce.push(Se),`${_r}${ce.length-1}${_r}`));let Z=le;return/\$t:[a-zA-Z0-9._-]+/.test(le)&&(Z=l.resolveTranslations(le,a,se)),Z.replace(new RegExp(`${_r}(\\d+)${_r}`,"g"),(be,Se)=>ce[parseInt(Se)])}if(q.startsWith("$t:defer:"))return q;if(/\$t:[a-zA-Z0-9._-]+/.test(q)){const ce=q.trim();return ce.startsWith("{")&&ce.endsWith("}")||ce.startsWith("[")&&ce.endsWith("]")?q:l.resolveTranslations(q,a,se)}return q}if(Array.isArray(q))return q.map(ce=>Et(ce));if(q&&typeof q=="object"){const ce={};for(const[le,Z]of Object.entries(q))ce[le]=Et(Z);return ce}return q},[l,a,se]),Rt=N.useCallback(q=>/[?:|&!+\-*/<>=()]/.test(q),[]),_t=N.useCallback(q=>{if(!q.startsWith("{{")||!q.endsWith("}}"))return null;const ce=q.slice(2,-2);let le=null,Z=0;for(let be=0;be<ce.length;be++){const Se=ce[be];if((be>0?ce[be-1]:"")!=="\\"&&((Se==='"'||Se==="'")&&!le?le=Se:Se===le&&(le=null),!le&&(Se==="{"&&Z++,Se==="}"&&Z--,Z<0)))return null}return Z===0?ce.trim():null},[]),ft=N.useMemo(()=>{let q={...x.props||{}};const ce=["cellChildren","expandChildren","expandContext","render"],Z=r.getMetadata(x.name)?.skipBindingKeys||[],be=[...new Set([...ce,...Z])],Se=b?{skipCache:!0}:void 0,Re=_e=>{if(Se)return Se;if(_e.startsWith("_computed")||_e.startsWith("$computed"))return{skipCache:!0}};for(const[_e,Te]of Object.entries(q))if(!be.includes(_e))if(typeof Te=="string"){const Ue=_t(Te);if(Ue!==null){let st=!1,Dt=Ue;Ue.startsWith(Er)&&(st=!0,Dt=Ue.slice(Er.length));const nn={componentId:x.id,componentName:x.name,propName:_e};let Kt;if(Rt(Dt))try{Kt=i.evaluateExpression(Dt,se,nn)}catch(qn){dt.warn(`표현식 평가 실패 (컴포넌트: ${x.id}, prop: ${_e}):`,qn),Kt=void 0}else Kt=i.resolve(Dt,se,Re(Dt),nn);q[_e]=st&&Kt!=null?Xs(Kt):Kt}else{const st={componentId:x.id,componentName:x.name,propName:_e};q[_e]=i.resolveBindings(Te,se,Se,st)}}else Array.isArray(Te)?q[_e]=Te.map(Ue=>typeof Ue=="string"?i.resolveBindings(Ue,se,Se):typeof Ue=="object"&&Ue!==null?i.resolveObject(Ue,se,Se):Ue):Te&&typeof Te=="object"&&(q[_e]=i.resolveObject(Te,se,Se));for(const[_e,Te]of Object.entries(q))q[_e]=Et(Te);if(typeof q.style=="string"&&(q.style=m_(q.style)),q=od(q,v?void 0:x.actions,se,{componentContext:me,actionDispatcher:u}),x.classMap){const _e=ow(x.classMap,se,i,{skipCache:!0});if(_e){const Te=q.className||"";q.className=Te?`${Te} ${_e}`:_e}}x.style&&(q.style=x.style),x.actions&&x.actions.length>0&&x.type==="composite"&&Object.assign(q,re),x.component_layout&&(q.__componentLayoutDefs=x.component_layout);const xe=x.expandChildren||x.props?.expandChildren,je=x.props?.cellChildren,ze=x.children&&x.children.length>0,Le=x.component_layout,ke=x.slot,We=x.props?.modalId,Fe=x.type==="composite";return(xe||je||ze||Le||ke||We||Fe)&&(q.__componentContext=me),q},[x.props,x.actions,x.style,x.classMap,x.id,se,a,i,l,me,re,Et,Rt,_t,b]),un=N.useRef(null),gt=N.useMemo(()=>un.current&&rm(un.current,ft)?un.current:(un.current=ft,ft),[ft]),ja=N.useMemo(()=>{const q=x.id;if(typeof q!="string"||!q.includes("{{"))return q;const ce=i.resolveBindings(q,se,{skipCache:!0});return typeof ce=="string"?ce:q},[x.id,se,i]),kn=N.useMemo(()=>{const q=x.dataKey,ce=x.trackChanges,le=x.debounce;if(q){const Z=q.startsWith("_global."),be=Z?q.slice(8):q,Se=Z?e._global:se._local;return{dataKey:be,trackChanges:ce??!1,debounce:le,setState:Z?xe=>{e._globalSetState?e._globalSetState(xe):dt.warn("_global.formData 사용 시 _globalSetState가 필요합니다.")}:de,state:Se??{},_isGlobal:Z}}if(ye.dataKey)return ye},[x.dataKey,x.trackChanges,x.debounce,x.id,de,se._local,e._global,e._globalSetState,ye]),Dn=N.useRef(new Set);N.useEffect(()=>{Dn.current.clear()},[e._global?._remountKeys]);const jt=N.useCallback((q,ce)=>{const le=e._global?._remountKeys;return q&&le?.[q]&&!Dn.current.has(q)?(Dn.current.add(q),`${q}-remount-${le[q]}`):q||ce},[e._global?._remountKeys]),On=N.useMemo(()=>{if(x.text!==void 0){if(typeof x.text=="string"){const q=x.text;let ce=q;const le={componentId:x.id,componentName:x.name,propName:"text",skipCache:!0},Z=_t(q);if(Z!==null)if(ap(Z))ce=i.resolveBindings(q,se,{skipCache:!0},le);else if(Rt(Z))try{ce=i.evaluateExpression(Z,se,le)}catch(be){dt.warn(`text 표현식 평가 실패 (컴포넌트: ${x.id}):`,be),ce=""}else ce=i.resolve(Z,se,{skipCache:!0},le);else q.includes("{{")&&(ce=i.resolveBindings(q,se,{skipCache:!0},le));return ce=Et(ce),ce??""}return x.text}return!x.children||x.children.length===0?null:x.children.map((q,ce)=>{if(typeof q=="string")return q;const le=x.__responsiveChildrenKey,Z=le?`responsive.${le}.children`:"children",be=L?`${L}.${Z}.${ce}`:`${ce}`,Se=q._fromBase?q.id||`child-${ce}`:jt(q.id,`child-${ce}`),Re=!q._fromBase&&M?`${Se}_${M}`:Se;return ut.jsx(Ha,{componentDef:q,dataContext:se,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:me,parentFormContextProp:kn,isInsideIteration:b,isEditMode:v,onComponentSelect:S,onComponentHover:E,componentPath:be,onDragStart:A,onDragEnd:T,layoutKey:M},Re)})},[x.text,x.children,x.id,e,se,a,r,i,l,u,me,kn,_t,Rt,Et,jt,b,v,S,E,L,A,T,M]),ea=N.useMemo(()=>{if(!x.iteration)return null;try{const q=sd(x.iteration.source,se,i);if(!Array.isArray(q))return dt.warn(`iteration source가 배열이 아닙니다 (컴포넌트: ${x.id}):`,q),null;const ce=Qa();return ce?.isEnabled()&&ce.trackIteration(x.id||`iteration-${Date.now()}`,x.iteration.source,x.iteration.item_var,x.iteration.index_var,q.length),q.map((le,Z)=>{const be={...se,[x.iteration.item_var]:le};x.iteration.index_var&&(be[x.iteration.index_var]=Z);const Se=Z===0||Z===q.length-1;ce?.isEnabled()&&Se&&ce.trackNestedContext?.({componentId:`${x.id||"unknown"}-iter-${Z}`,componentType:"iteration",parentContext:{available:Object.keys(se),values:{}},ownContext:{added:[x.iteration.item_var,...x.iteration.index_var?[x.iteration.index_var]:[]],values:{[x.iteration.item_var]:le,...x.iteration.index_var?{[x.iteration.index_var]:Z}:{}}},depth:1});const Re={...x,iteration:void 0,responsive:void 0},xe=L?`${L}.iteration.${Z}`:`iteration.${Z}`,je=`${jt(x.id,"item")}-${Z}`;return ut.jsx(Ha,{componentDef:Re,dataContext:be,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:me,parentFormContextProp:kn,isInsideIteration:!0,isEditMode:v,onComponentSelect:S,onComponentHover:E,componentPath:xe,onDragStart:A,onDragEnd:T,layoutKey:M},je)})}catch(q){return dt.error(`iteration 렌더링 실패 (컴포넌트: ${x.id}):`,q),null}},[x.iteration,x.children,x.id,e,se,a,r,i,l,u,me,kn,jt,v,S,E,L,A,T,M]),[Ua,Ft]=N.useState(0),Dr=N.useMemo(()=>{if(!x.sortable||!x.itemTemplate)return null;const{sortable:q,itemTemplate:ce}=x;try{const le=sd(q.source,se,i);if(!Array.isArray(le))return dt.warn(`sortable source가 배열이 아닙니다 (컴포넌트: ${x.id}):`,le),null;if(le.length===0)return null;const Z=q.itemKey||"id",be=q.strategy||"verticalList",Se=q.itemVar||"$item",Re=q.indexVar||"$index",xe=q.handle,je=q.wrapperElement,ze=(We,Fe)=>{const _e=x.actions?.filter(Te=>Te.event==="onSortEnd"||Te.type==="onSortEnd");if(Ft(Te=>Te+1),_e&&_e.length>0&&u){const Te={...se,$sortedItems:We,$sortEvent:Fe};_e.forEach(Ue=>{try{const st=u.createHandler(Ue,Te,me),Dt=new Event("sortend");st(Dt)}catch(st){dt.error(`onSortEnd action failed: ${Ue.handler}`,st)}})}},Le=We=>{const Fe=x.actions?.filter(_e=>_e.event==="onSortStart"||_e.type==="onSortStart");if(Fe&&Fe.length>0&&u){const _e={...se,$activeId:We.activeId};Fe.forEach(Te=>{try{const Ue=u.createHandler(Te,_e,me),st=new Event("sortstart");Ue(st)}catch(Ue){dt.error(`onSortStart action failed: ${Te.handler}`,Ue)}})}},ke=le.map((We,Fe)=>{const _e=String(We[Z]),Te={...se,[Se]:We,[Re]:Fe},Ue=L?`${L}.sortable.${Fe}`:`sortable.${Fe}`,st=`${jt(x.id,"sortable-item")}-v${Ua}-${_e}`;return ut.jsx(g_,{id:_e,handle:xe,...je?{as:je}:{},children:(je&&ce.children?ce.children:[ce]).map((Dt,nn)=>ut.jsx(Ha,{componentDef:Dt,dataContext:Te,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:me,parentFormContextProp:void 0,isInsideIteration:!0,isEditMode:v,onComponentSelect:S,onComponentHover:E,componentPath:Ue,onDragStart:A,onDragEnd:T,layoutKey:M},`${st}-child-${nn}`))},st)});return ut.jsx(d_,{items:le,itemKey:Z,strategy:be,onSortEnd:ze,onSortStart:Le,sortVersion:Ua,children:ke})}catch(le){return dt.error(`sortable 렌더링 실패 (컴포넌트: ${x.id}):`,le),null}},[x.sortable,x.itemTemplate,x.actions,x.id,e,se,a,r,i,l,u,me,jt,v,S,E,L,A,T,Ua,M]),er=N.useRef(!1);N.useEffect(()=>{if(er.current)return;er.current=!0;const q=Qa();if(q?.isEnabled()&&q.trackMount(o.id,{name:o.name,type:o.type||"component",props:gt}),o.lifecycle?.onMount&&o.lifecycle.onMount.length>0)for(const le of o.lifecycle.onMount)try{const Z=u.createHandler(le,se,me),be=new Event("mount");Z(be),dt.log(`Lifecycle onMount executed: ${le.handler} (Component: ${o.id})`)}catch(Z){dt.error(`Lifecycle onMount failed: ${le.handler} (Component: ${o.id})`,Z)}const ce=[];if(o.onComponentEvent&&o.onComponentEvent.length>0){const le=window.G7Core;if(le?.componentEvent?.on)for(const Z of o.onComponentEvent){if(!Z.event){dt.warn(`onComponentEvent: event name is required (Component: ${o.id})`);continue}const be=async Re=>{try{const xe={...se,_eventData:Re},ze=await u.createHandler({handler:Z.handler,params:Z.params,onSuccess:Z.onSuccess,onError:Z.onError},xe,me)(new CustomEvent(Z.event,{detail:Re}));return dt.log(`onComponentEvent "${Z.event}" handled: ${Z.handler} (Component: ${o.id})`,{eventData:Re,result:ze}),ze}catch(xe){throw dt.error(`onComponentEvent "${Z.event}" failed: ${Z.handler} (Component: ${o.id})`,xe),xe}},Se=le.componentEvent.on(Z.event,be);ce.push(Se),dt.log(`onComponentEvent: Subscribed to "${Z.event}" (Component: ${o.id})`)}else dt.warn(`onComponentEvent: G7Core.componentEvent is not available (Component: ${o.id})`)}return()=>{const le=Qa();le?.isEnabled()&&le.trackUnmount(o.id);for(const Z of ce)try{Z()}catch(be){dt.error(`onComponentEvent: Failed to unsubscribe (Component: ${o.id})`,be)}if(ce.length>0&&dt.log(`onComponentEvent: Unsubscribed ${ce.length} event(s) (Component: ${o.id})`),o.lifecycle?.onUnmount&&o.lifecycle.onUnmount.length>0)for(const Z of o.lifecycle.onUnmount)try{const be=u.createHandler(Z,se,me),Se=new Event("unmount");be(Se),dt.log(`Lifecycle onUnmount executed: ${Z.handler} (Component: ${o.id})`)}catch(be){dt.error(`Lifecycle onUnmount failed: ${Z.handler} (Component: ${o.id})`,be)}}},[]);const bn=N.useMemo(()=>{const q=gt.dataKey,ce=gt.trackChanges,le=gt.debounce;return q?{dataKey:q,trackChanges:ce??!1,debounce:le,setState:de,state:re}:null},[gt.dataKey,gt.trackChanges,gt.debounce,de,re]);N.useEffect(()=>{const q=x.dataKey||gt.dataKey;if(!q)return;const ce=Qa();if(!ce?.isEnabled())return;const le=[],Z=Se=>{if(Se)for(const Re of Se){const xe=Re?.props?.name;if(xe&&le.push({name:xe,type:Re.name||Re.type||"unknown"}),Re?.children&&Z(Re.children),Re?.slots)for(const je of Object.values(Re.slots))Array.isArray(je)&&Z(je)}};if(o.children&&Z(o.children),o.slots)for(const Se of Object.values(o.slots))Array.isArray(Se)&&Z(Se);const be=o.id||`form-${q}`;return ce.trackForm(be,q,le),()=>{ce.untrackForm(be)}},[x,gt.dataKey,o.id,o.children]);const en=N.useRef(null),et=N.useRef(void 0);N.useEffect(()=>{const q=gt?.name;if(!q||!ye.dataKey||!ye.setState||gt?.autoBinding===!1)return;const ce=`${ye.dataKey}.${q}`,le=window.__g7AutoBindingPaths??new Map;return window.__g7AutoBindingPaths=le,le.set(ce,(le.get(ce)??0)+1),()=>{const Z=le.get(ce)??0;Z<=1?le.delete(ce):le.set(ce,Z-1)}},[gt?.name,gt?.autoBinding,ye.dataKey,ye.setState]);const ta=N.useMemo(()=>{const{dataKey:q,trackChanges:ce,debounce:le,...Z}=gt,be=Z.name;if(!be||!ye.dataKey||!ye.setState)return Z;if(Z.autoBinding===!1){const{autoBinding:_e,...Te}=Z;return Te}const Se=`${ye.dataKey}.${be}`,Re=fC(ye.state,Se),xe=Re!==void 0?Re:Z.value,ze=r.getMetadata(o.name)?.bindingType,Le=typeof xe=="boolean"&&(ze==="checked"||ze==="checkable"&&["checkbox","radio"].includes(Z?.type)),ke=ye.debounce,We=_e=>{const Te=ye.state||{},Ue=hC(Te,Se,_e);if(ye.trackChanges&&(Ue.hasChanges=!0),window.__g7PendingLocalState=Ue,ye.setState(Ue),ye._isGlobal)return;const st=window.G7Core,Dt={[Se]:_e};ye.trackChanges&&(Dt.hasChanges=!0),st?.state?.setLocal?.(Dt,{render:!1})},Fe=(_e,Te)=>{ke&&ke>0?(en.current&&clearTimeout(en.current),en.current=setTimeout(()=>{We(_e),en.current=null,Te&&(Te(),window.__g7PendingLocalState=null)},ke)):(We(_e),Te&&(Te(),window.__g7PendingLocalState=null))};if(Le)return{...Z,checked:xe,onChange:Te=>{const Ue=Te.target.checked;We(Ue),Z.onChange&&Z.onChange(Te)}};{const _e=Ue=>{const st=Ue?.target?.value!==void 0?Ue.target.value:Ue;ke&&ke>0&&(et.current=st);const Dt=Ue?.target?{target:{value:st,name:Ue.target.name,type:Ue.target.type,checked:Ue.target.checked},currentTarget:Ue.currentTarget?{value:st,name:Ue.currentTarget.name}:void 0}:Ue;Fe(st,()=>{Z.onChange&&Z.onChange(Dt)})};let Te;return et.current!==void 0?en.current!==null?Te=et.current:String(xe??"")===String(et.current)?(et.current=void 0,Te=xe??""):Te=et.current:Te=xe??"",{...Z,value:Te,onChange:_e}}},[gt,ye,ye.state,ye.debounce]),En=N.useMemo(()=>{const q=Qa();if(q?.isEnabled()&&q.trackRender(o.name),!Ne)return null;if(x.sortable&&x.itemTemplate)return Dr;if(x.iteration)return ea;if(x.type==="extension_point"){const{layout:ze,columns:Le,gap:ke,className:We,...Fe}=x.props||{};let _e=We||"";return ze==="grid"&&Le?_e=`${_e} grid grid-cols-${Le} gap-${ke||4}`.trim():ze==="flex"&&(_e=`${_e} flex flex-col gap-${ke||4}`.trim()),ut.jsx("div",{id:ja,className:_e||void 0,...Fe,children:On})}const ce=r.getComponent(x.name);if(!ce)return dt.error(`컴포넌트를 찾을 수 없습니다: ${x.name} (ID: ${x.id})`,"componentDef:",JSON.stringify(x,null,2)),null;const le=e._global?._remountKeys,Z={...ta,id:ta.id??ja,...le&&Object.keys(le).length>0&&{__remountTrigger:JSON.stringify(le)}};if(he?.listeners&&he.handle&&ta["data-drag-handle"]!==void 0&&(Object.assign(Z,he.listeners),Z.style={...Z.style,cursor:he.isDragging?"grabbing":"grab"}),v){const ze=x.id||`auto_${x.name||x.type||"unknown"}_${Math.random().toString(36).substring(2,8)}`,Le=Fe=>{typeof Fe.preventDefault=="function"&&Fe.preventDefault(),S&&(Fe.stopPropagation(),S(ze,Fe))},ke={"data-editor-id":ze,"data-editor-name":x.name,"data-editor-type":x.type,onClick:Le};L&&(ke["data-editor-path"]=L);const We=x.__editorSlotName??x.slot;typeof We=="string"&&(ke["data-editor-slot"]=We),E&&(ke.onMouseMove=Fe=>{Fe.stopPropagation(),E(ze,Fe)},ke.onMouseLeave=Fe=>{E(null,Fe)}),Object.assign(Z,ke),Z.editorAttrs=ke}const be=x.type==="basic",Se=x.type==="layout",xe=be||Se?(()=>{const ze={};for(const[Le,ke]of Object.entries(Z))Le.startsWith("__")||Le==="editorAttrs"&&be||(ze[Le]=ke);return ze})():Z;let je=ut.jsx(ce,{...xe,children:On});if(kn&&(je=ut.jsx(uC,{value:kn,children:je})),x.isolatedState){const ze=typeof x.isolatedState=="object"?x.isolatedState:{},Le=e?._isolatedInit,ke=Le?{...ze,...Le}:ze;je=ut.jsx(vC,{initialState:ke,scopeId:x.isolatedScopeId,children:je})}return je},[Ne,x.iteration,x.sortable,x.itemTemplate,x.type,x.name,x.id,x.props,x.isolatedState,x.isolatedScopeId,r,ta,On,ea,Dr,he,bn,v,S,E,A,T,L,e._global?._remountKeys]),tr=N.useMemo(()=>{const q=x.blur_until_loaded;if(!q||e?._global?.__isPreview)return!1;if(typeof q=="string"){const Z=_t(q);if(Z!==null)try{const be={componentId:x.id,componentName:x.name,propName:"blur_until_loaded"};return!!i.evaluateExpression(Z,se,be)}catch(be){return dt.warn(`blur_until_loaded 표현식 평가 실패 (컴포넌트: ${x.id}):`,be),!1}return!1}if(typeof q=="object"&&q!==null){if(!q.enabled)return!1;if(q.data_sources)return(Array.isArray(q.data_sources)?q.data_sources:[q.data_sources]).some(Re=>e[Re]===void 0);if(Q)return!0;const Z=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(Se=>!Z.includes(Se)&&!Se.startsWith("_")).some(Se=>e[Se]===void 0)}if(Q)return!0;const ce=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(Z=>!ce.includes(Z)&&!Z.startsWith("_")).some(Z=>e[Z]===void 0)},[x.blur_until_loaded,x.id,Q,e,se,i,_t]);if(tr){const q=x.blur_until_loaded;if(typeof q=="object"&&q?.data_sources){const le=(Array.isArray(q.data_sources)?q.data_sources:[q.data_sources]).reduce((be,Se)=>(be[Se]=e[Se]===void 0?"UNDEFINED":"LOADED",be),{}),Z=Object.keys(e).filter(be=>!be.startsWith("_"));dt.log(`[BLUR APPLIED] Component: ${x.id}, data_sources status:`,le,"Available keys:",Z)}else dt.log(`[BLUR APPLIED] Component: ${x.id}, blur_until_loaded:`,q)}const Ea=N.useMemo(()=>{if(!x.blur_until_loaded)return{wrapperClasses:"",innerClasses:""};const q=ft?.className||"";if(!q)return{wrapperClasses:"",innerClasses:""};const ce=[/^(sm:|md:|lg:|xl:|2xl:)?(col-span-|row-span-|col-start-|col-end-|row-start-|row-end-)/,/^(sm:|md:|lg:|xl:|2xl:)?(self-|place-self-|order-)/,/^(sm:|md:|lg:|xl:|2xl:)?(flex-shrink|flex-grow|flex-\d|basis-)/],le=q.split(/\s+/).filter(Boolean),Z=[],be=[];for(const Se of le)ce.some(xe=>xe.test(Se))?Z.push(Se):be.push(Se);return{wrapperClasses:Z.join(" "),innerClasses:be.join(" ")}},[x.blur_until_loaded,ft?.className]),tn=window.__slotContextValue;return ve&&tn?.isEnabled?null:ut.jsx(y_,{componentId:o.id,componentName:o.name,children:x.blur_until_loaded?ut.jsx("div",{className:[Ea.wrapperClasses,tr?"opacity-50 blur-sm transition-all duration-300 pointer-events-none":void 0].filter(Boolean).join(" ")||void 0,children:En}):En})});Ha.displayName="DynamicRenderer",typeof window<"u"&&(window.__DynamicRenderer=Ha);function b_(o){const e={};try{const r=new URL(o,typeof window<"u"?window.location.origin:"http://localhost").searchParams,i=new Set;for(const l of r.keys()){if(i.has(l))continue;i.add(l);const u=r.getAll(l);u.length>1||l.endsWith("[]")?e[l]=u:e[l]=u[0]}}catch{}return e}function v_(o){try{return new URL(o,typeof window<"u"?window.location.origin:"http://localhost").pathname}catch{return o.split("?")[0]}}const mi=class mi{constructor(){$(this,"config",{enabled:!1,maxHistorySize:100,logLevel:"info",serverEndpoint:"/_boost/g7-debug/dump-state",autoCapture:!0});$(this,"stateHistory",[]);$(this,"snapshotIdCounter",0);$(this,"stateWatchers",new Map);$(this,"currentLocalState",{});$(this,"currentComputedState",{});$(this,"currentParentContext");$(this,"actionHistory",[]);$(this,"actionWatchers",new Set);$(this,"cacheStats",{hits:0,misses:0,entries:0});$(this,"cacheDecisions",[]);$(this,"cacheDecisionIdCounter",0);$(this,"maxCacheDecisions",200);$(this,"currentRenderCycleId",null);$(this,"isInActionExecution",!1);$(this,"isInIteration",!1);$(this,"mountedComponents",new Map);$(this,"eventListeners",new Map);$(this,"mountWatchers",new Set);$(this,"unmountWatchers",new Set);$(this,"renderCounts",new Map);$(this,"bindingEvalCount",0);$(this,"profilingData",[]);$(this,"isProfiling",!1);$(this,"profilingStartTime",0);$(this,"activeRequests",new Map);$(this,"requestHistory",[]);$(this,"pendingDataSources",new Set);$(this,"requestWatchers",new Set);$(this,"wsConnections",new Map);$(this,"wsMessageHistory",[]);$(this,"wsMessageWatchers",new Set);$(this,"ifConditions",new Map);$(this,"iterations",new Map);$(this,"conditionWatchers",new Set);$(this,"forms",new Map);$(this,"formWatchers",new Set);$(this,"expressionHistory",[]);$(this,"expressionWatchers",new Set);$(this,"expressionIdCounter",0);$(this,"dataSources",new Map);$(this,"dataPathTransforms",[]);$(this,"maxDataPathTransforms",100);$(this,"nestedContexts",[]);$(this,"nestedContextIdCounter",0);$(this,"maxNestedContexts",100);$(this,"formBindingIssues",[]);$(this,"formBindingValidations",[]);$(this,"formBindingIssueIdCounter",0);$(this,"maxFormBindingIssues",100);$(this,"computedProperties",new Map);$(this,"computedRecalcLogs",[]);$(this,"computedRecalcIdCounter",0);$(this,"maxComputedRecalcLogs",100);$(this,"handlers",new Map);$(this,"componentEventSubscriptions",new Map);$(this,"componentEventEmitHistory",[]);$(this,"componentEventIdCounter",0);$(this,"maxComponentEventHistory",100);$(this,"stateRenderingLogs",[]);$(this,"currentStateChangeContext",null);$(this,"stateRenderingIdCounter",0);$(this,"componentRenderCounts",new Map);$(this,"stateToComponentMap",new Map);$(this,"maxStateRenderingLogs",100);$(this,"componentStateSources",new Map);$(this,"contextFlowNodes",new Map);$(this,"dynamicStates",new Map);$(this,"styleIssues",[]);$(this,"componentStyles",new Map);$(this,"authEvents",[]);$(this,"authHeaderHistory",[]);$(this,"authEventIdCounter",0);$(this,"maxAuthEventHistory",50);$(this,"logHistory",[]);$(this,"logIdCounter",0);$(this,"maxLogHistory",500);$(this,"currentLayout",null);$(this,"layoutHistory",[]);$(this,"layoutIdCounter",0);$(this,"layoutStats",{totalLoads:0,cacheHits:0,apiLoads:0});$(this,"maxLayoutHistory",50);$(this,"executionDetails",new Map);$(this,"stateChangeHistory",[]);$(this,"dataSourceChangeHistory",[]);$(this,"changeAlerts",[]);$(this,"changeExpectations",new Map);$(this,"executionIdCounter",0);$(this,"stateChangeIdCounter",0);$(this,"alertIdCounter",0);$(this,"maxExecutionDetails",100);$(this,"maxStateChangeHistory",200);$(this,"maxChangeAlerts",100);$(this,"sequenceExecutions",[]);$(this,"sequenceExecutionStack",[]);$(this,"sequenceIdCounter",0);$(this,"maxSequenceExecutions",50);$(this,"staleClosureWarnings",[]);$(this,"staleClosureIdCounter",0);$(this,"maxStaleClosureWarnings",100);$(this,"stateCaptureRegistry",new Map);$(this,"modalStates",new Map);$(this,"modalStateIssues",[]);$(this,"modalStateRelations",[]);$(this,"modalStateChangeLogs",[]);$(this,"modalStateIssueIdCounter",0);$(this,"modalStateChangeLogIdCounter",0);$(this,"maxModalStateIssues",100);$(this,"maxModalStateChangeLogs",200);$(this,"namedActionDefinitions",{});$(this,"namedActionRefLogs",[]);$(this,"namedActionRefIdCounter",0);$(this,"maxNamedActionRefLogs",200);$(this,"debounceActionHistory",[]);$(this,"dataSourceUpdateHistory",[]);$(this,"debounceActionIdCounter",0);$(this,"dataSourceUpdateIdCounter",0)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.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 r=window.G7Core?.state?.get?.();return r?.settings?.advanced?.debug_mode===!0||r?._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 a={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(a),this.stateHistory.length>this.config.maxHistorySize&&this.stateHistory.shift(),this.notifyStateWatchers(a)}getState(){try{const e=window.G7Core,a=e?.state?.get?.()||{},r={};if(e?._isolatedStates&&typeof e._isolatedStates=="object")for(const[i,l]of Object.entries(e._isolatedStates))r[i]=this.sanitizeObject(l);return{_global:a._global||a,_local:this.currentLocalState,_computed:this.currentComputedState,_isolated:Object.keys(r).length>0?r: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 a={};try{a=(window.G7Core?.state?.get?.()||{})._local||{}}catch{a={}}const r=this.findMismatchedLeafPaths(e,a);return{hasMismatch:r.length>0,mismatchedPaths:r,storageA:e,storageB:a}}findMismatchedLeafPaths(e,a,r=""){const i=[],l=new Set([...Object.keys(e||{}),...Object.keys(a||{})]);for(const u of l){const d=r?`${r}.${u}`:u,f=e?.[u],g=a?.[u],m=f&&typeof f=="object"&&!Array.isArray(f),b=g&&typeof g=="object"&&!Array.isArray(g);if(m&&b)i.push(...this.findMismatchedLeafPaths(f,g,d));else{const v=f===void 0?"__undefined__":JSON.stringify(f),S=g===void 0?"__undefined__":JSON.stringify(g);v!==S&&i.push(d)}}return i}watchState(e,a){return this.stateWatchers.has(e)||this.stateWatchers.set(e,new Set),this.stateWatchers.get(e).add(a),()=>{this.stateWatchers.get(e)?.delete(a)}}notifyStateWatchers(e){if(this.stateWatchers.get("*")?.forEach(a=>{try{a(e.next,e.prev,"*")}catch(r){console.error("[G7DevTools] State watcher error:",r)}}),e.diff)for(const a of e.diff.changed)this.stateWatchers.get(a.path)?.forEach(r=>{try{r(a.newValue,a.oldValue,a.path)}catch(i){console.error("[G7DevTools] State watcher error:",i)}})}diffSnapshots(e,a){const r=this.stateHistory.find(l=>l.id===e),i=this.stateHistory.find(l=>l.id===a);return!r||!i?null:this.calculateDiff(r.next,i.next)}calculateDiff(e,a,r=""){const i={added:[],removed:[],changed:[]},l=new Set(Object.keys(e)),u=new Set(Object.keys(a));for(const d of u){const f=r?`${r}.${d}`:d;l.has(d)?JSON.stringify(e[d])!==JSON.stringify(a[d])&&i.changed.push({path:f,oldValue:e[d],newValue:a[d]}):i.added.push(f)}for(const d of l){const f=r?`${r}.${d}`:d;u.has(d)||i.removed.push(f)}return i}logAction(e){if(!this.config.enabled)return;const a=this.actionHistory.findIndex(r=>r.id===e.id);a>=0?this.actionHistory[a]={...this.actionHistory[a],...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(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Action watcher error:",r)}})}getActionMetrics(){const e=this.actionHistory.filter(l=>l.status==="success"),a=this.actionHistory.filter(l=>l.status==="error"),r={};for(const l of this.actionHistory)r[l.type]=(r[l.type]||0)+1;const i=e.reduce((l,u)=>l+(u.duration||0),0);return{totalActions:this.actionHistory.length,successCount:e.length,errorCount:a.length,averageDuration:e.length>0?i/e.length:0,actionsByType:r}}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 a={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(a),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 a=0,r=0,i=0,l=0;const u={},d={};for(const g of e)g.decision==="cache_hit"?a++:g.decision==="cache_miss"?r++:g.decision==="skip_cache"?i++:g.decision==="invalidate"&&l++,u[g.reason]=(u[g.reason]||0)+1,g.context.componentId&&(d[g.context.componentId]=(d[g.context.componentId]||0)+1);const f=a+r+i;return{totalDecisions:e.length,cacheHits:a,cacheMisses:r,skipCacheCount:i,invalidateCount:l,byReason:u,byComponent:d,avgHitRate:f>0?a/f:0}}getRecentCacheDecisions(e=20,a){let r=[...this.cacheDecisions];return a&&(r=r.filter(i=>i.decision===a)),r.slice(-e)}clearCacheDecisionData(){this.cacheDecisions=[],this.cacheDecisionIdCounter=0}summarizePropsForLifecycle(e){if(!e||typeof e!="object")return e;const a={},r=["children","ref","key"];for(const[i,l]of Object.entries(e))if(!r.includes(i))if(l==null)a[i]=l;else if(Array.isArray(l))a[i]=`[Array(${l.length})]`;else if(typeof l=="object"){const u=Object.keys(l);u.length<=3?a[i]=`{${u.join(", ")}}`:a[i]=`{${u.slice(0,3).join(", ")}, ... +${u.length-3}}`}else typeof l=="string"&&l.length>50?a[i]=l.substring(0,50)+"...":typeof l=="function"?a[i]="[Function]":a[i]=l;return a}trackMount(e,a){if(!this.config.enabled)return;const r=this.summarizePropsForLifecycle(a.props),i={...a,props:r,id:e,mountTime:Date.now()};this.mountedComponents.set(e,i),this.mountWatchers.forEach(l=>{try{l({componentId:e,componentName:a.name,timestamp:i.mountTime})}catch(u){console.error("[G7DevTools] Mount watcher error:",u)}})}trackUnmount(e){if(!this.config.enabled)return;const a=this.mountedComponents.get(e),r=this.eventListeners.get(e)||[];r.length>0&&console.warn(`[G7DevTools] 컴포넌트 ${e} 언마운트 시 ${r.length}개 리스너 미정리`),a&&this.unmountWatchers.forEach(i=>{try{i({componentId:e,componentName:a.name,timestamp:Date.now(),orphanedListeners:r.length})}catch(l){console.error("[G7DevTools] Unmount watcher error:",l)}}),this.mountedComponents.delete(e)}trackListener(e,a,r){if(!this.config.enabled)return;const i=this.eventListeners.get(e)||[];i.push({type:a,target:r,addedAt:Date.now()}),this.eventListeners.set(e,i)}removeListener(e,a){if(!this.config.enabled)return;const r=this.eventListeners.get(e)||[],i=r.findIndex(l=>l.type===a);i>=0&&r.splice(i,1)}getMountedComponents(){return Array.from(this.mountedComponents.values())}getOrphanedListeners(){const e=[];for(const[a,r]of this.eventListeners)this.mountedComponents.has(a)||e.push(...r.map(i=>({...i,componentId:a})));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 a=this.renderCounts.get(e)||0;this.renderCounts.set(e,a+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(),l=JSON.stringify(i).length;l>1e6&&e.push({type:"large-state",message:`상태 크기가 ${(l/1024/1024).toFixed(2)}MB입니다`,suggestion:"불필요한 데이터 정리 필요",severity:l>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 a=this.getOrphanedListeners().length;a>0&&e.push({type:"orphaned-listeners",message:`${a}개의 정리되지 않은 이벤트 리스너`,suggestion:"useEffect cleanup 또는 removeEventListener 확인",severity:a>10?"error":"warning"});const r=Array.from(this.renderCounts.entries()).filter(([,i])=>i>50);return r.length>0&&e.push({type:"excessive-renders",message:`${r.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,a=this.analyzeProfile(e);return console.log("[G7DevTools] 프로파일링 완료",a),a}analyzeProfile(e){const a=this.profilingData.filter(g=>g.type==="render"),r=this.profilingData.filter(g=>g.type==="binding"),i=this.profilingData.filter(g=>g.type==="action"),l={};for(const g of a)g.component&&(l[g.component]||(l[g.component]={count:0,durations:[]}),l[g.component].count++,g.duration&&l[g.component].durations.push(g.duration));const u=Object.entries(l).map(([g,m])=>({name:g,renderCount:m.count,avgDuration:m.durations.length>0?m.durations.reduce((b,v)=>b+v,0)/m.durations.length:0})).sort((g,m)=>m.renderCount-g.renderCount).slice(0,10),d={};for(const g of r)g.expression&&(d[g.expression]=(d[g.expression]||0)+1);const f=Object.entries(d).sort(([,g],[,m])=>m-g).slice(0,10).map(([g])=>g);return{duration:e,entries:this.profilingData,summary:{totalRenders:a.length,totalBindings:r.length,totalActions:i.length,slowestComponents:u,hotPaths:f}}}resetPerformanceStats(){this.renderCounts.clear(),this.bindingEvalCount=0,this.profilingData=[]}trackRequest(e,a,r){if(!this.config.enabled)return"";const i=this.generateId(),l=v_(e),u=b_(e);return this.activeRequests.set(i,{id:i,url:l,fullUrl:e,queryParams:u,method:a,startTime:Date.now(),status:"pending",requestBody:r?.requestBody?this.sanitizeObject(r.requestBody):void 0,dataSourceId:r?.dataSourceId}),this.isProfiling&&this.profilingData.push({type:"network",timestamp:performance.now()}),i}completeRequest(e,a,r){if(!this.config.enabled)return;const i=this.activeRequests.get(e);if(!i)return;const l={...i,status:a>=200&&a<300?"success":"error",statusCode:a,duration:Date.now()-i.startTime,endTime:Date.now(),response:this.sanitizeObject(r)};this.requestHistory.push(l),this.activeRequests.delete(e),this.requestHistory.length>this.config.maxHistorySize&&this.requestHistory.shift(),this.notifyRequestWatchers(l)}failRequest(e,a){if(!this.config.enabled)return;const r=this.activeRequests.get(e);if(!r)return;const i={...r,status:"error",error:a,duration:Date.now()-r.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(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Request watcher error:",r)}})}trackWebSocketConnection(e,a,r){this.config.enabled&&this.wsConnections.set(e,{id:e,url:a,state:r,connectedAt:r==="open"?Date.now():void 0})}trackWebSocketMessage(e,a,r,i){if(!this.config.enabled)return;const l={id:this.generateId(),connectionId:e,direction:a,type:r,payload:this.sanitizeObject(i),timestamp:Date.now(),sequence:this.wsMessageHistory.length};this.wsMessageHistory.push(l),this.wsMessageHistory.length>this.config.maxHistorySize&&this.wsMessageHistory.shift(),this.notifyWebSocketWatchers(l)}getWebSocketConnections(){return Array.from(this.wsConnections.values())}getWebSocketMessageHistory(){return[...this.wsMessageHistory]}getWebSocketConnectionState(){const e=Array.from(this.wsConnections.values());return e.some(a=>a.state==="open")?"connected":e.some(a=>a.state==="connecting")?"reconnecting":"disconnected"}watchWebSocketMessage(e){return this.wsMessageWatchers.add(e),()=>{this.wsMessageWatchers.delete(e)}}notifyWebSocketWatchers(e){this.wsMessageWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] WebSocket watcher error:",r)}})}trackIfCondition(e,a,r){if(!this.config.enabled)return;const i=this.ifConditions.get(e),l=i?.evaluatedValue;this.ifConditions.set(e,{id:e,expression:a,evaluatedValue:r,evaluationCount:(i?.evaluationCount||0)+1,lastEvaluated:Date.now()}),i&&l!==r&&this.notifyConditionWatchers({id:e,expression:a,oldValue:l,newValue:r,timestamp:Date.now()})}trackIteration(e,a){this.config.enabled&&this.iterations.set(e,{id:e,...a,lastRendered:Date.now()})}getIfConditions(){return Array.from(this.ifConditions.values())}getIterations(){return Array.from(this.iterations.values())}getScopeChain(e){const a=[],r=this.getState();return a.push({name:"_global",value:r._global,source:"global"}),a.push({name:"_local",value:r._local,source:"local"}),a.push({name:"_computed",value:r._computed,source:"computed"}),a}watchConditionChange(e){return this.conditionWatchers.add(e),()=>{this.conditionWatchers.delete(e)}}notifyConditionWatchers(e){this.conditionWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Condition watcher error:",r)}})}trackForm(e,a,r){this.config.enabled&&this.forms.set(e,{id:e,dataKey:a,inputs:r,trackedAt:Date.now()})}trackFormChange(e,a,r){if(!this.config.enabled)return;const i={formId:e,inputName:a,value:r,timestamp:Date.now()};this.notifyFormWatchers(i)}untrackForm(e){this.forms.delete(e)}getForms(){return Array.from(this.forms.values())}getFormState(e){const a=this.getState();return this.getNestedValue(a,e)||{}}getBindingPath(e,a){return`${e}.${a}`}watchFormChange(e){return this.formWatchers.add(e),()=>{this.formWatchers.delete(e)}}notifyFormWatchers(e){this.formWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Form watcher error:",r)}})}trackFormBindingIssue(e,a,r){if(!this.config.enabled)return;const i={id:`form-issue-${++this.formBindingIssueIdCounter}`,timestamp:Date.now(),type:e,severity:a,formId:r.formId,formDataKey:r.formDataKey,inputInfo:r.inputInfo,contextInfo:r.contextInfo,description:r.description,suggestion:r.suggestion,docLink:r.docLink};this.formBindingIssues.push(i),this.formBindingIssues.length>this.maxFormBindingIssues&&this.formBindingIssues.shift()}validateFormBinding(e,a,r,i){const l=r.map(f=>{const g=[];let m=!0;return f.name||(g.push("Input에 name 속성이 없습니다"),m=!1,this.trackFormBindingIssue("missing-input-name","error",{formId:e,formDataKey:a,inputInfo:{name:f.name,type:f.type},description:"Input에 name 속성이 없어 자동 바인딩이 동작하지 않습니다",suggestion:"Input에 name 속성을 추가하세요",docLink:"troubleshooting-components-form.md"})),a||(g.push("Form에 dataKey가 없습니다"),m=!1),{inputName:f.name||"(unnamed)",inputType:f.type,bindingPath:a&&f.name?`${a}.${f.name}`:"-",isValid:m,currentValue:f.value,issues:g}});if(a||this.trackFormBindingIssue("missing-datakey","error",{formId:e,description:"Form에 dataKey가 설정되지 않아 자동 바인딩이 동작하지 않습니다",suggestion:"Form 컴포넌트에 dataKey props를 설정하세요",docLink:"troubleshooting-components-form.md"}),i.isContextBroken){const f=i.breakReason?.includes("sortable")?"sortable-context-break":i.breakReason?.includes("modal")?"modal-context-isolation":"context-not-propagated";this.trackFormBindingIssue(f,"warning",{formId:e,formDataKey:a,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 u={formId:e,dataKey:a,timestamp:Date.now(),contextPropagation:i,inputBindings:l,isValid:l.every(f=>f.isValid)&&!!a&&!i.isContextBroken,issueCount:l.filter(f=>!f.isValid).length+(a?0:1)+(i.isContextBroken?1:0)},d=this.formBindingValidations.findIndex(f=>f.formId===e);return d>=0?this.formBindingValidations[d]=u:this.formBindingValidations.push(u),u}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},a={info:0,warning:0,error:0};for(const i of this.formBindingIssues)e[i.type]++,a[i.severity]++;const r=Object.entries(e).filter(([,i])=>i>0).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i,l])=>({type:i,count:l,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:a,topIssues:r}}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,a,r,i,l,u,d){if(!this.config.enabled)return;const f=`computed-${e}-${u||"global"}`,g={id:f,name:e,expression:a,componentId:u,dependencies:r,currentValue:this.safeClone(i),lastComputedAt:Date.now(),computationTime:l,error:d};this.computedProperties.set(f,g)}trackComputedRecalc(e,a,r,i,l,u,d){if(!this.config.enabled)return;const f=`computed-${e}-${d||"global"}`,g=JSON.stringify(r)!==JSON.stringify(i),m={id:`recalc-${++this.computedRecalcIdCounter}`,computedId:f,computedName:e,timestamp:Date.now(),trigger:a,triggeredBy:u,previousValue:this.safeClone(r),newValue:this.safeClone(i),valueChanged:g,computationTime:l,cascadeCount:0};this.computedRecalcLogs.push(m),this.computedRecalcLogs.length>this.maxComputedRecalcLogs&&this.computedRecalcLogs.shift();const b=this.computedProperties.get(f);b&&(b.currentValue=this.safeClone(i),b.lastComputedAt=Date.now(),b.computationTime=l)}analyzeComputedDependencyChain(e,a){const r=new Set,i=[];let l=!1,u,d=0;const f=(m,b)=>{if(d=Math.max(d,b),r.has(m))return l=!0,u=[...i,m],{name:m,type:"computed",children:[],depth:b};r.add(m),i.push(m);const v=this.computedProperties.get(`computed-${m}-${a||"global"}`),S=[];if(v)for(const E of v.dependencies)E.type==="computed"?S.push(f(E.path,b+1)):S.push({name:E.path,type:E.type,children:[],depth:b+1});return i.pop(),r.delete(m),{name:m,type:"computed",children:S,depth:b}},g=f(e,0);return{root:e,tree:g,hasCycle:l,cyclePath:u,maxDepth:d}}getComputedDependencyTrackingInfo(){const e=Array.from(this.computedProperties.values()),a=this.getComputedDependencyStats(),r=[];for(const i of e){const l=this.analyzeComputedDependencyChain(i.name,i.componentId);r.push(l)}return{properties:e,recalcLogs:[...this.computedRecalcLogs],dependencyChains:r,stats:a,timestamp:Date.now()}}getComputedDependencyStats(){const e={"state-change":0,"datasource-update":0,"dependency-change":0,manual:0,initial:0},a={},r={};let i=0,l=0;for(const g of this.computedRecalcLogs)e[g.trigger]++,g.valueChanged||l++,a[g.computedName]=(a[g.computedName]||0)+1,r[g.computedName]||(r[g.computedName]=[]),r[g.computedName].push(g.computationTime),i+=g.computationTime;const u=Object.entries(a).sort((g,m)=>m[1]-g[1]).slice(0,5).map(([g,m])=>({name:g,count:m})),d=Object.entries(r).map(([g,m])=>({name:g,avgTime:m.reduce((b,v)=>b+v,0)/m.length})).sort((g,m)=>m.avgTime-g.avgTime).slice(0,5);let f=0;for(const g of this.computedProperties.values())this.analyzeComputedDependencyChain(g.name,g.componentId).hasCycle&&f++;return{totalComputed:this.computedProperties.size,totalRecalculations:this.computedRecalcLogs.length,unnecessaryRecalculations:l,avgComputationTime:this.computedRecalcLogs.length>0?i/this.computedRecalcLogs.length:0,topRecalculated:u,slowestComputed:d,cycleDetectionCount:f,byTrigger:e}}clearComputedTracking(){this.computedProperties.clear(),this.computedRecalcLogs=[],this.computedRecalcIdCounter=0}trackModalOpen(e){if(!this.config.enabled)return;const a={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,a),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,a){if(!this.config.enabled)return;const r=this.modalStates.get(e);r&&(r.closedAt=Date.now(),a&&(r.currentState={...a}),this.detectStateLeakage(r))}validateModalDefinitionExists(e,a){const r=this.currentLayout;if(!r?.layoutJson)return;const i=r.layoutJson.modals;if(!i){this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:a,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 현재 레이아웃에 modals 섹션이 없습니다. 레이아웃 경로: ${r.layoutPath}`,affectedStateKeys:[],expectedValue:`modals 섹션에 id="${e}" 정의 존재`,actualValue:"modals 섹션 없음"});return}const l=Array.isArray(i)?i:Object.values(i);l.some(d=>d?.id===e||d?.props?.id===e)||this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:a,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 렌더링된 레이아웃의 modals 섹션에 해당 ID의 정의가 없습니다. partial 로딩 실패, 레이아웃 병합 문제, extends 상속 누락 등을 확인하세요. 레이아웃 경로: ${r.layoutPath}`,affectedStateKeys:[],expectedValue:`modals 배열에 id="${e}" 항목 존재`,actualValue:`modals 배열에 ${l.length}개 모달 정의 (${l.map(d=>d?.id||"unknown").join(", ")})`})}trackModalStateChange(e){if(!this.config.enabled)return;const a=this.modalStates.get(e.modalId);if(!a)return;a.stateChangeCount++,a.currentState[e.stateKey]=e.newValue;const r=this.checkIsolationViolation(a,e.stateKey),i={id:`modal-change-${++this.modalStateChangeLogIdCounter}`,modalId:e.modalId,modalName:a.modalName,timestamp:Date.now(),stateKey:e.stateKey,previousValue:e.previousValue,newValue:e.newValue,changeSource:e.changeSource||"user-action",violatesIsolation:r};this.modalStateChangeLogs.push(i),this.modalStateChangeLogs.length>this.maxModalStateChangeLogs&&this.modalStateChangeLogs.shift(),r&&this.recordModalStateIssue({type:"isolation-violation",modalId:e.modalId,modalName:a.modalName,severity:"warning",description:`모달 '${a.modalName}'에서 격리된 상태 키 '${e.stateKey}'가 변경됨`,affectedStateKeys:[e.stateKey]})}detectStateLeakage(e){if(e.scopeType==="isolated")for(const a of e.isolatedStateKeys){const r=e.initialState[a],i=e.currentState[a];if(r!==i&&e.parentModalId){const l=this.modalStates.get(e.parentModalId);l&&l.currentState.hasOwnProperty(a)&&this.recordModalStateIssue({type:"state-leakage",modalId:e.modalId,modalName:e.modalName,severity:"error",description:`모달 닫힘 후 상태 '${a}'가 부모 모달로 유출될 수 있음`,affectedStateKeys:[a],leakedValue:i,expectedValue:r})}}}checkIsolationViolation(e,a){return e.scopeType==="isolated",!1}recordModalStateIssue(e){const a={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(a),this.modalStateIssues.length>this.maxModalStateIssues&&this.modalStateIssues.shift()}getModalStateScopeTrackingInfo(){const e=Array.from(this.modalStates.values()),a=this.getModalStateScopeStats();return{modals:e,issues:[...this.modalStateIssues],relations:[...this.modalStateRelations],changeLogs:[...this.modalStateChangeLogs],stats:a,timestamp:Date.now()}}getModalStateScopeStats(){const e=Array.from(this.modalStates.values()),a={warning:0,error:0},r={"state-leakage":0,"isolation-violation":0,"parent-mutation":0,"orphaned-state":0,"scope-mismatch":0,"cleanup-failure":0,"missing-definition":0};for(const l of this.modalStateIssues)a[l.severity]++,r[l.type]++;const i={isolated:0,shared:0,inherited:0};for(const l of e)i[l.scopeType]++;return{totalModals:e.length,openModals:e.filter(l=>l.closedAt===null).length,nestedModals:e.filter(l=>l.parentModalId!==void 0).length,totalIssues:this.modalStateIssues.length,issuesBySeverity:a,issuesByType:r,byScope:i,leakageDetectionCount:r["state-leakage"],cleanupFailureCount:r["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 a={...e,id:`named_action_ref_${++this.namedActionRefIdCounter}`};this.namedActionRefLogs.push(a),this.namedActionRefLogs.length>this.maxNamedActionRefLogs&&(this.namedActionRefLogs=this.namedActionRefLogs.slice(-this.maxNamedActionRefLogs))}getNamedActionTrackingInfo(){const e={};for(const r of this.namedActionRefLogs)e[r.actionRefName]=(e[r.actionRefName]||0)+1;const a=Object.keys(this.namedActionDefinitions).filter(r=>!e[r]);return{definitions:this.namedActionDefinitions,refLogs:[...this.namedActionRefLogs],stats:{totalDefinitions:Object.keys(this.namedActionDefinitions).length,totalRefs:this.namedActionRefLogs.length,refCountByName:e,unusedDefinitions:a},timestamp:Date.now()}}clearNamedActionTracking(){this.namedActionDefinitions={},this.namedActionRefLogs=[],this.namedActionRefIdCounter=0}trackExpressionEval(e){if(!this.config.enabled)return;const a={...e,id:`expr-${++this.expressionIdCounter}`,timestamp:Date.now(),warning:this.detectExpressionWarning(e)};this.expressionHistory.push(a),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(a)}detectExpressionWarning(e){const{expression:a,result:r,resultType:i,method:l,duration:u}=e;if(i==="undefined"&&!a.includes("??")&&!a.includes("||")&&/^[a-zA-Z_$][a-zA-Z0-9_$.]*$/.test(a.replace(/{{|}}/g,"").trim()))return{type:"undefined-result",message:"표현식 결과가 undefined입니다",suggestion:`데이터가 로드되었는지 확인하거나 fallback 값을 추가하세요: ${a} ?? ''`};if(i==="null")return{type:"null-result",message:"표현식 결과가 null입니다",suggestion:`nullish coalescing 연산자를 사용하세요: ${a} ?? ''`};if(l==="resolveBindings"&&i==="string"){const d=String(r);if(d.includes("[object Object]")||/^\[.*\]$/.test(d))return{type:"array-to-string",message:"배열/객체가 문자열로 변환되었습니다",suggestion:"evaluateExpression()을 사용하여 원본 타입을 유지하세요"}}if(l==="resolveBindings"&&i==="string"&&String(r).includes("[object Object]"))return{type:"object-to-string",message:"객체가 [object Object]로 변환되었습니다",suggestion:"evaluateExpression()을 사용하거나 특정 속성에 접근하세요"};if(i==="undefined"&&a.includes(".")&&!a.includes("?.")){const d=a.replace(/{{|}}/g,"").trim().split(".");if(d.length>=2)return{type:"missing-optional-chain",message:"Optional chaining(?.) 누락 가능성",suggestion:`안전한 접근을 위해 ?. 사용을 고려하세요: ${d.join("?.")}`}}if((a.includes("{{item.")||a.includes("{{index}}"))&&Array.from(this.iterations.values()).some(g=>g.itemVar!=="item"))return{type:"wrong-iteration-var",message:"'item'/'index' 대신 iteration에서 정의한 변수명을 사용해야 합니다",suggestion:"iteration의 item_var/index_var에 정의된 변수명을 확인하세요"};if(u&&u>10)return{type:"slow-evaluation",message:`표현식 평가에 ${u.toFixed(2)}ms 소요됨`,suggestion:"복잡한 표현식을 단순화하거나 computed 값으로 분리하세요"}}getExpressions(){return[...this.expressionHistory]}getExpressionWarnings(){return this.expressionHistory.filter(e=>e.warning!=null)}searchExpressions(e){const a=e.toLowerCase();return this.expressionHistory.filter(r=>r.expression.toLowerCase().includes(a)||r.componentName?.toLowerCase().includes(a)||r.propName?.toLowerCase().includes(a))}getExpressionStats(){const e=this.expressionHistory,a=new Set(e.map(f=>f.expression)),r=e.filter(f=>f.warning!=null),i=e.filter(f=>f.fromCache),l=e.filter(f=>f.duration!=null).map(f=>f.duration),u={};for(const f of e)u[f.resultType]=(u[f.resultType]||0)+1;const d={};for(const f of r)f.warning&&(d[f.warning.type]=(d[f.warning.type]||0)+1);return{totalEvaluations:e.length,uniqueExpressions:a.size,warningCount:r.length,cacheHitRate:e.length>0?i.length/e.length:0,averageDuration:l.length>0?l.reduce((f,g)=>f+g,0)/l.length:0,byType:u,byWarning:d}}clearExpressions(){this.expressionHistory=[],this.expressionIdCounter=0}watchExpressions(e){return this.expressionWatchers.add(e),()=>{this.expressionWatchers.delete(e)}}notifyExpressionWatchers(e){this.expressionWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Expression watcher error:",r)}})}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,a=new WeakSet){if(e===null||typeof e!="object")return e;if(a.has(e))return"[Circular]";if(a.add(e),Array.isArray(e))return e.map(i=>this.sanitizeObject(i,a));const r={};for(const i of Object.keys(e))try{r[i]=this.sanitizeObject(e[i],a)}catch{r[i]="[Unable to serialize]"}return r}getNestedValue(e,a){if(!a)return e;const r=a.split(".");let i=e;for(const l of r){if(i==null)return;i=i[l]}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 a=[...this.stateHistory].reverse().find(r=>r.timestamp<=e);if(a)return{_global:a.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,a,r){if(!this.config.enabled)return;const i=r.map(u=>{if(typeof u=="string")return u;try{return JSON.stringify(u)}catch{return String(u)}}).join(" "),l={id:`log-${++this.logIdCounter}`,level:e,prefix:a,message:i,args:this.sanitizeObject(r),timestamp:Date.now(),stack:e==="error"?new Error().stack:void 0};this.logHistory.push(l),this.logHistory.length>this.maxLogHistory&&this.logHistory.shift()}trackAction(e){if(!this.config.enabled)return;const a={id:`debounce-action-${++this.debounceActionIdCounter}`,...e,timestamp:Date.now()};this.debounceActionHistory.push(a),this.debounceActionHistory.length>100&&this.debounceActionHistory.shift()}trackDataSourceUpdate(e){if(!this.config.enabled)return;const a={id:`ds-update-${++this.dataSourceUpdateIdCounter}`,...e};this.dataSourceUpdateHistory.push(a),this.dataSourceUpdateHistory.length>100&&this.dataSourceUpdateHistory.shift()}getDebounceActionHistory(e){let a=[...this.debounceActionHistory];return e?.handler&&(a=a.filter(r=>r.handler.includes(e.handler))),e?.status&&(a=a.filter(r=>r.status===e.status)),e?.limit&&(a=a.slice(-e.limit)),a}getDataSourceUpdateHistory(e){let a=[...this.dataSourceUpdateHistory];return e?.dataSourceId&&(a=a.filter(r=>r.dataSourceId===e.dataSourceId)),e?.updateType&&(a=a.filter(r=>r.updateType===e.updateType)),e?.limit&&(a=a.slice(-e.limit)),a}getLogs(e){let a=[...this.logHistory];if(e?.level){const r=Array.isArray(e.level)?e.level:[e.level];a=a.filter(i=>r.includes(i.level))}if(e?.prefix){const r=e.prefix.toLowerCase();a=a.filter(i=>i.prefix.toLowerCase().includes(r))}if(e?.search){const r=e.search.toLowerCase();a=a.filter(i=>i.message.toLowerCase().includes(r))}return e?.since&&(a=a.filter(r=>r.timestamp>=e.since)),e?.limit&&(a=a.slice(-e.limit)),a}getLogStats(){const a=Date.now()-6e4,r={log:0,warn:0,error:0,debug:0,info:0},i={};let l=0,u=0;for(const d of this.logHistory)r[d.level]++,i[d.prefix]=(i[d.prefix]||0)+1,d.timestamp>=a&&(d.level==="error"&&l++,d.level==="warn"&&u++);return{totalLogs:this.logHistory.length,byLevel:r,byPrefix:i,recentErrors:l,recentWarnings:u}}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 a=this.dataSources.get(e);a&&this.dataSources.set(e,{...a,status:"loading"})}trackDataSourceLoaded(e,a,r){if(!this.config.enabled)return;const i=this.dataSources.get(e);if(!i)return;let l,u,d=r;a&&(Array.isArray(a)?(l=a.length,u=a.length>0&&typeof a[0]=="object"?Object.keys(a[0]):void 0):typeof a=="object"&&(Array.isArray(a.data)?(d=d||"data",l=a.data.length,u=a.data.length>0&&typeof a.data[0]=="object"?Object.keys(a.data[0]):void 0):Array.isArray(a.items)?(d=d||"items",l=a.items.length,u=a.items.length>0&&typeof a.items[0]=="object"?Object.keys(a.items[0]):void 0):u=Object.keys(a))),this.dataSources.set(e,{...i,status:"loaded",dataPath:d,itemCount:l,keys:u,lastLoadedAt:Date.now(),error:void 0})}trackDataSourceError(e,a){if(!this.config.enabled)return;const r=this.dataSources.get(e);r&&this.dataSources.set(e,{...r,status:"error",error:a,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 a=this.dataPathTransforms.find(r=>r.dataSourceId===e.dataSourceId);a||(a={dataSourceId:e.dataSourceId,timestamp:Date.now(),transformSteps:[],warnings:[]},this.dataPathTransforms.push(a),this.dataPathTransforms.length>this.maxDataPathTransforms&&this.dataPathTransforms.shift()),a.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&&a.warnings.push(e.warning)}setDataPathFinalBinding(e,a){if(!this.config.enabled)return;const r=this.dataPathTransforms.find(i=>i.dataSourceId===e);r&&(r.finalBinding={expression:a.expression,resolvedPath:a.resolvedPath,value:this.safeClone(a.value)})}getDataPathTransformTrackingInfo(){const e=this.getDataPathTransformStats();return{transforms:[...this.dataPathTransforms],stats:e,timestamp:Date.now()}}getDataPathTransformStats(){const e=this.dataPathTransforms,a={};let r=0;const i={};for(const u of e){a[u.dataSourceId]=(a[u.dataSourceId]||0)+1,r+=u.warnings.length;for(const d of u.warnings)i[d]=(i[d]||0)+1}const l=Object.entries(i).map(([u,d])=>({warning:u,count:d})).sort((u,d)=>d.count-u.count).slice(0,10);return{totalTransforms:e.length,byDataSource:a,warningsCount:r,commonWarnings:l}}getDataPathTransformForDataSource(e){return this.dataPathTransforms.find(a=>a.dataSourceId===e)}clearDataPathTransforms(){this.dataPathTransforms=[]}trackNestedContext(e){if(!this.config.enabled)return"";const a=`nested-${++this.nestedContextIdCounter}`,r=[...new Set([...e.parentContext.available,...e.ownContext.added])],i={...e.parentContext.values,...e.ownContext.values},l={id:a,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:r,values:this.safeClone(i)},accessAttempts:[],depth:e.depth,parentId:e.parentId};return this.nestedContexts.push(l),this.nestedContexts.length>this.maxNestedContexts&&this.nestedContexts.shift(),a}trackNestedContextAccess(e,a){if(!this.config.enabled)return;const r=this.nestedContexts.find(i=>i.id===e);r&&r.accessAttempts.push({path:a.path,found:a.found,value:a.found?this.safeClone(a.value):void 0,error:a.error})}getNestedContextTrackingInfo(){const e=this.getNestedContextStats();return{contexts:[...this.nestedContexts],stats:e,timestamp:Date.now()}}getNestedContextStats(){const e=this.nestedContexts,a={expandChildren:0,cellChildren:0,iteration:0,modal:0,slot:0};let r=0,i=0;const l={};for(const d of e){a[d.componentType]++,d.depth>r&&(r=d.depth);for(const f of d.accessAttempts)f.found||(i++,l[f.path]=(l[f.path]||0)+1)}const u=Object.entries(l).map(([d,f])=>({path:d,count:f})).sort((d,f)=>f.count-d.count).slice(0,10);return{totalContexts:e.length,byType:a,maxDepth:r,failedAccessCount:i,commonFailedPaths:u}}getNestedContextForComponent(e){return this.nestedContexts.find(a=>a.componentId===e)}clearNestedContexts(){this.nestedContexts=[],this.nestedContextIdCounter=0}trackHandlerRegistration(e,a="custom",r,i){this.isEnabled&&this.handlers.set(e,{name:e,category:a,description:r,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(a=>a.category===e)}clearHandlers(){this.handlers.clear()}trackEventSubscribe(e){if(!this.isEnabled)return;const a=this.componentEventSubscriptions.get(e),r=Date.now();a?(a.subscriberCount++,a.lastSubscribedAt=r):this.componentEventSubscriptions.set(e,{eventName:e,subscriberCount:1,firstSubscribedAt:r,lastSubscribedAt:r})}trackEventUnsubscribe(e){if(!this.isEnabled)return;const a=this.componentEventSubscriptions.get(e);a&&(a.subscriberCount--,a.subscriberCount<=0&&this.componentEventSubscriptions.delete(e))}trackEventEmit(e,a,r,i,l){if(!this.isEnabled)return;const u={id:`evt_${++this.componentEventIdCounter}`,eventName:e,data:this.sanitizeForLogging(a),timestamp:Date.now(),listenerCount:r,results:i?this.sanitizeForLogging(i):void 0,hasError:!!l,errorMessage:l?.message};this.componentEventEmitHistory.push(u),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((a,r)=>a+r.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,a,r,i){if(!this.config.enabled)return"";const l=`setState_${++this.stateRenderingIdCounter}`;this.currentStateChangeContext={setStateId:l,startTime:performance.now(),changedPath:e,trigger:i||{},renderedComponents:[]};const u={id:`sr_${this.stateRenderingIdCounter}`,setStateId:l,statePath:e,oldValue:this.sanitizeForLogging(a),newValue:this.sanitizeForLogging(r),timestamp:Date.now(),triggeredBy:i||{},renderedComponents:[],totalRenderDuration:0,affectedBindingsCount:0};return this.stateRenderingLogs.push(u),this.stateRenderingLogs.length>this.maxStateRenderingLogs&&this.stateRenderingLogs.shift(),l}trackComponentRender(e,a,r,i=[],l=[],u){if(!this.config.enabled)return;const d=this.componentRenderCounts.get(a)||0;this.componentRenderCounts.set(a,d+1);for(const f of i)this.stateToComponentMap.has(f)||this.stateToComponentMap.set(f,new Set),this.stateToComponentMap.get(f).add(a);if(this.currentStateChangeContext){const f={componentId:e,componentName:a,renderDuration:r,accessedStatePaths:i,evaluatedBindings:l,renderOrder:this.currentStateChangeContext.renderedComponents.length,parentId:u};this.currentStateChangeContext.renderedComponents.push(f)}this.trackRender(a)}completeStateChange(e){if(!this.config.enabled||!this.currentStateChangeContext||this.currentStateChangeContext.setStateId!==e)return;const a=this.currentStateChangeContext,i=performance.now()-a.startTime,l=this.stateRenderingLogs.findIndex(u=>u.setStateId===e);if(l>=0){const u=this.stateRenderingLogs[l];u.renderedComponents=a.renderedComponents,u.totalRenderDuration=i,u.affectedBindingsCount=a.renderedComponents.reduce((d,f)=>d+f.evaluatedBindings.length,0)}this.currentStateChangeContext=null}getCurrentStateChangeContext(){return this.currentStateChangeContext}getStateRenderingLogs(){return[...this.stateRenderingLogs]}getStateRenderingInfo(){const e=this.stateRenderingLogs,a=Object.fromEntries(this.componentRenderCounts),r={};for(const[i,l]of this.stateToComponentMap)r[i]=Array.from(l);return{logs:e,componentRenderCounts:a,stateToComponentMap:r,stats:this.calculateStateRenderingStats()}}calculateStateRenderingStats(){const e=this.stateRenderingLogs;if(e.length===0)return{totalStateChanges:0,totalRenders:0,avgRenderDuration:0,avgComponentsPerChange:0,topRenderedComponents:[],topInfluentialPaths:[]};const a=e.reduce((d,f)=>d+f.renderedComponents.length,0),r=e.reduce((d,f)=>d+f.totalRenderDuration,0)/e.length,i=a/e.length,l=Array.from(this.componentRenderCounts.entries()).sort((d,f)=>f[1]-d[1]).slice(0,5).map(([d,f])=>({name:d,count:f})),u=Array.from(this.stateToComponentMap.entries()).sort((d,f)=>f[1].size-d[1].size).slice(0,5).map(([d,f])=>({path:d,affectedComponents:f.size}));return{totalStateChanges:e.length,totalRenders:a,avgRenderDuration:r,avgComponentsPerChange:i,topRenderedComponents:l,topInfluentialPaths:u}}getComponentsAffectedByState(e){const a=this.stateToComponentMap.get(e);return a?Array.from(a):[]}getComponentRenderHistory(e){return this.stateRenderingLogs.filter(a=>a.renderedComponents.some(r=>r.componentName===e))}clearStateRenderingLogs(){this.stateRenderingLogs=[],this.componentRenderCounts.clear(),this.stateToComponentMap.clear(),this.currentStateChangeContext=null,this.stateRenderingIdCounter=0}trackComponentStateSource(e,a,r,i){this.config.enabled&&this.componentStateSources.set(e,{componentId:e,componentName:a,stateSource:r,stateProvider:i})}trackDynamicState(e,a){this.config.enabled&&this.dynamicStates.set(e,a)}trackContextFlow(e,a,r,i,l,u){if(!this.config.enabled)return;const d={component:a,componentId:e,contextReceived:r,passedToChildren:i,usedInRender:l};if(this.contextFlowNodes.set(e,d),u){const f=this.contextFlowNodes.get(u);f&&(f.children||(f.children=[]),f.children.push(d))}}getStateHierarchyInfo(e=!0){const a=this.buildStateHierarchyLayers(),r=this.detectStateConflicts(a),i=Array.from(this.componentStateSources.values());return{layers:e?a.map(u=>({...u,values:this.summarizeValues(u.values,2)})):a,conflicts:r,componentStateSources:i,timestamp:Date.now()}}summarizeValues(e,a,r=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(r>=a){if(Array.isArray(e))return`[Array(${e.length})]`;const u=Object.keys(e);return`{${u.slice(0,5).join(", ")}${u.length>5?`, ... +${u.length-5}`:""}}`}if(Array.isArray(e))return e.length<=3?e.map(u=>this.summarizeValues(u,a,r+1)):{__type:"array",__length:e.length,__preview:e.slice(0,3).map(u=>this.summarizeValues(u,a,r+1))};const i={},l=Object.keys(e);for(const u of l)i[u]=this.summarizeValues(e[u],a,r+1);return i}buildStateHierarchyLayers(){const e=[];try{const r=window.G7Core?.state?.get?.();if(!r)return e;r._local&&e.push({name:"Global _local",type:"global",path:"_local",values:r._local,priority:1}),r._global&&e.push({name:"Global _global",type:"global",path:"_global",values:r._global,priority:1});for(const[l,u]of this.dynamicStates)u&&Object.keys(u).length>0&&e.push({name:`DynamicState (${l})`,type:"dynamicState",componentId:l,values:u,priority:2});const i=this.computeEffectiveState(r._local||{});e.push({name:"Effective _local (merged)",type:"effective",values:i,priority:3})}catch(a){console.warn("[G7DevTools] 상태 계층 빌드 실패:",a)}return e}computeEffectiveState(e){const a={...e};for(const[,r]of this.dynamicStates)r._local&&Object.assign(a,r._local);return a}detectStateConflicts(e){const a=[],r=e.find(l=>l.type==="global"&&l.path==="_local");if(!r)return a;const i=e.filter(l=>l.type==="dynamicState");for(const l of i){const u=l.values._local||l.values;for(const[d,f]of Object.entries(u)){const g=r.values[d];if(JSON.stringify(g)!==JSON.stringify(f)){const m=[],b=[];for(const v of this.componentStateSources.values())v.stateSource.local.some(E=>E===`_local.${d}`||E===d)&&(v.stateProvider.type==="dynamicState"?m.push(v.componentName):v.stateProvider.type==="globalState"&&b.push(v.componentName));a.push({path:`_local.${d}`,globalValue:g,dynamicStateValue:f,effectiveValue:f,usedBy:m,notUsedBy:b,severity:b.length>0?"warning":"info",description:b.length>0?`${b.join(", ")}은(는) globalState._local을 읽어 dynamicState 값을 사용하지 못함`:"dynamicState 값이 globalState와 다르지만 모든 컴포넌트가 dynamicState를 사용"})}}}return a}getContextFlowInfo(){const e=[],a=new Set(this.contextFlowNodes.keys());for(const r of this.contextFlowNodes.values())if(r.children)for(const i of r.children)a.delete(i.componentId);for(const r of a){const i=this.contextFlowNodes.get(r);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,a,r,i){if(!this.config.enabled)return;const l=this.analyzeTailwindClasses(r),u={componentId:e,componentName:a,classes:r,computedStyles:i,tailwindAnalysis:l};this.componentStyles.set(e,u),this.detectStyleIssues(u)}analyzeTailwindClasses(e){const a=[],r=[],i=[],l=[],u=["sm:","md:","lg:","xl:","2xl:"],d=[/bg-\w+-\d+/,/text-\w+-\d+/,/border-\w+-\d+/];for(const f of e){l.push(f),f.startsWith("dark:")&&a.push(f);for(const g of u)if(f.startsWith(g)){r.push(f);break}for(const g of d)if(g.test(f)){i.push(f);break}}return{usedClasses:l,darkClasses:a,responsiveClasses:r,dynamicClasses:i}}detectStyleIssues(e){const{componentId:a,componentName:r,computedStyles:i,tailwindAnalysis:l}=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:a,componentName:r,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 u=l.usedClasses.filter(f=>f.startsWith("bg-")&&!f.startsWith("dark:")),d=l.darkClasses.filter(f=>f.includes("bg-"));u.length>0&&d.length===0&&this.addStyleIssue({id:this.generateId(),type:"dark-mode-missing",componentId:a,componentName:r,property:"background-color",currentValue:u.join(", "),expectedValue:"dark:bg-* 클래스 필요",severity:"info",description:"다크 모드 배경색 클래스가 누락되었습니다.",suggestion:`${u[0]}에 대응하는 dark: 클래스를 추가하세요.`}),l.dynamicClasses.length>0&&this.addStyleIssue({id:this.generateId(),type:"tailwind-purging",componentId:a,componentName:r,property:"class",currentValue:l.dynamicClasses.join(", "),severity:"info",description:"동적으로 생성된 Tailwind 클래스가 있습니다.",suggestion:"tailwind.config.js의 safelist에 추가하거나 전체 클래스명을 상수로 정의하세요."})}addStyleIssue(e){this.styleIssues.some(r=>r.componentId===e.componentId&&r.type===e.type&&r.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(a=>a.type==="invisible-element").length,tailwindIssueCount:this.styleIssues.filter(a=>a.type==="tailwind-purging").length,darkModeIssueCount:this.styleIssues.filter(a=>a.type==="dark-mode-missing").length},timestamp:Date.now()}}clearStyleValidationData(){this.styleIssues=[],this.componentStyles.clear()}trackAuthEvent(e,a,r,i){if(!this.config.enabled)return;const l={id:`auth_${++this.authEventIdCounter}`,type:e,timestamp:Date.now(),success:a,error:r,details:i};this.authEvents.push(l),this.authEvents.length>this.maxAuthEventHistory&&(this.authEvents=this.authEvents.slice(-this.maxAuthEventHistory))}trackAuthHeader(e,a,r,i,l){if(!this.config.enabled)return;const u={url:e,hasAuthHeader:a,headerType:r,tokenValid:i??!1,responseStatus:l,timestamp:Date.now()};this.authHeaderHistory.push(u),this.authHeaderHistory.length>this.maxAuthEventHistory&&(this.authHeaderHistory=this.authHeaderHistory.slice(-this.maxAuthEventHistory)),l===401&&this.trackAuthEvent("api-unauthorized",!1,`401 Unauthorized: ${e}`,{url:e})}getAuthState(){try{const e=window.G7Core,a=e?.api;let r=e?.auth;!r&&e?.AuthManager?.getInstance&&(r=e.AuthManager.getInstance());const i=a?.getToken?.()||r?.getAccessToken?.()||localStorage.getItem("auth_token")||localStorage.getItem("access_token"),l=r?.getRefreshToken?.()||localStorage.getItem("refresh_token");let u="unknown",d=r?.getUser?.();if(d&&(u="AuthManager"),!d){const S=e?.state?.get?.();d=S?._global?.user||S?._global?.currentUser||S?.user||S?.currentUser,d&&(u="G7Core.state")}const f=r?.isAuthenticated?.()??!1;let g="memory";localStorage.getItem("auth_token")||localStorage.getItem("access_token")?g="localStorage":(sessionStorage.getItem("auth_token")||sessionStorage.getItem("access_token"))&&(g="sessionStorage");const m=!!i&&(!!d||f);let b;i&&typeof i=="string"&&i.length>20?b=`${i.substring(0,10)}...${i.substring(i.length-6)}`:i&&(b="***");const v=d?{id:d.id,email:d.email,name:d.name,roles:d.roles?.map(S=>typeof S=="string"?{name:S}:{id:S.id,name:S.name,guard_name:S.guard_name}),permissions:d.permissions?.map(S=>typeof S=="string"?{name:S}:{id:S.id,name:S.name,guard_name:S.guard_name}),avatar:d.avatar||d.profile_photo_url||d.profile_image,created_at:d.created_at,updated_at:d.updated_at,last_login_at:d.last_login_at,email_verified_at:d.email_verified_at,...d.phone&&{phone:d.phone},...d.nickname&&{nickname:d.nickname},...d.status&&{status:d.status},...d.locale&&{locale:d.locale}}:void 0;return{isAuthenticated:m,user:v,tokens:{hasAccessToken:!!i,hasRefreshToken:!!l,storage:g,accessTokenPreview:b},lastActivity:Date.now(),source:u}}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(a=>a.type==="login").length,successfulLogins:e.filter(a=>a.type==="login"&&a.success).length,failedLogins:e.filter(a=>a.type==="login"&&!a.success).length,tokenRefreshes:e.filter(a=>a.type==="token-refresh").length,unauthorizedResponses:e.filter(a=>a.type==="api-unauthorized").length},timestamp:Date.now()}}clearAuthData(){this.authEvents=[],this.authHeaderHistory=[],this.authEventIdCounter=0}trackLayoutLoad(e,a,r,i="api"){if(!this.config.enabled)return;const l=Date.now();this.currentLayout={layoutPath:e,templateId:a,layoutJson:this.sanitizeObject(r),loadedAt:l,version:r.version,layoutName:r.layout_name,source:i};const u={id:`layout-${++this.layoutIdCounter}`,layoutPath:e,templateId:a,loadedAt:l,source:i,version:r.version};this.layoutHistory.push(u),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 a=`exec_${++this.executionIdCounter}_${Date.now()}`,r={handlerName:e,executionId:a,startTime:Date.now(),stateChanges:[],dataSourceChanges:[],alerts:[]};if(this.executionDetails.set(a,r),this.executionDetails.size>this.maxExecutionDetails){const i=Array.from(this.executionDetails.keys());i.slice(0,i.length-this.maxExecutionDetails).forEach(u=>this.executionDetails.delete(u))}return a}endHandlerExecution(e,a,r,i){if(!this.config.enabled||!e)return;const l=this.executionDetails.get(e);if(!l)return;l.endTime=Date.now(),l.duration=l.endTime-l.startTime,l.exitReason=a,l.exitLocation=r,l.exitDescription=i;const u=this.changeExpectations.get(e);u&&(l.expectedChanges=u,this.checkExpectations(e,l,u),this.changeExpectations.delete(e)),a==="normal"&&l.stateChanges.length===0&&l.dataSourceChanges.length===0&&this.addChangeAlert(e,{type:"no-state-change",severity:"warning",message:`핸들러 "${l.handlerName}"이(가) 상태 변경 없이 완료됨`,description:"핸들러가 성공적으로 완료되었지만 상태나 데이터소스 변경이 없습니다. 의도한 동작인지 확인하세요.",handlerName:l.handlerName,suggestion:'핸들러 내부 조건문을 확인하거나 DevTools의 "변경감지" 탭에서 exitLocation을 확인하세요.',docLink:"troubleshooting-state.md"}),(a==="early-return-condition"||a==="early-return-validation")&&this.addChangeAlert(e,{type:"early-return-detected",severity:"info",message:`핸들러 "${l.handlerName}"이(가) early return으로 종료됨`,description:i||`종료 위치: ${r||"알 수 없음"}`,handlerName:l.handlerName,suggestion:a==="early-return-validation"?"검증 실패로 인한 early return입니다. 입력 데이터를 확인하세요.":"조건부 early return입니다. 조건문의 평가 결과를 확인하세요."})}recordExitReason(e,a,r,i){if(!this.config.enabled||!e)return;const l=this.executionDetails.get(e);l&&(l.exitReason=a,l.exitLocation=r,l.exitDescription=i)}recordStateChange(e,a,r,i,l){if(!this.config.enabled)return;const u={id:`sc_${++this.stateChangeIdCounter}`,path:a,changeType:r,oldValue:this.safeClone(i),newValue:this.safeClone(l),timestamp:Date.now(),comparison:this.compareValues(i,l),executionId:e};if(this.stateChangeHistory.push(u),e){const d=this.executionDetails.get(e);d&&d.stateChanges.push(u)}this.stateChangeHistory.length>this.maxStateChangeHistory&&this.stateChangeHistory.splice(0,this.stateChangeHistory.length-this.maxStateChangeHistory),u.comparison.isDeepEqual&&typeof i=="object"&&i!==null&&this.addChangeAlert(e||"",{type:"object-reference-same",severity:"warning",message:`상태 "${a}"가 변경되었으나 값이 동일함`,description:"객체 참조가 동일하거나 깊은 비교 결과 변경이 없습니다. 변경 감지가 실패할 수 있습니다.",handlerName:e&&this.executionDetails.get(e)?.handlerName||"unknown",statePath:a,suggestion:"불변성을 유지하여 새 객체를 생성하세요. 예: { ...oldObject, newField: value }",docLink:"troubleshooting-state.md#object-mutation"})}recordDataSourceChange(e,a,r,i,l){if(!this.config.enabled)return;const u={dataSourceId:a,changeType:r,timestamp:Date.now(),previousStatus:i,newStatus:l,executionId:e};if(this.dataSourceChangeHistory.push(u),e){const d=this.executionDetails.get(e);d&&d.dataSourceChanges.push(u)}this.dataSourceChangeHistory.length>this.maxStateChangeHistory&&this.dataSourceChangeHistory.splice(0,this.dataSourceChangeHistory.length-this.maxStateChangeHistory)}expectChange(e,a,r){if(!this.config.enabled||!e)return;const i=this.executionDetails.get(e);if(!i)return;const l={expectedStatePaths:a,expectedDataSources:r,setAt:Date.now(),source:i.handlerName};this.changeExpectations.set(e,l)}checkExpectations(e,a,r){const i=new Set(a.stateChanges.map(u=>u.path)),l=new Set(a.dataSourceChanges.map(u=>u.dataSourceId));for(const u of r.expectedStatePaths)i.has(u)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 상태 변경 "${u}"가 발생하지 않음`,description:`핸들러 "${a.handlerName}"이(가) "${u}" 변경을 예고했지만 실제로 변경되지 않았습니다.`,handlerName:a.handlerName,statePath:u,suggestion:"핸들러 내부 로직을 확인하세요. early return이나 조건부 분기로 인해 변경이 생략되었을 수 있습니다.",docLink:"troubleshooting-state.md"});for(const u of r.expectedDataSources)l.has(u)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 데이터소스 갱신 "${u}"가 발생하지 않음`,description:`핸들러 "${a.handlerName}"이(가) "${u}" 갱신을 예고했지만 실제로 갱신되지 않았습니다.`,handlerName:a.handlerName,dataSourceId:u,suggestion:"refetchDataSource 호출이 실행되었는지 확인하세요.",docLink:"data-sources.md"})}addChangeAlert(e,a){const r={...a,id:`alert_${++this.alertIdCounter}`,timestamp:Date.now()};if(this.changeAlerts.push(r),e){const i=this.executionDetails.get(e);i&&i.alerts.push(r)}this.changeAlerts.length>this.maxChangeAlerts&&this.changeAlerts.splice(0,this.changeAlerts.length-this.maxChangeAlerts)}compareValues(e,a){const r=this.getValueType(e),i=this.getValueType(a),l=r!==i;let u=!1,d;return!l&&(r==="object"||r==="array")?(u=this.deepEqual(e,a),!u&&r==="object"&&(d=this.getChangedKeys(e,a))):u=e===a,{typeChanged:l,oldType:r,newType:i,isDeepEqual:u,changedKeys:d}}getValueType(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}deepEqual(e,a){if(e===a)return!0;if(typeof e!=typeof a)return!1;if(e===null||a===null||typeof e!="object")return e===a;if(Array.isArray(e)!==Array.isArray(a))return!1;const r=Object.keys(e),i=Object.keys(a);if(r.length!==i.length)return!1;for(const l of r)if(!i.includes(l)||!this.deepEqual(e[l],a[l]))return!1;return!0}getChangedKeys(e,a){const r=[],i=new Set([...Object.keys(e),...Object.keys(a)]);for(const l of i)this.deepEqual(e[l],a[l])||r.push(l);return r}getChangeDetectionInfo(){const e=Array.from(this.executionDetails.values()),a={totalExecutions:e.length,executionsWithStateChange:e.filter(r=>r.stateChanges.length>0).length,executionsWithoutStateChange:e.filter(r=>r.stateChanges.length===0&&r.exitReason==="normal").length,earlyReturnCount:e.filter(r=>r.exitReason==="early-return-condition"||r.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:a,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 a of this.changeAlerts)e[a.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,a){let r=[...this.changeAlerts];return a&&(r=r.filter(i=>i.severity===a)),r.slice(-e)}getHandlerExecutions(e,a=10){return Array.from(this.executionDetails.values()).filter(i=>i.handlerName===e).slice(-a)}findExecutionInStack(e){return this.sequenceExecutionStack.find(a=>a.sequenceId===e)}startSequenceExecution(e){if(!this.config.enabled)return"";const a=`seq_${++this.sequenceIdCounter}_${Date.now()}`,r={sequenceId:a,startTime:Date.now(),totalDuration:0,trigger:e,actions:[],status:"running"};return this.sequenceExecutionStack.push(r),a}captureSequenceActionBefore(e,a,r,i,l){if(!this.config.enabled)return;const u=this.findExecutionInStack(e);if(!u)return;const d={index:a,handler:r,params:this.safeClone(i),stateBeforeAction:{_global:this.safeClone(l._global),_local:this.safeClone(l._local),_isolated:l._isolated?this.safeClone(l._isolated):void 0},stateAfterAction:{_global:{},_local:{}},duration:0,status:"success"};u.actions.push(d)}captureSequenceActionAfter(e,a,r,i,l,u){if(!this.config.enabled)return;const d=this.findExecutionInStack(e);if(!d)return;const f=d.actions.find(m=>m.index===a);if(!f)return;f.stateAfterAction={_global:this.safeClone(r._global),_local:this.safeClone(r._local),_isolated:r._isolated?this.safeClone(r._isolated):void 0},f.duration=i,f.result=this.safeClone(l),f.stateDiff={global:this.computeStateDiff(f.stateBeforeAction._global,f.stateAfterAction._global),local:this.computeStateDiff(f.stateBeforeAction._local,f.stateAfterAction._local)},f.stateBeforeAction._isolated&&f.stateAfterAction._isolated&&(f.stateDiff.isolated=this.computeStateDiff(f.stateBeforeAction._isolated,f.stateAfterAction._isolated));const g=window.__g7PendingLocalState;g&&(f.pendingState=this.safeClone(g)),u&&(f.status="error",f.error={name:u.name,message:u.message,stack:u.stack})}endSequenceExecution(e,a){if(!this.config.enabled)return;const r=this.sequenceExecutionStack.findIndex(l=>l.sequenceId===e);if(r===-1)return;const i=this.sequenceExecutionStack[r];if(i.endTime=Date.now(),i.totalDuration=i.endTime-i.startTime,a){i.status="error",i.error={name:a.name,message:a.message,stack:a.stack};const l=i.actions.find(u=>u.status==="error");l&&(i.failedAtIndex=l.index)}else i.status="success";this.sequenceExecutions.push(i),this.sequenceExecutions.length>this.maxSequenceExecutions&&this.sequenceExecutions.shift(),this.sequenceExecutionStack.splice(r,1)}computeStateDiff(e,a){const r=[],i=[],l=[],u=new Set(Object.keys(e)),d=new Set(Object.keys(a));for(const f of d)u.has(f)||r.push(f);for(const f of u)d.has(f)||i.push(f);for(const f of u)if(d.has(f)){const g=e[f],m=a[f];JSON.stringify(g)!==JSON.stringify(m)&&l.push({path:f,oldValue:g,newValue:m})}return{added:r,removed:i,changed:l}}getSequenceTrackingInfo(){const e=this.getSequenceStats(),a=this.sequenceExecutionStack.length>0?this.sequenceExecutionStack[this.sequenceExecutionStack.length-1]:void 0;return{executions:[...this.sequenceExecutions],currentExecution:a,stats:e}}getSequenceStats(){const e=this.sequenceExecutions,a=e.length,r=e.filter(g=>g.status==="success").length,i=e.filter(g=>g.status==="error").length,l=e.reduce((g,m)=>g+m.actions.length,0),u=a>0?e.reduce((g,m)=>g+m.totalDuration,0)/a:0,d={};for(const g of e)for(const m of g.actions)d[m.handler]=(d[m.handler]||0)+1;const f=Object.entries(d).sort(([,g],[,m])=>m-g).slice(0,5).map(([g,m])=>({handler:g,count:m}));return{totalExecutions:a,successCount:r,errorCount:i,totalActions:l,avgDuration:u,topHandlers:f}}clearSequenceData(){this.sequenceExecutions=[],this.sequenceExecutionStack=[],this.sequenceIdCounter=0}getSequenceExecution(e){const a=this.findExecutionInStack(e);return a||this.sequenceExecutions.find(r=>r.sequenceId===e)}getRecentSequences(e=10){return this.sequenceExecutions.slice(-e)}registerStateCaptureForHandler(e,a,r){if(!this.config.enabled)return;const i=new Map,l=Date.now();for(const u of a)i.set(u,{value:this.safeClone(r[u]),capturedAt:l});this.stateCaptureRegistry.set(e,i)}detectStaleClosure(e,a,r,i,l){if(!this.config.enabled)return[];const u=this.stateCaptureRegistry.get(e);if(!u)return[];const d=Date.now(),f=[];for(const[g,m]of u){const b=this.getValueByPath(r,g),v=d-m.capturedAt;if(!this.isDeepEqual(m.value,b)&&v>0){const S=this.createStaleClosureWarning(i,a,g,m.value,m.capturedAt,b,d,v,l);f.push(S),this.addStaleClosureWarning(S)}}return this.stateCaptureRegistry.delete(e),f}trackStaleClosureWarning(e){if(!this.config.enabled)return;const a=Date.now(),r=this.createStaleClosureWarning(e.type,e.location,e.capturedPath,e.capturedValue,e.capturedAt,e.currentValue,a,a-e.capturedAt,e.actionId,e.stackTrace);this.addStaleClosureWarning(r)}createStaleClosureWarning(e,a,r,i,l,u,d,f,g,m){const b=this.getStaleClosureSeverity(e,f),{description:v,suggestion:S,docLink:E}=this.getStaleClosureMessages(e,r,f);return{id:`stale_${++this.staleClosureIdCounter}_${Date.now()}`,timestamp:Date.now(),type:e,location:a,capturedState:{path:r,capturedValue:this.safeClone(i),capturedAt:l},currentState:{path:r,currentValue:this.safeClone(u),retrievedAt:d},timeDiff:f,severity:b,description:v,suggestion:S,docLink:E,actionId:g,stackTrace:m}}getStaleClosureSeverity(e,a){if(a>5e3)return"error";if(a>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,a,r){const i=r<1e3?`${r}ms`:`${(r/1e3).toFixed(1)}s`;switch(e){case"async-state-capture":return{description:`await 후 ${i} 경과 시점에 '${a}' 상태가 변경됨. 캡처된 상태 대신 최신 상태를 사용해야 함`,suggestion:"await 이후에는 G7Core.state.get()으로 최신 상태를 다시 조회하거나, useRef + getter 패턴을 사용하세요",docLink:"troubleshooting-state-closure.md"};case"callback-state-capture":return{description:`콜백에서 ${i} 전에 캡처된 '${a}' 상태를 사용 중. 최신 상태와 다름`,suggestion:"콜백에서 상태를 참조할 때는 stateRef.current 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};case"timeout-state-capture":return{description:`setTimeout/setInterval 콜백에서 '${a}' 상태가 ${i} 전 값 사용 중`,suggestion:"타이머 콜백 내에서는 G7Core.state.get()으로 최신 상태를 조회하세요",docLink:"troubleshooting-state-closure.md"};case"sequence-state-mismatch":return{description:`sequence 내 '${a}' 상태가 이전 액션 결과와 불일치. context.state 대신 캡처된 값 사용 의심`,suggestion:"sequence 내에서는 context.state 또는 $prev를 사용하여 최신 상태를 참조하세요",docLink:"troubleshooting-state-setstate.md"};case"event-handler-stale":return{description:`이벤트 핸들러에서 ${i} 전에 바인딩된 '${a}' 상태 사용 중`,suggestion:"이벤트 핸들러에서 상태를 참조할 때는 useRef 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};default:return{description:`'${a}' 상태에서 stale closure 감지됨 (${i} 경과)`,suggestion:"상태 참조 시 최신 값을 사용하는지 확인하세요"}}}addStaleClosureWarning(e){this.staleClosureWarnings.push(e),this.staleClosureWarnings.length>this.maxStaleClosureWarnings&&this.staleClosureWarnings.shift()}getValueByPath(e,a){const r=a.split(".");let i=e;for(const l of r){if(i==null)return;i=i[l]}return i}isDeepEqual(e,a){if(e===a)return!0;if(e===null||a===null)return e===a;if(typeof e!=typeof a)return!1;if(typeof e!="object")return e===a;try{return JSON.stringify(e)===JSON.stringify(a)}catch{return!1}}getStaleClosureTrackingInfo(){const e=this.getStaleClosureStats();return{warnings:[...this.staleClosureWarnings],stats:e,timestamp:Date.now()}}getStaleClosureStats(){const e=this.staleClosureWarnings,a={"async-state-capture":0,"callback-state-capture":0,"timeout-state-capture":0,"sequence-state-mismatch":0,"event-handler-stale":0};for(const f of e)a[f.type]++;const r={info:0,warning:0,error:0};for(const f of e)r[f.severity]++;const i={};for(const f of e)i[f.location]=(i[f.location]||0)+1;const l=Object.entries(i).sort(([,f],[,g])=>g-f).slice(0,5).map(([f,g])=>({location:f,count:g})),u={};for(const f of e)u[f.capturedState.path]=(u[f.capturedState.path]||0)+1;const d=Object.entries(u).sort(([,f],[,g])=>g-f).slice(0,5).map(([f,g])=>({path:f,count:g}));return{totalWarnings:e.length,warningsByType:a,warningsBySeverity:r,topLocations:l,topAffectedPaths:d}}clearStaleClosureData(){this.staleClosureWarnings=[],this.staleClosureIdCounter=0,this.stateCaptureRegistry.clear()}getRecentStaleClosureWarnings(e=10,a){let r=[...this.staleClosureWarnings];return a&&(r=r.filter(i=>i.severity===a)),r.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(r=>{try{return JSON.parse(JSON.stringify(r))}catch{return"[Unserializable]"}});const a={};for(const r of Object.keys(e))try{a[r]=JSON.parse(JSON.stringify(e[r]))}catch{a[r]="[Unserializable]"}return a}}};$(mi,"instance");let Tr=mi;const Bn=ct("LayoutLoader");class ba extends Error{constructor(a,r,i){super(a);$(this,"code");$(this,"details");this.code=r,this.details=i,this.name="LayoutLoaderError"}}class ef{constructor(e){$(this,"componentRegistry");$(this,"currentLayout",null);$(this,"layoutCache",new Map);$(this,"cacheVersion",0);this.componentRegistry=e}setCacheVersion(e){this.cacheVersion!==e&&(Bn.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.layoutCache.clear())}getCacheVersion(){return this.cacheVersion}async loadLayout(e,a){const r=`${e}:${a}`;if(this.layoutCache.has(r)){Bn.log("Loading layout from cache:",a);const l=await this.layoutCache.get(r),u=JSON.parse(JSON.stringify(l));return this.currentLayout=u,Tr.getInstance().trackLayoutLoad(a,e,u,"cache"),u}const i=this.fetchLayout(e,a);return this.layoutCache.set(r,i),i.catch(()=>{this.layoutCache.get(r)===i&&this.layoutCache.delete(r)}),i}async fetchLayout(e,a,r=!1){try{const i=this.cacheVersion>0?this.cacheVersion:null;let l;if(a.startsWith("__preview__/")){const v=a.replace("__preview__/","");l=La(`/api/layouts/preview/${v}`,"json",i)}else l=La(`/api/layouts/${e}/${a}`,"json",i);Bn.log("Fetching layout from API:",l);const u=$a(),d=r?null:u.getToken(),f={Accept:"application/json"};d&&(f.Authorization=`Bearer ${d}`);const g=await Al(l,{init:{headers:f},label:`layout: ${a}`});let m;try{m=await g.json()}catch{m=null}if(!g.ok){if(g.status===401&&!r&&d){Bn.log("Token invalid, removing and retrying without token"),u.removeToken();try{return await this.fetchLayout(e,a,!0)}catch(S){throw S instanceof ba&&S.details?.status===401?new ba(S.message,S.code,{...S.details,hadToken:!0}):S}}const v=m?.message||m?.error;throw new ba(`Failed to fetch layout: ${g.status} ${g.statusText}`,"FETCH_FAILED",{status:g.status,statusText:g.statusText,url:l,apiMessage:v})}const b=m.data||m;return this.validateLayoutData(b),this.currentLayout=b,Tr.getInstance().trackLayoutLoad(a,e,b,"api"),Bn.log("Layout fetched and cached successfully:",b.layout_name),b}catch(i){const l=`${e}:${a}`;throw this.layoutCache.delete(l),i instanceof ba?i:new ba("Failed to load layout","LOAD_FAILED",{originalError:i})}}prefetchLayout(e,a){return this.loadLayout(e,a)}validateLayoutData(e){if(!e.version)throw new ba("Layout data missing required field: version","VALIDATION_FAILED",{field:"version"});if(!e.layout_name)throw new ba("Layout data missing required field: layout_name","VALIDATION_FAILED",{field:"layout_name"});if(!Array.isArray(e.components))throw new ba('Layout data field "components" must be an array',"VALIDATION_FAILED",{field:"components",value:e.components});Bn.log("Layout data validation passed")}renderLayout(e,a){try{const r=a||this.currentLayout;if(!r)throw new ba("No layout data to render","NO_LAYOUT_DATA");Bn.log("Rendering layout:",r.layout_name),e.innerHTML="",this.renderComponents(e,r.components),Bn.log("Layout rendered successfully")}catch(r){Bn.error("Render error:",r),this.renderErrorState(e,r)}}renderComponents(e,a){for(const r of a){const i=this.renderComponent(r);i&&e.appendChild(i)}}renderComponent(e){try{if(!this.componentRegistry.getComponent(e.type))return Bn.warn(`Component not found: ${e.type}`),this.createPlaceholderElement(e.type);const r=document.createElement("div");return r.setAttribute("data-component",e.type),e.props&&Object.entries(e.props).forEach(([i,l])=>{r.setAttribute(`data-prop-${i}`,JSON.stringify(l))}),e.children&&e.children.length>0?this.renderComponents(r,e.children):e.text&&(r.textContent=e.text),r}catch(a){return Bn.error(`Error rendering component ${e.type}:`,a),this.createErrorElement(e.type,a)}}createPlaceholderElement(e){const a=document.createElement("div");return a.className="component-placeholder",a.setAttribute("data-component-type",e),a.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>
|
||
`,a}createErrorElement(e,a){const r=document.createElement("div");return r.className="component-error",r.setAttribute("data-component-type",e),r.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;">${a?.message||"Unknown error"}</p>
|
||
</div>
|
||
`,r}renderErrorState(e,a){const r=a instanceof Error?a.message:String(a),i=a instanceof ba?a.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;
|
||
">${r}</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>
|
||
`,Bn.error("Error state rendered:",i,r)}getCurrentLayout(){return this.currentLayout}clear(){this.currentLayout=null,this.layoutCache.clear(),Bn.log("Layout data and cache cleared")}}const S_=ct("TranslationContext"),tf=N.createContext(null),cc=({children:o,translationEngine:e,translationContext:a})=>{const r=N.useMemo(()=>(l,u)=>{if(u){const d="|"+Object.entries(u).map(([f,g])=>`${f}=${g}`).join("|");return e.translate(l,a,d)}return e.translate(l,a)},[e,a]),i=N.useMemo(()=>({translationEngine:e,translationContext:a,t:r}),[e,a,r]);return ut.jsx(tf.Provider,{value:i,children:o})},Fm=()=>{const o=N.useContext(tf);return o||(S_.warn("TranslationProvider 외부에서 호출되었습니다. 키를 그대로 반환합니다."),{t:e=>e,translationEngine:null,translationContext:null})},Rr=ct("SlotContext"),w_={registerToSlot:()=>{Rr.warn("SlotContext not available: registerToSlot called outside SlotProvider")},unregisterFromSlot:()=>{Rr.warn("SlotContext not available: unregisterFromSlot called outside SlotProvider")},getSlotComponents:()=>[],subscribeToSlot:()=>()=>{},clearAllSlots:()=>{},isEnabled:!1},C_=N.createContext(w_),nf=({children:o})=>{const e=N.useRef(new Map),a=N.useRef(new Map),r=N.useCallback(m=>{const b=a.current.get(m);b&&b.forEach(v=>{try{v()}catch(S){Rr.error(`Slot subscriber error (slotId: ${m}):`,S)}})},[]),i=N.useCallback((m,b,v)=>{if(!m||!b){Rr.warn("registerToSlot: slotId and componentId are required");return}e.current.has(m)||e.current.set(m,new Map);const S=e.current.get(m),E=S.get(b);E&&E.registrationKey===v.registrationKey||(S.set(b,v),Rr.log(`Component registered to slot: ${b} -> ${m} (order: ${v.order})`),r(m))},[r]),l=N.useCallback((m,b)=>{const v=e.current.get(m);v&&v.has(b)&&(v.delete(b),Rr.log(`Component unregistered from slot: ${b} <- ${m}`),v.size===0&&e.current.delete(m),r(m))},[r]),u=N.useCallback(m=>{const b=e.current.get(m);return b?Array.from(b.values()).sort((v,S)=>v.order-S.order):[]},[]),d=N.useCallback((m,b)=>{a.current.has(m)||a.current.set(m,new Set);const v=a.current.get(m);return v.add(b),()=>{v.delete(b),v.size===0&&a.current.delete(m)}},[]),f=N.useCallback(()=>{e.current.forEach((m,b)=>{r(b)}),e.current.clear(),a.current.clear(),Rr.log("All slots cleared")},[r]),g=N.useMemo(()=>({registerToSlot:i,unregisterFromSlot:l,getSlotComponents:u,subscribeToSlot:d,clearAllSlots:f,isEnabled:!0}),[i,l,u,d,f]);return N.useLayoutEffect(()=>{typeof window<"u"&&(window.__slotContextValue=g,Rr.log("SlotContext exposed to window.__slotContextValue"))},[g]),ut.jsx(C_.Provider,{value:g,children:o})};class af{constructor(){this.notificationCreatedEvent=".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"}listenForWhisper(e,a){return this.listen(".client-"+e,a)}notification(e){return this.listen(this.notificationCreatedEvent,e)}stopListeningForNotification(e){return this.stopListening(this.notificationCreatedEvent,e)}stopListeningForWhisper(e,a){return this.stopListening(".client-"+e,a)}}class Km{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 E_(o){try{return Reflect.construct(String,[],o),!0}catch{return!1}}class rf extends af{constructor(e,a,r){super(),this.name=a,this.pusher=e,this.options=r,this.eventFormatter=new Km(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(e,a){return this.on(this.eventFormatter.format(e),a),this}listenToAll(e){return this.subscription.bind_global((a,r)=>{if(a.startsWith("pusher:"))return;let i=String(this.options.namespace??"").replace(/\./g,"\\"),l=a.startsWith(i)?a.substring(i.length+1):"."+a;e(l,r)}),this}stopListening(e,a){return a?this.subscription.unbind(this.eventFormatter.format(e),a):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",a=>{e(a)}),this}on(e,a){return this.subscription.bind(e,a),this}}class Wm extends rf{whisper(e,a){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,a),this}}class __ extends rf{whisper(e,a){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,a),this}}class A_ extends Wm{here(e){return this.on("pusher:subscription_succeeded",a=>{e(Object.keys(a.members).map(r=>a.members[r]))}),this}joining(e){return this.on("pusher:member_added",a=>{e(a.info)}),this}whisper(e,a){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,a),this}leaving(e){return this.on("pusher:member_removed",a=>{e(a.info)}),this}}class Ym extends af{constructor(e,a,r){super(),this.events={},this.listeners={},this.name=a,this.socket=e,this.options=r,this.eventFormatter=new Km(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,a){return this.on(this.eventFormatter.format(e),a),this}stopListening(e,a){return this.unbindEvent(this.eventFormatter.format(e),a),this}subscribed(e){return this.on("connect",a=>{e(a)}),this}error(e){return this}on(e,a){return this.listeners[e]=this.listeners[e]||[],this.events[e]||(this.events[e]=(r,i)=>{this.name===r&&this.listeners[e]&&this.listeners[e].forEach(l=>l(i))},this.socket.on(e,this.events[e])),this.listeners[e].push(a),this}unbind(){Object.keys(this.events).forEach(e=>{this.unbindEvent(e)})}unbindEvent(e,a){this.listeners[e]=this.listeners[e]||[],a&&(this.listeners[e]=this.listeners[e].filter(r=>r!==a)),(!a||this.listeners[e].length===0)&&(this.events[e]&&(this.socket.removeListener(e,this.events[e]),delete this.events[e]),delete this.listeners[e])}}class Xm extends Ym{whisper(e,a){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:a}),this}}class x_ extends Xm{here(e){return this.on("presence:subscribed",a=>{e(a.map(r=>r.user_info))}),this}joining(e){return this.on("presence:joining",a=>e(a.user_info)),this}whisper(e,a){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:a}),this}leaving(e){return this.on("presence:leaving",a=>e(a.user_info)),this}}class uc extends af{subscribe(){}unsubscribe(){}listen(e,a){return this}listenToAll(e){return this}stopListening(e,a){return this}subscribed(e){return this}error(e){return this}on(e,a){return this}}class Jm extends uc{whisper(e,a){return this}}class T_ extends uc{whisper(e,a){return this}}class R_ extends Jm{here(e){return this}joining(e){return this}whisper(e,a){return this}leaving(e){return this}}const Qm=class DS{constructor(e){this.setOptions(e),this.connect()}setOptions(e){this.options={...DS._defaultOptions,...e,broadcaster:e.broadcaster};let a=this.csrfToken();a&&(this.options.auth.headers["X-CSRF-TOKEN"]=a,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=a),a=this.options.bearerToken,a&&(this.options.auth.headers.Authorization="Bearer "+a,this.options.userAuthentication.headers.Authorization="Bearer "+a)}csrfToken(){var e,a;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"?((a=document.querySelector('meta[name="csrf-token"]'))==null?void 0:a.getAttribute("content"))??null:null}};Qm._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let sf=Qm;class dc extends sf{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,a,r){return this.channel(e).listen(a,r)}channel(e){return this.channels[e]||(this.channels[e]=new rf(this.pusher,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new Wm(this.pusher,"private-"+e,this.options)),this.channels["private-"+e]}encryptedPrivateChannel(e){return this.channels["private-encrypted-"+e]||(this.channels["private-encrypted-"+e]=new __(this.pusher,"private-encrypted-"+e,this.options)),this.channels["private-encrypted-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new A_(this.pusher,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"private-encrypted-"+e,"presence-"+e].forEach(a=>{this.leaveChannel(a)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.pusher.connection.socket_id}connectionStatus(){const e=this.pusher.connection.state;switch(e){case"connected":case"connecting":return e;case"failed":case"unavailable":return"failed";default:return"disconnected"}}onConnectionChange(e){const a=()=>{e(this.connectionStatus())},r=["state_change","connected","disconnected"];return r.forEach(i=>{this.pusher.connection.bind(i,a)}),()=>{r.forEach(i=>{this.pusher.connection.unbind(i,a)})}}disconnect(){this.pusher.disconnect()}}class k_ extends sf{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(a=>{a.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,a,r){return this.channel(e).listen(a,r)}channel(e){return this.channels[e]||(this.channels[e]=new Ym(this.socket,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new Xm(this.socket,"private-"+e,this.options)),this.channels["private-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new x_(this.socket,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"presence-"+e].forEach(a=>{this.leaveChannel(a)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.socket.id}connectionStatus(){return this.socket.connected?"connected":this.socket.io._reconnecting?"reconnecting":this.socket.id!==void 0?"disconnected":"connecting"}onConnectionChange(e){const a=()=>{e(this.connectionStatus())},r=["connect","disconnect","connect_error","reconnect_attempt","reconnect","reconnect_error","reconnect_failed"];return r.forEach(i=>{this.socket.on(i,a)}),()=>{r.forEach(i=>{this.socket.off(i,a)})}}disconnect(){this.socket.disconnect()}}class Zm extends sf{constructor(){super(...arguments),this.channels={}}connect(){}listen(e,a,r){return new uc}channel(e){return new uc}privateChannel(e){return new Jm}encryptedPrivateChannel(e){return new T_}presenceChannel(e){return new R_}leave(e){}leaveChannel(e){}socketId(){return"fake-socket-id"}connectionStatus(){return"connected"}onConnectionChange(e){return()=>{}}disconnect(){}}class D_{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 dc({...this.options,cluster:""});else if(this.options.broadcaster==="pusher")this.connector=new dc(this.options);else if(this.options.broadcaster==="ably")this.connector=new dc({...this.options,cluster:"",broadcaster:"pusher"});else if(this.options.broadcaster==="socket.io")this.connector=new k_(this.options);else if(this.options.broadcaster==="null")this.connector=new Zm(this.options);else if(typeof this.options.broadcaster=="function"&&E_(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,a,r){return this.connector.listen(e,a,r)}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 dc||e instanceof Zm}socketId(){return this.connector.socketId()}connectionStatus(){return this.connector.connectionStatus()}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,a)=>{this.socketId()&&e.headers.set("X-Socket-ID",this.socketId()),a()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(e=>(this.socketId()&&(e.headers["X-Socket-Id"]=this.socketId()),e))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((e,a,r)=>{this.socketId()&&r.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",e=>{e.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}var of={exports:{}};var ey;function O_(){return ey||(ey=1,(function(o,e){(function(r,i){o.exports=i()})(self,()=>(()=>{var a={594(u,d){var f=this&&this.__extends||(function(){var M=function(R,D){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(U,j){U.__proto__=j}||function(U,j){for(var P in j)j.hasOwnProperty(P)&&(U[P]=j[P])},M(R,D)};return function(R,D){M(R,D);function U(){this.constructor=R}R.prototype=D===null?Object.create(D):(U.prototype=D.prototype,new U)}})();Object.defineProperty(d,"__esModule",{value:!0});var g=256,m=(function(){function M(R){R===void 0&&(R="="),this._paddingCharacter=R}return M.prototype.encodedLength=function(R){return this._paddingCharacter?(R+2)/3*4|0:(R*8+5)/6|0},M.prototype.encode=function(R){for(var D="",U=0;U<R.length-2;U+=3){var j=R[U]<<16|R[U+1]<<8|R[U+2];D+=this._encodeByte(j>>>18&63),D+=this._encodeByte(j>>>12&63),D+=this._encodeByte(j>>>6&63),D+=this._encodeByte(j>>>0&63)}var P=R.length-U;if(P>0){var j=R[U]<<16|(P===2?R[U+1]<<8:0);D+=this._encodeByte(j>>>18&63),D+=this._encodeByte(j>>>12&63),P===2?D+=this._encodeByte(j>>>6&63):D+=this._paddingCharacter||"",D+=this._paddingCharacter||""}return D},M.prototype.maxDecodedLength=function(R){return this._paddingCharacter?R/4*3|0:(R*6+7)/8|0},M.prototype.decodedLength=function(R){return this.maxDecodedLength(R.length-this._getPaddingLength(R))},M.prototype.decode=function(R){if(R.length===0)return new Uint8Array(0);for(var D=this._getPaddingLength(R),U=R.length-D,j=new Uint8Array(this.maxDecodedLength(U)),P=0,X=0,ge=0,Ee=0,Ce=0,$e=0,Pe=0;X<U-4;X+=4)Ee=this._decodeChar(R.charCodeAt(X+0)),Ce=this._decodeChar(R.charCodeAt(X+1)),$e=this._decodeChar(R.charCodeAt(X+2)),Pe=this._decodeChar(R.charCodeAt(X+3)),j[P++]=Ee<<2|Ce>>>4,j[P++]=Ce<<4|$e>>>2,j[P++]=$e<<6|Pe,ge|=Ee&g,ge|=Ce&g,ge|=$e&g,ge|=Pe&g;if(X<U-1&&(Ee=this._decodeChar(R.charCodeAt(X)),Ce=this._decodeChar(R.charCodeAt(X+1)),j[P++]=Ee<<2|Ce>>>4,ge|=Ee&g,ge|=Ce&g),X<U-2&&($e=this._decodeChar(R.charCodeAt(X+2)),j[P++]=Ce<<4|$e>>>2,ge|=$e&g),X<U-3&&(Pe=this._decodeChar(R.charCodeAt(X+3)),j[P++]=$e<<6|Pe,ge|=Pe&g),ge!==0)throw new Error("Base64Coder: incorrect characters for decoding");return j},M.prototype._encodeByte=function(R){var D=R;return D+=65,D+=25-R>>>8&6,D+=51-R>>>8&-75,D+=61-R>>>8&-15,D+=62-R>>>8&3,String.fromCharCode(D)},M.prototype._decodeChar=function(R){var D=g;return D+=(42-R&R-44)>>>8&-g+R-43+62,D+=(46-R&R-48)>>>8&-g+R-47+63,D+=(47-R&R-58)>>>8&-g+R-48+52,D+=(64-R&R-91)>>>8&-g+R-65+0,D+=(96-R&R-123)>>>8&-g+R-97+26,D},M.prototype._getPaddingLength=function(R){var D=0;if(this._paddingCharacter){for(var U=R.length-1;U>=0&&R[U]===this._paddingCharacter;U--)D++;if(R.length<4||D>2)throw new Error("Base64Coder: incorrect padding")}return D},M})();d.Coder=m;var b=new m;function v(M){return b.encode(M)}d.encode=v;function S(M){return b.decode(M)}d.decode=S;var E=(function(M){f(R,M);function R(){return M!==null&&M.apply(this,arguments)||this}return R.prototype._encodeByte=function(D){var U=D;return U+=65,U+=25-D>>>8&6,U+=51-D>>>8&-75,U+=61-D>>>8&-13,U+=62-D>>>8&49,String.fromCharCode(U)},R.prototype._decodeChar=function(D){var U=g;return U+=(44-D&D-46)>>>8&-g+D-45+62,U+=(94-D&D-96)>>>8&-g+D-95+63,U+=(47-D&D-58)>>>8&-g+D-48+52,U+=(64-D&D-91)>>>8&-g+D-65+0,U+=(96-D&D-123)>>>8&-g+D-97+26,U},R})(m);d.URLSafeCoder=E;var A=new E;function T(M){return A.encode(M)}d.encodeURLSafe=T;function L(M){return A.decode(M)}d.decodeURLSafe=L,d.encodedLength=function(M){return b.encodedLength(M)},d.maxDecodedLength=function(M){return b.maxDecodedLength(M)},d.decodedLength=function(M){return b.decodedLength(M)}},978(u,d){var f="utf8: invalid source encoding";function g(m){for(var b=[],v=0;v<m.length;v++){var S=m[v];if(S&128){var E=void 0;if(S<224){if(v>=m.length)throw new Error(f);var A=m[++v];if((A&192)!==128)throw new Error(f);S=(S&31)<<6|A&63,E=128}else if(S<240){if(v>=m.length-1)throw new Error(f);var A=m[++v],T=m[++v];if((A&192)!==128||(T&192)!==128)throw new Error(f);S=(S&15)<<12|(A&63)<<6|T&63,E=2048}else if(S<248){if(v>=m.length-2)throw new Error(f);var A=m[++v],T=m[++v],L=m[++v];if((A&192)!==128||(T&192)!==128||(L&192)!==128)throw new Error(f);S=(S&15)<<18|(A&63)<<12|(T&63)<<6|L&63,E=65536}else throw new Error(f);if(S<E||S>=55296&&S<=57343)throw new Error(f);if(S>=65536){if(S>1114111)throw new Error(f);S-=65536,b.push(String.fromCharCode(55296|S>>10)),S=56320|S&1023}}b.push(String.fromCharCode(S))}return b.join("")}d.D4=g},721(u,d,f){u.exports=f(207).default},207(u,d,f){f.d(d,{default:()=>ps});class g{constructor(y,C){this.lastId=0,this.prefix=y,this.name=C}create(y){this.lastId++;var C=this.lastId,O=this.prefix+C,I=this.name+"["+C+"]",ne=!1,pe=function(){ne||(y.apply(null,arguments),ne=!0)};return this[C]=pe,{number:C,id:O,name:I,callback:pe}}remove(y){delete this[y.number]}}var m=new g("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.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:""};const v=b;class S{constructor(y){this.options=y,this.receivers=y.receivers||m,this.loading={}}load(y,C,O){var I=this;if(I.loading[y]&&I.loading[y].length>0)I.loading[y].push(O);else{I.loading[y]=[O];var ne=Be.createScriptRequest(I.getPath(y,C)),pe=I.receivers.create(function(Me){if(I.receivers.remove(pe),I.loading[y]){var Ve=I.loading[y];delete I.loading[y];for(var ot=function(Nt){Nt||ne.cleanup()},pt=0;pt<Ve.length;pt++)Ve[pt](Me,ot)}});ne.send(pe)}}getRoot(y){var C,O=Be.getDocument().location.protocol;return y&&y.useTLS||O==="https:"?C=this.options.cdn_https:C=this.options.cdn_http,C.replace(/\/*$/,"")+"/"+this.options.version}getPath(y,C){return this.getRoot(C)+"/"+y+this.options.suffix+".js"}}var E=new g("_pusher_dependencies","Pusher.DependenciesReceivers"),A=new S({cdn_http:v.cdn_http,cdn_https:v.cdn_https,version:v.VERSION,suffix:v.dependency_suffix,receivers:E});const T={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"}}},M={buildLogSuffix:function(_){const y="See:",C=T.urls[_];if(!C)return"";let O;return C.fullUrl?O=C.fullUrl:C.path&&(O=T.baseUrl+C.path),O?`${y} ${O}`:""}};var R;(function(_){_.UserAuthentication="user-authentication",_.ChannelAuthorization="channel-authorization"})(R||(R={}));class D extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class j extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class X extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class ge extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class Ce extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class $e extends Error{constructor(y,C){super(C),this.status=y,Object.setPrototypeOf(this,new.target.prototype)}}const Xe=function(_,y,C,O,I){const ne=Be.createXHR();ne.open("POST",C.endpoint,!0),ne.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var pe in C.headers)ne.setRequestHeader(pe,C.headers[pe]);if(C.headersProvider!=null){let Me=C.headersProvider();for(var pe in Me)ne.setRequestHeader(pe,Me[pe])}return ne.onreadystatechange=function(){if(ne.readyState===4)if(ne.status===200){let Me,Ve=!1;try{Me=JSON.parse(ne.responseText),Ve=!0}catch{I(new $e(200,`JSON returned from ${O.toString()} endpoint was invalid, yet status code was 200. Data was: ${ne.responseText}`),null)}Ve&&I(null,Me)}else{let Me="";switch(O){case R.UserAuthentication:Me=M.buildLogSuffix("authenticationEndpoint");break;case R.ChannelAuthorization:Me=`Clients must be authorized to join private or presence channels. ${M.buildLogSuffix("authorizationEndpoint")}`;break}I(new $e(ne.status,`Unable to retrieve auth string from ${O.toString()} endpoint - received status: ${ne.status} from ${C.endpoint}. ${Me}`),null)}},ne.send(y),ne};function ht(_){return x(te(_))}var Q=String.fromCharCode,fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye=function(_){var y=_.charCodeAt(0);return y<128?_:y<2048?Q(192|y>>>6)+Q(128|y&63):Q(224|y>>>12&15)+Q(128|y>>>6&63)+Q(128|y&63)},te=function(_){return _.replace(/[^\x00-\x7F]/g,ye)},he=function(_){var y=[0,2,1][_.length%3],C=_.charCodeAt(0)<<16|(_.length>1?_.charCodeAt(1):0)<<8|(_.length>2?_.charCodeAt(2):0),O=[fe.charAt(C>>>18),fe.charAt(C>>>12&63),y>=2?"=":fe.charAt(C>>>6&63),y>=1?"=":fe.charAt(C&63)];return O.join("")},x=window.btoa||function(_){return _.replace(/[\s\S]{1,3}/g,he)};class K{constructor(y,C,O,I){this.clear=C,this.timer=y(()=>{this.timer&&(this.timer=I(this.timer))},O)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const re=K;function de(_){window.clearTimeout(_)}function se(_){window.clearInterval(_)}class me extends re{constructor(y,C){super(setTimeout,de,y,function(O){return C(),null})}}class Ne extends re{constructor(y,C){super(setInterval,se,y,function(O){return C(),O})}}var ve={now(){return Date.now?Date.now():new Date().valueOf()},defer(_){return new me(0,_)},method(_,...y){var C=Array.prototype.slice.call(arguments,1);return function(O){return O[_].apply(O,C.concat(arguments))}}};const He=ve;function Ae(_,...y){for(var C=0;C<y.length;C++){var O=y[C];for(var I in O)O[I]&&O[I].constructor&&O[I].constructor===Object?_[I]=Ae(_[I]||{},O[I]):_[I]=O[I]}return _}function Et(){for(var _=["Pusher"],y=0;y<arguments.length;y++)typeof arguments[y]=="string"?_.push(arguments[y]):_.push(bn(arguments[y]));return _.join(" : ")}function Rt(_,y){var C=Array.prototype.indexOf;if(_===null)return-1;if(C&&_.indexOf===C)return _.indexOf(y);for(var O=0,I=_.length;O<I;O++)if(_[O]===y)return O;return-1}function _t(_,y){for(var C in _)Object.prototype.hasOwnProperty.call(_,C)&&y(_[C],C,_)}function ft(_){var y=[];return _t(_,function(C,O){y.push(O)}),y}function un(_){var y=[];return _t(_,function(C){y.push(C)}),y}function gt(_,y,C){for(var O=0;O<_.length;O++)y.call(C||window,_[O],O,_)}function ja(_,y){for(var C=[],O=0;O<_.length;O++)C.push(y(_[O],O,_,C));return C}function kn(_,y){var C={};return _t(_,function(O,I){C[I]=y(O)}),C}function Dn(_,y){y=y||function(I){return!!I};for(var C=[],O=0;O<_.length;O++)y(_[O],O,_,C)&&C.push(_[O]);return C}function jt(_,y){var C={};return _t(_,function(O,I){(y&&y(O,I,_,C)||O)&&(C[I]=O)}),C}function On(_){var y=[];return _t(_,function(C,O){y.push([O,C])}),y}function ea(_,y){for(var C=0;C<_.length;C++)if(y(_[C],C,_))return!0;return!1}function Ua(_,y){for(var C=0;C<_.length;C++)if(!y(_[C],C,_))return!1;return!0}function Ft(_){return kn(_,function(y){return typeof y=="object"&&(y=bn(y)),encodeURIComponent(ht(y.toString()))})}function Dr(_){var y=jt(_,function(O){return O!==void 0}),C=ja(On(Ft(y)),He.method("join","=")).join("&");return C}function er(_){var y=[],C=[];return(function O(I,ne){var pe,Me,Ve;switch(typeof I){case"object":if(!I)return null;for(pe=0;pe<y.length;pe+=1)if(y[pe]===I)return{$ref:C[pe]};if(y.push(I),C.push(ne),Object.prototype.toString.apply(I)==="[object Array]")for(Ve=[],pe=0;pe<I.length;pe+=1)Ve[pe]=O(I[pe],ne+"["+pe+"]");else{Ve={};for(Me in I)Object.prototype.hasOwnProperty.call(I,Me)&&(Ve[Me]=O(I[Me],ne+"["+JSON.stringify(Me)+"]"))}return Ve;case"number":case"string":case"boolean":return I}})(_,"$")}function bn(_){try{return JSON.stringify(_)}catch{return JSON.stringify(er(_))}}class en{constructor(){this.globalLog=y=>{window.console&&window.console.log&&window.console.log(y)}}debug(...y){this.log(this.globalLog,y)}warn(...y){this.log(this.globalLogWarn,y)}error(...y){this.log(this.globalLogError,y)}globalLogWarn(y){window.console&&window.console.warn?window.console.warn(y):this.globalLog(y)}globalLogError(y){window.console&&window.console.error?window.console.error(y):this.globalLogWarn(y)}log(y,...C){var O=Et.apply(this,arguments);ps.log?ps.log(O):ps.logToConsole&&y.bind(this)(O)}}const et=new en;var ta=function(_,y,C,O,I){(C.headers!==void 0||C.headersProvider!=null)&&et.warn(`To send headers with the ${O.toString()} request, you must use AJAX, rather than JSONP.`);var ne=_.nextAuthCallbackID.toString();_.nextAuthCallbackID++;var pe=_.getDocument(),Me=pe.createElement("script");_.auth_callbacks[ne]=function(pt){I(null,pt)};var Ve="Pusher.auth_callbacks['"+ne+"']";Me.src=C.endpoint+"?callback="+encodeURIComponent(Ve)+"&"+y;var ot=pe.getElementsByTagName("head")[0]||pe.documentElement;ot.insertBefore(Me,ot.firstChild)};const En=ta;class tr{constructor(y){this.src=y}send(y){var C=this,O="Error loading "+C.src;C.script=document.createElement("script"),C.script.id=y.id,C.script.src=C.src,C.script.type="text/javascript",C.script.charset="UTF-8",C.script.addEventListener?(C.script.onerror=function(){y.callback(O)},C.script.onload=function(){y.callback(null)}):C.script.onreadystatechange=function(){(C.script.readyState==="loaded"||C.script.readyState==="complete")&&y.callback(null)},C.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(C.errorScript=document.createElement("script"),C.errorScript.id=y.id+"_error",C.errorScript.text=y.name+"('"+O+"');",C.script.async=C.errorScript.async=!1):C.script.async=!0;var I=document.getElementsByTagName("head")[0];I.insertBefore(C.script,I.firstChild),C.errorScript&&I.insertBefore(C.errorScript,C.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 Ea{constructor(y,C){this.url=y,this.data=C}send(y){if(!this.request){var C=Dr(this.data),O=this.url+"/"+y.number+"?"+C;this.request=Be.createScriptRequest(O),this.request.send(y)}}cleanup(){this.request&&this.request.cleanup()}}var tn=function(_,y){return function(C,O){var I="http"+(y?"s":"")+"://",ne=I+(_.host||_.options.host)+_.options.path,pe=Be.createJSONPRequest(ne,C),Me=Be.ScriptReceivers.create(function(Ve,ot){m.remove(Me),pe.cleanup(),ot&&ot.host&&(_.host=ot.host),O&&O(Ve,ot)});pe.send(Me)}},_n={name:"jsonp",getAgent:tn};const q=_n;function ce(_,y,C){var O=_+(y.useTLS?"s":""),I=y.useTLS?y.hostTLS:y.hostNonTLS;return O+"://"+I+C}function le(_,y){var C="/app/"+_,O="?protocol="+v.PROTOCOL+"&client=js&version="+v.VERSION+(y?"&"+y:"");return C+O}var Z={getInitial:function(_,y){var C=(y.httpPath||"")+le(_,"flash=false");return ce("ws",y,C)}},be={getInitial:function(_,y){var C=(y.httpPath||"/pusher")+le(_);return ce("http",y,C)}},Se={getInitial:function(_,y){return ce("http",y,y.httpPath||"/pusher")},getPath:function(_,y){return le(_)}};class Re{constructor(){this._callbacks={}}get(y){return this._callbacks[xe(y)]}add(y,C,O){var I=xe(y);this._callbacks[I]=this._callbacks[I]||[],this._callbacks[I].push({fn:C,context:O})}remove(y,C,O){if(!y&&!C&&!O){this._callbacks={};return}var I=y?[xe(y)]:ft(this._callbacks);C||O?this.removeCallback(I,C,O):this.removeAllCallbacks(I)}removeCallback(y,C,O){gt(y,function(I){this._callbacks[I]=Dn(this._callbacks[I]||[],function(ne){return C&&C!==ne.fn||O&&O!==ne.context}),this._callbacks[I].length===0&&delete this._callbacks[I]},this)}removeAllCallbacks(y){gt(y,function(C){delete this._callbacks[C]},this)}}function xe(_){return"_"+_}class je{constructor(y){this.callbacks=new Re,this.global_callbacks=[],this.failThrough=y}bind(y,C,O){return this.callbacks.add(y,C,O),this}bind_global(y){return this.global_callbacks.push(y),this}unbind(y,C,O){return this.callbacks.remove(y,C,O),this}unbind_global(y){return y?(this.global_callbacks=Dn(this.global_callbacks||[],C=>C!==y),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(y,C,O){for(var I=0;I<this.global_callbacks.length;I++)this.global_callbacks[I](y,C);var ne=this.callbacks.get(y),pe=[];if(O?pe.push(C,O):C&&pe.push(C),ne&&ne.length>0)for(var I=0;I<ne.length;I++)ne[I].fn.apply(ne[I].context||window,pe);else this.failThrough&&this.failThrough(y,C);return this}}class ze extends je{constructor(y,C,O,I,ne){super(),this.initialize=Be.transportConnectionInitializer,this.hooks=y,this.name=C,this.priority=O,this.key=I,this.options=ne,this.state="new",this.timeline=ne.timeline,this.activityTimeout=ne.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 y=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(y,this.options)}catch(C){return He.defer(()=>{this.onError(C),this.changeState("closed")}),!1}return this.bindListeners(),et.debug("Connecting",{transport:this.name,url:y}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(y){return this.state==="open"?(He.defer(()=>{this.socket&&this.socket.send(y)}),!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(y){this.emit("error",{type:"WebSocketError",error:y}),this.timeline.error(this.buildTimelineMessage({error:y.toString()}))}onClose(y){y?this.changeState("closed",{code:y.code,reason:y.reason,wasClean:y.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(y){this.emit("message",y)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=y=>{this.onError(y)},this.socket.onclose=y=>{this.onClose(y)},this.socket.onmessage=y=>{this.onMessage(y)},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(y,C){this.state=y,this.timeline.info(this.buildTimelineMessage({state:y,params:C})),this.emit(y,C)}buildTimelineMessage(y){return Ae({cid:this.id},y)}}class Le{constructor(y){this.hooks=y}isSupported(y){return this.hooks.isSupported(y)}createConnection(y,C,O,I){return new ze(this.hooks,y,C,O,I)}}var ke=new Le({urls:Z,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!Be.getWebSocketAPI()},isSupported:function(){return!!Be.getWebSocketAPI()},getSocket:function(_){return Be.createWebSocket(_)}}),We={urls:be,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Fe=Ae({getSocket:function(_){return Be.HTTPFactory.createStreamingSocket(_)}},We),_e=Ae({getSocket:function(_){return Be.HTTPFactory.createPollingSocket(_)}},We),Te={isSupported:function(){return Be.isXHRSupported()}},Ue=new Le(Ae({},Fe,Te)),st=new Le(Ae({},_e,Te)),Dt={ws:ke,xhr_streaming:Ue,xhr_polling:st};const nn=Dt;var Kt=new Le({file:"sockjs",urls:Se,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(_,y){return new window.SockJS(_,null,{js_path:A.getPath("sockjs",{useTLS:y.useTLS}),ignore_null_origin:y.ignoreNullOrigin})},beforeOpen:function(_,y){_.send(JSON.stringify({path:y}))}}),qn={isSupported:function(_){var y=Be.isXDRSupported(_.useTLS);return y}},Ln=new Le(Ae({},Fe,qn)),an=new Le(Ae({},_e,qn));nn.xdr_streaming=Ln,nn.xdr_polling=an,nn.sockjs=Kt;const vn=nn;class Or extends je{constructor(){super();var y=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){y.emit("online")},!1),window.addEventListener("offline",function(){y.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var To=new Or;class gf{constructor(y,C,O){this.manager=y,this.transport=C,this.minPingDelay=O.minPingDelay,this.maxPingDelay=O.maxPingDelay,this.pingDelay=void 0}createConnection(y,C,O,I){I=Ae({},I,{activityTimeout:this.pingDelay});var ne=this.transport.createConnection(y,C,O,I),pe=null,Me=function(){ne.unbind("open",Me),ne.bind("closed",Ve),pe=He.now()},Ve=ot=>{if(ne.unbind("closed",Ve),ot.code===1002||ot.code===1003)this.manager.reportDeath();else if(!ot.wasClean&&pe){var pt=He.now()-pe;pt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(pt/2,this.minPingDelay))}};return ne.bind("open",Me),ne}isSupported(y){return this.manager.isAlive()&&this.transport.isSupported(y)}}const bc={decodeMessage:function(_){try{var y=JSON.parse(_.data),C=y.data;if(typeof C=="string")try{C=JSON.parse(y.data)}catch{}var O={event:y.event,channel:y.channel,data:C};return y.user_id&&(O.user_id=y.user_id),O}catch(I){throw{type:"MessageParseError",error:I,data:_.data}}},encodeMessage:function(_){return JSON.stringify(_)},processHandshake:function(_){var y=bc.decodeMessage(_);if(y.event==="pusher:connection_established"){if(!y.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:y.data.socket_id,activityTimeout:y.data.activity_timeout*1e3}}else{if(y.event==="pusher:error")return{action:this.getCloseAction(y.data),error:this.getCloseError(y.data)};throw"Invalid handshake"}},getCloseAction:function(_){return _.code<4e3?_.code>=1002&&_.code<=1004?"backoff":null:_.code===4e3?"tls_only":_.code<4100?"refused":_.code<4200?"backoff":_.code<4300?"retry":"refused"},getCloseError:function(_){return _.code!==1e3&&_.code!==1001?{type:"PusherError",data:{code:_.code,message:_.reason||_.message}}:null}},Ba=bc;class yi extends je{constructor(y,C){super(),this.id=y,this.transport=C,this.activityTimeout=C.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(y){return this.transport.send(y)}send_event(y,C,O){var I={event:y,data:C};return O&&(I.channel=O),et.debug("Event sent",I),this.send(Ba.encodeMessage(I))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var y={message:O=>{var I;try{I=Ba.decodeMessage(O)}catch(ne){this.emit("error",{type:"MessageParseError",error:ne,data:O.data})}if(I!==void 0){switch(et.debug("Event recd",I),I.event){case"pusher:error":this.emit("error",{type:"PusherError",data:I.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",I)}},activity:()=>{this.emit("activity")},error:O=>{this.emit("error",O)},closed:O=>{C(),O&&O.code&&this.handleCloseEvent(O),this.transport=null,this.emit("closed")}},C=()=>{_t(y,(O,I)=>{this.transport.unbind(I,O)})};_t(y,(O,I)=>{this.transport.bind(I,O)})}handleCloseEvent(y){var C=Ba.getCloseAction(y),O=Ba.getCloseError(y);O&&this.emit("error",O),C&&this.emit(C,{action:C,error:O})}}class Ro{constructor(y,C){this.transport=y,this.callback=C,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=y=>{this.unbindListeners();var C;try{C=Ba.processHandshake(y)}catch(O){this.finish("error",{error:O}),this.transport.close();return}C.action==="connected"?this.finish("connected",{connection:new yi(C.id,this.transport),activityTimeout:C.activityTimeout}):(this.finish(C.action,{error:C.error}),this.transport.close())},this.onClosed=y=>{this.unbindListeners();var C=Ba.getCloseAction(y)||"backoff",O=Ba.getCloseError(y);this.finish(C,{error:O})},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(y,C){this.callback(Ae({transport:this.transport,action:y},C))}}class Lr{constructor(y,C){this.timeline=y,this.options=C||{}}send(y,C){this.timeline.isEmpty()||this.timeline.send(Be.TimelineTransport.getAgent(this,y),C)}}class Pa extends je{constructor(y,C){super(function(O,I){et.debug("No callbacks on "+y+" for "+O)}),this.name=y,this.pusher=C,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(y,C){return C(null,{auth:""})}trigger(y,C){if(y.indexOf("client-")!==0)throw new D("Event '"+y+"' does not start with 'client-'");if(!this.subscribed){var O=M.buildLogSuffix("triggeringClientEvents");et.warn(`Client event triggered before channel 'subscription_succeeded' event . ${O}`)}return this.pusher.send_event(y,C,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(y){var C=y.event,O=y.data;if(C==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(y);else if(C==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(y);else if(C.indexOf("pusher_internal:")!==0){var I={};this.emit(C,O,I)}}handleSubscriptionSucceededEvent(y){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",y.data)}handleSubscriptionCountEvent(y){y.data.subscription_count&&(this.subscriptionCount=y.data.subscription_count),this.emit("pusher:subscription_count",y.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(y,C)=>{y?(this.subscriptionPending=!1,et.error(y.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:y.message},y instanceof $e?{status:y.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:C.auth,channel_data:C.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 nr extends Pa{authorize(y,C){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:y},C)}}class Mr{constructor(){this.reset()}get(y){return Object.prototype.hasOwnProperty.call(this.members,y)?{id:y,info:this.members[y]}:null}each(y){_t(this.members,(C,O)=>{y(this.get(O))})}setMyID(y){this.myID=y}onSubscription(y){this.members=y.presence.hash,this.count=y.presence.count,this.me=this.get(this.myID)}addMember(y){return this.get(y.user_id)===null&&this.count++,this.members[y.user_id]=y.user_info,this.get(y.user_id)}removeMember(y){var C=this.get(y.user_id);return C&&(delete this.members[y.user_id],this.count--),C}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Wt=function(_,y,C,O){function I(ne){return ne instanceof C?ne:new C(function(pe){pe(ne)})}return new(C||(C=Promise))(function(ne,pe){function Me(pt){try{ot(O.next(pt))}catch(Nt){pe(Nt)}}function Ve(pt){try{ot(O.throw(pt))}catch(Nt){pe(Nt)}}function ot(pt){pt.done?ne(pt.value):I(pt.value).then(Me,Ve)}ot((O=O.apply(_,y||[])).next())})};class vc extends nr{constructor(y,C){super(y,C),this.members=new Mr}authorize(y,C){super.authorize(y,(O,I)=>Wt(this,void 0,void 0,function*(){if(!O)if(I=I,I.channel_data!=null){var ne=JSON.parse(I.channel_data);this.members.setMyID(ne.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 pe=M.buildLogSuffix("authorizationEndpoint");et.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${pe}, or the user should be signed in.`),C("Invalid auth response");return}C(O,I)}))}handleEvent(y){var C=y.event;if(C.indexOf("pusher_internal:")===0)this.handleInternalEvent(y);else{var O=y.data,I={};y.user_id&&(I.user_id=y.user_id),this.emit(C,O,I)}}handleInternalEvent(y){var C=y.event,O=y.data;switch(C){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(y);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(y);break;case"pusher_internal:member_added":var I=this.members.addMember(O);this.emit("pusher:member_added",I);break;case"pusher_internal:member_removed":var ne=this.members.removeMember(O);ne&&this.emit("pusher:member_removed",ne);break}}handleSubscriptionSucceededEvent(y){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(y.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Sc=f(978),_a=f(594);class $r extends nr{constructor(y,C,O){super(y,C),this.key=null,this.nacl=O}authorize(y,C){super.authorize(y,(O,I)=>{if(O){C(O,I);return}let ne=I.shared_secret;if(!ne){C(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,_a.decode)(ne),delete I.shared_secret,C(null,I)})}trigger(y,C){throw new ge("Client events are not currently supported for encrypted channels")}handleEvent(y){var C=y.event,O=y.data;if(C.indexOf("pusher_internal:")===0||C.indexOf("pusher:")===0){super.handleEvent(y);return}this.handleEncryptedEvent(C,O)}handleEncryptedEvent(y,C){if(!this.key){et.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!C.ciphertext||!C.nonce){et.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+C);return}let O=(0,_a.decode)(C.ciphertext);if(O.length<this.nacl.secretbox.overheadLength){et.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${O.length}`);return}let I=(0,_a.decode)(C.nonce);if(I.length<this.nacl.secretbox.nonceLength){et.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${I.length}`);return}let ne=this.nacl.secretbox.open(O,I,this.key);if(ne===null){et.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,(pe,Me)=>{if(pe){et.error(`Failed to make a request to the authEndpoint: ${Me}. Unable to fetch new key, so dropping encrypted event`);return}if(ne=this.nacl.secretbox.open(O,I,this.key),ne===null){et.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(y,this.getDataToEmit(ne))});return}this.emit(y,this.getDataToEmit(ne))}getDataToEmit(y){let C=(0,Sc.D4)(y);try{return JSON.parse(C)}catch{return C}}}class pf extends je{constructor(y,C){super(),this.state="initialized",this.connection=null,this.key=y,this.options=C,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 O=Be.getNetwork();O.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),O.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(y){this.key=y,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(y){return this.connection?this.connection.send(y):!1}send_event(y,C,O){return this.connection?this.connection.send_event(y,C,O):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var y=(C,O)=>{C?this.runner=this.strategy.connect(0,y):O.action==="error"?(this.emit("error",{type:"HandshakeError",error:O.error}),this.timeline.error({handshakeError:O.error})):(this.abortConnecting(),this.handshakeCallbacks[O.action](O))};this.runner=this.strategy.connect(0,y)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var y=this.abandonConnection();y.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(y){this.timeline.info({action:"retry",delay:y}),y>0&&this.emit("connecting_in",Math.round(y/1e3)),this.retryTimer=new me(y||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new me(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new me(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 me(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(y){return Ae({},y,{message:C=>{this.resetActivityCheck(),this.emit("message",C)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:C=>{this.emit("error",C)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(y){return Ae({},y,{connected:C=>{this.activityTimeout=Math.min(this.options.activityTimeout,C.activityTimeout,C.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(C.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let y=C=>O=>{O.error&&this.emit("error",{type:"WebSocketError",error:O.error}),C(O)};return{tls_only:y(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:y(()=>{this.disconnect()}),backoff:y(()=>{this.retryIn(1e3)}),retry:y(()=>{this.retryIn(0)})}}setConnection(y){this.connection=y;for(var C in this.connectionCallbacks)this.connection.bind(C,this.connectionCallbacks[C]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var y in this.connectionCallbacks)this.connection.unbind(y,this.connectionCallbacks[y]);var C=this.connection;return this.connection=null,C}}updateState(y,C){var O=this.state;if(this.state=y,O!==y){var I=y;I==="connected"&&(I+=" with new socket ID "+C.socket_id),et.debug("State changed",O+" -> "+I),this.timeline.info({state:y,params:C}),this.emit("state_change",{previous:O,current:y}),this.emit(y,C)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class wc{constructor(){this.channels={}}add(y,C){return this.channels[y]||(this.channels[y]=Cc(y,C)),this.channels[y]}all(){return un(this.channels)}find(y){return this.channels[y]}remove(y){var C=this.channels[y];return delete this.channels[y],C}disconnect(){_t(this.channels,function(y){y.disconnect()})}}function Cc(_,y){if(_.indexOf("private-encrypted-")===0){if(y.config.nacl)return Mn.createEncryptedChannel(_,y,y.config.nacl);let C="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",O=M.buildLogSuffix("encryptedChannelSupport");throw new ge(`${C}. ${O}`)}else{if(_.indexOf("private-")===0)return Mn.createPrivateChannel(_,y);if(_.indexOf("presence-")===0)return Mn.createPresenceChannel(_,y);if(_.indexOf("#")===0)throw new U('Cannot create a channel with name "'+_+'".');return Mn.createChannel(_,y)}}var mf={createChannels(){return new wc},createConnectionManager(_,y){return new pf(_,y)},createChannel(_,y){return new Pa(_,y)},createPrivateChannel(_,y){return new nr(_,y)},createPresenceChannel(_,y){return new vc(_,y)},createEncryptedChannel(_,y,C){return new $r(_,y,C)},createTimelineSender(_,y){return new Lr(_,y)},createHandshake(_,y){return new Ro(_,y)},createAssistantToTheTransportManager(_,y,C){return new gf(_,y,C)}};const Mn=mf;class bi{constructor(y){this.options=y||{},this.livesLeft=this.options.lives||1/0}getAssistant(y){return Mn.createAssistantToTheTransportManager(this,y,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class dn{constructor(y,C){this.strategies=y,this.loop=!!C.loop,this.failFast=!!C.failFast,this.timeout=C.timeout,this.timeoutLimit=C.timeoutLimit}isSupported(){return ea(this.strategies,He.method("isSupported"))}connect(y,C){var O=this.strategies,I=0,ne=this.timeout,pe=null,Me=(Ve,ot)=>{ot?C(null,ot):(I=I+1,this.loop&&(I=I%O.length),I<O.length?(ne&&(ne=ne*2,this.timeoutLimit&&(ne=Math.min(ne,this.timeoutLimit))),pe=this.tryStrategy(O[I],y,{timeout:ne,failFast:this.failFast},Me)):C(!0))};return pe=this.tryStrategy(O[I],y,{timeout:ne,failFast:this.failFast},Me),{abort:function(){pe.abort()},forceMinPriority:function(Ve){y=Ve,pe&&pe.forceMinPriority(Ve)}}}tryStrategy(y,C,O,I){var ne=null,pe=null;return O.timeout>0&&(ne=new me(O.timeout,function(){pe.abort(),I(!0)})),pe=y.connect(C,function(Me,Ve){Me&&ne&&ne.isRunning()&&!O.failFast||(ne&&ne.ensureAborted(),I(Me,Ve))}),{abort:function(){ne&&ne.ensureAborted(),pe.abort()},forceMinPriority:function(Me){pe.forceMinPriority(Me)}}}}class Sn{constructor(y){this.strategies=y}isSupported(){return ea(this.strategies,He.method("isSupported"))}connect(y,C){return Ec(this.strategies,y,function(O,I){return function(ne,pe){if(I[O].error=ne,ne){yf(I)&&C(!0);return}gt(I,function(Me){Me.forceMinPriority(pe.transport.priority)}),C(null,pe)}})}}function Ec(_,y,C){var O=ja(_,function(I,ne,pe,Me){return I.connect(y,C(ne,Me))});return{abort:function(){gt(O,ko)},forceMinPriority:function(I){gt(O,function(ne){ne.forceMinPriority(I)})}}}function yf(_){return Ua(_,function(y){return!!y.error})}function ko(_){!_.error&&!_.aborted&&(_.abort(),_.aborted=!0)}class _c{constructor(y,C,O){this.strategy=y,this.transports=C,this.ttl=O.ttl||18e5,this.usingTLS=O.useTLS,this.timeline=O.timeline}isSupported(){return this.strategy.isSupported()}connect(y,C){var O=this.usingTLS,I=bf(O),ne=I&&I.cacheSkipCount?I.cacheSkipCount:0,pe=[this.strategy];if(I&&I.timestamp+this.ttl>=He.now()){var Me=this.transports[I.transport];Me&&(["ws","wss"].includes(I.transport)||ne>3?(this.timeline.info({cached:!0,transport:I.transport,latency:I.latency}),pe.push(new dn([Me],{timeout:I.latency*2+1e3,failFast:!0}))):ne++)}var Ve=He.now(),ot=pe.pop().connect(y,function pt(Nt,Ra){Nt?(us(O),pe.length>0?(Ve=He.now(),ot=pe.pop().connect(y,pt)):C(Nt)):($n(O,Ra.transport.name,He.now()-Ve,ne),C(null,Ra))});return{abort:function(){ot.abort()},forceMinPriority:function(pt){y=pt,ot&&ot.forceMinPriority(pt)}}}}function Nr(_){return"pusherTransport"+(_?"TLS":"NonTLS")}function bf(_){var y=Be.getLocalStorage();if(y)try{var C=y[Nr(_)];if(C)return JSON.parse(C)}catch{us(_)}return null}function $n(_,y,C,O){var I=Be.getLocalStorage();if(I)try{I[Nr(_)]=bn({timestamp:He.now(),transport:y,latency:C,cacheSkipCount:O})}catch{}}function us(_){var y=Be.getLocalStorage();if(y)try{delete y[Nr(_)]}catch{}}class vi{constructor(y,{delay:C}){this.strategy=y,this.options={delay:C}}isSupported(){return this.strategy.isSupported()}connect(y,C){var O=this.strategy,I,ne=new me(this.options.delay,function(){I=O.connect(y,C)});return{abort:function(){ne.ensureAborted(),I&&I.abort()},forceMinPriority:function(pe){y=pe,I&&I.forceMinPriority(pe)}}}}class ar{constructor(y,C,O){this.test=y,this.trueBranch=C,this.falseBranch=O}isSupported(){var y=this.test()?this.trueBranch:this.falseBranch;return y.isSupported()}connect(y,C){var O=this.test()?this.trueBranch:this.falseBranch;return O.connect(y,C)}}class Ir{constructor(y){this.strategy=y}isSupported(){return this.strategy.isSupported()}connect(y,C){var O=this.strategy.connect(y,function(I,ne){ne&&O.abort(),C(I,ne)});return O}}function Hr(_){return function(){return _.isSupported()}}var Ac=function(_,y,C){var O={};function I(qo,jc,Uc,jf,Uf){var Bc=C(_,qo,jc,Uc,jf,Uf);return O[qo]=Bc,Bc}var ne=Object.assign({},y,{hostNonTLS:_.wsHost+":"+_.wsPort,hostTLS:_.wsHost+":"+_.wssPort,httpPath:_.wsPath}),pe=Object.assign({},ne,{useTLS:!0}),Me=Object.assign({},y,{hostNonTLS:_.httpHost+":"+_.httpPort,hostTLS:_.httpHost+":"+_.httpsPort,httpPath:_.httpPath}),Ve={loop:!0,timeout:15e3,timeoutLimit:6e4},ot=new bi({minPingDelay:1e4,maxPingDelay:_.activityTimeout}),pt=new bi({lives:2,minPingDelay:1e4,maxPingDelay:_.activityTimeout}),Nt=I("ws","ws",3,ne,ot),Ra=I("wss","ws",3,pe,ot),If=I("sockjs","sockjs",1,Me),Hc=I("xhr_streaming","xhr_streaming",1,Me,pt),Hf=I("xdr_streaming","xdr_streaming",1,Me,pt),Uo=I("xhr_polling","xhr_polling",1,Me),zc=I("xdr_polling","xdr_polling",1,Me),Ur=new dn([Nt],Ve),Ai=new dn([Ra],Ve),zf=new dn([If],Ve),xi=new dn([new ar(Hr(Hc),Hc,Hf)],Ve),Bo=new dn([new ar(Hr(Uo),Uo,zc)],Ve),Po=new dn([new ar(Hr(xi),new Sn([xi,new vi(Bo,{delay:4e3})]),Bo)],Ve),Ti=new ar(Hr(Po),Po,zf),Ri;return y.useTLS?Ri=new Sn([Ur,new vi(Ti,{delay:2e3})]):Ri=new Sn([Ur,new vi(Ai,{delay:2e3}),new vi(Ti,{delay:5e3})]),new _c(new Ir(new ar(Hr(Nt),Ri,Ti)),O,{ttl:18e5,timeline:y.timeline,useTLS:y.useTLS})};const zr=Ac;function vf(){var _=this;_.timeline.info(_.buildTimelineMessage({transport:_.name+(_.options.useTLS?"s":"")})),_.hooks.isInitialized()?_.changeState("initialized"):_.hooks.file?(_.changeState("initializing"),A.load(_.hooks.file,{useTLS:_.options.useTLS},function(y,C){_.hooks.isInitialized()?(_.changeState("initialized"),C(!0)):(y&&_.onError(y),_.onClose(),C(!1))})):_.onClose()}var xc={getRequest:function(_){var y=new window.XDomainRequest;return y.ontimeout=function(){_.emit("error",new j),_.close()},y.onerror=function(C){_.emit("error",C),_.close()},y.onprogress=function(){y.responseText&&y.responseText.length>0&&_.onChunk(200,y.responseText)},y.onload=function(){y.responseText&&y.responseText.length>0&&_.onChunk(200,y.responseText),_.emit("finished",200),_.close()},y},abortRequest:function(_){_.ontimeout=_.onerror=_.onprogress=_.onload=null,_.abort()}};const Tc=xc,Do=256*1024;class Sf extends je{constructor(y,C,O){super(),this.hooks=y,this.method=C,this.url=O}start(y){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},Be.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(y)}close(){this.unloader&&(Be.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(y,C){for(;;){var O=this.advanceBuffer(C);if(O)this.emit("chunk",{status:y,data:O});else break}this.isBufferTooLong(C)&&this.emit("buffer_too_long")}advanceBuffer(y){var C=y.slice(this.position),O=C.indexOf(`
|
||
`);return O!==-1?(this.position+=O+1,C.slice(0,O)):null}isBufferTooLong(y){return this.position===y.length&&y.length>Do}}var Oo;(function(_){_[_.CONNECTING=0]="CONNECTING",_[_.OPEN=1]="OPEN",_[_.CLOSED=3]="CLOSED"})(Oo||(Oo={}));const na=Oo;var Aa=1;class Lo{constructor(y,C){this.hooks=y,this.session=ds(1e3)+"/"+kc(8),this.location=Mo(C),this.readyState=na.CONNECTING,this.openStream()}send(y){return this.sendRaw(JSON.stringify([y]))}ping(){this.hooks.sendHeartbeat(this)}close(y,C){this.onClose(y,C,!0)}sendRaw(y){if(this.readyState===na.OPEN)try{return Be.createSocketRequest("POST",rr(jr(this.location,this.session))).start(y),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(y,C,O){this.closeStream(),this.readyState=na.CLOSED,this.onclose&&this.onclose({code:y,reason:C,wasClean:O})}onChunk(y){if(y.status===200){this.readyState===na.OPEN&&this.onActivity();var C,O=y.data.slice(0,1);switch(O){case"o":C=JSON.parse(y.data.slice(1)||"{}"),this.onOpen(C);break;case"a":C=JSON.parse(y.data.slice(1)||"[]");for(var I=0;I<C.length;I++)this.onEvent(C[I]);break;case"m":C=JSON.parse(y.data.slice(1)||"null"),this.onEvent(C);break;case"h":this.hooks.onHeartbeat(this);break;case"c":C=JSON.parse(y.data.slice(1)||"[]"),this.onClose(C[0],C[1],!0);break}}}onOpen(y){this.readyState===na.CONNECTING?(y&&y.hostname&&(this.location.base=Rc(this.location.base,y.hostname)),this.readyState=na.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(y){this.readyState===na.OPEN&&this.onmessage&&this.onmessage({data:y})}onActivity(){this.onactivity&&this.onactivity()}onError(y){this.onerror&&this.onerror(y)}openStream(){this.stream=Be.createSocketRequest("POST",rr(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",y=>{this.onChunk(y)}),this.stream.bind("finished",y=>{this.hooks.onFinished(this,y)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(y){He.defer(()=>{this.onError(y),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Mo(_){var y=/([^\?]*)\/*(\??.*)/.exec(_);return{base:y[1],queryString:y[2]}}function jr(_,y){return _.base+"/"+y+"/xhr_send"}function rr(_){var y=_.indexOf("?")===-1?"?":"&";return _+y+"t="+ +new Date+"&n="+Aa++}function Rc(_,y){var C=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(_);return C[1]+y+C[3]}function ds(_){return Be.randomInt(_)}function kc(_){for(var y=[],C=0;C<_;C++)y.push(ds(32).toString(32));return y.join("")}const Si=Lo;var xa={getReceiveURL:function(_,y){return _.base+"/"+y+"/xhr_streaming"+_.queryString},onHeartbeat:function(_){_.sendRaw("[]")},sendHeartbeat:function(_){_.sendRaw("[]")},onFinished:function(_,y){_.onClose(1006,"Connection interrupted ("+y+")",!1)}};const $o=xa;var wi={getReceiveURL:function(_,y){return _.base+"/"+y+"/xhr"+_.queryString},onHeartbeat:function(){},sendHeartbeat:function(_){_.sendRaw("[]")},onFinished:function(_,y){y===200?_.reconnect():_.onClose(1006,"Connection interrupted ("+y+")",!1)}};const qa=wi;var No={getRequest:function(_){var y=Be.getXHRAPI(),C=new y;return C.onreadystatechange=C.onprogress=function(){switch(C.readyState){case 3:C.responseText&&C.responseText.length>0&&_.onChunk(C.status,C.responseText);break;case 4:C.responseText&&C.responseText.length>0&&_.onChunk(C.status,C.responseText),_.emit("finished",C.status),_.close();break}},C},abortRequest:function(_){_.onreadystatechange=null,_.abort()}};const fs=No;var Dc={createStreamingSocket(_){return this.createSocket($o,_)},createPollingSocket(_){return this.createSocket(qa,_)},createSocket(_,y){return new Si(_,y)},createXHR(_,y){return this.createRequest(fs,_,y)},createRequest(_,y,C){return new Sf(_,y,C)}};const Ci=Dc;Ci.createXDR=function(_,y){return this.createRequest(Tc,_,y)};var Oc={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:m,DependenciesReceivers:E,getDefaultStrategy:zr,Transports:vn,transportConnectionInitializer:vf,HTTPFactory:Ci,TimelineTransport:q,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(_){window.Pusher=_;var y=()=>{this.onDocumentBody(_.ready)};window.JSON?y():A.load("json2",{},y)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Xe,jsonp:En}},onDocumentBody(_){document.body?_():setTimeout(()=>{this.onDocumentBody(_)},0)},createJSONPRequest(_,y){return new Ea(_,y)},createScriptRequest(_){return new tr(_)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var _=this.getXHRAPI();return new _},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return To},createWebSocket(_){var y=this.getWebSocketAPI();return new y(_)},createSocketRequest(_,y){if(this.isXHRSupported())return this.HTTPFactory.createXHR(_,y);if(this.isXDRSupported(y.indexOf("https:")===0))return this.HTTPFactory.createXDR(_,y);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var _=this.getXHRAPI();return!!_&&new _().withCredentials!==void 0},isXDRSupported(_){var y=_?"https:":"http:",C=this.getProtocol();return!!window.XDomainRequest&&C===y},addUnloadListener(_){window.addEventListener!==void 0?window.addEventListener("unload",_,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",_)},removeUnloadListener(_){window.addEventListener!==void 0?window.removeEventListener("unload",_,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",_)},randomInt(_){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*_)}};const Be=Oc;var Ta;(function(_){_[_.ERROR=3]="ERROR",_[_.INFO=6]="INFO",_[_.DEBUG=7]="DEBUG"})(Ta||(Ta={}));const ir=Ta;class Ei{constructor(y,C,O){this.key=y,this.session=C,this.events=[],this.options=O||{},this.sent=0,this.uniqueID=0}log(y,C){y<=this.options.level&&(this.events.push(Ae({},C,{timestamp:He.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(y){this.log(ir.ERROR,y)}info(y){this.log(ir.INFO,y)}debug(y){this.log(ir.DEBUG,y)}isEmpty(){return this.events.length===0}send(y,C){var O=Ae({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=[],y(O,(I,ne)=>{I||this.sent++,C&&C(I,ne)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class wf{constructor(y,C,O,I){this.name=y,this.priority=C,this.transport=O,this.options=I||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(y,C){if(this.isSupported()){if(this.priority<y)return hs(new P,C)}else return hs(new Ce,C);var O=!1,I=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),ne=null,pe=function(){I.unbind("initialized",pe),I.connect()},Me=function(){ne=Mn.createHandshake(I,function(Nt){O=!0,pt(),C(null,Nt)})},Ve=function(Nt){pt(),C(Nt)},ot=function(){pt();var Nt;Nt=bn(I),C(new X(Nt))},pt=function(){I.unbind("initialized",pe),I.unbind("open",Me),I.unbind("error",Ve),I.unbind("closed",ot)};return I.bind("initialized",pe),I.bind("open",Me),I.bind("error",Ve),I.bind("closed",ot),I.initialize(),{abort:()=>{O||(pt(),ne?ne.close():I.close())},forceMinPriority:Nt=>{O||this.priority<Nt&&(ne?ne.close():I.close())}}}}function hs(_,y){return He.defer(function(){y(_)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Ho}=Be;var _i=function(_,y,C,O,I,ne){var pe=Ho[C];if(!pe)throw new Ee(C);var Me=(!_.enabledTransports||Rt(_.enabledTransports,y)!==-1)&&(!_.disabledTransports||Rt(_.disabledTransports,y)===-1),Ve;return Me?(I=Object.assign({ignoreNullOrigin:_.ignoreNullOrigin},I),Ve=new wf(y,O,ne?ne.getAssistant(pe):pe,I)):Ve=gs,Ve},gs={isSupported:function(){return!1},connect:function(_,y){var C=He.defer(function(){y(new Ce)});return{abort:function(){C.ensureAborted()},forceMinPriority:function(){}}}};function Lc(_){if(_==null)throw"You must pass an options object";if(_.cluster==null)throw"Options object must provide a cluster";"disableStats"in _&&et.warn("The disableStats option is deprecated in favor of enableStats")}const Cf=(_,y)=>{var C="socket_id="+encodeURIComponent(_.socketId);for(var O in y.params)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(y.params[O]);if(y.paramsProvider!=null){let I=y.paramsProvider();for(var O in I)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(I[O])}return C},Ef=_=>{if(typeof Be.getAuthorizers()[_.transport]>"u")throw`'${_.transport}' is not a recognized auth transport`;return(y,C)=>{const O=Cf(y,_);Be.getAuthorizers()[_.transport](Be,O,_,R.UserAuthentication,C)}},zo=(_,y)=>{var C="socket_id="+encodeURIComponent(_.socketId);C+="&channel_name="+encodeURIComponent(_.channelName);for(var O in y.params)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(y.params[O]);if(y.paramsProvider!=null){let I=y.paramsProvider();for(var O in I)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(I[O])}return C},_f=_=>{if(typeof Be.getAuthorizers()[_.transport]>"u")throw`'${_.transport}' is not a recognized auth transport`;return(y,C)=>{const O=zo(y,_);Be.getAuthorizers()[_.transport](Be,O,_,R.ChannelAuthorization,C)}},Af=(_,y,C)=>{const O={authTransport:y.transport,authEndpoint:y.endpoint,auth:{params:y.params,headers:y.headers}};return(I,ne)=>{const pe=_.channel(I.channelName);C(pe,O).authorize(I.socketId,ne)}};function Mc(_,y){let C={activityTimeout:_.activityTimeout||v.activityTimeout,cluster:_.cluster,httpPath:_.httpPath||v.httpPath,httpPort:_.httpPort||v.httpPort,httpsPort:_.httpsPort||v.httpsPort,pongTimeout:_.pongTimeout||v.pongTimeout,statsHost:_.statsHost||v.stats_host,unavailableTimeout:_.unavailableTimeout||v.unavailableTimeout,wsPath:_.wsPath||v.wsPath,wsPort:_.wsPort||v.wsPort,wssPort:_.wssPort||v.wssPort,enableStats:kf(_),httpHost:xf(_),useTLS:Rf(_),wsHost:$c(_),userAuthenticator:jo(_),channelAuthorizer:Of(_,y)};return"disabledTransports"in _&&(C.disabledTransports=_.disabledTransports),"enabledTransports"in _&&(C.enabledTransports=_.enabledTransports),"ignoreNullOrigin"in _&&(C.ignoreNullOrigin=_.ignoreNullOrigin),"timelineParams"in _&&(C.timelineParams=_.timelineParams),"nacl"in _&&(C.nacl=_.nacl),C}function xf(_){return _.httpHost?_.httpHost:_.cluster?`sockjs-${_.cluster}.pusher.com`:v.httpHost}function $c(_){return _.wsHost?_.wsHost:Tf(_.cluster)}function Tf(_){return`ws-${_}.pusher.com`}function Rf(_){return Be.getProtocol()==="https:"?!0:_.forceTLS!==!1}function kf(_){return"enableStats"in _?_.enableStats:"disableStats"in _?!_.disableStats:!1}const Nc=_=>"customHandler"in _&&_.customHandler!=null;function jo(_){const y=Object.assign(Object.assign({},v.userAuthentication),_.userAuthentication);return Nc(y)?y.customHandler:Ef(y)}function Df(_,y){let C;if("channelAuthorization"in _)C=Object.assign(Object.assign({},v.channelAuthorization),_.channelAuthorization);else if(C={transport:_.authTransport||v.authTransport,endpoint:_.authEndpoint||v.authEndpoint},"auth"in _&&("params"in _.auth&&(C.params=_.auth.params),"headers"in _.auth&&(C.headers=_.auth.headers)),"authorizer"in _)return{customHandler:Af(y,C,_.authorizer)};return C}function Of(_,y){const C=Df(_,y);return Nc(C)?C.customHandler:_f(C)}class Lf extends je{constructor(y){super(function(C,O){et.debug(`No callbacks on watchlist events for ${C}`)}),this.pusher=y,this.bindWatchlistInternalEvent()}handleEvent(y){y.data.events.forEach(C=>{this.emit(C.name,C)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",y=>{var C=y.event;C==="pusher_internal:watchlist_events"&&this.handleEvent(y)})}}function Ic(){let _,y;return{promise:new Promise((O,I)=>{_=O,y=I}),resolve:_,reject:y}}const Mf=Ic;class $f extends je{constructor(y){super(function(C,O){et.debug("No callbacks on user for "+C)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(C,O)=>{if(C){et.warn(`Error during signin: ${C}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:O.auth,user_data:O.user_data})},this.pusher=y,this.pusher.connection.bind("state_change",({previous:C,current:O})=>{C!=="connected"&&O==="connected"&&this._signin(),C==="connected"&&O!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Lf(y),this.pusher.connection.bind("message",C=>{var O=C.event;O==="pusher:signin_success"&&this._onSigninSuccess(C.data),this.serverToUserChannel&&this.serverToUserChannel.name===C.channel&&this.serverToUserChannel.handleEvent(C)})}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(y){try{this.user_data=JSON.parse(y.user_data)}catch{et.error(`Failed parsing user data after signin: ${y.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){et.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const y=C=>{C.subscriptionPending&&C.subscriptionCancelled?C.reinstateSubscription():!C.subscriptionPending&&this.pusher.connection.state==="connected"&&C.subscribe()};this.serverToUserChannel=new Pa(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((C,O)=>{C.indexOf("pusher_internal:")===0||C.indexOf("pusher:")===0||this.emit(C,O)}),y(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:y,resolve:C}=Mf();y.done=!1;const O=()=>{y.done=!0};y.then(O).catch(O),this.signinDonePromise=y,this._signinDoneResolve=C}}class rn{static ready(){rn.isReady=!0;for(var y=0,C=rn.instances.length;y<C;y++)rn.instances[y].connect()}static getClientFeatures(){return ft(jt({ws:Be.Transports.ws},function(y){return y.isSupported({})}))}constructor(y,C){Nf(y),Lc(C),this.key=y,this.options=C,this.config=Mc(this.options,this),this.channels=Mn.createChannels(),this.global_emitter=new je,this.sessionID=Be.randomInt(1e9),this.timeline=new Ei(this.key,this.sessionID,{cluster:this.config.cluster,features:rn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:ir.INFO,version:v.VERSION}),this.config.enableStats&&(this.timelineSender=Mn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+Be.TimelineTransport.name}));var O=I=>Be.getDefaultStrategy(this.config,I,_i);this.connection=Mn.createConnectionManager(this.key,{getStrategy:O,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",I=>{var ne=I.event,pe=ne.indexOf("pusher_internal:")===0;if(I.channel){var Me=this.channel(I.channel);Me&&Me.handleEvent(I)}pe||this.global_emitter.emit(I.event,I.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",I=>{et.warn(I)}),rn.instances.push(this),this.timeline.info({instances:rn.instances.length}),this.user=new $f(this),rn.isReady&&this.connect()}switchCluster(y){const{appKey:C,cluster:O}=y;this.key=C,this.options=Object.assign(Object.assign({},this.options),{cluster:O}),this.config=Mc(this.options,this),this.connection.switchCluster(this.key)}channel(y){return this.channels.find(y)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var y=this.connection.isUsingTLS(),C=this.timelineSender;this.timelineSenderTimer=new Ne(6e4,function(){C.send(y)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(y,C,O){return this.global_emitter.bind(y,C,O),this}unbind(y,C,O){return this.global_emitter.unbind(y,C,O),this}bind_global(y){return this.global_emitter.bind_global(y),this}unbind_global(y){return this.global_emitter.unbind_global(y),this}unbind_all(y){return this.global_emitter.unbind_all(),this}subscribeAll(){var y;for(y in this.channels.channels)this.channels.channels.hasOwnProperty(y)&&this.subscribe(y)}subscribe(y){var C=this.channels.add(y,this);return C.subscriptionPending&&C.subscriptionCancelled?C.reinstateSubscription():!C.subscriptionPending&&this.connection.state==="connected"&&C.subscribe(),C}unsubscribe(y){var C=this.channels.find(y);C&&C.subscriptionPending?C.cancelSubscription():(C=this.channels.remove(y),C&&C.subscribed&&C.unsubscribe())}send_event(y,C,O){return this.connection.send_event(y,C,O)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}rn.instances=[],rn.isReady=!1,rn.logToConsole=!1,rn.Runtime=Be,rn.ScriptReceivers=Be.ScriptReceivers,rn.DependenciesReceivers=Be.DependenciesReceivers,rn.auth_callbacks=Be.auth_callbacks;const ps=rn;function Nf(_){if(_==null)throw"You must pass your app key when you instantiate Pusher."}Be.setup(rn)}},r={};function i(u){var d=r[u];if(d!==void 0)return d.exports;var f=r[u]={exports:{}};return a[u].call(f.exports,f,f.exports,i),f.exports}i.d=(u,d)=>{for(var f in d)i.o(d,f)&&!i.o(u,f)&&Object.defineProperty(u,f,{enumerable:!0,get:d[f]})},i.o=(u,d)=>Object.prototype.hasOwnProperty.call(u,d);var l=i(721);return l})())})(of)),of.exports}var L_=O_();const ty=Ya(L_),Ht=ct("WebSocketManager");class M_{constructor(){$(this,"echo",null);$(this,"subscriptions",new Map);$(this,"initialized",!1);$(this,"config",null)}configure(e){if(this.initialized){Ht.warn("[WebSocketManager] 이미 초기화되어 설정을 변경할 수 없습니다.");return}this.config=e,Ht.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){Ht.warn("[WebSocketManager] WebSocket 설정이 없습니다. initTemplateApp에서 websocket 옵션을 전달해주세요.");return}const{appKey:e,host:a="localhost",port:r=80,scheme:i="https",authEndpoint:l="/api/broadcasting/auth"}=this.config,u=Number(r)||80,d=i==="https";Ht.log("[WebSocketManager] 연결 설정:",{host:a,port:u,scheme:i,useTLS:d,authEndpoint:l}),window.Pusher=ty;const f=localStorage.getItem("auth_token"),g={wsHost:a,wsPort:u,wssPort:u,forceTLS:d,disableStats:!0,enabledTransports:["ws","wss"],cluster:"mt1",authEndpoint:l,auth:{headers:{Authorization:f?`Bearer ${f}`:"",Accept:"application/json"}}};Ht.log("[WebSocketManager] Pusher 옵션:",g);const m=new ty(e,g);m.connection.bind("connecting",()=>{Ht.log("[WebSocketManager] 연결 시도 중...")}),m.connection.bind("connected",()=>{Ht.log("[WebSocketManager] 연결 성공! Socket ID:",m.connection.socket_id)}),m.connection.bind("failed",()=>{Ht.error("[WebSocketManager] 연결 실패 - WebSocket을 사용할 수 없습니다.")}),m.connection.bind("error",b=>{Ht.error("[WebSocketManager] 연결 오류:",b)}),m.connection.bind("state_change",b=>{Ht.log(`[WebSocketManager] 상태 변경: ${b.previous} → ${b.current}`)}),m.connection.bind("unavailable",()=>{Ht.error("[WebSocketManager] WebSocket 사용 불가 - 연결할 수 없습니다.")}),m.connection.bind("disconnected",()=>{Ht.warn("[WebSocketManager] 연결이 끊어졌습니다.")}),Ht.log("[WebSocketManager] 초기 연결 상태:",m.connection.state),this.echo=new D_({broadcaster:"reverb",client:m}),Ht.log("[WebSocketManager] 연결 시작 시도..."),m.connect(),window.Echo=this.echo,this.initialized=!0,Ht.log("[WebSocketManager] Echo 초기화 완료")}subscribe(e,a,r,i={}){if(this.initialize(),!this.echo)return Ht.warn("[WebSocketManager] Echo가 초기화되지 않았습니다."),"";const{channelType:l="private"}=i,u=`${e}:${a}`;if(this.subscriptions.has(u))return Ht.log(`[WebSocketManager] 이미 구독 중: ${u}`),u;let d;switch(l){case"public":d=this.echo.channel(e);break;case"presence":d=this.echo.join(e);break;default:d=this.echo.private(e)}return d.listen(`.${a}`,r),this.subscriptions.set(u,d),Ht.log(`[WebSocketManager] 구독 완료: ${u} (${l})`),u}unsubscribe(e){const a=this.subscriptions.get(e);if(!a)return;const r=e.lastIndexOf(":"),i=r>=0?e.substring(r+1):"";if(i)try{a.stopListening(`.${i}`)}catch(l){Ht.warn(`[WebSocketManager] stopListening 실패: ${e}`,l)}this.subscriptions.delete(e),Ht.log(`[WebSocketManager] 구독 해제: ${e}`)}leaveChannel(e){if(!this.echo)return;this.echo.leave(e);const a=[];this.subscriptions.forEach((r,i)=>{i.startsWith(`${e}:`)&&a.push(i)}),a.forEach(r=>this.subscriptions.delete(r)),Ht.log(`[WebSocketManager] 채널 구독 해제: ${e}`)}disconnect(){this.echo&&(this.echo.disconnect(),this.subscriptions.clear(),this.initialized=!1,Ht.log("[WebSocketManager] 연결 종료"))}getEcho(){return this.echo}isInitialized(){return this.initialized}isConfigured(){return this.config!==null&&!!this.config.appKey}getSubscriptionCount(){return this.subscriptions.size}}const fc=new M_,bt=ct("DataSourceManager"),$_=new wn;function hc(o,e){const a=o.match(/^\{\{(.+)\}\}$/);if(a){const r=a[1].trim();try{return $_.evaluateExpression(r,e)}catch(i){return bt.error("Failed to evaluate param expression:",r,i),o}}return Xi(o,e,{skipCache:!0})}function ny(o){const e={};for(const a of o.keys()){if(a in e)continue;const r=o.getAll(a);r.length>1?e[a]=r:r.length===1&&(a.endsWith("[]")?e[a]=r:e[a]=r[0])}return e}function N_(){try{return window.G7Core?.devTools}catch{return}}const yc=class yc{constructor(e={}){$(this,"options");$(this,"dataCache",new Map);$(this,"bindingEngine");$(this,"globalHeaders",[]);this.options=e,this.bindingEngine=new wn}setGlobalHeaders(e){this.globalHeaders=e||[]}matchesPattern(e,a){if(a==="*")return!0;const r=a.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${r}$`).test(e)}toFormData(e){const a=new FormData;for(const[r,i]of Object.entries(e))i instanceof File||i instanceof Blob?a.append(r,i):i!=null&&a.append(r,typeof i=="object"?JSON.stringify(i):String(i));return a}getMatchingGlobalHeaders(e,a){const r={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([l,u])=>{const d=hc(u,a);d!=null&&d!==""&&(r[l]=String(d))});return r}filterByCondition(e,a={}){const r=new Set,i=[];for(const l of e){if(r.has(l.id))continue;if(!l.if&&!l.conditions){r.add(l.id),i.push(l);continue}Yi({if:l.if,conditions:l.conditions},a,this.bindingEngine,`data_source:${l.id}`)&&(r.add(l.id),i.push(l))}return i}checkErrorCondition(e,a){if(!e.errorCondition?.if||e.errorCondition?.errorCode===void 0)return null;try{const r={response:a};if(Yi({if:e.errorCondition.if},r,this.bindingEngine,`errorCondition:${e.id}`))return bt.log(`errorCondition matched for ${e.id}, triggering error ${e.errorCondition.errorCode}`),e.errorCondition.errorCode}catch(r){bt.error(`Failed to evaluate errorCondition for ${e.id}:`,r)}return null}async fetchDataSources(e,a={},r=new URLSearchParams,i,l){const u={},d=!!this.options.sampleProvider,f=e.filter(g=>(d||g.auto_fetch!==!1)&&g.type!=="websocket");return await Promise.all(f.map(async g=>{try{const m=await this.fetchDataSource(g,a,r,i,l);u[g.id]=m,this.dataCache.set(g.id,{data:m,timestamp:Date.now()});const b=this.checkErrorCondition(g,m);if(b!==null){const v={status:b,message:`Error condition matched for ${g.id}`,data:m},S=pa(),E=S.resolve(b,{errorHandling:g.errorHandling,onError:g.onError});if(E.handler)try{await S.execute(E.handler,v)}catch(A){bt.error(`Error executing errorCondition handler for ${g.id}:`,A)}g.fallback!==void 0&&(u[g.id]=g.fallback,this.dataCache.set(g.id,{data:g.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${g.id} (errorCondition)`));return}if(g.onSuccess)try{const v={data:m,sourceId:g.id};await this.executeOnSuccessHandler(g.onSuccess,v)}catch(v){bt.error(`Error executing onSuccess handler for ${g.id}:`,v)}}catch(m){bt.error(`Failed to fetch data source: ${g.id}`,m);const b=m?.response?.status||m?.status||500,v=m?.response?.data,S=v?.message||m.message||"Unknown error",E={status:b,message:S,errors:v?.errors,data:v,statusText:m?.response?.statusText},A=pa(),T=A.resolve(b,{errorHandling:g.errorHandling,onError:g.onError});if(T.handler)try{await A.execute(T.handler,E)}catch(L){bt.error(`Error executing error handler for ${g.id}:`,L)}g.fallback!==void 0&&(u[g.id]=g.fallback,this.dataCache.set(g.id,{data:g.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${g.id}`)),this.options.onError&&this.options.onError(m,g)}})),u}async fetchDataSourcesWithResults(e,a={},r=new URLSearchParams,i,l,u){if(e.some(m=>m.type==="websocket")){const m=e.filter(b=>b.type==="websocket").map(b=>b.id).join(", ");bt.warn(`fetchDataSourcesWithResults received WebSocket sources (caller should filter them out before calling): ${m}. WebSocket sources are event listeners, not data providers — they should not be passed to fetch.`)}const f=u?.ignoreAutoFetch?e.filter(m=>m.type!=="websocket"):e.filter(m=>m.auto_fetch!==!1&&m.type!=="websocket");return await Promise.all(f.map(async m=>{try{const b=await this.fetchDataSource(m,a,r,i,l);this.dataCache.set(m.id,{data:b,timestamp:Date.now()});const v=this.checkErrorCondition(m,b);if(v!==null){const S={status:v,message:`Error condition matched for ${m.id}`,data:b},E=pa(),A=E.resolve(v,{errorHandling:m.errorHandling,onError:m.onError});let T=!1;if(A.handler)if(m.loading_strategy==="blocking")E.execute(A.handler,S).catch(L=>{bt.error(`Error executing errorCondition handler for ${m.id}:`,L)}),T=!0;else try{await E.execute(A.handler,S),T=!0}catch(L){bt.error(`Error executing errorCondition handler for ${m.id}:`,L)}return m.fallback!==void 0?(this.dataCache.set(m.id,{data:m.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${m.id} (errorCondition)`),{id:m.id,state:"success",data:m.fallback}):{id:m.id,state:"error",error:new Error(`Error condition matched: ${v}`),errorCode:v,errorHandled:T}}if(m.onSuccess)try{const S={data:b,sourceId:m.id};await this.executeOnSuccessHandler(m.onSuccess,S)}catch(S){bt.error(`Error executing onSuccess handler for ${m.id}:`,S)}return{id:m.id,state:"success",data:b}}catch(b){bt.error(`Failed to fetch data source: ${m.id}`,b);const v=b?.response?.status||b?.status||500,S=b?.response?.data,E=S?.message||b.message||"Unknown error",A={status:v,message:E,errors:S?.errors,data:S,statusText:b?.response?.statusText},T=pa(),L=T.resolve(v,{errorHandling:m.errorHandling,onError:m.onError});let M=!1;if(L.handler)if(m.loading_strategy==="blocking")T.execute(L.handler,A).catch(R=>{bt.error(`Error executing error handler for ${m.id}:`,R)}),M=!0;else try{await T.execute(L.handler,A),M=!0}catch(R){bt.error(`Error executing error handler for ${m.id}:`,R)}return m.fallback!==void 0?(this.dataCache.set(m.id,{data:m.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${m.id}`),{id:m.id,state:"success",data:m.fallback}):(this.options.onError&&this.options.onError(b,m),{id:m.id,state:"error",error:b,errorCode:v,errorHandled:M})}}))}fetchDataSourcesInBackground(e,a={},r=new URLSearchParams,i){e.filter(u=>u.auto_fetch!==!1&&u.loading_strategy==="background"&&u.type!=="websocket").forEach(u=>{this.fetchDataSource(u,a,r).then(async d=>{this.dataCache.set(u.id,{data:d,timestamp:Date.now()});const f=this.checkErrorCondition(u,d);if(f!==null){const g={status:f,message:`Error condition matched for ${u.id}`,data:d},m=pa(),b=m.resolve(f,{errorHandling:u.errorHandling,onError:u.onError});if(b.handler)try{await m.execute(b.handler,g)}catch(v){bt.error(`Error executing errorCondition handler for ${u.id}:`,v)}u.fallback!==void 0&&(this.dataCache.set(u.id,{data:u.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${u.id} (errorCondition)`),i&&i(u.id,u.fallback));return}if(u.onSuccess)try{const g={data:d,sourceId:u.id};await this.executeOnSuccessHandler(u.onSuccess,g)}catch(g){bt.error(`Error executing onSuccess handler for ${u.id}:`,g)}i&&i(u.id,d)}).catch(async d=>{bt.error(`Background fetch failed: ${u.id}`,d);const f=d?.response?.status||d?.status||500,g=d?.response?.data,m=g?.message||d.message||"Unknown error",b={status:f,message:m,errors:g?.errors,data:g,statusText:d?.response?.statusText},v=pa(),S=v.resolve(f,{errorHandling:u.errorHandling,onError:u.onError});if(S.handler)try{await v.execute(S.handler,b)}catch(E){bt.error(`Error executing error handler for ${u.id}:`,E)}if(u.fallback!==void 0){this.dataCache.set(u.id,{data:u.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${u.id}`),i&&i(u.id,u.fallback);return}this.options.onError&&this.options.onError(d,u)})})}async fetchDataSource(e,a,r,i,l){switch(e.type){case"api":return this.fetchApiDataSource(e,a,r,i,l);case"static":return e.data;case"route_params":return a;case"query_params":return ny(r);default:throw new Error(`Unknown data source type: ${e.type}`)}}async fetchApiDataSource(e,a,r,i,l){if(this.options.sampleProvider?.has(e.id))return await Promise.resolve(this.options.sampleProvider.resolve(e));if(!e.endpoint)throw new Error(`API data source ${e.id} has no endpoint`);const u={route:a,query:ny(r)};i&&(u._global=i),l&&(u._local=l);let d=Xi(e.endpoint,u,{skipCache:!0});const f=e.method||"GET",m=(e.contentType?typeof e.contentType=="string"&&e.contentType.includes("{{")?Xi(e.contentType,u,{skipCache:!0}):e.contentType:"application/json")==="multipart/form-data";let b=m?{...e.params||{}}:JSON.parse(JSON.stringify(e.params||{}));Object.entries(b).forEach(([E,A])=>{typeof A=="string"&&(b[E]=hc(A,u))}),Object.keys(b).forEach(E=>{b[E]===""&&delete b[E]});const v=N_();let S=null;if(v?.isEnabled()){v.trackDataSourceDefinition({id:e.id,type:e.type,endpoint:d,method:f,autoFetch:e.auto_fetch,initLocal:e.initLocal,initGlobal:e.initGlobal});let E=d;if(f==="GET"&&Object.keys(b).length>0){const A=new URLSearchParams;Object.entries(b).forEach(([L,M])=>{Array.isArray(M)?M.forEach(R=>A.append(L,String(R))):M!=null&&A.append(L,String(M))});const T=A.toString();E=T?`${d}?${T}`:d}S=v.trackRequest(E,f,{requestBody:f!=="GET"?b:void 0,dataSourceId:e.id}),v.trackDataSourceLoading(e.id)}try{let E;const A=e.auth_mode??(e.auth_required===!0?"required":"none"),T=ha.getInstance().isAuthenticated();if(A==="required"&&!T){bt.log(`[DataSourceManager] Skipping ${e.id}: auth_mode is 'required' but no token available`),v?.isEnabled()&&(v.trackDataSourceError(e.id,"Skipped: auth_mode required but not authenticated"),S&&v.failRequest(S,"Skipped: not authenticated"));const M=new Error("Auth required but not authenticated");throw M.response={status:401,statusText:"Unauthorized",data:null},M.status=401,M._authSkipped=!0,M}const L=A==="required"||A==="optional"&&T;if(L){const M=$a(),R=d.startsWith("/api/")?d.substring(4):d.startsWith("/api")?d.substring(4)||"/":d;this.options.onError&&bt.log(`[DataSourceManager] Normalized endpoint: ${d} -> ${R}`);const D=this.getMatchingGlobalHeaders(d,u),U={};e.headers&&Object.entries(e.headers).forEach(([ge,Ee])=>{const Ce=hc(Ee,u);Ce!=null&&Ce!==""&&(U[ge]=String(Ce))});const j={...D,...U},P=Object.keys(j).length>0,X=m?this.toFormData(b):b;switch(f){case"GET":E=await M.get(R,{params:b,...P&&{headers:j}});break;case"POST":P?E=await M.post(R,X,{headers:j}):E=await M.post(R,X);break;case"PUT":P?E=await M.put(R,X,{headers:j}):E=await M.put(R,X);break;case"PATCH":P?E=await M.patch(R,X,{headers:j}):E=await M.patch(R,X);break;case"DELETE":E=await M.delete(R,{params:b,...P&&{headers:j}});break;default:throw new Error(`Unsupported HTTP method: ${f}`)}}else{let M=d;if(f==="GET"){const X=new URLSearchParams(b).toString();M=X?`${d}?${X}`:d}const R={...m?{}:{"Content-Type":"application/json"},Accept:"application/json"};if(typeof window<"u"){const X=localStorage.getItem("g7_locale");X&&(R["Accept-Language"]=X)}const D=this.getMatchingGlobalHeaders(d,u);Object.assign(R,D),e.headers&&Object.entries(e.headers).forEach(([X,ge])=>{const Ee=hc(ge,u);Ee!=null&&Ee!==""&&(R[X]=String(Ee))});let U;f!=="GET"&&(m?(U=this.toFormData(b),delete R["Content-Type"]):U=JSON.stringify(b));const j=await fetch(M,{method:f,headers:R,body:U});let P;try{P=await j.json()}catch{P=null}if(S&&v?.isEnabled()&&(v.completeRequest(S,j.status,P),S=null),!j.ok){v?.isEnabled()&&v.trackDataSourceError(e.id,`HTTP ${j.status}: ${j.statusText}`);const X=new Error(`HTTP error! status: ${j.status}`);throw X.response={status:j.status,statusText:j.statusText,data:P},X.status=j.status,X}E=P,v?.isEnabled()&&v.trackDataSourceLoaded(e.id,E)}return L&&S&&v?.isEnabled()&&(v.completeRequest(S,200,E),v.trackDataSourceLoaded(e.id,E)),E}catch(E){if(S&&v?.isEnabled()){const A=E;A?.response?v.completeRequest(S,A.response.status,A.response.data):v.failRequest(S,E instanceof Error?E.message:String(E)),v.trackDataSourceError(e.id,E instanceof Error?E.message:String(E))}throw E}}getCachedData(e){const a=this.dataCache.get(e);if(!a)return;if(Date.now()-a.timestamp>yc.DATA_CACHE_TTL){this.dataCache.delete(e);return}return a.data}clearCache(){this.dataCache.clear()}subscribeWebSockets(e,a,r={}){const i=[],l=e.filter(u=>u.type==="websocket");return l.length===0||l.forEach(u=>{if(!u.channel||!u.event){bt.warn(`WebSocket source ${u.id} missing channel or event`);return}let d,f;try{d=Xi(u.channel,r,{skipCache:!0}),f=Xi(u.event,r,{skipCache:!0})}catch(b){bt.error(`Failed to resolve WebSocket channel/event for source ${u.id}:`,b);return}const g=b=>!!(!b||b.trim()===""||b.includes("{{")||b.endsWith(".")||b.endsWith(":")||b.startsWith(".")||b.startsWith(":")||b.includes("..")||b.includes("::"));if(g(d)||g(f)){bt.warn(`WebSocket source ${u.id} has invalid channel/event after expression resolution, skipping. Original channel="${u.channel}", resolved="${d}". Original event="${u.event}", resolved="${f}". Available context keys: [${Object.keys(r).join(", ")}]`);return}const m=fc.subscribe(d,f,b=>{const v=u.target_source||u.id;this.dataCache.set(v,{data:b,timestamp:Date.now()}),a(v,b)},{channelType:u.channel_type||"private"});m&&i.push(m)}),i}unsubscribeWebSockets(e){e.length!==0&&e.forEach(a=>{fc.unsubscribe(a)})}async executeOnSuccessHandler(e,a){const r=this.options.actionDispatcher??Zp();if(!r){bt.warn("ActionDispatcher not available, skipping onSuccess handler");return}const i=Array.isArray(e)?e:[e];for(const l of i)try{await r.dispatchAction({type:"click",...l},{data:{response:a}})}catch(u){throw bt.error("Failed to execute onSuccess handler:",u),u}}};$(yc,"DATA_CACHE_TTL",3e5);let va=yc;const I_=new va,hi=ct("ModalDataSourceWrapper");function H_(o,e){if(!o||!e)return o;const r=e.replace(/\?\./g,".").split(/\.(?![^\[]*\])/).flatMap(l=>{const u=l.match(/^([^\[]*)((?:\[\d+\])*)$/);if(u){const[,d,f]=u,g=[];d&&g.push(d);const m=f.match(/\[\d+\]/g);return m&&g.push(...m),g}return[l]}).filter(l=>l!=="");let i=o;for(const l of r){if(i==null)return;if(l.startsWith("[")&&l.endsWith("]")){const u=parseInt(l.slice(1,-1),10);i=i[u]}else i=i[l]}return i}const ay=({isOpen:o,modalId:e,dataSources:a,dataContext:r,globalStateUpdater:i,bindingEngine:l,debug:u=!1,children:d})=>{const[f,g]=N.useState(!1),[m,b]=N.useState(!1),v=N.useRef(!1),S=N.useRef(null);S.current||(S.current=new va);const E=N.useCallback(async()=>{if(!(!a||a.length===0)&&S.current){g(!0);try{const A=r.route||{},T=new URLSearchParams(window.location.search),L=a.map(R=>{let D={...R};if(R.endpoint&&l){const U=l.resolveBindings(R.endpoint,r,{skipCache:!0});D.endpoint=U}if(R.params&&l){const U={};Object.entries(R.params).forEach(([j,P])=>{typeof P=="string"?U[j]=l.resolveBindings(P,r,{skipCache:!0}):U[j]=P}),D.params=U}return D});u&&hi.log(`[ModalDataSourceWrapper] Modal "${e}" fetching data sources:`,L.map(R=>({id:R.id,endpoint:R.endpoint})));const M=await S.current.fetchDataSourcesWithResults(L,A,T);i&&M.forEach(R=>{if(R.state==="success"&&R.data!==void 0){const D=L.find(U=>U.id===R.id);if(D?.initGlobal){const U=R.data?.data??R.data,j=Array.isArray(D.initGlobal)?D.initGlobal:[D.initGlobal];for(const P of j)if(typeof P=="string")i({[P]:U}),u&&hi.log(`[ModalDataSourceWrapper] Modal "${e}" initGlobal: ${R.id}.data -> _global.${P}`);else if(typeof P=="object"&&P.key){const{key:X,path:ge}=P,Ee=ge?H_(U,ge):U;i({[X]:Ee}),u&&hi.log(`Modal "${e}" initGlobal: ${R.id}.data${ge?"."+ge:""} -> _global.${X}`)}}}else R.state==="error"&&hi.error(`Modal "${e}" data source error:`,R.id,R.error)}),u&&hi.log(`Modal "${e}" data sources fetched successfully`)}catch(A){hi.error(`Modal "${e}" data source fetch error:`,A)}finally{g(!1),b(!0)}}},[a,r,i,l,e,u]);return N.useEffect(()=>{if(!a||a.length===0)return;const A=window.__templateApp;return A?.registerModalDataSources&&A.registerModalDataSources(e,a),()=>{A?.unregisterModalDataSources&&A.unregisterModalDataSources(e)}},[e,a]),N.useEffect(()=>{!o&&v.current&&(b(!1),u&&hi.log(`[ModalDataSourceWrapper] Modal "${e}" closed, reset fetch state`)),o&&!v.current&&a&&a.length>0&&!m&&E(),v.current=o},[o,a,m,E,e,u]),ut.jsx(ut.Fragment,{children:d})};class gc extends Error{constructor(a,r,i={}){super(r);$(this,"code");$(this,"userMessageKey");$(this,"showStack");$(this,"icon");$(this,"recoverable");this.name="TemplateEngineError",this.code=a,this.userMessageKey=r,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(a,r){if(!r||!a)return this.userMessageKey;try{return r.translate(this.userMessageKey,a)}catch{return this.userMessageKey}}}class z_ extends gc{constructor(){super("TEMPLATE_NOT_FOUND","$t:core.errors.template_not_found",{showStack:!1,icon:"fa-paint-brush",recoverable:!1}),this.name="TemplateNotFoundError"}}function ry(o){if(o instanceof gc)return o;if(o instanceof Error){const e=new gc("TEMPLATE_INIT_ERROR",o.message||"$t:core.errors.template_init_error",{showStack:!0,icon:"fa-circle-exclamation",recoverable:!0});return e.stack=o.stack,e}return new gc("TEMPLATE_INIT_ERROR","$t:core.errors.template_init_error",{showStack:!1,icon:"fa-circle-exclamation",recoverable:!0})}const j_=ct("ErrorDisplay");class lf{static render(e,a){const r=document.getElementById(e);if(!r){j_.error(`Container #${e} not found`);return}const i=a.debug&&a.showStack&&a.stackTrace,l=window.matchMedia("(prefers-color-scheme: dark)").matches,u={container:`
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 100vh;
|
||
background-color: ${l?"#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: ${l?"#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: ${l?"#ffffff":"#111827"};
|
||
margin-bottom: 1rem;
|
||
`,message:`
|
||
color: ${l?"#d1d5db":"#4b5563"};
|
||
margin-bottom: 0.5rem;
|
||
line-height: 1.625;
|
||
`,detailMessage:`
|
||
font-size: 0.875rem;
|
||
color: ${l?"#9ca3af":"#6b7280"};
|
||
margin-bottom: 1.5rem;
|
||
background-color: ${l?"#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: ${l?"#374151":"#f3f4f6"};
|
||
border-radius: 0.375rem;
|
||
text-align: left;
|
||
`,stackTitle:`
|
||
font-size: 0.875rem;
|
||
font-weight: 600;
|
||
color: ${l?"#e5e7eb":"#374151"};
|
||
margin-bottom: 0.5rem;
|
||
`,stackTrace:`
|
||
font-size: 0.75rem;
|
||
color: ${l?"#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;
|
||
`};r.innerHTML=`
|
||
<div style="${u.container}">
|
||
<div style="${u.card}">
|
||
<!-- 아이콘 -->
|
||
<div style="${u.iconContainer}">
|
||
<i class="fa-solid ${a.icon}" style="${u.icon}"></i>
|
||
</div>
|
||
|
||
<!-- 제목 -->
|
||
<h1 style="${u.title}">
|
||
${this.escapeHtml(a.title)}
|
||
</h1>
|
||
|
||
<!-- 사용자 메시지 -->
|
||
<p style="${u.message}">
|
||
${this.escapeHtml(a.message)}
|
||
</p>
|
||
|
||
<!-- 상세 메시지 (API 응답 등) -->
|
||
${a.detailMessage?`
|
||
<p style="${u.detailMessage}">
|
||
${this.escapeHtml(a.detailMessage)}
|
||
</p>
|
||
`:`<div style="${u.spacer}"></div>`}
|
||
|
||
<!-- Stack Trace (디버그 모드일 때만) -->
|
||
${i?`
|
||
<div style="${u.stackContainer}">
|
||
<p style="${u.stackTitle}">
|
||
Stack Trace:
|
||
</p>
|
||
<pre style="${u.stackTrace}">${this.escapeHtml(a.stackTrace)}</pre>
|
||
</div>
|
||
`:""}
|
||
|
||
<!-- 새로고침 버튼 (복구 가능할 때만) -->
|
||
${a.showReloadButton?`
|
||
<div style="${u.buttonContainer}">
|
||
<button
|
||
onclick="window.location.reload()"
|
||
style="${u.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,a,r,i=!1,l,u,d){let f,g;if(a.userMessageKey.startsWith("$t:"))if(u&&l)try{f=u.translate(a.userMessageKey,l)}catch{f=a.userMessageKey.replace("$t:","")}else f=a.userMessageKey.replace("$t:","");else f=a.userMessageKey;if(d){const m=d;m.details?.apiMessage?g=m.details.apiMessage:m.response?.data?.message&&(g=m.response.data.message)}this.render(e,{title:r,message:f,detailMessage:g,icon:a.icon,showStack:a.showStack,stackTrace:a.stack,showReloadButton:a.recoverable,debug:i})}static escapeHtml(e){if(!e)return"";const a=document.createElement("div");return a.textContent=e,a.innerHTML}}const ss=ct("Router");class U_{constructor(e){$(this,"routes",[]);$(this,"templateIdentifier");$(this,"eventHandlers",new Map);$(this,"pendingNavigation",null);$(this,"isNavigating",!1);$(this,"handlePopState",()=>{this.navigateToCurrentPath()});this.templateIdentifier=e,this.initPopstateListener()}initPopstateListener(){window.addEventListener("popstate",this.handlePopState)}on(e,a){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(a)}async emit(e,...a){const r=this.eventHandlers.get(e);r&&await Promise.all(r.map(i=>i(...a)))}async loadRoutes(e){try{const a=e!==void 0&&e>0?e:null,r=await fetch(La(`/api/templates/${this.templateIdentifier}/routes`,"json",a));if(!r.ok)throw new Error(`Failed to load routes: ${r.statusText}`);const i=await r.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,ss.log(`Loaded ${this.routes.length} routes${e?` (v=${e})`:""}`);else throw new Error("Invalid routes data format")}catch(a){throw ss.error("Error loading routes:",a),a}}setRoutes(e){this.routes=e,ss.log(`Set ${this.routes.length} routes`)}match(e){for(const a of this.routes){const r=this.matchPattern(a.path,e);if(r!==null)return{route:a,params:r}}return null}matchPattern(e,a){const r=[];let i=e.replace(/:([^/]+)/g,(f,g)=>(r.push(g),"([^/]+)"));i.startsWith("*/")&&(i="(?:/[^/]+)?"+i.slice(1)),i=i.replace(/\//g,"\\/");const l=new RegExp(`^${i}$`),u=a.match(l);if(!u)return null;const d={};return r.forEach((f,g)=>{d[f]=u[g+1]}),d}getRoutes(){return[...this.routes]}getAuthType(e,a){return e.auth_type?e.auth_type:a.startsWith("/admin")?"admin":"user"}async navigateToCurrentPath(){const e=window.location.pathname,a=window.location.search,r=this.match(e);if(!r){ss.warn(`No route matched for path: ${e}`),this.emit("routeNotFound",e);return}if(r.route.redirect){ss.log(`Redirecting from ${e} to ${r.route.redirect}`),this.navigate(r.route.redirect);return}if(r.route.auth_required){const u=this.getAuthType(r.route,e),d=ha.getInstance();let f=d.isAuthenticated()&&d.getAuthType()===u;if(f||(f=await d.checkAuth(u)),!f){const g=d.getLoginRedirectUrl(u,e+a);ss.log(`Not authenticated, redirecting to: ${g}`),window.location.href=g;return}}const i=new URLSearchParams(a),l={};for(const u of i.keys()){if(u in l)continue;const d=i.getAll(u);d.length>1?l[u]=d:d.length===1&&(u.endsWith("[]")?l[u]=d:l[u]=d[0])}await this.emit("routeChange",{path:e,layout:r.route.layout,endpoint:r.route.endpoint,params:{...r.route.params||{},...r.params},query:l,auth_required:r.route.auth_required,auth_type:r.route.auth_type,meta:r.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 a=this.pendingNavigation;this.executeNavigation(a)}}}}const B_=/^\/admin\/layout-editor\/([^/?#]+)\/?$/;function iy(o){const e=B_.exec(o);return e?{templateIdentifier:e[1]}:null}const zt=ct("ErrorPageHandler");class P_{constructor(e){$(this,"templateId");$(this,"layoutLoader");$(this,"locale");$(this,"debug");$(this,"renderFunction");$(this,"dataSourceManager");$(this,"globalState");$(this,"errorConfig",null);$(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(La(`/api/templates/${this.templateId}/config`,"json"));if(!e.ok)return this.debug&&zt.warn("Failed to load template config:",e.statusText),this.configLoaded=!0,null;const a=await e.json();if(!a.success||!a.data)return this.debug&&zt.warn("Invalid template config response"),this.configLoaded=!0,null;const r=a.data;return!r.error_config||!r.error_config.layouts?(this.debug&&zt.warn("No error_config found in template.json"),this.configLoaded=!0,null):(this.errorConfig=r.error_config,this.configLoaded=!0,this.debug&&zt.log("Error config loaded:",this.errorConfig),this.errorConfig)}catch(e){return zt.error("Failed to load error config:",e),this.configLoaded=!0,null}}async renderError(e,a="app"){try{const r=await this.loadConfig();if(!r)return this.debug&&zt.warn("No error config available, cannot render error page"),!1;const i=r.layouts[e]||r.layouts[String(e)];if(!i)return this.debug&&zt.warn(`No layout defined for error code: ${e}`),!1;this.debug&&zt.log(`Loading error layout: ${i} for code: ${e}`);const l=await this.layoutLoader.loadLayout(this.templateId,i);if(!l)return this.debug&&zt.error(`Failed to load error layout: ${i}`),!1;this.debug&&zt.log("Error layout loaded:",l);let u={};const d=l.data_sources||[];if(d.length>0){this.debug&&zt.log("Fetching data sources:",d.map(S=>S.id));const m=d.filter(S=>S.loading_strategy==="blocking"),b=d.filter(S=>!S.loading_strategy||S.loading_strategy==="progressive"),v=[...m,...b];if(v.length>0)try{u=await this.dataSourceManager.fetchDataSources(v,{},new URLSearchParams),this.debug&&zt.log("Data sources fetched:",Object.keys(u))}catch(S){zt.error("Failed to fetch data sources:",S)}}const f={};d.length>0&&(this.processInitOptions(d,u,f),this.debug&&zt.log("initOptions processed:",{globalKeys:Object.keys(this.globalState),localKeys:Object.keys(f)}));const g={...u,errorCode:e,_global:{...this.globalState},_local:{...f}};return await this.renderFunction({containerId:a,layoutJson:l,dataContext:g,translationContext:{templateId:this.templateId,locale:this.locale}}),this.debug&&zt.log(`Error page ${e} rendered successfully`),!0}catch(r){return zt.error(`Failed to render error page ${e}:`,r),!1}}processInitOptions(e,a,r){for(const i of e){const l=a[i.id];if(!l)continue;const u=l?.data??l;if(i.initLocal){if(typeof i.initLocal=="string")r[i.initLocal]=u,zt.log(`initLocal: ${i.id}.data -> _local.${i.initLocal}`);else if(typeof i.initLocal=="object"&&"key"in i.initLocal){const{key:d,path:f}=i.initLocal;r[d]=f?this.getValueByPath(u,f):u,zt.log(`initLocal: ${i.id}.data${f?"."+f:""} -> _local.${d}`)}}if(i.initGlobal){const d=Array.isArray(i.initGlobal)?i.initGlobal:[i.initGlobal];for(const f of d)if(typeof f=="string")this.globalState[f]=u,zt.log(`initGlobal: ${i.id}.data -> _global.${f}`);else if(typeof f=="object"&&f!==null&&"key"in f){const{key:g,path:m}=f;this.globalState[g]=m?this.getValueByPath(u,m):u,zt.log(`initGlobal: ${i.id}.data${m?"."+m:""} -> _global.${g}`)}}}}getValueByPath(e,a){return a.split(".").reduce((r,i)=>r?.[i],e)}updateGlobalState(e){this.globalState={...this.globalState,...e}}updateLocale(e){this.locale=e,this.debug&&zt.log("Locale updated:",e)}isConfigLoaded(){return this.configLoaded}async hasErrorLayout(e){const a=await this.loadConfig();return a?!!(a.layouts[e]||a.layouts[String(e)]):!1}clearConfigCache(){this.errorConfig=null,this.configLoaded=!1,this.debug&&zt.log("Config cache cleared")}}const $t=ct("ModuleAssetLoader");class q_{constructor(){$(this,"loadedAssets",new Map);$(this,"loadingPromises",new Map);$(this,"failedJsAssets",new Set)}hasFailedJsAssets(){return this.failedJsAssets.size>0}getFailedJsAssets(){return[...this.failedJsAssets]}async loadActiveExtensionAssets(e){if(!e||e.length===0){$t.log("No module assets to load");return}const a=[...e].sort((d,f)=>d.priority-f.priority);$t.log("Loading module assets:",a.map(d=>d.identifier));const r=a.filter(d=>d.css).map(d=>this.loadCSS(d.identifier,d.css)),i=a.filter(d=>d.js).map(d=>this.loadJS(d.identifier,d.js)),l=await Promise.allSettled([...r,...i]),u=l.filter(d=>d.status==="rejected");if(u.length>0){$t.warn(`Some module assets failed to load (${u.length}/${l.length}); continuing with the rest`,this.getFailedJsAssets());return}$t.log("All module assets loaded successfully")}async loadBundle(e,a,r){const i=[];if(r&&i.push(this.loadBundleCss(e,r)),a&&i.push(this.loadBundleJs(e,a)),i.length===0){$t.log(`No bundle assets to load for: ${e}`);return}await Promise.all(i)}async loadBundleCss(e,a){const r=`ext-bundle-css-${e}`;if(document.getElementById(r)){$t.log(`Bundle CSS already loaded: ${e}`);return}return new Promise(i=>{const l=document.createElement("link");l.rel="stylesheet",l.href=a,l.id=r,l.onload=()=>{$t.log(`Bundle CSS loaded: ${e}`),this.registerLoadedAsset(`bundle-${e}`,{type:"css",element:l}),i()},l.onerror=()=>{$t.warn(`Failed to load bundle CSS: ${e} (${a})`),i()},document.head.appendChild(l)})}async loadBundleJs(e,a){const r=`ext-bundle-js-${e}`;if(document.getElementById(r)){$t.log(`Bundle JS already loaded: ${e}`);return}const i=this.loadingPromises.get(r);if(i)return $t.log(`Bundle JS already loading: ${e}`),i;const l=Yg(a,{id:r},{label:`bundle JS: ${e}`}).then(()=>{$t.log(`Bundle JS loaded: ${e}`);const u=document.getElementById(r);u&&this.registerLoadedAsset(`bundle-${e}`,{type:"js",element:u}),this.loadingPromises.delete(r)}).catch(u=>{throw $t.warn(`Failed to load bundle JS: ${e} (${a})`,u),this.failedJsAssets.add(e),this.loadingPromises.delete(r),u});return this.loadingPromises.set(r,l),l}async loadCSS(e,a){const r=`module-css-${e}`;if(document.getElementById(r)){$t.log(`CSS already loaded: ${e}`);return}return new Promise((i,l)=>{const u=document.createElement("link");u.rel="stylesheet",u.href=a,u.id=r,u.onload=()=>{$t.log(`CSS loaded: ${e}`),this.registerLoadedAsset(e,{type:"css",element:u}),i()},u.onerror=()=>{$t.warn(`Failed to load CSS: ${e} (${a})`),i()},document.head.appendChild(u)})}async loadJS(e,a){const r=`module-js-${e}`;if(document.getElementById(r)){$t.log(`JS already loaded: ${e}`);return}const i=this.loadingPromises.get(e);if(i)return $t.log(`JS already loading: ${e}`),i;const l=Yg(a,{id:r},{label:`JS: ${e}`}).then(()=>{$t.log(`JS loaded: ${e}`);const u=document.getElementById(r);u&&this.registerLoadedAsset(e,{type:"js",element:u}),this.loadingPromises.delete(e)}).catch(u=>{throw $t.warn(`Failed to load JS: ${e} (${a})`,u),this.failedJsAssets.add(e),this.loadingPromises.delete(e),u});return this.loadingPromises.set(e,l),l}registerLoadedAsset(e,a){const r=this.loadedAssets.get(e)||[];r.push(a),this.loadedAssets.set(e,r)}unloadExtensionAsset(e){const a=this.loadedAssets.get(e);if(!a||a.length===0){$t.log(`No assets to unload for: ${e}`);return}a.forEach(r=>{r.element.parentNode&&(r.element.parentNode.removeChild(r.element),$t.log(`${r.type.toUpperCase()} unloaded: ${e}`))}),this.loadedAssets.delete(e),$t.log(`All assets unloaded for: ${e}`)}unloadAllAssets(){Array.from(this.loadedAssets.keys()).forEach(a=>{this.unloadExtensionAsset(a)}),$t.log("All module assets unloaded")}isLoaded(e){return this.loadedAssets.has(e)}getLoadedModules(){return Array.from(this.loadedAssets.keys())}}let cf=null;function uf(){return cf||(cf=new q_),cf}function G_(){if(typeof window>"u")return[];const o=window.G7Config;if(!o?.moduleAssets)return[];const e=[];for(const[a,r]of Object.entries(o.moduleAssets)){const i=r;e.push({identifier:a,js:i.js?wr(i.js):i.js,css:i.css?wr(i.css):i.css,priority:i.priority,external:i.external})}return e}function V_(){if(typeof window>"u")return null;const o=window.G7Config;if(!o?.bundleUrls)return null;const e=o.bundleUrls;return{moduleJs:e.moduleJs?wr(e.moduleJs):e.moduleJs,moduleCss:e.moduleCss?wr(e.moduleCss):e.moduleCss,pluginJs:e.pluginJs?wr(e.pluginJs):e.pluginJs,pluginCss:e.pluginCss?wr(e.pluginCss):e.pluginCss}}function F_(){if(typeof window>"u")return[];const o=window.G7Config;if(!o?.pluginAssets)return[];const e=[];for(const[a,r]of Object.entries(o.pluginAssets)){const i=r;e.push({identifier:a,js:i.js?wr(i.js):i.js,css:i.css?wr(i.css):i.css,priority:i.priority,external:i.external})}return e}const df=ct("SystemBannerManager");class pc{static show(e){this.banners.set(e.id,e),this.render(),df.log(`Banner shown: ${e.id}`)}static hide(e){this.banners.delete(e)&&(this.render(),df.log(`Banner hidden: ${e}`))}static hideAll(){this.banners.clear(),this.render(),df.log("All banners hidden")}static detectLocale(){try{const a=window.G7Core;if(a?.locale?.current)return a.locale.current()}catch{}return(navigator.language||"ko").split("-")[0]}static resolveMessage(e,a){return typeof e=="string"?e:e[a]||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 a=Array.from(this.banners.values()).sort((i,l)=>(i.order??0)-(l.order??0)),r=this.detectLocale();e.innerHTML=a.map(i=>{const l=this.resolveMessage(i.message,r),u=i.background||"#f59e0b",d=i.color||"white";return`<div data-banner-id="${i.id}" style="background:${u};color:${d};text-align:center;padding:8px 16px;font-size:14px;font-weight:500;">${l}</div>`}).join(""),requestAnimationFrame(()=>{e&&this.adjustAppPadding(e.offsetHeight)})}static adjustAppPadding(e){const a=document.getElementById("app");a&&(a.style.paddingTop=e>0?`${e}px`:"")}}$(pc,"banners",new Map),$(pc,"containerId","g7-system-banners");const B=ct("TemplateApp");function sy(o){const e={};for(const a of o.keys()){if(a in e)continue;const r=o.getAll(a);r.length>1?e[a]=r:r.length===1&&(a.endsWith("[]")?e[a]=r:e[a]=r[0])}return e}const Ca=class Ca{constructor(e){$(this,"router",null);$(this,"layoutLoader",null);$(this,"errorPageHandler",null);$(this,"config");$(this,"globalState");$(this,"globalStateListeners",new Set);$(this,"currentRouteChangeId",0);$(this,"currentDataSources",[]);$(this,"currentRawDataSources",[]);$(this,"currentRouteParams",{});$(this,"currentQueryParams",new URLSearchParams);$(this,"currentFetchedData",{});$(this,"currentLayoutName","");$(this,"templateErrorHandling",null);$(this,"currentWebSocketSubscriptions",[]);$(this,"extensionCacheVersion",0);$(this,"currentGlobalHeaders",[]);$(this,"transitionOverlayEl",null);$(this,"skeletonOverlayRoot",null);$(this,"skeletonOverlayContainer",null);$(this,"_spinnerState",null);$(this,"modalDataSources",new Map);this.globalState={sidebarOpen:!1},this.loadG7Config(),this.migrateLocaleStorage();const a=this.loadLocaleFromStorage(),r=a||e.locale||"ko";this.config={...e,locale:r},!a&&e.locale&&this.saveLocaleToStorage(e.locale)}loadG7Config(){if(typeof window<"u"&&window.G7Config){const e=window.G7Config;e.settings&&(this.globalState.settings=e.settings,B.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,B.log("Loaded plugin settings from G7Config:",Object.keys(e.plugins))),e.modules&&(this.globalState.modules=e.modules,B.log("Loaded module settings from G7Config:",Object.keys(e.modules))),e.appConfig&&(this.globalState.appConfig=e.appConfig,B.log("Loaded appConfig from G7Config:",Object.keys(e.appConfig)))}}resolveRouteExpressions(e){const a=new wn,r={_global:this.globalState};return e.map(i=>{const l={...i};if(l.path&&l.path.includes("{{")){const u=l.path;l.path=a.resolveBindings(l.path,r),l.path=l.path.replace(/\/\/+/g,"/")||"/",l.path.includes("{{")&&(B.warn("Route expression resolution failed, using fallback:",u),l.path=u.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/")}if(l.redirect&&l.redirect.includes("{{")){const u=l.redirect;l.redirect=a.resolveBindings(l.redirect,r),l.redirect=l.redirect.replace(/\/\/+/g,"/")||"/",l.redirect.includes("{{")&&(B.warn("Route redirect expression resolution failed:",u),l.redirect=u.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/")}return l})}migrateLocaleStorage(){const e=["locale","g7_template_locale"];for(const a of e)try{const r=localStorage.getItem(a);r&&r!==localStorage.getItem(Ca.LOCALE_STORAGE_KEY)&&(localStorage.setItem(Ca.LOCALE_STORAGE_KEY,r),B.log(`Migrated locale from '${a}' to '${Ca.LOCALE_STORAGE_KEY}'`)),localStorage.removeItem(a)}catch(r){B.warn(`Failed to migrate locale key '${a}':`,r)}}async init(){try{Fs.getInstance().setDebug(this.config.debug),B.log("Initializing with config:",this.config),US();const e=da.getInstance(),a=ha.getInstance(),r=this.loadCacheVersionFromStorage()||0,[i,l,u,d,f]=await Promise.all([_o({templateId:this.config.templateId,templateType:this.config.templateType,locale:this.config.locale,debug:this.config.debug,cacheVersion:r}),e.loadComponents(this.config.templateId,this.config.templateType),Al(La(`/api/templates/${this.config.templateId}/routes`,"json",r>0?r:null),{label:"routes.json"}).then(A=>{if(!A.ok)throw new Error(`Failed to load routes: ${A.statusText}`);return A.json()}).then(A=>{if(!A.success)throw new Error("Failed to load routes from API");return A.data}).catch(A=>{throw B.error("Error loading routes:",A),A}),a.preloadAuth(this.config.templateType==="admin"?"admin":"user"),fetch(La(`/api/templates/${this.config.templateId}/config`,"json")).then(A=>A.ok?A.json():null).then(A=>!A?.success||!A?.data?null:A.data).catch(A=>(B.warn("Error loading template config:",A),null))]);if(B.log("Template Engine initialized"),B.log("ComponentRegistry loaded"),B.log("Routes data loaded"),B.log("User info preloaded"),B.log("Template config loaded:",f),f?.cache_version!==void 0){const A=this.loadCacheVersionFromStorage();if(this.extensionCacheVersion=f.cache_version,this.saveCacheVersionToStorage(this.extensionCacheVersion),B.log("Extension cache version:",this.extensionCacheVersion),A!==null&&A!==this.extensionCacheVersion){B.log("Cache version changed, reloading routes...");const T=await Al(La(`/api/templates/${this.config.templateId}/routes`,"json",this.extensionCacheVersion),{label:"routes.json (reload)"}).then(L=>{if(!L.ok)throw new Error(`Failed to reload routes: ${L.statusText}`);return L.json()}).then(L=>{if(!L.success)throw new Error("Failed to reload routes from API");return L.data});Array.isArray(T.routes)&&(T.routes=this.resolveRouteExpressions(T.routes),Object.assign(u,T),B.log("Routes reloaded with new cache version"));try{const{TranslationEngine:L}=await Promise.resolve().then(()=>ep),M=L.getInstance();M.setCacheVersion(this.extensionCacheVersion);const R=this.config.locale||"ko",D="en";await M.loadTranslations(this.config.templateId,R,"/api",!0),R!==D&&await M.loadTranslations(this.config.templateId,D,"/api",!0),B.log("Translations reloaded with new cache version")}catch(L){B.error("Failed to reload translations:",L)}}}f?.errorHandling&&(this.templateErrorHandling=f.errorHandling,pa().setTemplateConfig(this.templateErrorHandling),B.log("Template errorHandling registered:",this.templateErrorHandling)),a.on("logout",()=>{B.log("User logged out")}),a.on("authStateChange",A=>{B.log("Auth state changed:",A)}),B.log("AuthManager event handlers registered");const g=$a(),m=this.config.templateType==="admin"?"admin":"user",b=a.getConfig(m);g.setOnUnauthorized(()=>{B.log("Unauthorized - redirecting to login page"),g.removeToken();const A=window.location.pathname+window.location.search,T=a.getLoginRedirectUrl(m,A,"session_expired");window.location.href=T}),B.log("ApiClient onUnauthorized callback registered"),this.layoutLoader=new ef(e),this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),B.log("LayoutLoader initialized:",this.layoutLoader);const v=new va({onUnauthorized:()=>{B.warn("Unauthorized request in error page")}});if(this.errorPageHandler=new P_({templateId:this.config.templateId,layoutLoader:this.layoutLoader,locale:this.config.locale,debug:this.config.debug,renderFunction:os,dataSourceManager:v,globalState:this.globalState}),B.log("ErrorPageHandler initialized with DataSourceManager"),await this.handleServerError()){B.log("Server error handled, skipping normal initialization");return}if(this.router=new U_(this.config.templateId),Array.isArray(u.routes)){const A=this.resolveRouteExpressions(u.routes);this.router.setRoutes(A)}else throw new Error("Invalid routes data format");B.log("Router initialized:",this.router),B.log("Routes set:",this.router.getRoutes());const{getActionDispatcher:S}=await Promise.resolve().then(()=>za),E=S();if(E&&(E.setDefaultContext({navigate:A=>this.router?.navigate(A)}),E.setGlobalStateUpdater((A,T)=>this.setGlobalState(A,T)),B.log("Navigate function and setGlobalState injected to ActionDispatcher")),await this.loadExtensionAssets(),this.reinitializeTemplateHandlers(),this.router.on("routeChange",A=>this.handleRouteChange(A)),this.router.on("routeNotFound",A=>this.handleRouteNotFound(A)),typeof window<"u"&&iy(window.location.pathname)){B.log("Layout editor mode detected — skipping router match"),await os({containerId:"app",layoutJson:{components:[]},dataContext:{},translationContext:{templateId:this.config.templateId,locale:this.config.locale}}),B.log("Template App initialized in layout editor mode");return}this.router.navigateToCurrentPath(),B.log("Template App initialized successfully")}catch(e){B.error("Initialization failed:",e),this.showInitError(e)}}async loadExtensionAssets(){try{const e=uf(),a=V_();if(!a){await this.loadExtensionAssetsIndividually();return}await e.loadBundle("module",a.moduleJs,a.moduleCss),await e.loadBundle("plugin",a.pluginJs,a.pluginCss),B.log("Extension bundle assets loaded successfully")}catch(e){B.warn("Failed to load extension assets:",e)}}async loadExtensionAssetsIndividually(){const e=uf(),a=G_();a.length>0&&(B.log("Loading module assets (individual fallback):",a.map(i=>i.identifier)),await e.loadActiveExtensionAssets(a));const r=F_();r.length>0&&(B.log("Loading plugin assets (individual fallback):",r.map(i=>i.identifier)),await e.loadActiveExtensionAssets(r))}async handleRouteChange(e){const a=++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(B.log("Route changed:",e,"requestId:",a),!this.layoutLoader)throw new Error("LayoutLoader is not initialized");if(!e.layout)throw new Error("Route layout is not defined");let r=e.layout;const i=r==="__preview__";i&&e.params?.token&&(r=`__preview__/${e.params.token}`);const l=await this.layoutLoader.loadLayout(this.config.templateId,r);if(a!==this.currentRouteChangeId){B.log("Route change cancelled (newer request exists):",a);return}B.log("Layout loaded:",l);const u=pa();l.errorHandling?(u.setLayoutConfig(l.errorHandling),B.log("Layout errorHandling registered:",l.errorHandling)):u.clearLayoutConfig();const d=l.data_sources||[],f=e.query||{},g=new URLSearchParams;for(const[te,he]of Object.entries(f))if(Array.isArray(he))for(const x of he)g.append(te,x);else g.set(te,he);const m={route:e.params||{},query:f,_global:this.globalState};l.scripts&&Array.isArray(l.scripts)&&await this.loadLayoutScripts(l.scripts,m);const{DataSourceManager:b,getActionDispatcher:v}=await Promise.resolve().then(()=>za),S=new b;if(i){const te=v();te&&te.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"}),B.log("Preview mode activated")}else{const te=v();te?.isPreviewMode()&&(te.setPreviewMode(!1),pc.hide("preview-mode"))}if(this.currentGlobalHeaders=l.globalHeaders||[],this.currentGlobalHeaders.length>0){S.setGlobalHeaders(this.currentGlobalHeaders);const te=v();te&&te.setGlobalHeaders(this.currentGlobalHeaders),B.log("globalHeaders set:",this.currentGlobalHeaders.map(he=>he.pattern))}if(l.named_actions&&Object.keys(l.named_actions).length>0){const te=v();te&&te.setNamedActions(l.named_actions)}const E=S.filterByCondition(d,m);d.length!==E.length&&B.log("Data sources filtered by condition:",{before:d.map(te=>te.id),after:E.map(te=>te.id)});const A=E.filter(te=>te.loading_strategy==="blocking"),T=E.filter(te=>(te.loading_strategy||"progressive")!=="blocking"&&te.type!=="websocket"),L=Array.isArray(l.transition_overlay?.wait_for)?l.transition_overlay.wait_for:[],M=L.length>0&&E.some(te=>L.includes(te.id)&&te.type!=="websocket"&&(te.loading_strategy||"progressive")!=="background");if((A.length>0||M)&&l.transition_overlay){const te=typeof l.transition_overlay=="boolean"?{enabled:l.transition_overlay,style:"opaque"}:l.transition_overlay;te.enabled&&te.style==="skeleton"&&te.skeleton?.component&&te.target?this.renderSkeletonOverlay(te.target,te.skeleton,l,te.fallback_target):te.enabled&&te.style==="spinner"&&te.target&&this.renderSpinnerOverlay(te.target,te.spinner,te.fallback_target)}let R={},D={},U={},j={};this.currentWebSocketSubscriptions.length>0&&(B.log("Unsubscribing previous WebSocket subscriptions:",this.currentWebSocketSubscriptions),S.unsubscribeWebSockets(this.currentWebSocketSubscriptions),this.currentWebSocketSubscriptions=[]),this.currentDataSources=E,this.currentRawDataSources=d,this.currentRouteParams=e.params||{},this.currentQueryParams=g,B.log(`handleRouteChange #${a} - queryObject:`,f),B.log(`handleRouteChange #${a} - queryParams:`,g.toString()),A.length>0&&(B.log("Fetching blocking data sources:",A.map(he=>he.id)),(await S.fetchDataSourcesWithResults(A,e.params||{},g)).forEach(he=>{if(he.state==="success"&&he.data!==void 0)R[he.id]=he.data;else if(he.state==="error"&&he.error){const x=he.error,K=x.response?.data?.message;D[he.id]={message:K||he.error.message,status:x.response?.status||x.status}}}),this.processInitOptions(A,R,U,j),this.currentFetchedData={...R},B.log("Blocking data loaded:",Object.keys(R)),Object.keys(D).length>0&&B.log("Data source errors:",D),Object.keys(U).length>0&&B.log("Local state init (blocking):",Object.keys(U)),Object.keys(j).length>0&&B.log("Isolated state init (blocking):",Object.keys(j)));const P=T.length>0;if(P&&(Na.setPending(!0),B.log("Transition started before rendering")),a!==this.currentRouteChangeId){B.log("Route change cancelled after blocking data (newer request exists):",a);return}const{getState:X}=await Promise.resolve().then(()=>za),ge=X().currentDataContext||{},Ee=T.map(te=>te.id),Ce={};if(P){Ee.forEach(he=>{ge[he]!==void 0?Ce[he]=ge[he]:Ce[he]=void 0});const te=Object.keys(Ce).filter(he=>Ce[he]!==void 0);te.length>0&&B.log("Preserving previous progressive data:",te),B.log("Progressive data sources initialized:",Ee)}const $e=l.defines||{},Pe={...Ce,...e.params,...R,route:{...e.params||{},path:e.path},query:f,_global:{...this.globalState},_globalSetState:te=>this.setGlobalState(te),_dataSourceErrors:Object.keys(D).length>0?D:void 0,_localInit:Object.keys(U).length>0?U:void 0,_isolatedInit:Object.keys(j).length>0?j:void 0,_defines:Object.keys($e).length>0?$e:void 0};if(l.computed&&Object.keys(l.computed).length>0){const te=this.calculateComputed(l.computed,Pe);Object.keys(te).length>0&&(Pe._computed=te,this.globalState._computed=te,B.log("Computed values calculated:",Object.keys(te))),Pe._computedDefinitions=l.computed}const Xe=l.layout_name||e.layout;this.currentLayoutName!==""&&this.currentLayoutName!==Xe&&(B.log("_local reset due to layout change:",{from:this.currentLayoutName,to:Xe}),this.globalState._local={},nC()),this.currentLayoutName=Xe;const Q=l.initLocal||l.state;if(Q&&Object.keys(Q).length>0){this.globalState._local||(this.globalState._local={});for(const[te,he]of Object.entries(Q))this.globalState._local[te]===void 0&&(this.globalState._local[te]=JSON.parse(JSON.stringify(he)));Pe._local={...this.globalState._local},B.log("initLocal applied to _local:",Object.keys(Q))}if(l.initGlobal&&Object.keys(l.initGlobal).length>0){for(const[te,he]of Object.entries(l.initGlobal))this.globalState[te]===void 0&&(this.globalState[te]=JSON.parse(JSON.stringify(he)));B.log("initGlobal applied to _global:",Object.keys(l.initGlobal))}if(l.initIsolated&&Object.keys(l.initIsolated).length>0){for(const[te,he]of Object.entries(l.initIsolated))j[te]===void 0&&(j[te]=JSON.parse(JSON.stringify(he)));B.log("initIsolated applied:",Object.keys(l.initIsolated))}Pe._global={...this.globalState,layoutWarnings:l.warnings||[]};const fe=l.initActions||l.init_actions;if(fe&&fe.length>0){await this.executeInitActions(fe,Pe),B.log("initActions executed before render");const te=this.globalState;if(te._local){if(Object.keys(U).length>0){for(const[he,x]of Object.entries(U))te._local[he]!==void 0?te._local[he]=this.deepMerge(te._local[he],x):te._local[he]=x;B.log("localInit merged into _local after initActions:",Object.keys(U))}Pe._local=te._local,B.log("_local merged into dataContext:",te._local)}if(Pe._global={...this.globalState,layoutWarnings:l.warnings||[]},B.log("_global merged into dataContext after initActions"),l.computed&&Object.keys(l.computed).length>0){const he=this.calculateComputed(l.computed,Pe);Object.keys(he).length>0&&(Pe._computed=he,this.globalState._computed=he,B.log("Computed values recalculated after init_actions:",Object.keys(he)))}if(Object.keys(this.currentFetchedData).length>0){for(const[he,x]of Object.entries(this.currentFetchedData))Pe[he]=x;B.log("Fetched data sources merged into dataContext after initActions:",Object.keys(this.currentFetchedData))}}if(l.transition_overlay&&!this.skeletonOverlayContainer&&this.showTransitionOverlay(l.transition_overlay,l),await os({containerId:"app",layoutJson:l,dataContext:Pe,translationContext:{templateId:this.config.templateId,locale:this.config.locale}}),B.log("Initial render complete with blocking data"),this.reattachSpinnerOverlay(),T.length>0){if(a!==this.currentRouteChangeId){B.log("Route change cancelled before progressive fetch (newer request exists):",a),Na.setPending(!1),this.hideTransitionOverlay();return}B.log("Fetching progressive/background data sources:",T.map(x=>x.id));const{updateTemplateData:te,getState:he}=await Promise.resolve().then(()=>za);try{const x=T.map(async K=>{try{const de=(await S.fetchDataSourcesWithResults([K],e.params||{},g,this.globalState))[0];if(!de){B.log(`Data source ${K.id} skipped (no fetch result)`);return}if(a!==this.currentRouteChangeId){B.log(`Data source ${K.id} fetch cancelled (newer request exists)`);return}if(de.state==="success"&&de.data!==void 0){B.log(`Progressive data source loaded: ${K.id}`),this.currentFetchedData[K.id]=de.data;const se={};this.processInitOptions([K],{[K.id]:de.data},se);const me=he();if(me.bindingEngine){const ve=[K.id];K.initGlobal&&ve.push("_global"),K.initLocal&&ve.push("_local"),me.bindingEngine.invalidateCacheByKeys(ve)}const Ne={[K.id]:de.data};Object.keys(se).length>0&&(Ne._localInit=se,Object.assign(U,se)),K.initGlobal&&(Ne._global={...this.globalState}),te(Ne)}else if(de.state==="error"&&de.error){const se=de.error,me=se.response?.data?.message;D[K.id]={message:me||de.error.message,status:se.response?.status||se.status},B.log(`Progressive data source error: ${K.id}`,D[K.id]),te({[K.id]:null,_dataSourceErrors:{...D}})}}catch(re){B.error(`Failed to fetch data source: ${K.id}`,re)}});if(await Promise.all(x),a!==this.currentRouteChangeId){B.log("Route change cancelled after progressive fetch (newer request exists):",a);return}B.log("All progressive data sources loaded")}finally{Na.setPending(!1),this.hideTransitionOverlay()}}else this.hideTransitionOverlay();const ye=E.filter(te=>te.type==="websocket");if(ye.length>0){B.log("Subscribing WebSocket data sources:",ye.map(K=>K.id));const{updateTemplateData:te,getState:he}=await Promise.resolve().then(()=>za),x={...this.currentFetchedData,...e.params,route:{...e.params||{},path:e.path},query:f,_global:{...this.globalState}};B.log("WebSocket binding context keys:",Object.keys(x)),this.currentWebSocketSubscriptions=S.subscribeWebSockets(E,(K,re)=>{B.log(`WebSocket data received for: ${K}`,re),this.currentFetchedData[K]=re;const de=E.find(ve=>ve.id===K),se=he();if(se.bindingEngine){const ve=[K];de?.initGlobal&&ve.push("_global"),de?.initLocal&&ve.push("_local"),se.bindingEngine.invalidateCacheByKeys(ve)}te({[K]:re});const Ne=E.find(ve=>ve.type==="websocket"&&(ve.target_source||ve.id)===K)?.onReceive;Array.isArray(Ne)&&Ne.length>0&&window.G7Core?.dispatch&&(async()=>{for(const He of Ne)try{const Ae=this.getActionDispatcher?.();Ae&&await Ae.dispatchAction(He,{navigate:this.getRouter?.()?(Et,Rt)=>this.getRouter().navigate(Et,Rt):void 0,setState:Et=>this.setGlobalState(Et),state:this.globalState,data:{...this.globalState,$args:[re],$event:re},_isDispatchFallbackContext:!0})}catch(Ae){B.error(`WebSocket onReceive action failed for ${K}:`,Ae)}})()},x),B.log("WebSocket subscriptions established:",this.currentWebSocketSubscriptions)}B.log("Layout rendered successfully")}catch(r){B.error("Route change handling failed:",r),this.hideTransitionOverlay(),this.showRouteError(r)}}processInitOptions(e,a,r,i){e.some(u=>u.refetchOnMount===!0&&u.initLocal)&&(r._forceLocalInit=Date.now(),B.log("refetchOnMount detected, forcing local state init")),e.forEach(u=>{const d=a[u.id];if(!d)return;const f=d.data??d;if(u.initLocal){if(typeof u.initLocal=="string"){let g=f;if(u.initLocalDefaults&&typeof u.initLocalDefaults=="object"){const b=this.evaluateDefaults(u.initLocalDefaults,a);g={...b,...f},B.log(`initLocalDefaults applied for ${u.initLocal}:`,Object.keys(b))}const m=this.globalState._local?.[u.initLocal];m!==void 0&&typeof m=="object"&&typeof g=="object"?(r[u.initLocal]=this.deepMerge(m,g),B.log(`initLocal (merged): ${u.id}.data -> _local.${u.initLocal}`)):(r[u.initLocal]=g,B.log(`initLocal: ${u.id}.data -> _local.${u.initLocal}`))}else if(typeof u.initLocal=="object"&&u.initLocal.key){const{key:g,path:m}=u.initLocal;let b=m?this.extractValueByPathOrExpression(f,m,u.id):f;if(u.initLocalDefaults&&typeof u.initLocalDefaults=="object"){const S=this.evaluateDefaults(u.initLocalDefaults,a);b={...S,...b},B.log(`initLocalDefaults applied for ${g}:`,Object.keys(S))}const v=this.globalState._local?.[g];v!==void 0&&typeof v=="object"&&typeof b=="object"?(r[g]=this.deepMerge(v,b),B.log(`initLocal (merged): ${u.id}.data${m?"."+m:""} -> _local.${g}`)):(r[g]=b,B.log(`initLocal: ${u.id}.data${m?"."+m:""} -> _local.${g}`))}else if(typeof u.initLocal=="object"){const g=u.initLocal._merge||"deep",m=this.flattenNestedObjectToMappings(u.initLocal);for(const{targetPath:b,sourcePath:v}of m){const S=this.extractValueByPathOrExpression(f,v,u.id);if(b.includes(".")){const E=b.split(".")[0];r[E]===void 0&&this.globalState._local?.[E]!==void 0&&(r[E]=JSON.parse(JSON.stringify(this.globalState._local[E]))),this.setValueAtPath(r,b,S,g),B.log(`initLocal map (${g}): ${u.id} ${v} -> _local.${b}`)}else{const E=this.globalState._local?.[b];g==="replace"?(r[b]=S,B.log(`initLocal map (replace): ${u.id} ${v} -> _local.${b}`)):g==="shallow"?E!==void 0&&typeof E=="object"&&typeof S=="object"?(r[b]={...E,...S},B.log(`initLocal map (shallow): ${u.id} ${v} -> _local.${b}`)):(r[b]=S,B.log(`initLocal map: ${u.id} ${v} -> _local.${b}`)):E!==void 0&&typeof E=="object"&&typeof S=="object"?(r[b]=this.deepMerge(E,S),B.log(`initLocal map (deep): ${u.id} ${v} -> _local.${b}`)):(r[b]=S,B.log(`initLocal map: ${u.id} ${v} -> _local.${b}`))}}}}if(u.initGlobal)if(typeof u.initGlobal=="object"&&!Array.isArray(u.initGlobal)&&!("key"in u.initGlobal))for(const[m,b]of Object.entries(u.initGlobal)){if(typeof b!="string"){B.warn(`initGlobal map value must be string, got ${typeof b} for key ${m}`);continue}const v=this.extractValueByPathOrExpression(f,b,u.id),S=this.globalState[m];S!==void 0&&typeof S=="object"&&typeof v=="object"?(this.globalState[m]=this.deepMerge(S,v),B.log(`initGlobal map (merged): ${u.id} ${b} -> _global.${m}`)):(this.globalState[m]=v,B.log(`initGlobal map: ${u.id} ${b} -> _global.${m}`))}else{const m=Array.isArray(u.initGlobal)?u.initGlobal:[u.initGlobal];for(const b of m)if(typeof b=="string"){const v=this.globalState[b];v!==void 0&&typeof v=="object"&&typeof f=="object"?(this.globalState[b]=this.deepMerge(v,f),B.log(`initGlobal (merged): ${u.id}.data -> _global.${b}`)):(this.globalState[b]=f,B.log(`initGlobal: ${u.id}.data -> _global.${b}`))}else if(typeof b=="object"&&b.key){const{key:v,path:S}=b,E=S?this.extractValueByPathOrExpression(f,S,u.id):f,A=this.globalState[v];A!==void 0&&typeof A=="object"&&typeof E=="object"?(this.globalState[v]=this.deepMerge(A,E),B.log(`initGlobal (merged): ${u.id}.data${S?"."+S:""} -> _global.${v}`)):(this.globalState[v]=E,B.log(`initGlobal: ${u.id}.data${S?"."+S:""} -> _global.${v}`))}}if(i&&u.initIsolated){if(typeof u.initIsolated=="string"){const g=i[u.initIsolated];g!==void 0&&typeof g=="object"&&typeof f=="object"?(i[u.initIsolated]=this.deepMerge(g,f),B.log(`initIsolated (merged): ${u.id}.data -> _isolated.${u.initIsolated}`)):(i[u.initIsolated]=f,B.log(`initIsolated: ${u.id}.data -> _isolated.${u.initIsolated}`))}else if(typeof u.initIsolated=="object"&&u.initIsolated.key){const{key:g,path:m}=u.initIsolated,b=m?this.extractValueByPathOrExpression(f,m,u.id):f,v=i[g];v!==void 0&&typeof v=="object"&&typeof b=="object"?(i[g]=this.deepMerge(v,b),B.log(`initIsolated (merged): ${u.id}.data${m?"."+m:""} -> _isolated.${g}`)):(i[g]=b,B.log(`initIsolated: ${u.id}.data${m?"."+m:""} -> _isolated.${g}`))}else if(typeof u.initIsolated=="object")for(const[g,m]of Object.entries(u.initIsolated)){if(typeof m!="string"){B.warn(`initIsolated map value must be string, got ${typeof m} for key ${g}`);continue}const b=this.extractValueByPathOrExpression(f,m,u.id),v=i[g];v!==void 0&&typeof v=="object"&&typeof b=="object"?(i[g]=this.deepMerge(v,b),B.log(`initIsolated map (merged): ${u.id} ${m} -> _isolated.${g}`)):(i[g]=b,B.log(`initIsolated map: ${u.id} ${m} -> _isolated.${g}`))}}})}evaluateDefaults(e,a){const r={};for(const[i,l]of Object.entries(e))if(typeof l=="string"&&l.startsWith("{{")&&l.endsWith("}}")){const u=l.slice(2,-2).trim();r[i]=this.evaluateExpression(u,a)}else r[i]=l;return r}evaluateExpression(e,a){try{const r=e.split("??").map(i=>i.trim());for(const i of r){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 l=this.getNestedValue(a,i);if(l!=null)return l}return}catch(r){B.warn(`Expression evaluation failed: ${e}`,r);return}}getNestedValue(e,a){const r=a.replace(/\?\./g,".");let i=e;const l=r.split(/\.(?![^\[]*\])/).flatMap(u=>{const d=u.match(/^([^\[]*)((?:\[\d+\])*)$/);if(d){const[,f,g]=d,m=[];f&&m.push(f);const b=g.match(/\[\d+\]/g);return b&&m.push(...b),m}return[u]}).filter(u=>u!=="");for(const u of l){if(i==null)return;if(u.startsWith("[")&&u.endsWith("]")){const d=parseInt(u.slice(1,-1),10);i=i[d]}else i=i[u]}return i}extractValueByPathOrExpression(e,a,r){const i=a.match(/^\{\{(.+)\}\}$/);if(i){const l=i[1].trim(),u=new wn,d={data:e,_global:this.globalState,_local:this.globalState._local||{}};try{const f=u.evaluateExpression(l,d);return B.log(`initLocal/initGlobal expression evaluated: ${a} -> `,f),f}catch(f){B.warn(`initLocal/initGlobal expression evaluation failed for ${r}:`,a,f);return}}return this.getNestedValue(e,a)}async loadLayoutScripts(e,a){const r=[];for(const i of e){if((i.if!==void 0||i.conditions!==void 0)&&!Yi({if:i.if,conditions:i.conditions},a,this.bindingEngine,`script:${i.id}`)){B.log(`Script skipped (condition not met): ${i.id}`);continue}if(document.getElementById(i.id)){B.log(`Script already loaded: ${i.id}`);continue}const u=new Promise((d,f)=>{const g=document.createElement("script");g.src=i.src,g.id=i.id,g.async=i.async??!0,g.onload=()=>{B.log(`Script loaded successfully: ${i.id}`),d()},g.onerror=()=>{B.warn(`Failed to load script: ${i.id} (${i.src})`),d()},document.head.appendChild(g)});r.push(u)}r.length>0&&(await Promise.all(r),B.log(`All scripts loaded: ${e.filter(i=>!document.getElementById(i.id)||r.length>0).map(i=>i.id).join(", ")}`))}evaluateScriptCondition(e,a){try{if(e.startsWith("{{")&&e.endsWith("}}")){const r=e.slice(2,-2).trim();return new Function("ctx",`
|
||
with(ctx) {
|
||
try {
|
||
return Boolean(${r});
|
||
} catch (e) {
|
||
return false;
|
||
}
|
||
}
|
||
`)(a)}return!!e}catch(r){return B.warn(`Failed to evaluate script condition: ${e}`,r),!1}}showInitError(e){if(ed()){B.warn("Init failed while document is unloading — skipping error screen",e);return}const a=ry(e);lf.renderFromError("app",a,"초기화 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}showTransitionOverlay(e,a){const r=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(!r.enabled)return;if(this.hideTransitionOverlay(),r.style==="skeleton"&&r.skeleton?.component&&r.target&&a){this.renderSkeletonOverlay(r.target,r.skeleton,a,r.fallback_target);return}if(r.style==="spinner"&&r.target){this.renderSpinnerOverlay(r.target,r.spinner,r.fallback_target);return}const i=document.documentElement.classList.contains("dark");let l,u="";switch(r.style){case"blur":l=i?"rgba(17,24,39,0.3)":"rgba(255,255,255,0.3)",u="backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);";break;case"fade":l=i?"rgba(17,24,39,0.8)":"rgba(255,255,255,0.8)";break;case"skeleton":l=i?"rgb(17,24,39)":"rgb(249,250,251)";break;default:l=i?"rgb(17,24,39)":"rgb(249,250,251)";break}if(r.target){const d=`#${CSS.escape(r.target)}`,f=document.createElement("style");f.id="g7-transition-overlay",f.textContent=`${d}{position:relative;z-index:0;}${d}::after{content:'';position:absolute;inset:0;background:${l};${u}z-index:2147483647;pointer-events:none;}`,document.head.appendChild(f),this.transitionOverlayEl=f}else{const d=document.createElement("div");d.id="g7-transition-overlay",d.setAttribute("aria-hidden","true"),d.style.position="fixed",d.style.inset="0",d.style.zIndex="9999",d.style.pointerEvents="none",d.style.background=l;for(const f of u.split(";")){const g=f.indexOf(":");g!==-1&&d.style.setProperty(f.slice(0,g).trim(),f.slice(g+1).trim())}document.body.appendChild(d),this.transitionOverlayEl=d}}hideTransitionOverlay(){this.transitionOverlayEl&&(this.transitionOverlayEl.remove(),this.transitionOverlayEl=null),this.hideSkeletonOverlay()}renderSkeletonOverlay(e,a,r,i){const u=da.getInstance().getComponent(a.component);if(!u){B.log(`Skeleton component "${a.component}" not found in registry, falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}let d=document.getElementById(e),f="target";if(!d&&i&&(d=document.getElementById(i),f="fallback"),d||(d=document.getElementById("app"),f="fullpage"),!d){B.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 m=document.documentElement.classList.contains("dark")?"rgb(17,24,39)":"rgb(249,250,251)",b=f==="fullpage"?"app":f==="fallback"?i:e,v=`#${CSS.escape(b)}`,S=document.createElement("style");S.id="g7-skeleton-overlay-style",S.textContent=`${v}{position:relative;z-index:0;}${v}::after{content:'';position:absolute;inset:0;background:${m};z-index:2147483646;pointer-events:none;}`,document.head.appendChild(S),this.transitionOverlayEl=S;const E=document.createElement("div");if(E.id="g7-skeleton-overlay",E.setAttribute("role","status"),E.setAttribute("aria-busy","true"),E.setAttribute("aria-label","Loading..."),f==="fullpage")E.style.cssText=["position:fixed","inset:0","z-index:20","overflow:hidden","pointer-events:none",`background:${m}`].join(";")+";";else{const R=d.getBoundingClientRect(),D=window.scrollX||document.documentElement.scrollLeft,U=window.scrollY||document.documentElement.scrollTop;E.style.cssText=["position:absolute",`top:${R.top+U}px`,`left:${R.left+D}px`,`width:${R.width}px`,`height:${R.height}px`,"z-index:20","overflow:hidden","pointer-events:none",`background:${m}`].join(";")+";"}document.body.appendChild(E),this.skeletonOverlayContainer=E;const A=r.components||[];let T;if(f==="fullpage")T=A;else{const R=f==="fallback"?i:e;T=this.findComponentChildrenById(A,R)}const L=Xu.createRoot(E);this.skeletonOverlayRoot=L,Ar.flushSync(()=>{L.render(Ye.createElement(u,{components:T,options:{animation:a.animation||"pulse",iteration_count:a.iteration_count||5}}))});const M=f==="fullpage"?"fullpage (#app)":f==="fallback"?`fallback (#${i})`:`target (#${e})`;B.log(`Skeleton overlay rendered [${M}] with "${a.component}" (${T.length} components)`)}findComponentChildrenById(e,a){const r=i=>{for(const l of i){if(l.id===a)return l.children||[];if(l.children&&Array.isArray(l.children)){const u=r(l.children);if(u!==null)return u}}return null};return r(e)||e}renderSpinnerOverlay(e,a,r){let i=document.getElementById(e),l="target";if(!i&&r&&(i=document.getElementById(r),l="fallback"),i||(i=document.getElementById("app"),l="fullpage"),!i){B.log(`Spinner overlay: no target found (target="#${e}", fallback="${r||"none"}"), falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}this.hideSkeletonOverlay();const u=l==="fullpage"?"app":l==="fallback"?r:e,d=`#${CSS.escape(u)}`,f=document.createElement("style");f.id="g7-skeleton-overlay-style",f.textContent=[`${d}{position:relative;}`,"@keyframes g7-spin{to{transform:rotate(360deg)}}"].join(""),document.head.appendChild(f),this.transitionOverlayEl=f;const g=a?.text||window.G7Core?.t?.("nav.loading")||"";this._spinnerState={target:e,fallbackTarget:r,spinnerConfig:a,resolvedText:g},this._mountSpinnerInTarget(i);const m=l==="fullpage"?"fullpage (#app)":l==="fallback"?`fallback (#${r})`:`target (#${e})`,b=a?.component||"default spinner";B.log(`Spinner overlay rendered [${m}] with "${b}"`)}_mountSpinnerInTarget(e){if(!this._spinnerState)return;const{spinnerConfig:a,resolvedText:r}=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,a?.component){const u=da.getInstance().getComponent(a.component);if(u){const d=Xu.createRoot(i);this.skeletonOverlayRoot=d,Ar.flushSync(()=>{d.render(Ye.createElement(u,{options:{text:r}}))});return}B.log(`Spinner component "${a.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:a}=this._spinnerState;let r=document.getElementById(e);!r&&a&&(r=document.getElementById(a)),r||(r=document.getElementById("app")),r&&(this._mountSpinnerInTarget(r),B.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 ba&&e.details?.status===401){const r=this.config.templateId||"",i=window.location.pathname,l=r.includes("admin")||i.startsWith("/admin")?"admin":"user",u=i+window.location.search,d=!!$a().getToken()||e.details?.hadToken===!0,f=ha.getInstance().getLoginRedirectUrl(l,u,d?"session_expired":void 0);window.location.href=f;return}const a=ry(e);lf.renderFromError("app",a,"페이지 로딩 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}async handleServerError(){const e=window.G7Error;if(!e)return!1;B.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"))?(B.log(`${e.code} error page rendered successfully`),!0):(B.log(`Falling back to ErrorDisplay for ${e.code}`),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0)}catch(a){return B.error(`Failed to render ${e.code} page:`,a),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0}}async handleRouteNotFound(e){B.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"))){B.log("404 error page rendered successfully");return}B.log("Falling back to ErrorDisplay for 404"),this.showRouteError(new Error(`Page not found: ${e}`))}catch(a){B.error("Failed to render 404 page:",a),this.showRouteError(new Error(`Page not found: ${e}`))}}getRouter(){return this.router}getConfig(){return this.config}getLayoutLoader(){return this.layoutLoader}async reloadExtensionState(){B.log("reloadExtensionState: start");let e;try{const a=await fetch(La(`/api/templates/${this.config.templateId}/config`,"json",null,`_=${Date.now()}`));if(a.ok){const r=await a.json();r?.success&&r?.data?.cache_version!==void 0&&(e=r.data.cache_version)}}catch(a){B.warn("reloadExtensionState: failed to fetch config.json",a)}e!==void 0&&e!==this.extensionCacheVersion&&(B.log(`reloadExtensionState: cache version ${this.extensionCacheVersion} -> ${e}`),this.extensionCacheVersion=e,this.saveCacheVersionToStorage(e));try{this.router&&(await this.router.loadRoutes(this.extensionCacheVersion),B.log("reloadExtensionState: routes reloaded"))}catch(a){B.error("reloadExtensionState: routes reload failed",a)}try{this.layoutLoader&&(this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),this.layoutLoader.clear(),B.log("reloadExtensionState: layout cache cleared"))}catch(a){B.error("reloadExtensionState: layout cache clear failed",a)}try{const{TranslationEngine:a}=await Promise.resolve().then(()=>ep),r=a.getInstance();this.extensionCacheVersion>0&&r.setCacheVersion(this.extensionCacheVersion);const i=this.config.locale||"ko",l="en";await r.loadTranslations(this.config.templateId,i,"/api",!0),i!==l&&await r.loadTranslations(this.config.templateId,l,"/api",!0),B.log("reloadExtensionState: translations reloaded")}catch(a){B.error("reloadExtensionState: translations reload failed",a)}try{const a=await fetch(`/api/locales/active?_=${Date.now()}`);if(a.ok){const i=(await a.json())?.data?.locales;if(Array.isArray(i)&&i.length>0){const l=this.globalState.appConfig??{};this.setGlobalState({appConfig:{...l,supportedLocales:i}}),B.log("reloadExtensionState: supportedLocales refreshed",i)}}}catch(a){B.warn("reloadExtensionState: supportedLocales refresh failed",a)}B.log("reloadExtensionState: done")}getActionDispatcher(){return Za().actionDispatcher}async changeLocale(e){try{if(B.log("Changing locale to:",e),this.config.locale===e){B.log("Locale is already",e);return}this.config.locale=e,this.saveLocaleToStorage(e),await this.saveLocaleToDatabase(e),this.layoutLoader&&(this.layoutLoader.clear(),B.log("Layout cache cleared")),this.errorPageHandler&&(this.errorPageHandler.updateLocale(e),B.log("ErrorPageHandler locale updated")),mc(),await _o({templateId:this.config.templateId,templateType:this.config.templateType,locale:e,debug:this.config.debug,cacheVersion:this.extensionCacheVersion}),B.log("Template Engine re-initialized with new locale");const{getActionDispatcher:a}=await Promise.resolve().then(()=>za),r=a();r&&(r.setDefaultContext({navigate:i=>this.router?.navigate(i)}),r.setGlobalStateUpdater((i,l)=>this.setGlobalState(i,l)),B.log("Navigate function and setGlobalState re-injected to ActionDispatcher")),this.reinitializeModuleHandlers(),B.log("Module handlers re-initialized"),this.reinitializeTemplateHandlers(),B.log("Template handlers re-initialized"),this.reinitializePluginHandlers(),B.log("Plugin handlers re-initialized"),this.router&&this.router.navigateToCurrentPath(),B.log("Locale changed successfully to",e)}catch(a){throw B.error("Failed to change locale:",a),a}}loadLocaleFromStorage(){try{return localStorage.getItem(Ca.LOCALE_STORAGE_KEY)}catch(e){return B.warn("Failed to load locale from storage:",e),null}}saveLocaleToStorage(e){try{localStorage.setItem(Ca.LOCALE_STORAGE_KEY,e)}catch(a){B.warn("Failed to save locale to storage:",a)}}async saveLocaleToDatabase(e){const a=localStorage.getItem("auth_token");if(!a){B.log("No auth token, skipping DB locale save");return}let r,i;if(this.config.localeApi)r=this.config.localeApi.endpoint,i=this.config.localeApi.method;else{const l=this.config.templateType==="admin";r=l?"/api/admin/users/me/language":"/api/user/profile/update-language",i=l?"PATCH":"POST"}try{const l=this.getXsrfToken(),u=await fetch(r,{method:i,headers:{"Content-Type":"application/json",Accept:"application/json",...l&&{"X-XSRF-TOKEN":l},Authorization:`Bearer ${a}`},credentials:"include",body:JSON.stringify({language:e})});u.ok?B.log("Locale saved to DB:",e):B.warn("Failed to save locale to DB (UI will still change):",u.statusText)}catch(l){B.warn("Failed to call locale API (UI will still change):",l)}}getXsrfToken(){if(typeof document>"u")return null;const a=`; ${document.cookie}`.split("; XSRF-TOKEN=");return a.length===2?decodeURIComponent(a.pop()?.split(";").shift()||""):null}loadCacheVersionFromStorage(){try{const e=localStorage.getItem(Ca.CACHE_VERSION_STORAGE_KEY);return e?parseInt(e,10):null}catch(e){return B.warn("Failed to load cache version from storage:",e),null}}saveCacheVersionToStorage(e){try{localStorage.setItem(Ca.CACHE_VERSION_STORAGE_KEY,String(e))}catch(a){B.warn("Failed to save cache version to storage:",a)}}reinitializeModuleHandlers(){if(typeof window>"u")return;const e="__",a=window;Object.keys(a).forEach(r=>{if(r.startsWith(e)&&typeof a[r]?.initModule=="function")try{a[r].initModule(),B.log(`Module handler re-initialized: ${r}`)}catch(i){B.warn(`Failed to re-initialize module handlers for ${r}:`,i)}})}reinitializeTemplateHandlers(){if(typeof window>"u")return;const e=window.G7TemplateHandlers;if(!e){B.warn("Template handlers not found on window.G7TemplateHandlers");return}const a=this.getActionDispatcher();if(!a){B.warn("ActionDispatcher not available for template handler registration");return}Object.entries(e).forEach(([r,i])=>{a.registerHandler(r,i)}),B.log(`${Object.keys(e).length} template handler(s) re-registered:`,Object.keys(e))}reinitializePluginHandlers(){if(typeof window>"u")return;const e="__",a=window;Object.keys(a).forEach(r=>{if(r.startsWith(e)&&typeof a[r]?.initPlugin=="function")try{a[r].initPlugin(),B.log(`Plugin handler re-initialized: ${r}`)}catch(i){B.warn(`Failed to re-initialize plugin handlers for ${r}:`,i)}})}getLocale(){return this.config.locale}getErrorPageHandler(){return this.errorPageHandler}getGlobalState(){return{...this.globalState}}setGlobalState(e,a){const r={...this.globalState};typeof e=="function"?this.globalState=e(this.globalState):this.globalState={...this.globalState,...e},B.log("Global state updated:",this.globalState),window.G7Core?.devTools?.captureStateSnapshot?.({source:"setGlobalState",prev:r,next:this.globalState}),this.globalStateListeners.forEach(l=>{l(this.globalState)}),a?.render!==!1&&Promise.resolve().then(()=>za).then(({updateTemplateData:l,getState:u})=>{const d=u();d.reactRoot&&d.currentLayoutJson&&l({_global:{...this.globalState},_local:this.globalState._local||{}})})}onGlobalStateChange(e){this.globalStateListeners.add(e)}offGlobalStateChange(e){this.globalStateListeners.delete(e)}async refetchDataSource(e,a){let r=this.currentDataSources.find(i=>i.id===e);if(!r)for(const[,i]of this.modalDataSources){const l=i.find(u=>u.id===e);if(l){r=l;break}}if(!r){B.warn(`Data source not found: ${e}`);return}B.log(`Refetching data source: ${e}`,a?.sync?"(sync mode)":"",a?.globalStateOverride?"(with global override)":"",a?.localStateOverride?"(with local override)":""),Na.setPending(!0);try{const i=new va;this.currentGlobalHeaders.length>0&&i.setGlobalHeaders(this.currentGlobalHeaders);const l=Za(),u=l.currentDataContext?._global||{},d=a?.globalStateOverride?{...u,...a.globalStateOverride}:u,f=l.currentDataContext?._local||{},g=a?.localStateOverride?{...f,...a.localStateOverride}:f,b=(await i.fetchDataSourcesWithResults([r],this.currentRouteParams,this.currentQueryParams,d,g,{ignoreAutoFetch:!0}))[0];if(b.state==="success"&&b.data!==void 0){this.currentFetchedData[e]=b.data;const v={};this.processInitOptions([r],{[e]:b.data},v);const S=Za();if(S.bindingEngine){const A=[e];r.initGlobal&&A.push("_global"),r.initLocal&&A.push("_local"),S.bindingEngine.invalidateCacheByKeys(A)}const E={[e]:b.data};return Object.keys(v).length>0&&(E._localInit=v),r.initGlobal&&(E._global={...this.globalState}),ls(E,a?.sync?{sync:!0}:void 0),B.log(`Data source refetched successfully: ${e}`),b.data}else if(b.state==="error"){B.error(`Failed to refetch data source: ${e}`,b.error);return}}catch(i){B.error(`Error refetching data source: ${e}`,i);return}finally{Na.setPending(!1)}}registerModalDataSources(e,a){this.modalDataSources.set(e,a),B.log(`Modal data sources registered: ${e} (${a.length} sources)`)}unregisterModalDataSources(e){this.modalDataSources.delete(e),B.log(`Modal data sources unregistered: ${e}`)}getDataSource(e){return this.currentFetchedData[e]}setDataSource(e,a,r){if(!e){B.warn("setDataSource: dataSourceId is required");return}const{merge:i=!1,sync:l=!1}=r||{};i&&this.currentFetchedData[e]?this.currentFetchedData[e]={...this.currentFetchedData[e],...a}:this.currentFetchedData[e]=a,Promise.resolve().then(()=>za).then(({updateTemplateData:u})=>{u({[e]:this.currentFetchedData[e]},l?{sync:!0}:void 0)}),B.log(`setDataSource: Updated ${e}`,i?"(merged)":"(replaced)")}updateDataSourceItem(e,a,r,i,l){const{idField:u="id",merge:d=!0,skipRender:f=!1}=l||{},g=this.currentFetchedData[e];if(!g)return B.warn(`updateDataSourceItem: DataSource '${e}' not found`),!1;const m=this.parseItemPath(a);let b=g;for(const E of m)if(b=b?.[E],b===void 0)return B.warn(`updateDataSourceItem: Path '${a}' not found in dataSource`),!1;if(!Array.isArray(b))return B.warn(`updateDataSourceItem: Target at '${a}' is not an array`),!1;const v=b.findIndex(E=>String(E[u])===String(r));if(v===-1)return B.warn(`updateDataSourceItem: Item with ${u}='${r}' not found`),!1;d?b[v]=this.deepMerge(b[v],i):b[v]={...b[v],...i};const S=window.G7Core?.devTools;return S?.isEnabled?.()&&S.trackDataSourceUpdate?.({dataSourceId:e,updateType:"partial",itemPath:a,itemId:r,updates:i,timestamp:Date.now()}),f||Promise.resolve().then(()=>za).then(({updateTemplateData:E})=>{E({[e]:this.currentFetchedData[e]},{sync:!1})}),B.log(`updateDataSourceItem: Updated ${e}.${a}[${u}=${r}]`),!0}parseItemPath(e){const a=[],r=/([^\.\[\]]+)|\[(\d+)\]/g;let i;for(;(i=r.exec(e))!==null;)i[1]!==void 0?a.push(i[1]):i[2]!==void 0&&a.push(parseInt(i[2],10));return a}deepMerge(e,a){if(a==null)return e;if(typeof a!="object"||Array.isArray(a))return a;const r={...e};for(const i of Object.keys(a))typeof a[i]=="object"&&a[i]!==null&&!Array.isArray(a[i])?r[i]=this.deepMerge(r[i]||{},a[i]):r[i]=a[i];return r}setValueAtPath(e,a,r,i="deep"){const l=a.split(".");let u=e;for(let g=0;g<l.length-1;g++){const m=l[g];(u[m]===void 0||u[m]===null||typeof u[m]!="object")&&(u[m]={}),u=u[m]}const d=l[l.length-1],f=u[d];i==="replace"||f===void 0?u[d]=r:i==="shallow"?typeof f=="object"&&typeof r=="object"&&!Array.isArray(r)?u[d]={...f,...r}:u[d]=r:typeof f=="object"&&typeof r=="object"&&!Array.isArray(r)?u[d]=this.deepMerge(f,r):u[d]=r}flattenNestedObjectToMappings(e,a=""){const r=[];for(const[i,l]of Object.entries(e)){if(i==="_merge")continue;const u=a?`${a}.${i}`:i;typeof l=="string"?r.push({targetPath:u,sourcePath:l}):typeof l=="object"&&l!==null&&!Array.isArray(l)&&r.push(...this.flattenNestedObjectToMappings(l,u))}return r}async updateQueryParams(e,a){B.log("updateQueryParams:",e);const r=new URL(e,window.location.origin),i=new URLSearchParams(r.search);window.history.replaceState(null,"",e),B.log("URL updated via replaceState"),this.currentQueryParams=i,B.log("currentQueryParams updated:",Object.fromEntries(i.entries()));const l=new va,u=Za().currentDataContext?._global||this.globalState||{},d={route:this.currentRouteParams||{},query:sy(this.currentQueryParams),_global:u},f=Array.isArray(this.currentRawDataSources)&&this.currentRawDataSources.length>0?l.filterByCondition(this.currentRawDataSources,d):this.currentDataSources;this.currentDataSources=f;const g=f.filter(A=>A.auto_fetch!==!1&&A.type!=="websocket");if(g.length===0){B.log("No auto_fetch data sources to refetch");return}B.log(`Refetching ${g.length} auto_fetch data sources`),Na.setPending(!0);const m=Za().currentLayoutJson,b=m?.transition_overlay,v=Array.isArray(b?.wait_for)?b.wait_for:[],S=g.some(A=>(A.loading_strategy||"progressive")==="blocking"),E=v.length>0&&g.some(A=>v.includes(A.id)&&A.type!=="websocket"&&(A.loading_strategy||"progressive")!=="background");if((S||E)&&b&&typeof b=="object"){const A=a?.transitionOverlayTarget||b.target;b.enabled&&b.style==="skeleton"&&b.skeleton?.component&&A?this.renderSkeletonOverlay(A,b.skeleton,m,b.fallback_target):b.enabled&&b.style==="spinner"&&A&&this.renderSpinnerOverlay(A,b.spinner,b.fallback_target)}try{const A=new va;this.currentGlobalHeaders.length>0&&A.setGlobalHeaders(this.currentGlobalHeaders);const T=Za(),L=T.currentDataContext?._global||{},M=await A.fetchDataSourcesWithResults(g,this.currentRouteParams,this.currentQueryParams,L,void 0,{ignoreAutoFetch:!1}),R={},D={},U=new Map(g.map(j=>[j.id,j]));for(const j of M){const P=U.get(j.id);if(!P){B.warn(`Refetch result id not found in autoFetchDataSources: ${j.id}`);continue}const X=j.id;j.state==="success"&&j.data!==void 0?(this.currentFetchedData[X]=j.data,R[X]=j.data,this.processInitOptions([P],{[X]:j.data},D),B.log(`Data source refetched: ${X}`)):j.state==="error"&&B.error(`Failed to refetch data source: ${X}`,j.error)}if(T.bindingEngine){const j=Object.keys(R);j.push("query"),T.bindingEngine.invalidateCacheByKeys(j)}if(Object.keys(D).length>0&&(R._localInit=D),Object.keys(R).length>0){if(R.query=sy(this.currentQueryParams),T.currentLayoutJson?.computed&&Object.keys(T.currentLayoutJson.computed).length>0){const j={...T.currentDataContext,...R,query:R.query},P=this.calculateComputed(T.currentLayoutJson.computed,j);Object.keys(P).length>0&&(R._computed=P,this.globalState._computed=P,B.log("Computed values recalculated in updateQueryParams:",Object.keys(P)))}ls(R,{sync:!0}),B.log("Template data updated with new query params")}}catch(A){B.error("Error in updateQueryParams:",A)}finally{Na.setPending(!1),this.hideTransitionOverlay()}}calculateComputed(e,a){const r={},i=new wn;for(const[l,u]of Object.entries(e))try{let d;if(this.isComputedSwitchDefinition(u))d=i.resolveSwitch(u,a,{skipCache:!0});else if(typeof u=="string")if(u.startsWith("{{")&&u.endsWith("}}")){const f=u.slice(2,-2).trim();d=this.evaluateComputedExpression(f,a)}else d=u;r[l]=d,B.log(`Computed ${l}:`,d)}catch(d){B.warn(`Failed to calculate computed value: ${l}`,d),r[l]=void 0}return r}isComputedSwitchDefinition(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}evaluateComputedExpression(e,a){try{return new Function("ctx",`
|
||
with(ctx) {
|
||
try {
|
||
return ${e};
|
||
} catch (e) {
|
||
return undefined;
|
||
}
|
||
}
|
||
`)(a)}catch(r){B.warn(`Expression evaluation failed: ${e}`,r);return}}async executeInitActions(e,a={}){const{getActionDispatcher:r}=await Promise.resolve().then(()=>za),i=r();if(!i){B.warn("ActionDispatcher not available for init_actions");return}B.log("Executing init_actions:",e.map(d=>d.handler)),B.log("Init actions dataContext:",a),B.log("Init actions dataContext._global:",a._global);const l=e.map(d=>d.handler).filter(d=>d.includes("."));l.length>0&&await this.waitForHandlers(i,l);let u={...a};for(const d of e)try{const f={type:"click",handler:d.handler,target:d.target,params:d.params,resultTo:d.resultTo,onSuccess:d.onSuccess,onError:d.onError,if:d.if,conditions:d.conditions,auth_mode:d.auth_mode,auth_required:d.auth_required},g=i.createHandler(f,u),m=new Event("init");await g(m),B.log(`Init action executed: ${d.handler}`);const b=this.globalState;u={...u,_global:{...b},_local:b._local||u._local||{}},B.log(`Data context refreshed after ${d.handler}:`,{cartKey:u._global?.cartKey})}catch(f){B.error(`Failed to execute init action: ${d.handler}`,f)}}async waitForHandlers(e,a,r=5e3){const i=Date.now(),l=50,u=()=>a.every(f=>e.customHandlers?.has(f));if(u()){B.log("All module handlers already registered");return}const d=uf().getFailedJsAssets();if(d.length>0){const f=d.some(b=>b==="module"||b==="plugin"),g=a.filter(b=>!e.customHandlers?.has(b)),m=g.length>0&&g.every(b=>d.some(v=>b.startsWith(`${v}.`)));if(f||m){B.warn("Extension asset load failed — not waiting for handlers that will never register:",{pending:g,failedAssets:d});return}}return B.log("Waiting for module handlers:",a),new Promise(f=>{const g=()=>{if(u()){B.log("All module handlers now registered"),f();return}if(Date.now()-i>=r){const m=a.filter(b=>!e.customHandlers?.has(b));B.warn("Timeout waiting for handlers:",m),f();return}setTimeout(g,l)};g()})}};$(Ca,"LOCALE_STORAGE_KEY","g7_locale"),$(Ca,"CACHE_VERSION_STORAGE_KEY","g7_cache_version");let vo=Ca;function ff(o){const e=new vo(o);return o.websocket&&(fc.configure(o.websocket),B.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=ff,window.G7Core.dataSource={refetch:async(o,e)=>{const a=window.__templateApp;if(!a){B.warn("TemplateApp not initialized (G7Core.dataSource.refetch)");return}return a.refetchDataSource(o,e)},get:o=>{const e=window.__templateApp;if(!e){B.warn("TemplateApp not initialized (G7Core.dataSource.get)");return}return e.getDataSource(o)}});function K_(o={}){const{checked:e,value:a,name:r,type:i="checkbox"}=o,u=a!==void 0?a:i==="checkbox"||i==="radio"?e??!1:String(e??""),d={checked:e??!1,value:u,name:r??"",type:i};return{target:d,currentTarget:d,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 W_(o={}){const{button:e=0,clientX:a=0,clientY:r=0}=o;return{button:e,clientX:a,clientY:r,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 Y_(){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 X_(o,e="keydown"){return{key:o,code:o.length===1?`Key${o.toUpperCase()}`:o,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new KeyboardEvent(e,{key:o}),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 J_={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 oy(o){const e=o.replace(/^(dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+/,"");for(const[a,r]of Object.entries(J_))if(r.test(e))return a;return null}function ly(o){const e=o.match(/^((dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+)/);return e?e[1]:""}function Q_(o,e){if(!e||e.trim()==="")return o;if(!o||o.trim()==="")return e;const a=o.split(/\s+/).filter(Boolean),r=e.split(/\s+/).filter(Boolean),i=new Map;for(const u of r){const d=oy(u);if(d){const f=ly(u),g=`${d}:${f}`;i.set(g,u)}}return[...a.filter(u=>{const d=oy(u);if(!d)return!0;const f=ly(u),g=`${d}:${f}`;return!i.has(g)}),...r].join(" ")}function Z_(o){return Object.entries(o).filter(([,e])=>e).map(([e])=>e).join(" ")}function eA(...o){return o.filter(e=>typeof e=="string"&&e.length>0).join(" ")}const we=ct("G7CoreGlobals");function tA(){window.React=Ye,window.ReactDOM={...Ju,createPortal:Ar.createPortal,unstable_batchedUpdates:o=>o()},window.ReactJSXRuntime=J0,we.log("전역 객체 window.React, window.ReactDOM, window.ReactJSXRuntime에 노출됨")}function nA(o){const e=new Map,a=Tr.getInstance();o.componentEvent={on:(r,i)=>(e.has(r)||e.set(r,new Set),e.get(r).add(i),a.trackEventSubscribe(r),()=>{e.get(r)?.delete(i),a.trackEventUnsubscribe(r)}),emit:async(r,i)=>{const l=e.get(r),u=l?.size??0;if(!l||l.size===0)return a.trackEventEmit(r,i,0),[];let d,f=[];try{f=await Promise.all(Array.from(l).map(async g=>{try{return await g(i)}catch(m){throw we.error(`componentEvent: Error in listener for "${r}":`,m),m}}))}catch(g){d=g instanceof Error?g:new Error(String(g))}if(a.trackEventEmit(r,i,u,f,d),d)throw d;return f},off:r=>{e.delete(r),a.trackEventOff(r)},clear:()=>{e.clear(),a.trackEventClear()}},we.log("전역 객체 window.G7Core.componentEvent에 노출됨")}function aA(o){o.__runtime||(o.__runtime={DynamicRenderer:Ha,ComponentRegistry:da,TranslationEngine:Cr,DataSourceManager:va,dataSourceManager:I_,DataBindingEngine:wn,dataBindingEngine:XS,ActionDispatcher:oo,TranslationReactContext:tf,TranslationProvider:cc,useTranslation:Fm,ResponsiveContext:Ld,ResponsiveProvider:Xl,useResponsive:Md,responsiveManager:ci,BREAKPOINT_PRESETS:kl,AuthManager:ha,createLogger:ct,G7DevToolsCore:Tr},we.log("전역 객체 window.G7Core.__runtime(코어 런타임 표면)에 노출됨"))}function rA(o){if(o.layoutEditor&&o.layoutEditor.__isStub!==!0||o.layoutEditor&&o.layoutEditor.__isStub===!0)return;const e=[],a=[];o.layoutEditor={__isStub:!0,__queue:e,__readyCallbacks:a,registerWidget:(r,i)=>e.push(["widget",r,i]),registerNodeEditor:(r,i)=>e.push(["nodeEditor",r,i]),registerCanvasOverlay:(r,i)=>e.push(["canvasOverlay",r,i]),onReady:r=>{typeof r=="function"&&a.push(r)}},we.log("전역 객체 window.G7Core.layoutEditor 예약 접수함(stub) 노출됨")}function iA(o,e){o.useTranslation=Fm,o.t=(a,r)=>{const i=e.getState();if(!i.translationEngine||!i.translationContext)return a;if(r){const l="|"+Object.entries(r).map(([u,d])=>`${u}=${d}`).join("|");return i.translationEngine.translate(a,i.translationContext,l)}return i.translationEngine.translate(a,i.translationContext)},we.log("전역 객체 window.G7Core.useTranslation에 노출됨")}function sA(o,e){o.createChangeEvent=K_,o.createClickEvent=W_,o.createSubmitEvent=Y_,o.createKeyboardEvent=X_,o.uuid=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)}),o.createLogger=ct,we.log("전역 객체 window.G7Core.createLogger에 노출됨"),o.renderItemChildren=(a,r,i,l,u)=>{const d=e.getState(),m={_global:window.__templateApp?.getGlobalState?.()||{},_local:r._local||{},_computed:r._computed||{},...r},b=new Set,v=(E,A)=>{const T=m._global?._remountKeys;return E&&T?.[E]&&!b.has(E)?(b.add(E),`${E}-remount-${T[E]}`):E||A},S={translationContext:d.translationContext,translationEngine:d.translationEngine,bindingEngine:d.bindingEngine,actionDispatcher:d.actionDispatcher,getRemountKey:v,...u};return Qs(a,m,i,l,S)},o.getComponentMap=()=>da.getInstance().getComponentMap(),o.renderComponentLayout=(a,r,i)=>{if(!a||!Array.isArray(a)||a.length===0)return null;const l=da.getInstance().getComponentMap(),u=e.getState(),f=window.__templateApp?.getGlobalState?.()||{},g={_global:f._global||{},_local:f._local||{},_computed:f._computed||{},...r},m=new Set,b=(v,S)=>{const E=g._global?._remountKeys;return v&&E?.[v]&&!m.has(v)?(m.add(v),`${v}-remount-${E[v]}`):v||S};return Qs(a,g,l,i,{translationContext:u.translationContext,translationEngine:u.translationEngine,bindingEngine:u.bindingEngine,actionDispatcher:u.actionDispatcher,getRemountKey:b})},o.renderExpandContent=a=>{const{children:r,row:i,expandContext:l,componentContext:u,keyPrefix:d}=a;if(!r||!Array.isArray(r)||r.length===0)return null;const f=a.componentMap||da.getInstance().getComponentMap(),g=e.getState(),m=o.state?.get?.()||{},b=u?.stateRef?.current??u?.state??{},v={...m._local||{},...b},S=u?.computedRef?.current??m._computed??{},E=g.bindingEngine??o.getDataBindingEngine?.(),A={...m,_local:v,_computed:S,row:i,item:i,$item:i};let T={};if(l&&typeof l=="object"&&E)try{for(const[D,U]of Object.entries(l))if(typeof U=="string"){const j=U.match(/^\{\{([^}]+)\}\}$/);if(j){const P=j[1].trim();try{T[D]=E.evaluateExpression(P,A,{skipCache:!0})}catch{T[D]=void 0}}else T[D]=E.resolveBindings(U,A,{skipCache:!0})}else T[D]=U}catch(D){we.warn("renderExpandContent: expandContext 평가 오류:",D)}const L={row:i,item:i,$item:i,_local:v,_global:m._global||{},_computed:m._computed||{},...T},M=new Set,R=(D,U)=>{const j=L._global?._remountKeys;return D&&j?.[D]&&!M.has(D)?(M.add(D),`${D}-remount-${j[D]}`):D||U};return Qs(r,L,f,d,{translationContext:g.translationContext,translationEngine:g.translationEngine??void 0,bindingEngine:g.bindingEngine??void 0,actionDispatcher:g.actionDispatcher,componentContext:u,getRemountKey:R})},o.$get=function(r,i,l=void 0){if(r==null)return l;const u=Array.isArray(i)?i:[i];if(u.length===0)return r;let d=r;for(const f of u){if(d==null||f==null)return l;d=d[f]}return d??l},we.log("전역 객체 window.G7Core.renderItemChildren에 노출됨"),we.log("전역 객체 window.G7Core.renderComponentLayout에 노출됨"),we.log("전역 객체 window.G7Core.renderExpandContent에 노출됨"),we.log("전역 객체 window.G7Core.$get에 노출됨")}function oA(o){o.dispatch=async(e,a)=>{const r=window.__templateApp;if(!r)return we.warn("G7Core.dispatch: TemplateApp이 초기화되지 않았습니다."),{success:!1,error:new Error("TemplateApp이 초기화되지 않았습니다.")};const i=r.getActionDispatcher?.();if(!i)return we.warn("G7Core.dispatch: ActionDispatcher를 찾을 수 없습니다."),{success:!1,error:new Error("ActionDispatcher를 찾을 수 없습니다.")};const l=r.getRouter?.(),u=r.getGlobalState?.(),d=r.setGlobalState?.bind(r),g=a?.componentContext||window.__g7ActionContext,m=window.__g7PendingLocalState;let b=g?.state??u;m&&g&&(b=m,we.log("[dispatch] Using __g7PendingLocalState for context.state:",m));let v=g?.data??u;m&&g?.data?._local&&(v={...g.data,_local:m},we.log("[dispatch] Updated context.data._local with pendingLocalState"));const S={navigate:l?(E,A)=>l.navigate(E,A):void 0,setState:g?.setState??d,state:b,data:v,_isDispatchFallbackContext:!g?.setState};if(e.debounce){const E=e.debounceKey||`dispatch-${e.handler}`,A=typeof e.debounce=="number"?e.debounce:e.debounce.delay;return i.debouncedCall(E,A,()=>{const{debounce:T,debounceKey:L,...M}=e;i.dispatchAction(M,S)}),{success:!0,debounced:!0}}try{return await i.dispatchAction(e,S)}catch(E){return we.error("G7Core.dispatch: 액션 실행 오류:",E),{success:!1,error:E instanceof Error?E:new Error(String(E))}}},we.log("전역 객체 window.G7Core.dispatch에 노출됨")}function So(o){const e={};for(const[a,r]of Object.entries(o))if(a.includes(".")){const i=a.split(".");let l=e;for(let u=0;u<i.length-1;u++){const d=i[u];d in l?(typeof l[d]!="object"||l[d]===null)&&(l[d]={}):l[d]={},l=l[d]}l[i[i.length-1]]=r}else e[a]=r;return e}function cy(o,e=""){const a=[];if(!o||typeof o!="object")return a;for(const r of Object.keys(o)){const i=e?`${e}.${r}`:r,l=o[r];l&&typeof l=="object"&&!Array.isArray(l)?a.push(...cy(l,i)):a.push(i)}return a}function lA(o){const e=Object.keys(o);return e.length>0&&e.every(a=>/^\d+$/.test(a))}function uy(o,e){const a={...o};for(const r of Object.keys(e))r in a?a[r]!==null&&typeof a[r]=="object"&&!Array.isArray(a[r])&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])&&(a[r]=uy(a[r],e[r])):a[r]=e[r];return a}function Zn(o,e){if(Array.isArray(o)&&!Array.isArray(e)&&lA(e)){const r=Object.keys(e).map(l=>parseInt(l,10));if(!((r.length>0?Math.max(...r):0)>=o.length+r.length+10)){const l=[...o];for(const[u,d]of Object.entries(e)){const f=parseInt(u,10);f>=0&&f<l.length?d!==null&&typeof d=="object"&&!Array.isArray(d)&&l[f]!==null&&typeof l[f]=="object"?l[f]=Zn(l[f],d):l[f]=d:f>=l.length&&(l[f]=d)}return l}}const a={...o};for(const[r,i]of Object.entries(e))i!==null&&typeof i=="object"&&!Array.isArray(i)?a[r]!==null&&typeof a[r]=="object"?a[r]=Zn(a[r],i):a[r]={...i}:a[r]=i;return a}function cA(o){o.state={get:()=>window.__templateApp?.getGlobalState?.()||{},set:(e,a)=>{const r=window.__templateApp;if(r?.setGlobalState&&r?.getGlobalState){const i=a?.merge||"deep",l=So(e);let u;if(i==="replace")u=l;else if(i==="shallow")u={...r.getGlobalState(),...l};else{const d=r.getGlobalState();u=Zn(d,l)}r.setGlobalState(u,{render:a?.render})}else we.warn("G7Core.state.set: TemplateApp이 초기화되지 않았습니다.")},setLocal:(e,a)=>{const r=window.__templateApp;if(a?.render===!1&&!a?.selfManaged){const T=window.__g7AutoBindingPaths;T&&T.size>0&&cy(So(e)).some(M=>T.has(M))&&(we.log("[setLocal] render:false + 자동바인딩 경로 겹침 감지 → render:true 자동 승격 (engine-v1.43.0)"),a={...a,render:!0})}if(a?.debounce){const T=r?.getActionDispatcher?.();if(T){const L=a.debounceKey||`setLocal-${Object.keys(e).join(",")}`,{debounce:M,debounceKey:R,...D}=a;T.debouncedCall(L,a.debounce,()=>{o.state.setLocal(e,D)});return}}const i=a?.scope??"current",l=a?.merge||"deep",u=window.__g7ActionContext,d=So(e);if(i==="parent"||i==="root"){const T=window.__g7LayoutContextStack||[];if(T.length>0){const L=i==="parent"?T[T.length-1]:T[0];if(L?.setState){L.setState(M=>l==="replace"?d:l==="shallow"?{...M||{},...d}:Zn(M||{},d)),we.log(`[setLocal] scope=${i}: 타겟 컨텍스트에 상태 업데이트 (mergeMode=${l})`,d);return}}we.warn(`[setLocal] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const f=window.__g7PendingLocalState,g=r?.getGlobalState?.()?._local||{},v=!((window.__g7LayoutContextStack||[]).length>0)&&u?.state?u.state:void 0,S=v?uy(g,v):g,E=f||S;let A;if(l==="replace"?A=d:l==="shallow"?A={...E,...d}:A=Zn(E,d),r?.setGlobalState&&(r.setGlobalState({_local:A},{render:a?.render}),we.log(`[setLocal] globalLocal updated via setGlobalState (mergeMode=${l}, render=${a?.render??!0}):`,d)),window.__g7PendingLocalState=A,we.log("[setLocal] __g7PendingLocalState updated:",A),window.__g7SequenceLocalSync=A,window.__g7LastSetLocalSnapshot=A,l==="replace")window.__g7ForcedLocalFields=d;else{const T=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Zn(T,d)}if(we.log("[setLocal] __g7ForcedLocalFields updated:",d),l==="replace")window.__g7SetLocalOverrideKeys=d;else{const T=window.__g7SetLocalOverrideKeys||{};window.__g7SetLocalOverrideKeys=Zn(T,d)}we.log("[setLocal] __g7SetLocalOverrideKeys updated:",d),u?.setState&&u.setState(T=>l==="replace"?d:l==="shallow"?{...T||{},...d}:Zn(T||{},d)),r?.setGlobalState||we.warn("G7Core.state.setLocal: TemplateApp이 없습니다.")},getLocal:()=>{const r=(window.__templateApp?.getGlobalState?.()||{})._local||{},i=window.__g7PendingLocalState;if(i)return Zn(r,i);const l=window.__g7LastSetLocalSnapshot;return l&&l!==r?Zn(r,l):r},update:e=>{const a=window.__templateApp;if(a?.getGlobalState&&a?.setGlobalState){const r=a.getGlobalState(),i=e(r);a.setGlobalState(i)}else we.warn("G7Core.state.update: TemplateApp이 초기화되지 않았습니다.")},subscribe:e=>{const a=window.__templateApp;return a?.onGlobalStateChange?a.onGlobalStateChange(e):(we.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,a,r)=>{let i,l,u;typeof e=="string"?(i=e,l=a||{},u=r):(l=e,u=a&&typeof a=="object"&&"merge"in a?a:r);const d=u?.merge||"deep",f=So(l);if(i){const b=window.__g7IsolatedStates?.[i];b?.mergeState?b.mergeState(f,d):we.warn(`G7Core.state.setIsolated: scopeId '${i}'를 찾을 수 없습니다.`);return}const g=window.__g7ActionContext;g?.isolatedContext?.mergeState?g.isolatedContext.mergeState(f,d):we.warn("G7Core.state.setIsolated: 액션 컨텍스트에 isolatedContext가 없습니다.")},getParent:()=>{const e=window.__g7LayoutContextStack||[];if(e.length===0)return we.log("[getParent] 레이아웃 컨텍스트 스택이 비어있습니다."),null;const a=e[e.length-1];if(!a)return null;const r=a.dataContext||{};return{_local:a.state||r._local||{},_global:r._global||o.state.get()||{},setState:a.setState}},setParentLocal:(e,a,r)=>{const i=window.__g7LayoutContextStack||[];if(i.length===0){we.warn("[setParentLocal] 레이아웃 컨텍스트 스택이 비어있습니다.");return}const l=i[i.length-1];if(!l?.setState){we.warn("[setParentLocal] 부모 컨텍스트에 setState가 없습니다.");return}let u,d;typeof e=="string"?(u={[e]:a},d=r):(u=e,d=a&&typeof a=="object"&&"merge"in a?a:r);const f=d?.merge||"deep",g=So(u),m=l.state?._local!==void 0,b=m?l.state._local:l.state||{};let v;f==="replace"?v=g:f==="shallow"?v={...b,...g}:v=Zn(b,g),window.__g7PendingLocalState=v;const S=window.__templateApp;if(S?.setGlobalState&&S.setGlobalState({_local:v}),l.setState(v),m?l.state._local=v:l.state=v,l.dataContext&&(l.dataContext._local=v),f==="replace")window.__g7ForcedLocalFields=g;else{const E=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Zn(E,g)}kd()},setParentGlobal:(e,a)=>{let r;typeof e=="string"?r={[e]:a}:r=e,o.state.set(r),we.log("[setParentGlobal] 전역 상태 업데이트:",r)}},window.__g7IsolatedStates||(window.__g7IsolatedStates={}),o.state.getGlobal=o.state.get,o.state.setGlobal=o.state.set,we.log("전역 객체 window.G7Core.state에 노출됨")}function uA(o){o.dataSource={get:e=>window.__templateApp?.getDataSource?.(e),set:(e,a,r)=>{const i=window.__templateApp;i?.setDataSource?i.setDataSource(e,a,r):we.warn("G7Core.dataSource.set: TemplateApp이 초기화되지 않았습니다.")},refetch:async(e,a)=>{const r=window.__templateApp;if(r?.refetchDataSource)return r.refetchDataSource(e,a);we.warn("G7Core.dataSource.refetch: TemplateApp이 초기화되지 않았습니다.")},updateItem:(e,a,r,i,l)=>{const u=window.__templateApp;return u?.updateDataSourceItem?u.updateDataSourceItem(e,a,r,i,l):(we.warn("G7Core.dataSource.updateItem: TemplateApp이 초기화되지 않았습니다."),!1)},updateData:(e,a,r,i="append")=>{const l=window.__templateApp;if(!l?.getDataSource||!l?.setDataSource)return we.warn("G7Core.dataSource.updateData: TemplateApp이 초기화되지 않았습니다."),!1;const u=l.getDataSource(e);if(!u)return we.warn(`G7Core.dataSource.updateData: 데이터 소스 '${e}'를 찾을 수 없습니다.`),!1;let d,f=u,g=null;if(a){const b=a.split(".");g=b.pop();for(const v of b)if(f&&typeof f=="object"&&v in f)f=f[v];else return we.warn(`G7Core.dataSource.updateData: 경로 '${a}'를 찾을 수 없습니다.`),!1;d=f[g]}else d=u;if(!Array.isArray(d))return we.warn("G7Core.dataSource.updateData: 대상 경로의 데이터가 배열이 아닙니다."),!1;if(!Array.isArray(r))return we.warn("G7Core.dataSource.updateData: newData가 배열이 아닙니다."),!1;const m=i==="prepend"?[...r,...d]:[...d,...r];return a&&g?(f[g]=m,l.setDataSource(e,u,{merge:!1})):l.setDataSource(e,m,{merge:!1}),we.log(`G7Core.dataSource.updateData: '${e}'에 ${r.length}개 항목 ${i==="prepend"?"앞에":"뒤에"} 추가됨`),!0}},we.log("전역 객체 window.G7Core.dataSource에 노출됨")}function dA(o,e){o.locale={current:()=>window.__templateApp?.getLocale?.()||"ko",supported:()=>{const r=window.__templateApp?.globalState?.appConfig?.supportedLocales;return Array.isArray(r)&&r.length>0?r:e.getState().templateMetadata?.locales||["ko","en"]},change:async a=>{const r=window.__templateApp;r?.changeLocale?await r.changeLocale(a):we.warn("G7Core.locale.change: TemplateApp이 초기화되지 않았습니다.")}},we.log("전역 객체 window.G7Core.locale에 노출됨")}function fA(o){o.toast={show:(e,a)=>{o.dispatch({handler:"toast",params:{message:e,type:a?.type||"info",...a?.duration&&{duration:a.duration}}})},success:(e,a)=>{o.toast.show(e,{type:"success",duration:a})},error:(e,a)=>{o.toast.show(e,{type:"error",duration:a})},warning:(e,a)=>{o.toast.show(e,{type:"warning",duration:a})},info:(e,a)=>{o.toast.show(e,{type:"info",duration:a})}},we.log("전역 객체 window.G7Core.toast에 노출됨")}function hA(o){o.modal={open:e=>{o.dispatch({handler:"openModal",target:e})},close:e=>{o.dispatch({handler:"closeModal",...e&&{target:e}})},closeAll:()=>{o.dispatch({handler:"closeAllModals"})},isOpen:e=>{const a=o.state.get();return a._global?.activeModal===e||a._global?.modalStack?.includes(e)||!1},getStack:()=>o.state.get()._global?.modalStack||[]},we.log("전역 객체 window.G7Core.modal에 노출됨")}function gA(o){o.style={mergeClasses:Q_,conditionalClass:Z_,joinClasses:eA},we.log("전역 객체 window.G7Core.style에 노출됨")}function pA(o,e){const{webSocketManager:a}=e;o.websocket={manager:a,subscribe:(r,i,l,u)=>a.subscribe(r,i,l,u),unsubscribe:r=>a.unsubscribe(r),leaveChannel:r=>a.leaveChannel(r),disconnect:()=>a.disconnect(),isInitialized:()=>a.isInitialized(),getSubscriptionCount:()=>a.getSubscriptionCount()},we.log("전역 객체 window.G7Core.websocket에 노출됨")}function mA(o,e){const{transitionManager:a}=e;o.navigation={isPending:()=>a?.getIsPending?.()||!1,onComplete:r=>{if(!a)return r(),()=>{};let i=a.getIsPending();const l=a.subscribe(u=>{u?i=!0:i&&(r(),l())});return l}},we.log("전역 객체 window.G7Core.navigation에 노출됨")}function yA(o){o.plugin={getSettings:e=>window.G7Config?.plugins?.[e],get:(e,a,r)=>window.G7Config?.plugins?.[e]?.[a]??r,getAll:()=>window.G7Config?.plugins??{}},we.log("전역 객체 window.G7Core.plugin에 노출됨")}function bA(o){o.module={getSettings:e=>window.G7Config?.modules?.[e],get:(e,a,r)=>window.G7Config?.modules?.[e]?.[a]??r,getAll:()=>window.G7Config?.modules??{}},we.log("전역 객체 window.G7Core.module에 노출됨")}function vA(o,e){const{transitionManager:a,responsiveManager:r}=e;o.AuthManager=ha,o.api=$a(),o.TransitionManager=a,o.useTransitionState=nm,o.ResponsiveManager=r,o.useResponsive=Md,o.useControllableState=lC,o.shallowArrayEqual=cC,o.shallowObjectEqual=rm,o.updateQueryParams=async(i,l)=>{const u=window.__templateApp;if(u?.updateQueryParams)return u.updateQueryParams(i,l);we.warn("G7Core.updateQueryParams: TemplateApp이 초기화되지 않았습니다.")},we.log("전역 객체 window.G7Core.AuthManager에 노출됨"),we.log("전역 객체 window.G7Core.api에 노출됨"),we.log("전역 객체 window.G7Core.ResponsiveManager에 노출됨"),we.log("전역 객체 window.G7Core.useResponsive에 노출됨"),we.log("전역 객체 window.G7Core.useControllableState에 노출됨"),we.log("전역 객체 window.G7Core.updateQueryParams에 노출됨")}function SA(o,e){o.getSlotContext=()=>window.__slotContextValue??null,o.getDynamicRenderer=()=>window.__DynamicRenderer??null,o.getComponentRegistry=()=>e.getComponentRegistry?.()??da.getInstance(),o.getDataBindingEngine=()=>e.getDataBindingEngine?.()??e.getState().bindingEngine,o.getTranslationEngine=()=>e.getTranslationEngine?.()??e.getState().translationEngine,o.getActionDispatcher=()=>e.getActionDispatcher?.()??e.getState().actionDispatcher,we.log("전역 객체 window.G7Core 슬롯 API에 노출됨 (getSlotContext, getDynamicRenderer 등)")}function wA(o){o.identity={setLauncher:St.setLauncher.bind(St),handle:St.handle.bind(St),isIdentityRequired:St.isIdentityRequired.bind(St),hasLauncher:St.hasLauncher.bind(St),markDomainNoticeShown:St.markDomainNoticeShown.bind(St),redirectExternally:St.redirectExternally.bind(St),createDeferred:St.createDeferred.bind(St),resolveDeferred:St.resolveDeferred.bind(St),reset:St.reset.bind(St),redirectStashKey:Ed},we.log("전역 객체 window.G7Core 본인인증(IDV) API에 노출됨 (identity)")}function CA(o){if(typeof window>"u")return;tA(),window.G7Core||(window.G7Core={});const e=window.G7Core;aA(e),nA(e),rA(e),vA(e,o),iA(e,o),sA(e,o),oA(e),cA(e),uA(e),dA(e,o),fA(e),hA(e),gA(e),pA(e,o),mA(e,o),yA(e),bA(e),SA(e,o),wA(e),we.log("G7Core 전역 객체 초기화 완료")}function EA(){const o=window.G7Core;if(!o){we.warn("G7Core가 초기화되지 않았습니다.");return}const e=()=>Tr.getInstance(),a={isEnabled:()=>{try{return e().isEnabled()}catch{return!1}},trackRender:r=>{try{e().isEnabled()&&e().trackRender(r)}catch{}},trackIteration:(r,i,l,u,d)=>{try{e().isEnabled()&&e().trackIteration(r,{source:i,itemVar:l,indexVar:u,sourceLength:d})}catch{}},trackIfCondition:(r,i,l,u)=>{try{e().isEnabled()&&e().trackIfCondition(r,i,l)}catch{}},trackMount:(r,i)=>{try{e().isEnabled()&&e().trackMount(r,{...i,id:r})}catch{}},trackUnmount:r=>{try{e().isEnabled()&&e().trackUnmount(r)}catch{}},trackExpressionEval:r=>{try{e().isEnabled()&&e().trackExpressionEval(r)}catch{}},trackBindingEval:r=>{try{e().isEnabled()&&e().trackBindingEval(r)}catch{}},recordCacheHit:()=>{try{e().isEnabled()&&e().recordCacheHit()}catch{}},recordCacheMiss:()=>{try{e().isEnabled()&&e().recordCacheMiss()}catch{}},trackHandlerRegistration:(r,i,l,u)=>{try{e().isEnabled()&&e().trackHandlerRegistration(r,i,l,u)}catch{}},trackHandlerUnregistration:r=>{try{e().isEnabled()&&e().trackHandlerUnregistration(r)}catch{}},logAction:r=>{try{e().isEnabled()&&e().logAction(r)}catch{}},trackRequest:(r,i)=>{try{return e().isEnabled()?e().trackRequest(r,i):""}catch{return""}},completeRequest:(r,i,l)=>{try{e().isEnabled()&&e().completeRequest(r,i,l)}catch{}},failRequest:(r,i)=>{try{e().isEnabled()&&e().failRequest(r,i)}catch{}},trackDataSourceDefinition:r=>{try{e().isEnabled()&&e().trackDataSourceDefinition(r)}catch{}},trackDataSourceLoading:r=>{try{e().isEnabled()&&e().trackDataSourceLoading(r)}catch{}},trackDataSourceLoaded:(r,i,l)=>{try{e().isEnabled()&&e().trackDataSourceLoaded(r,i,l)}catch{}},trackDataSourceError:(r,i)=>{try{e().isEnabled()&&e().trackDataSourceError(r,i)}catch{}},trackForm:(r,i,l)=>{try{e().isEnabled()&&e().trackForm(r,i,l)}catch{}},untrackForm:r=>{try{e().isEnabled()&&e().untrackForm(r)}catch{}},startStateChange:(r,i,l,u)=>{try{return e().isEnabled()?e().startStateChange(r,i,l,u):""}catch{return""}},completeStateChange:r=>{try{e().isEnabled()&&e().completeStateChange(r)}catch{}},trackComponentRender:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().trackComponentRender(r,i,l,u,d,f)}catch{}},updateLocalState:r=>{try{e().isEnabled()&&e().updateLocalState(r)}catch{}},updateComputedState:r=>{try{e().isEnabled()&&e().updateComputedState(r)}catch{}},updateParentContext:r=>{try{e().isEnabled()&&e().updateParentContext(r)}catch{}},trackComponentStateSource:(r,i,l,u)=>{try{e().isEnabled()&&e().trackComponentStateSource(r,i,l,u)}catch{}},trackDynamicState:(r,i)=>{try{e().isEnabled()&&e().trackDynamicState(r,i)}catch{}},trackContextFlow:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().trackContextFlow(r,i,l,u,d,f)}catch{}},trackComponentStyle:(r,i,l,u)=>{try{e().isEnabled()&&e().trackComponentStyle(r,i,l,u)}catch{}},trackAuthEvent:(r,i,l,u)=>{try{e().isEnabled()&&e().trackAuthEvent(r,i,l,u)}catch{}},trackAuthHeader:(r,i,l,u,d)=>{try{e().isEnabled()&&e().trackAuthHeader(r,i,l,u,d)}catch{}},trackLog:(r,i,l)=>{try{e().isEnabled()&&e().trackLog(r,i,l)}catch{}},trackAction:r=>{try{e().isEnabled()&&e().trackAction?.(r)}catch{}},trackDataSourceUpdate:r=>{try{e().isEnabled()&&e().trackDataSourceUpdate?.(r)}catch{}},startSequenceExecution:r=>{try{return e().isEnabled()?e().startSequenceExecution(r):""}catch{return""}},captureSequenceActionBefore:(r,i,l,u,d)=>{try{e().isEnabled()&&e().captureSequenceActionBefore(r,i,l,u,d)}catch{}},captureSequenceActionAfter:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().captureSequenceActionAfter(r,i,l,u,d,f)}catch{}},endSequenceExecution:(r,i)=>{try{e().isEnabled()&&e().endSequenceExecution(r,i)}catch{}},registerStateCaptureForHandler:(r,i,l)=>{try{e().isEnabled()&&e().registerStateCaptureForHandler(r,i,l)}catch{}},detectStaleClosure:(r,i,l,u,d)=>{try{return e().isEnabled()?e().detectStaleClosure(r,i,l,u,d):[]}catch{return[]}},trackStaleClosureWarning:r=>{try{e().isEnabled()&&e().trackStaleClosureWarning(r)}catch{}},trackModalOpen:r=>{try{e().isEnabled()&&e().trackModalOpen(r)}catch{}},trackModalClose:(r,i)=>{try{e().isEnabled()&&e().trackModalClose(r,i)}catch{}},trackModalStateChange:r=>{try{e().isEnabled()&&e().trackModalStateChange(r)}catch{}},trackNestedContext:r=>{try{return e().isEnabled()?e().trackNestedContext(r):""}catch{return""}},trackNestedContextAccess:(r,i)=>{try{e().isEnabled()&&e().trackNestedContextAccess(r,i)}catch{}},trackComputedProperty:(r,i,l,u,d,f,g)=>{try{e().isEnabled()&&e().trackComputedProperty(r,i,l,u,d,f,g)}catch{}},trackComputedRecalc:(r,i,l,u,d,f,g)=>{try{e().isEnabled()&&e().trackComputedRecalc(r,i,l,u,d,f,g)}catch{}},setNamedActionDefinitions:r=>{try{e().isEnabled()&&e().setNamedActionDefinitions(r)}catch{}},trackNamedActionRef:r=>{try{e().isEnabled()&&e().trackNamedActionRef(r)}catch{}}};o.devTools=a,we.log("G7Core.devTools 인터페이스 초기화 완료")}let wo=null;function _A(){const o=window.G7Core;return o?.__devtools?Promise.resolve(o.__devtools):wo||(wo=new Promise((e,a)=>{const r=window.G7Config?.coreDevToolsAsset||"/build/core/devtools.min.js",i="g7-devtools-bundle",l=()=>{const f=window.G7Core?.__devtools;f?e(f):a(new Error("DevTools 번들 로드됨 — 그러나 __devtools 미노출"))};window.G7Core=window.G7Core||{},window.G7Core.__onDevToolsReady=l;const u=document.getElementById(i);if(u){u.addEventListener("load",l,{once:!0}),u.addEventListener("error",()=>a(new Error(`DevTools 번들 로드 실패: ${r}`)),{once:!0});return}const d=document.createElement("script");d.id=i,d.src=r,d.async=!1,d.addEventListener("load",l,{once:!0}),d.addEventListener("error",()=>{wo=null,a(new Error(`DevTools 번들 로드 실패: ${r}`))},{once:!0}),document.head.appendChild(d)}),wo)}function AA(){const o=window.G7Core;if(!o){we.warn("G7Core가 초기화되지 않았습니다.");return}const e=Tr.getInstance();if(e.initialize(),!e.isEnabled()){window.G7DevTools={isEnabled:()=>!1,enable:()=>{we.log("환경설정 > 고급 설정 > 디버그 모드를 켜세요")}},Zu(),we.log("G7DevTools 비활성화됨 (디버그 모드 꺼짐)");return}xA(o,e)}async function xA(o,e){let a;try{a=await _A()}catch(g){we.warn("DevTools 번들 로드 실패 — 최소 API 로 폴백:",g),window.G7DevTools={isEnabled:()=>!1,enable:()=>{}},Zu();return}const{DiagnosticEngine:r,getServerConnector:i,getStyleTracker:l}=a;EA(),Zu();try{l().enable(),we.log("StyleTracker 활성화됨")}catch(g){we.warn("StyleTracker 활성화 실패:",g)}const u=new r,d=i(),f={isEnabled:()=>e.isEnabled(),state:{get:()=>e.getState(),getHistory:()=>e.getStateHistory(),watch:(g,m)=>e.watchState(g,m)},actions:{getHistory:()=>e.getActionHistory(),watch:g=>e.watchActions(g),getMetrics:()=>e.getActionMetrics()},binding:{evaluate:g=>{const m=o.getDataBindingEngine?.();if(!m){we.warn("DataBindingEngine이 없습니다.");return}return m.evaluateExpression(g,e.getState())},getCacheStats:()=>e.getCacheStats(),clearStats:()=>{e.resetCacheStats(),we.log("캐시 통계 초기화됨")}},diagnose:{analyze:g=>u.analyze(g),suggestFix:g=>u.suggestFix(g),getCommonIssues:()=>u.getCommonIssues(),getRulesByCategory:g=>u.getRulesByCategory(g)},server:{dumpState:g=>d.dumpState(g),sendLog:g=>d.sendLog(g),sendError:(g,m)=>d.sendError(g,m),isConnected:()=>d.isConnected(),testConnection:()=>d.testConnection()},config:{isDebugMode:()=>e.isEnabled(),setLogLevel:g=>e.setLogLevel(g),setMaxHistory:g=>e.setMaxHistory(g)},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=f,o.devtools=f,we.log("G7DevTools 전역 객체 초기화 완료 (window.G7DevTools)"),TA(a.DevToolsPanel)}function TA(o){if(document.getElementById("g7-devtools-root")){we.log("DevToolsPanel 이미 렌더링됨");return}const e=document.createElement("div");e.id="g7-devtools-root",document.body.appendChild(e);try{Ju.createRoot(e).render(Ye.createElement(o)),we.log("DevToolsPanel UI 렌더링 완료")}catch(a){we.error("DevToolsPanel UI 렌더링 실패:",a)}}const Ze=ct("TemplateEngine"),ie={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 Co=!1;const Eo=[];async function RA(o){try{Ze.log("템플릿 메타데이터 로드 중...",o);const e=o.split("-").map(r=>r.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")).join(""),a=window[e];return a?.templateMetadata?(Ze.log("템플릿 메타데이터 로드 완료 (전역 변수)",a.templateMetadata),a.templateMetadata):(Ze.warn(`템플릿 번들에 메타데이터가 없습니다. 전역 변수: ${e}`),{identifier:o,locales:["ko","en"],name:{ko:o,en:o},description:{ko:"",en:""},version:"1.0.0",type:"admin"})}catch(e){return Ze.error("템플릿 메타데이터 로드 실패",e),{identifier:o,locales:["ko","en"],name:{ko:o,en:o},description:{ko:"",en:""},version:"1.0.0",type:"admin"}}}function dy(){const e=(typeof window<"u"?window.__templateApp:void 0)?.globalState?.appConfig?.supportedLocales,a=ie.templateMetadata?.locales;return{$locale:ie.locale,$locales:Array.isArray(e)&&e.length>0?e:a||["ko","en"],$templateLocales:a||["ko","en"],$templateId:ie.templateId}}async function _o(o){try{if(Ze.log("템플릿 엔진 초기화 시작",o),ie.isInitialized)throw new Error("템플릿 엔진이 이미 초기화되었습니다. destroyTemplate()을 먼저 호출하세요.");if(!o.templateId)throw new z_;Co=o.debug??!1,typeof window<"u"&&(window.G7Config||(window.G7Config={}),window.G7Config.debug=Co),AA(),ie.templateId=o.templateId,ie.locale=o.locale||"ko",Ze.log("엔진 인스턴스 생성 중..."),ie.registry=da.getInstance(),ie.bindingEngine=new wn,ie.translationEngine=Cr.getInstance(),o.cacheVersion!==void 0&&o.cacheVersion>0&&ie.translationEngine.setCacheVersion(o.cacheVersion),ie.translationContext={templateId:o.templateId,locale:ie.locale},ie.actionDispatcher=new oo({},ie.translationEngine,ie.translationContext),eC(ie.actionDispatcher),Ze.log("다국어 파일 로드 중...",o.templateId,ie.locale);const e="en",a=[ie.translationEngine.loadTranslations(o.templateId,ie.locale).then(()=>{Ze.log(`다국어 파일 로드 완료: ${ie.locale}`)}).catch(r=>{Ze.warn(`다국어 파일 로드 실패 (${ie.locale}):`,r instanceof Error?r.message:r)})];ie.locale!==e&&a.push(ie.translationEngine.loadTranslations(o.templateId,e).then(()=>{Ze.log(`폴백 다국어 파일 로드 완료: ${e}`)}).catch(r=>{Ze.warn(`폴백 다국어 파일 로드 실패 (${e}):`,r instanceof Error?r.message:r)})),await Promise.allSettled(a),Ze.log("템플릿 메타데이터 로드 중...",o.templateId),ie.templateMetadata=await RA(o.templateId),ie.isInitialized=!0,Ze.log("템플릿 엔진 초기화 완료 (ComponentRegistry는 별도 로드)")}catch(e){throw Ze.error("템플릿 엔진 초기화 실패",e),ie.isInitialized=!1,ie.registry=null,ie.bindingEngine=null,ie.translationEngine=null,ie.actionDispatcher=null,e}}let Ao=null;function hf(){const o=window.G7Core;return o?.__LayoutEditorChrome?Promise.resolve(o.__LayoutEditorChrome):Ao||(Ao=new Promise((e,a)=>{const r=window.G7Config?.coreEditorAsset||"/build/core/layout-editor.min.js",i="g7-layout-editor-bundle",l=document.getElementById(i),u=()=>{const f=window.G7Core?.__LayoutEditorChrome;f?e(f):a(new Error("편집기 번들 로드됨 — 그러나 __LayoutEditorChrome 미노출"))};if(window.G7Core=window.G7Core||{},window.G7Core.__onChromeReady=u,l){l.addEventListener("load",u,{once:!0}),l.addEventListener("error",()=>a(new Error(`편집기 번들 로드 실패: ${r}`)),{once:!0});return}const d=document.createElement("script");d.id=i,d.src=r,d.async=!1,d.addEventListener("load",u,{once:!0}),d.addEventListener("error",()=>{Ao=null,a(new Error(`편집기 번들 로드 실패: ${r}`))},{once:!0}),document.head.appendChild(d)}),Ao)}async function os(o){try{if(Ze.log("템플릿 렌더링 시작",o),!ie.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다. initTemplateEngine()을 먼저 호출하세요.");if(!o.containerId)throw new Error("containerId는 필수입니다.");if(!o.layoutJson)throw new Error("layoutJson은 필수입니다.");const e=document.getElementById(o.containerId);if(!e)throw new Error(`컨테이너를 찾을 수 없습니다: #${o.containerId}`);const a=dy();if(ie.containerId=o.containerId,ie.currentLayoutJson=o.layoutJson,ie.currentDataContext={...a,...o.dataContext||{}},ie.translationContext=o.translationContext||{templateId:ie.templateId||"",locale:ie.locale},ie.reactRoot||(Ze.log("React Root 생성"),ie.reactRoot=Ju.createRoot(e)),typeof window<"u"){const l=iy(window.location.pathname);if(l){Ze.log("레이아웃 편집기 모드 진입",l);let u;try{u=await hf()}catch(f){Ze.error("레이아웃 편집기 번들 로드 실패",f),lf.render(o.containerId,{title:"레이아웃 편집기 로드 실패",message:f instanceof Error?f.message:"편집기 번들을 불러오지 못했습니다.",icon:"fas fa-triangle-exclamation",showStack:!1,showReloadButton:!0,debug:Co});return}const d=Ye.createElement(u,{templateIdentifier:l.templateIdentifier,initialLocale:ie.locale});ie.reactRoot.render(Ye.createElement(cc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext,children:Ye.createElement(Dd,{children:Ye.createElement(Xl,{children:Ye.createElement(nf,{children:d})})})}));return}}const r=o.layoutJson.components||[];if(r.length===0){Ze.warn("렌더링할 컴포넌트가 없습니다.");return}const i=o.layoutJson.modals||[];if(Ze.log("modals 배열:",i),Ze.log("modals 개수:",i.length),Ze.log("DynamicRenderer로 렌더링 시작"),ie.reactRoot.render(Ye.createElement(cc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext},Ye.createElement(Dd,null,Ye.createElement(Xl,null,Ye.createElement(nf,null,[...r.map((l,u)=>{const d=ie.currentLayoutJson?.layout_name||"";return Ye.createElement(Ha,{key:d&&!l._fromBase?`${l.id}_${d}`:l.id,componentDef:l,dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,isRootRenderer:u===0,layoutKey:d})}),Ye.createElement(Jp,{key:"__modal_parent_context_provider"},i.map(l=>{const u=ie.currentDataContext._global?.modalStack||[],f=u.includes(l.id)||ie.currentDataContext._global?.activeModal===l.id,g=u.indexOf(l.id),m=g>=0?50+g:50,b=window.__g7LayoutContextStack||[],S=b[b.length-1]?.dataContext,E=Ye.createElement(Ha,{key:`modal_${l.id}_renderer`,componentDef:{...l,props:{...l.props,isOpen:f,style:{...l.props?.style,zIndex:m},onClose:ie.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ie.currentDataContext)}},dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,parentDataContext:S});return l.data_sources&&l.data_sources.length>0?Ye.createElement(ay,{key:`modal_${l.id}`,isOpen:f,modalId:l.id,dataSources:l.data_sources,dataContext:ie.currentDataContext,globalStateUpdater:ie.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ie.bindingEngine,debug:Co,children:E}):E}))]))))),Ze.log("템플릿 렌더링 완료"),Eo.length>0){Ze.log(`대기 중인 데이터 업데이트 ${Eo.length}건 적용`);const l=[...Eo];Eo.length=0;for(const{data:u,options:d}of l)ls(u,d)}}catch(e){throw Ze.error("템플릿 렌더링 실패",e),e}}function ls(o,e){try{if(Ze.log("템플릿 데이터 업데이트 시작",Object.keys(o)),!ie.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다.");if(!ie.reactRoot||!ie.currentLayoutJson){Ze.log("React 미준비 - 데이터 업데이트 큐잉:",Object.keys(o)),Eo.push({data:o,options:e});return}const a=dy(),r={...ie.currentDataContext._global||{},...o._global||{}},i=sC(ie.currentDataContext._localInit,o._localInit);ie.currentDataContext={...a,...ie.currentDataContext,...o,_global:r,_localInit:i},r._local!==void 0&&(ie.currentDataContext._local=r._local),r._computed!==void 0&&(ie.currentDataContext._computed=r._computed);const l=ie.currentLayoutJson.components||[],u=ie.currentLayoutJson.modals||[];Ze.log("updateTemplateData - modals 배열:",u),Ze.log("updateTemplateData - modals 개수:",u.length),Ze.log("updateTemplateData - activeModal:",ie.currentDataContext._global?.activeModal);const d=()=>{ie.reactRoot.render(Ye.createElement(cc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext},Ye.createElement(Dd,null,Ye.createElement(Xl,null,Ye.createElement(nf,null,[...l.map((f,g)=>{const m=ie.currentLayoutJson?.layout_name||"";return Ye.createElement(Ha,{key:m&&!f._fromBase?`${f.id}_${m}`:f.id,componentDef:f,dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,isRootRenderer:g===0,layoutKey:m})}),Ye.createElement(Jp,{key:"__modal_parent_context_provider_update"},u.map(f=>{const g=ie.currentDataContext._global?.modalStack||[],b=g.includes(f.id)||ie.currentDataContext._global?.activeModal===f.id,v=g.indexOf(f.id),S=v>=0?50+v:50,E=window.__g7LayoutContextStack||[],T=E[E.length-1]?.dataContext,L=Ye.createElement(Ha,{key:`modal_${f.id}_renderer`,componentDef:{...f,props:{...f.props,isOpen:b,style:{...f.props?.style,zIndex:S},onClose:ie.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ie.currentDataContext)}},dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,parentDataContext:T});return f.data_sources&&f.data_sources.length>0?Ye.createElement(ay,{key:`modal_${f.id}`,isOpen:b,modalId:f.id,dataSources:f.data_sources,dataContext:ie.currentDataContext,globalStateUpdater:ie.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ie.bindingEngine,debug:Co,children:L}):L}))])))))};e?.sync?(Ze.log("재렌더링 시작 (sync mode - 즉시 렌더링)"),d()):(Ze.log("재렌더링 시작 (with startTransition)"),N.startTransition(()=>{d()})),Ze.log("템플릿 데이터 업데이트 완료")}catch(a){throw Ze.error("템플릿 데이터 업데이트 실패",a),a}}function mc(){try{Ze.log("템플릿 정리 시작"),ie.reactRoot&&(Ze.log("React Root 언마운트"),ie.reactRoot.unmount(),ie.reactRoot=null),ie.templateId=null,ie.locale="ko",ie.isInitialized=!1,ie.containerId=null,ie.currentLayoutJson=null,ie.currentDataContext={},ie.translationContext={templateId:"",locale:"ko"},ie.registry=null,ie.bindingEngine=null,ie.translationEngine=null,ie.actionDispatcher=null,ie.templateMetadata=null,Ze.log("템플릿 정리 완료")}catch(o){throw Ze.error("템플릿 정리 실패",o),o}}function Za(){return Object.freeze({...ie})}function fy(){return ie.actionDispatcher}const xo={initTemplateEngine:_o,renderTemplate:os,updateTemplateData:ls,destroyTemplate:mc,getState:Za};typeof window<"u"&&(window.G7Core||(window.G7Core={}),window.G7Core.TemplateEngine=xo,CA({getState:()=>({translationEngine:ie.translationEngine,translationContext:ie.translationContext,bindingEngine:ie.bindingEngine,actionDispatcher:ie.actionDispatcher,templateMetadata:ie.templateMetadata}),transitionManager:Na,responsiveManager:ci,webSocketManager:fc}),Ze.log("전역 객체 window.G7Core.TemplateEngine에 노출됨"));const za=Object.freeze(Object.defineProperty({__proto__:null,DataSourceManager:va,LayoutLoader:ef,TemplateApp:vo,TemplateEngine:xo,default:xo,destroyTemplate:mc,getActionDispatcher:fy,getState:Za,initTemplateApp:ff,initTemplateEngine:_o,loadLayoutEditorBundle:hf,renderTemplate:os,updateTemplateData:ls},Symbol.toStringTag,{value:"Module"}));Vt.DataSourceManager=va,Vt.LayoutLoader=ef,Vt.TemplateApp=vo,Vt.TemplateEngine=xo,Vt.default=xo,Vt.destroyTemplate=mc,Vt.getActionDispatcher=fy,Vt.getState=Za,Vt.initTemplateApp=ff,Vt.initTemplateEngine=_o,Vt.loadLayoutEditorBundle=hf,Vt.renderTemplate=os,Vt.updateTemplateData=ls,Object.defineProperties(Vt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.G7Core=this.G7Core||{});
|
||
//# sourceMappingURL=template-engine.min.js.map
|