@friggframework/devtools 2.0.0--canary.398.dd443c7.0 → 2.0.0--canary.402.d2f4ae6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/frigg-cli/.eslintrc.js +141 -0
  2. package/frigg-cli/__tests__/jest.config.js +102 -0
  3. package/frigg-cli/__tests__/unit/commands/build.test.js +483 -0
  4. package/frigg-cli/__tests__/unit/commands/install.test.js +418 -0
  5. package/frigg-cli/__tests__/unit/commands/ui.test.js +592 -0
  6. package/frigg-cli/__tests__/utils/command-tester.js +170 -0
  7. package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
  8. package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
  9. package/frigg-cli/__tests__/utils/test-setup.js +286 -0
  10. package/frigg-cli/generate-command/__tests__/generate-command.test.js +312 -0
  11. package/frigg-cli/generate-command/azure-generator.js +43 -0
  12. package/frigg-cli/generate-command/gcp-generator.js +47 -0
  13. package/frigg-cli/generate-command/index.js +332 -0
  14. package/frigg-cli/generate-command/terraform-generator.js +555 -0
  15. package/frigg-cli/index.js +19 -1
  16. package/frigg-cli/init-command/backend-first-handler.js +756 -0
  17. package/frigg-cli/init-command/index.js +93 -0
  18. package/frigg-cli/init-command/template-handler.js +143 -0
  19. package/frigg-cli/package.json +51 -0
  20. package/frigg-cli/test/init-command.test.js +180 -0
  21. package/frigg-cli/test/npm-registry.test.js +319 -0
  22. package/frigg-cli/ui-command/index.js +154 -0
  23. package/frigg-cli/utils/app-resolver.js +319 -0
  24. package/frigg-cli/utils/backend-path.js +25 -0
  25. package/frigg-cli/utils/npm-registry.js +167 -0
  26. package/frigg-cli/utils/process-manager.js +199 -0
  27. package/frigg-cli/utils/repo-detection.js +405 -0
  28. package/infrastructure/serverless-template.js +177 -292
  29. package/management-ui/.eslintrc.js +22 -0
  30. package/management-ui/README.md +203 -0
  31. package/management-ui/components.json +21 -0
  32. package/management-ui/docs/phase2-integration-guide.md +320 -0
  33. package/management-ui/{dist/index.html → index.html} +1 -2
  34. package/management-ui/package-lock.json +16517 -0
  35. package/management-ui/package.json +76 -0
  36. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +302 -0
  37. package/management-ui/postcss.config.js +6 -0
  38. package/management-ui/server/api/backend.js +256 -0
  39. package/management-ui/server/api/cli.js +315 -0
  40. package/management-ui/server/api/codegen.js +663 -0
  41. package/management-ui/server/api/connections.js +857 -0
  42. package/management-ui/server/api/discovery.js +185 -0
  43. package/management-ui/server/api/environment/index.js +1 -0
  44. package/management-ui/server/api/environment/router.js +378 -0
  45. package/management-ui/server/api/environment.js +328 -0
  46. package/management-ui/server/api/integrations.js +876 -0
  47. package/management-ui/server/api/logs.js +248 -0
  48. package/management-ui/server/api/monitoring.js +282 -0
  49. package/management-ui/server/api/open-ide.js +31 -0
  50. package/management-ui/server/api/project.js +1029 -0
  51. package/management-ui/server/api/users/sessions.js +371 -0
  52. package/management-ui/server/api/users/simulation.js +254 -0
  53. package/management-ui/server/api/users.js +362 -0
  54. package/management-ui/server/api-contract.md +275 -0
  55. package/management-ui/server/index.js +873 -0
  56. package/management-ui/server/middleware/errorHandler.js +93 -0
  57. package/management-ui/server/middleware/security.js +32 -0
  58. package/management-ui/server/processManager.js +296 -0
  59. package/management-ui/server/server.js +346 -0
  60. package/management-ui/server/services/aws-monitor.js +413 -0
  61. package/management-ui/server/services/npm-registry.js +347 -0
  62. package/management-ui/server/services/template-engine.js +538 -0
  63. package/management-ui/server/utils/cliIntegration.js +220 -0
  64. package/management-ui/server/utils/environment/auditLogger.js +471 -0
  65. package/management-ui/server/utils/environment/awsParameterStore.js +264 -0
  66. package/management-ui/server/utils/environment/encryption.js +278 -0
  67. package/management-ui/server/utils/environment/envFileManager.js +286 -0
  68. package/management-ui/server/utils/import-commonjs.js +28 -0
  69. package/management-ui/server/utils/response.js +83 -0
  70. package/management-ui/server/websocket/handler.js +325 -0
  71. package/management-ui/src/App.jsx +109 -0
  72. package/management-ui/src/components/AppRouter.jsx +65 -0
  73. package/management-ui/src/components/Button.jsx +70 -0
  74. package/management-ui/src/components/Card.jsx +97 -0
  75. package/management-ui/src/components/EnvironmentCompare.jsx +400 -0
  76. package/management-ui/src/components/EnvironmentEditor.jsx +372 -0
  77. package/management-ui/src/components/EnvironmentImportExport.jsx +469 -0
  78. package/management-ui/src/components/EnvironmentSchema.jsx +491 -0
  79. package/management-ui/src/components/EnvironmentSecurity.jsx +463 -0
  80. package/management-ui/src/components/ErrorBoundary.jsx +73 -0
  81. package/management-ui/src/components/IntegrationCard.jsx +481 -0
  82. package/management-ui/src/components/IntegrationCardEnhanced.jsx +770 -0
  83. package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
  84. package/management-ui/src/components/IntegrationStatus.jsx +336 -0
  85. package/management-ui/src/components/Layout.jsx +716 -0
  86. package/management-ui/src/components/LoadingSpinner.jsx +113 -0
  87. package/management-ui/src/components/RepositoryPicker.jsx +248 -0
  88. package/management-ui/src/components/SessionMonitor.jsx +350 -0
  89. package/management-ui/src/components/StatusBadge.jsx +208 -0
  90. package/management-ui/src/components/UserContextSwitcher.jsx +212 -0
  91. package/management-ui/src/components/UserSimulation.jsx +327 -0
  92. package/management-ui/src/components/Welcome.jsx +434 -0
  93. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +637 -0
  94. package/management-ui/src/components/codegen/APIModuleSelector.jsx +227 -0
  95. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +247 -0
  96. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +316 -0
  97. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +271 -0
  98. package/management-ui/src/components/codegen/FormBuilder.jsx +737 -0
  99. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +855 -0
  100. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +797 -0
  101. package/management-ui/src/components/codegen/SchemaBuilder.jsx +303 -0
  102. package/management-ui/src/components/codegen/TemplateSelector.jsx +586 -0
  103. package/management-ui/src/components/codegen/index.js +10 -0
  104. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +362 -0
  105. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +182 -0
  106. package/management-ui/src/components/connections/ConnectionTester.jsx +200 -0
  107. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +292 -0
  108. package/management-ui/src/components/connections/OAuthFlow.jsx +204 -0
  109. package/management-ui/src/components/connections/index.js +5 -0
  110. package/management-ui/src/components/index.js +21 -0
  111. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +222 -0
  112. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +169 -0
  113. package/management-ui/src/components/monitoring/MetricsChart.jsx +197 -0
  114. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +393 -0
  115. package/management-ui/src/components/monitoring/SQSMetrics.jsx +246 -0
  116. package/management-ui/src/components/monitoring/index.js +6 -0
  117. package/management-ui/src/components/monitoring/monitoring.css +218 -0
  118. package/management-ui/src/components/theme-provider.jsx +52 -0
  119. package/management-ui/src/components/theme-toggle.jsx +39 -0
  120. package/management-ui/src/components/ui/badge.tsx +36 -0
  121. package/management-ui/src/components/ui/button.test.jsx +56 -0
  122. package/management-ui/src/components/ui/button.tsx +57 -0
  123. package/management-ui/src/components/ui/card.tsx +76 -0
  124. package/management-ui/src/components/ui/dropdown-menu.tsx +199 -0
  125. package/management-ui/src/components/ui/select.tsx +157 -0
  126. package/management-ui/src/components/ui/skeleton.jsx +15 -0
  127. package/management-ui/src/hooks/useFrigg.jsx +601 -0
  128. package/management-ui/src/hooks/useSocket.jsx +58 -0
  129. package/management-ui/src/index.css +193 -0
  130. package/management-ui/src/lib/utils.ts +6 -0
  131. package/management-ui/src/main.jsx +10 -0
  132. package/management-ui/src/pages/CodeGeneration.jsx +14 -0
  133. package/management-ui/src/pages/Connections.jsx +252 -0
  134. package/management-ui/src/pages/ConnectionsEnhanced.jsx +633 -0
  135. package/management-ui/src/pages/Dashboard.jsx +311 -0
  136. package/management-ui/src/pages/Environment.jsx +314 -0
  137. package/management-ui/src/pages/IntegrationConfigure.jsx +669 -0
  138. package/management-ui/src/pages/IntegrationDiscovery.jsx +567 -0
  139. package/management-ui/src/pages/IntegrationTest.jsx +742 -0
  140. package/management-ui/src/pages/Integrations.jsx +253 -0
  141. package/management-ui/src/pages/Monitoring.jsx +17 -0
  142. package/management-ui/src/pages/Simulation.jsx +155 -0
  143. package/management-ui/src/pages/Users.jsx +492 -0
  144. package/management-ui/src/services/api.js +41 -0
  145. package/management-ui/src/services/apiModuleService.js +193 -0
  146. package/management-ui/src/services/websocket-handlers.js +120 -0
  147. package/management-ui/src/test/api/project.test.js +273 -0
  148. package/management-ui/src/test/components/Welcome.test.jsx +378 -0
  149. package/management-ui/src/test/mocks/server.js +178 -0
  150. package/management-ui/src/test/setup.js +61 -0
  151. package/management-ui/src/test/utils/test-utils.jsx +134 -0
  152. package/management-ui/src/utils/repository.js +98 -0
  153. package/management-ui/src/utils/repository.test.js +118 -0
  154. package/management-ui/src/workflows/phase2-integration-workflows.js +884 -0
  155. package/management-ui/tailwind.config.js +63 -0
  156. package/management-ui/tsconfig.json +37 -0
  157. package/management-ui/tsconfig.node.json +10 -0
  158. package/management-ui/vite.config.js +26 -0
  159. package/management-ui/vitest.config.js +38 -0
  160. package/package.json +5 -5
  161. package/management-ui/dist/assets/index-BA21WgFa.js +0 -1221
  162. package/management-ui/dist/assets/index-CbM64Oba.js +0 -1221
  163. package/management-ui/dist/assets/index-CkvseXTC.css +0 -1
  164. /package/management-ui/{dist/assets/FriggLogo-B7Xx8ZW1.svg → src/assets/FriggLogo.svg} +0 -0
@@ -1,1221 +0,0 @@
1
- function $1(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(s,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function qx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kx={exports:{}},vl={},Gx={exports:{}},te={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var io=Symbol.for("react.element"),U1=Symbol.for("react.portal"),z1=Symbol.for("react.fragment"),V1=Symbol.for("react.strict_mode"),B1=Symbol.for("react.profiler"),W1=Symbol.for("react.provider"),H1=Symbol.for("react.context"),q1=Symbol.for("react.forward_ref"),K1=Symbol.for("react.suspense"),G1=Symbol.for("react.memo"),Y1=Symbol.for("react.lazy"),hh=Symbol.iterator;function X1(e){return e===null||typeof e!="object"?null:(e=hh&&e[hh]||e["@@iterator"],typeof e=="function"?e:null)}var Yx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xx=Object.assign,Qx={};function Tr(e,t,n){this.props=e,this.context=t,this.refs=Qx,this.updater=n||Yx}Tr.prototype.isReactComponent={};Tr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Tr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Jx(){}Jx.prototype=Tr.prototype;function ef(e,t,n){this.props=e,this.context=t,this.refs=Qx,this.updater=n||Yx}var tf=ef.prototype=new Jx;tf.constructor=ef;Xx(tf,Tr.prototype);tf.isPureReactComponent=!0;var ph=Array.isArray,Zx=Object.prototype.hasOwnProperty,nf={current:null},e0={key:!0,ref:!0,__self:!0,__source:!0};function t0(e,t,n){var s,i={},o=null,a=null;if(t!=null)for(s in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)Zx.call(t,s)&&!e0.hasOwnProperty(s)&&(i[s]=t[s]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(s in l=e.defaultProps,l)i[s]===void 0&&(i[s]=l[s]);return{$$typeof:io,type:e,key:o,ref:a,props:i,_owner:nf.current}}function Q1(e,t){return{$$typeof:io,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function sf(e){return typeof e=="object"&&e!==null&&e.$$typeof===io}function J1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var gh=/\/+/g;function ic(e,t){return typeof e=="object"&&e!==null&&e.key!=null?J1(""+e.key):t.toString(36)}function sa(e,t,n,s,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case io:case U1:a=!0}}if(a)return a=e,i=i(a),e=s===""?"."+ic(a,0):s,ph(i)?(n="",e!=null&&(n=e.replace(gh,"$&/")+"/"),sa(i,t,n,"",function(u){return u})):i!=null&&(sf(i)&&(i=Q1(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(gh,"$&/")+"/")+e)),t.push(i)),1;if(a=0,s=s===""?".":s+":",ph(e))for(var l=0;l<e.length;l++){o=e[l];var c=s+ic(o,l);a+=sa(o,t,n,c,i)}else if(c=X1(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=s+ic(o,l++),a+=sa(o,t,n,c,i);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Eo(e,t,n){if(e==null)return e;var s=[],i=0;return sa(e,s,"","",function(o){return t.call(n,o,i++)}),s}function Z1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ge={current:null},ra={transition:null},eN={ReactCurrentDispatcher:Ge,ReactCurrentBatchConfig:ra,ReactCurrentOwner:nf};function n0(){throw Error("act(...) is not supported in production builds of React.")}te.Children={map:Eo,forEach:function(e,t,n){Eo(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Eo(e,function(){t++}),t},toArray:function(e){return Eo(e,function(t){return t})||[]},only:function(e){if(!sf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};te.Component=Tr;te.Fragment=z1;te.Profiler=B1;te.PureComponent=ef;te.StrictMode=V1;te.Suspense=K1;te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eN;te.act=n0;te.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Xx({},e.props),i=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=nf.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Zx.call(t,c)&&!e0.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];s.children=l}return{$$typeof:io,type:e.type,key:i,ref:o,props:s,_owner:a}};te.createContext=function(e){return e={$$typeof:H1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:W1,_context:e},e.Consumer=e};te.createElement=t0;te.createFactory=function(e){var t=t0.bind(null,e);return t.type=e,t};te.createRef=function(){return{current:null}};te.forwardRef=function(e){return{$$typeof:q1,render:e}};te.isValidElement=sf;te.lazy=function(e){return{$$typeof:Y1,_payload:{_status:-1,_result:e},_init:Z1}};te.memo=function(e,t){return{$$typeof:G1,type:e,compare:t===void 0?null:t}};te.startTransition=function(e){var t=ra.transition;ra.transition={};try{e()}finally{ra.transition=t}};te.unstable_act=n0;te.useCallback=function(e,t){return Ge.current.useCallback(e,t)};te.useContext=function(e){return Ge.current.useContext(e)};te.useDebugValue=function(){};te.useDeferredValue=function(e){return Ge.current.useDeferredValue(e)};te.useEffect=function(e,t){return Ge.current.useEffect(e,t)};te.useId=function(){return Ge.current.useId()};te.useImperativeHandle=function(e,t,n){return Ge.current.useImperativeHandle(e,t,n)};te.useInsertionEffect=function(e,t){return Ge.current.useInsertionEffect(e,t)};te.useLayoutEffect=function(e,t){return Ge.current.useLayoutEffect(e,t)};te.useMemo=function(e,t){return Ge.current.useMemo(e,t)};te.useReducer=function(e,t,n){return Ge.current.useReducer(e,t,n)};te.useRef=function(e){return Ge.current.useRef(e)};te.useState=function(e){return Ge.current.useState(e)};te.useSyncExternalStore=function(e,t,n){return Ge.current.useSyncExternalStore(e,t,n)};te.useTransition=function(){return Ge.current.useTransition()};te.version="18.3.1";Gx.exports=te;var g=Gx.exports;const We=qx(g),rf=$1({__proto__:null,default:We},[g]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var tN=g,nN=Symbol.for("react.element"),sN=Symbol.for("react.fragment"),rN=Object.prototype.hasOwnProperty,iN=tN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,oN={key:!0,ref:!0,__self:!0,__source:!0};function s0(e,t,n){var s,i={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(s in t)rN.call(t,s)&&!oN.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)i[s]===void 0&&(i[s]=t[s]);return{$$typeof:nN,type:e,key:o,ref:a,props:i,_owner:iN.current}}vl.Fragment=sN;vl.jsx=s0;vl.jsxs=s0;Kx.exports=vl;var r=Kx.exports,du={},r0={exports:{}},gt={},i0={exports:{}},o0={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(R,I){var D=R.length;R.push(I);e:for(;0<D;){var z=D-1>>>1,K=R[z];if(0<i(K,I))R[z]=I,R[D]=K,D=z;else break e}}function n(R){return R.length===0?null:R[0]}function s(R){if(R.length===0)return null;var I=R[0],D=R.pop();if(D!==I){R[0]=D;e:for(var z=0,K=R.length,se=K>>>1;z<se;){var ve=2*(z+1)-1,yt=R[ve],Pe=ve+1,Le=R[Pe];if(0>i(yt,D))Pe<K&&0>i(Le,yt)?(R[z]=Le,R[Pe]=D,z=Pe):(R[z]=yt,R[ve]=D,z=ve);else if(Pe<K&&0>i(Le,D))R[z]=Le,R[Pe]=D,z=Pe;else break e}}return I}function i(R,I){var D=R.sortIndex-I.sortIndex;return D!==0?D:R.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,p=3,b=!1,j=!1,v=!1,h=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(R){for(var I=n(u);I!==null;){if(I.callback===null)s(u);else if(I.startTime<=R)s(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function w(R){if(v=!1,y(R),!j)if(n(c)!==null)j=!0,F(S);else{var I=n(u);I!==null&&$(w,I.startTime-R)}}function S(R,I){j=!1,v&&(v=!1,m(T),T=-1),b=!0;var D=p;try{for(y(I),f=n(c);f!==null&&(!(f.expirationTime>I)||R&&!A());){var z=f.callback;if(typeof z=="function"){f.callback=null,p=f.priorityLevel;var K=z(f.expirationTime<=I);I=e.unstable_now(),typeof K=="function"?f.callback=K:f===n(c)&&s(c),y(I)}else s(c);f=n(c)}if(f!==null)var se=!0;else{var ve=n(u);ve!==null&&$(w,ve.startTime-I),se=!1}return se}finally{f=null,p=D,b=!1}}var C=!1,k=null,T=-1,N=5,E=-1;function A(){return!(e.unstable_now()-E<N)}function P(){if(k!==null){var R=e.unstable_now();E=R;var I=!0;try{I=k(!0,R)}finally{I?M():(C=!1,k=null)}}else C=!1}var M;if(typeof x=="function")M=function(){x(P)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,O=_.port2;_.port1.onmessage=P,M=function(){O.postMessage(null)}}else M=function(){h(P,0)};function F(R){k=R,C||(C=!0,M())}function $(R,I){T=h(function(){R(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){j||b||(j=!0,F(S))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(R){switch(p){case 1:case 2:case 3:var I=3;break;default:I=p}var D=p;p=I;try{return R()}finally{p=D}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,I){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var D=p;p=R;try{return I()}finally{p=D}},e.unstable_scheduleCallback=function(R,I,D){var z=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?z+D:z):D=z,R){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=D+K,R={id:d++,callback:I,priorityLevel:R,startTime:D,expirationTime:K,sortIndex:-1},D>z?(R.sortIndex=D,t(u,R),n(c)===null&&R===n(u)&&(v?(m(T),T=-1):v=!0,$(w,D-z))):(R.sortIndex=K,t(c,R),j||b||(j=!0,F(S))),R},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(R){var I=p;return function(){var D=p;p=I;try{return R.apply(this,arguments)}finally{p=D}}}})(o0);i0.exports=o0;var aN=i0.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var lN=g,pt=aN;function U(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a0=new Set,Si={};function Os(e,t){yr(e,t),yr(e+"Capture",t)}function yr(e,t){for(Si[e]=t,e=0;e<t.length;e++)a0.add(t[e])}var xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fu=Object.prototype.hasOwnProperty,cN=/^[: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]*$/,xh={},yh={};function uN(e){return fu.call(yh,e)?!0:fu.call(xh,e)?!1:cN.test(e)?yh[e]=!0:(xh[e]=!0,!1)}function dN(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function fN(e,t,n,s){if(t===null||typeof t>"u"||dN(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ye(e,t,n,s,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Oe[e]=new Ye(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Oe[t]=new Ye(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Oe[e]=new Ye(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Oe[e]=new Ye(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Oe[e]=new Ye(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Oe[e]=new Ye(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Oe[e]=new Ye(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Oe[e]=new Ye(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Oe[e]=new Ye(e,5,!1,e.toLowerCase(),null,!1,!1)});var of=/[\-:]([a-z])/g;function af(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(of,af);Oe[t]=new Ye(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(of,af);Oe[t]=new Ye(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(of,af);Oe[t]=new Ye(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Oe[e]=new Ye(e,1,!1,e.toLowerCase(),null,!1,!1)});Oe.xlinkHref=new Ye("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Oe[e]=new Ye(e,1,!1,e.toLowerCase(),null,!0,!0)});function lf(e,t,n,s){var i=Oe.hasOwnProperty(t)?Oe[t]:null;(i!==null?i.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(fN(t,n,i,s)&&(n=null),s||i===null?uN(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,s=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var En=lN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,To=Symbol.for("react.element"),Hs=Symbol.for("react.portal"),qs=Symbol.for("react.fragment"),cf=Symbol.for("react.strict_mode"),mu=Symbol.for("react.profiler"),l0=Symbol.for("react.provider"),c0=Symbol.for("react.context"),uf=Symbol.for("react.forward_ref"),hu=Symbol.for("react.suspense"),pu=Symbol.for("react.suspense_list"),df=Symbol.for("react.memo"),On=Symbol.for("react.lazy"),u0=Symbol.for("react.offscreen"),vh=Symbol.iterator;function Br(e){return e===null||typeof e!="object"?null:(e=vh&&e[vh]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Object.assign,oc;function ni(e){if(oc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);oc=t&&t[1]||""}return`
34
- `+oc+e}var ac=!1;function lc(e,t){if(!e||ac)return"";ac=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var s=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){s=u}e.call(t.prototype)}else{try{throw Error()}catch(u){s=u}e()}}catch(u){if(u&&s&&typeof u.stack=="string"){for(var i=u.stack.split(`
35
- `),o=s.stack.split(`
36
- `),a=i.length-1,l=o.length-1;1<=a&&0<=l&&i[a]!==o[l];)l--;for(;1<=a&&0<=l;a--,l--)if(i[a]!==o[l]){if(a!==1||l!==1)do if(a--,l--,0>l||i[a]!==o[l]){var c=`
37
- `+i[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{ac=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ni(e):""}function mN(e){switch(e.tag){case 5:return ni(e.type);case 16:return ni("Lazy");case 13:return ni("Suspense");case 19:return ni("SuspenseList");case 0:case 2:case 15:return e=lc(e.type,!1),e;case 11:return e=lc(e.type.render,!1),e;case 1:return e=lc(e.type,!0),e;default:return""}}function gu(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qs:return"Fragment";case Hs:return"Portal";case mu:return"Profiler";case cf:return"StrictMode";case hu:return"Suspense";case pu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case c0:return(e.displayName||"Context")+".Consumer";case l0:return(e._context.displayName||"Context")+".Provider";case uf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case df:return t=e.displayName||null,t!==null?t:gu(e.type)||"Memo";case On:t=e._payload,e=e._init;try{return gu(e(t))}catch{}}return null}function hN(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return gu(t);case 8:return t===cf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Jn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function d0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pN(e){var t=d0(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){s=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(a){s=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ao(e){e._valueTracker||(e._valueTracker=pN(e))}function f0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=d0(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Pa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function xu(e,t){var n=t.checked;return ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bh(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Jn(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function m0(e,t){t=t.checked,t!=null&&lf(e,"checked",t,!1)}function yu(e,t){m0(e,t);var n=Jn(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?vu(e,t.type,n):t.hasOwnProperty("defaultValue")&&vu(e,t.type,Jn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wh(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function vu(e,t,n){(t!=="number"||Pa(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var si=Array.isArray;function lr(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Jn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,s&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function bu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(U(91));return ge({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function jh(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(U(92));if(si(n)){if(1<n.length)throw Error(U(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Jn(n)}}function h0(e,t){var n=Jn(t.value),s=Jn(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function Nh(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function p0(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function wu(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?p0(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ro,g0=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ro=Ro||document.createElement("div"),Ro.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ro.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ci(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ui={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},gN=["Webkit","ms","Moz","O"];Object.keys(ui).forEach(function(e){gN.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ui[t]=ui[e]})});function x0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ui.hasOwnProperty(e)&&ui[e]?(""+t).trim():t+"px"}function y0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=x0(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}var xN=ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ju(e,t){if(t){if(xN[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(U(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(U(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(U(61))}if(t.style!=null&&typeof t.style!="object")throw Error(U(62))}}function Nu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Su=null;function ff(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cu=null,cr=null,ur=null;function Sh(e){if(e=lo(e)){if(typeof Cu!="function")throw Error(U(280));var t=e.stateNode;t&&(t=Sl(t),Cu(e.stateNode,e.type,t))}}function v0(e){cr?ur?ur.push(e):ur=[e]:cr=e}function b0(){if(cr){var e=cr,t=ur;if(ur=cr=null,Sh(e),t)for(e=0;e<t.length;e++)Sh(t[e])}}function w0(e,t){return e(t)}function j0(){}var cc=!1;function N0(e,t,n){if(cc)return e(t,n);cc=!0;try{return w0(e,t,n)}finally{cc=!1,(cr!==null||ur!==null)&&(j0(),b0())}}function ki(e,t){var n=e.stateNode;if(n===null)return null;var s=Sl(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(U(231,t,typeof n));return n}var ku=!1;if(xn)try{var Wr={};Object.defineProperty(Wr,"passive",{get:function(){ku=!0}}),window.addEventListener("test",Wr,Wr),window.removeEventListener("test",Wr,Wr)}catch{ku=!1}function yN(e,t,n,s,i,o,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var di=!1,Ma=null,_a=!1,Eu=null,vN={onError:function(e){di=!0,Ma=e}};function bN(e,t,n,s,i,o,a,l,c){di=!1,Ma=null,yN.apply(vN,arguments)}function wN(e,t,n,s,i,o,a,l,c){if(bN.apply(this,arguments),di){if(di){var u=Ma;di=!1,Ma=null}else throw Error(U(198));_a||(_a=!0,Eu=u)}}function Ls(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function S0(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ch(e){if(Ls(e)!==e)throw Error(U(188))}function jN(e){var t=e.alternate;if(!t){if(t=Ls(e),t===null)throw Error(U(188));return t!==e?null:e}for(var n=e,s=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(s=i.return,s!==null){n=s;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Ch(i),e;if(o===s)return Ch(i),t;o=o.sibling}throw Error(U(188))}if(n.return!==s.return)n=i,s=o;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,s=o;break}if(l===s){a=!0,s=i,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,s=i;break}if(l===s){a=!0,s=o,n=i;break}l=l.sibling}if(!a)throw Error(U(189))}}if(n.alternate!==s)throw Error(U(190))}if(n.tag!==3)throw Error(U(188));return n.stateNode.current===n?e:t}function C0(e){return e=jN(e),e!==null?k0(e):null}function k0(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=k0(e);if(t!==null)return t;e=e.sibling}return null}var E0=pt.unstable_scheduleCallback,kh=pt.unstable_cancelCallback,NN=pt.unstable_shouldYield,SN=pt.unstable_requestPaint,we=pt.unstable_now,CN=pt.unstable_getCurrentPriorityLevel,mf=pt.unstable_ImmediatePriority,T0=pt.unstable_UserBlockingPriority,Ia=pt.unstable_NormalPriority,kN=pt.unstable_LowPriority,A0=pt.unstable_IdlePriority,bl=null,Qt=null;function EN(e){if(Qt&&typeof Qt.onCommitFiberRoot=="function")try{Qt.onCommitFiberRoot(bl,e,void 0,(e.current.flags&128)===128)}catch{}}var $t=Math.clz32?Math.clz32:RN,TN=Math.log,AN=Math.LN2;function RN(e){return e>>>=0,e===0?32:31-(TN(e)/AN|0)|0}var Po=64,Mo=4194304;function ri(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Oa(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~i;l!==0?s=ri(l):(o&=a,o!==0&&(s=ri(o)))}else a=n&~i,a!==0?s=ri(a):o!==0&&(s=ri(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&i)&&(i=s&-s,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-$t(t),i=1<<n,s|=e[n],t&=~i;return s}function PN(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function MN(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-$t(o),l=1<<a,c=i[a];c===-1?(!(l&n)||l&s)&&(i[a]=PN(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Tu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function R0(){var e=Po;return Po<<=1,!(Po&4194240)&&(Po=64),e}function uc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function oo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$t(t),e[t]=n}function _N(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-$t(n),o=1<<i;t[i]=0,s[i]=-1,e[i]=-1,n&=~o}}function hf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-$t(n),i=1<<s;i&t|e[s]&t&&(e[s]|=t),n&=~i}}var oe=0;function P0(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var M0,pf,_0,I0,O0,Au=!1,_o=[],Vn=null,Bn=null,Wn=null,Ei=new Map,Ti=new Map,Dn=[],IN="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 submit".split(" ");function Eh(e,t){switch(e){case"focusin":case"focusout":Vn=null;break;case"dragenter":case"dragleave":Bn=null;break;case"mouseover":case"mouseout":Wn=null;break;case"pointerover":case"pointerout":Ei.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ti.delete(t.pointerId)}}function Hr(e,t,n,s,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:o,targetContainers:[i]},t!==null&&(t=lo(t),t!==null&&pf(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function ON(e,t,n,s,i){switch(t){case"focusin":return Vn=Hr(Vn,e,t,n,s,i),!0;case"dragenter":return Bn=Hr(Bn,e,t,n,s,i),!0;case"mouseover":return Wn=Hr(Wn,e,t,n,s,i),!0;case"pointerover":var o=i.pointerId;return Ei.set(o,Hr(Ei.get(o)||null,e,t,n,s,i)),!0;case"gotpointercapture":return o=i.pointerId,Ti.set(o,Hr(Ti.get(o)||null,e,t,n,s,i)),!0}return!1}function L0(e){var t=xs(e.target);if(t!==null){var n=Ls(t);if(n!==null){if(t=n.tag,t===13){if(t=S0(n),t!==null){e.blockedOn=t,O0(e.priority,function(){_0(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ia(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ru(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Su=s,n.target.dispatchEvent(s),Su=null}else return t=lo(n),t!==null&&pf(t),e.blockedOn=n,!1;t.shift()}return!0}function Th(e,t,n){ia(e)&&n.delete(t)}function LN(){Au=!1,Vn!==null&&ia(Vn)&&(Vn=null),Bn!==null&&ia(Bn)&&(Bn=null),Wn!==null&&ia(Wn)&&(Wn=null),Ei.forEach(Th),Ti.forEach(Th)}function qr(e,t){e.blockedOn===t&&(e.blockedOn=null,Au||(Au=!0,pt.unstable_scheduleCallback(pt.unstable_NormalPriority,LN)))}function Ai(e){function t(i){return qr(i,e)}if(0<_o.length){qr(_o[0],e);for(var n=1;n<_o.length;n++){var s=_o[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Vn!==null&&qr(Vn,e),Bn!==null&&qr(Bn,e),Wn!==null&&qr(Wn,e),Ei.forEach(t),Ti.forEach(t),n=0;n<Dn.length;n++)s=Dn[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Dn.length&&(n=Dn[0],n.blockedOn===null);)L0(n),n.blockedOn===null&&Dn.shift()}var dr=En.ReactCurrentBatchConfig,La=!0;function DN(e,t,n,s){var i=oe,o=dr.transition;dr.transition=null;try{oe=1,gf(e,t,n,s)}finally{oe=i,dr.transition=o}}function FN(e,t,n,s){var i=oe,o=dr.transition;dr.transition=null;try{oe=4,gf(e,t,n,s)}finally{oe=i,dr.transition=o}}function gf(e,t,n,s){if(La){var i=Ru(e,t,n,s);if(i===null)bc(e,t,s,Da,n),Eh(e,s);else if(ON(i,e,t,n,s))s.stopPropagation();else if(Eh(e,s),t&4&&-1<IN.indexOf(e)){for(;i!==null;){var o=lo(i);if(o!==null&&M0(o),o=Ru(e,t,n,s),o===null&&bc(e,t,s,Da,n),o===i)break;i=o}i!==null&&s.stopPropagation()}else bc(e,t,s,null,n)}}var Da=null;function Ru(e,t,n,s){if(Da=null,e=ff(s),e=xs(e),e!==null)if(t=Ls(e),t===null)e=null;else if(n=t.tag,n===13){if(e=S0(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Da=e,null}function D0(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(CN()){case mf:return 1;case T0:return 4;case Ia:case kN:return 16;case A0:return 536870912;default:return 16}default:return 16}}var $n=null,xf=null,oa=null;function F0(){if(oa)return oa;var e,t=xf,n=t.length,s,i="value"in $n?$n.value:$n.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(s=1;s<=a&&t[n-s]===i[o-s];s++);return oa=i.slice(e,1<s?1-s:void 0)}function aa(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Io(){return!0}function Ah(){return!1}function xt(e){function t(n,s,i,o,a){this._reactName=n,this._targetInst=i,this.type=s,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Io:Ah,this.isPropagationStopped=Ah,this}return ge(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Io)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Io)},persist:function(){},isPersistent:Io}),t}var Ar={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yf=xt(Ar),ao=ge({},Ar,{view:0,detail:0}),$N=xt(ao),dc,fc,Kr,wl=ge({},ao,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Kr&&(Kr&&e.type==="mousemove"?(dc=e.screenX-Kr.screenX,fc=e.screenY-Kr.screenY):fc=dc=0,Kr=e),dc)},movementY:function(e){return"movementY"in e?e.movementY:fc}}),Rh=xt(wl),UN=ge({},wl,{dataTransfer:0}),zN=xt(UN),VN=ge({},ao,{relatedTarget:0}),mc=xt(VN),BN=ge({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),WN=xt(BN),HN=ge({},Ar,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qN=xt(HN),KN=ge({},Ar,{data:0}),Ph=xt(KN),GN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},YN={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"},XN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QN(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=XN[e])?!!t[e]:!1}function vf(){return QN}var JN=ge({},ao,{key:function(e){if(e.key){var t=GN[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=aa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?YN[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vf,charCode:function(e){return e.type==="keypress"?aa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?aa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ZN=xt(JN),e2=ge({},wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mh=xt(e2),t2=ge({},ao,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vf}),n2=xt(t2),s2=ge({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),r2=xt(s2),i2=ge({},wl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),o2=xt(i2),a2=[9,13,27,32],bf=xn&&"CompositionEvent"in window,fi=null;xn&&"documentMode"in document&&(fi=document.documentMode);var l2=xn&&"TextEvent"in window&&!fi,$0=xn&&(!bf||fi&&8<fi&&11>=fi),_h=" ",Ih=!1;function U0(e,t){switch(e){case"keyup":return a2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function z0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ks=!1;function c2(e,t){switch(e){case"compositionend":return z0(t);case"keypress":return t.which!==32?null:(Ih=!0,_h);case"textInput":return e=t.data,e===_h&&Ih?null:e;default:return null}}function u2(e,t){if(Ks)return e==="compositionend"||!bf&&U0(e,t)?(e=F0(),oa=xf=$n=null,Ks=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return $0&&t.locale!=="ko"?null:t.data;default:return null}}var d2={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 Oh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!d2[e.type]:t==="textarea"}function V0(e,t,n,s){v0(s),t=Fa(t,"onChange"),0<t.length&&(n=new yf("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var mi=null,Ri=null;function f2(e){Z0(e,0)}function jl(e){var t=Xs(e);if(f0(t))return e}function m2(e,t){if(e==="change")return t}var B0=!1;if(xn){var hc;if(xn){var pc="oninput"in document;if(!pc){var Lh=document.createElement("div");Lh.setAttribute("oninput","return;"),pc=typeof Lh.oninput=="function"}hc=pc}else hc=!1;B0=hc&&(!document.documentMode||9<document.documentMode)}function Dh(){mi&&(mi.detachEvent("onpropertychange",W0),Ri=mi=null)}function W0(e){if(e.propertyName==="value"&&jl(Ri)){var t=[];V0(t,Ri,e,ff(e)),N0(f2,t)}}function h2(e,t,n){e==="focusin"?(Dh(),mi=t,Ri=n,mi.attachEvent("onpropertychange",W0)):e==="focusout"&&Dh()}function p2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jl(Ri)}function g2(e,t){if(e==="click")return jl(t)}function x2(e,t){if(e==="input"||e==="change")return jl(t)}function y2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zt=typeof Object.is=="function"?Object.is:y2;function Pi(e,t){if(zt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var i=n[s];if(!fu.call(t,i)||!zt(e[i],t[i]))return!1}return!0}function Fh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $h(e,t){var n=Fh(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fh(n)}}function H0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?H0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function q0(){for(var e=window,t=Pa();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pa(e.document)}return t}function wf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function v2(e){var t=q0(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&H0(n.ownerDocument.documentElement,n)){if(s!==null&&wf(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(s.start,i);s=s.end===void 0?o:Math.min(s.end,i),!e.extend&&o>s&&(i=s,s=o,o=i),i=$h(n,o);var a=$h(n,s);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var b2=xn&&"documentMode"in document&&11>=document.documentMode,Gs=null,Pu=null,hi=null,Mu=!1;function Uh(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mu||Gs==null||Gs!==Pa(s)||(s=Gs,"selectionStart"in s&&wf(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),hi&&Pi(hi,s)||(hi=s,s=Fa(Pu,"onSelect"),0<s.length&&(t=new yf("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Gs)))}function Oo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ys={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionend:Oo("Transition","TransitionEnd")},gc={},K0={};xn&&(K0=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 Nl(e){if(gc[e])return gc[e];if(!Ys[e])return e;var t=Ys[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in K0)return gc[e]=t[n];return e}var G0=Nl("animationend"),Y0=Nl("animationiteration"),X0=Nl("animationstart"),Q0=Nl("transitionend"),J0=new Map,zh="abort auxClick 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(" ");function is(e,t){J0.set(e,t),Os(t,[e])}for(var xc=0;xc<zh.length;xc++){var yc=zh[xc],w2=yc.toLowerCase(),j2=yc[0].toUpperCase()+yc.slice(1);is(w2,"on"+j2)}is(G0,"onAnimationEnd");is(Y0,"onAnimationIteration");is(X0,"onAnimationStart");is("dblclick","onDoubleClick");is("focusin","onFocus");is("focusout","onBlur");is(Q0,"onTransitionEnd");yr("onMouseEnter",["mouseout","mouseover"]);yr("onMouseLeave",["mouseout","mouseover"]);yr("onPointerEnter",["pointerout","pointerover"]);yr("onPointerLeave",["pointerout","pointerover"]);Os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Os("onBeforeInput",["compositionend","keypress","textInput","paste"]);Os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ii="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(" "),N2=new Set("cancel close invalid load scroll toggle".split(" ").concat(ii));function Vh(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,wN(s,t,void 0,e),e.currentTarget=null}function Z0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],i=s.event;s=s.listeners;e:{var o=void 0;if(t)for(var a=s.length-1;0<=a;a--){var l=s[a],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==o&&i.isPropagationStopped())break e;Vh(i,l,u),o=c}else for(a=0;a<s.length;a++){if(l=s[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==o&&i.isPropagationStopped())break e;Vh(i,l,u),o=c}}}if(_a)throw e=Eu,_a=!1,Eu=null,e}function ce(e,t){var n=t[Du];n===void 0&&(n=t[Du]=new Set);var s=e+"__bubble";n.has(s)||(ey(t,e,2,!1),n.add(s))}function vc(e,t,n){var s=0;t&&(s|=4),ey(n,e,s,t)}var Lo="_reactListening"+Math.random().toString(36).slice(2);function Mi(e){if(!e[Lo]){e[Lo]=!0,a0.forEach(function(n){n!=="selectionchange"&&(N2.has(n)||vc(n,!1,e),vc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Lo]||(t[Lo]=!0,vc("selectionchange",!1,t))}}function ey(e,t,n,s){switch(D0(t)){case 1:var i=DN;break;case 4:i=FN;break;default:i=gf}n=i.bind(null,t,n,e),i=void 0,!ku||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),s?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function bc(e,t,n,s,i){var o=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var a=s.tag;if(a===3||a===4){var l=s.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(a===4)for(a=s.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;a=a.return}for(;l!==null;){if(a=xs(l),a===null)return;if(c=a.tag,c===5||c===6){s=o=a;continue e}l=l.parentNode}}s=s.return}N0(function(){var u=o,d=ff(n),f=[];e:{var p=J0.get(e);if(p!==void 0){var b=yf,j=e;switch(e){case"keypress":if(aa(n)===0)break e;case"keydown":case"keyup":b=ZN;break;case"focusin":j="focus",b=mc;break;case"focusout":j="blur",b=mc;break;case"beforeblur":case"afterblur":b=mc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":b=Rh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":b=zN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":b=n2;break;case G0:case Y0:case X0:b=WN;break;case Q0:b=r2;break;case"scroll":b=$N;break;case"wheel":b=o2;break;case"copy":case"cut":case"paste":b=qN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":b=Mh}var v=(t&4)!==0,h=!v&&e==="scroll",m=v?p!==null?p+"Capture":null:p;v=[];for(var x=u,y;x!==null;){y=x;var w=y.stateNode;if(y.tag===5&&w!==null&&(y=w,m!==null&&(w=ki(x,m),w!=null&&v.push(_i(x,w,y)))),h)break;x=x.return}0<v.length&&(p=new b(p,j,null,n,d),f.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",b=e==="mouseout"||e==="pointerout",p&&n!==Su&&(j=n.relatedTarget||n.fromElement)&&(xs(j)||j[yn]))break e;if((b||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,b?(j=n.relatedTarget||n.toElement,b=u,j=j?xs(j):null,j!==null&&(h=Ls(j),j!==h||j.tag!==5&&j.tag!==6)&&(j=null)):(b=null,j=u),b!==j)){if(v=Rh,w="onMouseLeave",m="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(v=Mh,w="onPointerLeave",m="onPointerEnter",x="pointer"),h=b==null?p:Xs(b),y=j==null?p:Xs(j),p=new v(w,x+"leave",b,n,d),p.target=h,p.relatedTarget=y,w=null,xs(d)===u&&(v=new v(m,x+"enter",j,n,d),v.target=y,v.relatedTarget=h,w=v),h=w,b&&j)t:{for(v=b,m=j,x=0,y=v;y;y=Us(y))x++;for(y=0,w=m;w;w=Us(w))y++;for(;0<x-y;)v=Us(v),x--;for(;0<y-x;)m=Us(m),y--;for(;x--;){if(v===m||m!==null&&v===m.alternate)break t;v=Us(v),m=Us(m)}v=null}else v=null;b!==null&&Bh(f,p,b,v,!1),j!==null&&h!==null&&Bh(f,h,j,v,!0)}}e:{if(p=u?Xs(u):window,b=p.nodeName&&p.nodeName.toLowerCase(),b==="select"||b==="input"&&p.type==="file")var S=m2;else if(Oh(p))if(B0)S=x2;else{S=p2;var C=h2}else(b=p.nodeName)&&b.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(S=g2);if(S&&(S=S(e,u))){V0(f,S,n,d);break e}C&&C(e,p,u),e==="focusout"&&(C=p._wrapperState)&&C.controlled&&p.type==="number"&&vu(p,"number",p.value)}switch(C=u?Xs(u):window,e){case"focusin":(Oh(C)||C.contentEditable==="true")&&(Gs=C,Pu=u,hi=null);break;case"focusout":hi=Pu=Gs=null;break;case"mousedown":Mu=!0;break;case"contextmenu":case"mouseup":case"dragend":Mu=!1,Uh(f,n,d);break;case"selectionchange":if(b2)break;case"keydown":case"keyup":Uh(f,n,d)}var k;if(bf)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ks?U0(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&($0&&n.locale!=="ko"&&(Ks||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ks&&(k=F0()):($n=d,xf="value"in $n?$n.value:$n.textContent,Ks=!0)),C=Fa(u,T),0<C.length&&(T=new Ph(T,e,null,n,d),f.push({event:T,listeners:C}),k?T.data=k:(k=z0(n),k!==null&&(T.data=k)))),(k=l2?c2(e,n):u2(e,n))&&(u=Fa(u,"onBeforeInput"),0<u.length&&(d=new Ph("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=k))}Z0(f,t)})}function _i(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fa(e,t){for(var n=t+"Capture",s=[];e!==null;){var i=e,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=ki(e,n),o!=null&&s.unshift(_i(e,o,i)),o=ki(e,t),o!=null&&s.push(_i(e,o,i))),e=e.return}return s}function Us(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bh(e,t,n,s,i){for(var o=t._reactName,a=[];n!==null&&n!==s;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===s)break;l.tag===5&&u!==null&&(l=u,i?(c=ki(n,o),c!=null&&a.unshift(_i(n,c,l))):i||(c=ki(n,o),c!=null&&a.push(_i(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var S2=/\r\n?/g,C2=/\u0000|\uFFFD/g;function Wh(e){return(typeof e=="string"?e:""+e).replace(S2,`
38
- `).replace(C2,"")}function Do(e,t,n){if(t=Wh(t),Wh(e)!==t&&n)throw Error(U(425))}function $a(){}var _u=null,Iu=null;function Ou(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Lu=typeof setTimeout=="function"?setTimeout:void 0,k2=typeof clearTimeout=="function"?clearTimeout:void 0,Hh=typeof Promise=="function"?Promise:void 0,E2=typeof queueMicrotask=="function"?queueMicrotask:typeof Hh<"u"?function(e){return Hh.resolve(null).then(e).catch(T2)}:Lu;function T2(e){setTimeout(function(){throw e})}function wc(e,t){var n=t,s=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(s===0){e.removeChild(i),Ai(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=i}while(n);Ai(t)}function Hn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function qh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Rr=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Rr,Ii="__reactProps$"+Rr,yn="__reactContainer$"+Rr,Du="__reactEvents$"+Rr,A2="__reactListeners$"+Rr,R2="__reactHandles$"+Rr;function xs(e){var t=e[Gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yn]||n[Gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=qh(e);e!==null;){if(n=e[Gt])return n;e=qh(e)}return t}e=n,n=e.parentNode}return null}function lo(e){return e=e[Gt]||e[yn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Xs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(U(33))}function Sl(e){return e[Ii]||null}var Fu=[],Qs=-1;function os(e){return{current:e}}function ue(e){0>Qs||(e.current=Fu[Qs],Fu[Qs]=null,Qs--)}function ae(e,t){Qs++,Fu[Qs]=e.current,e.current=t}var Zn={},Ve=os(Zn),rt=os(!1),Ts=Zn;function vr(e,t){var n=e.type.contextTypes;if(!n)return Zn;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function it(e){return e=e.childContextTypes,e!=null}function Ua(){ue(rt),ue(Ve)}function Kh(e,t,n){if(Ve.current!==Zn)throw Error(U(168));ae(Ve,t),ae(rt,n)}function ty(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in t))throw Error(U(108,hN(e)||"Unknown",i));return ge({},n,s)}function za(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zn,Ts=Ve.current,ae(Ve,e),ae(rt,rt.current),!0}function Gh(e,t,n){var s=e.stateNode;if(!s)throw Error(U(169));n?(e=ty(e,t,Ts),s.__reactInternalMemoizedMergedChildContext=e,ue(rt),ue(Ve),ae(Ve,e)):ue(rt),ae(rt,n)}var dn=null,Cl=!1,jc=!1;function ny(e){dn===null?dn=[e]:dn.push(e)}function P2(e){Cl=!0,ny(e)}function as(){if(!jc&&dn!==null){jc=!0;var e=0,t=oe;try{var n=dn;for(oe=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}dn=null,Cl=!1}catch(i){throw dn!==null&&(dn=dn.slice(e+1)),E0(mf,as),i}finally{oe=t,jc=!1}}return null}var Js=[],Zs=0,Va=null,Ba=0,jt=[],Nt=0,As=null,hn=1,pn="";function hs(e,t){Js[Zs++]=Ba,Js[Zs++]=Va,Va=e,Ba=t}function sy(e,t,n){jt[Nt++]=hn,jt[Nt++]=pn,jt[Nt++]=As,As=e;var s=hn;e=pn;var i=32-$t(s)-1;s&=~(1<<i),n+=1;var o=32-$t(t)+i;if(30<o){var a=i-i%5;o=(s&(1<<a)-1).toString(32),s>>=a,i-=a,hn=1<<32-$t(t)+i|n<<i|s,pn=o+e}else hn=1<<o|n<<i|s,pn=e}function jf(e){e.return!==null&&(hs(e,1),sy(e,1,0))}function Nf(e){for(;e===Va;)Va=Js[--Zs],Js[Zs]=null,Ba=Js[--Zs],Js[Zs]=null;for(;e===As;)As=jt[--Nt],jt[Nt]=null,pn=jt[--Nt],jt[Nt]=null,hn=jt[--Nt],jt[Nt]=null}var mt=null,ft=null,de=!1,Ft=null;function ry(e,t){var n=kt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Yh(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,mt=e,ft=Hn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,mt=e,ft=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=As!==null?{id:hn,overflow:pn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=kt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,mt=e,ft=null,!0):!1;default:return!1}}function $u(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Uu(e){if(de){var t=ft;if(t){var n=t;if(!Yh(e,t)){if($u(e))throw Error(U(418));t=Hn(n.nextSibling);var s=mt;t&&Yh(e,t)?ry(s,n):(e.flags=e.flags&-4097|2,de=!1,mt=e)}}else{if($u(e))throw Error(U(418));e.flags=e.flags&-4097|2,de=!1,mt=e}}}function Xh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;mt=e}function Fo(e){if(e!==mt)return!1;if(!de)return Xh(e),de=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ou(e.type,e.memoizedProps)),t&&(t=ft)){if($u(e))throw iy(),Error(U(418));for(;t;)ry(e,t),t=Hn(t.nextSibling)}if(Xh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ft=Hn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ft=null}}else ft=mt?Hn(e.stateNode.nextSibling):null;return!0}function iy(){for(var e=ft;e;)e=Hn(e.nextSibling)}function br(){ft=mt=null,de=!1}function Sf(e){Ft===null?Ft=[e]:Ft.push(e)}var M2=En.ReactCurrentBatchConfig;function Gr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(U(309));var s=n.stateNode}if(!s)throw Error(U(147,e));var i=s,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var l=i.refs;a===null?delete l[o]:l[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(U(284));if(!n._owner)throw Error(U(290,e))}return e}function $o(e,t){throw e=Object.prototype.toString.call(t),Error(U(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qh(e){var t=e._init;return t(e._payload)}function oy(e){function t(m,x){if(e){var y=m.deletions;y===null?(m.deletions=[x],m.flags|=16):y.push(x)}}function n(m,x){if(!e)return null;for(;x!==null;)t(m,x),x=x.sibling;return null}function s(m,x){for(m=new Map;x!==null;)x.key!==null?m.set(x.key,x):m.set(x.index,x),x=x.sibling;return m}function i(m,x){return m=Yn(m,x),m.index=0,m.sibling=null,m}function o(m,x,y){return m.index=y,e?(y=m.alternate,y!==null?(y=y.index,y<x?(m.flags|=2,x):y):(m.flags|=2,x)):(m.flags|=1048576,x)}function a(m){return e&&m.alternate===null&&(m.flags|=2),m}function l(m,x,y,w){return x===null||x.tag!==6?(x=Ac(y,m.mode,w),x.return=m,x):(x=i(x,y),x.return=m,x)}function c(m,x,y,w){var S=y.type;return S===qs?d(m,x,y.props.children,w,y.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===On&&Qh(S)===x.type)?(w=i(x,y.props),w.ref=Gr(m,x,y),w.return=m,w):(w=ha(y.type,y.key,y.props,null,m.mode,w),w.ref=Gr(m,x,y),w.return=m,w)}function u(m,x,y,w){return x===null||x.tag!==4||x.stateNode.containerInfo!==y.containerInfo||x.stateNode.implementation!==y.implementation?(x=Rc(y,m.mode,w),x.return=m,x):(x=i(x,y.children||[]),x.return=m,x)}function d(m,x,y,w,S){return x===null||x.tag!==7?(x=Ss(y,m.mode,w,S),x.return=m,x):(x=i(x,y),x.return=m,x)}function f(m,x,y){if(typeof x=="string"&&x!==""||typeof x=="number")return x=Ac(""+x,m.mode,y),x.return=m,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case To:return y=ha(x.type,x.key,x.props,null,m.mode,y),y.ref=Gr(m,null,x),y.return=m,y;case Hs:return x=Rc(x,m.mode,y),x.return=m,x;case On:var w=x._init;return f(m,w(x._payload),y)}if(si(x)||Br(x))return x=Ss(x,m.mode,y,null),x.return=m,x;$o(m,x)}return null}function p(m,x,y,w){var S=x!==null?x.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return S!==null?null:l(m,x,""+y,w);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case To:return y.key===S?c(m,x,y,w):null;case Hs:return y.key===S?u(m,x,y,w):null;case On:return S=y._init,p(m,x,S(y._payload),w)}if(si(y)||Br(y))return S!==null?null:d(m,x,y,w,null);$o(m,y)}return null}function b(m,x,y,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return m=m.get(y)||null,l(x,m,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case To:return m=m.get(w.key===null?y:w.key)||null,c(x,m,w,S);case Hs:return m=m.get(w.key===null?y:w.key)||null,u(x,m,w,S);case On:var C=w._init;return b(m,x,y,C(w._payload),S)}if(si(w)||Br(w))return m=m.get(y)||null,d(x,m,w,S,null);$o(x,w)}return null}function j(m,x,y,w){for(var S=null,C=null,k=x,T=x=0,N=null;k!==null&&T<y.length;T++){k.index>T?(N=k,k=null):N=k.sibling;var E=p(m,k,y[T],w);if(E===null){k===null&&(k=N);break}e&&k&&E.alternate===null&&t(m,k),x=o(E,x,T),C===null?S=E:C.sibling=E,C=E,k=N}if(T===y.length)return n(m,k),de&&hs(m,T),S;if(k===null){for(;T<y.length;T++)k=f(m,y[T],w),k!==null&&(x=o(k,x,T),C===null?S=k:C.sibling=k,C=k);return de&&hs(m,T),S}for(k=s(m,k);T<y.length;T++)N=b(k,m,T,y[T],w),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?T:N.key),x=o(N,x,T),C===null?S=N:C.sibling=N,C=N);return e&&k.forEach(function(A){return t(m,A)}),de&&hs(m,T),S}function v(m,x,y,w){var S=Br(y);if(typeof S!="function")throw Error(U(150));if(y=S.call(y),y==null)throw Error(U(151));for(var C=S=null,k=x,T=x=0,N=null,E=y.next();k!==null&&!E.done;T++,E=y.next()){k.index>T?(N=k,k=null):N=k.sibling;var A=p(m,k,E.value,w);if(A===null){k===null&&(k=N);break}e&&k&&A.alternate===null&&t(m,k),x=o(A,x,T),C===null?S=A:C.sibling=A,C=A,k=N}if(E.done)return n(m,k),de&&hs(m,T),S;if(k===null){for(;!E.done;T++,E=y.next())E=f(m,E.value,w),E!==null&&(x=o(E,x,T),C===null?S=E:C.sibling=E,C=E);return de&&hs(m,T),S}for(k=s(m,k);!E.done;T++,E=y.next())E=b(k,m,T,E.value,w),E!==null&&(e&&E.alternate!==null&&k.delete(E.key===null?T:E.key),x=o(E,x,T),C===null?S=E:C.sibling=E,C=E);return e&&k.forEach(function(P){return t(m,P)}),de&&hs(m,T),S}function h(m,x,y,w){if(typeof y=="object"&&y!==null&&y.type===qs&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case To:e:{for(var S=y.key,C=x;C!==null;){if(C.key===S){if(S=y.type,S===qs){if(C.tag===7){n(m,C.sibling),x=i(C,y.props.children),x.return=m,m=x;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===On&&Qh(S)===C.type){n(m,C.sibling),x=i(C,y.props),x.ref=Gr(m,C,y),x.return=m,m=x;break e}n(m,C);break}else t(m,C);C=C.sibling}y.type===qs?(x=Ss(y.props.children,m.mode,w,y.key),x.return=m,m=x):(w=ha(y.type,y.key,y.props,null,m.mode,w),w.ref=Gr(m,x,y),w.return=m,m=w)}return a(m);case Hs:e:{for(C=y.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===y.containerInfo&&x.stateNode.implementation===y.implementation){n(m,x.sibling),x=i(x,y.children||[]),x.return=m,m=x;break e}else{n(m,x);break}else t(m,x);x=x.sibling}x=Rc(y,m.mode,w),x.return=m,m=x}return a(m);case On:return C=y._init,h(m,x,C(y._payload),w)}if(si(y))return j(m,x,y,w);if(Br(y))return v(m,x,y,w);$o(m,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,x!==null&&x.tag===6?(n(m,x.sibling),x=i(x,y),x.return=m,m=x):(n(m,x),x=Ac(y,m.mode,w),x.return=m,m=x),a(m)):n(m,x)}return h}var wr=oy(!0),ay=oy(!1),Wa=os(null),Ha=null,er=null,Cf=null;function kf(){Cf=er=Ha=null}function Ef(e){var t=Wa.current;ue(Wa),e._currentValue=t}function zu(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function fr(e,t){Ha=e,Cf=er=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(nt=!0),e.firstContext=null)}function Rt(e){var t=e._currentValue;if(Cf!==e)if(e={context:e,memoizedValue:t,next:null},er===null){if(Ha===null)throw Error(U(308));er=e,Ha.dependencies={lanes:0,firstContext:e}}else er=er.next=e;return t}var ys=null;function Tf(e){ys===null?ys=[e]:ys.push(e)}function ly(e,t,n,s){var i=t.interleaved;return i===null?(n.next=n,Tf(t)):(n.next=i.next,i.next=n),t.interleaved=n,vn(e,s)}function vn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ln=!1;function Af(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ie&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,vn(e,n)}return i=s.interleaved,i===null?(t.next=t,Tf(s)):(t.next=i.next,i.next=t),s.interleaved=t,vn(e,n)}function la(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,hf(e,n)}}function Jh(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function qa(e,t,n,s){var i=e.updateQueue;Ln=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?o=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=i.baseState;a=0,d=u=c=null,l=o;do{var p=l.lane,b=l.eventTime;if((s&p)===p){d!==null&&(d=d.next={eventTime:b,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var j=e,v=l;switch(p=t,b=n,v.tag){case 1:if(j=v.payload,typeof j=="function"){f=j.call(b,f,p);break e}f=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,p=typeof j=="function"?j.call(b,f,p):j,p==null)break e;f=ge({},f,p);break e;case 2:Ln=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else b={eventTime:b,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=b,c=f):d=d.next=b,a|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Ps|=a,e.lanes=a,e.memoizedState=f}}function Zh(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],i=s.callback;if(i!==null){if(s.callback=null,s=n,typeof i!="function")throw Error(U(191,i));i.call(s)}}}var co={},Jt=os(co),Oi=os(co),Li=os(co);function vs(e){if(e===co)throw Error(U(174));return e}function Rf(e,t){switch(ae(Li,t),ae(Oi,e),ae(Jt,co),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:wu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=wu(t,e)}ue(Jt),ae(Jt,t)}function jr(){ue(Jt),ue(Oi),ue(Li)}function uy(e){vs(Li.current);var t=vs(Jt.current),n=wu(t,e.type);t!==n&&(ae(Oi,e),ae(Jt,n))}function Pf(e){Oi.current===e&&(ue(Jt),ue(Oi))}var fe=os(0);function Ka(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Nc=[];function Mf(){for(var e=0;e<Nc.length;e++)Nc[e]._workInProgressVersionPrimary=null;Nc.length=0}var ca=En.ReactCurrentDispatcher,Sc=En.ReactCurrentBatchConfig,Rs=0,he=null,Ee=null,Ae=null,Ga=!1,pi=!1,Di=0,_2=0;function De(){throw Error(U(321))}function _f(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!zt(e[n],t[n]))return!1;return!0}function If(e,t,n,s,i,o){if(Rs=o,he=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ca.current=e===null||e.memoizedState===null?D2:F2,e=n(s,i),pi){o=0;do{if(pi=!1,Di=0,25<=o)throw Error(U(301));o+=1,Ae=Ee=null,t.updateQueue=null,ca.current=$2,e=n(s,i)}while(pi)}if(ca.current=Ya,t=Ee!==null&&Ee.next!==null,Rs=0,Ae=Ee=he=null,Ga=!1,t)throw Error(U(300));return e}function Of(){var e=Di!==0;return Di=0,e}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ae===null?he.memoizedState=Ae=e:Ae=Ae.next=e,Ae}function Pt(){if(Ee===null){var e=he.alternate;e=e!==null?e.memoizedState:null}else e=Ee.next;var t=Ae===null?he.memoizedState:Ae.next;if(t!==null)Ae=t,Ee=e;else{if(e===null)throw Error(U(310));Ee=e,e={memoizedState:Ee.memoizedState,baseState:Ee.baseState,baseQueue:Ee.baseQueue,queue:Ee.queue,next:null},Ae===null?he.memoizedState=Ae=e:Ae=Ae.next=e}return Ae}function Fi(e,t){return typeof t=="function"?t(e):t}function Cc(e){var t=Pt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var s=Ee,i=s.baseQueue,o=n.pending;if(o!==null){if(i!==null){var a=i.next;i.next=o.next,o.next=a}s.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,s=s.baseState;var l=a=null,c=null,u=o;do{var d=u.lane;if((Rs&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),s=u.hasEagerState?u.eagerState:e(s,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,a=s):c=c.next=f,he.lanes|=d,Ps|=d}u=u.next}while(u!==null&&u!==o);c===null?a=s:c.next=l,zt(s,t.memoizedState)||(nt=!0),t.memoizedState=s,t.baseState=a,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){i=e;do o=i.lane,he.lanes|=o,Ps|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function kc(e){var t=Pt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var s=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do o=e(o,a.action),a=a.next;while(a!==i);zt(o,t.memoizedState)||(nt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function dy(){}function fy(e,t){var n=he,s=Pt(),i=t(),o=!zt(s.memoizedState,i);if(o&&(s.memoizedState=i,nt=!0),s=s.queue,Lf(py.bind(null,n,s,e),[e]),s.getSnapshot!==t||o||Ae!==null&&Ae.memoizedState.tag&1){if(n.flags|=2048,$i(9,hy.bind(null,n,s,i,t),void 0,null),Re===null)throw Error(U(349));Rs&30||my(n,t,i)}return i}function my(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=he.updateQueue,t===null?(t={lastEffect:null,stores:null},he.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function hy(e,t,n,s){t.value=n,t.getSnapshot=s,gy(t)&&xy(e)}function py(e,t,n){return n(function(){gy(t)&&xy(e)})}function gy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zt(e,n)}catch{return!0}}function xy(e){var t=vn(e,1);t!==null&&Ut(t,e,1,-1)}function ep(e){var t=Kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fi,lastRenderedState:e},t.queue=e,e=e.dispatch=L2.bind(null,he,e),[t.memoizedState,e]}function $i(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=he.updateQueue,t===null?(t={lastEffect:null,stores:null},he.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function yy(){return Pt().memoizedState}function ua(e,t,n,s){var i=Kt();he.flags|=e,i.memoizedState=$i(1|t,n,void 0,s===void 0?null:s)}function kl(e,t,n,s){var i=Pt();s=s===void 0?null:s;var o=void 0;if(Ee!==null){var a=Ee.memoizedState;if(o=a.destroy,s!==null&&_f(s,a.deps)){i.memoizedState=$i(t,n,o,s);return}}he.flags|=e,i.memoizedState=$i(1|t,n,o,s)}function tp(e,t){return ua(8390656,8,e,t)}function Lf(e,t){return kl(2048,8,e,t)}function vy(e,t){return kl(4,2,e,t)}function by(e,t){return kl(4,4,e,t)}function wy(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function jy(e,t,n){return n=n!=null?n.concat([e]):null,kl(4,4,wy.bind(null,t,e),n)}function Df(){}function Ny(e,t){var n=Pt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&_f(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Sy(e,t){var n=Pt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&_f(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function Cy(e,t,n){return Rs&21?(zt(n,t)||(n=R0(),he.lanes|=n,Ps|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,nt=!0),e.memoizedState=n)}function I2(e,t){var n=oe;oe=n!==0&&4>n?n:4,e(!0);var s=Sc.transition;Sc.transition={};try{e(!1),t()}finally{oe=n,Sc.transition=s}}function ky(){return Pt().memoizedState}function O2(e,t,n){var s=Gn(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Ey(e))Ty(t,n);else if(n=ly(e,t,n,s),n!==null){var i=qe();Ut(n,e,s,i),Ay(n,t,s)}}function L2(e,t,n){var s=Gn(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ey(e))Ty(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,l=o(a,n);if(i.hasEagerState=!0,i.eagerState=l,zt(l,a)){var c=t.interleaved;c===null?(i.next=i,Tf(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=ly(e,t,i,s),n!==null&&(i=qe(),Ut(n,e,s,i),Ay(n,t,s))}}function Ey(e){var t=e.alternate;return e===he||t!==null&&t===he}function Ty(e,t){pi=Ga=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ay(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,hf(e,n)}}var Ya={readContext:Rt,useCallback:De,useContext:De,useEffect:De,useImperativeHandle:De,useInsertionEffect:De,useLayoutEffect:De,useMemo:De,useReducer:De,useRef:De,useState:De,useDebugValue:De,useDeferredValue:De,useTransition:De,useMutableSource:De,useSyncExternalStore:De,useId:De,unstable_isNewReconciler:!1},D2={readContext:Rt,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:Rt,useEffect:tp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ua(4194308,4,wy.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ua(4194308,4,e,t)},useInsertionEffect:function(e,t){return ua(4,2,e,t)},useMemo:function(e,t){var n=Kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Kt();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=O2.bind(null,he,e),[s.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:ep,useDebugValue:Df,useDeferredValue:function(e){return Kt().memoizedState=e},useTransition:function(){var e=ep(!1),t=e[0];return e=I2.bind(null,e[1]),Kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=he,i=Kt();if(de){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),Re===null)throw Error(U(349));Rs&30||my(s,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,tp(py.bind(null,s,o,e),[e]),s.flags|=2048,$i(9,hy.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=Kt(),t=Re.identifierPrefix;if(de){var n=pn,s=hn;n=(s&~(1<<32-$t(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=Di++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=_2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},F2={readContext:Rt,useCallback:Ny,useContext:Rt,useEffect:Lf,useImperativeHandle:jy,useInsertionEffect:vy,useLayoutEffect:by,useMemo:Sy,useReducer:Cc,useRef:yy,useState:function(){return Cc(Fi)},useDebugValue:Df,useDeferredValue:function(e){var t=Pt();return Cy(t,Ee.memoizedState,e)},useTransition:function(){var e=Cc(Fi)[0],t=Pt().memoizedState;return[e,t]},useMutableSource:dy,useSyncExternalStore:fy,useId:ky,unstable_isNewReconciler:!1},$2={readContext:Rt,useCallback:Ny,useContext:Rt,useEffect:Lf,useImperativeHandle:jy,useInsertionEffect:vy,useLayoutEffect:by,useMemo:Sy,useReducer:kc,useRef:yy,useState:function(){return kc(Fi)},useDebugValue:Df,useDeferredValue:function(e){var t=Pt();return Ee===null?t.memoizedState=e:Cy(t,Ee.memoizedState,e)},useTransition:function(){var e=kc(Fi)[0],t=Pt().memoizedState;return[e,t]},useMutableSource:dy,useSyncExternalStore:fy,useId:ky,unstable_isNewReconciler:!1};function Ot(e,t){if(e&&e.defaultProps){t=ge({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Vu(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:ge({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var El={isMounted:function(e){return(e=e._reactInternals)?Ls(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=qe(),i=Gn(e),o=gn(s,i);o.payload=t,n!=null&&(o.callback=n),t=qn(e,o,i),t!==null&&(Ut(t,e,i,s),la(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=qe(),i=Gn(e),o=gn(s,i);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=qn(e,o,i),t!==null&&(Ut(t,e,i,s),la(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=qe(),s=Gn(e),i=gn(n,s);i.tag=2,t!=null&&(i.callback=t),t=qn(e,i,s),t!==null&&(Ut(t,e,s,n),la(t,e,s))}};function np(e,t,n,s,i,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,o,a):t.prototype&&t.prototype.isPureReactComponent?!Pi(n,s)||!Pi(i,o):!0}function Ry(e,t,n){var s=!1,i=Zn,o=t.contextType;return typeof o=="object"&&o!==null?o=Rt(o):(i=it(t)?Ts:Ve.current,s=t.contextTypes,o=(s=s!=null)?vr(e,i):Zn),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=El,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function sp(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&El.enqueueReplaceState(t,t.state,null)}function Bu(e,t,n,s){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Af(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=Rt(o):(o=it(t)?Ts:Ve.current,i.context=vr(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Vu(e,t,o,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&El.enqueueReplaceState(i,i.state,null),qa(e,n,i,s),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Nr(e,t){try{var n="",s=t;do n+=mN(s),s=s.return;while(s);var i=n}catch(o){i=`
39
- Error generating stack: `+o.message+`
40
- `+o.stack}return{value:e,source:t,stack:i,digest:null}}function Ec(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Wu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var U2=typeof WeakMap=="function"?WeakMap:Map;function Py(e,t,n){n=gn(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Qa||(Qa=!0,ed=s),Wu(e,t)},n}function My(e,t,n){n=gn(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var i=t.value;n.payload=function(){return s(i)},n.callback=function(){Wu(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Wu(e,t),typeof s!="function"&&(Kn===null?Kn=new Set([this]):Kn.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function rp(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new U2;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(i.add(n),e=eS.bind(null,e,t,n),t.then(e,e))}function ip(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function op(e,t,n,s,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=gn(-1,1),t.tag=2,qn(n,t,1))),n.lanes|=1),e)}var z2=En.ReactCurrentOwner,nt=!1;function Be(e,t,n,s){t.child=e===null?ay(t,null,n,s):wr(t,e.child,n,s)}function ap(e,t,n,s,i){n=n.render;var o=t.ref;return fr(t,i),s=If(e,t,n,s,o,i),n=Of(),e!==null&&!nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,bn(e,t,i)):(de&&n&&jf(t),t.flags|=1,Be(e,t,s,i),t.child)}function lp(e,t,n,s,i){if(e===null){var o=n.type;return typeof o=="function"&&!Hf(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,_y(e,t,o,s,i)):(e=ha(n.type,null,s,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&i)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:Pi,n(a,s)&&e.ref===t.ref)return bn(e,t,i)}return t.flags|=1,e=Yn(o,s),e.ref=t.ref,e.return=t,t.child=e}function _y(e,t,n,s,i){if(e!==null){var o=e.memoizedProps;if(Pi(o,s)&&e.ref===t.ref)if(nt=!1,t.pendingProps=s=o,(e.lanes&i)!==0)e.flags&131072&&(nt=!0);else return t.lanes=e.lanes,bn(e,t,i)}return Hu(e,t,n,s,i)}function Iy(e,t,n){var s=t.pendingProps,i=s.children,o=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ae(nr,ut),ut|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ae(nr,ut),ut|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=o!==null?o.baseLanes:n,ae(nr,ut),ut|=s}else o!==null?(s=o.baseLanes|n,t.memoizedState=null):s=n,ae(nr,ut),ut|=s;return Be(e,t,i,n),t.child}function Oy(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hu(e,t,n,s,i){var o=it(n)?Ts:Ve.current;return o=vr(t,o),fr(t,i),n=If(e,t,n,s,o,i),s=Of(),e!==null&&!nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,bn(e,t,i)):(de&&s&&jf(t),t.flags|=1,Be(e,t,n,i),t.child)}function cp(e,t,n,s,i){if(it(n)){var o=!0;za(t)}else o=!1;if(fr(t,i),t.stateNode===null)da(e,t),Ry(t,n,s),Bu(t,n,s,i),s=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=Rt(u):(u=it(n)?Ts:Ve.current,u=vr(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==s||c!==u)&&sp(t,a,s,u),Ln=!1;var p=t.memoizedState;a.state=p,qa(t,s,a,i),c=t.memoizedState,l!==s||p!==c||rt.current||Ln?(typeof d=="function"&&(Vu(t,n,d,s),c=t.memoizedState),(l=Ln||np(t,n,l,s,p,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),a.props=s,a.state=c,a.context=u,s=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{a=t.stateNode,cy(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Ot(t.type,l),a.props=u,f=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Rt(c):(c=it(n)?Ts:Ve.current,c=vr(t,c));var b=n.getDerivedStateFromProps;(d=typeof b=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||p!==c)&&sp(t,a,s,c),Ln=!1,p=t.memoizedState,a.state=p,qa(t,s,a,i);var j=t.memoizedState;l!==f||p!==j||rt.current||Ln?(typeof b=="function"&&(Vu(t,n,b,s),j=t.memoizedState),(u=Ln||np(t,n,u,s,p,j,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(s,j,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(s,j,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=j),a.props=s,a.state=j,a.context=c,s=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),s=!1)}return qu(e,t,n,s,o,i)}function qu(e,t,n,s,i,o){Oy(e,t);var a=(t.flags&128)!==0;if(!s&&!a)return i&&Gh(t,n,!1),bn(e,t,o);s=t.stateNode,z2.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&a?(t.child=wr(t,e.child,null,o),t.child=wr(t,null,l,o)):Be(e,t,l,o),t.memoizedState=s.state,i&&Gh(t,n,!0),t.child}function Ly(e){var t=e.stateNode;t.pendingContext?Kh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kh(e,t.context,!1),Rf(e,t.containerInfo)}function up(e,t,n,s,i){return br(),Sf(i),t.flags|=256,Be(e,t,n,s),t.child}var Ku={dehydrated:null,treeContext:null,retryLane:0};function Gu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Dy(e,t,n){var s=t.pendingProps,i=fe.current,o=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),ae(fe,i&1),e===null)return Uu(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=s.children,e=s.fallback,o?(s=t.mode,o=t.child,a={mode:"hidden",children:a},!(s&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=Rl(a,s,0,null),e=Ss(e,s,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Gu(n),t.memoizedState=Ku,e):Ff(t,a));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return V2(e,t,a,s,l,i,n);if(o){o=s.fallback,a=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:s.children};return!(a&1)&&t.child!==i?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Yn(i,c),s.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=Yn(l,o):(o=Ss(o,a,n,null),o.flags|=2),o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,a=e.child.memoizedState,a=a===null?Gu(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Ku,s}return o=e.child,e=o.sibling,s=Yn(o,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Ff(e,t){return t=Rl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Uo(e,t,n,s){return s!==null&&Sf(s),wr(t,e.child,null,n),e=Ff(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function V2(e,t,n,s,i,o,a){if(n)return t.flags&256?(t.flags&=-257,s=Ec(Error(U(422))),Uo(e,t,a,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=s.fallback,i=t.mode,s=Rl({mode:"visible",children:s.children},i,0,null),o=Ss(o,i,a,null),o.flags|=2,s.return=t,o.return=t,s.sibling=o,t.child=s,t.mode&1&&wr(t,e.child,null,a),t.child.memoizedState=Gu(a),t.memoizedState=Ku,o);if(!(t.mode&1))return Uo(e,t,a,null);if(i.data==="$!"){if(s=i.nextSibling&&i.nextSibling.dataset,s)var l=s.dgst;return s=l,o=Error(U(419)),s=Ec(o,s,void 0),Uo(e,t,a,s)}if(l=(a&e.childLanes)!==0,nt||l){if(s=Re,s!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(s.suspendedLanes|a)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,vn(e,i),Ut(s,e,i,-1))}return Wf(),s=Ec(Error(U(421))),Uo(e,t,a,s)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=tS.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,ft=Hn(i.nextSibling),mt=t,de=!0,Ft=null,e!==null&&(jt[Nt++]=hn,jt[Nt++]=pn,jt[Nt++]=As,hn=e.id,pn=e.overflow,As=t),t=Ff(t,s.children),t.flags|=4096,t)}function dp(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),zu(e.return,t,n)}function Tc(e,t,n,s,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=i)}function Fy(e,t,n){var s=t.pendingProps,i=s.revealOrder,o=s.tail;if(Be(e,t,s.children,n),s=fe.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&dp(e,n,t);else if(e.tag===19)dp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(ae(fe,s),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Ka(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Tc(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ka(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Tc(t,!0,n,null,o);break;case"together":Tc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function da(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function bn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ps|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(U(153));if(t.child!==null){for(e=t.child,n=Yn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function B2(e,t,n){switch(t.tag){case 3:Ly(t),br();break;case 5:uy(t);break;case 1:it(t.type)&&za(t);break;case 4:Rf(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,i=t.memoizedProps.value;ae(Wa,s._currentValue),s._currentValue=i;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(ae(fe,fe.current&1),t.flags|=128,null):n&t.child.childLanes?Dy(e,t,n):(ae(fe,fe.current&1),e=bn(e,t,n),e!==null?e.sibling:null);ae(fe,fe.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Fy(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ae(fe,fe.current),s)break;return null;case 22:case 23:return t.lanes=0,Iy(e,t,n)}return bn(e,t,n)}var $y,Yu,Uy,zy;$y=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Yu=function(){};Uy=function(e,t,n,s){var i=e.memoizedProps;if(i!==s){e=t.stateNode,vs(Jt.current);var o=null;switch(n){case"input":i=xu(e,i),s=xu(e,s),o=[];break;case"select":i=ge({},i,{value:void 0}),s=ge({},s,{value:void 0}),o=[];break;case"textarea":i=bu(e,i),s=bu(e,s),o=[];break;default:typeof i.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=$a)}ju(n,s);var a;n=null;for(u in i)if(!s.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Si.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in s){var c=s[u];if(l=i!=null?i[u]:void 0,s.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(o||(o=[]),o.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Si.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&ce("scroll",e),o||l===c||(o=[])):(o=o||[]).push(u,c))}n&&(o=o||[]).push("style",n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};zy=function(e,t,n,s){n!==s&&(t.flags|=4)};function Yr(e,t){if(!de)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Fe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags&14680064,s|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags,s|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function W2(e,t,n){var s=t.pendingProps;switch(Nf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fe(t),null;case 1:return it(t.type)&&Ua(),Fe(t),null;case 3:return s=t.stateNode,jr(),ue(rt),ue(Ve),Mf(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Fo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ft!==null&&(sd(Ft),Ft=null))),Yu(e,t),Fe(t),null;case 5:Pf(t);var i=vs(Li.current);if(n=t.type,e!==null&&t.stateNode!=null)Uy(e,t,n,s,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(U(166));return Fe(t),null}if(e=vs(Jt.current),Fo(t)){s=t.stateNode,n=t.type;var o=t.memoizedProps;switch(s[Gt]=t,s[Ii]=o,e=(t.mode&1)!==0,n){case"dialog":ce("cancel",s),ce("close",s);break;case"iframe":case"object":case"embed":ce("load",s);break;case"video":case"audio":for(i=0;i<ii.length;i++)ce(ii[i],s);break;case"source":ce("error",s);break;case"img":case"image":case"link":ce("error",s),ce("load",s);break;case"details":ce("toggle",s);break;case"input":bh(s,o),ce("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!o.multiple},ce("invalid",s);break;case"textarea":jh(s,o),ce("invalid",s)}ju(n,o),i=null;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a];a==="children"?typeof l=="string"?s.textContent!==l&&(o.suppressHydrationWarning!==!0&&Do(s.textContent,l,e),i=["children",l]):typeof l=="number"&&s.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Do(s.textContent,l,e),i=["children",""+l]):Si.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&ce("scroll",s)}switch(n){case"input":Ao(s),wh(s,o,!0);break;case"textarea":Ao(s),Nh(s);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(s.onclick=$a)}s=i,t.updateQueue=s,s!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=p0(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=a.createElement(n,{is:s.is}):(e=a.createElement(n),n==="select"&&(a=e,s.multiple?a.multiple=!0:s.size&&(a.size=s.size))):e=a.createElementNS(e,n),e[Gt]=t,e[Ii]=s,$y(e,t,!1,!1),t.stateNode=e;e:{switch(a=Nu(n,s),n){case"dialog":ce("cancel",e),ce("close",e),i=s;break;case"iframe":case"object":case"embed":ce("load",e),i=s;break;case"video":case"audio":for(i=0;i<ii.length;i++)ce(ii[i],e);i=s;break;case"source":ce("error",e),i=s;break;case"img":case"image":case"link":ce("error",e),ce("load",e),i=s;break;case"details":ce("toggle",e),i=s;break;case"input":bh(e,s),i=xu(e,s),ce("invalid",e);break;case"option":i=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},i=ge({},s,{value:void 0}),ce("invalid",e);break;case"textarea":jh(e,s),i=bu(e,s),ce("invalid",e);break;default:i=s}ju(n,i),l=i;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?y0(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&g0(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ci(e,c):typeof c=="number"&&Ci(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Si.hasOwnProperty(o)?c!=null&&o==="onScroll"&&ce("scroll",e):c!=null&&lf(e,o,c,a))}switch(n){case"input":Ao(e),wh(e,s,!1);break;case"textarea":Ao(e),Nh(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Jn(s.value));break;case"select":e.multiple=!!s.multiple,o=s.value,o!=null?lr(e,!!s.multiple,o,!1):s.defaultValue!=null&&lr(e,!!s.multiple,s.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=$a)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Fe(t),null;case 6:if(e&&t.stateNode!=null)zy(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(U(166));if(n=vs(Li.current),vs(Jt.current),Fo(t)){if(s=t.stateNode,n=t.memoizedProps,s[Gt]=t,(o=s.nodeValue!==n)&&(e=mt,e!==null))switch(e.tag){case 3:Do(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Do(s.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[Gt]=t,t.stateNode=s}return Fe(t),null;case 13:if(ue(fe),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(de&&ft!==null&&t.mode&1&&!(t.flags&128))iy(),br(),t.flags|=98560,o=!1;else if(o=Fo(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(U(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(U(317));o[Gt]=t}else br(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fe(t),o=!1}else Ft!==null&&(sd(Ft),Ft=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||fe.current&1?Te===0&&(Te=3):Wf())),t.updateQueue!==null&&(t.flags|=4),Fe(t),null);case 4:return jr(),Yu(e,t),e===null&&Mi(t.stateNode.containerInfo),Fe(t),null;case 10:return Ef(t.type._context),Fe(t),null;case 17:return it(t.type)&&Ua(),Fe(t),null;case 19:if(ue(fe),o=t.memoizedState,o===null)return Fe(t),null;if(s=(t.flags&128)!==0,a=o.rendering,a===null)if(s)Yr(o,!1);else{if(Te!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ka(e),a!==null){for(t.flags|=128,Yr(o,!1),s=a.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)o=n,e=s,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ae(fe,fe.current&1|2),t.child}e=e.sibling}o.tail!==null&&we()>Sr&&(t.flags|=128,s=!0,Yr(o,!1),t.lanes=4194304)}else{if(!s)if(e=Ka(a),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Yr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!de)return Fe(t),null}else 2*we()-o.renderingStartTime>Sr&&n!==1073741824&&(t.flags|=128,s=!0,Yr(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=we(),t.sibling=null,n=fe.current,ae(fe,s?n&1|2:n&1),t):(Fe(t),null);case 22:case 23:return Bf(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?ut&1073741824&&(Fe(t),t.subtreeFlags&6&&(t.flags|=8192)):Fe(t),null;case 24:return null;case 25:return null}throw Error(U(156,t.tag))}function H2(e,t){switch(Nf(t),t.tag){case 1:return it(t.type)&&Ua(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jr(),ue(rt),ue(Ve),Mf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pf(t),null;case 13:if(ue(fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));br()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ue(fe),null;case 4:return jr(),null;case 10:return Ef(t.type._context),null;case 22:case 23:return Bf(),null;case 24:return null;default:return null}}var zo=!1,$e=!1,q2=typeof WeakSet=="function"?WeakSet:Set,G=null;function tr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){ye(e,t,s)}else n.current=null}function Xu(e,t,n){try{n()}catch(s){ye(e,t,s)}}var fp=!1;function K2(e,t){if(_u=La,e=q0(),wf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var b;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==o||s!==0&&f.nodeType!==3||(c=a+s),f.nodeType===3&&(a+=f.nodeValue.length),(b=f.firstChild)!==null;)p=f,f=b;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=a),p===o&&++d===s&&(c=a),(b=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=b}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Iu={focusedElem:e,selectionRange:n},La=!1,G=t;G!==null;)if(t=G,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var j=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(j!==null){var v=j.memoizedProps,h=j.memoizedState,m=t.stateNode,x=m.getSnapshotBeforeUpdate(t.elementType===t.type?v:Ot(t.type,v),h);m.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(w){ye(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return j=fp,fp=!1,j}function gi(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&Xu(t,n,o)}i=i.next}while(i!==s)}}function Tl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Qu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Vy(e){var t=e.alternate;t!==null&&(e.alternate=null,Vy(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gt],delete t[Ii],delete t[Du],delete t[A2],delete t[R2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function By(e){return e.tag===5||e.tag===3||e.tag===4}function mp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||By(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ju(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$a));else if(s!==4&&(e=e.child,e!==null))for(Ju(e,t,n),e=e.sibling;e!==null;)Ju(e,t,n),e=e.sibling}function Zu(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Zu(e,t,n),e=e.sibling;e!==null;)Zu(e,t,n),e=e.sibling}var Me=null,Lt=!1;function An(e,t,n){for(n=n.child;n!==null;)Wy(e,t,n),n=n.sibling}function Wy(e,t,n){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(bl,n)}catch{}switch(n.tag){case 5:$e||tr(n,t);case 6:var s=Me,i=Lt;Me=null,An(e,t,n),Me=s,Lt=i,Me!==null&&(Lt?(e=Me,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Me.removeChild(n.stateNode));break;case 18:Me!==null&&(Lt?(e=Me,n=n.stateNode,e.nodeType===8?wc(e.parentNode,n):e.nodeType===1&&wc(e,n),Ai(e)):wc(Me,n.stateNode));break;case 4:s=Me,i=Lt,Me=n.stateNode.containerInfo,Lt=!0,An(e,t,n),Me=s,Lt=i;break;case 0:case 11:case 14:case 15:if(!$e&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&Xu(n,t,a),i=i.next}while(i!==s)}An(e,t,n);break;case 1:if(!$e&&(tr(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(l){ye(n,t,l)}An(e,t,n);break;case 21:An(e,t,n);break;case 22:n.mode&1?($e=(s=$e)||n.memoizedState!==null,An(e,t,n),$e=s):An(e,t,n);break;default:An(e,t,n)}}function hp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new q2),t.forEach(function(s){var i=nS.bind(null,e,s);n.has(s)||(n.add(s),s.then(i,i))})}}function _t(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var i=n[s];try{var o=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:Me=l.stateNode,Lt=!1;break e;case 3:Me=l.stateNode.containerInfo,Lt=!0;break e;case 4:Me=l.stateNode.containerInfo,Lt=!0;break e}l=l.return}if(Me===null)throw Error(U(160));Wy(o,a,i),Me=null,Lt=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){ye(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Hy(t,e),t=t.sibling}function Hy(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(_t(t,e),Ht(e),s&4){try{gi(3,e,e.return),Tl(3,e)}catch(v){ye(e,e.return,v)}try{gi(5,e,e.return)}catch(v){ye(e,e.return,v)}}break;case 1:_t(t,e),Ht(e),s&512&&n!==null&&tr(n,n.return);break;case 5:if(_t(t,e),Ht(e),s&512&&n!==null&&tr(n,n.return),e.flags&32){var i=e.stateNode;try{Ci(i,"")}catch(v){ye(e,e.return,v)}}if(s&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&m0(i,o),Nu(l,a);var u=Nu(l,o);for(a=0;a<c.length;a+=2){var d=c[a],f=c[a+1];d==="style"?y0(i,f):d==="dangerouslySetInnerHTML"?g0(i,f):d==="children"?Ci(i,f):lf(i,d,f,u)}switch(l){case"input":yu(i,o);break;case"textarea":h0(i,o);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var b=o.value;b!=null?lr(i,!!o.multiple,b,!1):p!==!!o.multiple&&(o.defaultValue!=null?lr(i,!!o.multiple,o.defaultValue,!0):lr(i,!!o.multiple,o.multiple?[]:"",!1))}i[Ii]=o}catch(v){ye(e,e.return,v)}}break;case 6:if(_t(t,e),Ht(e),s&4){if(e.stateNode===null)throw Error(U(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(v){ye(e,e.return,v)}}break;case 3:if(_t(t,e),Ht(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Ai(t.containerInfo)}catch(v){ye(e,e.return,v)}break;case 4:_t(t,e),Ht(e);break;case 13:_t(t,e),Ht(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(zf=we())),s&4&&hp(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?($e=(u=$e)||d,_t(t,e),$e=u):_t(t,e),Ht(e),s&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(G=e,d=e.child;d!==null;){for(f=G=d;G!==null;){switch(p=G,b=p.child,p.tag){case 0:case 11:case 14:case 15:gi(4,p,p.return);break;case 1:tr(p,p.return);var j=p.stateNode;if(typeof j.componentWillUnmount=="function"){s=p,n=p.return;try{t=s,j.props=t.memoizedProps,j.state=t.memoizedState,j.componentWillUnmount()}catch(v){ye(s,n,v)}}break;case 5:tr(p,p.return);break;case 22:if(p.memoizedState!==null){gp(f);continue}}b!==null?(b.return=p,G=b):gp(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,u?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=x0("display",a))}catch(v){ye(e,e.return,v)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(v){ye(e,e.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:_t(t,e),Ht(e),s&4&&hp(e);break;case 21:break;default:_t(t,e),Ht(e)}}function Ht(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(By(n)){var s=n;break e}n=n.return}throw Error(U(160))}switch(s.tag){case 5:var i=s.stateNode;s.flags&32&&(Ci(i,""),s.flags&=-33);var o=mp(e);Zu(e,o,i);break;case 3:case 4:var a=s.stateNode.containerInfo,l=mp(e);Ju(e,l,a);break;default:throw Error(U(161))}}catch(c){ye(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function G2(e,t,n){G=e,qy(e)}function qy(e,t,n){for(var s=(e.mode&1)!==0;G!==null;){var i=G,o=i.child;if(i.tag===22&&s){var a=i.memoizedState!==null||zo;if(!a){var l=i.alternate,c=l!==null&&l.memoizedState!==null||$e;l=zo;var u=$e;if(zo=a,($e=c)&&!u)for(G=i;G!==null;)a=G,c=a.child,a.tag===22&&a.memoizedState!==null?xp(i):c!==null?(c.return=a,G=c):xp(i);for(;o!==null;)G=o,qy(o),o=o.sibling;G=i,zo=l,$e=u}pp(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,G=o):pp(e)}}function pp(e){for(;G!==null;){var t=G;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:$e||Tl(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!$e)if(n===null)s.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Ot(t.type,n.memoizedProps);s.componentDidUpdate(i,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&Zh(t,o,s);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Zh(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Ai(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(U(163))}$e||t.flags&512&&Qu(t)}catch(p){ye(t,t.return,p)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function gp(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function xp(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Tl(4,t)}catch(c){ye(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var i=t.return;try{s.componentDidMount()}catch(c){ye(t,i,c)}}var o=t.return;try{Qu(t)}catch(c){ye(t,o,c)}break;case 5:var a=t.return;try{Qu(t)}catch(c){ye(t,a,c)}}}catch(c){ye(t,t.return,c)}if(t===e){G=null;break}var l=t.sibling;if(l!==null){l.return=t.return,G=l;break}G=t.return}}var Y2=Math.ceil,Xa=En.ReactCurrentDispatcher,$f=En.ReactCurrentOwner,Et=En.ReactCurrentBatchConfig,ie=0,Re=null,Ce=null,Ie=0,ut=0,nr=os(0),Te=0,Ui=null,Ps=0,Al=0,Uf=0,xi=null,tt=null,zf=0,Sr=1/0,un=null,Qa=!1,ed=null,Kn=null,Vo=!1,Un=null,Ja=0,yi=0,td=null,fa=-1,ma=0;function qe(){return ie&6?we():fa!==-1?fa:fa=we()}function Gn(e){return e.mode&1?ie&2&&Ie!==0?Ie&-Ie:M2.transition!==null?(ma===0&&(ma=R0()),ma):(e=oe,e!==0||(e=window.event,e=e===void 0?16:D0(e.type)),e):1}function Ut(e,t,n,s){if(50<yi)throw yi=0,td=null,Error(U(185));oo(e,n,s),(!(ie&2)||e!==Re)&&(e===Re&&(!(ie&2)&&(Al|=n),Te===4&&Fn(e,Ie)),ot(e,s),n===1&&ie===0&&!(t.mode&1)&&(Sr=we()+500,Cl&&as()))}function ot(e,t){var n=e.callbackNode;MN(e,t);var s=Oa(e,e===Re?Ie:0);if(s===0)n!==null&&kh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&kh(n),t===1)e.tag===0?P2(yp.bind(null,e)):ny(yp.bind(null,e)),E2(function(){!(ie&6)&&as()}),n=null;else{switch(P0(s)){case 1:n=mf;break;case 4:n=T0;break;case 16:n=Ia;break;case 536870912:n=A0;break;default:n=Ia}n=ev(n,Ky.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ky(e,t){if(fa=-1,ma=0,ie&6)throw Error(U(327));var n=e.callbackNode;if(mr()&&e.callbackNode!==n)return null;var s=Oa(e,e===Re?Ie:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=Za(e,s);else{t=s;var i=ie;ie|=2;var o=Yy();(Re!==e||Ie!==t)&&(un=null,Sr=we()+500,Ns(e,t));do try{J2();break}catch(l){Gy(e,l)}while(!0);kf(),Xa.current=o,ie=i,Ce!==null?t=0:(Re=null,Ie=0,t=Te)}if(t!==0){if(t===2&&(i=Tu(e),i!==0&&(s=i,t=nd(e,i))),t===1)throw n=Ui,Ns(e,0),Fn(e,s),ot(e,we()),n;if(t===6)Fn(e,s);else{if(i=e.current.alternate,!(s&30)&&!X2(i)&&(t=Za(e,s),t===2&&(o=Tu(e),o!==0&&(s=o,t=nd(e,o))),t===1))throw n=Ui,Ns(e,0),Fn(e,s),ot(e,we()),n;switch(e.finishedWork=i,e.finishedLanes=s,t){case 0:case 1:throw Error(U(345));case 2:ps(e,tt,un);break;case 3:if(Fn(e,s),(s&130023424)===s&&(t=zf+500-we(),10<t)){if(Oa(e,0)!==0)break;if(i=e.suspendedLanes,(i&s)!==s){qe(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Lu(ps.bind(null,e,tt,un),t);break}ps(e,tt,un);break;case 4:if(Fn(e,s),(s&4194240)===s)break;for(t=e.eventTimes,i=-1;0<s;){var a=31-$t(s);o=1<<a,a=t[a],a>i&&(i=a),s&=~o}if(s=i,s=we()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Y2(s/1960))-s,10<s){e.timeoutHandle=Lu(ps.bind(null,e,tt,un),s);break}ps(e,tt,un);break;case 5:ps(e,tt,un);break;default:throw Error(U(329))}}}return ot(e,we()),e.callbackNode===n?Ky.bind(null,e):null}function nd(e,t){var n=xi;return e.current.memoizedState.isDehydrated&&(Ns(e,t).flags|=256),e=Za(e,t),e!==2&&(t=tt,tt=n,t!==null&&sd(t)),e}function sd(e){tt===null?tt=e:tt.push.apply(tt,e)}function X2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var i=n[s],o=i.getSnapshot;i=i.value;try{if(!zt(o(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fn(e,t){for(t&=~Uf,t&=~Al,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-$t(t),s=1<<n;e[n]=-1,t&=~s}}function yp(e){if(ie&6)throw Error(U(327));mr();var t=Oa(e,0);if(!(t&1))return ot(e,we()),null;var n=Za(e,t);if(e.tag!==0&&n===2){var s=Tu(e);s!==0&&(t=s,n=nd(e,s))}if(n===1)throw n=Ui,Ns(e,0),Fn(e,t),ot(e,we()),n;if(n===6)throw Error(U(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ps(e,tt,un),ot(e,we()),null}function Vf(e,t){var n=ie;ie|=1;try{return e(t)}finally{ie=n,ie===0&&(Sr=we()+500,Cl&&as())}}function Ms(e){Un!==null&&Un.tag===0&&!(ie&6)&&mr();var t=ie;ie|=1;var n=Et.transition,s=oe;try{if(Et.transition=null,oe=1,e)return e()}finally{oe=s,Et.transition=n,ie=t,!(ie&6)&&as()}}function Bf(){ut=nr.current,ue(nr)}function Ns(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,k2(n)),Ce!==null)for(n=Ce.return;n!==null;){var s=n;switch(Nf(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Ua();break;case 3:jr(),ue(rt),ue(Ve),Mf();break;case 5:Pf(s);break;case 4:jr();break;case 13:ue(fe);break;case 19:ue(fe);break;case 10:Ef(s.type._context);break;case 22:case 23:Bf()}n=n.return}if(Re=e,Ce=e=Yn(e.current,null),Ie=ut=t,Te=0,Ui=null,Uf=Al=Ps=0,tt=xi=null,ys!==null){for(t=0;t<ys.length;t++)if(n=ys[t],s=n.interleaved,s!==null){n.interleaved=null;var i=s.next,o=n.pending;if(o!==null){var a=o.next;o.next=i,s.next=a}n.pending=s}ys=null}return e}function Gy(e,t){do{var n=Ce;try{if(kf(),ca.current=Ya,Ga){for(var s=he.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Ga=!1}if(Rs=0,Ae=Ee=he=null,pi=!1,Di=0,$f.current=null,n===null||n.return===null){Te=1,Ui=t,Ce=null;break}e:{var o=e,a=n.return,l=n,c=t;if(t=Ie,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var b=ip(a);if(b!==null){b.flags&=-257,op(b,a,l,o,t),b.mode&1&&rp(o,u,t),t=b,c=u;var j=t.updateQueue;if(j===null){var v=new Set;v.add(c),t.updateQueue=v}else j.add(c);break e}else{if(!(t&1)){rp(o,u,t),Wf();break e}c=Error(U(426))}}else if(de&&l.mode&1){var h=ip(a);if(h!==null){!(h.flags&65536)&&(h.flags|=256),op(h,a,l,o,t),Sf(Nr(c,l));break e}}o=c=Nr(c,l),Te!==4&&(Te=2),xi===null?xi=[o]:xi.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var m=Py(o,c,t);Jh(o,m);break e;case 1:l=c;var x=o.type,y=o.stateNode;if(!(o.flags&128)&&(typeof x.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Kn===null||!Kn.has(y)))){o.flags|=65536,t&=-t,o.lanes|=t;var w=My(o,l,t);Jh(o,w);break e}}o=o.return}while(o!==null)}Qy(n)}catch(S){t=S,Ce===n&&n!==null&&(Ce=n=n.return);continue}break}while(!0)}function Yy(){var e=Xa.current;return Xa.current=Ya,e===null?Ya:e}function Wf(){(Te===0||Te===3||Te===2)&&(Te=4),Re===null||!(Ps&268435455)&&!(Al&268435455)||Fn(Re,Ie)}function Za(e,t){var n=ie;ie|=2;var s=Yy();(Re!==e||Ie!==t)&&(un=null,Ns(e,t));do try{Q2();break}catch(i){Gy(e,i)}while(!0);if(kf(),ie=n,Xa.current=s,Ce!==null)throw Error(U(261));return Re=null,Ie=0,Te}function Q2(){for(;Ce!==null;)Xy(Ce)}function J2(){for(;Ce!==null&&!NN();)Xy(Ce)}function Xy(e){var t=Zy(e.alternate,e,ut);e.memoizedProps=e.pendingProps,t===null?Qy(e):Ce=t,$f.current=null}function Qy(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=H2(n,t),n!==null){n.flags&=32767,Ce=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Te=6,Ce=null;return}}else if(n=W2(n,t,ut),n!==null){Ce=n;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);Te===0&&(Te=5)}function ps(e,t,n){var s=oe,i=Et.transition;try{Et.transition=null,oe=1,Z2(e,t,n,s)}finally{Et.transition=i,oe=s}return null}function Z2(e,t,n,s){do mr();while(Un!==null);if(ie&6)throw Error(U(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(U(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(_N(e,o),e===Re&&(Ce=Re=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Vo||(Vo=!0,ev(Ia,function(){return mr(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Et.transition,Et.transition=null;var a=oe;oe=1;var l=ie;ie|=4,$f.current=null,K2(e,n),Hy(n,e),v2(Iu),La=!!_u,Iu=_u=null,e.current=n,G2(n),SN(),ie=l,oe=a,Et.transition=o}else e.current=n;if(Vo&&(Vo=!1,Un=e,Ja=i),o=e.pendingLanes,o===0&&(Kn=null),EN(n.stateNode),ot(e,we()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],s(i.value,{componentStack:i.stack,digest:i.digest});if(Qa)throw Qa=!1,e=ed,ed=null,e;return Ja&1&&e.tag!==0&&mr(),o=e.pendingLanes,o&1?e===td?yi++:(yi=0,td=e):yi=0,as(),null}function mr(){if(Un!==null){var e=P0(Ja),t=Et.transition,n=oe;try{if(Et.transition=null,oe=16>e?16:e,Un===null)var s=!1;else{if(e=Un,Un=null,Ja=0,ie&6)throw Error(U(331));var i=ie;for(ie|=4,G=e.current;G!==null;){var o=G,a=o.child;if(G.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(G=u;G!==null;){var d=G;switch(d.tag){case 0:case 11:case 15:gi(8,d,o)}var f=d.child;if(f!==null)f.return=d,G=f;else for(;G!==null;){d=G;var p=d.sibling,b=d.return;if(Vy(d),d===u){G=null;break}if(p!==null){p.return=b,G=p;break}G=b}}}var j=o.alternate;if(j!==null){var v=j.child;if(v!==null){j.child=null;do{var h=v.sibling;v.sibling=null,v=h}while(v!==null)}}G=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,G=a;else e:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:gi(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,G=m;break e}G=o.return}}var x=e.current;for(G=x;G!==null;){a=G;var y=a.child;if(a.subtreeFlags&2064&&y!==null)y.return=a,G=y;else e:for(a=x;G!==null;){if(l=G,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Tl(9,l)}}catch(S){ye(l,l.return,S)}if(l===a){G=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,G=w;break e}G=l.return}}if(ie=i,as(),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(bl,e)}catch{}s=!0}return s}finally{oe=n,Et.transition=t}}return!1}function vp(e,t,n){t=Nr(n,t),t=Py(e,t,1),e=qn(e,t,1),t=qe(),e!==null&&(oo(e,1,t),ot(e,t))}function ye(e,t,n){if(e.tag===3)vp(e,e,n);else for(;t!==null;){if(t.tag===3){vp(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Kn===null||!Kn.has(s))){e=Nr(n,e),e=My(t,e,1),t=qn(t,e,1),e=qe(),t!==null&&(oo(t,1,e),ot(t,e));break}}t=t.return}}function eS(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=qe(),e.pingedLanes|=e.suspendedLanes&n,Re===e&&(Ie&n)===n&&(Te===4||Te===3&&(Ie&130023424)===Ie&&500>we()-zf?Ns(e,0):Uf|=n),ot(e,t)}function Jy(e,t){t===0&&(e.mode&1?(t=Mo,Mo<<=1,!(Mo&130023424)&&(Mo=4194304)):t=1);var n=qe();e=vn(e,t),e!==null&&(oo(e,t,n),ot(e,n))}function tS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Jy(e,n)}function nS(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(U(314))}s!==null&&s.delete(t),Jy(e,n)}var Zy;Zy=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)nt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return nt=!1,B2(e,t,n);nt=!!(e.flags&131072)}else nt=!1,de&&t.flags&1048576&&sy(t,Ba,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;da(e,t),e=t.pendingProps;var i=vr(t,Ve.current);fr(t,n),i=If(null,t,s,e,i,n);var o=Of();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(s)?(o=!0,za(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Af(t),i.updater=El,t.stateNode=i,i._reactInternals=t,Bu(t,s,e,n),t=qu(null,t,s,!0,o,n)):(t.tag=0,de&&o&&jf(t),Be(null,t,i,n),t=t.child),t;case 16:s=t.elementType;e:{switch(da(e,t),e=t.pendingProps,i=s._init,s=i(s._payload),t.type=s,i=t.tag=rS(s),e=Ot(s,e),i){case 0:t=Hu(null,t,s,e,n);break e;case 1:t=cp(null,t,s,e,n);break e;case 11:t=ap(null,t,s,e,n);break e;case 14:t=lp(null,t,s,Ot(s.type,e),n);break e}throw Error(U(306,s,""))}return t;case 0:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Ot(s,i),Hu(e,t,s,i,n);case 1:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Ot(s,i),cp(e,t,s,i,n);case 3:e:{if(Ly(t),e===null)throw Error(U(387));s=t.pendingProps,o=t.memoizedState,i=o.element,cy(e,t),qa(t,s,null,n);var a=t.memoizedState;if(s=a.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Nr(Error(U(423)),t),t=up(e,t,s,n,i);break e}else if(s!==i){i=Nr(Error(U(424)),t),t=up(e,t,s,n,i);break e}else for(ft=Hn(t.stateNode.containerInfo.firstChild),mt=t,de=!0,Ft=null,n=ay(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(br(),s===i){t=bn(e,t,n);break e}Be(e,t,s,n)}t=t.child}return t;case 5:return uy(t),e===null&&Uu(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,Ou(s,i)?a=null:o!==null&&Ou(s,o)&&(t.flags|=32),Oy(e,t),Be(e,t,a,n),t.child;case 6:return e===null&&Uu(t),null;case 13:return Dy(e,t,n);case 4:return Rf(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=wr(t,null,s,n):Be(e,t,s,n),t.child;case 11:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Ot(s,i),ap(e,t,s,i,n);case 7:return Be(e,t,t.pendingProps,n),t.child;case 8:return Be(e,t,t.pendingProps.children,n),t.child;case 12:return Be(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,ae(Wa,s._currentValue),s._currentValue=a,o!==null)if(zt(o.value,a)){if(o.children===i.children&&!rt.current){t=bn(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var c=l.firstContext;c!==null;){if(c.context===s){if(o.tag===1){c=gn(-1,n&-n),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),zu(o.return,n,t),l.lanes|=n;break}c=c.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(U(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),zu(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Be(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,s=t.pendingProps.children,fr(t,n),i=Rt(i),s=s(i),t.flags|=1,Be(e,t,s,n),t.child;case 14:return s=t.type,i=Ot(s,t.pendingProps),i=Ot(s.type,i),lp(e,t,s,i,n);case 15:return _y(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Ot(s,i),da(e,t),t.tag=1,it(s)?(e=!0,za(t)):e=!1,fr(t,n),Ry(t,s,i),Bu(t,s,i,n),qu(null,t,s,!0,e,n);case 19:return Fy(e,t,n);case 22:return Iy(e,t,n)}throw Error(U(156,t.tag))};function ev(e,t){return E0(e,t)}function sS(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kt(e,t,n,s){return new sS(e,t,n,s)}function Hf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rS(e){if(typeof e=="function")return Hf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uf)return 11;if(e===df)return 14}return 2}function Yn(e,t){var n=e.alternate;return n===null?(n=kt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ha(e,t,n,s,i,o){var a=2;if(s=e,typeof e=="function")Hf(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qs:return Ss(n.children,i,o,t);case cf:a=8,i|=8;break;case mu:return e=kt(12,n,t,i|2),e.elementType=mu,e.lanes=o,e;case hu:return e=kt(13,n,t,i),e.elementType=hu,e.lanes=o,e;case pu:return e=kt(19,n,t,i),e.elementType=pu,e.lanes=o,e;case u0:return Rl(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case l0:a=10;break e;case c0:a=9;break e;case uf:a=11;break e;case df:a=14;break e;case On:a=16,s=null;break e}throw Error(U(130,e==null?e:typeof e,""))}return t=kt(a,n,t,i),t.elementType=e,t.type=s,t.lanes=o,t}function Ss(e,t,n,s){return e=kt(7,e,s,t),e.lanes=n,e}function Rl(e,t,n,s){return e=kt(22,e,s,t),e.elementType=u0,e.lanes=n,e.stateNode={isHidden:!1},e}function Ac(e,t,n){return e=kt(6,e,null,t),e.lanes=n,e}function Rc(e,t,n){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iS(e,t,n,s,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=uc(0),this.expirationTimes=uc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uc(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function qf(e,t,n,s,i,o,a,l,c){return e=new iS(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=kt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Af(o),e}function oS(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Hs,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function tv(e){if(!e)return Zn;e=e._reactInternals;e:{if(Ls(e)!==e||e.tag!==1)throw Error(U(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(it(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(U(171))}if(e.tag===1){var n=e.type;if(it(n))return ty(e,n,t)}return t}function nv(e,t,n,s,i,o,a,l,c){return e=qf(n,s,!0,e,i,o,a,l,c),e.context=tv(null),n=e.current,s=qe(),i=Gn(n),o=gn(s,i),o.callback=t??null,qn(n,o,i),e.current.lanes=i,oo(e,i,s),ot(e,s),e}function Pl(e,t,n,s){var i=t.current,o=qe(),a=Gn(i);return n=tv(n),t.context===null?t.context=n:t.pendingContext=n,t=gn(o,a),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=qn(i,t,a),e!==null&&(Ut(e,i,a,o),la(e,i,a)),a}function el(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Kf(e,t){bp(e,t),(e=e.alternate)&&bp(e,t)}function aS(){return null}var sv=typeof reportError=="function"?reportError:function(e){console.error(e)};function Gf(e){this._internalRoot=e}Ml.prototype.render=Gf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(U(409));Pl(e,t,null,null)};Ml.prototype.unmount=Gf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ms(function(){Pl(null,e,null,null)}),t[yn]=null}};function Ml(e){this._internalRoot=e}Ml.prototype.unstable_scheduleHydration=function(e){if(e){var t=I0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Dn.length&&t!==0&&t<Dn[n].priority;n++);Dn.splice(n,0,e),n===0&&L0(e)}};function Yf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function wp(){}function lS(e,t,n,s,i){if(i){if(typeof s=="function"){var o=s;s=function(){var u=el(a);o.call(u)}}var a=nv(t,s,e,0,null,!1,!1,"",wp);return e._reactRootContainer=a,e[yn]=a.current,Mi(e.nodeType===8?e.parentNode:e),Ms(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof s=="function"){var l=s;s=function(){var u=el(c);l.call(u)}}var c=qf(e,0,!1,null,null,!1,!1,"",wp);return e._reactRootContainer=c,e[yn]=c.current,Mi(e.nodeType===8?e.parentNode:e),Ms(function(){Pl(t,c,n,s)}),c}function Il(e,t,n,s,i){var o=n._reactRootContainer;if(o){var a=o;if(typeof i=="function"){var l=i;i=function(){var c=el(a);l.call(c)}}Pl(t,a,e,i)}else a=lS(n,t,e,i,s);return el(a)}M0=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ri(t.pendingLanes);n!==0&&(hf(t,n|1),ot(t,we()),!(ie&6)&&(Sr=we()+500,as()))}break;case 13:Ms(function(){var s=vn(e,1);if(s!==null){var i=qe();Ut(s,e,1,i)}}),Kf(e,1)}};pf=function(e){if(e.tag===13){var t=vn(e,134217728);if(t!==null){var n=qe();Ut(t,e,134217728,n)}Kf(e,134217728)}};_0=function(e){if(e.tag===13){var t=Gn(e),n=vn(e,t);if(n!==null){var s=qe();Ut(n,e,t,s)}Kf(e,t)}};I0=function(){return oe};O0=function(e,t){var n=oe;try{return oe=e,t()}finally{oe=n}};Cu=function(e,t,n){switch(t){case"input":if(yu(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var i=Sl(s);if(!i)throw Error(U(90));f0(s),yu(s,i)}}}break;case"textarea":h0(e,n);break;case"select":t=n.value,t!=null&&lr(e,!!n.multiple,t,!1)}};w0=Vf;j0=Ms;var cS={usingClientEntryPoint:!1,Events:[lo,Xs,Sl,v0,b0,Vf]},Xr={findFiberByHostInstance:xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},uS={bundleType:Xr.bundleType,version:Xr.version,rendererPackageName:Xr.rendererPackageName,rendererConfig:Xr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:En.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=C0(e),e===null?null:e.stateNode},findFiberByHostInstance:Xr.findFiberByHostInstance||aS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bo.isDisabled&&Bo.supportsFiber)try{bl=Bo.inject(uS),Qt=Bo}catch{}}gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cS;gt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yf(t))throw Error(U(200));return oS(e,t,null,n)};gt.createRoot=function(e,t){if(!Yf(e))throw Error(U(299));var n=!1,s="",i=sv;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=qf(e,1,!1,null,null,n,!1,s,i),e[yn]=t.current,Mi(e.nodeType===8?e.parentNode:e),new Gf(t)};gt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(U(188)):(e=Object.keys(e).join(","),Error(U(268,e)));return e=C0(t),e=e===null?null:e.stateNode,e};gt.flushSync=function(e){return Ms(e)};gt.hydrate=function(e,t,n){if(!_l(t))throw Error(U(200));return Il(null,e,t,!0,n)};gt.hydrateRoot=function(e,t,n){if(!Yf(e))throw Error(U(405));var s=n!=null&&n.hydratedSources||null,i=!1,o="",a=sv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=nv(t,null,e,1,n??null,i,!1,o,a),e[yn]=t.current,Mi(e),s)for(e=0;e<s.length;e++)n=s[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Ml(t)};gt.render=function(e,t,n){if(!_l(t))throw Error(U(200));return Il(null,e,t,!1,n)};gt.unmountComponentAtNode=function(e){if(!_l(e))throw Error(U(40));return e._reactRootContainer?(Ms(function(){Il(null,null,e,!1,function(){e._reactRootContainer=null,e[yn]=null})}),!0):!1};gt.unstable_batchedUpdates=Vf;gt.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!_l(n))throw Error(U(200));if(e==null||e._reactInternals===void 0)throw Error(U(38));return Il(e,t,n,!1,s)};gt.version="18.3.1-next-f1338f8080-20240426";function rv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rv)}catch(e){console.error(e)}}rv(),r0.exports=gt;var Ol=r0.exports;const dS=qx(Ol);var jp=Ol;du.createRoot=jp.createRoot,du.hydrateRoot=jp.hydrateRoot;/**
41
- * @remix-run/router v1.23.0
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */function zi(){return zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},zi.apply(this,arguments)}var zn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(zn||(zn={}));const Np="popstate";function fS(e){e===void 0&&(e={});function t(s,i){let{pathname:o,search:a,hash:l}=s.location;return rd("",{pathname:o,search:a,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(s,i){return typeof i=="string"?i:tl(i)}return hS(t,n,null,e)}function je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function iv(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function mS(){return Math.random().toString(36).substr(2,8)}function Sp(e,t){return{usr:e.state,key:e.key,idx:t}}function rd(e,t,n,s){return n===void 0&&(n=null),zi({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pr(t):t,{state:n,key:t&&t.key||s||mS()})}function tl(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Pr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function hS(e,t,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:o=!1}=s,a=i.history,l=zn.Pop,c=null,u=d();u==null&&(u=0,a.replaceState(zi({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function f(){l=zn.Pop;let h=d(),m=h==null?null:h-u;u=h,c&&c({action:l,location:v.location,delta:m})}function p(h,m){l=zn.Push;let x=rd(v.location,h,m);u=d()+1;let y=Sp(x,u),w=v.createHref(x);try{a.pushState(y,"",w)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(w)}o&&c&&c({action:l,location:v.location,delta:1})}function b(h,m){l=zn.Replace;let x=rd(v.location,h,m);u=d();let y=Sp(x,u),w=v.createHref(x);a.replaceState(y,"",w),o&&c&&c({action:l,location:v.location,delta:0})}function j(h){let m=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof h=="string"?h:tl(h);return x=x.replace(/ $/,"%20"),je(m,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,m)}let v={get action(){return l},get location(){return e(i,a)},listen(h){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Np,f),c=h,()=>{i.removeEventListener(Np,f),c=null}},createHref(h){return t(i,h)},createURL:j,encodeLocation(h){let m=j(h);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:p,replace:b,go(h){return a.go(h)}};return v}var Cp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Cp||(Cp={}));function pS(e,t,n){return n===void 0&&(n="/"),gS(e,t,n)}function gS(e,t,n,s){let i=typeof t=="string"?Pr(t):t,o=Xf(i.pathname||"/",n);if(o==null)return null;let a=ov(e);xS(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let u=AS(o);l=kS(a[c],u)}return l}function ov(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let i=(o,a,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};c.relativePath.startsWith("/")&&(je(c.relativePath.startsWith(s),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(s.length));let u=Xn([s,c.relativePath]),d=n.concat(c);o.children&&o.children.length>0&&(je(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),ov(o.children,t,d,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:SS(u,o.index),routesMeta:d})};return e.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,a);else for(let c of av(o.path))i(o,a,c)}),t}function av(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return i?[o,""]:[o];let a=av(s.join("/")),l=[];return l.push(...a.map(c=>c===""?o:[o,c].join("/"))),i&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function xS(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:CS(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const yS=/^:[\w-]+$/,vS=3,bS=2,wS=1,jS=10,NS=-2,kp=e=>e==="*";function SS(e,t){let n=e.split("/"),s=n.length;return n.some(kp)&&(s+=NS),t&&(s+=bS),n.filter(i=>!kp(i)).reduce((i,o)=>i+(yS.test(o)?vS:o===""?wS:jS),s)}function CS(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function kS(e,t,n){let{routesMeta:s}=e,i={},o="/",a=[];for(let l=0;l<s.length;++l){let c=s[l],u=l===s.length-1,d=o==="/"?t:t.slice(o.length)||"/",f=ES({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),p=c.route;if(!f)return null;Object.assign(i,f.params),a.push({params:i,pathname:Xn([o,f.pathname]),pathnameBase:_S(Xn([o,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(o=Xn([o,f.pathnameBase]))}return a}function ES(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=TS(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],a=o.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:s.reduce((u,d,f)=>{let{paramName:p,isOptional:b}=d;if(p==="*"){let v=l[f]||"";a=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}const j=l[f];return b&&!j?u[p]=void 0:u[p]=(j||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:a,pattern:e}}function TS(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),iv(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(s.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function AS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return iv(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Xf(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function RS(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:i=""}=typeof e=="string"?Pr(e):e;return{pathname:n?n.startsWith("/")?n:PS(n,t):t,search:IS(s),hash:OS(i)}}function PS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Pc(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function MS(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Qf(e,t){let n=MS(e);return t?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function Jf(e,t,n,s){s===void 0&&(s=!1);let i;typeof e=="string"?i=Pr(e):(i=zi({},e),je(!i.pathname||!i.pathname.includes("?"),Pc("?","pathname","search",i)),je(!i.pathname||!i.pathname.includes("#"),Pc("#","pathname","hash",i)),je(!i.search||!i.search.includes("#"),Pc("#","search","hash",i)));let o=e===""||i.pathname==="",a=o?"/":i.pathname,l;if(a==null)l=n;else{let f=t.length-1;if(!s&&a.startsWith("..")){let p=a.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=RS(i,l),u=a&&a!=="/"&&a.endsWith("/"),d=(o||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Xn=e=>e.join("/").replace(/\/\/+/g,"/"),_S=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),IS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,OS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function LS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const lv=["post","put","patch","delete"];new Set(lv);const DS=["get",...lv];new Set(DS);/**
50
- * React Router v6.30.1
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function Vi(){return Vi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Vi.apply(this,arguments)}const Zf=g.createContext(null),FS=g.createContext(null),ls=g.createContext(null),Ll=g.createContext(null),Tn=g.createContext({outlet:null,matches:[],isDataRoute:!1}),cv=g.createContext(null);function $S(e,t){let{relative:n}=t===void 0?{}:t;Mr()||je(!1);let{basename:s,navigator:i}=g.useContext(ls),{hash:o,pathname:a,search:l}=fv(e,{relative:n}),c=a;return s!=="/"&&(c=a==="/"?s:Xn([s,a])),i.createHref({pathname:c,search:l,hash:o})}function Mr(){return g.useContext(Ll)!=null}function Ds(){return Mr()||je(!1),g.useContext(Ll).location}function uv(e){g.useContext(ls).static||g.useLayoutEffect(e)}function uo(){let{isDataRoute:e}=g.useContext(Tn);return e?JS():US()}function US(){Mr()||je(!1);let e=g.useContext(Zf),{basename:t,future:n,navigator:s}=g.useContext(ls),{matches:i}=g.useContext(Tn),{pathname:o}=Ds(),a=JSON.stringify(Qf(i,n.v7_relativeSplatPath)),l=g.useRef(!1);return uv(()=>{l.current=!0}),g.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){s.go(u);return}let f=Jf(u,JSON.parse(a),o,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Xn([t,f.pathname])),(d.replace?s.replace:s.push)(f,d.state,d)},[t,s,a,o,e])}function dv(){let{matches:e}=g.useContext(Tn),t=e[e.length-1];return t?t.params:{}}function fv(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=g.useContext(ls),{matches:i}=g.useContext(Tn),{pathname:o}=Ds(),a=JSON.stringify(Qf(i,s.v7_relativeSplatPath));return g.useMemo(()=>Jf(e,JSON.parse(a),o,n==="path"),[e,a,o,n])}function zS(e,t){return VS(e,t)}function VS(e,t,n,s){Mr()||je(!1);let{navigator:i}=g.useContext(ls),{matches:o}=g.useContext(Tn),a=o[o.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let u=Ds(),d;if(t){var f;let h=typeof t=="string"?Pr(t):t;c==="/"||(f=h.pathname)!=null&&f.startsWith(c)||je(!1),d=h}else d=u;let p=d.pathname||"/",b=p;if(c!=="/"){let h=c.replace(/^\//,"").split("/");b="/"+p.replace(/^\//,"").split("/").slice(h.length).join("/")}let j=pS(e,{pathname:b}),v=KS(j&&j.map(h=>Object.assign({},h,{params:Object.assign({},l,h.params),pathname:Xn([c,i.encodeLocation?i.encodeLocation(h.pathname).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:Xn([c,i.encodeLocation?i.encodeLocation(h.pathnameBase).pathname:h.pathnameBase])})),o,n,s);return t&&v?g.createElement(Ll.Provider,{value:{location:Vi({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:zn.Pop}},v):v}function BS(){let e=QS(),t=LS(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:i},n):null,null)}const WS=g.createElement(BS,null);class HS extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?g.createElement(Tn.Provider,{value:this.props.routeContext},g.createElement(cv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function qS(e){let{routeContext:t,match:n,children:s}=e,i=g.useContext(Zf);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(Tn.Provider,{value:t},s)}function KS(e,t,n,s){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=s)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=a.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||je(!1),a=a.slice(0,Math.min(a.length,d+1))}let c=!1,u=-1;if(n&&s&&s.v7_partialHydration)for(let d=0;d<a.length;d++){let f=a[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:p,errors:b}=n,j=f.route.loader&&p[f.route.id]===void 0&&(!b||b[f.route.id]===void 0);if(f.route.lazy||j){c=!0,u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,f,p)=>{let b,j=!1,v=null,h=null;n&&(b=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||WS,c&&(u<0&&p===0?(ZS("route-fallback"),j=!0,h=null):u===p&&(j=!0,h=f.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,p+1)),x=()=>{let y;return b?y=v:j?y=h:f.route.Component?y=g.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=d,g.createElement(qS,{match:f,routeContext:{outlet:d,matches:m,isDataRoute:n!=null},children:y})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?g.createElement(HS,{location:n.location,revalidation:n.revalidation,component:v,error:b,children:x(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):x()},null)}var mv=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(mv||{}),hv=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(hv||{});function GS(e){let t=g.useContext(Zf);return t||je(!1),t}function YS(e){let t=g.useContext(FS);return t||je(!1),t}function XS(e){let t=g.useContext(Tn);return t||je(!1),t}function pv(e){let t=XS(),n=t.matches[t.matches.length-1];return n.route.id||je(!1),n.route.id}function QS(){var e;let t=g.useContext(cv),n=YS(),s=pv();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function JS(){let{router:e}=GS(mv.UseNavigateStable),t=pv(hv.UseNavigateStable),n=g.useRef(!1);return uv(()=>{n.current=!0}),g.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Vi({fromRouteId:t},o)))},[e,t])}const Ep={};function ZS(e,t,n){Ep[e]||(Ep[e]=!0)}function eC(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Tp(e){let{to:t,replace:n,state:s,relative:i}=e;Mr()||je(!1);let{future:o,static:a}=g.useContext(ls),{matches:l}=g.useContext(Tn),{pathname:c}=Ds(),u=uo(),d=Jf(t,Qf(l,o.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return g.useEffect(()=>u(JSON.parse(f),{replace:n,state:s,relative:i}),[u,f,i,n,s]),null}function et(e){je(!1)}function tC(e){let{basename:t="/",children:n=null,location:s,navigationType:i=zn.Pop,navigator:o,static:a=!1,future:l}=e;Mr()&&je(!1);let c=t.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:c,navigator:o,static:a,future:Vi({v7_relativeSplatPath:!1},l)}),[c,l,o,a]);typeof s=="string"&&(s=Pr(s));let{pathname:d="/",search:f="",hash:p="",state:b=null,key:j="default"}=s,v=g.useMemo(()=>{let h=Xf(d,c);return h==null?null:{location:{pathname:h,search:f,hash:p,state:b,key:j},navigationType:i}},[c,d,f,p,b,j,i]);return v==null?null:g.createElement(ls.Provider,{value:u},g.createElement(Ll.Provider,{children:n,value:v}))}function nC(e){let{children:t,location:n}=e;return zS(id(t),n)}new Promise(()=>{});function id(e,t){t===void 0&&(t=[]);let n=[];return g.Children.forEach(e,(s,i)=>{if(!g.isValidElement(s))return;let o=[...t,i];if(s.type===g.Fragment){n.push.apply(n,id(s.props.children,o));return}s.type!==et&&je(!1),!s.props.index||!s.props.children||je(!1);let a={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(a.children=id(s.props.children,o)),n.push(a)}),n}/**
59
- * React Router DOM v6.30.1
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */function od(){return od=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},od.apply(this,arguments)}function sC(e,t){if(e==null)return{};var n={},s=Object.keys(e),i,o;for(o=0;o<s.length;o++)i=s[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function rC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function iC(e,t){return e.button===0&&(!t||t==="_self")&&!rC(e)}const oC=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],aC="6";try{window.__reactRouterVersion=aC}catch{}const lC="startTransition",Ap=rf[lC];function cC(e){let{basename:t,children:n,future:s,window:i}=e,o=g.useRef();o.current==null&&(o.current=fS({window:i,v5Compat:!0}));let a=o.current,[l,c]=g.useState({action:a.action,location:a.location}),{v7_startTransition:u}=s||{},d=g.useCallback(f=>{u&&Ap?Ap(()=>c(f)):c(f)},[c,u]);return g.useLayoutEffect(()=>a.listen(d),[a,d]),g.useEffect(()=>eC(s),[s]),g.createElement(tC,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:a,future:s})}const uC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rp=g.forwardRef(function(t,n){let{onClick:s,relative:i,reloadDocument:o,replace:a,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=sC(t,oC),{basename:b}=g.useContext(ls),j,v=!1;if(typeof u=="string"&&dC.test(u)&&(j=u,uC))try{let y=new URL(window.location.href),w=u.startsWith("//")?new URL(y.protocol+u):new URL(u),S=Xf(w.pathname,b);w.origin===y.origin&&S!=null?u=S+w.search+w.hash:v=!0}catch{}let h=$S(u,{relative:i}),m=fC(u,{replace:a,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function x(y){s&&s(y),y.defaultPrevented||m(y)}return g.createElement("a",od({},p,{href:j||h,onClick:v||o?s:x,ref:n,target:c}))});var Pp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Pp||(Pp={}));var Mp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Mp||(Mp={}));function fC(e,t){let{target:n,replace:s,state:i,preventScrollReset:o,relative:a,viewTransition:l}=t===void 0?{}:t,c=uo(),u=Ds(),d=fv(e,{relative:a});return g.useCallback(f=>{if(iC(f,n)){f.preventDefault();let p=s!==void 0?s:tl(u)===tl(d);c(e,{replace:p,state:i,preventScrollReset:o,relative:a,viewTransition:l})}},[u,c,d,s,i,n,e,o,a,l])}const rn=Object.create(null);rn.open="0";rn.close="1";rn.ping="2";rn.pong="3";rn.message="4";rn.upgrade="5";rn.noop="6";const pa=Object.create(null);Object.keys(rn).forEach(e=>{pa[rn[e]]=e});const ad={type:"error",data:"parser error"},gv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xv=typeof ArrayBuffer=="function",yv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,em=({type:e,data:t},n,s)=>gv&&t instanceof Blob?n?s(t):_p(t,s):xv&&(t instanceof ArrayBuffer||yv(t))?n?s(t):_p(new Blob([t]),s):s(rn[e]+(t||"")),_p=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function Ip(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Mc;function mC(e,t){if(gv&&e.data instanceof Blob)return e.data.arrayBuffer().then(Ip).then(t);if(xv&&(e.data instanceof ArrayBuffer||yv(e.data)))return t(Ip(e.data));em(e,!1,n=>{Mc||(Mc=new TextEncoder),t(Mc.encode(n))})}const Op="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Op.length;e++)oi[Op.charCodeAt(e)]=e;const hC=e=>{let t=e.length*.75,n=e.length,s,i=0,o,a,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(s=0;s<n;s+=4)o=oi[e.charCodeAt(s)],a=oi[e.charCodeAt(s+1)],l=oi[e.charCodeAt(s+2)],c=oi[e.charCodeAt(s+3)],d[i++]=o<<2|a>>4,d[i++]=(a&15)<<4|l>>2,d[i++]=(l&3)<<6|c&63;return u},pC=typeof ArrayBuffer=="function",tm=(e,t)=>{if(typeof e!="string")return{type:"message",data:vv(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:gC(e.substring(1),t)}:pa[n]?e.length>1?{type:pa[n],data:e.substring(1)}:{type:pa[n]}:ad},gC=(e,t)=>{if(pC){const n=hC(e);return vv(n,t)}else return{base64:!0,data:e}},vv=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},bv="",xC=(e,t)=>{const n=e.length,s=new Array(n);let i=0;e.forEach((o,a)=>{em(o,!1,l=>{s[a]=l,++i===n&&t(s.join(bv))})})},yC=(e,t)=>{const n=e.split(bv),s=[];for(let i=0;i<n.length;i++){const o=tm(n[i],t);if(s.push(o),o.type==="error")break}return s};function vC(){return new TransformStream({transform(e,t){mC(e,n=>{const s=n.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,s)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let _c;function Wo(e){return e.reduce((t,n)=>t+n.length,0)}function Ho(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let i=0;i<t;i++)n[i]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function bC(e,t){_c||(_c=new TextDecoder);const n=[];let s=0,i=-1,o=!1;return new TransformStream({transform(a,l){for(n.push(a);;){if(s===0){if(Wo(n)<1)break;const c=Ho(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(Wo(n)<2)break;const c=Ho(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(Wo(n)<8)break;const c=Ho(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(ad);break}i=d*Math.pow(2,32)+u.getUint32(4),s=3}else{if(Wo(n)<i)break;const c=Ho(n,i);l.enqueue(tm(o?c:_c.decode(c),t)),s=0}if(i===0||i>e){l.enqueue(ad);break}}}})}const wv=4;function ke(e){if(e)return wC(e)}function wC(e){for(var t in ke.prototype)e[t]=ke.prototype[t];return e}ke.prototype.on=ke.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};ke.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};ke.prototype.off=ke.prototype.removeListener=ke.prototype.removeAllListeners=ke.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,i=0;i<n.length;i++)if(s=n[i],s===t||s.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};ke.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,i=n.length;s<i;++s)n[s].apply(this,t)}return this};ke.prototype.emitReserved=ke.prototype.emit;ke.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};ke.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Dl=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),St=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),jC="arraybuffer";function jv(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const NC=St.setTimeout,SC=St.clearTimeout;function Fl(e,t){t.useNativeTimers?(e.setTimeoutFn=NC.bind(St),e.clearTimeoutFn=SC.bind(St)):(e.setTimeoutFn=St.setTimeout.bind(St),e.clearTimeoutFn=St.clearTimeout.bind(St))}const CC=1.33;function kC(e){return typeof e=="string"?EC(e):Math.ceil((e.byteLength||e.size)*CC)}function EC(e){let t=0,n=0;for(let s=0,i=e.length;s<i;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function Nv(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function TC(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function AC(e){let t={},n=e.split("&");for(let s=0,i=n.length;s<i;s++){let o=n[s].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class RC extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class nm extends ke{constructor(t){super(),this.writable=!1,Fl(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new RC(t,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=tm(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=TC(t);return n.length?"?"+n:""}}class PC extends nm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};yC(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,xC(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Nv()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Sv=!1;try{Sv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const MC=Sv;function _C(){}class IC extends PC{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}let hr=class ga extends ke{constructor(t,n,s){super(),this.createRequest=t,Fl(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=jv(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ga.requestsCount++,ga.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=_C,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ga.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};hr.requestsCount=0;hr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Lp);else if(typeof addEventListener=="function"){const e="onpagehide"in St?"pagehide":"unload";addEventListener(e,Lp,!1)}}function Lp(){for(let e in hr.requests)hr.requests.hasOwnProperty(e)&&hr.requests[e].abort()}const OC=function(){const e=Cv({xdomain:!1});return e&&e.responseType!==null}();class LC extends IC{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=OC&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hr(Cv,this.uri(),t)}}function Cv(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||MC))return new XMLHttpRequest}catch{}if(!t)try{return new St[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const kv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class DC extends nm{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=kv?{}:jv(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],i=n===t.length-1;em(s,this.supportsBinary,o=>{try{this.doWrite(s,o)}catch{}i&&Dl(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Nv()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Ic=St.WebSocket||St.MozWebSocket;class FC extends DC{createSocket(t,n,s){return kv?new Ic(t,n,s):n?new Ic(t,n):new Ic(t)}doWrite(t,n){this.ws.send(n)}}class $C extends nm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=bC(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),i=vC();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const o=()=>{s.read().then(({done:l,value:c})=>{l||(this.onPacket(c),o())}).catch(l=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],i=n===t.length-1;this._writer.write(s).then(()=>{i&&Dl(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const UC={websocket:FC,webtransport:$C,polling:LC},zC=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,VC=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ld(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let i=zC.exec(e||""),o={},a=14;for(;a--;)o[VC[a]]=i[a]||"";return n!=-1&&s!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=BC(o,o.path),o.queryKey=WC(o,o.query),o}function BC(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function WC(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,o){i&&(n[i]=o)}),n}const cd=typeof addEventListener=="function"&&typeof removeEventListener=="function",xa=[];cd&&addEventListener("offline",()=>{xa.forEach(e=>e())},!1);class Qn extends ke{constructor(t,n){if(super(),this.binaryType=jC,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=ld(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=ld(n.host).host);Fl(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=AC(this.opts.query)),cd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},xa.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=wv,n.transport=t,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Qn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Qn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(n+=kC(i)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Dl(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,i){if(typeof n=="function"&&(i=n,n=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const o={type:t,data:n,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(Qn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),cd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=xa.indexOf(this._offlineEventListener);s!==-1&&xa.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Qn.protocol=wv;class HC extends Qn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;Qn.priorWebsocketSuccess=!1;const i=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!s)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Qn.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function o(){s||(s=!0,d(),n.close(),n=null)}const a=f=>{const p=new Error("probe error: "+f);p.transport=n.name,o(),this.emitReserved("upgradeError",p)};function l(){a("transport closed")}function c(){a("socket closed")}function u(f){n&&f.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let qC=class extends HC{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>UC[i]).filter(i=>!!i)),super(t,s)}};function KC(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=ld(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const o=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+o+":"+s.port+t,s.href=s.protocol+"://"+o+(n&&n.port===s.port?"":":"+s.port),s}const GC=typeof ArrayBuffer=="function",YC=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Ev=Object.prototype.toString,XC=typeof Blob=="function"||typeof Blob<"u"&&Ev.call(Blob)==="[object BlobConstructor]",QC=typeof File=="function"||typeof File<"u"&&Ev.call(File)==="[object FileConstructor]";function sm(e){return GC&&(e instanceof ArrayBuffer||YC(e))||XC&&e instanceof Blob||QC&&e instanceof File}function ya(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(ya(e[n]))return!0;return!1}if(sm(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ya(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ya(e[n]))return!0;return!1}function JC(e){const t=[],n=e.data,s=e;return s.data=ud(n,t),s.attachments=t.length,{packet:s,buffers:t}}function ud(e,t){if(!e)return e;if(sm(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=ud(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ud(e[s],t));return n}return e}function ZC(e,t){return e.data=dd(e.data,t),delete e.attachments,e}function dd(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=dd(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=dd(e[n],t));return e}const ek=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],tk=5;var ne;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ne||(ne={}));class nk{constructor(t){this.replacer=t}encode(t){return(t.type===ne.EVENT||t.type===ne.ACK)&&ya(t)?this.encodeAsBinary({type:t.type===ne.EVENT?ne.BINARY_EVENT:ne.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ne.BINARY_EVENT||t.type===ne.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=JC(t),s=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(s),i}}function Dp(e){return Object.prototype.toString.call(e)==="[object Object]"}class rm extends ke{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===ne.BINARY_EVENT;s||n.type===ne.BINARY_ACK?(n.type=s?ne.EVENT:ne.ACK,this.reconstructor=new sk(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(sm(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(ne[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===ne.BINARY_EVENT||s.type===ne.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(o,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(a)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(o,n)}else s.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}s.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(rm.isPayloadValid(s.type,o))s.data=o;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ne.CONNECT:return Dp(n);case ne.DISCONNECT:return n===void 0;case ne.CONNECT_ERROR:return typeof n=="string"||Dp(n);case ne.EVENT:case ne.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ek.indexOf(n[0])===-1);case ne.ACK:case ne.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sk{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=ZC(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const rk=Object.freeze(Object.defineProperty({__proto__:null,Decoder:rm,Encoder:nk,get PacketType(){return ne},protocol:tk},Symbol.toStringTag,{value:"Module"}));function Dt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ik=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Tv extends ke{constructor(t,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Dt(t,"open",this.onopen.bind(this)),Dt(t,"packet",this.onpacket.bind(this)),Dt(t,"error",this.onerror.bind(this)),Dt(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,i,o;if(ik.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:ne.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,f=n.pop();this._registerAckCallback(d,f),a.id=d}const l=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,n){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},i),a=(...l)=>{this.io.clearTimeoutFn(o),n.apply(this,l)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((s,i)=>{const o=(a,l)=>a?i(a):s(l);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ne.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ne.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ne.EVENT:case ne.BINARY_EVENT:this.onevent(t);break;case ne.ACK:case ne.BINARY_ACK:this.onack(t);break;case ne.DISCONNECT:this.ondisconnect();break;case ne.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...i){s||(s=!0,n.packet({type:ne.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ne.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function _r(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}_r.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};_r.prototype.reset=function(){this.attempts=0};_r.prototype.setMin=function(e){this.ms=e};_r.prototype.setMax=function(e){this.max=e};_r.prototype.setJitter=function(e){this.jitter=e};class fd extends ke{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Fl(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new _r({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||rk;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new qC(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=Dt(n,"open",function(){s.onopen(),t&&t()}),o=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},a=Dt(n,"error",o);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Dt(t,"ping",this.onping.bind(this)),Dt(t,"data",this.ondata.bind(this)),Dt(t,"error",this.onerror.bind(this)),Dt(t,"close",this.onclose.bind(this)),Dt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Dl(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new Tv(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Qr={};function va(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=KC(e,t.path||"/socket.io"),s=n.source,i=n.id,o=n.path,a=Qr[i]&&o in Qr[i].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let c;return l?c=new fd(s,t):(Qr[i]||(Qr[i]=new fd(s,t)),c=Qr[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(va,{Manager:fd,Socket:Tv,io:va,connect:va});const Av=g.createContext(),an=()=>{const e=g.useContext(Av);if(!e)throw new Error("useSocket must be used within SocketProvider");return e},ok=({children:e})=>{const[t,n]=g.useState(null),[s,i]=g.useState(!1);g.useEffect(()=>{const l=va("http://localhost:3001",{transports:["websocket","polling"]});return l.on("connect",()=>{console.log("Connected to server"),i(!0)}),l.on("disconnect",()=>{console.log("Disconnected from server"),i(!1)}),n(l),()=>{l.close()}},[]);const o=(l,c)=>{t&&s&&t.emit(l,c)},a=(l,c)=>{if(t)return t.on(l,c),()=>t.off(l,c)};return r.jsx(Av.Provider,{value:{socket:t,connected:s,emit:o,on:a},children:e})};function Rv(e,t){return function(){return e.apply(t,arguments)}}const{toString:ak}=Object.prototype,{getPrototypeOf:im}=Object,{iterator:$l,toStringTag:Pv}=Symbol,Ul=(e=>t=>{const n=ak.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wt=e=>(e=e.toLowerCase(),t=>Ul(t)===e),zl=e=>t=>typeof t===e,{isArray:Ir}=Array,Bi=zl("undefined");function lk(e){return e!==null&&!Bi(e)&&e.constructor!==null&&!Bi(e.constructor)&&at(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Mv=Wt("ArrayBuffer");function ck(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Mv(e.buffer),t}const uk=zl("string"),at=zl("function"),_v=zl("number"),Vl=e=>e!==null&&typeof e=="object",dk=e=>e===!0||e===!1,ba=e=>{if(Ul(e)!=="object")return!1;const t=im(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Pv in e)&&!($l in e)},fk=Wt("Date"),mk=Wt("File"),hk=Wt("Blob"),pk=Wt("FileList"),gk=e=>Vl(e)&&at(e.pipe),xk=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||at(e.append)&&((t=Ul(e))==="formdata"||t==="object"&&at(e.toString)&&e.toString()==="[object FormData]"))},yk=Wt("URLSearchParams"),[vk,bk,wk,jk]=["ReadableStream","Request","Response","Headers"].map(Wt),Nk=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fo(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,i;if(typeof e!="object"&&(e=[e]),Ir(e))for(s=0,i=e.length;s<i;s++)t.call(null,e[s],s,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let l;for(s=0;s<a;s++)l=o[s],t.call(null,e[l],l,e)}}function Iv(e,t){t=t.toLowerCase();const n=Object.keys(e);let s=n.length,i;for(;s-- >0;)if(i=n[s],t===i.toLowerCase())return i;return null}const bs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ov=e=>!Bi(e)&&e!==bs;function md(){const{caseless:e}=Ov(this)&&this||{},t={},n=(s,i)=>{const o=e&&Iv(t,i)||i;ba(t[o])&&ba(s)?t[o]=md(t[o],s):ba(s)?t[o]=md({},s):Ir(s)?t[o]=s.slice():t[o]=s};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&fo(arguments[s],n);return t}const Sk=(e,t,n,{allOwnKeys:s}={})=>(fo(t,(i,o)=>{n&&at(i)?e[o]=Rv(i,n):e[o]=i},{allOwnKeys:s}),e),Ck=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),kk=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Ek=(e,t,n,s)=>{let i,o,a;const l={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],(!s||s(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=n!==!1&&im(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Tk=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Ak=e=>{if(!e)return null;if(Ir(e))return e;let t=e.length;if(!_v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Rk=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&im(Uint8Array)),Pk=(e,t)=>{const s=(e&&e[$l]).call(e);let i;for(;(i=s.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},Mk=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},_k=Wt("HTMLFormElement"),Ik=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,i){return s.toUpperCase()+i}),Fp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ok=Wt("RegExp"),Lv=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};fo(n,(i,o)=>{let a;(a=t(i,o,e))!==!1&&(s[o]=a||i)}),Object.defineProperties(e,s)},Lk=e=>{Lv(e,(t,n)=>{if(at(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(at(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Dk=(e,t)=>{const n={},s=i=>{i.forEach(o=>{n[o]=!0})};return Ir(e)?s(e):s(String(e).split(t)),n},Fk=()=>{},$k=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Uk(e){return!!(e&&at(e.append)&&e[Pv]==="FormData"&&e[$l])}const zk=e=>{const t=new Array(10),n=(s,i)=>{if(Vl(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[i]=s;const o=Ir(s)?[]:{};return fo(s,(a,l)=>{const c=n(a,i+1);!Bi(c)&&(o[l]=c)}),t[i]=void 0,o}}return s};return n(e,0)},Vk=Wt("AsyncFunction"),Bk=e=>e&&(Vl(e)||at(e))&&at(e.then)&&at(e.catch),Dv=((e,t)=>e?setImmediate:t?((n,s)=>(bs.addEventListener("message",({source:i,data:o})=>{i===bs&&o===n&&s.length&&s.shift()()},!1),i=>{s.push(i),bs.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",at(bs.postMessage)),Wk=typeof queueMicrotask<"u"?queueMicrotask.bind(bs):typeof process<"u"&&process.nextTick||Dv,Hk=e=>e!=null&&at(e[$l]),L={isArray:Ir,isArrayBuffer:Mv,isBuffer:lk,isFormData:xk,isArrayBufferView:ck,isString:uk,isNumber:_v,isBoolean:dk,isObject:Vl,isPlainObject:ba,isReadableStream:vk,isRequest:bk,isResponse:wk,isHeaders:jk,isUndefined:Bi,isDate:fk,isFile:mk,isBlob:hk,isRegExp:Ok,isFunction:at,isStream:gk,isURLSearchParams:yk,isTypedArray:Rk,isFileList:pk,forEach:fo,merge:md,extend:Sk,trim:Nk,stripBOM:Ck,inherits:kk,toFlatObject:Ek,kindOf:Ul,kindOfTest:Wt,endsWith:Tk,toArray:Ak,forEachEntry:Pk,matchAll:Mk,isHTMLForm:_k,hasOwnProperty:Fp,hasOwnProp:Fp,reduceDescriptors:Lv,freezeMethods:Lk,toObjectSet:Dk,toCamelCase:Ik,noop:Fk,toFiniteNumber:$k,findKey:Iv,global:bs,isContextDefined:Ov,isSpecCompliantForm:Uk,toJSONObject:zk,isAsyncFn:Vk,isThenable:Bk,setImmediate:Dv,asap:Wk,isIterable:Hk};function J(e,t,n,s,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}L.inherits(J,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:L.toJSONObject(this.config),code:this.code,status:this.status}}});const Fv=J.prototype,$v={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{$v[e]={value:e}});Object.defineProperties(J,$v);Object.defineProperty(Fv,"isAxiosError",{value:!0});J.from=(e,t,n,s,i,o)=>{const a=Object.create(Fv);return L.toFlatObject(e,a,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),J.call(a,e.message,t,n,s,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};const qk=null;function hd(e){return L.isPlainObject(e)||L.isArray(e)}function Uv(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function $p(e,t,n){return e?e.concat(t).map(function(i,o){return i=Uv(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function Kk(e){return L.isArray(e)&&!e.some(hd)}const Gk=L.toFlatObject(L,{},null,function(t){return/^is[A-Z]/.test(t)});function Bl(e,t,n){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,h){return!L.isUndefined(h[v])});const s=n.metaTokens,i=n.visitor||d,o=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(i))throw new TypeError("visitor must be a function");function u(j){if(j===null)return"";if(L.isDate(j))return j.toISOString();if(L.isBoolean(j))return j.toString();if(!c&&L.isBlob(j))throw new J("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(j)||L.isTypedArray(j)?c&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function d(j,v,h){let m=j;if(j&&!h&&typeof j=="object"){if(L.endsWith(v,"{}"))v=s?v:v.slice(0,-2),j=JSON.stringify(j);else if(L.isArray(j)&&Kk(j)||(L.isFileList(j)||L.endsWith(v,"[]"))&&(m=L.toArray(j)))return v=Uv(v),m.forEach(function(y,w){!(L.isUndefined(y)||y===null)&&t.append(a===!0?$p([v],w,o):a===null?v:v+"[]",u(y))}),!1}return hd(j)?!0:(t.append($p(h,v,o),u(j)),!1)}const f=[],p=Object.assign(Gk,{defaultVisitor:d,convertValue:u,isVisitable:hd});function b(j,v){if(!L.isUndefined(j)){if(f.indexOf(j)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(j),L.forEach(j,function(m,x){(!(L.isUndefined(m)||m===null)&&i.call(t,m,L.isString(x)?x.trim():x,v,p))===!0&&b(m,v?v.concat(x):[x])}),f.pop()}}if(!L.isObject(e))throw new TypeError("data must be an object");return b(e),t}function Up(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function om(e,t){this._pairs=[],e&&Bl(e,this,t)}const zv=om.prototype;zv.append=function(t,n){this._pairs.push([t,n])};zv.toString=function(t){const n=t?function(s){return t.call(this,s,Up)}:Up;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Yk(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Vv(e,t,n){if(!t)return e;const s=n&&n.encode||Yk;L.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(t,n):o=L.isURLSearchParams(t)?t.toString():new om(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class zp{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){L.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Bv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xk=typeof URLSearchParams<"u"?URLSearchParams:om,Qk=typeof FormData<"u"?FormData:null,Jk=typeof Blob<"u"?Blob:null,Zk={isBrowser:!0,classes:{URLSearchParams:Xk,FormData:Qk,Blob:Jk},protocols:["http","https","file","blob","url","data"]},am=typeof window<"u"&&typeof document<"u",pd=typeof navigator=="object"&&navigator||void 0,eE=am&&(!pd||["ReactNative","NativeScript","NS"].indexOf(pd.product)<0),tE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",nE=am&&window.location.href||"http://localhost",sE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:am,hasStandardBrowserEnv:eE,hasStandardBrowserWebWorkerEnv:tE,navigator:pd,origin:nE},Symbol.toStringTag,{value:"Module"})),Ue={...sE,...Zk};function rE(e,t){return Bl(e,new Ue.classes.URLSearchParams,Object.assign({visitor:function(n,s,i,o){return Ue.isNode&&L.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function iE(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function oE(e){const t={},n=Object.keys(e);let s;const i=n.length;let o;for(s=0;s<i;s++)o=n[s],t[o]=e[o];return t}function Wv(e){function t(n,s,i,o){let a=n[o++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),c=o>=n.length;return a=!a&&L.isArray(i)?i.length:a,c?(L.hasOwnProp(i,a)?i[a]=[i[a],s]:i[a]=s,!l):((!i[a]||!L.isObject(i[a]))&&(i[a]=[]),t(n,s,i[a],o)&&L.isArray(i[a])&&(i[a]=oE(i[a])),!l)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,(s,i)=>{t(iE(s),i,n,0)}),n}return null}function aE(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const mo={transitional:Bv,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",i=s.indexOf("application/json")>-1,o=L.isObject(t);if(o&&L.isHTMLForm(t)&&(t=new FormData(t)),L.isFormData(t))return i?JSON.stringify(Wv(t)):t;if(L.isArrayBuffer(t)||L.isBuffer(t)||L.isStream(t)||L.isFile(t)||L.isBlob(t)||L.isReadableStream(t))return t;if(L.isArrayBufferView(t))return t.buffer;if(L.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return rE(t,this.formSerializer).toString();if((l=L.isFileList(t))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Bl(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),aE(t)):t}],transformResponse:[function(t){const n=this.transitional||mo.transitional,s=n&&n.forcedJSONParsing,i=this.responseType==="json";if(L.isResponse(t)||L.isReadableStream(t))return t;if(t&&L.isString(t)&&(s&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(l){if(a)throw l.name==="SyntaxError"?J.from(l,J.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch"],e=>{mo.headers[e]={}});const lE=L.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"]),cE=e=>{const t={};let n,s,i;return e&&e.split(`
68
- `).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),s=a.substring(i+1).trim(),!(!n||t[n]&&lE[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},Vp=Symbol("internals");function Jr(e){return e&&String(e).trim().toLowerCase()}function wa(e){return e===!1||e==null?e:L.isArray(e)?e.map(wa):String(e)}function uE(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const dE=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Oc(e,t,n,s,i){if(L.isFunction(s))return s.call(this,t,n);if(i&&(t=n),!!L.isString(t)){if(L.isString(s))return t.indexOf(s)!==-1;if(L.isRegExp(s))return s.test(t)}}function fE(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function mE(e,t){const n=L.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(i,o,a){return this[s].call(this,t,i,o,a)},configurable:!0})})}let lt=class{constructor(t){t&&this.set(t)}set(t,n,s){const i=this;function o(l,c,u){const d=Jr(c);if(!d)throw new Error("header name must be a non-empty string");const f=L.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=wa(l))}const a=(l,c)=>L.forEach(l,(u,d)=>o(u,d,c));if(L.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(L.isString(t)&&(t=t.trim())&&!dE(t))a(cE(t),n);else if(L.isObject(t)&&L.isIterable(t)){let l={},c,u;for(const d of t){if(!L.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?L.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}a(l,n)}else t!=null&&o(n,t,s);return this}get(t,n){if(t=Jr(t),t){const s=L.findKey(this,t);if(s){const i=this[s];if(!n)return i;if(n===!0)return uE(i);if(L.isFunction(n))return n.call(this,i,s);if(L.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Jr(t),t){const s=L.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Oc(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let i=!1;function o(a){if(a=Jr(a),a){const l=L.findKey(s,a);l&&(!n||Oc(s,s[l],l,n))&&(delete s[l],i=!0)}}return L.isArray(t)?t.forEach(o):o(t),i}clear(t){const n=Object.keys(this);let s=n.length,i=!1;for(;s--;){const o=n[s];(!t||Oc(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const n=this,s={};return L.forEach(this,(i,o)=>{const a=L.findKey(s,o);if(a){n[a]=wa(i),delete n[o];return}const l=t?fE(o):String(o).trim();l!==o&&delete n[o],n[l]=wa(i),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return L.forEach(this,(s,i)=>{s!=null&&s!==!1&&(n[i]=t&&L.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
69
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(i=>s.set(i)),s}static accessor(t){const s=(this[Vp]=this[Vp]={accessors:{}}).accessors,i=this.prototype;function o(a){const l=Jr(a);s[l]||(mE(i,a),s[l]=!0)}return L.isArray(t)?t.forEach(o):o(t),this}};lt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(lt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});L.freezeMethods(lt);function Lc(e,t){const n=this||mo,s=t||n,i=lt.from(s.headers);let o=s.data;return L.forEach(e,function(l){o=l.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Hv(e){return!!(e&&e.__CANCEL__)}function Or(e,t,n){J.call(this,e??"canceled",J.ERR_CANCELED,t,n),this.name="CanceledError"}L.inherits(Or,J,{__CANCEL__:!0});function qv(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new J("Request failed with status code "+n.status,[J.ERR_BAD_REQUEST,J.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function hE(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pE(e,t){e=e||10;const n=new Array(e),s=new Array(e);let i=0,o=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=s[o];a||(a=u),n[i]=c,s[i]=u;let f=o,p=0;for(;f!==i;)p+=n[f++],f=f%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),u-a<t)return;const b=d&&u-d;return b?Math.round(p*1e3/b):void 0}}function gE(e,t){let n=0,s=1e3/t,i,o;const a=(u,d=Date.now())=>{n=d,i=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=s?a(u,d):(i=u,o||(o=setTimeout(()=>{o=null,a(i)},s-f)))},()=>i&&a(i)]}const nl=(e,t,n=3)=>{let s=0;const i=pE(50,250);return gE(o=>{const a=o.loaded,l=o.lengthComputable?o.total:void 0,c=a-s,u=i(c),d=a<=l;s=a;const f={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},Bp=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},Wp=e=>(...t)=>L.asap(()=>e(...t)),xE=Ue.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ue.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ue.origin),Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent)):()=>!0,yE=Ue.hasStandardBrowserEnv?{write(e,t,n,s,i,o){const a=[e+"="+encodeURIComponent(t)];L.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),L.isString(s)&&a.push("path="+s),L.isString(i)&&a.push("domain="+i),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function vE(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function bE(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Kv(e,t,n){let s=!vE(t);return e&&(s||n==!1)?bE(e,t):t}const Hp=e=>e instanceof lt?{...e}:e;function _s(e,t){t=t||{};const n={};function s(u,d,f,p){return L.isPlainObject(u)&&L.isPlainObject(d)?L.merge.call({caseless:p},u,d):L.isPlainObject(d)?L.merge({},d):L.isArray(d)?d.slice():d}function i(u,d,f,p){if(L.isUndefined(d)){if(!L.isUndefined(u))return s(void 0,u,f,p)}else return s(u,d,f,p)}function o(u,d){if(!L.isUndefined(d))return s(void 0,d)}function a(u,d){if(L.isUndefined(d)){if(!L.isUndefined(u))return s(void 0,u)}else return s(void 0,d)}function l(u,d,f){if(f in t)return s(u,d);if(f in e)return s(void 0,u)}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d,f)=>i(Hp(u),Hp(d),f,!0)};return L.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||i,p=f(e[d],t[d],d);L.isUndefined(p)&&f!==l||(n[d]=p)}),n}const Gv=e=>{const t=_s({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:l}=t;t.headers=a=lt.from(a),t.url=Vv(Kv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(L.isFormData(n)){if(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Ue.hasStandardBrowserEnv&&(s&&L.isFunction(s)&&(s=s(t)),s||s!==!1&&xE(t.url))){const u=i&&o&&yE.read(o);u&&a.set(i,u)}return t},wE=typeof XMLHttpRequest<"u",jE=wE&&function(e){return new Promise(function(n,s){const i=Gv(e);let o=i.data;const a=lt.from(i.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=i,d,f,p,b,j;function v(){b&&b(),j&&j(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let h=new XMLHttpRequest;h.open(i.method.toUpperCase(),i.url,!0),h.timeout=i.timeout;function m(){if(!h)return;const y=lt.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),S={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:y,config:e,request:h};qv(function(k){n(k),v()},function(k){s(k),v()},S),h=null}"onloadend"in h?h.onloadend=m:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(m)},h.onabort=function(){h&&(s(new J("Request aborted",J.ECONNABORTED,e,h)),h=null)},h.onerror=function(){s(new J("Network Error",J.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let w=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const S=i.transitional||Bv;i.timeoutErrorMessage&&(w=i.timeoutErrorMessage),s(new J(w,S.clarifyTimeoutError?J.ETIMEDOUT:J.ECONNABORTED,e,h)),h=null},o===void 0&&a.setContentType(null),"setRequestHeader"in h&&L.forEach(a.toJSON(),function(w,S){h.setRequestHeader(S,w)}),L.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),l&&l!=="json"&&(h.responseType=i.responseType),u&&([p,j]=nl(u,!0),h.addEventListener("progress",p)),c&&h.upload&&([f,b]=nl(c),h.upload.addEventListener("progress",f),h.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(d=y=>{h&&(s(!y||y.type?new Or(null,e,h):y),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=hE(i.url);if(x&&Ue.protocols.indexOf(x)===-1){s(new J("Unsupported protocol "+x+":",J.ERR_BAD_REQUEST,e));return}h.send(o||null)})},NE=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,i;const o=function(u){if(!i){i=!0,l();const d=u instanceof Error?u:this.reason;s.abort(d instanceof J?d:new Or(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,o(new J(`timeout ${t} of ms exceeded`,J.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=s;return c.unsubscribe=()=>L.asap(l),c}},SE=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,i;for(;s<n;)i=s+t,yield e.slice(s,i),s=i},CE=async function*(e,t){for await(const n of kE(e))yield*SE(n,t)},kE=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},qp=(e,t,n,s)=>{const i=CE(e,t);let o=0,a,l=c=>{a||(a=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await i.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=o+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},Wl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Yv=Wl&&typeof ReadableStream=="function",EE=Wl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Xv=(e,...t)=>{try{return!!e(...t)}catch{return!1}},TE=Yv&&Xv(()=>{let e=!1;const t=new Request(Ue.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Kp=64*1024,gd=Yv&&Xv(()=>L.isReadableStream(new Response("").body)),sl={stream:gd&&(e=>e.body)};Wl&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!sl[t]&&(sl[t]=L.isFunction(e[t])?n=>n[t]():(n,s)=>{throw new J(`Response type '${t}' is not supported`,J.ERR_NOT_SUPPORT,s)})})})(new Response);const AE=async e=>{if(e==null)return 0;if(L.isBlob(e))return e.size;if(L.isSpecCompliantForm(e))return(await new Request(Ue.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(L.isArrayBufferView(e)||L.isArrayBuffer(e))return e.byteLength;if(L.isURLSearchParams(e)&&(e=e+""),L.isString(e))return(await EE(e)).byteLength},RE=async(e,t)=>{const n=L.toFiniteNumber(e.getContentLength());return n??AE(t)},PE=Wl&&(async e=>{let{url:t,method:n,data:s,signal:i,cancelToken:o,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:p}=Gv(e);u=u?(u+"").toLowerCase():"text";let b=NE([i,o&&o.toAbortSignal()],a),j;const v=b&&b.unsubscribe&&(()=>{b.unsubscribe()});let h;try{if(c&&TE&&n!=="get"&&n!=="head"&&(h=await RE(d,s))!==0){let S=new Request(t,{method:"POST",body:s,duplex:"half"}),C;if(L.isFormData(s)&&(C=S.headers.get("content-type"))&&d.setContentType(C),S.body){const[k,T]=Bp(h,nl(Wp(c)));s=qp(S.body,Kp,k,T)}}L.isString(f)||(f=f?"include":"omit");const m="credentials"in Request.prototype;j=new Request(t,{...p,signal:b,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:s,duplex:"half",credentials:m?f:void 0});let x=await fetch(j,p);const y=gd&&(u==="stream"||u==="response");if(gd&&(l||y&&v)){const S={};["status","statusText","headers"].forEach(N=>{S[N]=x[N]});const C=L.toFiniteNumber(x.headers.get("content-length")),[k,T]=l&&Bp(C,nl(Wp(l),!0))||[];x=new Response(qp(x.body,Kp,k,()=>{T&&T(),v&&v()}),S)}u=u||"text";let w=await sl[L.findKey(sl,u)||"text"](x,e);return!y&&v&&v(),await new Promise((S,C)=>{qv(S,C,{data:w,headers:lt.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:j})})}catch(m){throw v&&v(),m&&m.name==="TypeError"&&/Load failed|fetch/i.test(m.message)?Object.assign(new J("Network Error",J.ERR_NETWORK,e,j),{cause:m.cause||m}):J.from(m,m&&m.code,e,j)}}),xd={http:qk,xhr:jE,fetch:PE};L.forEach(xd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Gp=e=>`- ${e}`,ME=e=>L.isFunction(e)||e===null||e===!1,Qv={getAdapter:e=>{e=L.isArray(e)?e:[e];const{length:t}=e;let n,s;const i={};for(let o=0;o<t;o++){n=e[o];let a;if(s=n,!ME(n)&&(s=xd[(a=String(n)).toLowerCase()],s===void 0))throw new J(`Unknown adapter '${a}'`);if(s)break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
70
- `+o.map(Gp).join(`
71
- `):" "+Gp(o[0]):"as no adapter specified";throw new J("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:xd};function Dc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Or(null,e)}function Yp(e){return Dc(e),e.headers=lt.from(e.headers),e.data=Lc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Qv.getAdapter(e.adapter||mo.adapter)(e).then(function(s){return Dc(e),s.data=Lc.call(e,e.transformResponse,s),s.headers=lt.from(s.headers),s},function(s){return Hv(s)||(Dc(e),s&&s.response&&(s.response.data=Lc.call(e,e.transformResponse,s.response),s.response.headers=lt.from(s.response.headers))),Promise.reject(s)})}const Jv="1.10.0",Hl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Hl[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Xp={};Hl.transitional=function(t,n,s){function i(o,a){return"[Axios v"+Jv+"] Transitional option '"+o+"'"+a+(s?". "+s:"")}return(o,a,l)=>{if(t===!1)throw new J(i(a," has been removed"+(n?" in "+n:"")),J.ERR_DEPRECATED);return n&&!Xp[a]&&(Xp[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,a,l):!0}};Hl.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function _E(e,t,n){if(typeof e!="object")throw new J("options must be an object",J.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let i=s.length;for(;i-- >0;){const o=s[i],a=t[o];if(a){const l=e[o],c=l===void 0||a(l,o,e);if(c!==!0)throw new J("option "+o+" must be "+c,J.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new J("Unknown option "+o,J.ERR_BAD_OPTION)}}const ja={assertOptions:_E,validators:Hl},qt=ja.validators;let Cs=class{constructor(t){this.defaults=t||{},this.interceptors={request:new zp,response:new zp}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
72
- `+o):s.stack=o}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=_s(this.defaults,n);const{transitional:s,paramsSerializer:i,headers:o}=n;s!==void 0&&ja.assertOptions(s,{silentJSONParsing:qt.transitional(qt.boolean),forcedJSONParsing:qt.transitional(qt.boolean),clarifyTimeoutError:qt.transitional(qt.boolean)},!1),i!=null&&(L.isFunction(i)?n.paramsSerializer={serialize:i}:ja.assertOptions(i,{encode:qt.function,serialize:qt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ja.assertOptions(n,{baseUrl:qt.spelling("baseURL"),withXsrfToken:qt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&L.merge(o.common,o[n.method]);o&&L.forEach(["delete","get","head","post","put","patch","common"],j=>{delete o[j]}),n.headers=lt.concat(a,o);const l=[];let c=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(c=c&&v.synchronous,l.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,p;if(!c){const j=[Yp.bind(this),void 0];for(j.unshift.apply(j,l),j.push.apply(j,u),p=j.length,d=Promise.resolve(n);f<p;)d=d.then(j[f++],j[f++]);return d}p=l.length;let b=n;for(f=0;f<p;){const j=l[f++],v=l[f++];try{b=j(b)}catch(h){v.call(this,h);break}}try{d=Yp.call(this,b)}catch(j){return Promise.reject(j)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=_s(this.defaults,t);const n=Kv(t.baseURL,t.url,t.allowAbsoluteUrls);return Vv(n,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){Cs.prototype[t]=function(n,s){return this.request(_s(s||{},{method:t,url:n,data:(s||{}).data}))}});L.forEach(["post","put","patch"],function(t){function n(s){return function(o,a,l){return this.request(_s(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}Cs.prototype[t]=n(),Cs.prototype[t+"Form"]=n(!0)});let IE=class Zv{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const s=this;this.promise.then(i=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](i);s._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(l=>{s.subscribe(l),o=l}).then(i);return a.cancel=function(){s.unsubscribe(o)},a},t(function(o,a,l){s.reason||(s.reason=new Or(o,a,l),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Zv(function(i){t=i}),cancel:t}}};function OE(e){return function(n){return e.apply(null,n)}}function LE(e){return L.isObject(e)&&e.isAxiosError===!0}const yd={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(yd).forEach(([e,t])=>{yd[t]=e});function eb(e){const t=new Cs(e),n=Rv(Cs.prototype.request,t);return L.extend(n,Cs.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return eb(_s(e,i))},n}const Ne=eb(mo);Ne.Axios=Cs;Ne.CanceledError=Or;Ne.CancelToken=IE;Ne.isCancel=Hv;Ne.VERSION=Jv;Ne.toFormData=Bl;Ne.AxiosError=J;Ne.Cancel=Ne.CanceledError;Ne.all=function(t){return Promise.all(t)};Ne.spread=OE;Ne.isAxiosError=LE;Ne.mergeConfig=_s;Ne.AxiosHeaders=lt;Ne.formToJSON=e=>Wv(L.isHTMLForm(e)?new FormData(e):e);Ne.getAdapter=Qv.getAdapter;Ne.HttpStatusCode=yd;Ne.default=Ne;const{Axios:CL,AxiosError:kL,CanceledError:EL,isCancel:TL,CancelToken:AL,VERSION:RL,all:PL,Cancel:ML,isAxiosError:_L,spread:IL,toFormData:OL,AxiosHeaders:LL,HttpStatusCode:DL,formToJSON:FL,getAdapter:$L,mergeConfig:UL}=Ne,W=Ne.create({baseURL:"",headers:{"Content-Type":"application/json"}});W.interceptors.request.use(e=>e,e=>Promise.reject(e));W.interceptors.response.use(e=>e,e=>(e.response?console.error("API Error:",e.response.data):e.request?console.error("Network Error:",e.request):console.error("Error:",e.message),Promise.reject(e)));const tb=g.createContext(),Mt=()=>{const e=g.useContext(tb);if(!e)throw new Error("useFrigg must be used within FriggProvider");return e},DE=({children:e})=>{const{on:t,emit:n}=an(),[s,i]=g.useState("stopped"),[o,a]=g.useState("local"),[l,c]=g.useState([]),[u,d]=g.useState({}),[f,p]=g.useState([]),[b,j]=g.useState([]),[v,h]=g.useState(null),[m,x]=g.useState([]),[y,w]=g.useState(null),[S,C]=g.useState(!0),[k,T]=g.useState(!1),[N,E]=g.useState(null);g.useEffect(()=>{const H=t("frigg:status",ee=>{i(ee.status)}),q=t("integrations:update",ee=>{c(ee.integrations)});return A(),()=>{H&&H(),q&&q()}},[t]);const A=async()=>{try{C(!0);const H=await P();w(null)}catch(H){console.error("Error initializing app:",H),E(H.message||"Failed to initialize app")}finally{C(!1)}},P=async()=>{var H;try{const q=await W.get("/api/project/repositories"),ee=((H=q.data.data)==null?void 0:H.repositories)||q.data.repositories||[];return x(ee),ee}catch(q){return console.error("Error fetching repositories:",q),x([]),[]}},M=async H=>{var q;try{const ee=await W.post("/api/project/switch-repository",{repositoryPath:H}),Ze=((q=ee.data.data)==null?void 0:q.repository)||ee.data.repository;return w(Ze),await _(),Ze}catch(ee){throw console.error("Error switching repository:",ee),ee}},_=async()=>{var H,q,ee,Ze,ch;try{T(!0),E(null);const[Vr,uh,dh,fh,mh]=await Promise.all([W.get("/api/project/status"),W.get("/api/integrations"),W.get("/api/environment"),W.get("/api/users"),W.get("/api/connections")]);i(((H=Vr.data.data)==null?void 0:H.status)||Vr.data.status||"stopped"),c(((q=uh.data.data)==null?void 0:q.integrations)||uh.data.integrations||[]),d(((ee=dh.data.data)==null?void 0:ee.variables)||dh.data.variables||{}),p(((Ze=fh.data.data)==null?void 0:Ze.users)||fh.data.users||[]),j(((ch=mh.data.data)==null?void 0:ch.connections)||mh.data.connections||[])}catch(Vr){console.error("Error fetching initial data:",Vr),E(Vr.message||"Failed to fetch data")}finally{T(!1)}},O=async(H={})=>{try{i("starting"),await W.post("/api/project/start",H)}catch(q){console.error("Error starting Frigg:",q),i("stopped")}},F=async(H=!1)=>{try{await W.post("/api/project/stop",{force:H}),i("stopped")}catch(q){console.error("Error stopping Frigg:",q)}},$=async(H={})=>{try{await W.post("/api/project/restart",H)}catch(q){console.error("Error restarting Frigg:",q)}},R=async(H=100)=>{var q;try{const ee=await W.get(`/api/project/logs?limit=${H}`);return((q=ee.data.data)==null?void 0:q.logs)||ee.data.logs||[]}catch(ee){return console.error("Error fetching logs:",ee),[]}},I=async()=>{try{const H=await W.get("/api/project/metrics");return H.data.data||H.data}catch(H){return console.error("Error fetching metrics:",H),null}},D=async H=>{try{const q=await W.post("/api/integrations/install",{name:H});return await _(),q.data}catch(q){throw console.error("Error installing integration:",q),q}},z=async(H,q)=>{try{await W.put("/api/environment",{key:H,value:q}),d(ee=>({...ee,[H]:q}))}catch(ee){throw console.error("Error updating environment variable:",ee),ee}},K=async H=>{try{const q=await W.post("/api/users",H);return await _(),q.data}catch(q){throw console.error("Error creating user:",q),q}},se=async(H,q)=>{try{const ee=await W.put(`/api/users/${H}`,q);return await _(),ee.data}catch(ee){throw console.error("Error updating user:",ee),ee}},ve=async H=>{try{const q=await W.delete(`/api/users/${H}`);return await _(),q.data}catch(q){throw console.error("Error deleting user:",q),q}},yt=async H=>{try{const q=await W.post("/api/users/bulk",{count:H});return await _(),q.data}catch(q){throw console.error("Error creating bulk users:",q),q}},Pe=async()=>{try{const H=await W.delete("/api/users");return await _(),H.data}catch(H){throw console.error("Error deleting all users:",H),H}},Le=H=>{h(H),H?localStorage.setItem("frigg_current_user",JSON.stringify(H)):localStorage.removeItem("frigg_current_user"),n("user:context-switched",{user:H})},us=async(H,q={})=>{try{return(await W.post("/api/users/sessions/create",{userId:H,metadata:q})).data.session}catch(ee){throw console.error("Error creating session:",ee),ee}},Je=async H=>{try{return(await W.get(`/api/users/sessions/${H}`)).data.session}catch(q){throw console.error("Error fetching session:",q),q}},ds=async H=>{try{return(await W.get(`/api/users/sessions/user/${H}`)).data.sessions}catch(q){throw console.error("Error fetching user sessions:",q),q}},So=async(H,q,ee={})=>{try{return(await W.post(`/api/users/sessions/${H}/activity`,{action:q,data:ee})).data.activity}catch(Ze){throw console.error("Error tracking session activity:",Ze),Ze}},Co=async H=>{try{return(await W.post(`/api/users/sessions/${H}/refresh`)).data.session}catch(q){throw console.error("Error refreshing session:",q),q}},fs=async H=>{try{return(await W.delete(`/api/users/sessions/${H}`)).data}catch(q){throw console.error("Error ending session:",q),q}},ko=async()=>{try{return(await W.get("/api/users/sessions")).data}catch(H){throw console.error("Error fetching all sessions:",H),H}};g.useEffect(()=>{const H=localStorage.getItem("frigg_current_user");if(H)try{h(JSON.parse(H))}catch(q){console.error("Error loading stored user context:",q)}},[]);const rc={status:s,environment:o,integrations:l,envVariables:u,users:f,connections:b,currentUser:v,repositories:m,currentRepository:y,isLoading:S,loading:k,error:N,startFrigg:O,stopFrigg:F,restartFrigg:$,getLogs:R,getMetrics:I,installIntegration:D,updateEnvVariable:z,createUser:K,updateUser:se,deleteUser:ve,bulkCreateUsers:yt,deleteAllUsers:Pe,switchUserContext:Le,createSession:us,getSession:Je,getUserSessions:ds,trackSessionActivity:So,refreshSession:Co,endSession:fs,getAllSessions:ko,fetchRepositories:P,switchRepository:M,refreshData:_};return r.jsx(tb.Provider,{value:rc,children:e})};/**
73
- * @license lucide-react v0.473.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const FE=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nb=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
78
- * @license lucide-react v0.473.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */var $E={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
83
- * @license lucide-react v0.473.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const UE=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:o,iconNode:a,...l},c)=>g.createElement("svg",{ref:c,...$E,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:nb("lucide",i),...l},[...a.map(([u,d])=>g.createElement(u,d)),...Array.isArray(o)?o:[o]]));/**
88
- * @license lucide-react v0.473.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const X=(e,t)=>{const n=g.forwardRef(({className:s,...i},o)=>g.createElement(UE,{ref:o,iconNode:t,className:nb(`lucide-${FE(e)}`,s),...i}));return n.displayName=`${e}`,n};/**
93
- * @license lucide-react v0.473.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const zE=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],VE=X("Activity",zE);/**
98
- * @license lucide-react v0.473.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const BE=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],sb=X("ArrowLeft",BE);/**
103
- * @license lucide-react v0.473.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const WE=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],HE=X("ChartColumn",WE);/**
108
- * @license lucide-react v0.473.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const qE=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],lm=X("Check",qE);/**
113
- * @license lucide-react v0.473.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const KE=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cm=X("ChevronDown",KE);/**
118
- * @license lucide-react v0.473.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const GE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vd=X("ChevronRight",GE);/**
123
- * @license lucide-react v0.473.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const YE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Zt=X("CircleAlert",YE);/**
128
- * @license lucide-react v0.473.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const XE=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],rl=X("CircleCheckBig",XE);/**
133
- * @license lucide-react v0.473.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const QE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],bd=X("CircleCheck",QE);/**
138
- * @license lucide-react v0.473.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const JE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],ZE=X("CircleUser",JE);/**
143
- * @license lucide-react v0.473.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const eT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],rb=X("CircleX",eT);/**
148
- * @license lucide-react v0.473.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const tT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ib=X("Circle",tT);/**
153
- * @license lucide-react v0.473.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const nT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Wi=X("Clock",nT);/**
158
- * @license lucide-react v0.473.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const sT=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],Hi=X("Code",sT);/**
163
- * @license lucide-react v0.473.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const rT=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Qp=X("Copy",rT);/**
168
- * @license lucide-react v0.473.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const iT=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],oT=X("Database",iT);/**
173
- * @license lucide-react v0.473.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const aT=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],lT=X("Download",aT);/**
178
- * @license lucide-react v0.473.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const cT=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ob=X("ExternalLink",cT);/**
183
- * @license lucide-react v0.473.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const uT=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Fc=X("FolderOpen",uT);/**
188
- * @license lucide-react v0.473.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const dT=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],fT=X("Folder",dT);/**
193
- * @license lucide-react v0.473.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const mT=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],wd=X("GitBranch",mT);/**
198
- * @license lucide-react v0.473.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const hT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],ab=X("Grid3x3",hT);/**
203
- * @license lucide-react v0.473.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const pT=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],gT=X("House",pT);/**
208
- * @license lucide-react v0.473.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const xT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],yT=X("Info",xT);/**
213
- * @license lucide-react v0.473.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const vT=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],bT=X("Key",vT);/**
218
- * @license lucide-react v0.473.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const wT=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],jd=X("Layers",wT);/**
223
- * @license lucide-react v0.473.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const jT=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],NT=X("Link2",jT);/**
228
- * @license lucide-react v0.473.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const ST=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],CT=X("Link",ST);/**
233
- * @license lucide-react v0.473.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const kT=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],lb=X("List",kT);/**
238
- * @license lucide-react v0.473.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const ET=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],cb=X("LoaderCircle",ET);/**
243
- * @license lucide-react v0.473.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const TT=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],AT=X("Menu",TT);/**
248
- * @license lucide-react v0.473.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const RT=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],PT=X("Monitor",RT);/**
253
- * @license lucide-react v0.473.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const MT=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Jp=X("Moon",MT);/**
258
- * @license lucide-react v0.473.0 - ISC
259
- *
260
- * This source code is licensed under the ISC license.
261
- * See the LICENSE file in the root directory of this source tree.
262
- */const _T=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],il=X("Package",_T);/**
263
- * @license lucide-react v0.473.0 - ISC
264
- *
265
- * This source code is licensed under the ISC license.
266
- * See the LICENSE file in the root directory of this source tree.
267
- */const IT=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ub=X("Play",IT);/**
268
- * @license lucide-react v0.473.0 - ISC
269
- *
270
- * This source code is licensed under the ISC license.
271
- * See the LICENSE file in the root directory of this source tree.
272
- */const OT=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],LT=X("Plug",OT);/**
273
- * @license lucide-react v0.473.0 - ISC
274
- *
275
- * This source code is licensed under the ISC license.
276
- * See the LICENSE file in the root directory of this source tree.
277
- */const DT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Zp=X("Plus",DT);/**
278
- * @license lucide-react v0.473.0 - ISC
279
- *
280
- * This source code is licensed under the ISC license.
281
- * See the LICENSE file in the root directory of this source tree.
282
- */const FT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ol=X("RefreshCw",FT);/**
283
- * @license lucide-react v0.473.0 - ISC
284
- *
285
- * This source code is licensed under the ISC license.
286
- * See the LICENSE file in the root directory of this source tree.
287
- */const $T=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],UT=X("Rocket",$T);/**
288
- * @license lucide-react v0.473.0 - ISC
289
- *
290
- * This source code is licensed under the ISC license.
291
- * See the LICENSE file in the root directory of this source tree.
292
- */const zT=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],VT=X("Save",zT);/**
293
- * @license lucide-react v0.473.0 - ISC
294
- *
295
- * This source code is licensed under the ISC license.
296
- * See the LICENSE file in the root directory of this source tree.
297
- */const BT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],qi=X("Search",BT);/**
298
- * @license lucide-react v0.473.0 - ISC
299
- *
300
- * This source code is licensed under the ISC license.
301
- * See the LICENSE file in the root directory of this source tree.
302
- */const WT=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],um=X("Settings",WT);/**
303
- * @license lucide-react v0.473.0 - ISC
304
- *
305
- * This source code is licensed under the ISC license.
306
- * See the LICENSE file in the root directory of this source tree.
307
- */const HT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],qT=X("Square",HT);/**
308
- * @license lucide-react v0.473.0 - ISC
309
- *
310
- * This source code is licensed under the ISC license.
311
- * See the LICENSE file in the root directory of this source tree.
312
- */const KT=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],eg=X("Sun",KT);/**
313
- * @license lucide-react v0.473.0 - ISC
314
- *
315
- * This source code is licensed under the ISC license.
316
- * See the LICENSE file in the root directory of this source tree.
317
- */const GT=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],YT=X("TestTube",GT);/**
318
- * @license lucide-react v0.473.0 - ISC
319
- *
320
- * This source code is licensed under the ISC license.
321
- * See the LICENSE file in the root directory of this source tree.
322
- */const XT=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Nd=X("User",XT);/**
323
- * @license lucide-react v0.473.0 - ISC
324
- *
325
- * This source code is licensed under the ISC license.
326
- * See the LICENSE file in the root directory of this source tree.
327
- */const QT=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],JT=X("Users",QT);/**
328
- * @license lucide-react v0.473.0 - ISC
329
- *
330
- * This source code is licensed under the ISC license.
331
- * See the LICENSE file in the root directory of this source tree.
332
- */const ZT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],eA=X("X",ZT);/**
333
- * @license lucide-react v0.473.0 - ISC
334
- *
335
- * This source code is licensed under the ISC license.
336
- * See the LICENSE file in the root directory of this source tree.
337
- */const tA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],db=X("Zap",tA);function fb(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=fb(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function mb(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=fb(e))&&(s&&(s+=" "),s+=t);return s}const tg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ng=mb,hb=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return ng(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=o==null?void 0:o[u];if(d===null)return null;const p=tg(d)||tg(f);return i[u][p]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:p,...b}=d;return Object.entries(b).every(j=>{let[v,h]=j;return Array.isArray(h)?h.includes({...o,...l}[v]):{...o,...l}[v]===h})?[...u,f,p]:u},[]);return ng(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)},dm="-",nA=e=>{const t=rA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{const l=a.split(dm);return l[0]===""&&l.length!==1&&l.shift(),pb(l,t)||sA(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&s[a]?[...c,...s[a]]:c}}},pb=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),i=s?pb(e.slice(1),s):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(dm);return(a=t.validators.find(({validator:l})=>l(o)))==null?void 0:a.classGroupId},sg=/^\[(.+)\]$/,sA=e=>{if(sg.test(e)){const t=sg.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},rA=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return oA(Object.entries(e.classGroups),n).forEach(([o,a])=>{Sd(a,s,o,t)}),s},Sd=(e,t,n,s)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:rg(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(iA(i)){Sd(i(s),t,n,s);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,a])=>{Sd(a,rg(t,o),n,s)})})},rg=(e,t)=>{let n=e;return t.split(dm).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},iA=e=>e.isThemeGetter,oA=(e,t)=>t?e.map(([n,s])=>{const i=s.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([a,l])=>[t+a,l])):o);return[n,i]}):e,aA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const i=(o,a)=>{n.set(o,a),t++,t>e&&(t=0,s=n,n=new Map)};return{get(o){let a=n.get(o);if(a!==void 0)return a;if((a=s.get(o))!==void 0)return i(o,a),a},set(o,a){n.has(o)?n.set(o,a):i(o,a)}}},gb="!",lA=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,i=t[0],o=t.length,a=l=>{const c=[];let u=0,d=0,f;for(let h=0;h<l.length;h++){let m=l[h];if(u===0){if(m===i&&(s||l.slice(h,h+o)===t)){c.push(l.slice(d,h)),d=h+o;continue}if(m==="/"){f=h;continue}}m==="["?u++:m==="]"&&u--}const p=c.length===0?l:l.substring(d),b=p.startsWith(gb),j=b?p.substring(1):p,v=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:b,baseClassName:j,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:a}):a},cA=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},uA=e=>({cache:aA(e.cacheSize),parseClassName:lA(e),...nA(e)}),dA=/\s+/,fA=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=t,o=[],a=e.trim().split(dA);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:b}=n(u);let j=!!b,v=s(j?p.substring(0,b):p);if(!v){if(!j){l=u+(l.length>0?" "+l:l);continue}if(v=s(p),!v){l=u+(l.length>0?" "+l:l);continue}j=!1}const h=cA(d).join(":"),m=f?h+gb:h,x=m+v;if(o.includes(x))continue;o.push(x);const y=i(v,j);for(let w=0;w<y.length;++w){const S=y[w];o.push(m+S)}l=u+(l.length>0?" "+l:l)}return l};function mA(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=xb(t))&&(s&&(s+=" "),s+=n);return s}const xb=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=xb(e[s]))&&(n&&(n+=" "),n+=t);return n};function hA(e,...t){let n,s,i,o=a;function a(c){const u=t.reduce((d,f)=>f(d),e());return n=uA(u),s=n.cache.get,i=n.cache.set,o=l,l(c)}function l(c){const u=s(c);if(u)return u;const d=fA(c,n);return i(c,d),d}return function(){return o(mA.apply(null,arguments))}}const le=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},yb=/^\[(?:([a-z-]+):)?(.+)\]$/i,pA=/^\d+\/\d+$/,gA=new Set(["px","full","screen"]),xA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,vA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,bA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cn=e=>pr(e)||gA.has(e)||pA.test(e),Rn=e=>Lr(e,"length",AA),pr=e=>!!e&&!Number.isNaN(Number(e)),$c=e=>Lr(e,"number",pr),Zr=e=>!!e&&Number.isInteger(Number(e)),jA=e=>e.endsWith("%")&&pr(e.slice(0,-1)),Z=e=>yb.test(e),Pn=e=>xA.test(e),NA=new Set(["length","size","percentage"]),SA=e=>Lr(e,NA,vb),CA=e=>Lr(e,"position",vb),kA=new Set(["image","url"]),EA=e=>Lr(e,kA,PA),TA=e=>Lr(e,"",RA),ei=()=>!0,Lr=(e,t,n)=>{const s=yb.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},AA=e=>yA.test(e)&&!vA.test(e),vb=()=>!1,RA=e=>bA.test(e),PA=e=>wA.test(e),MA=()=>{const e=le("colors"),t=le("spacing"),n=le("blur"),s=le("brightness"),i=le("borderColor"),o=le("borderRadius"),a=le("borderSpacing"),l=le("borderWidth"),c=le("contrast"),u=le("grayscale"),d=le("hueRotate"),f=le("invert"),p=le("gap"),b=le("gradientColorStops"),j=le("gradientColorStopPositions"),v=le("inset"),h=le("margin"),m=le("opacity"),x=le("padding"),y=le("saturate"),w=le("scale"),S=le("sepia"),C=le("skew"),k=le("space"),T=le("translate"),N=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",Z,t],P=()=>[Z,t],M=()=>["",cn,Rn],_=()=>["auto",pr,Z],O=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",Z],D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[pr,Z];return{cacheSize:500,separator:":",theme:{colors:[ei],spacing:[cn,Rn],blur:["none","",Pn,Z],brightness:z(),borderColor:[e],borderRadius:["none","","full",Pn,Z],borderSpacing:P(),borderWidth:M(),contrast:z(),grayscale:I(),hueRotate:z(),invert:I(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[jA,Rn],inset:A(),margin:A(),opacity:z(),padding:P(),saturate:z(),scale:z(),sepia:I(),skew:z(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",Z]}],container:["container"],columns:[{columns:[Pn]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],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"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...O(),Z]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zr,Z]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Z]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Zr,Z]}],"grid-cols":[{"grid-cols":[ei]}],"col-start-end":[{col:["auto",{span:["full",Zr,Z]},Z]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[ei]}],"row-start-end":[{row:["auto",{span:[Zr,Z]},Z]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Z]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Z]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Z,t]}],"min-w":[{"min-w":[Z,t,"min","max","fit"]}],"max-w":[{"max-w":[Z,t,"none","full","min","max","fit","prose",{screen:[Pn]},Pn]}],h:[{h:[Z,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Z,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Z,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Z,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Pn,Rn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$c]}],"font-family":[{font:[ei]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Z]}],"line-clamp":[{"line-clamp":["none",pr,$c]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",cn,Z]}],"list-image":[{"list-image":["none",Z]}],"list-style-type":[{list:["none","disc","decimal",Z]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",cn,Rn]}],"underline-offset":[{"underline-offset":["auto",cn,Z]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Z]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Z]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),CA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",SA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},EA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:F()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[cn,Z]}],"outline-w":[{outline:[cn,Rn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[cn,Rn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Pn,TA]}],"shadow-color":[{shadow:[ei]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Pn,Z]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[y]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Z]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",Z]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",Z]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Zr,Z]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Z]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Z]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Z]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[cn,Rn,$c]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},_A=hA(MA);function Y(...e){return _A(mb(e))}const IA=hb("inline-flex items-center border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0 rounded-sm",{variants:{variant:{default:"border-primary/20 bg-primary text-primary-foreground shadow-sm hover:bg-primary/80",secondary:"border-secondary/20 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-destructive/20 bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/80",outline:"text-foreground border-2"}},defaultVariants:{variant:"default"}});function OA({className:e,variant:t,...n}){return r.jsx("div",{className:Y(IA({variant:t}),e),...n})}const wn=({status:e,className:t,showIcon:n=!0,...s})=>{const o=(l=>{switch(l){case"running":return{icon:bd,text:"Running",variant:"default",className:"bg-green-500/10 text-green-700 hover:bg-green-500/20 border-green-200 dark:bg-green-500/20 dark:text-green-400 dark:border-green-800"};case"stopped":return{icon:rb,text:"Stopped",variant:"secondary",className:"bg-red-500/10 text-red-700 hover:bg-red-500/20 border-red-200 dark:bg-red-500/20 dark:text-red-400 dark:border-red-800"};case"starting":return{icon:cb,text:"Starting...",variant:"outline",className:"bg-yellow-500/10 text-yellow-700 hover:bg-yellow-500/20 border-yellow-300 dark:bg-yellow-500/20 dark:text-yellow-400 dark:border-yellow-800",iconClassName:"animate-spin"};case"error":return{icon:Zt,text:"Error",variant:"destructive",className:""};default:return{icon:ib,text:"Unknown",variant:"outline",className:""}}})(e),a=o.icon;return r.jsxs(OA,{variant:o.variant,className:Y("gap-1.5 px-3 py-1 font-medium industrial-transition sharp-badge",o.className,t),...s,children:[n&&r.jsx(a,{size:14,className:Y("",o.iconClassName)}),o.text]})},LA=({users:e,currentUser:t,onUserSwitch:n})=>{var c,u;const[s,i]=g.useState(!1),o=g.useRef(null);g.useEffect(()=>{const d=f=>{o.current&&!o.current.contains(f.target)&&i(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const a=d=>{n(d),i(!1)},l=()=>{n(null),i(!1)};return r.jsxs("div",{className:"relative",ref:o,children:[r.jsxs("button",{onClick:()=>i(!s),className:Y("flex items-center space-x-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",t?"bg-blue-100 text-blue-700 hover:bg-blue-200":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:[t?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"w-6 h-6 rounded-full bg-blue-600 text-white flex items-center justify-center text-xs",children:[(c=t.firstName)==null?void 0:c[0],(u=t.lastName)==null?void 0:u[0]]}),r.jsxs("span",{className:"max-w-[150px] truncate",children:[t.firstName," ",t.lastName]})]}):r.jsxs(r.Fragment,{children:[r.jsx(ZE,{size:20}),r.jsx("span",{children:"No User Context"})]}),r.jsx(cm,{size:16,className:Y("transition-transform",s&&"rotate-180")})]}),s&&r.jsxs("div",{className:"absolute right-0 mt-2 w-72 bg-white rounded-lg shadow-lg border border-gray-200 z-50",children:[r.jsxs("div",{className:"p-3 border-b border-gray-200",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Switch User Context"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Simulate integration behavior as different users"})]}),r.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-gray-500",children:"No users available. Create a test user first."}):r.jsxs(r.Fragment,{children:[t&&r.jsxs("button",{onClick:l,className:"w-full text-left px-4 py-3 hover:bg-gray-50 flex items-center space-x-3 border-b border-gray-100",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-300 flex items-center justify-center",children:r.jsx(Nd,{size:16,className:"text-gray-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Clear Context"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Use default system context"})]})]}),e.map(d=>{var f,p;return r.jsxs("button",{onClick:()=>a(d),className:Y("w-full text-left px-4 py-3 hover:bg-gray-50 flex items-center space-x-3",(t==null?void 0:t.id)===d.id&&"bg-blue-50"),children:[r.jsxs("div",{className:Y("w-8 h-8 rounded-full flex items-center justify-center text-xs font-medium",(t==null?void 0:t.id)===d.id?"bg-blue-600 text-white":"bg-gray-300 text-gray-700"),children:[(f=d.firstName)==null?void 0:f[0],(p=d.lastName)==null?void 0:p[0]]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[d.firstName," ",d.lastName]}),r.jsx("p",{className:"text-xs text-gray-500 truncate",children:d.email}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:"text-xs bg-gray-100 text-gray-600 px-2 py-0.5 rounded",children:d.role}),d.appOrgId&&r.jsxs("span",{className:"text-xs text-gray-500",children:["Org: ",d.appOrgId]})]})]}),(t==null?void 0:t.id)===d.id&&r.jsx("div",{className:"text-blue-600",children:r.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},d.id)})]})}),t&&r.jsx("div",{className:"p-3 bg-gray-50 border-t border-gray-200",children:r.jsxs("p",{className:"text-xs text-gray-600",children:[r.jsx("span",{className:"font-medium",children:"Current context:"})," ",t.appUserId||t.email]})})]})]})},DA=({currentRepo:e,onRepoChange:t})=>{const[n,s]=g.useState(!1),[i,o]=g.useState([]),[a,l]=g.useState(""),[c,u]=g.useState(!1),d=g.useRef(null);g.useEffect(()=>{f()},[]),g.useEffect(()=>{const h=m=>{d.current&&!d.current.contains(m.target)&&s(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const f=async()=>{var h;u(!0);try{const m=await W.get("/api/project/repositories");console.log("Repository API response:",m.data);const x=((h=m.data.data)==null?void 0:h.repositories)||m.data.repositories||[];console.log(`Setting ${x.length} repositories`),o(x)}catch(m){console.error("Failed to fetch repositories:",m)}finally{u(!1)}},p=async h=>{try{await W.post("/api/project/switch-repository",{repositoryPath:h.path}),t(h),s(!1),window.location.reload()}catch(m){console.error("Failed to switch repository:",m)}},b=async(h,m)=>{m.stopPropagation();try{if(!(await fetch("/api/open-in-ide",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:h})})).ok)throw new Error("Failed to open in IDE")}catch(x){console.error("Failed to open in IDE:",x)}},j=i.filter(h=>h.name.toLowerCase().includes(a.toLowerCase())||h.path.toLowerCase().includes(a.toLowerCase())),v=h=>({React:"text-blue-500",Vue:"text-green-500",Angular:"text-red-500",Svelte:"text-orange-500"})[h]||"text-gray-500";return r.jsxs("div",{className:"relative",ref:d,children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs("button",{onClick:()=>s(!n),className:Y("flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md","bg-background border border-border hover:bg-accent","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","transition-colors duration-150"),children:[r.jsx(fT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"max-w-[200px] truncate text-foreground",children:(e==null?void 0:e.name)||"Select Repository"}),r.jsx(cm,{className:Y("h-4 w-4 text-muted-foreground transition-transform duration-200",n&&"transform rotate-180")})]}),e&&r.jsx("button",{onClick:h=>b(e.path,h),title:"Open in IDE",className:Y("p-2 text-muted-foreground hover:text-foreground hover:bg-accent","rounded-md transition-colors duration-150","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"),children:r.jsx(Hi,{className:"h-4 w-4"})})]}),n&&r.jsxs("div",{className:Y("absolute z-50 mt-2 w-96 rounded-md shadow-lg","bg-popover border border-border","max-h-96 overflow-hidden flex flex-col"),children:[r.jsx("div",{className:"p-3 border-b border-border",children:r.jsxs("div",{className:"relative",children:[r.jsx(qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search repositories...",value:a,onChange:h=>l(h.target.value),className:"w-full pl-9 pr-3 py-2 text-sm border border-input bg-background rounded-md focus:outline-none focus:ring-2 focus:ring-ring text-foreground"})]})}),r.jsx("div",{className:"overflow-y-auto max-h-80",children:c?r.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"Loading repositories..."}):j.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"No repositories found"}):r.jsx("div",{className:"py-1",children:j.map(h=>r.jsxs("div",{className:Y("w-full px-4 py-3 text-left hover:bg-accent/50","flex items-start gap-3 group",(e==null?void 0:e.path)===h.path&&"bg-accent"),children:[r.jsxs("button",{onClick:()=>p(h),className:"flex items-start gap-3 flex-1 min-w-0 text-left",children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:(e==null?void 0:e.path)===h.path?r.jsx(lm,{className:"h-4 w-4 text-primary"}):r.jsx(wd,{className:"h-4 w-4 text-muted-foreground group-hover:text-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:h.name}),h.framework&&r.jsx("span",{className:Y("text-xs font-medium",v(h.framework)),children:h.framework}),h.hasBackend&&r.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:"Backend"})]}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:h.path}),h.version&&r.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["v",h.version]})]})]}),r.jsx("button",{onClick:m=>b(h.path,m),title:"Open in IDE",className:Y("flex-shrink-0 p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent","rounded transition-colors duration-150","opacity-0 group-hover:opacity-100"),children:r.jsx(Hi,{className:"h-3.5 w-3.5"})})]},h.path))})}),e&&r.jsx("div",{className:"p-3 bg-muted/50 border-t border-border",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current: ",r.jsx("span",{className:"font-medium text-foreground",children:e.name})]}),r.jsx("button",{onClick:h=>b(e.path,h),title:"Open current repo in IDE",className:Y("p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent","rounded transition-colors duration-150"),children:r.jsx(ob,{className:"h-3 w-3"})})]})})]})]})};function re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function ig(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ql(...e){return t=>{let n=!1;const s=e.map(i=>{const o=ig(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<s.length;i++){const o=s[i];typeof o=="function"?o():ig(e[i],null)}}}}function ct(...e){return g.useCallback(ql(...e),e)}function ho(e,t=[]){let n=[];function s(o,a){const l=g.createContext(a),c=n.length;n=[...n,a];const u=f=>{var m;const{scope:p,children:b,...j}=f,v=((m=p==null?void 0:p[e])==null?void 0:m[c])||l,h=g.useMemo(()=>j,Object.values(j));return r.jsx(v.Provider,{value:h,children:b})};u.displayName=o+"Provider";function d(f,p){var v;const b=((v=p==null?void 0:p[e])==null?void 0:v[c])||l,j=g.useContext(b);if(j)return j;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(a=>g.createContext(a));return function(l){const c=(l==null?void 0:l[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[s,FA(i,...t)]}function FA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var es=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},$A=rf[" useInsertionEffect ".trim().toString()]||es;function bb({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,o,a]=UA({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i;{const d=g.useRef(e!==void 0);g.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${s} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,s])}const u=g.useCallback(d=>{var f;if(l){const p=zA(d)?d(e):d;p!==e&&((f=a.current)==null||f.call(a,p))}else o(d)},[l,e,o,a]);return[c,u]}function UA({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),o=g.useRef(t);return $A(()=>{o.current=t},[t]),g.useEffect(()=>{var a;i.current!==n&&((a=o.current)==null||a.call(o,n),i.current=n)},[n,i]),[n,s,o]}function zA(e){return typeof e=="function"}function Ki(e){const t=BA(e),n=g.forwardRef((s,i)=>{const{children:o,...a}=s,l=g.Children.toArray(o),c=l.find(HA);if(c){const u=c.props.children,d=l.map(f=>f===c?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:f);return r.jsx(t,{...a,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,d):null})}return r.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var VA=Ki("Slot");function BA(e){const t=g.forwardRef((n,s)=>{const{children:i,...o}=n;if(g.isValidElement(i)){const a=KA(i),l=qA(o,i.props);return i.type!==g.Fragment&&(l.ref=s?ql(s,a):a),g.cloneElement(i,l)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WA=Symbol("radix.slottable");function HA(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WA}function qA(e,t){const n={...t};for(const s in t){const i=e[s],o=t[s];/^on[A-Z]/.test(s)?i&&o?n[s]=(...l)=>{const c=o(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...o}:s==="className"&&(n[s]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function KA(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var GA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xe=GA.reduce((e,t)=>{const n=Ki(`Primitive.${t}`),s=g.forwardRef((i,o)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function wb(e,t){e&&Ol.flushSync(()=>e.dispatchEvent(t))}function jb(e){const t=e+"CollectionProvider",[n,s]=ho(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:h,children:m}=v,x=We.useRef(null),y=We.useRef(new Map).current;return r.jsx(i,{scope:h,itemMap:y,collectionRef:x,children:m})};a.displayName=t;const l=e+"CollectionSlot",c=Ki(l),u=We.forwardRef((v,h)=>{const{scope:m,children:x}=v,y=o(l,m),w=ct(h,y.collectionRef);return r.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=Ki(d),b=We.forwardRef((v,h)=>{const{scope:m,children:x,...y}=v,w=We.useRef(null),S=ct(h,w),C=o(d,m);return We.useEffect(()=>(C.itemMap.set(w,{ref:w,...y}),()=>void C.itemMap.delete(w))),r.jsx(p,{[f]:"",ref:S,children:x})});b.displayName=d;function j(v){const h=o(e+"CollectionConsumer",v);return We.useCallback(()=>{const x=h.collectionRef.current;if(!x)return[];const y=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(h.itemMap.values()).sort((C,k)=>y.indexOf(C.ref.current)-y.indexOf(k.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:b},j,s]}var YA=g.createContext(void 0);function Nb(e){const t=g.useContext(YA);return e||t||"ltr"}function jn(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function XA(e,t=globalThis==null?void 0:globalThis.document){const n=jn(e);g.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var QA="DismissableLayer",Cd="dismissableLayer.update",JA="dismissableLayer.pointerDownOutside",ZA="dismissableLayer.focusOutside",og,Sb=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cb=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=e,u=g.useContext(Sb),[d,f]=g.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=g.useState({}),j=ct(t,k=>f(k)),v=Array.from(u.layers),[h]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),m=v.indexOf(h),x=d?v.indexOf(d):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,w=x>=m,S=nR(k=>{const T=k.target,N=[...u.branches].some(E=>E.contains(T));!w||N||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},p),C=sR(k=>{const T=k.target;[...u.branches].some(E=>E.contains(T))||(o==null||o(k),a==null||a(k),k.defaultPrevented||l==null||l())},p);return XA(k=>{x===u.layers.size-1&&(s==null||s(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},p),g.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(og=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ag(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=og)}},[d,p,n,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ag())},[d,u]),g.useEffect(()=>{const k=()=>b({});return document.addEventListener(Cd,k),()=>document.removeEventListener(Cd,k)},[]),r.jsx(Xe.div,{...c,ref:j,style:{pointerEvents:y?w?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,C.onFocusCapture),onBlurCapture:re(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,S.onPointerDownCapture)})});Cb.displayName=QA;var eR="DismissableLayerBranch",tR=g.forwardRef((e,t)=>{const n=g.useContext(Sb),s=g.useRef(null),i=ct(t,s);return g.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Xe.div,{...e,ref:i})});tR.displayName=eR;function nR(e,t=globalThis==null?void 0:globalThis.document){const n=jn(e),s=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const o=l=>{if(l.target&&!s.current){let c=function(){kb(JA,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);s.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function sR(e,t=globalThis==null?void 0:globalThis.document){const n=jn(e),s=g.useRef(!1);return g.useEffect(()=>{const i=o=>{o.target&&!s.current&&kb(ZA,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function ag(){const e=new CustomEvent(Cd);document.dispatchEvent(e)}function kb(e,t,n,{discrete:s}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?wb(i,o):i.dispatchEvent(o)}var Uc=0;function rR(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lg()),document.body.insertAdjacentElement("beforeend",e[1]??lg()),Uc++,()=>{Uc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Uc--}},[])}function lg(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var zc="focusScope.autoFocusOnMount",Vc="focusScope.autoFocusOnUnmount",cg={bubbles:!1,cancelable:!0},iR="FocusScope",Eb=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[l,c]=g.useState(null),u=jn(i),d=jn(o),f=g.useRef(null),p=ct(t,v=>c(v)),b=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(s){let v=function(y){if(b.paused||!l)return;const w=y.target;l.contains(w)?f.current=w:_n(f.current,{select:!0})},h=function(y){if(b.paused||!l)return;const w=y.relatedTarget;w!==null&&(l.contains(w)||_n(f.current,{select:!0}))},m=function(y){if(document.activeElement===document.body)for(const S of y)S.removedNodes.length>0&&_n(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",h);const x=new MutationObserver(m);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",h),x.disconnect()}}},[s,l,b.paused]),g.useEffect(()=>{if(l){dg.add(b);const v=document.activeElement;if(!l.contains(v)){const m=new CustomEvent(zc,cg);l.addEventListener(zc,u),l.dispatchEvent(m),m.defaultPrevented||(oR(dR(Tb(l)),{select:!0}),document.activeElement===v&&_n(l))}return()=>{l.removeEventListener(zc,u),setTimeout(()=>{const m=new CustomEvent(Vc,cg);l.addEventListener(Vc,d),l.dispatchEvent(m),m.defaultPrevented||_n(v??document.body,{select:!0}),l.removeEventListener(Vc,d),dg.remove(b)},0)}}},[l,u,d,b]);const j=g.useCallback(v=>{if(!n&&!s||b.paused)return;const h=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,m=document.activeElement;if(h&&m){const x=v.currentTarget,[y,w]=aR(x);y&&w?!v.shiftKey&&m===w?(v.preventDefault(),n&&_n(y,{select:!0})):v.shiftKey&&m===y&&(v.preventDefault(),n&&_n(w,{select:!0})):m===x&&v.preventDefault()}},[n,s,b.paused]);return r.jsx(Xe.div,{tabIndex:-1,...a,ref:p,onKeyDown:j})});Eb.displayName=iR;function oR(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(_n(s,{select:t}),document.activeElement!==n)return}function aR(e){const t=Tb(e),n=ug(t,e),s=ug(t.reverse(),e);return[n,s]}function Tb(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ug(e,t){for(const n of e)if(!lR(n,{upTo:t}))return n}function lR(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function cR(e){return e instanceof HTMLInputElement&&"select"in e}function _n(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&cR(e)&&t&&e.select()}}var dg=uR();function uR(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=fg(e,t),e.unshift(t)},remove(t){var n;e=fg(e,t),(n=e[0])==null||n.resume()}}}function fg(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function dR(e){return e.filter(t=>t.tagName!=="A")}var fR=rf[" useId ".trim().toString()]||(()=>{}),mR=0;function kd(e){const[t,n]=g.useState(fR());return es(()=>{n(s=>s??String(mR++))},[e]),t?`radix-${t}`:""}const hR=["top","right","bottom","left"],ts=Math.min,dt=Math.max,al=Math.round,qo=Math.floor,en=e=>({x:e,y:e}),pR={left:"right",right:"left",bottom:"top",top:"bottom"},gR={start:"end",end:"start"};function Ed(e,t,n){return dt(e,ts(t,n))}function Nn(e,t){return typeof e=="function"?e(t):e}function Sn(e){return e.split("-")[0]}function Dr(e){return e.split("-")[1]}function fm(e){return e==="x"?"y":"x"}function mm(e){return e==="y"?"height":"width"}function Xt(e){return["top","bottom"].includes(Sn(e))?"y":"x"}function hm(e){return fm(Xt(e))}function xR(e,t,n){n===void 0&&(n=!1);const s=Dr(e),i=hm(e),o=mm(i);let a=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=ll(a)),[a,ll(a)]}function yR(e){const t=ll(e);return[Td(e),t,Td(t)]}function Td(e){return e.replace(/start|end/g,t=>gR[t])}function vR(e,t,n){const s=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:s:t?s:i;case"left":case"right":return t?o:a;default:return[]}}function bR(e,t,n,s){const i=Dr(e);let o=vR(Sn(e),n==="start",s);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Td)))),o}function ll(e){return e.replace(/left|right|bottom|top/g,t=>pR[t])}function wR(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ab(e){return typeof e!="number"?wR(e):{top:e,right:e,bottom:e,left:e}}function cl(e){const{x:t,y:n,width:s,height:i}=e;return{width:s,height:i,top:n,left:t,right:t+s,bottom:n+i,x:t,y:n}}function mg(e,t,n){let{reference:s,floating:i}=e;const o=Xt(t),a=hm(t),l=mm(a),c=Sn(t),u=o==="y",d=s.x+s.width/2-i.width/2,f=s.y+s.height/2-i.height/2,p=s[l]/2-i[l]/2;let b;switch(c){case"top":b={x:d,y:s.y-i.height};break;case"bottom":b={x:d,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:f};break;case"left":b={x:s.x-i.width,y:f};break;default:b={x:s.x,y:s.y}}switch(Dr(t)){case"start":b[a]-=p*(n&&u?-1:1);break;case"end":b[a]+=p*(n&&u?-1:1);break}return b}const jR=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,l=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=mg(u,s,c),p=s,b={},j=0;for(let v=0;v<l.length;v++){const{name:h,fn:m}=l[v],{x,y,data:w,reset:S}=await m({x:d,y:f,initialPlacement:s,placement:p,strategy:i,middlewareData:b,rects:u,platform:a,elements:{reference:e,floating:t}});d=x??d,f=y??f,b={...b,[h]:{...b[h],...w}},S&&j<=50&&(j++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(u=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:d,y:f}=mg(u,p,c)),v=-1)}return{x:d,y:f,placement:p,strategy:i,middlewareData:b}};async function Gi(e,t){var n;t===void 0&&(t={});const{x:s,y:i,platform:o,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:b=0}=Nn(t,e),j=Ab(b),h=l[p?f==="floating"?"reference":"floating":f],m=cl(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(h)))==null||n?h:h.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=f==="floating"?{x:s,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),w=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},S=cl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:y,strategy:c}):x);return{top:(m.top-S.top+j.top)/w.y,bottom:(S.bottom-m.bottom+j.bottom)/w.y,left:(m.left-S.left+j.left)/w.x,right:(S.right-m.right+j.right)/w.x}}const NR=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:i,rects:o,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Nn(e,t)||{};if(u==null)return{};const f=Ab(d),p={x:n,y:s},b=hm(i),j=mm(b),v=await a.getDimensions(u),h=b==="y",m=h?"top":"left",x=h?"bottom":"right",y=h?"clientHeight":"clientWidth",w=o.reference[j]+o.reference[b]-p[b]-o.floating[j],S=p[b]-o.reference[b],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=C?C[y]:0;(!k||!await(a.isElement==null?void 0:a.isElement(C)))&&(k=l.floating[y]||o.floating[j]);const T=w/2-S/2,N=k/2-v[j]/2-1,E=ts(f[m],N),A=ts(f[x],N),P=E,M=k-v[j]-A,_=k/2-v[j]/2+T,O=Ed(P,_,M),F=!c.arrow&&Dr(i)!=null&&_!==O&&o.reference[j]/2-(_<P?E:A)-v[j]/2<0,$=F?_<P?_-P:_-M:0;return{[b]:p[b]+$,data:{[b]:O,centerOffset:_-O-$,...F&&{alignmentOffset:$}},reset:F}}}),SR=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:i,middlewareData:o,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:v=!0,...h}=Nn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const m=Sn(i),x=Xt(l),y=Sn(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=p||(y||!v?[ll(l)]:yR(l)),C=j!=="none";!p&&C&&S.push(...bR(l,v,j,w));const k=[l,...S],T=await Gi(t,h),N=[];let E=((s=o.flip)==null?void 0:s.overflows)||[];if(d&&N.push(T[m]),f){const _=xR(i,a,w);N.push(T[_[0]],T[_[1]])}if(E=[...E,{placement:i,overflows:N}],!N.every(_=>_<=0)){var A,P;const _=(((A=o.flip)==null?void 0:A.index)||0)+1,O=k[_];if(O&&(!(f==="alignment"?x!==Xt(O):!1)||E.every(R=>R.overflows[0]>0&&Xt(R.placement)===x)))return{data:{index:_,overflows:E},reset:{placement:O}};let F=(P=E.filter($=>$.overflows[0]<=0).sort(($,R)=>$.overflows[1]-R.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(b){case"bestFit":{var M;const $=(M=E.filter(R=>{if(C){const I=Xt(R.placement);return I===x||I==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(I=>I>0).reduce((I,D)=>I+D,0)]).sort((R,I)=>R[1]-I[1])[0])==null?void 0:M[0];$&&(F=$);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function hg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pg(e){return hR.some(t=>e[t]>=0)}const CR=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...i}=Nn(e,t);switch(s){case"referenceHidden":{const o=await Gi(t,{...i,elementContext:"reference"}),a=hg(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:pg(a)}}}case"escaped":{const o=await Gi(t,{...i,altBoundary:!0}),a=hg(o,n.floating);return{data:{escapedOffsets:a,escaped:pg(a)}}}default:return{}}}}};async function kR(e,t){const{placement:n,platform:s,elements:i}=e,o=await(s.isRTL==null?void 0:s.isRTL(i.floating)),a=Sn(n),l=Dr(n),c=Xt(n)==="y",u=["left","top"].includes(a)?-1:1,d=o&&c?-1:1,f=Nn(t,e);let{mainAxis:p,crossAxis:b,alignmentAxis:j}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof j=="number"&&(b=l==="end"?j*-1:j),c?{x:b*d,y:p*u}:{x:p*u,y:b*d}}const ER=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:o,placement:a,middlewareData:l}=t,c=await kR(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:a}}}}},TR=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:h=>{let{x:m,y:x}=h;return{x:m,y:x}}},...c}=Nn(e,t),u={x:n,y:s},d=await Gi(t,c),f=Xt(Sn(i)),p=fm(f);let b=u[p],j=u[f];if(o){const h=p==="y"?"top":"left",m=p==="y"?"bottom":"right",x=b+d[h],y=b-d[m];b=Ed(x,b,y)}if(a){const h=f==="y"?"top":"left",m=f==="y"?"bottom":"right",x=j+d[h],y=j-d[m];j=Ed(x,j,y)}const v=l.fn({...t,[p]:b,[f]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[p]:o,[f]:a}}}}}},AR=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:i,rects:o,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Nn(e,t),d={x:n,y:s},f=Xt(i),p=fm(f);let b=d[p],j=d[f];const v=Nn(l,t),h=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const y=p==="y"?"height":"width",w=o.reference[p]-o.floating[y]+h.mainAxis,S=o.reference[p]+o.reference[y]-h.mainAxis;b<w?b=w:b>S&&(b=S)}if(u){var m,x;const y=p==="y"?"width":"height",w=["top","left"].includes(Sn(i)),S=o.reference[f]-o.floating[y]+(w&&((m=a.offset)==null?void 0:m[f])||0)+(w?0:h.crossAxis),C=o.reference[f]+o.reference[y]+(w?0:((x=a.offset)==null?void 0:x[f])||0)-(w?h.crossAxis:0);j<S?j=S:j>C&&(j=C)}return{[p]:b,[f]:j}}}},RR=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:i,rects:o,platform:a,elements:l}=t,{apply:c=()=>{},...u}=Nn(e,t),d=await Gi(t,u),f=Sn(i),p=Dr(i),b=Xt(i)==="y",{width:j,height:v}=o.floating;let h,m;f==="top"||f==="bottom"?(h=f,m=p===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(m=f,h=p==="end"?"top":"bottom");const x=v-d.top-d.bottom,y=j-d.left-d.right,w=ts(v-d[h],x),S=ts(j-d[m],y),C=!t.middlewareData.shift;let k=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=y),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(k=x),C&&!p){const E=dt(d.left,0),A=dt(d.right,0),P=dt(d.top,0),M=dt(d.bottom,0);b?T=j-2*(E!==0||A!==0?E+A:dt(d.left,d.right)):k=v-2*(P!==0||M!==0?P+M:dt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:k});const N=await a.getDimensions(l.floating);return j!==N.width||v!==N.height?{reset:{rects:!0}}:{}}}};function Kl(){return typeof window<"u"}function Fr(e){return Rb(e)?(e.nodeName||"").toLowerCase():"#document"}function ht(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ln(e){var t;return(t=(Rb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Rb(e){return Kl()?e instanceof Node||e instanceof ht(e).Node:!1}function Vt(e){return Kl()?e instanceof Element||e instanceof ht(e).Element:!1}function on(e){return Kl()?e instanceof HTMLElement||e instanceof ht(e).HTMLElement:!1}function gg(e){return!Kl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ht(e).ShadowRoot}function po(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=Bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(i)}function PR(e){return["table","td","th"].includes(Fr(e))}function Gl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function pm(e){const t=gm(),n=Vt(e)?Bt(e):e;return["transform","translate","scale","rotate","perspective"].some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function MR(e){let t=ns(e);for(;on(t)&&!Cr(t);){if(pm(t))return t;if(Gl(t))return null;t=ns(t)}return null}function gm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Cr(e){return["html","body","#document"].includes(Fr(e))}function Bt(e){return ht(e).getComputedStyle(e)}function Yl(e){return Vt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ns(e){if(Fr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gg(e)&&e.host||ln(e);return gg(t)?t.host:t}function Pb(e){const t=ns(e);return Cr(t)?e.ownerDocument?e.ownerDocument.body:e.body:on(t)&&po(t)?t:Pb(t)}function Yi(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Pb(e),o=i===((s=e.ownerDocument)==null?void 0:s.body),a=ht(i);if(o){const l=Ad(a);return t.concat(a,a.visualViewport||[],po(i)?i:[],l&&n?Yi(l):[])}return t.concat(i,Yi(i,[],n))}function Ad(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mb(e){const t=Bt(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=on(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:s,l=al(n)!==o||al(s)!==a;return l&&(n=o,s=a),{width:n,height:s,$:l}}function xm(e){return Vt(e)?e:e.contextElement}function gr(e){const t=xm(e);if(!on(t))return en(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:o}=Mb(t);let a=(o?al(n.width):n.width)/s,l=(o?al(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const _R=en(0);function _b(e){const t=ht(e);return!gm()||!t.visualViewport?_R:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function IR(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ht(e)?!1:t}function Is(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=xm(e);let a=en(1);t&&(s?Vt(s)&&(a=gr(s)):a=gr(e));const l=IR(o,n,s)?_b(o):en(0);let c=(i.left+l.x)/a.x,u=(i.top+l.y)/a.y,d=i.width/a.x,f=i.height/a.y;if(o){const p=ht(o),b=s&&Vt(s)?ht(s):s;let j=p,v=Ad(j);for(;v&&s&&b!==j;){const h=gr(v),m=v.getBoundingClientRect(),x=Bt(v),y=m.left+(v.clientLeft+parseFloat(x.paddingLeft))*h.x,w=m.top+(v.clientTop+parseFloat(x.paddingTop))*h.y;c*=h.x,u*=h.y,d*=h.x,f*=h.y,c+=y,u+=w,j=ht(v),v=Ad(j)}}return cl({width:d,height:f,x:c,y:u})}function ym(e,t){const n=Yl(e).scrollLeft;return t?t.left+n:Is(ln(e)).left+n}function Ib(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-(n?0:ym(e,s)),o=s.top+t.scrollTop;return{x:i,y:o}}function OR(e){let{elements:t,rect:n,offsetParent:s,strategy:i}=e;const o=i==="fixed",a=ln(s),l=t?Gl(t.floating):!1;if(s===a||l&&o)return n;let c={scrollLeft:0,scrollTop:0},u=en(1);const d=en(0),f=on(s);if((f||!f&&!o)&&((Fr(s)!=="body"||po(a))&&(c=Yl(s)),on(s))){const b=Is(s);u=gr(s),d.x=b.x+s.clientLeft,d.y=b.y+s.clientTop}const p=a&&!f&&!o?Ib(a,c,!0):en(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function LR(e){return Array.from(e.getClientRects())}function DR(e){const t=ln(e),n=Yl(e),s=e.ownerDocument.body,i=dt(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=dt(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+ym(e);const l=-n.scrollTop;return Bt(s).direction==="rtl"&&(a+=dt(t.clientWidth,s.clientWidth)-i),{width:i,height:o,x:a,y:l}}function FR(e,t){const n=ht(e),s=ln(e),i=n.visualViewport;let o=s.clientWidth,a=s.clientHeight,l=0,c=0;if(i){o=i.width,a=i.height;const u=gm();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:o,height:a,x:l,y:c}}function $R(e,t){const n=Is(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,o=on(e)?gr(e):en(1),a=e.clientWidth*o.x,l=e.clientHeight*o.y,c=i*o.x,u=s*o.y;return{width:a,height:l,x:c,y:u}}function xg(e,t,n){let s;if(t==="viewport")s=FR(e,n);else if(t==="document")s=DR(ln(e));else if(Vt(t))s=$R(t,n);else{const i=_b(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return cl(s)}function Ob(e,t){const n=ns(e);return n===t||!Vt(n)||Cr(n)?!1:Bt(n).position==="fixed"||Ob(n,t)}function UR(e,t){const n=t.get(e);if(n)return n;let s=Yi(e,[],!1).filter(l=>Vt(l)&&Fr(l)!=="body"),i=null;const o=Bt(e).position==="fixed";let a=o?ns(e):e;for(;Vt(a)&&!Cr(a);){const l=Bt(a),c=pm(a);!c&&l.position==="fixed"&&(i=null),(o?!c&&!i:!c&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||po(a)&&!c&&Ob(e,a))?s=s.filter(d=>d!==a):i=l,a=ns(a)}return t.set(e,s),s}function zR(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const a=[...n==="clippingAncestors"?Gl(t)?[]:UR(t,this._c):[].concat(n),s],l=a[0],c=a.reduce((u,d)=>{const f=xg(t,d,i);return u.top=dt(f.top,u.top),u.right=ts(f.right,u.right),u.bottom=ts(f.bottom,u.bottom),u.left=dt(f.left,u.left),u},xg(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function VR(e){const{width:t,height:n}=Mb(e);return{width:t,height:n}}function BR(e,t,n){const s=on(t),i=ln(t),o=n==="fixed",a=Is(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=en(0);function u(){c.x=ym(i)}if(s||!s&&!o)if((Fr(t)!=="body"||po(i))&&(l=Yl(t)),s){const b=Is(t,!0,o,t);c.x=b.x+t.clientLeft,c.y=b.y+t.clientTop}else i&&u();o&&!s&&i&&u();const d=i&&!s&&!o?Ib(i,l):en(0),f=a.left+l.scrollLeft-c.x-d.x,p=a.top+l.scrollTop-c.y-d.y;return{x:f,y:p,width:a.width,height:a.height}}function Bc(e){return Bt(e).position==="static"}function yg(e,t){if(!on(e)||Bt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ln(e)===n&&(n=n.ownerDocument.body),n}function Lb(e,t){const n=ht(e);if(Gl(e))return n;if(!on(e)){let i=ns(e);for(;i&&!Cr(i);){if(Vt(i)&&!Bc(i))return i;i=ns(i)}return n}let s=yg(e,t);for(;s&&PR(s)&&Bc(s);)s=yg(s,t);return s&&Cr(s)&&Bc(s)&&!pm(s)?n:s||MR(e)||n}const WR=async function(e){const t=this.getOffsetParent||Lb,n=this.getDimensions,s=await n(e.floating);return{reference:BR(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function HR(e){return Bt(e).direction==="rtl"}const qR={convertOffsetParentRelativeRectToViewportRelativeRect:OR,getDocumentElement:ln,getClippingRect:zR,getOffsetParent:Lb,getElementRects:WR,getClientRects:LR,getDimensions:VR,getScale:gr,isElement:Vt,isRTL:HR};function Db(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KR(e,t){let n=null,s;const i=ln(e);function o(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:b}=u;if(l||t(),!p||!b)return;const j=qo(f),v=qo(i.clientWidth-(d+p)),h=qo(i.clientHeight-(f+b)),m=qo(d),y={rootMargin:-j+"px "+-v+"px "+-h+"px "+-m+"px",threshold:dt(0,ts(1,c))||1};let w=!0;function S(C){const k=C[0].intersectionRatio;if(k!==c){if(!w)return a();k?a(!1,k):s=setTimeout(()=>{a(!1,1e-7)},1e3)}k===1&&!Db(u,e.getBoundingClientRect())&&a(),w=!1}try{n=new IntersectionObserver(S,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return a(!0),o}function GR(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=xm(e),d=i||o?[...u?Yi(u):[],...Yi(t)]:[];d.forEach(m=>{i&&m.addEventListener("scroll",n,{passive:!0}),o&&m.addEventListener("resize",n)});const f=u&&l?KR(u,n):null;let p=-1,b=null;a&&(b=new ResizeObserver(m=>{let[x]=m;x&&x.target===u&&b&&(b.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=b)==null||y.observe(t)})),n()}),u&&!c&&b.observe(u),b.observe(t));let j,v=c?Is(e):null;c&&h();function h(){const m=Is(e);v&&!Db(v,m)&&n(),v=m,j=requestAnimationFrame(h)}return n(),()=>{var m;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(m=b)==null||m.disconnect(),b=null,c&&cancelAnimationFrame(j)}}const YR=ER,XR=TR,QR=SR,JR=RR,ZR=CR,vg=NR,eP=AR,tP=(e,t,n)=>{const s=new Map,i={platform:qR,...n},o={...i.platform,_c:s};return jR(e,t,{...i,platform:o})};var nP=typeof document<"u",sP=function(){},Na=nP?g.useLayoutEffect:sP;function ul(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!ul(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!ul(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Fb(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bg(e,t){const n=Fb(e);return Math.round(t*n)/n}function Wc(e){const t=g.useRef(e);return Na(()=>{t.current=e}),t}function rP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:o,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,b]=g.useState(s);ul(p,s)||b(s);const[j,v]=g.useState(null),[h,m]=g.useState(null),x=g.useCallback(R=>{R!==C.current&&(C.current=R,v(R))},[]),y=g.useCallback(R=>{R!==k.current&&(k.current=R,m(R))},[]),w=o||j,S=a||h,C=g.useRef(null),k=g.useRef(null),T=g.useRef(d),N=c!=null,E=Wc(c),A=Wc(i),P=Wc(u),M=g.useCallback(()=>{if(!C.current||!k.current)return;const R={placement:t,strategy:n,middleware:p};A.current&&(R.platform=A.current),tP(C.current,k.current,R).then(I=>{const D={...I,isPositioned:P.current!==!1};_.current&&!ul(T.current,D)&&(T.current=D,Ol.flushSync(()=>{f(D)}))})},[p,t,n,A,P]);Na(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const _=g.useRef(!1);Na(()=>(_.current=!0,()=>{_.current=!1}),[]),Na(()=>{if(w&&(C.current=w),S&&(k.current=S),w&&S){if(E.current)return E.current(w,S,M);M()}},[w,S,M,E,N]);const O=g.useMemo(()=>({reference:C,floating:k,setReference:x,setFloating:y}),[x,y]),F=g.useMemo(()=>({reference:w,floating:S}),[w,S]),$=g.useMemo(()=>{const R={position:n,left:0,top:0};if(!F.floating)return R;const I=bg(F.floating,d.x),D=bg(F.floating,d.y);return l?{...R,transform:"translate("+I+"px, "+D+"px)",...Fb(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:D}},[n,l,F.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:M,refs:O,elements:F,floatingStyles:$}),[d,M,O,F,$])}const iP=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:i}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?vg({element:s.current,padding:i}).fn(n):{}:s?vg({element:s,padding:i}).fn(n):{}}}},oP=(e,t)=>({...YR(e),options:[e,t]}),aP=(e,t)=>({...XR(e),options:[e,t]}),lP=(e,t)=>({...eP(e),options:[e,t]}),cP=(e,t)=>({...QR(e),options:[e,t]}),uP=(e,t)=>({...JR(e),options:[e,t]}),dP=(e,t)=>({...ZR(e),options:[e,t]}),fP=(e,t)=>({...iP(e),options:[e,t]});var mP="Arrow",$b=g.forwardRef((e,t)=>{const{children:n,width:s=10,height:i=5,...o}=e;return r.jsx(Xe.svg,{...o,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});$b.displayName=mP;var hP=$b;function pP(e){const[t,n]=g.useState(void 0);return es(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var vm="Popper",[Ub,zb]=ho(vm),[gP,Vb]=Ub(vm),Bb=e=>{const{__scopePopper:t,children:n}=e,[s,i]=g.useState(null);return r.jsx(gP,{scope:t,anchor:s,onAnchorChange:i,children:n})};Bb.displayName=vm;var Wb="PopperAnchor",Hb=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...i}=e,o=Vb(Wb,n),a=g.useRef(null),l=ct(t,a);return g.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||a.current)}),s?null:r.jsx(Xe.div,{...i,ref:l})});Hb.displayName=Wb;var bm="PopperContent",[xP,yP]=Ub(bm),qb=g.forwardRef((e,t)=>{var Le,us,Je,ds,So,Co;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:b="optimized",onPlaced:j,...v}=e,h=Vb(bm,n),[m,x]=g.useState(null),y=ct(t,fs=>x(fs)),[w,S]=g.useState(null),C=pP(w),k=(C==null?void 0:C.width)??0,T=(C==null?void 0:C.height)??0,N=s+(o!=="center"?"-"+o:""),E=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(u)?u:[u],P=A.length>0,M={padding:E,boundary:A.filter(bP),altBoundary:P},{refs:_,floatingStyles:O,placement:F,isPositioned:$,middlewareData:R}=rP({strategy:"fixed",placement:N,whileElementsMounted:(...fs)=>GR(...fs,{animationFrame:b==="always"}),elements:{reference:h.anchor},middleware:[oP({mainAxis:i+T,alignmentAxis:a}),c&&aP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?lP():void 0,...M}),c&&cP({...M}),uP({...M,apply:({elements:fs,rects:ko,availableWidth:rc,availableHeight:H})=>{const{width:q,height:ee}=ko.reference,Ze=fs.floating.style;Ze.setProperty("--radix-popper-available-width",`${rc}px`),Ze.setProperty("--radix-popper-available-height",`${H}px`),Ze.setProperty("--radix-popper-anchor-width",`${q}px`),Ze.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),w&&fP({element:w,padding:l}),wP({arrowWidth:k,arrowHeight:T}),p&&dP({strategy:"referenceHidden",...M})]}),[I,D]=Yb(F),z=jn(j);es(()=>{$&&(z==null||z())},[$,z]);const K=(Le=R.arrow)==null?void 0:Le.x,se=(us=R.arrow)==null?void 0:us.y,ve=((Je=R.arrow)==null?void 0:Je.centerOffset)!==0,[yt,Pe]=g.useState();return es(()=>{m&&Pe(window.getComputedStyle(m).zIndex)},[m]),r.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:$?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:yt,"--radix-popper-transform-origin":[(ds=R.transformOrigin)==null?void 0:ds.x,(So=R.transformOrigin)==null?void 0:So.y].join(" "),...((Co=R.hide)==null?void 0:Co.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(xP,{scope:n,placedSide:I,onArrowChange:S,arrowX:K,arrowY:se,shouldHideArrow:ve,children:r.jsx(Xe.div,{"data-side":I,"data-align":D,...v,ref:y,style:{...v.style,animation:$?void 0:"none"}})})})});qb.displayName=bm;var Kb="PopperArrow",vP={top:"bottom",right:"left",bottom:"top",left:"right"},Gb=g.forwardRef(function(t,n){const{__scopePopper:s,...i}=t,o=yP(Kb,s),a=vP[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(hP,{...i,ref:n,style:{...i.style,display:"block"}})})});Gb.displayName=Kb;function bP(e){return e!==null}var wP=e=>({name:"transformOrigin",options:e,fn(t){var h,m,x;const{placement:n,rects:s,middlewareData:i}=t,a=((h=i.arrow)==null?void 0:h.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=Yb(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(((m=i.arrow)==null?void 0:m.x)??0)+l/2,b=(((x=i.arrow)==null?void 0:x.y)??0)+c/2;let j="",v="";return u==="bottom"?(j=a?f:`${p}px`,v=`${-c}px`):u==="top"?(j=a?f:`${p}px`,v=`${s.floating.height+c}px`):u==="right"?(j=`${-c}px`,v=a?f:`${b}px`):u==="left"&&(j=`${s.floating.width+c}px`,v=a?f:`${b}px`),{data:{x:j,y:v}}}});function Yb(e){const[t,n="center"]=e.split("-");return[t,n]}var jP=Bb,NP=Hb,SP=qb,CP=Gb,kP="Portal",Xb=g.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[i,o]=g.useState(!1);es(()=>o(!0),[]);const a=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?dS.createPortal(r.jsx(Xe.div,{...s,ref:t}),a):null});Xb.displayName=kP;function EP(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}var go=e=>{const{present:t,children:n}=e,s=TP(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),o=ct(s.ref,AP(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:o}):null};go.displayName="Presence";function TP(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),o=g.useRef("none"),a=e?"mounted":"unmounted",[l,c]=EP(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=Ko(s.current);o.current=l==="mounted"?u:"none"},[l]),es(()=>{const u=s.current,d=i.current;if(d!==e){const p=o.current,b=Ko(u);e?c("MOUNT"):b==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&p!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),es(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=b=>{const v=Ko(s.current).includes(b.animationName);if(b.target===t&&v&&(c("ANIMATION_END"),!i.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},p=b=>{b.target===t&&(o.current=Ko(s.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(u=>{s.current=u?getComputedStyle(u):null,n(u)},[])}}function Ko(e){return(e==null?void 0:e.animationName)||"none"}function AP(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hc="rovingFocusGroup.onEntryFocus",RP={bubbles:!1,cancelable:!0},xo="RovingFocusGroup",[Rd,Qb,PP]=jb(xo),[MP,Jb]=ho(xo,[PP]),[_P,IP]=MP(xo),Zb=g.forwardRef((e,t)=>r.jsx(Rd.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Rd.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(OP,{...e,ref:t})})}));Zb.displayName=xo;var OP=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=g.useRef(null),b=ct(t,p),j=Nb(o),[v,h]=bb({prop:a,defaultProp:l??null,onChange:c,caller:xo}),[m,x]=g.useState(!1),y=jn(u),w=Qb(n),S=g.useRef(!1),[C,k]=g.useState(0);return g.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(Hc,y),()=>T.removeEventListener(Hc,y)},[y]),r.jsx(_P,{scope:n,orientation:s,dir:j,loop:i,currentTabStopId:v,onItemFocus:g.useCallback(T=>h(T),[h]),onItemShiftTab:g.useCallback(()=>x(!0),[]),onFocusableItemAdd:g.useCallback(()=>k(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>k(T=>T-1),[]),children:r.jsx(Xe.div,{tabIndex:m||C===0?-1:0,"data-orientation":s,...f,ref:b,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{S.current=!0}),onFocus:re(e.onFocus,T=>{const N=!S.current;if(T.target===T.currentTarget&&N&&!m){const E=new CustomEvent(Hc,RP);if(T.currentTarget.dispatchEvent(E),!E.defaultPrevented){const A=w().filter(F=>F.focusable),P=A.find(F=>F.active),M=A.find(F=>F.id===v),O=[P,M,...A].filter(Boolean).map(F=>F.ref.current);nw(O,d)}}S.current=!1}),onBlur:re(e.onBlur,()=>x(!1))})})}),ew="RovingFocusGroupItem",tw=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:o,children:a,...l}=e,c=kd(),u=o||c,d=IP(ew,n),f=d.currentTabStopId===u,p=Qb(n),{onFocusableItemAdd:b,onFocusableItemRemove:j,currentTabStopId:v}=d;return g.useEffect(()=>{if(s)return b(),()=>j()},[s,b,j]),r.jsx(Rd.ItemSlot,{scope:n,id:u,focusable:s,active:i,children:r.jsx(Xe.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:re(e.onMouseDown,h=>{s?d.onItemFocus(u):h.preventDefault()}),onFocus:re(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:re(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){d.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const m=FP(h,d.orientation,d.dir);if(m!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let y=p().filter(w=>w.focusable).map(w=>w.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();const w=y.indexOf(h.currentTarget);y=d.loop?$P(y,w+1):y.slice(w+1)}setTimeout(()=>nw(y))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:v!=null}):a})})});tw.displayName=ew;var LP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DP(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function FP(e,t,n){const s=DP(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return LP[s]}function nw(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function $P(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var UP=Zb,zP=tw,VP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zs=new WeakMap,Go=new WeakMap,Yo={},qc=0,sw=function(e){return e&&(e.host||sw(e.parentNode))},BP=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=sw(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},WP=function(e,t,n,s){var i=BP(t,Array.isArray(e)?e:[e]);Yo[n]||(Yo[n]=new WeakMap);var o=Yo[n],a=[],l=new Set,c=new Set(i),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(p){if(l.has(p))d(p);else try{var b=p.getAttribute(s),j=b!==null&&b!=="false",v=(zs.get(p)||0)+1,h=(o.get(p)||0)+1;zs.set(p,v),o.set(p,h),a.push(p),v===1&&j&&Go.set(p,!0),h===1&&p.setAttribute(n,"true"),j||p.setAttribute(s,"true")}catch(m){console.error("aria-hidden: cannot operate on ",p,m)}})};return d(t),l.clear(),qc++,function(){a.forEach(function(f){var p=zs.get(f)-1,b=o.get(f)-1;zs.set(f,p),o.set(f,b),p||(Go.has(f)||f.removeAttribute(s),Go.delete(f)),b||f.removeAttribute(n)}),qc--,qc||(zs=new WeakMap,zs=new WeakMap,Go=new WeakMap,Yo={})}},HP=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=VP(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),WP(s,i,n,"aria-hidden")):function(){return null}},Yt=function(){return Yt=Object.assign||function(t){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Yt.apply(this,arguments)};function rw(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function qP(e,t,n){if(n||arguments.length===2)for(var s=0,i=t.length,o;s<i;s++)(o||!(s in t))&&(o||(o=Array.prototype.slice.call(t,0,s)),o[s]=t[s]);return e.concat(o||Array.prototype.slice.call(t))}var Sa="right-scroll-bar-position",Ca="width-before-scroll-bar",KP="with-scroll-bars-hidden",GP="--removed-body-scroll-bar-size";function Kc(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function YP(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var XP=typeof window<"u"?g.useLayoutEffect:g.useEffect,wg=new WeakMap;function QP(e,t){var n=YP(null,function(s){return e.forEach(function(i){return Kc(i,s)})});return XP(function(){var s=wg.get(n);if(s){var i=new Set(s),o=new Set(e),a=n.current;i.forEach(function(l){o.has(l)||Kc(l,null)}),o.forEach(function(l){i.has(l)||Kc(l,a)})}wg.set(n,e)},[e]),n}function JP(e){return e}function ZP(e,t){t===void 0&&(t=JP);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,s);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(o){for(s=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){s=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(o),a=n}var c=function(){var d=a;a=[],d.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return i}function e4(e){e===void 0&&(e={});var t=ZP(null);return t.options=Yt({async:!0,ssr:!1},e),t}var iw=function(e){var t=e.sideCar,n=rw(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return g.createElement(s,Yt({},n))};iw.isSideCarExport=!0;function t4(e,t){return e.useMedium(t),iw}var ow=e4(),Gc=function(){},Xl=g.forwardRef(function(e,t){var n=g.useRef(null),s=g.useState({onScrollCapture:Gc,onWheelCapture:Gc,onTouchMoveCapture:Gc}),i=s[0],o=s[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,b=e.noRelative,j=e.noIsolation,v=e.inert,h=e.allowPinchZoom,m=e.as,x=m===void 0?"div":m,y=e.gapMode,w=rw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,C=QP([n,t]),k=Yt(Yt({},w),i);return g.createElement(g.Fragment,null,d&&g.createElement(S,{sideCar:ow,removeScrollBar:u,shards:f,noRelative:b,noIsolation:j,inert:v,setCallbacks:o,allowPinchZoom:!!h,lockRef:n,gapMode:y}),a?g.cloneElement(g.Children.only(l),Yt(Yt({},k),{ref:C})):g.createElement(x,Yt({},k,{className:c,ref:C}),l))});Xl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xl.classNames={fullWidth:Ca,zeroRight:Sa};var n4=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function s4(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=n4();return t&&e.setAttribute("nonce",t),e}function r4(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function i4(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var o4=function(){var e=0,t=null;return{add:function(n){e==0&&(t=s4())&&(r4(t,n),i4(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},a4=function(){var e=o4();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},aw=function(){var e=a4(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},l4={left:0,top:0,right:0,gap:0},Yc=function(e){return parseInt(e||"",10)||0},c4=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Yc(n),Yc(s),Yc(i)]},u4=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return l4;var t=c4(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},d4=aw(),xr="data-scroll-locked",f4=function(e,t,n,s){var i=e.left,o=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
338
- .`.concat(KP,` {
339
- overflow: hidden `).concat(s,`;
340
- padding-right: `).concat(l,"px ").concat(s,`;
341
- }
342
- body[`).concat(xr,`] {
343
- overflow: hidden `).concat(s,`;
344
- overscroll-behavior: contain;
345
- `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
346
- padding-left: `.concat(i,`px;
347
- padding-top: `).concat(o,`px;
348
- padding-right: `).concat(a,`px;
349
- margin-left:0;
350
- margin-top:0;
351
- margin-right: `).concat(l,"px ").concat(s,`;
352
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),`
353
- }
354
-
355
- .`).concat(Sa,` {
356
- right: `).concat(l,"px ").concat(s,`;
357
- }
358
-
359
- .`).concat(Ca,` {
360
- margin-right: `).concat(l,"px ").concat(s,`;
361
- }
362
-
363
- .`).concat(Sa," .").concat(Sa,` {
364
- right: 0 `).concat(s,`;
365
- }
366
-
367
- .`).concat(Ca," .").concat(Ca,` {
368
- margin-right: 0 `).concat(s,`;
369
- }
370
-
371
- body[`).concat(xr,`] {
372
- `).concat(GP,": ").concat(l,`px;
373
- }
374
- `)},jg=function(){var e=parseInt(document.body.getAttribute(xr)||"0",10);return isFinite(e)?e:0},m4=function(){g.useEffect(function(){return document.body.setAttribute(xr,(jg()+1).toString()),function(){var e=jg()-1;e<=0?document.body.removeAttribute(xr):document.body.setAttribute(xr,e.toString())}},[])},h4=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;m4();var o=g.useMemo(function(){return u4(i)},[i]);return g.createElement(d4,{styles:f4(o,!t,i,n?"":"!important")})},Pd=!1;if(typeof window<"u")try{var Xo=Object.defineProperty({},"passive",{get:function(){return Pd=!0,!0}});window.addEventListener("test",Xo,Xo),window.removeEventListener("test",Xo,Xo)}catch{Pd=!1}var Vs=Pd?{passive:!1}:!1,p4=function(e){return e.tagName==="TEXTAREA"},lw=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!p4(e)&&n[t]==="visible")},g4=function(e){return lw(e,"overflowY")},x4=function(e){return lw(e,"overflowX")},Ng=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=cw(e,s);if(i){var o=uw(e,s),a=o[1],l=o[2];if(a>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},y4=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},v4=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},cw=function(e,t){return e==="v"?g4(t):x4(t)},uw=function(e,t){return e==="v"?y4(t):v4(t)},b4=function(e,t){return e==="h"&&t==="rtl"?-1:1},w4=function(e,t,n,s,i){var o=b4(e,window.getComputedStyle(t).direction),a=o*s,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,p=0;do{if(!l)break;var b=uw(e,l),j=b[0],v=b[1],h=b[2],m=v-h-o*j;(j||m)&&cw(e,l)&&(f+=m,p+=j);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(u=!0),u},Qo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Sg=function(e){return[e.deltaX,e.deltaY]},Cg=function(e){return e&&"current"in e?e.current:e},j4=function(e,t){return e[0]===t[0]&&e[1]===t[1]},N4=function(e){return`
375
- .block-interactivity-`.concat(e,` {pointer-events: none;}
376
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
377
- `)},S4=0,Bs=[];function C4(e){var t=g.useRef([]),n=g.useRef([0,0]),s=g.useRef(),i=g.useState(S4++)[0],o=g.useState(aw)[0],a=g.useRef(e);g.useEffect(function(){a.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=qP([e.lockRef.current],(e.shards||[]).map(Cg),!0).filter(Boolean);return v.forEach(function(h){return h.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(h){return h.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(v,h){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var m=Qo(v),x=n.current,y="deltaX"in v?v.deltaX:x[0]-m[0],w="deltaY"in v?v.deltaY:x[1]-m[1],S,C=v.target,k=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in v&&k==="h"&&C.type==="range")return!1;var T=Ng(k,C);if(!T)return!0;if(T?S=k:(S=k==="v"?"h":"v",T=Ng(k,C)),!T)return!1;if(!s.current&&"changedTouches"in v&&(y||w)&&(s.current=S),!S)return!0;var N=s.current||S;return w4(N,h,v,N==="h"?y:w)},[]),c=g.useCallback(function(v){var h=v;if(!(!Bs.length||Bs[Bs.length-1]!==o)){var m="deltaY"in h?Sg(h):Qo(h),x=t.current.filter(function(S){return S.name===h.type&&(S.target===h.target||h.target===S.shadowParent)&&j4(S.delta,m)})[0];if(x&&x.should){h.cancelable&&h.preventDefault();return}if(!x){var y=(a.current.shards||[]).map(Cg).filter(Boolean).filter(function(S){return S.contains(h.target)}),w=y.length>0?l(h,y[0]):!a.current.noIsolation;w&&h.cancelable&&h.preventDefault()}}},[]),u=g.useCallback(function(v,h,m,x){var y={name:v,delta:h,target:m,should:x,shadowParent:k4(m)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),d=g.useCallback(function(v){n.current=Qo(v),s.current=void 0},[]),f=g.useCallback(function(v){u(v.type,Sg(v),v.target,l(v,e.lockRef.current))},[]),p=g.useCallback(function(v){u(v.type,Qo(v),v.target,l(v,e.lockRef.current))},[]);g.useEffect(function(){return Bs.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Vs),document.addEventListener("touchmove",c,Vs),document.addEventListener("touchstart",d,Vs),function(){Bs=Bs.filter(function(v){return v!==o}),document.removeEventListener("wheel",c,Vs),document.removeEventListener("touchmove",c,Vs),document.removeEventListener("touchstart",d,Vs)}},[]);var b=e.removeScrollBar,j=e.inert;return g.createElement(g.Fragment,null,j?g.createElement(o,{styles:N4(i)}):null,b?g.createElement(h4,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function k4(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const E4=t4(ow,C4);var dw=g.forwardRef(function(e,t){return g.createElement(Xl,Yt({},e,{ref:t,sideCar:E4}))});dw.classNames=Xl.classNames;var Md=["Enter"," "],T4=["ArrowDown","PageUp","Home"],fw=["ArrowUp","PageDown","End"],A4=[...T4,...fw],R4={ltr:[...Md,"ArrowRight"],rtl:[...Md,"ArrowLeft"]},P4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yo="Menu",[Xi,M4,_4]=jb(yo),[Fs,mw]=ho(yo,[_4,zb,Jb]),Ql=zb(),hw=Jb(),[I4,$s]=Fs(yo),[O4,vo]=Fs(yo),pw=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:i,onOpenChange:o,modal:a=!0}=e,l=Ql(t),[c,u]=g.useState(null),d=g.useRef(!1),f=jn(o),p=Nb(i);return g.useEffect(()=>{const b=()=>{d.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>d.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),r.jsx(jP,{...l,children:r.jsx(I4,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:r.jsx(O4,{scope:t,onClose:g.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:a,children:s})})})};pw.displayName=yo;var L4="MenuAnchor",wm=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=Ql(n);return r.jsx(NP,{...i,...s,ref:t})});wm.displayName=L4;var jm="MenuPortal",[D4,gw]=Fs(jm,{forceMount:void 0}),xw=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:i}=e,o=$s(jm,t);return r.jsx(D4,{scope:t,forceMount:n,children:r.jsx(go,{present:n||o.open,children:r.jsx(Xb,{asChild:!0,container:i,children:s})})})};xw.displayName=jm;var Tt="MenuContent",[F4,Nm]=Fs(Tt),yw=g.forwardRef((e,t)=>{const n=gw(Tt,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=$s(Tt,e.__scopeMenu),a=vo(Tt,e.__scopeMenu);return r.jsx(Xi.Provider,{scope:e.__scopeMenu,children:r.jsx(go,{present:s||o.open,children:r.jsx(Xi.Slot,{scope:e.__scopeMenu,children:a.modal?r.jsx($4,{...i,ref:t}):r.jsx(U4,{...i,ref:t})})})})}),$4=g.forwardRef((e,t)=>{const n=$s(Tt,e.__scopeMenu),s=g.useRef(null),i=ct(t,s);return g.useEffect(()=>{const o=s.current;if(o)return HP(o)},[]),r.jsx(Sm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),U4=g.forwardRef((e,t)=>{const n=$s(Tt,e.__scopeMenu);return r.jsx(Sm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),z4=Ki("MenuContent.ScrollLock"),Sm=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:b,disableOutsideScroll:j,...v}=e,h=$s(Tt,n),m=vo(Tt,n),x=Ql(n),y=hw(n),w=M4(n),[S,C]=g.useState(null),k=g.useRef(null),T=ct(t,k,h.onContentChange),N=g.useRef(0),E=g.useRef(""),A=g.useRef(0),P=g.useRef(null),M=g.useRef("right"),_=g.useRef(0),O=j?dw:g.Fragment,F=j?{as:z4,allowPinchZoom:!0}:void 0,$=I=>{var Le,us;const D=E.current+I,z=w().filter(Je=>!Je.disabled),K=document.activeElement,se=(Le=z.find(Je=>Je.ref.current===K))==null?void 0:Le.textValue,ve=z.map(Je=>Je.textValue),yt=Z4(ve,D,se),Pe=(us=z.find(Je=>Je.textValue===yt))==null?void 0:us.ref.current;(function Je(ds){E.current=ds,window.clearTimeout(N.current),ds!==""&&(N.current=window.setTimeout(()=>Je(""),1e3))})(D),Pe&&setTimeout(()=>Pe.focus())};g.useEffect(()=>()=>window.clearTimeout(N.current),[]),rR();const R=g.useCallback(I=>{var z,K;return M.current===((z=P.current)==null?void 0:z.side)&&t3(I,(K=P.current)==null?void 0:K.area)},[]);return r.jsx(F4,{scope:n,searchRef:E,onItemEnter:g.useCallback(I=>{R(I)&&I.preventDefault()},[R]),onItemLeave:g.useCallback(I=>{var D;R(I)||((D=k.current)==null||D.focus(),C(null))},[R]),onTriggerLeave:g.useCallback(I=>{R(I)&&I.preventDefault()},[R]),pointerGraceTimerRef:A,onPointerGraceIntentChange:g.useCallback(I=>{P.current=I},[]),children:r.jsx(O,{...F,children:r.jsx(Eb,{asChild:!0,trapped:i,onMountAutoFocus:re(o,I=>{var D;I.preventDefault(),(D=k.current)==null||D.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:r.jsx(Cb,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:b,children:r.jsx(UP,{asChild:!0,...y,dir:m.dir,orientation:"vertical",loop:s,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:re(c,I=>{m.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(SP,{role:"menu","aria-orientation":"vertical","data-state":Iw(h.open),"data-radix-menu-content":"",dir:m.dir,...x,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:re(v.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,K=I.ctrlKey||I.altKey||I.metaKey,se=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!K&&se&&$(I.key));const ve=k.current;if(I.target!==ve||!A4.includes(I.key))return;I.preventDefault();const Pe=w().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);fw.includes(I.key)&&Pe.reverse(),Q4(Pe)}),onBlur:re(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(N.current),E.current="")}),onPointerMove:re(e.onPointerMove,Qi(I=>{const D=I.target,z=_.current!==I.clientX;if(I.currentTarget.contains(D)&&z){const K=I.clientX>_.current?"right":"left";M.current=K,_.current=I.clientX}}))})})})})})})});yw.displayName=Tt;var V4="MenuGroup",Cm=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Xe.div,{role:"group",...s,ref:t})});Cm.displayName=V4;var B4="MenuLabel",vw=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Xe.div,{...s,ref:t})});vw.displayName=B4;var dl="MenuItem",kg="menu.itemSelect",Jl=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...i}=e,o=g.useRef(null),a=vo(dl,e.__scopeMenu),l=Nm(dl,e.__scopeMenu),c=ct(t,o),u=g.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const p=new CustomEvent(kg,{bubbles:!0,cancelable:!0});f.addEventListener(kg,b=>s==null?void 0:s(b),{once:!0}),wb(f,p),p.defaultPrevented?u.current=!1:a.onClose()}};return r.jsx(bw,{...i,ref:c,disabled:n,onClick:re(e.onClick,d),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),u.current=!0},onPointerUp:re(e.onPointerUp,f=>{var p;u.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:re(e.onKeyDown,f=>{const p=l.searchRef.current!=="";n||p&&f.key===" "||Md.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Jl.displayName=dl;var bw=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:i,...o}=e,a=Nm(dl,n),l=hw(n),c=g.useRef(null),u=ct(t,c),[d,f]=g.useState(!1),[p,b]=g.useState("");return g.useEffect(()=>{const j=c.current;j&&b((j.textContent??"").trim())},[o.children]),r.jsx(Xi.ItemSlot,{scope:n,disabled:s,textValue:i??p,children:r.jsx(zP,{asChild:!0,...l,focusable:!s,children:r.jsx(Xe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:u,onPointerMove:re(e.onPointerMove,Qi(j=>{s?a.onItemLeave(j):(a.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,Qi(j=>a.onItemLeave(j))),onFocus:re(e.onFocus,()=>f(!0)),onBlur:re(e.onBlur,()=>f(!1))})})})}),W4="MenuCheckboxItem",ww=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...i}=e;return r.jsx(kw,{scope:e.__scopeMenu,checked:n,children:r.jsx(Jl,{role:"menuitemcheckbox","aria-checked":fl(n)?"mixed":n,...i,ref:t,"data-state":Em(n),onSelect:re(i.onSelect,()=>s==null?void 0:s(fl(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ww.displayName=W4;var jw="MenuRadioGroup",[H4,q4]=Fs(jw,{value:void 0,onValueChange:()=>{}}),Nw=g.forwardRef((e,t)=>{const{value:n,onValueChange:s,...i}=e,o=jn(s);return r.jsx(H4,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Cm,{...i,ref:t})})});Nw.displayName=jw;var Sw="MenuRadioItem",Cw=g.forwardRef((e,t)=>{const{value:n,...s}=e,i=q4(Sw,e.__scopeMenu),o=n===i.value;return r.jsx(kw,{scope:e.__scopeMenu,checked:o,children:r.jsx(Jl,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Em(o),onSelect:re(s.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});Cw.displayName=Sw;var km="MenuItemIndicator",[kw,K4]=Fs(km,{checked:!1}),Ew=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...i}=e,o=K4(km,n);return r.jsx(go,{present:s||fl(o.checked)||o.checked===!0,children:r.jsx(Xe.span,{...i,ref:t,"data-state":Em(o.checked)})})});Ew.displayName=km;var G4="MenuSeparator",Tw=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Xe.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Tw.displayName=G4;var Y4="MenuArrow",Aw=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=Ql(n);return r.jsx(CP,{...i,...s,ref:t})});Aw.displayName=Y4;var X4="MenuSub",[zL,Rw]=Fs(X4),ai="MenuSubTrigger",Pw=g.forwardRef((e,t)=>{const n=$s(ai,e.__scopeMenu),s=vo(ai,e.__scopeMenu),i=Rw(ai,e.__scopeMenu),o=Nm(ai,e.__scopeMenu),a=g.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=g.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return g.useEffect(()=>d,[d]),g.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),r.jsx(wm,{asChild:!0,...u,children:r.jsx(bw,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Iw(n.open),...e,ref:ql(t,i.onTriggerChange),onClick:f=>{var p;(p=e.onClick)==null||p.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,Qi(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:re(e.onPointerLeave,Qi(f=>{var b,j;d();const p=(b=n.content)==null?void 0:b.getBoundingClientRect();if(p){const v=(j=n.content)==null?void 0:j.dataset.side,h=v==="right",m=h?-5:5,x=p[h?"left":"right"],y=p[h?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+m,y:f.clientY},{x,y:p.top},{x:y,y:p.top},{x:y,y:p.bottom},{x,y:p.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,f=>{var b;const p=o.searchRef.current!=="";e.disabled||p&&f.key===" "||R4[s.dir].includes(f.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),f.preventDefault())})})})});Pw.displayName=ai;var Mw="MenuSubContent",_w=g.forwardRef((e,t)=>{const n=gw(Tt,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=$s(Tt,e.__scopeMenu),a=vo(Tt,e.__scopeMenu),l=Rw(Mw,e.__scopeMenu),c=g.useRef(null),u=ct(t,c);return r.jsx(Xi.Provider,{scope:e.__scopeMenu,children:r.jsx(go,{present:s||o.open,children:r.jsx(Xi.Slot,{scope:e.__scopeMenu,children:r.jsx(Sm,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;a.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:re(e.onFocusOutside,d=>{d.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:re(e.onKeyDown,d=>{var b;const f=d.currentTarget.contains(d.target),p=P4[a.dir].includes(d.key);f&&p&&(o.onOpenChange(!1),(b=l.trigger)==null||b.focus(),d.preventDefault())})})})})})});_w.displayName=Mw;function Iw(e){return e?"open":"closed"}function fl(e){return e==="indeterminate"}function Em(e){return fl(e)?"indeterminate":e?"checked":"unchecked"}function Q4(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function J4(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function Z4(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=J4(e,Math.max(o,0));i.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function e3(e,t){const{x:n,y:s}=e;let i=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const l=t[o],c=t[a],u=l.x,d=l.y,f=c.x,p=c.y;d>s!=p>s&&n<(f-u)*(s-d)/(p-d)+u&&(i=!i)}return i}function t3(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return e3(n,t)}function Qi(e){return t=>t.pointerType==="mouse"?e(t):void 0}var n3=pw,s3=wm,r3=xw,i3=yw,o3=Cm,a3=vw,l3=Jl,c3=ww,u3=Nw,d3=Cw,f3=Ew,m3=Tw,h3=Aw,p3=Pw,g3=_w,Zl="DropdownMenu",[x3,VL]=ho(Zl,[mw]),Qe=mw(),[y3,Ow]=x3(Zl),Lw=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:i,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,c=Qe(t),u=g.useRef(null),[d,f]=bb({prop:i,defaultProp:o??!1,onChange:a,caller:Zl});return r.jsx(y3,{scope:t,triggerId:kd(),triggerRef:u,contentId:kd(),open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(p=>!p),[f]),modal:l,children:r.jsx(n3,{...c,open:d,onOpenChange:f,dir:s,modal:l,children:n})})};Lw.displayName=Zl;var Dw="DropdownMenuTrigger",Fw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...i}=e,o=Ow(Dw,n),a=Qe(n);return r.jsx(s3,{asChild:!0,...a,children:r.jsx(Xe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...i,ref:ql(t,o.triggerRef),onPointerDown:re(e.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(o.onOpenToggle(),o.open||l.preventDefault())}),onKeyDown:re(e.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&o.onOpenToggle(),l.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Fw.displayName=Dw;var v3="DropdownMenuPortal",$w=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Qe(t);return r.jsx(r3,{...s,...n})};$w.displayName=v3;var Uw="DropdownMenuContent",zw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Ow(Uw,n),o=Qe(n),a=g.useRef(!1);return r.jsx(i3,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...s,ref:t,onCloseAutoFocus:re(e.onCloseAutoFocus,l=>{var c;a.current||(c=i.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:re(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});zw.displayName=Uw;var b3="DropdownMenuGroup",w3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(o3,{...i,...s,ref:t})});w3.displayName=b3;var j3="DropdownMenuLabel",Vw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(a3,{...i,...s,ref:t})});Vw.displayName=j3;var N3="DropdownMenuItem",Bw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(l3,{...i,...s,ref:t})});Bw.displayName=N3;var S3="DropdownMenuCheckboxItem",Ww=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(c3,{...i,...s,ref:t})});Ww.displayName=S3;var C3="DropdownMenuRadioGroup",k3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(u3,{...i,...s,ref:t})});k3.displayName=C3;var E3="DropdownMenuRadioItem",Hw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(d3,{...i,...s,ref:t})});Hw.displayName=E3;var T3="DropdownMenuItemIndicator",qw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(f3,{...i,...s,ref:t})});qw.displayName=T3;var A3="DropdownMenuSeparator",Kw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(m3,{...i,...s,ref:t})});Kw.displayName=A3;var R3="DropdownMenuArrow",P3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(h3,{...i,...s,ref:t})});P3.displayName=R3;var M3="DropdownMenuSubTrigger",Gw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(p3,{...i,...s,ref:t})});Gw.displayName=M3;var _3="DropdownMenuSubContent",Yw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(g3,{...i,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Yw.displayName=_3;var I3=Lw,O3=Fw,L3=$w,Xw=zw,Qw=Vw,Jw=Bw,Zw=Ww,ej=Hw,tj=qw,nj=Kw,sj=Gw,rj=Yw;const D3=I3,F3=O3,$3=g.forwardRef(({className:e,inset:t,children:n,...s},i)=>r.jsxs(sj,{ref:i,className:Y("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[n,r.jsx(vd,{className:"ml-auto"})]}));$3.displayName=sj.displayName;const U3=g.forwardRef(({className:e,...t},n)=>r.jsx(rj,{ref:n,className:Y("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));U3.displayName=rj.displayName;const ij=g.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(L3,{children:r.jsx(Xw,{ref:s,sideOffset:t,className:Y("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));ij.displayName=Xw.displayName;const ka=g.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(Jw,{ref:s,className:Y("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));ka.displayName=Jw.displayName;const z3=g.forwardRef(({className:e,children:t,checked:n,...s},i)=>r.jsxs(Zw,{ref:i,className:Y("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(tj,{children:r.jsx(lm,{className:"h-4 w-4"})})}),t]}));z3.displayName=Zw.displayName;const V3=g.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(ej,{ref:s,className:Y("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(tj,{children:r.jsx(ib,{className:"h-2 w-2 fill-current"})})}),t]}));V3.displayName=ej.displayName;const B3=g.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(Qw,{ref:s,className:Y("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));B3.displayName=Qw.displayName;const W3=g.forwardRef(({className:e,...t},n)=>r.jsx(nj,{ref:n,className:Y("-mx-1 my-1 h-px bg-muted",e),...t}));W3.displayName=nj.displayName;const oj=g.createContext({theme:"system",setTheme:()=>null});function H3({children:e,defaultTheme:t="system",storageKey:n="frigg-ui-theme",...s}){const[i,o]=g.useState(()=>localStorage.getItem(n)||t);g.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),i==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(i)},[i]);const a={theme:i,setTheme:l=>{localStorage.setItem(n,l),o(l)}};return r.jsx(oj.Provider,{...s,value:a,children:e})}const q3=()=>{const e=g.useContext(oj);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function K3(){const{theme:e,setTheme:t}=q3();return r.jsxs(D3,{children:[r.jsx(F3,{asChild:!0,children:r.jsxs("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10",children:[r.jsx(eg,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),r.jsx(Jp,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),r.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),r.jsxs(ij,{align:"end",children:[r.jsxs(ka,{onClick:()=>t("light"),children:[r.jsx(eg,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Light"})]}),r.jsxs(ka,{onClick:()=>t("dark"),children:[r.jsx(Jp,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Dark"})]}),r.jsxs(ka,{onClick:()=>t("system"),children:[r.jsx(PT,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"System"})]})]})]})}const G3="/assets/FriggLogo-B7Xx8ZW1.svg",aj=({children:e})=>{const t=Ds(),{status:n,environment:s,users:i,currentUser:o,switchUserContext:a}=Mt(),[l,c]=We.useState(!1),[u,d]=We.useState(null);We.useEffect(()=>{(async()=>{var j;try{const h=await(await fetch("/api/repository/current")).json();(j=h.data)!=null&&j.repository&&d(h.data.repository)}catch(v){console.error("Failed to fetch repository info:",v)}})()},[]);const f=[{name:"Dashboard",href:"/dashboard",icon:gT},{name:"Integrations",href:"/integrations",icon:LT},{name:"Code Generation",href:"/code-generation",icon:Hi},{name:"Environment",href:"/environment",icon:um},{name:"Users",href:"/users",icon:JT},{name:"Connections",href:"/connections",icon:CT},{name:"Simulation",href:"/simulation",icon:db},{name:"Monitoring",href:"/monitoring",icon:HE}],p=()=>c(!1);return r.jsxs("div",{className:"min-h-screen bg-background",children:[l&&r.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 backdrop-blur-sm lg:hidden",onClick:p}),r.jsx("header",{className:"fixed w-full top-0 z-30 bg-card/90 backdrop-blur-md border-b industrial-border industrial-shadow",children:r.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex justify-between items-center py-3",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("button",{onClick:()=>c(!0),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent/50 industrial-transition lg:hidden sharp-button",children:r.jsx(AT,{size:24})}),r.jsxs("div",{className:"flex items-center gap-3 ml-2 lg:ml-0",children:[r.jsx("img",{src:G3,alt:"Frigg",className:"h-8 w-auto"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Frigg"}),r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Management UI"})]})]}),r.jsx("div",{className:"ml-4",children:r.jsx(wn,{status:n})})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(DA,{currentRepo:u,onRepoChange:d}),r.jsx(LA,{users:i,currentUser:o,onUserSwitch:a}),r.jsxs("select",{className:"h-9 px-3 text-sm bg-background border industrial-border industrial-input focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:opacity-50 industrial-transition",value:s,disabled:!0,children:[r.jsx("option",{value:"local",children:"Local"}),r.jsx("option",{value:"staging",children:"Staging"}),r.jsx("option",{value:"production",children:"Production"})]}),r.jsx(K3,{})]})]})})}),r.jsxs("div",{className:"flex h-screen pt-14",children:[r.jsx("nav",{className:"hidden lg:block w-64 bg-card border-r industrial-border industrial-shadow-lg",children:r.jsxs("div",{className:"px-3 py-4",children:[r.jsx("div",{className:"h-1 w-full bg-gradient-to-r from-primary/20 via-primary to-primary/20 rounded-full mb-4"}),r.jsx("ul",{className:"space-y-1",children:f.map(b=>{const j=t.pathname===b.href,v=b.icon;return r.jsx("li",{children:r.jsxs(Rp,{to:b.href,className:Y("flex items-center px-3 py-2 text-sm font-medium industrial-transition group relative overflow-hidden sharp-button",j?"bg-primary text-primary-foreground shadow-md":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:[!j&&r.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-primary/10 to-transparent translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700"}),r.jsx(v,{size:18,className:"mr-3"}),b.name,j&&r.jsx(vd,{size:16,className:"ml-auto"})]})},b.name)})}),r.jsx("div",{className:"mt-8 pt-8 border-t industrial-border",children:r.jsxs("div",{className:"flex items-center justify-center text-muted-foreground",children:[r.jsx(jd,{size:16,className:"mr-2"}),r.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",children:"Powered by Frigg"})]})})]})}),r.jsx("nav",{className:Y("fixed inset-y-0 left-0 z-50 w-64 bg-card border-r industrial-border transform transition-transform duration-300 ease-in-out lg:hidden",l?"translate-x-0":"-translate-x-full"),children:r.jsxs("div",{className:"px-3 py-4 pt-20",children:[r.jsx("button",{onClick:p,className:"absolute top-4 right-4 p-2 text-muted-foreground hover:text-foreground hover:bg-accent industrial-transition sharp-button",children:r.jsx(eA,{size:24})}),r.jsx("div",{className:"h-1 w-full bg-gradient-to-r from-primary/20 via-primary to-primary/20 rounded-full mb-4"}),r.jsx("ul",{className:"space-y-1",children:f.map(b=>{const j=t.pathname===b.href,v=b.icon;return r.jsx("li",{children:r.jsxs(Rp,{to:b.href,onClick:p,className:Y("flex items-center px-3 py-2 text-sm font-medium industrial-transition group relative overflow-hidden sharp-button",j?"bg-primary text-primary-foreground shadow-md":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:[!j&&r.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-primary/10 to-transparent translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700"}),r.jsx(v,{size:18,className:"mr-3"}),b.name,j&&r.jsx(vd,{size:16,className:"ml-auto"})]})},b.name)})})]})}),r.jsx("main",{className:"flex-1 overflow-y-auto bg-background",children:r.jsxs("div",{className:"p-4 sm:p-6 lg:p-8",children:[r.jsx("div",{className:"fixed inset-0 pointer-events-none opacity-[0.02] dark:opacity-[0.04]",style:{backgroundImage:`linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px),
378
- linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px)`,backgroundSize:"20px 20px"}}),r.jsx("div",{className:"relative",children:e})]})})]})]})},Tm=g.createContext({});function Am(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const Rm=typeof window<"u",lj=Rm?g.useLayoutEffect:g.useEffect,ec=g.createContext(null);function Pm(e,t){e.indexOf(t)===-1&&e.push(t)}function Mm(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Cn=(e,t,n)=>n>t?t:n<e?e:n;let _m=()=>{};const kn={},cj=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function uj(e){return typeof e=="object"&&e!==null}const dj=e=>/^0[^.\s]+$/u.test(e);function Im(e){let t;return()=>(t===void 0&&(t=e()),t)}const At=e=>e,Y3=(e,t)=>n=>t(e(n)),bo=(...e)=>e.reduce(Y3),Ji=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class Om{constructor(){this.subscriptions=[]}add(t){return Pm(this.subscriptions,t),()=>Mm(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let o=0;o<i;o++){const a=this.subscriptions[o];a&&a(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const tn=e=>e*1e3,nn=e=>e/1e3;function fj(e,t){return t?e*(1e3/t):0}const mj=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,X3=1e-7,Q3=12;function J3(e,t,n,s,i){let o,a,l=0;do a=t+(n-t)/2,o=mj(a,s,i)-e,o>0?n=a:t=a;while(Math.abs(o)>X3&&++l<Q3);return a}function wo(e,t,n,s){if(e===t&&n===s)return At;const i=o=>J3(o,0,1,e,n);return o=>o===0||o===1?o:mj(i(o),t,s)}const hj=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,pj=e=>t=>1-e(1-t),gj=wo(.33,1.53,.69,.99),Lm=pj(gj),xj=hj(Lm),yj=e=>(e*=2)<1?.5*Lm(e):.5*(2-Math.pow(2,-10*(e-1))),Dm=e=>1-Math.sin(Math.acos(e)),vj=pj(Dm),bj=hj(Dm),Z3=wo(.42,0,1,1),eM=wo(0,0,.58,1),wj=wo(.42,0,.58,1),tM=e=>Array.isArray(e)&&typeof e[0]!="number",jj=e=>Array.isArray(e)&&typeof e[0]=="number",nM={linear:At,easeIn:Z3,easeInOut:wj,easeOut:eM,circIn:Dm,circInOut:bj,circOut:vj,backIn:Lm,backInOut:xj,backOut:gj,anticipate:yj},sM=e=>typeof e=="string",Eg=e=>{if(jj(e)){_m(e.length===4);const[t,n,s,i]=e;return wo(t,n,s,i)}else if(sM(e))return nM[e];return e},Jo=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],Tg={value:null};function rM(e,t){let n=new Set,s=new Set,i=!1,o=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function u(f){a.has(f)&&(d.schedule(f),e()),c++,f(l)}const d={schedule:(f,p=!1,b=!1)=>{const v=b&&i?n:s;return p&&a.add(f),v.has(f)||v.add(f),f},cancel:f=>{s.delete(f),a.delete(f)},process:f=>{if(l=f,i){o=!0;return}i=!0,[n,s]=[s,n],n.forEach(u),t&&Tg.value&&Tg.value.frameloop[t].push(c),c=0,n.clear(),i=!1,o&&(o=!1,d.process(f))}};return d}const iM=40;function Nj(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,a=Jo.reduce((y,w)=>(y[w]=rM(o,t?w:void 0),y),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:p,render:b,postRender:j}=a,v=()=>{const y=kn.useManualTiming?i.timestamp:performance.now();n=!1,kn.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,iM),1)),i.timestamp=y,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),p.process(i),b.process(i),j.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(v))},h=()=>{n=!0,s=!0,i.isProcessing||e(v)};return{schedule:Jo.reduce((y,w)=>{const S=a[w];return y[w]=(C,k=!1,T=!1)=>(n||h(),S.schedule(C,k,T)),y},{}),cancel:y=>{for(let w=0;w<Jo.length;w++)a[Jo[w]].cancel(y)},state:i,steps:a}}const{schedule:pe,cancel:ss,state:_e,steps:Xc}=Nj(typeof requestAnimationFrame<"u"?requestAnimationFrame:At,!0);let Ea;function oM(){Ea=void 0}const st={now:()=>(Ea===void 0&&st.set(_e.isProcessing||kn.useManualTiming?_e.timestamp:performance.now()),Ea),set:e=>{Ea=e,queueMicrotask(oM)}},Sj=e=>t=>typeof t=="string"&&t.startsWith(e),Fm=Sj("--"),aM=Sj("var(--"),$m=e=>aM(e)?lM.test(e.split("/*")[0].trim()):!1,lM=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,$r={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Zi={...$r,transform:e=>Cn(0,1,e)},Zo={...$r,default:1},vi=e=>Math.round(e*1e5)/1e5,Um=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function cM(e){return e==null}const uM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zm=(e,t)=>n=>!!(typeof n=="string"&&uM.test(n)&&n.startsWith(e)||t&&!cM(n)&&Object.prototype.hasOwnProperty.call(n,t)),Cj=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,o,a,l]=s.match(Um);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},dM=e=>Cn(0,255,e),Qc={...$r,transform:e=>Math.round(dM(e))},ws={test:zm("rgb","red"),parse:Cj("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Qc.transform(e)+", "+Qc.transform(t)+", "+Qc.transform(n)+", "+vi(Zi.transform(s))+")"};function fM(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const _d={test:zm("#"),parse:fM,transform:ws.transform},jo=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),In=jo("deg"),sn=jo("%"),Q=jo("px"),mM=jo("vh"),hM=jo("vw"),Ag={...sn,parse:e=>sn.parse(e)/100,transform:e=>sn.transform(e*100)},sr={test:zm("hsl","hue"),parse:Cj("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+sn.transform(vi(t))+", "+sn.transform(vi(n))+", "+vi(Zi.transform(s))+")"},Se={test:e=>ws.test(e)||_d.test(e)||sr.test(e),parse:e=>ws.test(e)?ws.parse(e):sr.test(e)?sr.parse(e):_d.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ws.transform(e):sr.transform(e),getAnimatableNone:e=>{const t=Se.parse(e);return t.alpha=0,Se.transform(t)}},pM=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function gM(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Um))==null?void 0:t.length)||0)+(((n=e.match(pM))==null?void 0:n.length)||0)>0}const kj="number",Ej="color",xM="var",yM="var(",Rg="${}",vM=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function eo(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let o=0;const l=t.replace(vM,c=>(Se.test(c)?(s.color.push(o),i.push(Ej),n.push(Se.parse(c))):c.startsWith(yM)?(s.var.push(o),i.push(xM),n.push(c)):(s.number.push(o),i.push(kj),n.push(parseFloat(c))),++o,Rg)).split(Rg);return{values:n,split:l,indexes:s,types:i}}function Tj(e){return eo(e).values}function Aj(e){const{split:t,types:n}=eo(e),s=t.length;return i=>{let o="";for(let a=0;a<s;a++)if(o+=t[a],i[a]!==void 0){const l=n[a];l===kj?o+=vi(i[a]):l===Ej?o+=Se.transform(i[a]):o+=i[a]}return o}}const bM=e=>typeof e=="number"?0:Se.test(e)?Se.getAnimatableNone(e):e;function wM(e){const t=Tj(e);return Aj(e)(t.map(bM))}const rs={test:gM,parse:Tj,createTransformer:Aj,getAnimatableNone:wM};function Jc(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function jM({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=Jc(c,l,e+1/3),o=Jc(c,l,e),a=Jc(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:s}}function ml(e,t){return n=>n>0?t:e}const me=(e,t,n)=>e+(t-e)*n,Zc=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},NM=[_d,ws,sr],SM=e=>NM.find(t=>t.test(e));function Pg(e){const t=SM(e);if(!t)return!1;let n=t.parse(e);return t===sr&&(n=jM(n)),n}const Mg=(e,t)=>{const n=Pg(e),s=Pg(t);if(!n||!s)return ml(e,t);const i={...n};return o=>(i.red=Zc(n.red,s.red,o),i.green=Zc(n.green,s.green,o),i.blue=Zc(n.blue,s.blue,o),i.alpha=me(n.alpha,s.alpha,o),ws.transform(i))},Id=new Set(["none","hidden"]);function CM(e,t){return Id.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function kM(e,t){return n=>me(e,t,n)}function Vm(e){return typeof e=="number"?kM:typeof e=="string"?$m(e)?ml:Se.test(e)?Mg:AM:Array.isArray(e)?Rj:typeof e=="object"?Se.test(e)?Mg:EM:ml}function Rj(e,t){const n=[...e],s=n.length,i=e.map((o,a)=>Vm(o)(o,t[a]));return o=>{for(let a=0;a<s;a++)n[a]=i[a](o);return n}}function EM(e,t){const n={...e,...t},s={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(s[i]=Vm(e[i])(e[i],t[i]));return i=>{for(const o in s)n[o]=s[o](i);return n}}function TM(e,t){const n=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],a=e.indexes[o][s[o]],l=e.values[a]??0;n[i]=l,s[o]++}return n}const AM=(e,t)=>{const n=rs.createTransformer(t),s=eo(e),i=eo(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?Id.has(e)&&!i.values.length||Id.has(t)&&!s.values.length?CM(e,t):bo(Rj(TM(s,i),i.values),n):ml(e,t)};function Pj(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?me(e,t,n):Vm(e)(e,t)}const RM=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>pe.update(t,n),stop:()=>ss(t),now:()=>_e.isProcessing?_e.timestamp:st.now()}},Mj=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let o=0;o<i;o++)s+=Math.round(e(o/(i-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},hl=2e4;function Bm(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<hl;)t+=n,s=e.next(t);return t>=hl?1/0:t}function PM(e,t=100,n){const s=n({...e,keyframes:[0,t]}),i=Math.min(Bm(s),hl);return{type:"keyframes",ease:o=>s.next(i*o).value/t,duration:nn(i)}}const MM=5;function _j(e,t,n){const s=Math.max(t-MM,0);return fj(n-e(s),t-s)}const xe={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},eu=.001;function _M({duration:e=xe.duration,bounce:t=xe.bounce,velocity:n=xe.velocity,mass:s=xe.mass}){let i,o,a=1-t;a=Cn(xe.minDamping,xe.maxDamping,a),e=Cn(xe.minDuration,xe.maxDuration,nn(e)),a<1?(i=u=>{const d=u*a,f=d*e,p=d-n,b=Od(u,a),j=Math.exp(-f);return eu-p/b*j},o=u=>{const f=u*a*e,p=f*n+n,b=Math.pow(a,2)*Math.pow(u,2)*e,j=Math.exp(-f),v=Od(Math.pow(u,2),a);return(-i(u)+eu>0?-1:1)*((p-b)*j)/v}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-eu+d*f},o=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=OM(i,o,l);if(e=tn(e),isNaN(c))return{stiffness:xe.stiffness,damping:xe.damping,duration:e};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:e}}}const IM=12;function OM(e,t,n){let s=n;for(let i=1;i<IM;i++)s=s-e(s)/t(s);return s}function Od(e,t){return e*Math.sqrt(1-t*t)}const LM=["duration","bounce"],DM=["stiffness","damping","mass"];function _g(e,t){return t.some(n=>e[n]!==void 0)}function FM(e){let t={velocity:xe.velocity,stiffness:xe.stiffness,damping:xe.damping,mass:xe.mass,isResolvedFromDuration:!1,...e};if(!_g(e,DM)&&_g(e,LM))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,o=2*Cn(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:xe.mass,stiffness:i,damping:o}}else{const n=_M(e);t={...t,...n,mass:xe.mass},t.isResolvedFromDuration=!0}return t}function pl(e=xe.visualDuration,t=xe.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const o=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:o},{stiffness:c,damping:u,mass:d,duration:f,velocity:p,isResolvedFromDuration:b}=FM({...n,velocity:-nn(n.velocity||0)}),j=p||0,v=u/(2*Math.sqrt(c*d)),h=a-o,m=nn(Math.sqrt(c/d)),x=Math.abs(h)<5;s||(s=x?xe.restSpeed.granular:xe.restSpeed.default),i||(i=x?xe.restDelta.granular:xe.restDelta.default);let y;if(v<1){const S=Od(m,v);y=C=>{const k=Math.exp(-v*m*C);return a-k*((j+v*m*h)/S*Math.sin(S*C)+h*Math.cos(S*C))}}else if(v===1)y=S=>a-Math.exp(-m*S)*(h+(j+m*h)*S);else{const S=m*Math.sqrt(v*v-1);y=C=>{const k=Math.exp(-v*m*C),T=Math.min(S*C,300);return a-k*((j+v*m*h)*Math.sinh(T)+S*h*Math.cosh(T))/S}}const w={calculatedDuration:b&&f||null,next:S=>{const C=y(S);if(b)l.done=S>=f;else{let k=S===0?j:0;v<1&&(k=S===0?tn(j):_j(y,S,C));const T=Math.abs(k)<=s,N=Math.abs(a-C)<=i;l.done=T&&N}return l.value=l.done?a:C,l},toString:()=>{const S=Math.min(Bm(w),hl),C=Mj(k=>w.next(S*k).value,S,30);return S+"ms "+C},toTransition:()=>{}};return w}pl.applyToOptions=e=>{const t=PM(e,100,pl);return e.ease=t.ease,e.duration=tn(t.duration),e.type="keyframes",e};function Ld({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],p={done:!1,value:f},b=T=>l!==void 0&&T<l||c!==void 0&&T>c,j=T=>l===void 0?c:c===void 0||Math.abs(l-T)<Math.abs(c-T)?l:c;let v=n*t;const h=f+v,m=a===void 0?h:a(h);m!==h&&(v=m-f);const x=T=>-v*Math.exp(-T/s),y=T=>m+x(T),w=T=>{const N=x(T),E=y(T);p.done=Math.abs(N)<=u,p.value=p.done?m:E};let S,C;const k=T=>{b(p.value)&&(S=T,C=pl({keyframes:[p.value,j(p.value)],velocity:_j(y,T,p.value),damping:i,stiffness:o,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let N=!1;return!C&&S===void 0&&(N=!0,w(T),k(T)),S!==void 0&&T>=S?C.next(T-S):(!N&&w(T),p)}}}function $M(e,t,n){const s=[],i=n||kn.mix||Pj,o=e.length-1;for(let a=0;a<o;a++){let l=i(e[a],e[a+1]);if(t){const c=Array.isArray(t)?t[a]||At:t;l=bo(c,l)}s.push(l)}return s}function UM(e,t,{clamp:n=!0,ease:s,mixer:i}={}){const o=e.length;if(_m(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=$M(t,s,i),c=l.length,u=d=>{if(a&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const p=Ji(e[f],e[f+1],d);return l[f](p)};return n?d=>u(Cn(e[0],e[o-1],d)):u}function zM(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=Ji(0,t,s);e.push(me(n,1,i))}}function VM(e){const t=[0];return zM(t,e.length-1),t}function BM(e,t){return e.map(n=>n*t)}function WM(e,t){return e.map(()=>t||wj).splice(0,e.length-1)}function bi({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=tM(s)?s.map(Eg):Eg(s),o={done:!1,value:t[0]},a=BM(n&&n.length===t.length?n:VM(t),e),l=UM(a,t,{ease:Array.isArray(i)?i:WM(t,i)});return{calculatedDuration:e,next:c=>(o.value=l(c),o.done=c>=e,o)}}const HM=e=>e!==null;function Wm(e,{repeat:t,repeatType:n="loop"},s,i=1){const o=e.filter(HM),l=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!l||s===void 0?o[l]:s}const qM={decay:Ld,inertia:Ld,tween:bi,keyframes:bi,spring:pl};function Ij(e){typeof e.type=="string"&&(e.type=qM[e.type])}class Hm{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const KM=e=>e/100;class qm extends Hm{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,i;const{motionValue:n}=this.options;n&&n.updatedAt!==st.now()&&this.tick(st.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(s=this.options).onStop)==null||i.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Ij(t);const{type:n=bi,repeat:s=0,repeatDelay:i=0,repeatType:o,velocity:a=0}=t;let{keyframes:l}=t;const c=n||bi;c!==bi&&typeof l[0]!="number"&&(this.mixKeyframes=bo(KM,Pj(l[0],l[1])),l=[0,100]);const u=c({...t,keyframes:l});o==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-a})),u.calculatedDuration===null&&(u.calculatedDuration=Bm(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:i,mixKeyframes:o,mirroredGenerator:a,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:p,repeatDelay:b,type:j,onUpdate:v,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const m=this.currentTime-u*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?m<0:m>i;this.currentTime=Math.max(m,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let y=this.currentTime,w=s;if(f){const T=Math.min(this.currentTime,i)/l;let N=Math.floor(T),E=T%1;!E&&T>=1&&(E=1),E===1&&N--,N=Math.min(N,f+1),!!(N%2)&&(p==="reverse"?(E=1-E,b&&(E-=b/l)):p==="mirror"&&(w=a)),y=Cn(0,1,E)*l}const S=x?{done:!1,value:d[0]}:w.next(y);o&&(S.value=o(S.value));let{done:C}=S;!x&&c!==null&&(C=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return k&&j!==Ld&&(S.value=Wm(d,this.options,h,this.speed)),v&&v(S.value),k&&this.finish(),S}then(t,n){return this.finished.then(t,n)}get duration(){return nn(this.calculatedDuration)}get time(){return nn(this.currentTime)}set time(t){var n;t=tn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(st.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=nn(this.currentTime))}play(){var i,o;if(this.isStopped)return;const{driver:t=RM,startTime:n}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),(o=(i=this.options).onPlay)==null||o.call(i);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(st.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function GM(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const js=e=>e*180/Math.PI,Dd=e=>{const t=js(Math.atan2(e[1],e[0]));return Fd(t)},YM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Dd,rotateZ:Dd,skewX:e=>js(Math.atan(e[1])),skewY:e=>js(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Fd=e=>(e=e%360,e<0&&(e+=360),e),Ig=Dd,Og=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Lg=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),XM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Og,scaleY:Lg,scale:e=>(Og(e)+Lg(e))/2,rotateX:e=>Fd(js(Math.atan2(e[6],e[5]))),rotateY:e=>Fd(js(Math.atan2(-e[2],e[0]))),rotateZ:Ig,rotate:Ig,skewX:e=>js(Math.atan(e[4])),skewY:e=>js(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function $d(e){return e.includes("scale")?1:0}function Ud(e,t){if(!e||e==="none")return $d(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=XM,i=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=YM,i=l}if(!i)return $d(t);const o=s[t],a=i[1].split(",").map(JM);return typeof o=="function"?o(a):a[o]}const QM=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Ud(n,t)};function JM(e){return parseFloat(e.trim())}const Ur=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],zr=new Set(Ur),Dg=e=>e===$r||e===Q,ZM=new Set(["x","y","z"]),e_=Ur.filter(e=>!ZM.has(e));function t_(e){const t=[];return e_.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const ks={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Ud(t,"x"),y:(e,{transform:t})=>Ud(t,"y")};ks.translateX=ks.x;ks.translateY=ks.y;const Es=new Set;let zd=!1,Vd=!1,Bd=!1;function Oj(){if(Vd){const e=Array.from(Es).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=t_(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([o,a])=>{var l;(l=s.getValue(o))==null||l.set(a)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Vd=!1,zd=!1,Es.forEach(e=>e.complete(Bd)),Es.clear()}function Lj(){Es.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Vd=!0)})}function n_(){Bd=!0,Lj(),Oj(),Bd=!1}class Km{constructor(t,n,s,i,o,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=o,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(Es.add(this),zd||(zd=!0,pe.read(Lj),pe.resolveKeyframes(Oj))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;if(t[0]===null){const o=i==null?void 0:i.get(),a=t[t.length-1];if(o!==void 0)t[0]=o;else if(s&&n){const l=s.readValue(n,a);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=a),i&&o===void 0&&i.set(t[0])}GM(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Es.delete(this)}cancel(){this.state==="scheduled"&&(Es.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const s_=e=>e.startsWith("--");function r_(e,t,n){s_(t)?e.style.setProperty(t,n):e.style[t]=n}const i_=Im(()=>window.ScrollTimeline!==void 0),o_={};function a_(e,t){const n=Im(e);return()=>o_[t]??n()}const Dj=a_(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),li=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,Fg={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:li([0,.65,.55,1]),circOut:li([.55,0,1,.45]),backIn:li([.31,.01,.66,-.59]),backOut:li([.33,1.53,.69,.99])};function Fj(e,t){if(e)return typeof e=="function"?Dj()?Mj(e,t):"ease-out":jj(e)?li(e):Array.isArray(e)?e.map(n=>Fj(n,t)||Fg.easeOut):Fg[e]}function l_(e,t,n,{delay:s=0,duration:i=300,repeat:o=0,repeatType:a="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const f=Fj(l,i);Array.isArray(f)&&(d.easing=f);const p={delay:s,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),e.animate(d,p)}function $j(e){return typeof e=="function"&&"applyToOptions"in e}function c_({type:e,...t}){return $j(e)&&Dj()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class u_ extends Hm{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:i,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!o,this.allowFlatten=a,this.options=t,_m(typeof t.type!="string");const u=c_(t);this.animation=l_(n,s,i,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=Wm(i,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):r_(n,s,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return nn(Number(t))}get time(){return nn(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=tn(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&i_()?(this.animation.timeline=t,At):n(this)}}const Uj={anticipate:yj,backInOut:xj,circInOut:bj};function d_(e){return e in Uj}function f_(e){typeof e.ease=="string"&&d_(e.ease)&&(e.ease=Uj[e.ease])}const $g=10;class m_ extends u_{constructor(t){f_(t),Ij(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:o,...a}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new qm({...a,autoplay:!1}),c=tn(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-$g).value,l.sample(c).value,$g),l.stop()}}const Ug=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rs.test(e)||e==="0")&&!e.startsWith("url("));function h_(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function p_(e,t,n,s){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],a=Ug(i,t),l=Ug(o,t);return!a||!l?!1:h_(e)||(n==="spring"||$j(n))&&s}function Gm(e){return uj(e)&&"offsetHeight"in e}const g_=new Set(["opacity","clipPath","filter","transform"]),x_=Im(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function y_(e){var u;const{motionValue:t,name:n,repeatDelay:s,repeatType:i,damping:o,type:a}=e;if(!Gm((u=t==null?void 0:t.owner)==null?void 0:u.current))return!1;const{onUpdate:l,transformTemplate:c}=t.owner.getProps();return x_()&&n&&g_.has(n)&&(n!=="transform"||!c)&&!l&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}const v_=40;class b_ extends Hm{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:a="loop",keyframes:l,name:c,motionValue:u,element:d,...f}){var j;super(),this.stop=()=>{var v,h;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(h=this.keyframeResolver)==null||h.cancel()},this.createdAt=st.now();const p={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:o,repeatType:a,name:c,motionValue:u,element:d,...f},b=(d==null?void 0:d.KeyframeResolver)||Km;this.keyframeResolver=new b(l,(v,h,m)=>this.onKeyframesResolved(v,h,p,!m),c,u,d),(j=this.keyframeResolver)==null||j.scheduleResolve()}onKeyframesResolved(t,n,s,i){this.keyframeResolver=void 0;const{name:o,type:a,velocity:l,delay:c,isHandoff:u,onUpdate:d}=s;this.resolvedAt=st.now(),p_(t,o,a,l)||((kn.instantAnimations||!c)&&(d==null||d(Wm(t,s,n))),t[0]=t[t.length-1],s.duration=0,s.repeat=0);const p={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>v_?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},b=!u&&y_(p)?new m_({...p,element:p.motionValue.owner.current}):new qm(p);b.finished.then(()=>this.notifyFinished()).catch(At),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),n_()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const w_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function j_(e){const t=w_.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function zj(e,t,n=1){const[s,i]=j_(e);if(!s)return;const o=window.getComputedStyle(t).getPropertyValue(s);if(o){const a=o.trim();return cj(a)?parseFloat(a):a}return $m(i)?zj(i,t,n+1):i}function Ym(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const Vj=new Set(["width","height","top","left","right","bottom",...Ur]),N_={test:e=>e==="auto",parse:e=>e},Bj=e=>t=>t.test(e),Wj=[$r,Q,sn,In,hM,mM,N_],zg=e=>Wj.find(Bj(e));function S_(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||dj(e):!0}const C_=new Set(["brightness","contrast","saturate","opacity"]);function k_(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Um)||[];if(!s)return e;const i=n.replace(s,"");let o=C_.has(t)?1:0;return s!==n&&(o*=100),t+"("+o+i+")"}const E_=/\b([a-z-]*)\(.*?\)/gu,Wd={...rs,getAnimatableNone:e=>{const t=e.match(E_);return t?t.map(k_).join(" "):e}},Vg={...$r,transform:Math.round},T_={rotate:In,rotateX:In,rotateY:In,rotateZ:In,scale:Zo,scaleX:Zo,scaleY:Zo,scaleZ:Zo,skew:In,skewX:In,skewY:In,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:Zi,originX:Ag,originY:Ag,originZ:Q},Xm={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,radius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,backgroundPositionX:Q,backgroundPositionY:Q,...T_,zIndex:Vg,fillOpacity:Zi,strokeOpacity:Zi,numOctaves:Vg},A_={...Xm,color:Se,backgroundColor:Se,outlineColor:Se,fill:Se,stroke:Se,borderColor:Se,borderTopColor:Se,borderRightColor:Se,borderBottomColor:Se,borderLeftColor:Se,filter:Wd,WebkitFilter:Wd},Hj=e=>A_[e];function qj(e,t){let n=Hj(e);return n!==Wd&&(n=rs),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const R_=new Set(["auto","none","0"]);function P_(e,t,n){let s=0,i;for(;s<e.length&&!i;){const o=e[s];typeof o=="string"&&!R_.has(o)&&eo(o).values.length&&(i=e[s]),s++}if(i&&n)for(const o of t)e[o]=qj(n,i)}class M_ extends Km{constructor(t,n,s,i,o){super(t,n,s,i,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),$m(u))){const d=zj(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Vj.has(s)||t.length!==2)return;const[i,o]=t,a=zg(i),l=zg(o);if(a!==l)if(Dg(a)&&Dg(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else ks[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let i=0;i<t.length;i++)(t[i]===null||S_(t[i]))&&s.push(i);s.length&&P_(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ks[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(s,i).jump(i,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=ks[n](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function __(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const i=(n==null?void 0:n[e])??s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const Kj=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Bg=30,I_=e=>!isNaN(parseFloat(e));class O_{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{var a,l;const o=st.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty();i&&((l=this.events.renderRequest)==null||l.notify(this.current))},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=st.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=I_(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Om);const s=this.events[t].add(n);return t==="change"?()=>{s(),pe.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=st.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Bg)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Bg);return fj(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function kr(e,t){return new O_(e,t)}const{schedule:Qm}=Nj(queueMicrotask,!1),It={x:!1,y:!1};function Gj(){return It.x||It.y}function L_(e){return e==="x"||e==="y"?It[e]?null:(It[e]=!0,()=>{It[e]=!1}):It.x||It.y?null:(It.x=It.y=!0,()=>{It.x=It.y=!1})}function Yj(e,t){const n=__(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function Wg(e){return!(e.pointerType==="touch"||Gj())}function D_(e,t,n={}){const[s,i,o]=Yj(e,n),a=l=>{if(!Wg(l))return;const{target:c}=l,u=t(c,l);if(typeof u!="function"||!c)return;const d=f=>{Wg(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,i)};return s.forEach(l=>{l.addEventListener("pointerenter",a,i)}),o}const Xj=(e,t)=>t?e===t?!0:Xj(e,t.parentElement):!1,Jm=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,F_=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function $_(e){return F_.has(e.tagName)||e.tabIndex!==-1}const Ta=new WeakSet;function Hg(e){return t=>{t.key==="Enter"&&e(t)}}function tu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const U_=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=Hg(()=>{if(Ta.has(n))return;tu(n,"down");const i=Hg(()=>{tu(n,"up")}),o=()=>tu(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function qg(e){return Jm(e)&&!Gj()}function z_(e,t,n={}){const[s,i,o]=Yj(e,n),a=l=>{const c=l.currentTarget;if(!qg(l))return;Ta.add(c);const u=t(c,l),d=(b,j)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",p),Ta.has(c)&&Ta.delete(c),qg(b)&&typeof u=="function"&&u(b,{success:j})},f=b=>{d(b,c===window||c===document||n.useGlobalTarget||Xj(c,b.target))},p=b=>{d(b,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",p,i)};return s.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),Gm(l)&&(l.addEventListener("focus",u=>U_(u,i)),!$_(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),o}function Qj(e){return uj(e)&&"ownerSVGElement"in e}function V_(e){return Qj(e)&&e.tagName==="svg"}const ze=e=>!!(e&&e.getVelocity),B_=[...Wj,Se,rs],W_=e=>B_.find(Bj(e)),Zm=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class H_ extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=n.offsetParent,i=Gm(s)&&s.offsetWidth||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left}return null}componentDidUpdate(){}render(){return this.props.children}}function q_({children:e,isPresent:t,anchorX:n,root:s}){const i=g.useId(),o=g.useRef(null),a=g.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=g.useContext(Zm);return g.useInsertionEffect(()=>{const{width:c,height:u,top:d,left:f,right:p}=a.current;if(t||!o.current||!c||!u)return;const b=n==="left"?`left: ${f}`:`right: ${p}`;o.current.dataset.motionPopId=i;const j=document.createElement("style");l&&(j.nonce=l);const v=s??document.head;return v.appendChild(j),j.sheet&&j.sheet.insertRule(`
379
- [data-motion-pop-id="${i}"] {
380
- position: absolute !important;
381
- width: ${c}px !important;
382
- height: ${u}px !important;
383
- ${b}px !important;
384
- top: ${d}px !important;
385
- }
386
- `),()=>{v.removeChild(j),v.contains(j)&&v.removeChild(j)}},[t]),r.jsx(H_,{isPresent:t,childRef:o,sizeRef:a,children:g.cloneElement(e,{ref:o})})}const K_=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:o,mode:a,anchorX:l,root:c})=>{const u=Am(G_),d=g.useId();let f=!0,p=g.useMemo(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:b=>{u.set(b,!0);for(const j of u.values())if(!j)return;s&&s()},register:b=>(u.set(b,!1),()=>u.delete(b))}),[n,u,s]);return o&&f&&(p={...p}),g.useMemo(()=>{u.forEach((b,j)=>u.set(j,!1))},[n]),g.useEffect(()=>{!n&&!u.size&&s&&s()},[n]),a==="popLayout"&&(e=r.jsx(q_,{isPresent:n,anchorX:l,root:c,children:e})),r.jsx(ec.Provider,{value:p,children:e})};function G_(){return new Map}function Jj(e=!0){const t=g.useContext(ec);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,o=g.useId();g.useEffect(()=>{if(e)return i(o)},[e]);const a=g.useCallback(()=>e&&s&&s(o),[o,s,e]);return!n&&s?[!1,a]:[!0]}const ea=e=>e.key||"";function Kg(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const Gg=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:o="sync",propagate:a=!1,anchorX:l="left",root:c})=>{const[u,d]=Jj(a),f=g.useMemo(()=>Kg(e),[e]),p=a&&!u?[]:f.map(ea),b=g.useRef(!0),j=g.useRef(f),v=Am(()=>new Map),[h,m]=g.useState(f),[x,y]=g.useState(f);lj(()=>{b.current=!1,j.current=f;for(let C=0;C<x.length;C++){const k=ea(x[C]);p.includes(k)?v.delete(k):v.get(k)!==!0&&v.set(k,!1)}},[x,p.length,p.join("-")]);const w=[];if(f!==h){let C=[...f];for(let k=0;k<x.length;k++){const T=x[k],N=ea(T);p.includes(N)||(C.splice(k,0,T),w.push(T))}return o==="wait"&&w.length&&(C=w),y(Kg(C)),m(f),null}const{forceRender:S}=g.useContext(Tm);return r.jsx(r.Fragment,{children:x.map(C=>{const k=ea(C),T=a&&!u?!1:f===x||p.includes(k),N=()=>{if(v.has(k))v.set(k,!0);else return;let E=!0;v.forEach(A=>{A||(E=!1)}),E&&(S==null||S(),y(j.current),a&&(d==null||d()),s&&s())};return r.jsx(K_,{isPresent:T,initial:!b.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:c,onExitComplete:T?void 0:N,anchorX:l,children:C},k)})})},Zj=g.createContext({strict:!1}),Yg={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Er={};for(const e in Yg)Er[e]={isEnabled:t=>Yg[e].some(n=>!!t[n])};function Y_(e){for(const t in e)Er[t]={...Er[t],...e[t]}}const X_=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function gl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||X_.has(e)}let e1=e=>!gl(e);function Q_(e){typeof e=="function"&&(e1=t=>t.startsWith("on")?!gl(t):e(t))}try{Q_(require("@emotion/is-prop-valid").default)}catch{}function J_(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(e1(i)||n===!0&&gl(i)||!t&&!gl(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function Z_(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const tc=g.createContext({});function nc(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function to(e){return typeof e=="string"||Array.isArray(e)}const eh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],th=["initial",...eh];function sc(e){return nc(e.animate)||th.some(t=>to(e[t]))}function t1(e){return!!(sc(e)||e.variants)}function eI(e,t){if(sc(e)){const{initial:n,animate:s}=e;return{initial:n===!1||to(n)?n:void 0,animate:to(s)?s:void 0}}return e.inherit!==!1?t:{}}function tI(e){const{initial:t,animate:n}=eI(e,g.useContext(tc));return g.useMemo(()=>({initial:t,animate:n}),[Xg(t),Xg(n)])}function Xg(e){return Array.isArray(e)?e.join(" "):e}const nI=Symbol.for("motionComponentSymbol");function rr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function sI(e,t,n){return g.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):rr(n)&&(n.current=s))},[t])}const nh=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),rI="framerAppearId",n1="data-"+nh(rI),s1=g.createContext({});function iI(e,t,n,s,i){var v,h;const{visualElement:o}=g.useContext(tc),a=g.useContext(Zj),l=g.useContext(ec),c=g.useContext(Zm).reducedMotion,u=g.useRef(null);s=s||a.renderer,!u.current&&s&&(u.current=s(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,f=g.useContext(s1);d&&!d.projection&&i&&(d.type==="html"||d.type==="svg")&&oI(u.current,n,i,f);const p=g.useRef(!1);g.useInsertionEffect(()=>{d&&p.current&&d.update(n,l)});const b=n[n1],j=g.useRef(!!b&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,b))&&((h=window.MotionHasOptimisedAnimation)==null?void 0:h.call(window,b)));return lj(()=>{d&&(p.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),Qm.render(d.render),j.current&&d.animationState&&d.animationState.animateChanges())}),g.useEffect(()=>{d&&(!j.current&&d.animationState&&d.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var m;(m=window.MotionHandoffMarkAsComplete)==null||m.call(window,b)}),j.current=!1))}),d}function oI(e,t,n,s){const{layoutId:i,layout:o,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:r1(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!a||l&&rr(l),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:s,crossfade:d,layoutScroll:c,layoutRoot:u})}function r1(e){if(e)return e.options.allowProjection!==!1?e.projection:r1(e.parent)}function aI({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){e&&Y_(e);function o(l,c){let u;const d={...g.useContext(Zm),...l,layoutId:lI(l)},{isStatic:f}=d,p=tI(l),b=s(l,f);if(!f&&Rm){cI();const j=uI(d);u=j.MeasureLayout,p.visualElement=iI(i,b,d,t,j.ProjectionNode)}return r.jsxs(tc.Provider,{value:p,children:[u&&p.visualElement?r.jsx(u,{visualElement:p.visualElement,...d}):null,n(i,l,sI(b,p.visualElement,c),b,f,p.visualElement)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const a=g.forwardRef(o);return a[nI]=i,a}function lI({layoutId:e}){const t=g.useContext(Tm).id;return t&&e!==void 0?t+"-"+e:e}function cI(e,t){g.useContext(Zj).strict}function uI(e){const{drag:t,layout:n}=Er;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const no={};function dI(e){for(const t in e)no[t]=e[t],Fm(t)&&(no[t].isCSSVariable=!0)}function i1(e,{layout:t,layoutId:n}){return zr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!no[e]||e==="opacity")}const fI={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},mI=Ur.length;function hI(e,t,n){let s="",i=!0;for(let o=0;o<mI;o++){const a=Ur[o],l=e[a];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(a.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=Kj(l,Xm[a]);if(!c){i=!1;const d=fI[a]||a;s+=`${d}(${u}) `}n&&(t[a]=u)}}return s=s.trim(),n?s=n(t,i?"":s):i&&(s="none"),s}function sh(e,t,n){const{style:s,vars:i,transformOrigin:o}=e;let a=!1,l=!1;for(const c in t){const u=t[c];if(zr.has(c)){a=!0;continue}else if(Fm(c)){i[c]=u;continue}else{const d=Kj(u,Xm[c]);c.startsWith("origin")?(l=!0,o[c]=d):s[c]=d}}if(t.transform||(a||n?s.transform=hI(t,e.transform,n):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=o;s.transformOrigin=`${c} ${u} ${d}`}}const rh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function o1(e,t,n){for(const s in t)!ze(t[s])&&!i1(s,n)&&(e[s]=t[s])}function pI({transformTemplate:e},t){return g.useMemo(()=>{const n=rh();return sh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function gI(e,t){const n=e.style||{},s={};return o1(s,n,e),Object.assign(s,pI(e,t)),s}function xI(e,t){const n={},s=gI(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const yI={offset:"stroke-dashoffset",array:"stroke-dasharray"},vI={offset:"strokeDashoffset",array:"strokeDasharray"};function bI(e,t,n=1,s=0,i=!0){e.pathLength=1;const o=i?yI:vI;e[o.offset]=Q.transform(-s);const a=Q.transform(t),l=Q.transform(n);e[o.array]=`${a} ${l}`}function a1(e,{attrX:t,attrY:n,attrScale:s,pathLength:i,pathSpacing:o=1,pathOffset:a=0,...l},c,u,d){if(sh(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:p}=e;f.transform&&(p.transform=f.transform,delete f.transform),(p.transform||f.transformOrigin)&&(p.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),p.transform&&(p.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),i!==void 0&&bI(f,i,o,a,!1)}const l1=()=>({...rh(),attrs:{}}),c1=e=>typeof e=="string"&&e.toLowerCase()==="svg";function wI(e,t,n,s){const i=g.useMemo(()=>{const o=l1();return a1(o,t,c1(s),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};o1(o,e.style,e),i.style={...o,...i.style}}return i}const jI=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ih(e){return typeof e!="string"||e.includes("-")?!1:!!(jI.indexOf(e)>-1||/[A-Z]/u.test(e))}function NI(e=!1){return(n,s,i,{latestValues:o},a)=>{const c=(ih(n)?wI:xI)(s,o,a,n),u=J_(s,typeof n=="string",e),d=n!==g.Fragment?{...u,...c,ref:i}:{},{children:f}=s,p=g.useMemo(()=>ze(f)?f.get():f,[f]);return g.createElement(n,{...d,children:p})}}function Qg(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function oh(e,t,n,s){if(typeof t=="function"){const[i,o]=Qg(s);t=t(n!==void 0?n:e.custom,i,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,o]=Qg(s);t=t(n!==void 0?n:e.custom,i,o)}return t}function Aa(e){return ze(e)?e.get():e}function SI({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,i){return{latestValues:CI(n,s,i,e),renderState:t()}}const u1=e=>(t,n)=>{const s=g.useContext(tc),i=g.useContext(ec),o=()=>SI(e,t,s,i);return n?o():Am(o)};function CI(e,t,n,s){const i={},o=s(e,{});for(const p in o)i[p]=Aa(o[p]);let{initial:a,animate:l}=e;const c=sc(e),u=t1(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!nc(f)){const p=Array.isArray(f)?f:[f];for(let b=0;b<p.length;b++){const j=oh(e,p[b]);if(j){const{transitionEnd:v,transition:h,...m}=j;for(const x in m){let y=m[x];if(Array.isArray(y)){const w=d?y.length-1:0;y=y[w]}y!==null&&(i[x]=y)}for(const x in v)i[x]=v[x]}}}return i}function ah(e,t,n){var o;const{style:s}=e,i={};for(const a in s)(ze(s[a])||t.style&&ze(t.style[a])||i1(a,e)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(i[a]=s[a]);return i}const kI={useVisualState:u1({scrapeMotionValuesFromProps:ah,createRenderState:rh})};function d1(e,t,n){const s=ah(e,t,n);for(const i in e)if(ze(e[i])||ze(t[i])){const o=Ur.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[o]=e[i]}return s}const EI={useVisualState:u1({scrapeMotionValuesFromProps:d1,createRenderState:l1})};function TI(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...ih(s)?EI:kI,preloadedFeatures:e,useRender:NI(i),createVisualElement:t,Component:s};return aI(a)}}function so(e,t,n){const s=e.getProps();return oh(s,t,n!==void 0?n:s.custom,e)}const Hd=e=>Array.isArray(e);function AI(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,kr(n))}function RI(e){return Hd(e)?e[e.length-1]||0:e}function PI(e,t){const n=so(e,t);let{transitionEnd:s={},transition:i={},...o}=n||{};o={...o,...s};for(const a in o){const l=RI(o[a]);AI(e,a,l)}}function MI(e){return!!(ze(e)&&e.add)}function qd(e,t){const n=e.getValue("willChange");if(MI(n))return n.add(t);if(!n&&kn.WillChange){const s=new kn.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function f1(e){return e.props[n1]}const _I=e=>e!==null;function II(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(_I),o=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[o]}const OI={type:"spring",stiffness:500,damping:25,restSpeed:10},LI=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),DI={type:"keyframes",duration:.8},FI={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$I=(e,{keyframes:t})=>t.length>2?DI:zr.has(e)?e.startsWith("scale")?LI(t[1]):OI:FI;function UI({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const lh=(e,t,n,s={},i,o)=>a=>{const l=Ym(s,e)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-tn(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:p=>{t.set(p),l.onUpdate&&l.onUpdate(p)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:o?void 0:i};UI(l)||Object.assign(d,$I(e,d)),d.duration&&(d.duration=tn(d.duration)),d.repeatDelay&&(d.repeatDelay=tn(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),(kn.instantAnimations||kn.skipAnimations)&&(f=!0,d.duration=0,d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!o&&t.get()!==void 0){const p=II(d.keyframes,l);if(p!==void 0){pe.update(()=>{d.onUpdate(p),d.onComplete()});return}}return l.isSync?new qm(d):new b_(d)};function zI({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function m1(e,t,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;s&&(o=s);const c=[],u=i&&e.animationState&&e.animationState.getState()[i];for(const d in l){const f=e.getValue(d,e.latestValues[d]??null),p=l[d];if(p===void 0||u&&zI(u,d))continue;const b={delay:n,...Ym(o||{},d)},j=f.get();if(j!==void 0&&!f.isAnimating&&!Array.isArray(p)&&p===j&&!b.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const m=f1(e);if(m){const x=window.MotionHandoffAnimation(m,d,pe);x!==null&&(b.startTime=x,v=!0)}}qd(e,d),f.start(lh(d,f,p,e.shouldReduceMotion&&Vj.has(d)?{type:!1}:b,e,v));const h=f.animation;h&&c.push(h)}return a&&Promise.all(c).then(()=>{pe.update(()=>{a&&PI(e,a)})}),c}function Kd(e,t,n={}){var c;const s=so(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(m1(e,s,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:p}=i;return VI(e,t,d+u,f,p,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,d]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>d())}else return Promise.all([o(),a(n.delay)])}function VI(e,t,n=0,s=0,i=1,o){const a=[],l=(e.variantChildren.size-1)*s,c=i===1?(u=0)=>u*s:(u=0)=>l-u*s;return Array.from(e.variantChildren).sort(BI).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(Kd(u,t,{...o,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function BI(e,t){return e.sortNodePosition(t)}function WI(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(o=>Kd(e,o,n));s=Promise.all(i)}else if(typeof t=="string")s=Kd(e,t,n);else{const i=typeof t=="function"?so(e,t,n.custom):t;s=Promise.all(m1(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function h1(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const HI=th.length;function p1(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?p1(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<HI;n++){const s=th[n],i=e.props[s];(to(i)||i===!1)&&(t[s]=i)}return t}const qI=[...eh].reverse(),KI=eh.length;function GI(e){return t=>Promise.all(t.map(({animation:n,options:s})=>WI(e,n,s)))}function YI(e){let t=GI(e),n=Jg(),s=!0;const i=c=>(u,d)=>{var p;const f=so(e,d,c==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(f){const{transition:b,transitionEnd:j,...v}=f;u={...u,...v,...j}}return u};function o(c){t=c(e)}function a(c){const{props:u}=e,d=p1(e.parent)||{},f=[],p=new Set;let b={},j=1/0;for(let h=0;h<KI;h++){const m=qI[h],x=n[m],y=u[m]!==void 0?u[m]:d[m],w=to(y),S=m===c?x.isActive:null;S===!1&&(j=h);let C=y===d[m]&&y!==u[m]&&w;if(C&&s&&e.manuallyAnimateOnMount&&(C=!1),x.protectedKeys={...b},!x.isActive&&S===null||!y&&!x.prevProp||nc(y)||typeof y=="boolean")continue;const k=XI(x.prevProp,y);let T=k||m===c&&x.isActive&&!C&&w||h>j&&w,N=!1;const E=Array.isArray(y)?y:[y];let A=E.reduce(i(m),{});S===!1&&(A={});const{prevResolvedValues:P={}}=x,M={...P,...A},_=$=>{T=!0,p.has($)&&(N=!0,p.delete($)),x.needsAnimating[$]=!0;const R=e.getValue($);R&&(R.liveStyle=!1)};for(const $ in M){const R=A[$],I=P[$];if(b.hasOwnProperty($))continue;let D=!1;Hd(R)&&Hd(I)?D=!h1(R,I):D=R!==I,D?R!=null?_($):p.add($):R!==void 0&&p.has($)?_($):x.protectedKeys[$]=!0}x.prevProp=y,x.prevResolvedValues=A,x.isActive&&(b={...b,...A}),s&&e.blockInitialAnimation&&(T=!1),T&&(!(C&&k)||N)&&f.push(...E.map($=>({animation:$,options:{type:m}})))}if(p.size){const h={};if(typeof u.initial!="boolean"){const m=so(e,Array.isArray(u.initial)?u.initial[0]:u.initial);m&&m.transition&&(h.transition=m.transition)}p.forEach(m=>{const x=e.getBaseTarget(m),y=e.getValue(m);y&&(y.liveStyle=!0),h[m]=x??null}),f.push({animation:h})}let v=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(v=!1),s=!1,v?t(f):Promise.resolve()}function l(c,u){var f;if(n[c].isActive===u)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(p=>{var b;return(b=p.animationState)==null?void 0:b.setActive(c,u)}),n[c].isActive=u;const d=a(c);for(const p in n)n[p].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Jg(),s=!0}}}function XI(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!h1(t,e):!1}function ms(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Jg(){return{animate:ms(!0),whileInView:ms(),whileHover:ms(),whileTap:ms(),whileDrag:ms(),whileFocus:ms(),exit:ms()}}class cs{constructor(t){this.isMounted=!1,this.node=t}update(){}}class QI extends cs{constructor(t){super(t),t.animationState||(t.animationState=YI(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();nc(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let JI=0;class ZI extends cs{constructor(){super(...arguments),this.id=JI++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const e5={animation:{Feature:QI},exit:{Feature:ZI}};function ro(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function No(e){return{point:{x:e.pageX,y:e.pageY}}}const t5=e=>t=>Jm(t)&&e(t,No(t));function wi(e,t,n,s){return ro(e,t,t5(n),s)}function g1({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function n5({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function s5(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}const x1=1e-4,r5=1-x1,i5=1+x1,y1=.01,o5=0-y1,a5=0+y1;function He(e){return e.max-e.min}function l5(e,t,n){return Math.abs(e-t)<=n}function Zg(e,t,n,s=.5){e.origin=s,e.originPoint=me(t.min,t.max,e.origin),e.scale=He(n)/He(t),e.translate=me(n.min,n.max,e.origin)-e.originPoint,(e.scale>=r5&&e.scale<=i5||isNaN(e.scale))&&(e.scale=1),(e.translate>=o5&&e.translate<=a5||isNaN(e.translate))&&(e.translate=0)}function ji(e,t,n,s){Zg(e.x,t.x,n.x,s?s.originX:void 0),Zg(e.y,t.y,n.y,s?s.originY:void 0)}function ex(e,t,n){e.min=n.min+t.min,e.max=e.min+He(t)}function c5(e,t,n){ex(e.x,t.x,n.x),ex(e.y,t.y,n.y)}function tx(e,t,n){e.min=t.min-n.min,e.max=e.min+He(t)}function Ni(e,t,n){tx(e.x,t.x,n.x),tx(e.y,t.y,n.y)}const nx=()=>({translate:0,scale:1,origin:0,originPoint:0}),ir=()=>({x:nx(),y:nx()}),sx=()=>({min:0,max:0}),be=()=>({x:sx(),y:sx()});function wt(e){return[e("x"),e("y")]}function nu(e){return e===void 0||e===1}function Gd({scale:e,scaleX:t,scaleY:n}){return!nu(e)||!nu(t)||!nu(n)}function gs(e){return Gd(e)||v1(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function v1(e){return rx(e.x)||rx(e.y)}function rx(e){return e&&e!=="0%"}function xl(e,t,n){const s=e-n,i=t*s;return n+i}function ix(e,t,n,s,i){return i!==void 0&&(e=xl(e,i,s)),xl(e,n,s)+t}function Yd(e,t=0,n=1,s,i){e.min=ix(e.min,t,n,s,i),e.max=ix(e.max,t,n,s,i)}function b1(e,{x:t,y:n}){Yd(e.x,t.translate,t.scale,t.originPoint),Yd(e.y,n.translate,n.scale,n.originPoint)}const ox=.999999999999,ax=1.0000000000001;function u5(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let l=0;l<i;l++){o=n[l],a=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&ar(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,b1(e,a)),s&&gs(o.latestValues)&&ar(e,o.latestValues))}t.x<ax&&t.x>ox&&(t.x=1),t.y<ax&&t.y>ox&&(t.y=1)}function or(e,t){e.min=e.min+t,e.max=e.max+t}function lx(e,t,n,s,i=.5){const o=me(e.min,e.max,i);Yd(e,t,n,o,s)}function ar(e,t){lx(e.x,t.x,t.scaleX,t.scale,t.originX),lx(e.y,t.y,t.scaleY,t.scale,t.originY)}function w1(e,t){return g1(s5(e.getBoundingClientRect(),t))}function d5(e,t,n){const s=w1(e,n),{scroll:i}=t;return i&&(or(s.x,i.offset.x),or(s.y,i.offset.y)),s}const j1=({current:e})=>e?e.ownerDocument.defaultView:null,cx=(e,t)=>Math.abs(e-t);function f5(e,t){const n=cx(e.x,t.x),s=cx(e.y,t.y);return Math.sqrt(n**2+s**2)}class N1{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:o=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=ru(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,b=f5(f.offset,{x:0,y:0})>=3;if(!p&&!b)return;const{point:j}=f,{timestamp:v}=_e;this.history.push({...j,timestamp:v});const{onStart:h,onMove:m}=this.handlers;p||(h&&h(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=su(p,this.transformPagePoint),pe.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:b,onSessionEnd:j,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=ru(f.type==="pointercancel"?this.lastMoveEventInfo:su(p,this.transformPagePoint),this.history);this.startEvent&&b&&b(f,h),j&&j(f,h)},!Jm(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const a=No(t),l=su(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=_e;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,ru(l,this.history)),this.removeListeners=bo(wi(this.contextWindow,"pointermove",this.handlePointerMove),wi(this.contextWindow,"pointerup",this.handlePointerUp),wi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ss(this.updatePoint)}}function su(e,t){return t?{point:t(e.point)}:e}function ux(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ru({point:e},t){return{point:e,delta:ux(e,S1(t)),offset:ux(e,m5(t)),velocity:h5(t,.1)}}function m5(e){return e[0]}function S1(e){return e[e.length-1]}function h5(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=S1(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>tn(t)));)n--;if(!s)return{x:0,y:0};const o=nn(i.timestamp-s.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-s.x)/o,y:(i.y-s.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function p5(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?me(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?me(n,e,s.max):Math.min(e,n)),e}function dx(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function g5(e,{top:t,left:n,bottom:s,right:i}){return{x:dx(e.x,n,i),y:dx(e.y,t,s)}}function fx(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function x5(e,t){return{x:fx(e.x,t.x),y:fx(e.y,t.y)}}function y5(e,t){let n=.5;const s=He(e),i=He(t);return i>s?n=Ji(t.min,t.max-s,e.min):s>i&&(n=Ji(e.min,e.max-i,t.min)),Cn(0,1,n)}function v5(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Xd=.35;function b5(e=Xd){return e===!1?e=0:e===!0&&(e=Xd),{x:mx(e,"left","right"),y:mx(e,"top","bottom")}}function mx(e,t,n){return{min:hx(e,t),max:hx(e,n)}}function hx(e,t){return typeof e=="number"?e:e[t]||0}const w5=new WeakMap;class j5{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=be(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(No(d).point)},o=(d,f)=>{const{drag:p,dragPropagation:b,onDragStart:j}=this.getProps();if(p&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=L_(p),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wt(h=>{let m=this.getAxisMotionValue(h).get()||0;if(sn.test(m)){const{projection:x}=this.visualElement;if(x&&x.layout){const y=x.layout.layoutBox[h];y&&(m=He(y)*(parseFloat(m)/100))}}this.originPoint[h]=m}),j&&pe.postRender(()=>j(d,f)),qd(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:p,dragDirectionLock:b,onDirectionLock:j,onDrag:v}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:h}=f;if(b&&this.currentDirection===null){this.currentDirection=N5(h),this.currentDirection!==null&&j&&j(this.currentDirection);return}this.updateAxis("x",f.point,h),this.updateAxis("y",f.point,h),this.visualElement.render(),v&&v(d,f)},l=(d,f)=>this.stop(d,f),c=()=>wt(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)==null?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new N1(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:j1(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&pe.postRender(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!ta(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(a=p5(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,i=this.constraints;t&&rr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=g5(s.layoutBox,t):this.constraints=!1,this.elastic=b5(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&wt(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=v5(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!rr(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=d5(s,i.root,this.visualElement.getTransformPagePoint());let a=x5(i.layout.layoutBox,o);if(n){const l=n(n5(a));this.hasMutatedConstraints=!!l,l&&(a=g1(l))}return a}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=wt(d=>{if(!ta(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const p=i?200:1e6,b=i?40:1e7,j={type:"inertia",velocity:s?t[d]:0,bounceStiffness:p,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(d,j)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return qd(this.visualElement,t),s.start(lh(t,s,0,n,this.visualElement,!1))}stopAnimation(){wt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){wt(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){wt(n=>{const{drag:s}=this.getProps();if(!ta(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];o.set(t[n]-me(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!rr(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};wt(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=y5({min:c,max:c},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),wt(a=>{if(!ta(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(me(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;w5.set(this.visualElement,this);const t=this.visualElement.current,n=wi(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();rr(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),pe.read(s);const a=ro(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(wt(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=Xd,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:l}}}function ta(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function N5(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class S5 extends cs{constructor(t){super(t),this.removeGroupControls=At,this.removeListeners=At,this.controls=new j5(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||At}unmount(){this.removeGroupControls(),this.removeListeners()}}const px=e=>(t,n)=>{e&&pe.postRender(()=>e(t,n))};class C5 extends cs{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(t){this.session=new N1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:j1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:px(t),onStart:px(n),onMove:s,onEnd:(o,a)=>{delete this.session,i&&pe.postRender(()=>i(o,a))}}}mount(){this.removePointerDownListener=wi(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Ra={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function gx(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ti={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Q.test(e))e=parseFloat(e);else return e;const n=gx(e,t.target.x),s=gx(e,t.target.y);return`${n}% ${s}%`}},k5={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=rs.parse(e);if(i.length>5)return s;const o=rs.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=me(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class E5 extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:o}=t;dI(T5),o&&(n.group&&n.group.add(o),s&&s.register&&i&&s.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Ra.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:o}=this.props,{projection:a}=s;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0||t.isPresent!==o?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||pe.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Qm.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function C1(e){const[t,n]=Jj(),s=g.useContext(Tm);return r.jsx(E5,{...e,layoutGroup:s,switchLayoutGroup:g.useContext(s1),isPresent:t,safeToRemove:n})}const T5={borderRadius:{...ti,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ti,borderTopRightRadius:ti,borderBottomLeftRadius:ti,borderBottomRightRadius:ti,boxShadow:k5};function A5(e,t,n){const s=ze(e)?e:kr(e);return s.start(lh("",s,t,n)),s.animation}const R5=(e,t)=>e.depth-t.depth;class P5{constructor(){this.children=[],this.isDirty=!1}add(t){Pm(this.children,t),this.isDirty=!0}remove(t){Mm(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(R5),this.isDirty=!1,this.children.forEach(t)}}function M5(e,t){const n=st.now(),s=({timestamp:i})=>{const o=i-n;o>=t&&(ss(s),e(o-t))};return pe.setup(s,!0),()=>ss(s)}const k1=["TopLeft","TopRight","BottomLeft","BottomRight"],_5=k1.length,xx=e=>typeof e=="string"?parseFloat(e):e,yx=e=>typeof e=="number"||Q.test(e);function I5(e,t,n,s,i,o){i?(e.opacity=me(0,n.opacity??1,O5(s)),e.opacityExit=me(t.opacity??1,0,L5(s))):o&&(e.opacity=me(t.opacity??1,n.opacity??1,s));for(let a=0;a<_5;a++){const l=`border${k1[a]}Radius`;let c=vx(t,l),u=vx(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||yx(c)===yx(u)?(e[l]=Math.max(me(xx(c),xx(u),s),0),(sn.test(u)||sn.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=me(t.rotate||0,n.rotate||0,s))}function vx(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const O5=E1(0,.5,vj),L5=E1(.5,.95,At);function E1(e,t,n){return s=>s<e?0:s>t?1:n(Ji(e,t,s))}function bx(e,t){e.min=t.min,e.max=t.max}function vt(e,t){bx(e.x,t.x),bx(e.y,t.y)}function wx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function jx(e,t,n,s,i){return e-=t,e=xl(e,1/n,s),i!==void 0&&(e=xl(e,1/i,s)),e}function D5(e,t=0,n=1,s=.5,i,o=e,a=e){if(sn.test(t)&&(t=parseFloat(t),t=me(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=me(o.min,o.max,s);e===o&&(l-=t),e.min=jx(e.min,t,n,l,i),e.max=jx(e.max,t,n,l,i)}function Nx(e,t,[n,s,i],o,a){D5(e,t[n],t[s],t[i],t.scale,o,a)}const F5=["x","scaleX","originX"],$5=["y","scaleY","originY"];function Sx(e,t,n,s){Nx(e.x,t,F5,n?n.x:void 0,s?s.x:void 0),Nx(e.y,t,$5,n?n.y:void 0,s?s.y:void 0)}function Cx(e){return e.translate===0&&e.scale===1}function T1(e){return Cx(e.x)&&Cx(e.y)}function kx(e,t){return e.min===t.min&&e.max===t.max}function U5(e,t){return kx(e.x,t.x)&&kx(e.y,t.y)}function Ex(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function A1(e,t){return Ex(e.x,t.x)&&Ex(e.y,t.y)}function Tx(e){return He(e.x)/He(e.y)}function Ax(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class z5{constructor(){this.members=[]}add(t){Pm(this.members,t),t.scheduleRender()}remove(t){if(Mm(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){s=o;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function V5(e,t,n){let s="";const i=e.x.translate/t.x,o=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||o||a)&&(s=`translate3d(${i}px, ${o}px, ${a}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:p,skewX:b,skewY:j}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotateX(${f}deg) `),p&&(s+=`rotateY(${p}deg) `),b&&(s+=`skewX(${b}deg) `),j&&(s+=`skewY(${j}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const iu=["","X","Y","Z"],B5={visibility:"hidden"},W5=1e3;let H5=0;function ou(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function R1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=f1(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",pe,!(i||o))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&R1(s)}function P1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=H5++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(G5),this.nodes.forEach(J5),this.nodes.forEach(Z5),this.nodes.forEach(Y5)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new P5)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Om),this.eventHandlers.get(a).add(l)}notifyListeners(a,...l){const c=this.eventHandlers.get(a);c&&c.notify(...l)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=Qj(a)&&!V_(a),this.instance=a;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let d;const f=()=>this.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=M5(f,250),Ra.hasAnimatedSinceResize&&(Ra.hasAnimatedSinceResize=!1,this.nodes.forEach(Mx))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:p,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||u.getDefaultTransition()||rO,{onLayoutAnimationStart:v,onLayoutAnimationComplete:h}=u.getProps(),m=!this.targetLayout||!A1(this.targetLayout,b),x=!f&&p;if(this.options.layoutRoot||this.resumeFrom||x||f&&(m||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const y={...Ym(j,"layout"),onPlay:v,onComplete:h};(u.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y),this.setAnimationOrigin(d,x)}else f||Mx(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ss(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(eO),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&R1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Rx);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Px);return}this.isUpdating||this.nodes.forEach(Px),this.animationCommitId=this.animationId,this.isUpdating=!1,this.nodes.forEach(Q5),this.nodes.forEach(q5),this.nodes.forEach(K5),this.clearAllSnapshots();const l=st.now();_e.delta=Cn(0,1e3/60,l-_e.timestamp),_e.timestamp=l,_e.isProcessing=!0,Xc.update.process(_e),Xc.preRender.process(_e),Xc.render.process(_e),_e.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Qm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(X5),this.sharedNodes.forEach(tO)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!He(this.snapshot.measuredBox.x)&&!He(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=be(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(l=!1),l&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!T1(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;a&&this.instance&&(l||gs(this.latestValues)||d)&&(i(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return a&&(c=this.removeTransform(c)),iO(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:a}=this.options;if(!a)return be();const l=a.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(oO))){const{scroll:d}=this.root;d&&(or(l.x,d.offset.x),or(l.y,d.offset.y))}return l}removeElementScroll(a){var c;const l=be();if(vt(l,a),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:p}=d;d!==this.root&&f&&p.layoutScroll&&(f.wasRoot&&vt(l,a),or(l.x,f.offset.x),or(l.y,f.offset.y))}return l}applyTransform(a,l=!1){const c=be();vt(c,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&ar(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),gs(d.latestValues)&&ar(c,d.latestValues)}return gs(this.latestValues)&&ar(c,this.latestValues),c}removeTransform(a){const l=be();vt(l,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!gs(u.latestValues))continue;Gd(u.latestValues)&&u.updateSnapshot();const d=be(),f=u.measurePageBox();vt(d,f),Sx(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return gs(this.latestValues)&&Sx(l,this.latestValues),l}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==_e.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var p;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!(!this.layout||!(d||f))){if(this.resolvedRelativeTargetAt=_e.timestamp,!this.targetDelta&&!this.relativeTarget){const b=this.getClosestProjectingParent();b&&b.layout&&this.animationProgress!==1?(this.relativeParent=b,this.forceRelativeParentToResolveTarget(),this.relativeTarget=be(),this.relativeTargetOrigin=be(),Ni(this.relativeTargetOrigin,this.layout.layoutBox,b.layout.layoutBox),vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=be(),this.targetWithTransforms=be()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),c5(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):vt(this.target,this.layout.layoutBox),b1(this.target,this.targetDelta)):vt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const b=this.getClosestProjectingParent();b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?(this.relativeParent=b,this.forceRelativeParentToResolveTarget(),this.relativeTarget=be(),this.relativeTargetOrigin=be(),Ni(this.relativeTargetOrigin,this.target,b.target),vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Gd(this.parent.latestValues)||v1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var j;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||(j=this.parent)!=null&&j.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===_e.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;vt(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,p=this.treeScale.y;u5(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=be());const{target:b}=a;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(wx(this.prevProjectionDelta.x,this.projectionDelta.x),wx(this.prevProjectionDelta.y,this.projectionDelta.y)),ji(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==p||!Ax(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ax(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),a){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ir(),this.projectionDelta=ir(),this.projectionDeltaWithTransform=ir()}setAnimationOrigin(a,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=ir();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const p=be(),b=c?c.source:void 0,j=this.layout?this.layout.source:void 0,v=b!==j,h=this.getStack(),m=!h||h.members.length<=1,x=!!(v&&!m&&this.options.crossfade===!0&&!this.path.some(sO));this.animationProgress=0;let y;this.mixTargetDelta=w=>{const S=w/1e3;_x(f.x,a.x,S),_x(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ni(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),nO(this.relativeTarget,this.relativeTargetOrigin,p,S),y&&U5(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=be()),vt(y,this.relativeTarget)),v&&(this.animationValues=d,I5(d,u,this.latestValues,S,x,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(ss(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pe.update(()=>{Ra.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=kr(0)),this.currentAnimation=A5(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),a.onUpdate&&a.onUpdate(d)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(W5),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&M1(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||be();const f=He(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const p=He(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+p}vt(l,c),ar(l,d),ji(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new z5),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var l;const{layoutId:a}=this.options;return a?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:a}=this.options;return a?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&ou("z",a,u,this.animationValues);for(let d=0;d<iu.length;d++)ou(`rotate${iu[d]}`,a,u,this.animationValues),ou(`skew${iu[d]}`,a,u,this.animationValues);a.render();for(const d in u)a.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);a.scheduleRender()}getProjectionStyles(a){if(!this.instance||this.isSVG)return;if(!this.isVisible)return B5;const l={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,l.opacity="",l.pointerEvents=Aa(a==null?void 0:a.pointerEvents)||"",l.transform=c?c(this.latestValues,""):"none",l;const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){const b={};return this.options.layoutId&&(b.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,b.pointerEvents=Aa(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!gs(this.latestValues)&&(b.transform=c?c({},""):"none",this.hasProjected=!1),b}const d=u.animationValues||u.latestValues;this.applyTransformsToTarget(),l.transform=V5(this.projectionDeltaWithTransform,this.treeScale,d),c&&(l.transform=c(d,l.transform));const{x:f,y:p}=this.projectionDelta;l.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,u.animationValues?l.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:l.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const b in no){if(d[b]===void 0)continue;const{correct:j,applyTo:v,isCSSVariable:h}=no[b],m=l.transform==="none"?d[b]:j(d[b],u);if(v){const x=v.length;for(let y=0;y<x;y++)l[v[y]]=m}else h?this.options.visualElement.renderState.vars[b]=m:l[b]=m}return this.options.layoutId&&(l.pointerEvents=u===this?Aa(a==null?void 0:a.pointerEvents)||"":"none"),l}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var l;return(l=a.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(Rx),this.root.sharedNodes.clear()}}}function q5(e){e.updateLayout()}function K5(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:o}=e.options,a=t.source!==e.layout.source;o==="size"?wt(f=>{const p=a?t.measuredBox[f]:t.layoutBox[f],b=He(p);p.min=s[f].min,p.max=p.min+b}):M1(o,t.layoutBox,s)&&wt(f=>{const p=a?t.measuredBox[f]:t.layoutBox[f],b=He(s[f]);p.max=p.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+b)});const l=ir();ji(l,s,t.layoutBox);const c=ir();a?ji(c,e.applyTransform(i,!0),t.measuredBox):ji(c,s,t.layoutBox);const u=!T1(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:p,layout:b}=f;if(p&&b){const j=be();Ni(j,t.layoutBox,p.layoutBox);const v=be();Ni(v,s,b.layoutBox),A1(j,v)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=j,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function G5(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Y5(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function X5(e){e.clearSnapshot()}function Rx(e){e.clearMeasurements()}function Px(e){e.isLayoutDirty=!1}function Q5(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Mx(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function J5(e){e.resolveTargetDelta()}function Z5(e){e.calcProjection()}function eO(e){e.resetSkewAndRotation()}function tO(e){e.removeLeadSnapshot()}function _x(e,t,n){e.translate=me(t.translate,0,n),e.scale=me(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Ix(e,t,n,s){e.min=me(t.min,n.min,s),e.max=me(t.max,n.max,s)}function nO(e,t,n,s){Ix(e.x,t.x,n.x,s),Ix(e.y,t.y,n.y,s)}function sO(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const rO={duration:.45,ease:[.4,0,.1,1]},Ox=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Lx=Ox("applewebkit/")&&!Ox("chrome/")?Math.round:At;function Dx(e){e.min=Lx(e.min),e.max=Lx(e.max)}function iO(e){Dx(e.x),Dx(e.y)}function M1(e,t,n){return e==="position"||e==="preserve-aspect"&&!l5(Tx(t),Tx(n),.2)}function oO(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const aO=P1({attachResizeListener:(e,t)=>ro(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),au={current:void 0},_1=P1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!au.current){const e=new aO({});e.mount(window),e.setOptions({layoutScroll:!0}),au.current=e}return au.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),lO={pan:{Feature:C5},drag:{Feature:S5,ProjectionNode:_1,MeasureLayout:C1}};function Fx(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=s[i];o&&pe.postRender(()=>o(t,No(t)))}class cO extends cs{mount(){const{current:t}=this.node;t&&(this.unmount=D_(t,(n,s)=>(Fx(this.node,s,"Start"),i=>Fx(this.node,i,"End"))))}unmount(){}}class uO extends cs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=bo(ro(this.node.current,"focus",()=>this.onFocus()),ro(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $x(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=s[i];o&&pe.postRender(()=>o(t,No(t)))}class dO extends cs{mount(){const{current:t}=this.node;t&&(this.unmount=z_(t,(n,s)=>($x(this.node,s,"Start"),(i,{success:o})=>$x(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Qd=new WeakMap,lu=new WeakMap,fO=e=>{const t=Qd.get(e.target);t&&t(e)},mO=e=>{e.forEach(fO)};function hO({root:e,...t}){const n=e||document;lu.has(n)||lu.set(n,{});const s=lu.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(mO,{root:e,...t})),s[i]}function pO(e,t,n){const s=hO(t);return Qd.set(e,n),s.observe(e),()=>{Qd.delete(e),s.unobserve(e)}}const gO={some:0,all:1};class xO extends cs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:gO[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),p=u?d:f;p&&p(c)};return pO(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(yO(t,n))&&this.startObserver()}unmount(){}}function yO({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const vO={inView:{Feature:xO},tap:{Feature:dO},focus:{Feature:uO},hover:{Feature:cO}},bO={layout:{ProjectionNode:_1,MeasureLayout:C1}},Jd={current:null},I1={current:!1};function wO(){if(I1.current=!0,!!Rm)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Jd.current=e.matches;e.addListener(t),t()}else Jd.current=!1}const jO=new WeakMap;function NO(e,t,n){for(const s in t){const i=t[s],o=n[s];if(ze(i))e.addValue(s,i);else if(ze(o))e.addValue(s,kr(i,{owner:e}));else if(o!==i)if(e.hasValue(s)){const a=e.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(s);e.addValue(s,kr(a!==void 0?a:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const Ux=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class SO{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Km,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=st.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,pe.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=sc(n),this.isVariantNode=t1(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in f){const b=f[p];c[p]!==void 0&&ze(b)&&b.set(c[p],!1)}}mount(t){this.current=t,jO.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),I1.current||wO(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Jd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),ss(this.notifyUpdate),ss(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=zr.has(t);s&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&pe.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),o(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Er){const n=Er[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):be()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<Ux.length;s++){const i=Ux[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const o="on"+i,a=t[o];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=NO(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=kr(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(cj(s)||dj(s))?s=parseFloat(s):!W_(s)&&rs.test(n)&&(s=qj(t,n)),this.setBaseTarget(t,ze(s)?s.get():s)),ze(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const a=oh(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);a&&(s=a[t])}if(n&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ze(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Om),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class O1 extends SO{constructor(){super(...arguments),this.KeyframeResolver=M_}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ze(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function L1(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const o in n)e.style.setProperty(o,n[o])}function CO(e){return window.getComputedStyle(e)}class kO extends O1{constructor(){super(...arguments),this.type="html",this.renderInstance=L1}readValueFromInstance(t,n){var s;if(zr.has(n))return(s=this.projection)!=null&&s.isProjecting?$d(n):QM(t,n);{const i=CO(t),o=(Fm(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return w1(t,n)}build(t,n,s){sh(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return ah(t,n,s)}}const D1=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function EO(e,t,n,s){L1(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(D1.has(i)?i:nh(i),t.attrs[i])}class TO extends O1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=be}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(zr.has(n)){const s=Hj(n);return s&&s.default||0}return n=D1.has(n)?n:nh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return d1(t,n,s)}build(t,n,s){a1(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,i){EO(t,n,s,i)}mount(t){this.isSVGTag=c1(t.tagName),super.mount(t)}}const AO=(e,t)=>ih(e)?new TO(t):new kO(t,{allowProjection:e!==g.Fragment}),RO=TI({...e5,...vO,...lO,...bO},AO),bt=Z_(RO),PO=hb("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 rounded-sm",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-md hover:bg-primary/90 border border-primary/20",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 border border-destructive/20",outline:"border-2 border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground hover:border-accent",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 border border-secondary/20",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),V=g.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...i},o)=>{const a=s?VA:"button";return r.jsx(a,{className:Y(PO({variant:t,size:n,className:e})),ref:o,...i})});V.displayName="Button";const B=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("border-2 bg-card text-card-foreground shadow-lg rounded-sm",e),...t}));B.displayName="Card";const fn=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("flex flex-col space-y-1.5 p-6",e),...t}));fn.displayName="CardHeader";const mn=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("font-semibold leading-none tracking-tight",e),...t}));mn.displayName="CardTitle";const MO=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("text-sm text-muted-foreground",e),...t}));MO.displayName="CardDescription";const Ct=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("p-6 pt-0",e),...t}));Ct.displayName="CardContent";const _O=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("flex items-center p-6 pt-0",e),...t}));_O.displayName="CardFooter";const IO=async e=>{try{if(!(await fetch("/api/open-in-ide",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})).ok)throw new Error("Failed to open in IDE")}catch(t){console.error("Failed to open in IDE:",t)}},zx=({className:e,animate:t=!1})=>r.jsxs(bt.svg,{viewBox:"0 0 83.72 100",className:e,animate:t?{scale:[1,1.05,1]}:{},transition:{duration:3,ease:"easeInOut",repeat:t?1/0:0,repeatDelay:2},children:[r.jsx("defs",{children:r.jsx("style",{children:".cls-1{fill:#575959;}.cls-1,.cls-2{fill-rule:evenodd;}.cls-2{fill:#71a087;}"})}),r.jsxs("g",{children:[r.jsx("path",{className:"cls-2",d:"M55.47,64.04c6.99-6.38,12.45-6.24,18.5,.64,2.62,3.87,.43,7.52-1.58,9.32-.02,.02-.03,.03-.05,.05l-2.02,1.71c2.06-3.99-1.7-4.53-3.13-3.6-.1,.07-.21,.14-.3,.23l-.03,.02-31.08,27.49c-.16,.14-.4,.12-.54-.04l-9.09-10.3c-.14-.16-.13-.4,.03-.54l29.29-24.99Z"}),r.jsx("path",{className:"cls-1",d:"M83.43,8.57l.29-7.73c.04-1.09-.36-1.12-1.65-.05l-37.42,31.68,7.1,6.98,29.72-25.82c1.26-1.11,1.92-3.7,1.97-5.06h0Z"}),r.jsx("path",{className:"cls-2",d:"M83.1,27.7l.29-7.73c.04-1.09-.36-1.12-1.65-.05l-26.93,22.8,7.16,6.68,19.16-16.64c1.26-1.11,1.92-3.7,1.97-5.06h0Z"}),r.jsx("path",{className:"cls-1",d:"M83.25,46.68l.29-7.73c.04-1.09-.36-1.12-1.65-.05l-16.02,13.55,7.01,6.56,8.38-7.27c1.26-1.11,1.92-3.7,1.98-5.06h0Z"}),r.jsx("path",{className:"cls-2",d:"M50.96,59.82L3.51,17.25C.72,14.75,.61,12.31,.73,9.61L1.06,1.46,58.48,53.26l-7.52,6.56Z"}),r.jsx("path",{className:"cls-1",d:"M39.79,69.37L3.03,36.42c-1.47-1.33-1.92-5.47-1.85-6.98l.57-7.63L47.23,62.94l-7.44,6.43Z"}),r.jsx("path",{className:"cls-2",d:"M27.6,80.1L2.74,56.36C1.02,54.72-.08,52.17,0,50.43l.5-8.69,34.92,31.54-7.82,6.82Z"})]})]}),Vx=["Scanning for local Frigg repositories...","Checking installed integrations...","Pinging npm for up-to-date API modules...","Loading Frigg core plugins...","Initializing management interface..."];function Bx(){const e=uo(),{repositories:t,isLoading:n,switchRepository:s,currentRepository:i}=Mt(),[o,a]=g.useState(null),[l,c]=g.useState(0),[u,d]=g.useState(!1),[f,p]=g.useState(!1),[b,j]=g.useState(!1),[v,h]=g.useState("project");g.useEffect(()=>{const w=setInterval(()=>{c(S=>S>=Vx.length-1?(setTimeout(()=>d(!0),800),S):S+1)},600);return()=>clearInterval(w)},[]);const m=async w=>{a(w),j(!1),p(!0);try{await s(w.path),setTimeout(()=>e("/dashboard"),800)}catch(S){console.error("Failed to switch repository:",S),p(!1),a(null)}},x=()=>{window.open("/api/cli/init-wizard","_blank")},y=()=>{o&&m(o)};return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Gg,{mode:"wait",children:u?r.jsxs(bt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-2xl text-center",children:[r.jsxs("div",{className:"mb-12",children:[r.jsx(bt.div,{initial:{scale:.8},animate:{scale:1},transition:{delay:.2},children:r.jsx(zx,{className:"w-20 h-20 mx-auto text-primary mb-6",animate:!0})}),r.jsx(bt.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"text-5xl font-bold mb-6 bg-gradient-to-r from-primary to-blue-600 bg-clip-text text-transparent",children:"Welcome to Frigg"}),r.jsx(bt.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"text-xl text-muted-foreground max-w-xl mx-auto leading-relaxed",children:"Your local development interface for managing Frigg applications. Create integrations, manage connections, and configure your APIs."})]}),r.jsxs(bt.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{delay:.5},className:"mb-8",children:[r.jsx("h2",{className:"text-2xl font-semibold mb-6",children:"Frigg Builder Assistant"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx(B,{className:"p-4 hover:shadow-lg transition-all cursor-pointer border-2 hover:border-primary/50",onClick:()=>h("explore"),children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(qi,{className:"w-6 h-6 text-primary"}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold",children:"Explore Integrations"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse available API modules"})]})]})}),r.jsx(B,{className:"p-4 hover:shadow-lg transition-all cursor-pointer border-2 hover:border-primary/50",onClick:()=>h("analyze"),children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(jd,{className:"w-6 h-6 text-primary"}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold",children:"Code Analysis"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Analyze project structure"})]})]})}),r.jsx(B,{className:"p-4 hover:shadow-lg transition-all cursor-pointer border-2 hover:border-primary/50",onClick:()=>h("project"),children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wd,{className:"w-6 h-6 text-primary"}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold",children:"Project Selection"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose or create project"})]})]})})]}),v==="project"&&r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Choose Your Project"}),n||f?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(ol,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("span",{className:"ml-3 text-lg",children:f?"Loading project...":"Discovering projects..."})]}):t&&t.length>0?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"relative",children:[r.jsx(B,{className:`p-6 cursor-pointer transition-all hover:shadow-lg border-2 ${o?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,onClick:()=>j(!b),children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Fc,{className:"w-6 h-6 text-primary"}),r.jsxs("div",{className:"text-left",children:[r.jsx("h3",{className:"text-lg font-semibold",children:o?o.name:"Select a Frigg Project"}),o&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:o.path}),!o&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[t.length," project",t.length!==1?"s":""," available"]})]})]}),r.jsx(cm,{className:`w-5 h-5 text-muted-foreground transition-transform ${b?"rotate-180":""}`})]})}),r.jsx(Gg,{children:b&&r.jsx(bt.div,{initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},transition:{duration:.2},className:"absolute top-full left-0 right-0 mt-2 z-50",children:r.jsx(B,{className:"border-2 border-border shadow-lg",children:r.jsx("div",{className:"max-h-64 overflow-y-auto",children:t.map((w,S)=>r.jsx(bt.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.05},className:`p-4 cursor-pointer transition-colors hover:bg-primary/10 ${(o==null?void 0:o.path)===w.path?"bg-primary/5 border-l-4 border-l-primary":""} ${S!==t.length-1?"border-b border-border":""}`,onClick:()=>a(w),children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Fc,{className:"w-5 h-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:w.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:w.path}),w.framework&&w.framework!=="Unknown"&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-2 py-1 rounded mt-1 inline-block",children:w.framework})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(V,{variant:"ghost",size:"sm",onClick:C=>{C.stopPropagation(),IO(w.path)},children:r.jsx(Hi,{className:"w-4 h-4"})})})]})},w.path))})})})})]}),r.jsxs("div",{className:"flex gap-4 justify-center pt-4",children:[r.jsxs(V,{onClick:y,disabled:!o,size:"lg",className:"gap-2 px-8",children:[r.jsx(UT,{className:"w-5 h-5"}),"Launch Project"]}),r.jsxs(V,{onClick:x,variant:"outline",size:"lg",className:"gap-2 px-6",children:[r.jsx(Zp,{className:"w-5 h-5"}),"Create New"]})]})]}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Fc,{className:"w-16 h-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Frigg Projects Found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"No Frigg applications found in your local environment."}),r.jsxs(V,{onClick:x,size:"lg",className:"gap-2",children:[r.jsx(Zp,{className:"w-5 h-5"}),"Create Your First Frigg Application"]})]})]}),v==="explore"&&r.jsxs("div",{className:"space-y-6",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Integration Explorer"}),r.jsx(B,{className:"p-6",children:r.jsxs("div",{className:"text-center py-8",children:[r.jsx(qi,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h4",{className:"font-semibold mb-2",children:"Integration Explorer"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Browse and explore available integrations"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Integration Explorer coming soon..."})]})})]}),v==="analyze"&&r.jsxs("div",{className:"space-y-6",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Project Code Analysis"}),r.jsx(B,{className:"p-6",children:r.jsxs("div",{className:"text-center py-8",children:[r.jsx(jd,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h4",{className:"font-semibold mb-2",children:"Static Code Analysis"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Select a project to analyze its integration structure and dependencies"}),r.jsxs(V,{onClick:()=>h("project"),variant:"outline",children:[r.jsx(wd,{className:"w-4 h-4 mr-2"}),"Choose Project First"]})]})})]})]}),r.jsxs(bt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.8},className:"text-center text-sm text-muted-foreground border-t border-border pt-6",children:[r.jsx("p",{children:"All features are available via CLI and directly in code."}),r.jsx("p",{children:"This UI is here to help you use those tools more efficiently."})]})]},"content"):r.jsxs(bt.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},className:"text-center",children:[r.jsx(bt.div,{initial:{rotate:0},animate:{rotate:360,transition:{duration:2,ease:"linear",repeat:1/0}},className:"mb-8",children:r.jsx(zx,{className:"w-24 h-24 mx-auto text-primary"})}),r.jsx("div",{className:"space-y-2",children:Vx.slice(0,l+1).map((w,S)=>r.jsx(bt.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:S*.1},className:"text-muted-foreground text-sm",children:w},S))})]},"loading")})})}const OO=()=>{const{status:e,startFrigg:t,stopFrigg:n,restartFrigg:s,integrations:i,users:o,connections:a,getMetrics:l,getLogs:c}=Mt(),{on:u}=an(),[d,f]=g.useState([]),[p,b]=g.useState(null),[j,v]=g.useState(!1),[h,m]=g.useState({stage:"dev",verbose:!1});g.useEffect(()=>{const k=u("frigg:logs",A=>{f(A)}),T=u("frigg:log",A=>{f(P=>[...P.slice(-99),A])});(async()=>{try{if(typeof c=="function"){const A=await c(50);f(A)}if(typeof l=="function"){const A=await l();b(A)}}catch(A){console.error("Error fetching data:",A)}})();const E=setInterval(()=>{e==="running"&&typeof l=="function"&&l().then(b).catch(console.error)},5e3);return()=>{k&&k(),T&&T(),clearInterval(E)}},[u,c,l,e]);const x=async()=>{try{await t(h)}catch(k){console.error("Failed to start Frigg:",k)}},y=async(k=!1)=>{try{await n(k)}catch(T){console.error("Failed to stop Frigg:",T)}},w=async()=>{try{await s(h)}catch(k){console.error("Failed to restart Frigg:",k)}},S=[{name:"Integrations",value:i.length,icon:"🔌"},{name:"Test Users",value:o.length,icon:"👤"},{name:"Active Connections",value:a.filter(k=>k.active).length,icon:"🔗"},{name:"Total Entities",value:a.reduce((k,T)=>{var N;return k+(((N=T.entities)==null?void 0:N.length)||0)},0),icon:"📊"}],C=k=>{if(!k)return"N/A";const T=Math.floor(k/1e3),N=Math.floor(T/60),E=Math.floor(N/60);return E>0?`${E}h ${N%60}m`:N>0?`${N}m ${T%60}s`:`${T}s`};return r.jsxs("div",{children:[r.jsxs("div",{className:"mb-8",children:[r.jsx("h2",{className:"text-3xl font-bold text-foreground",children:"Dashboard"}),r.jsx("p",{className:"mt-2 text-muted-foreground",children:"Manage your Frigg development environment"})]}),r.jsxs("div",{className:"bg-card shadow rounded-lg p-6 mb-8 border border-border",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-card-foreground",children:"Frigg Server Control"}),r.jsxs("button",{onClick:()=>v(!j),className:"text-sm text-primary hover:text-primary/80",children:[j?"Hide":"Show"," Advanced Options"]})]}),j&&r.jsx("div",{className:"mb-6 p-4 bg-muted/50 rounded-md",children:r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-foreground mb-1",children:"Stage"}),r.jsxs("select",{value:h.stage,onChange:k=>m(T=>({...T,stage:k.target.value})),className:"w-full px-3 py-2 border border-input bg-background text-foreground rounded-md focus:outline-none focus:ring-2 focus:ring-ring",children:[r.jsx("option",{value:"dev",children:"Development"}),r.jsx("option",{value:"staging",children:"Staging"}),r.jsx("option",{value:"prod",children:"Production"})]})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",id:"verbose",checked:h.verbose,onChange:k=>m(T=>({...T,verbose:k.target.checked})),className:"mr-2"}),r.jsx("label",{htmlFor:"verbose",className:"text-sm font-medium text-foreground",children:"Verbose logging"})]})]})}),r.jsx("div",{className:"mb-4 p-4 bg-muted/50 rounded-md",children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsx("span",{className:`ml-2 font-medium ${e==="running"?"text-green-600":e==="stopped"?"text-red-600":"text-yellow-600"}`,children:e.charAt(0).toUpperCase()+e.slice(1)})]}),p&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"PID:"}),r.jsx("span",{className:"ml-2 font-medium",children:p.pid||"N/A"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Uptime:"}),r.jsx("span",{className:"ml-2 font-medium",children:C(p.uptime)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Stage:"}),r.jsx("span",{className:"ml-2 font-medium",children:h.stage})]})]})]})}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("button",{onClick:x,disabled:e==="running"||e==="starting",className:`px-6 py-3 rounded-md font-medium transition-colors ${e==="running"||e==="starting"?"bg-muted text-muted-foreground cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:"▶️ Start"}),r.jsx("button",{onClick:()=>y(),disabled:e==="stopped"||e==="stopping",className:`px-6 py-3 rounded-md font-medium transition-colors ${e==="stopped"||e==="stopping"?"bg-muted text-muted-foreground cursor-not-allowed":"bg-red-600 text-white hover:bg-red-700"}`,children:"⏹️ Stop"}),r.jsx("button",{onClick:w,disabled:e==="starting"||e==="stopping",className:`px-6 py-3 rounded-md font-medium transition-colors ${e==="starting"||e==="stopping"?"bg-muted text-muted-foreground cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700"}`,children:"🔄 Restart"}),(e==="running"||e==="stopping")&&r.jsx("button",{onClick:()=>y(!0),className:"px-4 py-3 rounded-md font-medium bg-orange-600 text-white hover:bg-orange-700 transition-colors",children:"⚠️ Force Stop"})]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:S.map(k=>r.jsx("div",{className:"bg-card shadow rounded-lg p-6 border border-border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("span",{className:"text-3xl mr-3",children:k.icon}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:k.name}),r.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:k.value})]})]})},k.name))}),r.jsxs("div",{className:"bg-card shadow rounded-lg p-6 mb-8 border border-border",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-card-foreground",children:"Real-time Logs"}),r.jsx("button",{onClick:()=>f([]),className:"text-sm text-red-600 hover:text-red-800",children:"Clear Logs"})]}),r.jsx("div",{className:"bg-muted/30 dark:bg-gray-900 text-foreground dark:text-gray-100 p-4 rounded-md h-64 overflow-y-auto font-mono text-sm border border-border",children:d.length===0?r.jsx("div",{className:"text-muted-foreground text-center py-8",children:"No logs available. Start Frigg to see real-time logs."}):d.map((k,T)=>r.jsxs("div",{className:"mb-1 flex",children:[r.jsx("span",{className:"text-muted-foreground mr-2 w-20 flex-shrink-0",children:new Date(k.timestamp).toLocaleTimeString()}),r.jsxs("span",{className:`mr-2 w-12 flex-shrink-0 ${k.type==="stderr"?"text-red-400":k.type==="system"?"text-blue-400":"text-green-400"}`,children:["[",k.type.toUpperCase(),"]"]}),r.jsx("span",{className:"flex-1 break-all",children:k.message})]},T))})]}),r.jsxs("div",{className:"bg-card shadow rounded-lg p-6 border border-border",children:[r.jsx("h3",{className:"text-lg font-medium text-card-foreground mb-4",children:"Recent Activity"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center text-sm",children:[r.jsx("span",{className:"w-2 h-2 bg-green-400 rounded-full mr-3"}),r.jsx("span",{className:"text-foreground",children:"Frigg server started"}),r.jsx("span",{className:"ml-auto text-muted-foreground",children:"2 minutes ago"})]}),r.jsxs("div",{className:"flex items-center text-sm",children:[r.jsx("span",{className:"w-2 h-2 bg-blue-400 rounded-full mr-3"}),r.jsx("span",{className:"text-foreground",children:"Integration 'Slack' installed"}),r.jsx("span",{className:"ml-auto text-muted-foreground",children:"15 minutes ago"})]}),r.jsxs("div",{className:"flex items-center text-sm",children:[r.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full mr-3"}),r.jsx("span",{className:"text-foreground",children:"Test user 'john.doe' created"}),r.jsx("span",{className:"ml-auto text-muted-foreground",children:"1 hour ago"})]})]})]})]})},Ke=({size:e="md",className:t,variant:n="default",...s})=>{const i={sm:16,md:24,lg:32,xl:48},o={default:"text-primary",secondary:"text-secondary",muted:"text-muted-foreground"};return r.jsx(cb,{size:i[e],className:Y("animate-spin",o[n],t),...s})},yl=({integration:e,onInstall:t,onConfigure:n,onUninstall:s,installing:i=!1,className:o,...a})=>{const[l,c]=g.useState(!1),u=e.installed||e.status==="installed",d=i||e.status==="installing",f=e.status==="error",p=async()=>{t&&!u&&!d&&await t(e.name)},b=()=>{n&&u&&n(e.name)},j=async()=>{s&&u&&await s(e.name)},{onUpdate:v,onTest:h,uninstalling:m,updating:x,error:y,...w}=a;return r.jsx(B,{className:Y("hover:shadow-lg industrial-transition",o),...w,children:r.jsxs(Ct,{className:"p-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center mb-2",children:[r.jsx("h4",{className:"font-semibold text-foreground text-lg",children:e.displayName||e.name}),e.version&&r.jsxs("span",{className:"ml-2 text-xs bg-muted text-muted-foreground px-2 py-1 sharp-badge",children:["v",e.version]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e.description||"No description available"}),e.tags&&e.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mb-3",children:e.tags.map((S,C)=>r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-2 py-1 sharp-badge",children:S},C))})]}),r.jsxs("div",{className:"flex items-center ml-4",children:[f&&r.jsx(Zt,{size:20,className:"text-red-500 mr-2"}),u&&!f&&r.jsx(rl,{size:20,className:"text-green-500 mr-2"}),d&&r.jsx(Ke,{size:"sm",className:"mr-2"})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[!u&&!d&&r.jsxs(V,{size:"sm",onClick:p,disabled:d,className:"inline-flex items-center",children:[r.jsx(lT,{size:16,className:"mr-1"}),"Install"]}),u&&!f&&r.jsxs(V,{size:"sm",variant:"outline",onClick:b,className:"inline-flex items-center",children:[r.jsx(um,{size:16,className:"mr-1"}),"Configure"]}),d&&r.jsxs(V,{size:"sm",disabled:!0,className:"inline-flex items-center",children:[r.jsx(Ke,{size:"sm",className:"mr-1"}),"Installing..."]}),f&&r.jsxs(V,{size:"sm",variant:"destructive",onClick:p,className:"inline-flex items-center",children:[r.jsx(Zt,{size:16,className:"mr-1"}),"Retry"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[e.docsUrl&&r.jsxs(V,{size:"sm",variant:"ghost",onClick:()=>window.open(e.docsUrl,"_blank"),className:"inline-flex items-center text-xs",children:[r.jsx(ob,{size:14,className:"mr-1"}),"Docs"]}),u&&r.jsx(V,{size:"sm",variant:"ghost",onClick:()=>c(!l),className:"text-xs",children:l?"Less":"More"})]})]}),l&&u&&r.jsxs("div",{className:"mt-4 pt-4 border-t border-border",children:[r.jsxs("div",{className:"space-y-2 text-sm",children:[e.endpoints&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Endpoints:"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:e.endpoints.length})]}),e.lastUpdated&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last Updated:"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:new Date(e.lastUpdated).toLocaleDateString()})]}),e.connections&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Active Connections:"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:e.connections})]})]}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(V,{size:"sm",variant:"destructive",onClick:j,className:"inline-flex items-center text-xs",children:"Uninstall"})})]})]})})},LO=()=>{const{integrations:e,installIntegration:t,uninstallIntegration:n}=Mt(),[s,i]=g.useState(""),[o,a]=g.useState("all"),[l,c]=g.useState("grid"),[u,d]=g.useState(!1),[f,p]=g.useState(null),b=[{name:"slack",displayName:"Slack",description:"Team communication and collaboration platform",category:"communication",tags:["messaging","team","notifications"],version:"2.1.0",docsUrl:"https://docs.frigg.dev/integrations/slack"},{name:"salesforce",displayName:"Salesforce",description:"Customer relationship management and sales platform",category:"crm",tags:["sales","crm","leads"],version:"1.8.2",docsUrl:"https://docs.frigg.dev/integrations/salesforce"},{name:"hubspot",displayName:"HubSpot",description:"Inbound marketing, sales, and service software",category:"marketing",tags:["marketing","automation","analytics"],version:"3.0.1",docsUrl:"https://docs.frigg.dev/integrations/hubspot"},{name:"google-sheets",displayName:"Google Sheets",description:"Online spreadsheet collaboration and data management",category:"productivity",tags:["spreadsheet","data","collaboration"],version:"1.5.0",docsUrl:"https://docs.frigg.dev/integrations/google-sheets"},{name:"stripe",displayName:"Stripe",description:"Online payment processing and financial services",category:"payments",tags:["payments","ecommerce","billing"],version:"2.3.1",docsUrl:"https://docs.frigg.dev/integrations/stripe"},{name:"mailchimp",displayName:"Mailchimp",description:"Email marketing and automation platform",category:"marketing",tags:["email","marketing","campaigns"],version:"1.9.0",docsUrl:"https://docs.frigg.dev/integrations/mailchimp"}].map(S=>({...S,installed:e.some(C=>C.name===S.name),connections:Math.floor(Math.random()*10),lastUpdated:new Date(Date.now()-Math.random()*30*24*60*60*1e3).toISOString()})),j=["all","communication","crm","marketing","productivity","payments"],v=g.useMemo(()=>b.filter(S=>{const C=S.displayName.toLowerCase().includes(s.toLowerCase())||S.description.toLowerCase().includes(s.toLowerCase())||S.tags.some(T=>T.toLowerCase().includes(s.toLowerCase())),k=o==="all"||S.category===o;return C&&k}),[b,s,o]),h=g.useMemo(()=>b.filter(S=>S.installed),[b]),m=g.useMemo(()=>v.filter(S=>!S.installed),[v]),x=async S=>{d(!0),p(S);try{await t(S)}catch(C){console.error("Installation failed:",C)}finally{d(!1),p(null)}},y=async S=>{try{n&&await n(S)}catch(C){console.error("Uninstall failed:",C)}},w=S=>{console.log("Configure integration:",S)};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Integration Discovery"}),r.jsx("p",{className:"mt-2 text-gray-600",children:"Browse and manage Frigg integrations"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(qi,{size:20,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Search integrations...",value:s,onChange:S=>i(S.target.value)})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("select",{value:o,onChange:S=>a(S.target.value),className:"px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:j.map(S=>r.jsx("option",{value:S,children:S.charAt(0).toUpperCase()+S.slice(1)},S))}),r.jsxs("div",{className:"flex border border-gray-300 rounded-lg",children:[r.jsx(V,{variant:l==="grid"?"default":"ghost",size:"sm",onClick:()=>c("grid"),className:"rounded-r-none",children:r.jsx(ab,{size:16})}),r.jsx(V,{variant:l==="list"?"default":"ghost",size:"sm",onClick:()=>c("list"),className:"rounded-l-none border-l",children:r.jsx(lb,{size:16})})]})]})]}),h.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center mb-4",children:[r.jsx(il,{size:20,className:"mr-2 text-green-600"}),r.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:["Installed Integrations (",h.length,")"]})]}),r.jsx("div",{className:Y(l==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4"),children:h.map(S=>r.jsx(yl,{integration:S,onConfigure:w,onUninstall:y,className:l==="list"?"max-w-none":""},S.name))})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:["Available Integrations (",m.length,")"]}),m.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(il,{size:48,className:"mx-auto text-gray-300 mb-4"}),r.jsx("p",{className:"text-gray-500",children:"No integrations found matching your criteria"}),r.jsx(V,{variant:"outline",onClick:()=>{i(""),a("all")},className:"mt-4",children:"Clear Filters"})]}):r.jsx("div",{className:Y(l==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4"),children:m.map(S=>r.jsx(yl,{integration:S,onInstall:x,installing:u&&f===S.name,className:l==="list"?"max-w-none":""},S.name))})]})]})},DO=()=>{const{refreshData:e}=Mt(),{on:t,emit:n}=an(),[s,i]=g.useState(!0),[o,a]=g.useState([]),[l,c]=g.useState([]),[u,d]=g.useState([]),[f,p]=g.useState(""),[b,j]=g.useState("all"),[v,h]=g.useState("grid"),[m,x]=g.useState({}),[y,w]=g.useState(null),[S,C]=g.useState(!1);g.useEffect(()=>{k()},[]),g.useEffect(()=>{T()},[f,b]),g.useEffect(()=>{const R=t("integration:install:progress",z=>{x(K=>({...K,[z.packageName]:{status:z.status,progress:z.progress,message:z.message}}))}),I=t("integration:install:complete",z=>{x(K=>{const se={...K};return delete se[z.packageName],se}),T(),e()}),D=t("integration:install:error",z=>{x(K=>({...K,[z.packageName]:{status:"error",message:z.error}}))});return()=>{R&&R(),I&&I(),D&&D()}},[t,e]);const k=async()=>{try{const R=await W.get("/api/discovery/categories");d([{id:"all",name:"All",icon:"grid"},...R.data.data])}catch(R){console.error("Failed to fetch categories:",R)}},T=async()=>{i(!0),w(null);try{const[R,I]=await Promise.all([f?W.get(`/api/discovery/search?query=${encodeURIComponent(f)}&limit=100`):W.get("/api/discovery/integrations"),W.get("/api/discovery/installed")]);let D=R.data.data.integrations||R.data.data.all||[];b&&b!=="all"&&(D=D.filter(K=>{var se;return((se=K.category)==null?void 0:se.toLowerCase())===b.toLowerCase()}));const z=I.data.data.map(K=>K.name);D=D.map(K=>{var se;return{...K,installed:z.includes(K.name),status:((se=m[K.name])==null?void 0:se.status)||(z.includes(K.name)?"installed":"available")}}),a(D),c(I.data.data)}catch(R){console.error("Failed to fetch integrations:",R),w("Failed to load integrations. Please try again.")}finally{i(!1)}},N=async R=>{try{x(I=>({...I,[R]:{status:"installing",progress:0,message:"Starting installation..."}})),await W.post("/api/discovery/install",{packageName:R})}catch(I){console.error("Installation failed:",I),x(D=>{var z,K;return{...D,[R]:{status:"error",message:((K=(z=I.response)==null?void 0:z.data)==null?void 0:K.message)||"Installation failed"}}})}},E=async R=>{try{if(!window.confirm(`Are you sure you want to uninstall ${R}? This action cannot be undone.`))return;x(D=>({...D,[R]:{status:"uninstalling",message:"Removing integration..."}})),await W.delete(`/api/discovery/uninstall/${R}`),x(D=>{const z={...D};return delete z[R],z}),await T(),e()}catch(I){console.error("Uninstall failed:",I),x(D=>{var z,K;return{...D,[R]:{status:"error",message:((K=(z=I.response)==null?void 0:z.data)==null?void 0:K.message)||"Uninstall failed"}}})}},A=async R=>{try{x(I=>({...I,[R]:{status:"updating",message:"Checking for updates..."}})),await W.post("/api/discovery/update",{packageName:R}),await T(),e()}catch(I){console.error("Update failed:",I),x(D=>{var z,K;return{...D,[R]:{status:"error",message:((K=(z=I.response)==null?void 0:z.data)==null?void 0:K.message)||"Update failed"}}})}},P=async()=>{C(!0);try{await W.post("/api/discovery/cache/clear"),await T()}catch(R){console.error("Refresh failed:",R)}finally{C(!1)}},M=R=>{window.location.href=`/integrations/${R}/configure`},_=R=>{window.location.href=`/integrations/${R}/test`},O=g.useMemo(()=>o.map(R=>{var I,D,z,K,se,ve;return{...R,installing:((I=m[R.name])==null?void 0:I.status)==="installing",uninstalling:((D=m[R.name])==null?void 0:D.status)==="uninstalling",updating:((z=m[R.name])==null?void 0:z.status)==="updating",installError:((K=m[R.name])==null?void 0:K.status)==="error",installMessage:(se=m[R.name])==null?void 0:se.message,installProgress:(ve=m[R.name])==null?void 0:ve.progress}}),[o,m]),F=O.filter(R=>R.installed).length,$=O.filter(R=>!R.installed).length;return s?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ke,{size:"lg"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading integrations..."})]})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Integration Library"}),r.jsx("p",{className:"mt-2 text-gray-600",children:"Discover and add integrations to your Frigg app"})]}),r.jsxs(V,{variant:"outline",onClick:P,disabled:S,className:"inline-flex items-center",children:[r.jsx(ol,{size:16,className:Y("mr-2",S&&"animate-spin")}),"Refresh"]})]}),y&&r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 flex items-start",children:[r.jsx(Zt,{size:20,className:"text-red-500 mr-2 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-red-800",children:"Error"}),r.jsx("p",{className:"text-sm text-red-700 mt-1",children:y})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(qi,{size:20,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Search integrations by name, description, or tags...",value:f,onChange:R=>p(R.target.value)})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("select",{value:b,onChange:R=>j(R.target.value),className:"px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:u.map(R=>r.jsx("option",{value:R.id,children:R.name},R.id))}),r.jsxs("div",{className:"flex border border-gray-300 rounded-lg",children:[r.jsx(V,{variant:v==="grid"?"default":"ghost",size:"sm",onClick:()=>h("grid"),className:"rounded-r-none",children:r.jsx(ab,{size:16})}),r.jsx(V,{variant:v==="list"?"default":"ghost",size:"sm",onClick:()=>h("list"),className:"rounded-l-none border-l",children:r.jsx(lb,{size:16})})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(il,{size:20,className:"text-blue-500 mr-2"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-600",children:"Total Available"}),r.jsx("p",{className:"text-xl font-semibold",children:O.length})]})]})}),r.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(bd,{size:20,className:"text-green-500 mr-2"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-600",children:"Installed"}),r.jsx("p",{className:"text-xl font-semibold",children:F})]})]})}),r.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(Wi,{size:20,className:"text-orange-500 mr-2"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-600",children:"Available to Install"}),r.jsx("p",{className:"text-xl font-semibold",children:$})]})]})})]}),F>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center mb-4",children:[r.jsx(bd,{size:20,className:"mr-2 text-green-600"}),r.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:["Installed Integrations (",F,")"]})]}),r.jsx("div",{className:Y(v==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4"),children:O.filter(R=>R.installed).map(R=>r.jsx(yl,{integration:R,onInstall:()=>N(R.name),onUninstall:()=>E(R.name),onUpdate:()=>A(R.name),onConfigure:()=>M(R.name),onTest:()=>_(R.name),installing:R.installing,uninstalling:R.uninstalling,updating:R.updating,error:R.installError,message:R.installMessage,progress:R.installProgress,className:v==="list"?"max-w-none":""},R.name))})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:["Available Integrations (",$,")"]}),$===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(il,{size:48,className:"mx-auto text-gray-300 mb-4"}),r.jsx("p",{className:"text-gray-500",children:f||b!=="all"?"No integrations found matching your criteria":"All available integrations are already installed"}),(f||b!=="all")&&r.jsx(V,{variant:"outline",onClick:()=>{p(""),j("all")},className:"mt-4",children:"Clear Filters"})]}):r.jsx("div",{className:Y(v==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4"),children:O.filter(R=>!R.installed).map(R=>r.jsx(yl,{integration:R,onInstall:()=>N(R.name),installing:R.installing,error:R.installError,message:R.installMessage,progress:R.installProgress,className:v==="list"?"max-w-none":""},R.name))})]})]})},FO=()=>{const{integrationName:e}=dv(),t=uo(),[n,s]=g.useState(!0),[i,o]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState({}),[p,b]=g.useState({}),[j,v]=g.useState(null),[h,m]=g.useState("");g.useEffect(()=>{x()},[e]);const x=async()=>{try{s(!0);const[N,E]=await Promise.all([W.get(`/api/discovery/integrations/${e}`),W.get(`/api/integrations/${e}/config`)]);u(N.data.data),f(E.data.config||{})}catch(N){console.error("Failed to fetch integration details:",N),b({general:"Failed to load integration configuration"})}finally{s(!1)}},y=(N,E)=>{f(A=>({...A,[N]:E})),b(A=>({...A,[N]:""})),m("")},w=()=>{var P,M;const N={},E=(P=c==null?void 0:c.integrationMetadata)==null?void 0:P.authType;return E==="oauth2"?(d.clientId||(N.clientId="Client ID is required"),d.clientSecret||(N.clientSecret="Client Secret is required"),d.redirectUri||(N.redirectUri="Redirect URI is required")):E==="api-key"?d.apiKey||(N.apiKey="API Key is required"):E==="basic"&&(d.username||(N.username="Username is required"),d.password||(N.password="Password is required")),(((M=c==null?void 0:c.integrationMetadata)==null?void 0:M.requiredScopes)||[]).length>0&&(!d.scopes||d.scopes.length===0)&&(N.scopes="Please select at least one scope"),b(N),Object.keys(N).length===0},S=async()=>{var N,E;if(w())try{o(!0),m(""),await W.post(`/api/integrations/${e}/config`,{config:d}),m("Configuration saved successfully!"),setTimeout(()=>{t("/integrations")},2e3)}catch(A){console.error("Failed to save configuration:",A),b({general:((E=(N=A.response)==null?void 0:N.data)==null?void 0:E.message)||"Failed to save configuration"})}finally{o(!1)}},C=async()=>{var N,E,A,P;if(w())try{l(!0),v(null);const M=await W.post(`/api/integrations/${e}/test`,{config:d});v({success:M.data.success,message:M.data.message,details:M.data.details})}catch(M){console.error("Test failed:",M),v({success:!1,message:((E=(N=M.response)==null?void 0:N.data)==null?void 0:E.message)||"Connection test failed",details:(P=(A=M.response)==null?void 0:A.data)==null?void 0:P.details})}finally{l(!1)}},k=()=>{var E;switch((E=c==null?void 0:c.integrationMetadata)==null?void 0:E.authType){case"oauth2":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Client ID"}),r.jsx("input",{type:"text",value:d.clientId||"",onChange:A=>y("clientId",A.target.value),className:Y("w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",p.clientId?"border-red-300":"border-gray-300"),placeholder:"Enter your OAuth2 Client ID"}),p.clientId&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.clientId})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Client Secret"}),r.jsx("input",{type:"password",value:d.clientSecret||"",onChange:A=>y("clientSecret",A.target.value),className:Y("w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",p.clientSecret?"border-red-300":"border-gray-300"),placeholder:"Enter your OAuth2 Client Secret"}),p.clientSecret&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.clientSecret})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Redirect URI"}),r.jsx("input",{type:"url",value:d.redirectUri||"",onChange:A=>y("redirectUri",A.target.value),className:Y("w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",p.redirectUri?"border-red-300":"border-gray-300"),placeholder:"https://your-app.com/auth/callback"}),p.redirectUri&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.redirectUri}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Add this URL to your OAuth app's allowed redirect URIs"})]})]});case"api-key":return r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"API Key"}),r.jsx("input",{type:"password",value:d.apiKey||"",onChange:A=>y("apiKey",A.target.value),className:Y("w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",p.apiKey?"border-red-300":"border-gray-300"),placeholder:"Enter your API key"}),p.apiKey&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.apiKey}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Keep your API key secure and never share it publicly"})]});case"basic":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Username"}),r.jsx("input",{type:"text",value:d.username||"",onChange:A=>y("username",A.target.value),className:Y("w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",p.username?"border-red-300":"border-gray-300"),placeholder:"Enter username"}),p.username&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.username})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),r.jsx("input",{type:"password",value:d.password||"",onChange:A=>y("password",A.target.value),className:Y("w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",p.password?"border-red-300":"border-gray-300"),placeholder:"Enter password"}),p.password&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.password})]})]});default:return r.jsxs("div",{className:"text-gray-500",children:[r.jsx(yT,{size:20,className:"inline mr-2"}),"No authentication configuration required for this integration."]})}},T=()=>{var E;const N=((E=c==null?void 0:c.integrationMetadata)==null?void 0:E.requiredScopes)||[];return N.length===0?null:r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Required Scopes"}),r.jsx("div",{className:"space-y-2",children:N.map(A=>{var P;return r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:((P=d.scopes)==null?void 0:P.includes(A))||!1,onChange:M=>{const _=M.target.checked?[...d.scopes||[],A]:(d.scopes||[]).filter(O=>O!==A);y("scopes",_)},className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),r.jsx("span",{className:"ml-2 text-sm text-gray-700",children:A})]},A)})}),p.scopes&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:p.scopes})]})};return n?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ke,{size:"lg"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading configuration..."})]})}):c?r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center",children:[r.jsxs(V,{variant:"ghost",onClick:()=>t("/integrations"),className:"mr-4",children:[r.jsx(sb,{size:20,className:"mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold text-gray-900",children:["Configure ",c.displayName]}),r.jsx("p",{className:"text-gray-600 mt-1",children:"Set up authentication and connection settings"})]})]})}),p.general&&r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 flex items-start",children:[r.jsx(Zt,{size:20,className:"text-red-500 mr-2 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-red-800",children:"Error"}),r.jsx("p",{className:"text-sm text-red-700 mt-1",children:p.general})]})]}),h&&r.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 flex items-start",children:[r.jsx(rl,{size:20,className:"text-green-500 mr-2 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-green-800",children:"Success"}),r.jsx("p",{className:"text-sm text-green-700 mt-1",children:h})]})]}),r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(bT,{size:20,className:"mr-2"}),"Authentication"]})}),r.jsx(Ct,{className:"space-y-4",children:k()})]}),T()&&r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(um,{size:20,className:"mr-2"}),"Permissions"]})}),r.jsx(Ct,{children:T()})]}),r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(NT,{size:20,className:"mr-2"}),"Connection Settings"]})}),r.jsxs(Ct,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Environment"}),r.jsxs("select",{value:d.environment||"production",onChange:N=>y("environment",N.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"production",children:"Production"}),r.jsx("option",{value:"sandbox",children:"Sandbox"}),r.jsx("option",{value:"development",children:"Development"})]}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Select the environment to connect to"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Webhook URL (Optional)"}),r.jsx("input",{type:"url",value:d.webhookUrl||"",onChange:N=>y("webhookUrl",N.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"https://your-app.com/webhooks/integration"}),r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Endpoint to receive webhook events from this integration"})]})]})]}),j&&r.jsx(B,{className:j.success?"border-green-300":"border-red-300",children:r.jsx(Ct,{className:"p-4",children:r.jsxs("div",{className:"flex items-start",children:[j.success?r.jsx(rl,{size:20,className:"text-green-500 mr-2 flex-shrink-0 mt-0.5"}):r.jsx(Zt,{size:20,className:"text-red-500 mr-2 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:Y("text-sm font-medium",j.success?"text-green-800":"text-red-800"),children:j.success?"Connection Test Passed":"Connection Test Failed"}),r.jsx("p",{className:Y("text-sm mt-1",j.success?"text-green-700":"text-red-700"),children:j.message}),j.details&&r.jsx("pre",{className:"mt-2 text-xs bg-gray-100 p-2 rounded overflow-x-auto",children:JSON.stringify(j.details,null,2)})]})]})})}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx(V,{variant:"outline",onClick:C,disabled:i||a,className:"inline-flex items-center",children:a?r.jsxs(r.Fragment,{children:[r.jsx(Ke,{size:"sm",className:"mr-2"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(YT,{size:16,className:"mr-2"}),"Test Connection"]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(V,{variant:"outline",onClick:()=>t("/integrations"),disabled:i,children:"Cancel"}),r.jsx(V,{onClick:S,disabled:i||a,className:"inline-flex items-center",children:i?r.jsxs(r.Fragment,{children:[r.jsx(Ke,{size:"sm",className:"mr-2"}),"Saving..."]}):r.jsxs(r.Fragment,{children:[r.jsx(VT,{size:16,className:"mr-2"}),"Save Configuration"]})})]})]})]}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Zt,{size:48,className:"mx-auto text-gray-400 mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Integration Not Found"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"The requested integration could not be found."}),r.jsx(V,{onClick:()=>t("/integrations"),children:"Back to Integrations"})]})},$O=()=>{var _;const{integrationName:e}=dv(),t=uo(),[n,s]=g.useState(!0),[i,o]=g.useState(null),[a,l]=g.useState([]),[c,u]=g.useState(null),[d,f]=g.useState({}),[p,b]=g.useState(null),[j,v]=g.useState(!1),[h,m]=g.useState(!1),[x,y]=g.useState([]),[w,S]=g.useState(!1);g.useEffect(()=>{C()},[e]);const C=async()=>{var O;try{s(!0);const[F,$,R]=await Promise.all([W.get(`/api/discovery/integrations/${e}`),W.get(`/api/integrations/${e}/endpoints`),W.get(`/api/integrations/${e}/test-history`)]);o(F.data.data),l($.data.endpoints||[]),y(R.data.history||[]),((O=$.data.endpoints)==null?void 0:O.length)>0&&(u($.data.endpoints[0]),k($.data.endpoints[0]))}catch(F){console.error("Failed to fetch integration data:",F)}finally{s(!1)}},k=O=>{var $;const F={};($=O.parameters)==null||$.forEach(R=>{R.required&&(F[R.name]=R.default||"")}),f(F)},T=O=>{const F=a.find($=>$.id===O);F&&(u(F),k(F),b(null))},N=(O,F)=>{f($=>({...$,[O]:F}))},E=async()=>{var O,F,$,R;if(c)try{v(!0),b(null);const I=await W.post(`/api/integrations/${e}/test-endpoint`,{endpoint:c.id,parameters:d,useMockData:w});b({success:!0,data:I.data.result,timing:I.data.timing,timestamp:new Date().toISOString()}),y(D=>[{endpoint:c.name,timestamp:new Date().toISOString(),success:!0,timing:I.data.timing},...D.slice(0,9)])}catch(I){console.error("Test failed:",I),b({success:!1,error:((F=(O=I.response)==null?void 0:O.data)==null?void 0:F.message)||"Test failed",details:(R=($=I.response)==null?void 0:$.data)==null?void 0:R.details,timestamp:new Date().toISOString()}),y(D=>{var z,K;return[{endpoint:c.name,timestamp:new Date().toISOString(),success:!1,error:(K=(z=I.response)==null?void 0:z.data)==null?void 0:K.message},...D.slice(0,9)]})}finally{v(!1)}},A=O=>{navigator.clipboard.writeText(O),m(!0),setTimeout(()=>m(!1),2e3)},P=()=>{if(!c)return"";const O=Object.entries(d).map(([F,$])=>` ${F}: '${$}'`).join(`,
387
- `);return`// ${c.name}
388
- const result = await frigg.integration('${e}')
389
- .${c.method}('${c.path}', {
390
- ${O}
391
- });
392
-
393
- console.log(result);`},M=O=>{var $;const F=d[O.name]||"";switch(O.type){case"boolean":return r.jsxs("select",{value:F,onChange:R=>N(O.name,R.target.value==="true"),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"false",children:"false"}),r.jsx("option",{value:"true",children:"true"})]});case"number":return r.jsx("input",{type:"number",value:F,onChange:R=>N(O.name,parseInt(R.target.value,10)),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:O.placeholder||`Enter ${O.name}`});case"select":return r.jsxs("select",{value:F,onChange:R=>N(O.name,R.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsxs("option",{value:"",children:["Select ",O.name]}),($=O.options)==null?void 0:$.map(R=>r.jsx("option",{value:R.value,children:R.label},R.value))]});default:return r.jsx("input",{type:"text",value:F,onChange:R=>N(O.name,R.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:O.placeholder||`Enter ${O.name}`})}};return n?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ke,{size:"lg"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading test interface..."})]})}):r.jsxs("div",{className:"max-w-6xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsxs(V,{variant:"ghost",onClick:()=>t("/integrations"),className:"mr-4",children:[r.jsx(sb,{size:20,className:"mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold text-gray-900",children:["Test ",i==null?void 0:i.displayName]}),r.jsx("p",{className:"text-gray-600 mt-1",children:"Test API endpoints and validate responses"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:w,onChange:O=>S(O.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),r.jsx("span",{className:"ml-2 text-sm text-gray-700",children:"Use Mock Data"})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(oT,{size:20,className:"mr-2"}),"Select Endpoint"]})}),r.jsxs(Ct,{children:[r.jsxs("select",{value:(c==null?void 0:c.id)||"",onChange:O=>T(O.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:"Select an endpoint to test"}),a.map(O=>r.jsxs("option",{value:O.id,children:[O.method.toUpperCase()," ",O.path," - ",O.name]},O.id))]}),c&&r.jsxs("div",{className:"mt-4 p-3 bg-gray-50 rounded-lg",children:[r.jsx("p",{className:"text-sm text-gray-600",children:c.description}),r.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-gray-500",children:[r.jsx("span",{className:Y("px-2 py-1 rounded font-medium",c.method==="get"&&"bg-blue-100 text-blue-700",c.method==="post"&&"bg-green-100 text-green-700",c.method==="put"&&"bg-yellow-100 text-yellow-700",c.method==="delete"&&"bg-red-100 text-red-700"),children:c.method.toUpperCase()}),r.jsx("span",{className:"font-mono",children:c.path})]})]})]})]}),c&&((_=c.parameters)==null?void 0:_.length)>0&&r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(Settings,{size:20,className:"mr-2"}),"Parameters"]})}),r.jsx(Ct,{className:"space-y-4",children:c.parameters.map(O=>r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[O.label||O.name,O.required&&r.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),M(O),O.description&&r.jsx("p",{className:"mt-1 text-xs text-gray-500",children:O.description})]},O.name))})]}),r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center",children:[r.jsx(Hi,{size:20,className:"mr-2"}),"Code Example"]}),r.jsx(V,{size:"sm",variant:"ghost",onClick:()=>A(P()),className:"text-xs",children:h?r.jsxs(r.Fragment,{children:[r.jsx(lm,{size:14,className:"mr-1"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Qp,{size:14,className:"mr-1"}),"Copy"]})})]})}),r.jsx(Ct,{children:r.jsx("pre",{className:"text-xs bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:r.jsx("code",{children:P()})})})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(B,{children:r.jsx(Ct,{className:"p-4",children:r.jsx(V,{onClick:E,disabled:!c||j,className:"w-full inline-flex items-center justify-center",children:j?r.jsxs(r.Fragment,{children:[r.jsx(Ke,{size:"sm",className:"mr-2"}),"Running Test..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ub,{size:16,className:"mr-2"}),"Run Test"]})})})}),p&&r.jsxs(B,{className:p.success?"border-green-300":"border-red-300",children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center justify-between",children:[r.jsx("span",{className:"flex items-center",children:p.success?r.jsxs(r.Fragment,{children:[r.jsx(CheckCircle,{size:20,className:"text-green-500 mr-2"}),"Test Passed"]}):r.jsxs(r.Fragment,{children:[r.jsx(Zt,{size:20,className:"text-red-500 mr-2"}),"Test Failed"]})}),p.timing&&r.jsxs("span",{className:"text-sm text-gray-500",children:[p.timing,"ms"]})]})}),r.jsxs(Ct,{children:[p.error&&r.jsxs("div",{className:"mb-4 p-3 bg-red-50 rounded-lg",children:[r.jsx("p",{className:"text-sm text-red-700",children:p.error}),p.details&&r.jsx("pre",{className:"mt-2 text-xs text-red-600 overflow-x-auto",children:JSON.stringify(p.details,null,2)})]}),p.data&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Response Data"}),r.jsxs(V,{size:"sm",variant:"ghost",onClick:()=>A(JSON.stringify(p.data,null,2)),className:"text-xs",children:[r.jsx(Qp,{size:12,className:"mr-1"}),"Copy"]})]}),r.jsx("pre",{className:"text-xs bg-gray-100 p-3 rounded-lg overflow-x-auto max-h-96",children:JSON.stringify(p.data,null,2)})]})]})]}),r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(Wi,{size:20,className:"mr-2"}),"Recent Tests"]})}),r.jsx(Ct,{children:x.length===0?r.jsx("p",{className:"text-sm text-gray-500",children:"No test history yet"}):r.jsx("div",{className:"space-y-2",children:x.map((O,F)=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[r.jsxs("div",{className:"flex items-center",children:[O.success?r.jsx(CheckCircle,{size:16,className:"text-green-500 mr-2"}):r.jsx(Zt,{size:16,className:"text-red-500 mr-2"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:O.endpoint}),r.jsx("p",{className:"text-xs text-gray-500",children:new Date(O.timestamp).toLocaleTimeString()})]})]}),O.timing&&r.jsxs("span",{className:"text-xs text-gray-500",children:[O.timing,"ms"]})]},F))})})]})]})]})]})},UO=({variables:e=[],environment:t="local",onSave:n,onVariableUpdate:s,onVariableDelete:i,readOnly:o=!1})=>{const[a,l]=g.useState(""),[c,u]=g.useState(!1),[d,f]=g.useState([]),[p,b]=g.useState(!1),[j,v]=g.useState(""),[h,m]=g.useState(new Set),x=g.useRef(null),{on:y}=an(),w=g.useCallback(M=>{let _=`# Environment: ${t}
394
- `;return _+=`# Generated at: ${new Date().toISOString()}
395
-
396
- `,[...M].sort((F,$)=>F.key.localeCompare($.key)).forEach(F=>{F.description&&(_+=`# ${F.description}
397
- `);let $=F.value;F.isSecret&&!p&&($="***MASKED***"),_+=`${F.key}=${$}
398
-
399
- `}),_.trim()},[t,p]),S=g.useCallback(M=>{const _=M.split(`
400
- `),O=[];let F="";const $=[];return _.forEach((R,I)=>{const D=R.trim();if(!D)return;if(D.startsWith("#")){if(D.includes("Environment:")||D.includes("Generated at:"))return;F=D.substring(1).trim();return}const z=D.indexOf("=");if(z>0){const K=D.substring(0,z).trim();let se=D.substring(z+1).trim();if((se.startsWith('"')&&se.endsWith('"')||se.startsWith("'")&&se.endsWith("'"))&&(se=se.slice(1,-1)),/^[A-Z_][A-Z0-9_]*$/i.test(K)||$.push({line:I+1,message:`Invalid variable name format: ${K}`}),se==="***MASKED***"){const ve=e.find(yt=>yt.key===K);ve&&(se=ve.value)}O.push({key:K,value:se,description:F,isSecret:C(K),line:I+1}),F=""}else D&&$.push({line:I+1,message:`Invalid line format: ${D}`})}),{variables:O,errors:$}},[e]),C=M=>["PASSWORD","SECRET","KEY","TOKEN","PRIVATE","CREDENTIAL"].some(O=>M.toUpperCase().includes(O));g.useEffect(()=>{l(w(e)),u(!1)},[e,w]),g.useEffect(()=>y("env-update",_=>{_.environment===t&&(c||l(w(e)))}),[y,t,c,e,w]);const k=M=>{const _=M.target.value;l(_),u(!0);const{errors:O}=S(_);f(O)},T=async()=>{const{variables:M,errors:_}=S(a);if(_.length>0){f(_);return}try{await n(M),u(!1),f([])}catch(O){f([{message:O.message}])}},N=(M,_)=>{if(_.ctrlKey||_.metaKey){const O=new Set(h);O.has(M)?O.delete(M):O.add(M),m(O)}},E=()=>j?a.split(`
401
- `).filter(O=>{const F=O.trim();return!F||F.startsWith("#")?!0:F.toLowerCase().includes(j.toLowerCase())}).join(`
402
- `):a,A=()=>{const _=a.split(`
403
- `).filter((O,F)=>h.has(F+1));navigator.clipboard.writeText(_.join(`
404
- `))},P=M=>{const O={database:`# Database Configuration
405
- DATABASE_URL=postgresql://user:password@localhost:5432/dbname
406
- DATABASE_POOL_SIZE=20
407
- DATABASE_SSL=true`,redis:`# Redis Configuration
408
- REDIS_URL=redis://localhost:6379
409
- REDIS_PASSWORD=
410
- REDIS_DB=0`,aws:`# AWS Configuration
411
- AWS_ACCESS_KEY_ID=
412
- AWS_SECRET_ACCESS_KEY=
413
- AWS_REGION=us-east-1
414
- AWS_BUCKET_NAME=`,api:`# API Configuration
415
- API_BASE_URL=https://api.example.com
416
- API_KEY=
417
- API_SECRET=
418
- API_TIMEOUT=30000`}[M];O&&(l(a+`
419
-
420
- `+O),u(!0))};return r.jsxs("div",{className:"environment-editor",children:[r.jsxs("div",{className:"bg-muted border-b border-border p-2 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("button",{onClick:T,disabled:!c||o,className:`px-3 py-1 rounded text-sm font-medium ${c&&!o?"bg-green-600 text-white hover:bg-green-700":"bg-muted text-muted-foreground cursor-not-allowed"}`,children:c?"Save Changes":"Saved"}),c&&r.jsx("button",{onClick:()=>{l(w(e)),u(!1),f([])},className:"px-3 py-1 rounded text-sm font-medium bg-secondary text-secondary-foreground hover:bg-secondary/80",children:"Revert"}),r.jsxs("button",{onClick:()=>b(!p),className:"px-3 py-1 rounded text-sm font-medium bg-gray-200 text-gray-700 hover:bg-gray-300 flex items-center",children:[r.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p?r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}):r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}),p?"Hide":"Show"," Secrets"]}),r.jsxs("div",{className:"relative group",children:[r.jsx("button",{className:"px-3 py-1 rounded text-sm font-medium bg-gray-200 text-gray-700 hover:bg-gray-300",children:"Insert Template ▼"}),r.jsxs("div",{className:"absolute left-0 mt-1 w-48 bg-popover border border-border rounded shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-10",children:[r.jsx("button",{onClick:()=>P("database"),className:"block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground",children:"Database Config"}),r.jsx("button",{onClick:()=>P("redis"),className:"block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground",children:"Redis Config"}),r.jsx("button",{onClick:()=>P("aws"),className:"block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground",children:"AWS Config"}),r.jsx("button",{onClick:()=>P("api"),className:"block w-full text-left px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground",children:"API Config"})]})]}),h.size>0&&r.jsxs("button",{onClick:A,className:"px-3 py-1 rounded text-sm font-medium bg-blue-600 text-white hover:bg-blue-700",children:["Copy ",h.size," Selected"]})]}),r.jsx("div",{className:"flex items-center",children:r.jsx("input",{type:"text",placeholder:"Search variables...",value:j,onChange:M=>v(M.target.value),className:"px-3 py-1 border border-input bg-background text-foreground rounded text-sm focus:outline-none focus:border-ring focus:ring-1 focus:ring-ring"})})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-12 bg-muted/50 border-r border-border select-none",children:a.split(`
421
- `).map((M,_)=>r.jsx("div",{onClick:O=>N(_+1,O),className:`px-2 text-right text-xs text-muted-foreground leading-6 cursor-pointer hover:bg-accent hover:text-accent-foreground ${h.has(_+1)?"bg-primary/20 text-primary":""}`,children:_+1},_))}),r.jsx("textarea",{ref:x,value:j?E():a,onChange:k,readOnly:o||j,className:"w-full h-96 pl-14 pr-4 py-2 font-mono text-sm leading-6 resize-none focus:outline-none bg-background text-foreground",spellCheck:!1,style:{tabSize:2}}),d.length>0&&r.jsxs("div",{className:"absolute right-2 top-2 bg-destructive/10 border border-destructive/20 rounded p-2 max-w-xs",children:[r.jsx("h4",{className:"text-sm font-medium text-destructive mb-1",children:"Validation Errors:"}),r.jsx("ul",{className:"text-xs text-destructive/80 space-y-1",children:d.map((M,_)=>r.jsxs("li",{children:[M.line&&`Line ${M.line}: `,M.message]},_))})]})]}),r.jsxs("div",{className:"bg-gray-100 border-t border-gray-300 px-3 py-1 flex items-center justify-between text-xs text-gray-600",children:[r.jsxs("div",{children:[e.length," variables • ",t," environment"]}),r.jsxs("div",{className:"flex items-center space-x-4",children:[c&&r.jsx("span",{className:"text-orange-600",children:"● Modified"}),d.length>0&&r.jsxs("span",{className:"text-red-600",children:[d.length," errors"]})]})]})]})},zO=({variables:e=[],onSchemaUpdate:t,environment:n="local"})=>{const[s,i]=g.useState({required:[],types:{},patterns:{},defaults:{},descriptions:{}}),[o,a]=g.useState(!1),[l,c]=g.useState({key:"",type:"string",required:!1,pattern:"",default:"",description:""}),u={url:"^https?://[\\w\\-]+(\\.[\\w\\-]+)+[/#?]?.*$",email:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",port:"^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$",ipAddress:"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$",uuid:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",alphanumeric:"^[a-zA-Z0-9]+$",boolean:"^(true|false|TRUE|FALSE|True|False|1|0|yes|no|YES|NO|Yes|No)$"},d={string:{name:"String",validator:()=>!0},number:{name:"Number",validator:h=>!isNaN(h)},boolean:{name:"Boolean",validator:h=>/^(true|false|1|0)$/i.test(h)},url:{name:"URL",validator:h=>/^https?:\/\/.+/.test(h)},email:{name:"Email",validator:h=>/^.+@.+\..+$/.test(h)},port:{name:"Port",validator:h=>!isNaN(h)&&h>=1&&h<=65535},json:{name:"JSON",validator:h=>{try{return JSON.parse(h),!0}catch{return!1}}},base64:{name:"Base64",validator:h=>/^[A-Za-z0-9+/]+=*$/.test(h)}};g.useEffect(()=>{const h=localStorage.getItem(`env-schema-${n}`);h&&i(JSON.parse(h))},[n]);const f=h=>{i(h),localStorage.setItem(`env-schema-${n}`,JSON.stringify(h)),t&&t(h)},p=()=>{if(!l.key)return;const h={...s};l.required&&(h.required=[...new Set([...h.required,l.key])]),l.type&&l.type!=="string"&&(h.types[l.key]=l.type),l.pattern&&(h.patterns[l.key]=l.pattern),l.default&&(h.defaults[l.key]=l.default),l.description&&(h.descriptions[l.key]=l.description),f(h),a(!1),c({key:"",type:"string",required:!1,pattern:"",default:"",description:""})},b=h=>{const m={required:s.required.filter(x=>x!==h),types:{...s.types},patterns:{...s.patterns},defaults:{...s.defaults},descriptions:{...s.descriptions}};delete m.types[h],delete m.patterns[h],delete m.defaults[h],delete m.descriptions[h],f(m)},v=(()=>{const h={valid:!0,errors:[],warnings:[]};return s.required.forEach(m=>{const x=e.find(y=>y.key===m);(!x||!x.value)&&(h.valid=!1,h.errors.push({key:m,type:"missing",message:`Required variable ${m} is missing or empty`}))}),e.forEach(m=>{const{key:x,value:y}=m,w=s.types[x];w&&d[w]&&(d[w].validator(y)||(h.valid=!1,h.errors.push({key:x,type:"type",message:`${x} should be of type ${w}`})));const S=s.patterns[x];if(S&&y)try{new RegExp(S).test(y)||(h.valid=!1,h.errors.push({key:x,type:"pattern",message:`${x} does not match required pattern`}))}catch{h.warnings.push({key:x,type:"pattern",message:`Invalid pattern for ${x}`})}!s.required.includes(x)&&!s.types[x]&&!s.patterns[x]&&!s.descriptions[x]&&h.warnings.push({key:x,type:"untracked",message:`${x} has no validation rules defined`})}),h})();return r.jsxs("div",{className:"environment-schema bg-white rounded-lg shadow",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Environment Schema"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Define validation rules and requirements for environment variables"})]}),r.jsx("div",{className:"p-4 border-b border-gray-200",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[v.valid?r.jsxs("div",{className:"flex items-center text-green-600",children:[r.jsx("svg",{className:"w-5 h-5 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),r.jsx("span",{className:"font-medium",children:"Schema Valid"})]}):r.jsxs("div",{className:"flex items-center text-red-600",children:[r.jsx("svg",{className:"w-5 h-5 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),r.jsxs("span",{className:"font-medium",children:[v.errors.length," Errors"]})]}),v.warnings.length>0&&r.jsxs("div",{className:"flex items-center text-yellow-600",children:[r.jsx("svg",{className:"w-5 h-5 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),r.jsxs("span",{className:"font-medium",children:[v.warnings.length," Warnings"]})]})]}),r.jsx("button",{onClick:()=>a(!o),className:"px-3 py-1 bg-blue-600 text-white rounded text-sm font-medium hover:bg-blue-700",children:"Add Rule"})]})}),o&&r.jsx("div",{className:"p-4 bg-gray-50 border-b border-gray-200",children:r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Variable Name"}),r.jsx("input",{type:"text",value:l.key,onChange:h=>c({...l,key:h.target.value.toUpperCase()}),placeholder:"DATABASE_URL",className:"w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),r.jsx("select",{value:l.type,onChange:h=>c({...l,type:h.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500",children:Object.entries(d).map(([h,{name:m}])=>r.jsx("option",{value:h,children:m},h))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Pattern (RegEx)"}),r.jsxs("div",{className:"flex",children:[r.jsx("input",{type:"text",value:l.pattern,onChange:h=>c({...l,pattern:h.target.value}),placeholder:"^[A-Za-z0-9]+$",className:"flex-1 px-3 py-2 border border-gray-300 rounded-l focus:outline-none focus:border-blue-500"}),r.jsxs("select",{onChange:h=>c({...l,pattern:h.target.value}),className:"px-2 border-t border-r border-b border-gray-300 rounded-r bg-gray-50",children:[r.jsx("option",{value:"",children:"Presets"}),Object.entries(u).map(([h,m])=>r.jsx("option",{value:m,children:h},h))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Default Value"}),r.jsx("input",{type:"text",value:l.default,onChange:h=>c({...l,default:h.target.value}),placeholder:"Default value",className:"w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500"})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Description"}),r.jsx("input",{type:"text",value:l.description,onChange:h=>c({...l,description:h.target.value}),placeholder:"Describe the purpose of this variable",className:"w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:border-blue-500"})]}),r.jsxs("div",{className:"col-span-2 flex items-center justify-between",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:l.required,onChange:h=>c({...l,required:h.target.checked}),className:"mr-2"}),r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Required Variable"})]}),r.jsxs("div",{className:"space-x-2",children:[r.jsx("button",{onClick:()=>a(!1),className:"px-3 py-1 text-gray-600 hover:text-gray-800",children:"Cancel"}),r.jsx("button",{onClick:p,className:"px-3 py-1 bg-green-600 text-white rounded text-sm font-medium hover:bg-green-700",children:"Add Rule"})]})]})]})}),r.jsx("div",{className:"divide-y divide-gray-200",children:Object.keys({...s.types,...s.patterns,...s.defaults,...s.descriptions}).filter((h,m,x)=>x.indexOf(h)===m).map(h=>{var m;return r.jsx("div",{className:"p-4 hover:bg-gray-50",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("code",{className:"text-sm font-mono font-medium text-gray-900",children:h}),s.required.includes(h)&&r.jsx("span",{className:"ml-2 px-2 py-0.5 text-xs bg-red-100 text-red-800 rounded",children:"Required"}),s.types[h]&&r.jsx("span",{className:"ml-2 px-2 py-0.5 text-xs bg-blue-100 text-blue-800 rounded",children:((m=d[s.types[h]])==null?void 0:m.name)||s.types[h]})]}),s.descriptions[h]&&r.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s.descriptions[h]}),r.jsxs("div",{className:"mt-2 space-y-1",children:[s.patterns[h]&&r.jsxs("div",{className:"text-xs text-gray-500",children:["Pattern: ",r.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:s.patterns[h]})]}),s.defaults[h]&&r.jsxs("div",{className:"text-xs text-gray-500",children:["Default: ",r.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:s.defaults[h]})]})]}),(()=>{const x=v.errors.find(S=>S.key===h),y=v.warnings.find(S=>S.key===h),w=e.find(S=>S.key===h);return x?r.jsxs("div",{className:"mt-2 text-xs text-red-600 flex items-center",children:[r.jsx("svg",{className:"w-4 h-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),x.message]}):y?r.jsxs("div",{className:"mt-2 text-xs text-yellow-600 flex items-center",children:[r.jsx("svg",{className:"w-4 h-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),y.message]}):w?r.jsxs("div",{className:"mt-2 text-xs text-green-600 flex items-center",children:[r.jsx("svg",{className:"w-4 h-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Valid"]}):null})()]}),r.jsx("button",{onClick:()=>b(h),className:"ml-4 text-gray-400 hover:text-red-600",children:r.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})})})]})},h)})}),r.jsxs("div",{className:"p-4 bg-gray-50 border-t border-gray-200 flex justify-end space-x-2",children:[r.jsx("button",{onClick:()=>{const h=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),m=URL.createObjectURL(h),x=document.createElement("a");x.href=m,x.download=`${n}-schema.json`,x.click(),URL.revokeObjectURL(m)},className:"px-3 py-1 text-sm text-gray-600 hover:text-gray-800",children:"Export Schema"}),r.jsxs("label",{className:"px-3 py-1 text-sm text-gray-600 hover:text-gray-800 cursor-pointer",children:["Import Schema",r.jsx("input",{type:"file",accept:".json",onChange:h=>{const m=h.target.files[0];if(m){const x=new FileReader;x.onload=y=>{try{const w=JSON.parse(y.target.result);f(w)}catch{alert("Invalid schema file")}},x.readAsText(m)}},className:"hidden"})]})]})]})},VO=({onSync:e})=>{const[t,n]=g.useState({local:[],staging:[],production:[]}),[s,i]=g.useState(!0),[o,a]=g.useState("side-by-side"),[l,c]=g.useState(["local","staging"]),[u,d]=g.useState(null),[f,p]=g.useState(new Set),[b,j]=g.useState(!1);g.useEffect(()=>{v()},[]);const v=async()=>{i(!0);try{const[N,E,A]=await Promise.all([W.get("/api/environment/variables/local"),W.get("/api/environment/variables/staging"),W.get("/api/environment/variables/production")]);n({local:N.data.variables||[],staging:E.data.variables||[],production:A.data.variables||[]})}catch(N){console.error("Error loading environments:",N)}finally{i(!1)}},h=()=>{const N=new Set;return l.forEach(E=>{t[E].forEach(A=>{N.add(A.key)})}),Array.from(N).sort()},m=N=>{const E=l.map(A=>{const P=t[A].find(M=>M.key===N);return P?P.value:void 0});return new Set(E).size>1},x=(N,E)=>{const A=t[N].find(P=>P.key===E);return A?A.value:null},y=N=>{const E=new Set(f);E.has(N)?E.delete(N):E.add(N),p(E)},w=async()=>{if(!u||f.size===0)return;const[N,E]=u.split("->"),A=[];f.forEach(P=>{const M=t[N].find(_=>_.key===P);M&&A.push({key:M.key,value:M.value,description:M.description||""})});try{await W.put(`/api/environment/variables/${E}`,{variables:A}),e&&e({source:N,target:E,count:A.length}),await v(),p(new Set),d(null)}catch(P){console.error("Error syncing variables:",P)}},S=async(N,E)=>{try{if(!window.confirm(`Are you sure you want to copy all variables from ${N} to ${E}? This will overwrite existing values.`))return;await W.post("/api/environment/copy",{source:N,target:E,excludeSecrets:!1}),await v()}catch(A){console.error("Error copying environment:",A)}},C=()=>{const N=h(),E={timestamp:new Date().toISOString(),environments:l,variables:{}};N.forEach(_=>{E.variables[_]={},l.forEach(O=>{const F=t[O].find($=>$.key===_);E.variables[_][O]=F?{value:F.value,exists:!0}:{value:null,exists:!1}})});const A=new Blob([JSON.stringify(E,null,2)],{type:"application/json"}),P=URL.createObjectURL(A),M=document.createElement("a");M.href=P,M.download=`environment-comparison-${Date.now()}.json`,M.click(),URL.revokeObjectURL(P)};if(s)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"text-gray-500",children:"Loading environments..."})});const k=h(),T=b?k.filter(N=>m(N)):k;return r.jsxs("div",{className:"environment-compare",children:[r.jsxs("div",{className:"bg-white rounded-lg shadow p-4 mb-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Compare:"}),["local","staging","production"].map(N=>r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:l.includes(N),onChange:E=>{E.target.checked?c([...l,N]):c(l.filter(A=>A!==N))},disabled:l.length===1&&l.includes(N),className:"mr-1"}),r.jsx("span",{className:"text-sm capitalize",children:N})]},N))]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"View:"}),r.jsxs("select",{value:o,onChange:N=>a(N.target.value),className:"text-sm border border-gray-300 rounded px-2 py-1",children:[r.jsx("option",{value:"side-by-side",children:"Side by Side"}),r.jsx("option",{value:"diff",children:"Differences Only"}),r.jsx("option",{value:"missing",children:"Missing Variables"})]})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:b,onChange:N=>j(N.target.checked),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"Show only differences"})]})]}),r.jsx("button",{onClick:C,className:"px-3 py-1 text-sm bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Export Report"})]}),l.length===2&&r.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Sync Direction:"}),r.jsxs("select",{value:u||"",onChange:N=>d(N.target.value),className:"text-sm border border-gray-300 rounded px-2 py-1",children:[r.jsx("option",{value:"",children:"Select direction"}),r.jsxs("option",{value:`${l[0]}->${l[1]}`,children:[l[0]," → ",l[1]]}),r.jsxs("option",{value:`${l[1]}->${l[0]}`,children:[l[1]," → ",l[0]]})]}),f.size>0&&r.jsxs("span",{className:"text-sm text-gray-500",children:[f.size," variable",f.size>1?"s":""," selected"]})]}),r.jsxs("div",{className:"space-x-2",children:[r.jsx("button",{onClick:()=>S(...u.split("->")),disabled:!u,className:"px-3 py-1 text-sm bg-yellow-600 text-white rounded hover:bg-yellow-700 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Copy All"}),r.jsx("button",{onClick:w,disabled:!u||f.size===0,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Sync Selected"})]})]})})]}),r.jsx("div",{className:"bg-white rounded-lg shadow overflow-hidden",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[u&&r.jsx("th",{className:"px-3 py-3 text-left",children:r.jsx("input",{type:"checkbox",checked:f.size===T.length,onChange:N=>{N.target.checked?p(new Set(T)):p(new Set)}})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Variable"}),l.map(N=>r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:N},N)),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:T.map(N=>{const E=m(N),A=l.map(M=>x(M,N)),P=A.filter(M=>M===null).length;return o==="diff"&&!E||o==="missing"&&P===0?null:r.jsxs("tr",{className:E?"bg-yellow-50":"",children:[u&&r.jsx("td",{className:"px-3 py-4",children:r.jsx("input",{type:"checkbox",checked:f.has(N),onChange:()=>y(N)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("code",{className:"text-sm font-mono text-gray-900",children:N})}),l.map((M,_)=>{const O=A[_],F=t[M].find(R=>R.key===N),$=F==null?void 0:F.isSecret;return r.jsx("td",{className:"px-6 py-4",children:O===null?r.jsx("span",{className:"text-gray-400 italic",children:"Not set"}):r.jsx("code",{className:`text-sm font-mono ${$?"text-gray-400":"text-gray-600"} break-all`,children:$?"•••••••":O})},M)}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[E&&r.jsx("span",{className:"px-2 py-1 text-xs bg-yellow-100 text-yellow-800 rounded",children:"Different"}),P>0&&r.jsxs("span",{className:"px-2 py-1 text-xs bg-red-100 text-red-800 rounded ml-1",children:["Missing in ",P]}),!E&&P===0&&r.jsx("span",{className:"px-2 py-1 text-xs bg-green-100 text-green-800 rounded",children:"Synchronized"})]})]},N)})})]})})]})},BO=({environment:e="local",onImport:t,onExport:n})=>{const[s,i]=g.useState(""),[o,a]=g.useState("env"),[l,c]=g.useState(null),[u,d]=g.useState([]),[f,p]=g.useState({format:"env",excludeSecrets:!1,includeDescriptions:!0}),[b,j]=g.useState(!1),[v,h]=g.useState(!1),m=g.useRef(null),x=(N,E)=>{const A=[],P=[];try{if(E==="json"){const M=typeof N=="string"?JSON.parse(N):N;if(typeof M!="object")return A.push({message:"Invalid JSON format"}),{variables:P,errors:A};Object.entries(M).forEach(([_,O])=>{if(typeof _!="string"){A.push({message:`Invalid key: ${_}`});return}P.push({key:_.toUpperCase(),value:String(O),isSecret:y(_)})})}else{const M=N.split(`
422
- `);let _="";M.forEach((O,F)=>{const $=O.trim();if(!$)return;if($.startsWith("#")){_=$.substring(1).trim();return}const R=$.indexOf("=");if(R>0){const I=$.substring(0,R).trim();let D=$.substring(R+1).trim();if((D.startsWith('"')&&D.endsWith('"')||D.startsWith("'")&&D.endsWith("'"))&&(D=D.slice(1,-1)),!/^[A-Z_][A-Z0-9_]*$/i.test(I)){A.push({line:F+1,message:`Invalid variable name: ${I}`});return}P.push({key:I.toUpperCase(),value:D,description:_,isSecret:y(I),line:F+1}),_=""}else A.push({line:F+1,message:`Invalid line format: ${$}`})})}}catch(M){A.push({message:M.message})}return{variables:P,errors:A}},y=N=>["PASSWORD","SECRET","KEY","TOKEN","PRIVATE","CREDENTIAL"].some(A=>N.toUpperCase().includes(A)),w=N=>{N.preventDefault(),N.stopPropagation(),h(!1);const E=N.dataTransfer.files[0];E&&S(E)},S=N=>{const E=new FileReader;E.onload=A=>{const P=A.target.result;i(P);const M=N.name.endsWith(".json")?"json":"env";a(M);const{variables:_,errors:O}=x(P,M);c(_),d(O)},E.readAsText(N)},C=N=>{const E=N.target.value;if(i(E),E){const{variables:A,errors:P}=x(E,o);c(A),d(P)}else c(null),d([])},k=async()=>{var N,E;if(!(!l||l.length===0)){j(!0);try{const A=await W.post(`/api/environment/import/${e}`,{data:s,format:o,merge:!0});t&&t({imported:A.data.imported,total:A.data.total}),i(""),c(null),d([])}catch(A){console.error("Import error:",A),d([{message:((E=(N=A.response)==null?void 0:N.data)==null?void 0:E.message)||A.message}])}finally{j(!1)}}},T=async()=>{try{const N=new URLSearchParams({format:f.format,excludeSecrets:f.excludeSecrets}),E=await W.get(`/api/environment/export/${e}?${N}`,{responseType:"blob"}),A=window.URL.createObjectURL(new Blob([E.data])),P=document.createElement("a");P.href=A;const M=f.format==="json"?`${e}-env.json`:e==="local"?".env":`.env.${e}`;P.setAttribute("download",M),document.body.appendChild(P),P.click(),P.remove(),n&&n({format:f.format})}catch(N){console.error("Export error:",N)}};return r.jsxs("div",{className:"environment-import-export",children:[r.jsxs("div",{className:"bg-white rounded-lg shadow mb-6",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Import Variables"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Import environment variables from .env or JSON files"})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Import Format"}),r.jsxs("div",{className:"flex space-x-4",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"radio",value:"env",checked:o==="env",onChange:N=>a(N.target.value),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:".env format"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"radio",value:"json",checked:o==="json",onChange:N=>a(N.target.value),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"JSON format"})]})]})]}),r.jsxs("div",{onDrop:w,onDragOver:N=>{N.preventDefault(),h(!0)},onDragLeave:()=>h(!1),className:`border-2 border-dashed rounded-lg p-6 text-center mb-4 transition-colors ${v?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"}`,children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 48 48",children:r.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),r.jsxs("p",{className:"mt-2 text-sm text-gray-600",children:["Drop a file here, or"," ",r.jsx("button",{onClick:()=>{var N;return(N=m.current)==null?void 0:N.click()},className:"text-blue-600 hover:text-blue-500",children:"browse"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Supports .env and .json files"}),r.jsx("input",{ref:m,type:"file",accept:".env,.json",onChange:N=>N.target.files[0]&&S(N.target.files[0]),className:"hidden"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Or paste content directly:"}),r.jsx("textarea",{value:s,onChange:C,placeholder:o==="json"?`{
423
- "API_KEY": "your-api-key",
424
- "DATABASE_URL": "postgresql://..."
425
- }`:`# Database configuration
426
- DATABASE_URL=postgresql://...
427
-
428
- # API settings
429
- API_KEY=your-api-key`,className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-md font-mono text-sm focus:outline-none focus:border-blue-500"})]}),u.length>0&&r.jsxs("div",{className:"mb-4 bg-red-50 border border-red-200 rounded p-3",children:[r.jsx("h4",{className:"text-sm font-medium text-red-800 mb-2",children:"Import Errors:"}),r.jsx("ul",{className:"text-sm text-red-600 space-y-1",children:u.map((N,E)=>r.jsxs("li",{children:[N.line&&`Line ${N.line}: `,N.message]},E))})]}),l&&l.length>0&&r.jsxs("div",{className:"mb-4",children:[r.jsxs("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:["Preview (",l.length," variables)"]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border border-gray-200 rounded",children:r.jsxs("table",{className:"min-w-full text-sm",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Key"}),r.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Value"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-200",children:l.map((N,E)=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-3 py-2 font-mono text-gray-900",children:N.key}),r.jsx("td",{className:"px-3 py-2 font-mono text-gray-600 truncate max-w-xs",children:N.isSecret?"•••••••":N.value})]},E))})]})})]}),r.jsx("button",{onClick:k,disabled:!l||l.length===0||u.length>0||b,className:`w-full py-2 px-4 rounded font-medium ${l&&l.length>0&&u.length===0?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed"}`,children:b?"Importing...":`Import ${(l==null?void 0:l.length)||0} Variables`})]})]}),r.jsxs("div",{className:"bg-white rounded-lg shadow",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Export Variables"}),r.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Export current environment variables to a file"})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs("div",{className:"space-y-4 mb-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Export Format"}),r.jsxs("div",{className:"flex space-x-4",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"radio",value:"env",checked:f.format==="env",onChange:N=>p({...f,format:N.target.value}),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:".env format"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"radio",value:"json",checked:f.format==="json",onChange:N=>p({...f,format:N.target.value}),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"JSON format"})]})]})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:f.excludeSecrets,onChange:N=>p({...f,excludeSecrets:N.target.checked}),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"Exclude secret values (replace with **REDACTED**)"})]}),f.format==="env"&&r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:f.includeDescriptions,onChange:N=>p({...f,includeDescriptions:N.target.checked}),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"Include variable descriptions as comments"})]})]}),r.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded p-3 mb-4",children:r.jsxs("div",{className:"flex",children:[r.jsx("svg",{className:"h-5 w-5 text-blue-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),r.jsxs("div",{className:"text-sm text-blue-700",children:[r.jsx("p",{children:"Export will create a file named:"}),r.jsx("code",{className:"font-mono",children:f.format==="json"?`${e}-env.json`:e==="local"?".env":`.env.${e}`})]})]})}),r.jsx("button",{onClick:T,className:"w-full py-2 px-4 bg-green-600 text-white rounded font-medium hover:bg-green-700",children:"Export Variables"})]})]})]})},WO=({environment:e="local"})=>{const[t,n]=g.useState({maskingEnabled:!0,encryptionEnabled:!1,auditLoggingEnabled:!0,accessControl:{enabled:!1,defaultPermission:"read",rules:[]}}),[s,i]=g.useState([{pattern:"PASSWORD",enabled:!0},{pattern:"SECRET",enabled:!0},{pattern:"KEY",enabled:!0},{pattern:"TOKEN",enabled:!0},{pattern:"PRIVATE",enabled:!0},{pattern:"CREDENTIAL",enabled:!0},{pattern:"AUTH",enabled:!0},{pattern:"API_KEY",enabled:!0}]),[o,a]=g.useState(""),[l,c]=g.useState([]),[u,d]=g.useState(!1),[f,p]=g.useState([]),[b,j]=g.useState({user:"",pattern:"",permission:"read"});g.useEffect(()=>{v(),m()},[e]);const v=()=>{const N=localStorage.getItem(`security-settings-${e}`);if(N){const E=JSON.parse(N);n(E.settings||t),i(E.patterns||s),p(E.rules||[])}},h=()=>{const N={settings:t,patterns:s,rules:f};localStorage.setItem(`security-settings-${e}`,JSON.stringify(N))},m=async()=>{const N=[{id:1,timestamp:new Date().toISOString(),user:"admin@example.com",action:"update",variable:"DATABASE_URL",environment:e,details:"Updated variable value"},{id:2,timestamp:new Date(Date.now()-36e5).toISOString(),user:"dev@example.com",action:"create",variable:"API_KEY",environment:e,details:"Created new variable"},{id:3,timestamp:new Date(Date.now()-72e5).toISOString(),user:"admin@example.com",action:"delete",variable:"OLD_SECRET",environment:e,details:"Deleted variable"}];c(N)},x=N=>{const E={...t,[N]:!t[N]};n(E),h()},y=N=>{const E=[...s];E[N].enabled=!E[N].enabled,i(E),h()},w=()=>{if(o&&!s.find(N=>N.pattern===o)){const N=[...s,{pattern:o.toUpperCase(),enabled:!0}];i(N),a(""),h()}},S=N=>{const E=s.filter((A,P)=>P!==N);i(E),h()},C=()=>{if(b.user&&b.pattern){const N=[...f,{...b,id:Date.now()}];p(N),j({user:"",pattern:"",permission:"read"}),h()}},k=N=>{const E=f.filter(A=>A.id!==N);p(E),h()},T=()=>{const N=[["Timestamp","User","Action","Variable","Environment","Details"].join(","),...l.map(M=>[M.timestamp,M.user,M.action,M.variable,M.environment,M.details].join(","))].join(`
430
- `),E=new Blob([N],{type:"text/csv"}),A=URL.createObjectURL(E),P=document.createElement("a");P.href=A,P.download=`audit-logs-${e}-${Date.now()}.csv`,P.click(),URL.revokeObjectURL(A)};return r.jsxs("div",{className:"environment-security space-y-6",children:[r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Security Settings"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Variable Masking"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Hide sensitive variable values in the UI"})]}),r.jsx("button",{onClick:()=>x("maskingEnabled"),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${t.maskingEnabled?"bg-blue-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${t.maskingEnabled?"translate-x-6":"translate-x-1"}`})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Value Encryption"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Encrypt sensitive values at rest"})]}),r.jsx("button",{onClick:()=>x("encryptionEnabled"),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${t.encryptionEnabled?"bg-blue-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${t.encryptionEnabled?"translate-x-6":"translate-x-1"}`})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Audit Logging"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Track all changes to environment variables"})]}),r.jsx("button",{onClick:()=>x("auditLoggingEnabled"),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${t.auditLoggingEnabled?"bg-blue-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${t.auditLoggingEnabled?"translate-x-6":"translate-x-1"}`})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Access Control"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Enable role-based access control"})]}),r.jsx("button",{onClick:()=>{const N={...t};N.accessControl.enabled=!N.accessControl.enabled,n(N),h()},className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${t.accessControl.enabled?"bg-blue-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${t.accessControl.enabled?"translate-x-6":"translate-x-1"}`})})]})]})]}),t.maskingEnabled&&r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Masking Patterns"}),r.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Variables containing these patterns will be automatically masked"}),r.jsx("div",{className:"space-y-2 mb-4",children:s.map((N,E)=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:N.enabled,onChange:()=>y(E),className:"mr-3"}),r.jsx("code",{className:"text-sm font-mono text-gray-700",children:N.pattern})]}),E>=8&&r.jsx("button",{onClick:()=>S(E),className:"text-red-600 hover:text-red-800",children:"Remove"})]},E))}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("input",{type:"text",value:o,onChange:N=>a(N.target.value.toUpperCase()),placeholder:"Add custom pattern",className:"flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500"}),r.jsx("button",{onClick:w,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700",children:"Add Pattern"})]})]}),t.accessControl.enabled&&r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Access Control Rules"}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Default Permission"}),r.jsxs("select",{value:t.accessControl.defaultPermission,onChange:N=>{const E={...t};E.accessControl.defaultPermission=N.target.value,n(E),h()},className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500",children:[r.jsx("option",{value:"none",children:"No Access"}),r.jsx("option",{value:"read",children:"Read Only"}),r.jsx("option",{value:"write",children:"Read & Write"})]})]}),f.length>0&&r.jsx("div",{className:"mb-4",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"User/Role"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Variable Pattern"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Permission"}),r.jsx("th",{className:"px-4 py-2"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:f.map(N=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-4 py-2 text-sm",children:N.user}),r.jsx("td",{className:"px-4 py-2 text-sm font-mono",children:N.pattern}),r.jsx("td",{className:"px-4 py-2 text-sm",children:N.permission}),r.jsx("td",{className:"px-4 py-2 text-sm text-right",children:r.jsx("button",{onClick:()=>k(N.id),className:"text-red-600 hover:text-red-800",children:"Remove"})})]},N.id))})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx("input",{type:"text",value:b.user,onChange:N=>j({...b,user:N.target.value}),placeholder:"User or role",className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500"}),r.jsx("input",{type:"text",value:b.pattern,onChange:N=>j({...b,pattern:N.target.value}),placeholder:"Variable pattern (e.g., API_*)",className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500"}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsxs("select",{value:b.permission,onChange:N=>j({...b,permission:N.target.value}),className:"flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500",children:[r.jsx("option",{value:"none",children:"No Access"}),r.jsx("option",{value:"read",children:"Read Only"}),r.jsx("option",{value:"write",children:"Read & Write"})]}),r.jsx("button",{onClick:C,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700",children:"Add"})]})]})]}),t.auditLoggingEnabled&&r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Audit Logs"}),r.jsxs("div",{className:"space-x-2",children:[r.jsxs("button",{onClick:()=>d(!u),className:"px-3 py-1 text-sm bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:[u?"Hide":"Show"," Logs"]}),r.jsx("button",{onClick:T,className:"px-3 py-1 text-sm bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Export CSV"})]})]}),u&&r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Timestamp"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"User"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Action"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Variable"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase",children:"Details"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:l.map(N=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-4 py-2 text-sm text-gray-500",children:new Date(N.timestamp).toLocaleString()}),r.jsx("td",{className:"px-4 py-2 text-sm",children:N.user}),r.jsx("td",{className:"px-4 py-2 text-sm",children:r.jsx("span",{className:`px-2 py-1 text-xs rounded ${N.action==="create"?"bg-green-100 text-green-800":N.action==="update"?"bg-blue-100 text-blue-800":N.action==="delete"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:N.action})}),r.jsx("td",{className:"px-4 py-2 text-sm font-mono",children:N.variable}),r.jsx("td",{className:"px-4 py-2 text-sm text-gray-500",children:N.details})]},N.id))})]})})]})]})},HO=()=>{const{envVariables:e,updateEnvVariable:t,refreshData:n}=Mt(),{on:s}=an(),[i,o]=g.useState("editor"),[a,l]=g.useState("local"),[c,u]=g.useState([]),[d,f]=g.useState(!1),[p,b]=g.useState(null);g.useEffect(()=>{j()},[a]),g.useEffect(()=>s("env-update",w=>{w.environment===a&&(j(),x("Environment variables updated","success"))}),[s,a]);const j=async()=>{f(!0);try{const y=await W.get(`/api/environment/variables/${a}`);u(y.data.variables||[])}catch(y){console.error("Error loading variables:",y),x("Failed to load environment variables","error")}finally{f(!1)}},v=async y=>{try{await W.put(`/api/environment/variables/${a}`,{variables:y}),await j(),x("Environment variables saved successfully","success")}catch(w){throw console.error("Error saving variables:",w),x("Failed to save environment variables","error"),w}},h=async(y,w)=>{try{await W.post("/api/environment",{key:y,value:w}),await j(),x(`Variable ${y} updated`,"success")}catch(S){console.error("Error updating variable:",S),x("Failed to update variable","error")}},m=async y=>{if(window.confirm(`Are you sure you want to delete ${y}?`))try{await W.delete(`/api/environment/${y}`),await j(),x(`Variable ${y} deleted`,"success")}catch(w){console.error("Error deleting variable:",w),x("Failed to delete variable","error")}},x=(y,w="info")=>{b({message:y,type:w}),setTimeout(()=>b(null),5e3)};return r.jsxs("div",{children:[r.jsx("div",{className:"mb-8",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Environment Variables"}),r.jsx("p",{className:"mt-2 text-gray-600",children:"Manage environment variables across different environments"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Environment:"}),r.jsxs("select",{value:a,onChange:y=>l(y.target.value),className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500",children:[r.jsx("option",{value:"local",children:"Local"}),r.jsx("option",{value:"staging",children:"Staging"}),r.jsx("option",{value:"production",children:"Production"})]})]})]})}),p&&r.jsx("div",{className:`mb-4 p-4 rounded-md ${p.type==="success"?"bg-green-50 text-green-800":p.type==="error"?"bg-red-50 text-red-800":"bg-blue-50 text-blue-800"}`,children:r.jsxs("div",{className:"flex",children:[r.jsxs("div",{className:"flex-shrink-0",children:[p.type==="success"&&r.jsx("svg",{className:"h-5 w-5 text-green-400",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),p.type==="error"&&r.jsx("svg",{className:"h-5 w-5 text-red-400",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})]}),r.jsx("div",{className:"ml-3",children:r.jsx("p",{className:"text-sm font-medium",children:p.message})})]})}),r.jsx("div",{className:"mb-6",children:r.jsx("div",{className:"border-b border-gray-200",children:r.jsxs("nav",{className:"-mb-px flex space-x-8",children:[r.jsx("button",{onClick:()=>o("editor"),className:`py-2 px-1 border-b-2 font-medium text-sm ${i==="editor"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Editor"}),r.jsx("button",{onClick:()=>o("schema"),className:`py-2 px-1 border-b-2 font-medium text-sm ${i==="schema"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Schema & Validation"}),r.jsx("button",{onClick:()=>o("compare"),className:`py-2 px-1 border-b-2 font-medium text-sm ${i==="compare"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Compare & Sync"}),r.jsx("button",{onClick:()=>o("import-export"),className:`py-2 px-1 border-b-2 font-medium text-sm ${i==="import-export"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Import/Export"}),r.jsx("button",{onClick:()=>o("security"),className:`py-2 px-1 border-b-2 font-medium text-sm ${i==="security"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Security"})]})})}),r.jsx("div",{className:"mt-6",children:d?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"text-gray-500",children:"Loading..."})}):r.jsxs(r.Fragment,{children:[i==="editor"&&r.jsx(UO,{variables:c,environment:a,onSave:v,onVariableUpdate:h,onVariableDelete:m,readOnly:a==="production"}),i==="schema"&&r.jsx(zO,{variables:c,environment:a,onSchemaUpdate:y=>{x("Schema updated","success")}}),i==="compare"&&r.jsx(VO,{onSync:y=>{x(`Synced ${y.count} variables from ${y.source} to ${y.target}`,"success"),y.target===a&&j()}}),i==="import-export"&&r.jsx(BO,{environment:a,onImport:y=>{x(`Imported ${y.imported} variables`,"success"),j()},onExport:y=>{x(`Exported variables as ${y.format.toUpperCase()}`,"success")}}),i==="security"&&r.jsx(WO,{environment:a})]})}),a==="production"&&r.jsx("div",{className:"mt-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex",children:[r.jsx("svg",{className:"h-5 w-5 text-yellow-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),r.jsxs("div",{className:"text-sm text-yellow-700",children:[r.jsx("p",{className:"font-medium",children:"Production Environment"}),r.jsx("p",{children:"This environment can sync with AWS Parameter Store for secure secret management."})]})]}),r.jsx("button",{onClick:async()=>{try{await W.post("/api/environment/sync/aws-parameter-store",{environment:"production"}),x("Synced with AWS Parameter Store","success")}catch{x("Failed to sync with AWS","error")}},className:"px-3 py-1 text-sm bg-yellow-600 text-white rounded hover:bg-yellow-700",children:"Sync with AWS"})]})})]})},qO=({userId:e=null})=>{const{users:t,getAllSessions:n,getUserSessions:s,refreshSession:i,endSession:o}=Mt(),{on:a}=an(),[l,c]=g.useState([]),[u,d]=g.useState(!0),[f,p]=g.useState(!1),b=async()=>{try{if(d(!0),e){const y=await s(e);c(y)}else{const y=await n();c(y.sessions)}}catch(y){console.error("Error fetching sessions:",y)}finally{d(!1)}};g.useEffect(()=>{b();const y=a("session:created",()=>{b()}),w=a("session:ended",()=>{b()}),S=a("session:activity",k=>{c(T=>T.map(N=>N.id===k.sessionId?{...N,lastActivity:k.timestamp}:N))}),C=setInterval(b,3e4);return()=>{y&&y(),w&&w(),S&&S(),clearInterval(C)}},[a,e]);const j=async y=>{try{p(!0),await i(y),await b()}catch(w){console.error("Error refreshing session:",w),alert("Failed to refresh session")}finally{p(!1)}},v=async y=>{if(window.confirm("Are you sure you want to end this session?"))try{await o(y),await b()}catch(w){console.error("Error ending session:",w),alert("Failed to end session")}},h=y=>t.find(w=>w.id===y),m=y=>{const w=new Date,C=new Date(y)-w;if(C<0)return"Expired";const k=Math.floor(C/6e4),T=Math.floor(k/60);return T>0?`${T}h ${k%60}m`:`${k}m`},x=y=>{const w=new Date,S=new Date(y),C=w-S,k=Math.floor(C/6e4),T=Math.floor(k/60);return T>0?`${T}h ago`:k>0?`${k}m ago`:"Just now"};return u?r.jsx("div",{className:"bg-white rounded-lg shadow p-6",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})}):r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Active Sessions"}),r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:e?"User sessions":"All active development sessions"})]}),r.jsxs("button",{onClick:b,disabled:f,className:Y("flex items-center space-x-2 px-3 py-1.5 rounded-md text-sm transition-colors",f?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:[r.jsx(ol,{size:14,className:Y(f&&"animate-spin")}),r.jsx("span",{children:"Refresh"})]})]}),l.length===0?r.jsxs("div",{className:"text-center py-8 text-gray-500",children:[r.jsx(Nd,{size:32,className:"mx-auto mb-2 text-gray-400"}),r.jsx("p",{children:"No active sessions"})]}):r.jsx("div",{className:"space-y-3",children:l.map(y=>{const w=h(y.userId),S=new Date(y.expiresAt)-new Date<6e5;return r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center",children:r.jsx(Nd,{size:16,className:"text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-gray-900",children:w?`${w.firstName} ${w.lastName}`:"Unknown User"}),r.jsx("p",{className:"text-xs text-gray-500",children:(w==null?void 0:w.email)||y.userId})]})]}),r.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-4 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-1 text-gray-600",children:[r.jsx(Wi,{size:12}),r.jsxs("span",{children:["Created ",x(y.createdAt)]})]}),r.jsxs("div",{className:"flex items-center space-x-1 text-gray-600",children:[r.jsx(VE,{size:12}),r.jsxs("span",{children:["Active ",x(y.lastActivity)]})]}),r.jsxs("div",{className:Y("flex items-center space-x-1",S?"text-orange-600":"text-gray-600"),children:[r.jsx(Wi,{size:12}),r.jsxs("span",{children:["Expires in ",m(y.expiresAt)]})]})]}),y.metadata&&Object.keys(y.metadata).length>0&&r.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[r.jsx("span",{className:"font-medium",children:"Metadata:"})," ",JSON.stringify(y.metadata)]})]}),r.jsxs("div",{className:"flex items-center space-x-2 ml-4",children:[r.jsx("button",{onClick:()=>j(y.id),disabled:f,className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors",title:"Refresh session",children:r.jsx(ol,{size:16})}),r.jsx("button",{onClick:()=>v(y.id),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors",title:"End session",children:r.jsx(rb,{size:16})})]})]}),r.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[r.jsx("code",{className:"text-gray-500 font-mono",children:y.id}),r.jsx("span",{className:Y("px-2 py-0.5 rounded-full font-medium",y.active?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"),children:y.active?"Active":"Inactive"})]})]},y.id)})}),r.jsx("div",{className:"mt-6 text-xs text-gray-500 text-center",children:"Sessions automatically expire after 1 hour of inactivity"})]})},KO=()=>{const{users:e,createUser:t,updateUser:n,deleteUser:s,bulkCreateUsers:i,deleteAllUsers:o}=Mt(),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(null),[p,b]=g.useState(""),[j,v]=g.useState(""),[h,m]=g.useState(""),[x,y]=g.useState("users"),[w,S]=g.useState({email:"",firstName:"",lastName:"",role:"user",appUserId:"",appOrgId:""}),C=_=>{const{name:O,value:F}=_.target;S($=>({...$,[O]:F}))},k=async _=>{_.preventDefault();try{c?(await n(c.id,w),u(null)):await t(w),S({email:"",firstName:"",lastName:"",role:"user",appUserId:"",appOrgId:""}),l(!1)}catch(O){console.error(c?"Error updating user:":"Error creating user:",O)}},T=_=>{u(_),S({email:_.email,firstName:_.firstName,lastName:_.lastName,role:_.role,appUserId:_.appUserId||"",appOrgId:_.appOrgId||""}),l(!0)},N=async _=>{try{await s(_),f(null)}catch(O){console.error("Error deleting user:",O)}},E=async()=>{try{await i(10)}catch(_){console.error("Error creating bulk users:",_)}},A=async()=>{if(window.confirm("Are you sure you want to delete all users? This action cannot be undone."))try{await o()}catch(_){console.error("Error deleting all users:",_)}},P=_=>`test_user_${_.email.split("@")[0].replace(/\./g,"_")}`,M=e.filter(_=>{const O=p===""||_.email.toLowerCase().includes(p.toLowerCase())||_.firstName.toLowerCase().includes(p.toLowerCase())||_.lastName.toLowerCase().includes(p.toLowerCase())||_.appUserId&&_.appUserId.toLowerCase().includes(p.toLowerCase())||_.appOrgId&&_.appOrgId.toLowerCase().includes(p.toLowerCase()),F=j===""||_.role===j,$=h===""||_.status===h;return O&&F&&$});return r.jsxs("div",{children:[r.jsxs("div",{className:"mb-8",children:[r.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Test User Management"}),r.jsx("p",{className:"mt-2 text-gray-600",children:"Create and manage dummy users for testing integrations"})]}),r.jsx("div",{className:"mb-6 border-b border-gray-200",children:r.jsxs("nav",{className:"-mb-px flex space-x-8",children:[r.jsxs("button",{onClick:()=>y("users"),className:`py-2 px-1 border-b-2 font-medium text-sm ${x==="users"?"border-frigg-blue text-frigg-blue":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:["Users (",e.length,")"]}),r.jsx("button",{onClick:()=>y("sessions"),className:`py-2 px-1 border-b-2 font-medium text-sm ${x==="sessions"?"border-frigg-blue text-frigg-blue":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Active Sessions"})]})}),x==="users"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mb-6 flex space-x-4",children:a?r.jsxs("div",{className:"bg-white shadow rounded-lg p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:c?"Edit User":"Create New Test User"}),r.jsxs("form",{onSubmit:k,children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"First Name"}),r.jsx("input",{type:"text",name:"firstName",required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:w.firstName,onChange:C})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Last Name"}),r.jsx("input",{type:"text",name:"lastName",required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:w.lastName,onChange:C})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),r.jsx("input",{type:"email",name:"email",required:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:w.email,onChange:C})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Role"}),r.jsxs("select",{name:"role",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:w.role,onChange:C,children:[r.jsx("option",{value:"user",children:"User"}),r.jsx("option",{value:"admin",children:"Admin"}),r.jsx("option",{value:"developer",children:"Developer"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"App User ID"}),r.jsx("input",{type:"text",name:"appUserId",placeholder:"e.g., app_user_123",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:w.appUserId,onChange:C}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Optional: External app user identifier"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"App Org ID"}),r.jsx("input",{type:"text",name:"appOrgId",placeholder:"e.g., app_org_456",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:w.appOrgId,onChange:C}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Optional: External organization identifier"})]})]}),r.jsxs("div",{className:"mt-4 flex space-x-2",children:[r.jsx("button",{type:"submit",className:"px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700",children:c?"Update User":"Create User"}),r.jsx("button",{type:"button",onClick:()=>{l(!1),u(null),S({email:"",firstName:"",lastName:"",role:"user",appUserId:"",appOrgId:""})},className:"px-4 py-2 bg-gray-300 text-gray-700 rounded-md hover:bg-gray-400",children:"Cancel"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>l(!0),className:"px-4 py-2 bg-frigg-blue text-white rounded-md hover:bg-blue-700 transition-colors",children:"+ Create Test User"}),r.jsx("button",{onClick:E,className:"px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700 transition-colors",children:"Generate 10 Users"}),e.length>0&&r.jsx("button",{onClick:A,className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors",children:"Delete All Users"})]})}),r.jsxs("div",{className:"mb-6 bg-white shadow rounded-lg p-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"md:col-span-2",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Search"}),r.jsx("input",{type:"text",placeholder:"Search by name, email, or IDs...",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:p,onChange:_=>b(_.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Filter by Role"}),r.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:j,onChange:_=>v(_.target.value),children:[r.jsx("option",{value:"",children:"All Roles"}),r.jsx("option",{value:"user",children:"User"}),r.jsx("option",{value:"admin",children:"Admin"}),r.jsx("option",{value:"developer",children:"Developer"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Filter by Status"}),r.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-frigg-blue",value:h,onChange:_=>m(_.target.value),children:[r.jsx("option",{value:"",children:"All Statuses"}),r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"inactive",children:"Inactive"})]})]})]}),(p||j||h)&&r.jsxs("div",{className:"mt-3 flex items-center text-sm text-gray-600",children:[r.jsxs("span",{children:["Showing ",M.length," of ",e.length," users"]}),r.jsx("button",{onClick:()=>{b(""),v(""),m("")},className:"ml-4 text-frigg-blue hover:text-blue-700",children:"Clear filters"})]})]}),r.jsx("div",{className:"bg-white shadow rounded-lg overflow-hidden",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"User"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"App User ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"App Org ID"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Role"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Connections"}),r.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:M.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:"6",className:"px-6 py-12 text-center text-gray-500",children:e.length===0?"No users created yet":"No users match your filters"})}):M.map(_=>{var O,F,$;return r.jsxs("tr",{children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:r.jsx("div",{className:"h-10 w-10 rounded-full bg-gray-300 flex items-center justify-center",children:r.jsxs("span",{className:"text-gray-600 font-medium",children:[(O=_.firstName)==null?void 0:O[0],(F=_.lastName)==null?void 0:F[0]]})})}),r.jsxs("div",{className:"ml-4",children:[r.jsxs("div",{className:"text-sm font-medium text-gray-900",children:[_.firstName," ",_.lastName]}),r.jsx("div",{className:"text-sm text-gray-500",children:_.email})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("code",{className:"text-sm font-mono text-gray-600",children:_.appUserId||P(_)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("code",{className:"text-sm font-mono text-gray-600",children:_.appOrgId||"N/A"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800",children:_.role})}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:[(($=_.connections)==null?void 0:$.length)||0," active"]}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:[r.jsx("button",{onClick:()=>T(_),className:"text-frigg-blue hover:text-blue-700 mr-3",children:"Edit"}),r.jsx("button",{onClick:()=>f(_.id),className:"text-red-600 hover:text-red-900",children:"Delete"})]})]},_.id||_.email)})})]})}),d&&r.jsx("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Confirm Delete"}),r.jsx("p",{className:"text-gray-600 mb-6",children:"Are you sure you want to delete this user? This action cannot be undone."}),r.jsxs("div",{className:"flex justify-end space-x-3",children:[r.jsx("button",{onClick:()=>f(null),className:"px-4 py-2 bg-gray-300 text-gray-700 rounded-md hover:bg-gray-400",children:"Cancel"}),r.jsx("button",{onClick:()=>N(d),className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:"Delete User"})]})]})}),r.jsx("div",{className:"mt-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-yellow-400",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),r.jsx("div",{className:"ml-3",children:r.jsx("p",{className:"text-sm text-yellow-700",children:"Test users are for local development only. They simulate real users for testing integration flows without requiring actual authentication."})})]})})]}):r.jsxs(r.Fragment,{children:[r.jsx(qO,{}),r.jsx("div",{className:"mt-6 bg-blue-50 border border-blue-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),r.jsx("div",{className:"ml-3",children:r.jsx("p",{className:"text-sm text-blue-700",children:"Sessions track user activity during development testing. Each session expires after 1 hour of inactivity and can be refreshed to extend the duration."})})]})})]})]})},GO=({integration:e,onSuccess:t,onCancel:n})=>{const[s,i]=g.useState(!1),[o,a]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState(!1),f=async()=>{var j,v;i(!0),a(null);try{const h=await W.post("/api/connections/oauth/init",{integration:e.name,provider:e.provider||e.name.toLowerCase()}),{authUrl:m,state:x,codeVerifier:y}=h.data;sessionStorage.setItem("oauth_state",x),y&&sessionStorage.setItem("oauth_verifier",y);const w=window.open(m,"OAuth Authorization","width=600,height=700,left=200,top=100");d(!0),p(x,w)}catch(h){a(((v=(j=h.response)==null?void 0:j.data)==null?void 0:v.error)||"Failed to initialize OAuth flow"),i(!1)}},p=async(j,v)=>{const h=setInterval(async()=>{if(v&&v.closed){clearInterval(h),d(!1),i(!1),a("Authorization window was closed");return}try{const m=await W.get(`/api/connections/oauth/status/${j}`);m.data.status==="completed"?(clearInterval(h),d(!1),i(!1),v&&!v.closed&&v.close(),sessionStorage.removeItem("oauth_state"),sessionStorage.removeItem("oauth_verifier"),t(m.data.connection)):m.data.status==="error"&&(clearInterval(h),d(!1),i(!1),a(m.data.error||"OAuth authorization failed"),v&&!v.closed&&v.close())}catch(m){console.error("Polling error:",m)}},1500);setTimeout(()=>{clearInterval(h),d(!1),i(!1),a("OAuth authorization timed out"),v&&!v.closed&&v.close()},3e5)},b=()=>{console.log("Manual entry not yet implemented")};return r.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-lg max-w-md mx-auto",children:[r.jsxs("h3",{className:"text-lg font-semibold mb-4",children:["Connect to ",e.displayName||e.name]}),o&&r.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md",children:r.jsx("p",{className:"text-sm text-red-800",children:o})}),!s&&!u&&r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"text-sm text-gray-600 mb-6",children:["Click the button below to authorize access to your ",e.displayName||e.name," account. You'll be redirected to ",e.displayName||e.name," to complete the authorization."]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs(V,{onClick:f,className:"w-full",variant:"primary",children:["Authorize with ",e.displayName||e.name]}),r.jsx(V,{onClick:n,className:"w-full",variant:"secondary",children:"Cancel"}),e.supportsApiKey&&r.jsx("button",{onClick:b,className:"w-full text-sm text-gray-600 hover:text-gray-800 underline",children:"Enter credentials manually"})]})]}),(s||u)&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Ke,{size:"lg"}),r.jsx("p",{className:"mt-4 text-sm text-gray-600",children:u?"Waiting for authorization... Please complete the process in the popup window.":"Initializing OAuth flow..."})]}),r.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200",children:r.jsx("p",{className:"text-xs text-gray-500",children:"By connecting, you agree to share the requested permissions with this application. Your credentials are securely stored and can be revoked at any time."})})]})},YO=({connection:e,onTestComplete:t})=>{const[n,s]=g.useState(!1),[i,o]=g.useState(null),[a,l]=g.useState([]),c=async()=>{var p,b;s(!0),o(null),l([]);const f=[{id:"auth",name:"Validating authentication",status:"pending"},{id:"api",name:"Testing API connectivity",status:"pending"},{id:"permissions",name:"Checking permissions",status:"pending"},{id:"data",name:"Fetching sample data",status:"pending"}];l(f);try{const j=await W.post(`/api/connections/${e.id}/test`,{comprehensive:!0}),{results:v,summary:h}=j.data,m=f.map(x=>{const y=v[x.id];return{...x,status:y!=null&&y.success?"success":"failed",message:y==null?void 0:y.message,latency:y==null?void 0:y.latency,error:y==null?void 0:y.error}});l(m),o(h),t&&t(h)}catch(j){o({success:!1,error:((b=(p=j.response)==null?void 0:p.data)==null?void 0:b.error)||"Connection test failed"}),l(f.map(v=>({...v,status:"failed",error:"Test aborted due to error"})))}finally{s(!1)}},u=f=>{switch(f){case"success":return"text-green-600";case"failed":return"text-red-600";case"pending":return"text-gray-400";default:return"text-gray-600"}},d=f=>{switch(f){case"success":return r.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})});case"failed":return r.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})});case"pending":return r.jsx(Ke,{size:"sm"});default:return null}};return r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Connection Test"}),i&&r.jsx(wn,{status:i.success?"success":"error",text:i.success?"Passed":"Failed"})]}),!n&&!i&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Run a comprehensive test to validate this connection's authentication, API access, and permissions."}),r.jsx(V,{onClick:c,variant:"primary",children:"Run Connection Test"})]}),(n||a.length>0)&&r.jsx("div",{className:"space-y-3",children:a.map(f=>r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:`flex-shrink-0 ${u(f.status)}`,children:d(f.status)}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium text-gray-900",children:f.name}),f.message&&r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:f.message}),f.error&&r.jsx("p",{className:"text-sm text-red-600 mt-1",children:f.error}),f.latency&&r.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Response time: ",f.latency,"ms"]})]})]},f.id))}),i&&r.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-200",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Test Summary"}),i.success?r.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-md p-4",children:[r.jsx("p",{className:"text-sm text-green-800",children:"All tests passed successfully. The connection is working properly."}),i.avgLatency&&r.jsxs("p",{className:"text-xs text-green-700 mt-2",children:["Average response time: ",i.avgLatency,"ms"]})]}):r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:[r.jsx("p",{className:"text-sm text-red-800",children:i.error||"One or more tests failed. Please check the connection configuration."}),i.suggestion&&r.jsxs("p",{className:"text-xs text-red-700 mt-2",children:["Suggestion: ",i.suggestion]})]}),!n&&r.jsxs("div",{className:"mt-4 flex space-x-3",children:[r.jsx(V,{onClick:c,variant:"secondary",size:"sm",children:"Run Again"}),i.success&&i.canRefreshToken&&r.jsx(V,{variant:"secondary",size:"sm",children:"Refresh Token"})]})]})]})},Wx=({connectionId:e,compact:t=!1})=>{var p;const n=an(),[s,i]=g.useState({status:"unknown",lastCheck:null,uptime:0,latency:null,errorRate:0,apiCalls:{total:0,successful:0,failed:0}}),[o,a]=g.useState(!0);g.useEffect(()=>{l(),n&&(n.on(`connection-health-${e}`,c),n.emit("subscribe",{topics:[`connection-health-${e}`]}));const b=setInterval(l,6e4);return()=>{n&&(n.off(`connection-health-${e}`,c),n.emit("unsubscribe",{topics:[`connection-health-${e}`]})),clearInterval(b)}},[e,n]);const l=async()=>{try{const b=await W.get(`/api/connections/${e}/health`);i(b.data),a(!1)}catch(b){console.error("Failed to fetch health data:",b),i(j=>({...j,status:"error"})),a(!1)}},c=b=>{i(j=>({...j,...b,lastCheck:new Date().toISOString()}))},u=()=>s.status==="healthy"&&s.errorRate<5?{color:"success",text:"Healthy"}:s.status==="healthy"&&s.errorRate<20?{color:"warning",text:"Degraded"}:s.status==="error"||s.errorRate>=20?{color:"error",text:"Unhealthy"}:{color:"default",text:"Unknown"},d=b=>{const j=Math.floor(b/86400),v=Math.floor(b%86400/3600),h=Math.floor(b%3600/60);return j>0?`${j}d ${v}h`:v>0?`${v}h ${h}m`:`${h}m`},f=u();return o?r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-4 bg-gray-200 rounded w-24"})}):t?r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(wn,{status:f.color,text:f.text}),s.latency&&r.jsxs("span",{className:"text-xs text-gray-500",children:[s.latency,"ms"]})]}):r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Connection Health"}),r.jsx(wn,{status:f.color,text:f.text})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Uptime"}),r.jsx("p",{className:"text-lg font-medium text-gray-900",children:d(s.uptime)})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Response Time"}),r.jsx("p",{className:"text-lg font-medium text-gray-900",children:s.latency?`${s.latency}ms`:"N/A"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Success Rate"}),r.jsx("p",{className:"text-lg font-medium text-gray-900",children:s.apiCalls.total>0?`${Math.round(s.apiCalls.successful/s.apiCalls.total*100)}%`:"N/A"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Total API Calls"}),r.jsx("p",{className:"text-lg font-medium text-gray-900",children:s.apiCalls.total.toLocaleString()})]})]}),s.apiCalls.failed>0&&r.jsx("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-md",children:r.jsxs("p",{className:"text-sm text-red-800",children:[s.apiCalls.failed," failed API calls in the last 24 hours"]})}),s.lastCheck&&r.jsxs("p",{className:"mt-4 text-xs text-gray-500",children:["Last checked: ",new Date(s.lastCheck).toLocaleTimeString()]}),r.jsxs("div",{className:"mt-6 pt-4 border-t border-gray-200",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Recent Activity"}),r.jsx("div",{className:"space-y-2",children:((p=s.recentEvents)==null?void 0:p.map((b,j)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600",children:b.type}),r.jsx("span",{className:"text-gray-500 text-xs",children:new Date(b.timestamp).toLocaleTimeString()})]},j)))||r.jsx("p",{className:"text-sm text-gray-500",children:"No recent activity"})})]})]})},XO=({connectionId:e})=>{const[t,n]=g.useState([]),[s,i]=g.useState([]),[o,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState("graph"),f=g.useRef(null);g.useEffect(()=>{p()},[e]),g.useEffect(()=>{u==="graph"&&t.length>0&&b()},[t,s,u,l]);const p=async()=>{a(!0);try{const[h,m]=await Promise.all([W.get(`/api/connections/${e}/entities`),W.get(`/api/connections/${e}/relationships`)]);n(h.data.entities||[]),i(m.data.relationships||[])}catch(h){console.error("Failed to fetch entity data:",h)}finally{a(!1)}},b=()=>{const h=f.current;if(!h)return;const m=h.getContext("2d"),x=h.width=h.offsetWidth,y=h.height=h.offsetHeight;m.clearRect(0,0,x,y);const w=x/2,S=y/2,C=Math.min(x,y)*.35,k={};t.forEach((T,N)=>{const E=N/t.length*2*Math.PI;k[T.id]={x:w+C*Math.cos(E),y:S+C*Math.sin(E),entity:T}}),m.strokeStyle="#e5e7eb",m.lineWidth=1,s.forEach(T=>{const N=k[T.fromId],E=k[T.toId];if(N&&E){m.beginPath(),m.moveTo(N.x,N.y),m.lineTo(E.x,E.y),m.stroke();const A=(N.x+E.x)/2,P=(N.y+E.y)/2;m.fillStyle="#6b7280",m.font="10px sans-serif",m.textAlign="center",m.fillText(T.type,A,P)}}),Object.values(k).forEach(({x:T,y:N,entity:E})=>{const A=(l==null?void 0:l.id)===E.id;m.beginPath(),m.arc(T,N,30,0,2*Math.PI),m.fillStyle=A?"#2563eb":"#ffffff",m.fill(),m.strokeStyle=A?"#2563eb":"#d1d5db",m.lineWidth=2,m.stroke(),m.fillStyle=A?"#ffffff":"#111827",m.font="12px sans-serif",m.textAlign="center",m.textBaseline="middle",m.fillText(E.name||E.type,T,N),m.fillStyle=A?"#dbeafe":"#6b7280",m.font="10px sans-serif",m.fillText(E.type,T,N+40)})},j=h=>{const m=f.current,x=m.getBoundingClientRect(),y=h.clientX-x.left,w=h.clientY-x.top,S=m.width/2,C=m.height/2,k=Math.min(m.width,m.height)*.35;t.forEach((T,N)=>{const E=N/t.length*2*Math.PI,A=S+k*Math.cos(E),P=C+k*Math.sin(E);Math.sqrt(Math.pow(y-A,2)+Math.pow(w-P,2))<=30&&c(T)})},v=async()=>{a(!0);try{await W.post(`/api/connections/${e}/sync`),await p()}catch(h){console.error("Failed to sync entities:",h)}finally{a(!1)}};return o?r.jsx("div",{className:"flex items-center justify-center p-8",children:r.jsx(Ke,{size:"lg"})}):r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Entity Relationships"}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsxs("div",{className:"flex rounded-md shadow-sm",children:[r.jsx("button",{onClick:()=>d("graph"),className:`px-3 py-1 text-sm font-medium rounded-l-md ${u==="graph"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:"Graph"}),r.jsx("button",{onClick:()=>d("list"),className:`px-3 py-1 text-sm font-medium rounded-r-md ${u==="list"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:"List"})]}),r.jsx(V,{onClick:v,size:"sm",variant:"secondary",children:"Sync Entities"})]})]}),t.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-gray-500 mb-4",children:"No entities found for this connection."}),r.jsx(V,{onClick:v,variant:"primary",children:"Sync Entities Now"})]}):r.jsxs(r.Fragment,{children:[u==="graph"?r.jsxs("div",{className:"relative",children:[r.jsx("canvas",{ref:f,width:600,height:400,className:"w-full h-96 border border-gray-200 rounded-lg cursor-pointer",onClick:j}),l&&r.jsxs("div",{className:"mt-4 p-4 bg-gray-50 rounded-lg",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:l.name||l.id}),r.jsxs("dl",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsx("dt",{className:"text-gray-500",children:"Type:"}),r.jsx("dd",{className:"text-gray-900",children:l.type}),r.jsx("dt",{className:"text-gray-500",children:"External ID:"}),r.jsx("dd",{className:"text-gray-900 font-mono text-xs",children:l.externalId}),r.jsx("dt",{className:"text-gray-500",children:"Created:"}),r.jsx("dd",{className:"text-gray-900",children:new Date(l.createdAt).toLocaleDateString()})]})]})]}):r.jsx("div",{className:"space-y-4",children:t.map(h=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:bg-gray-50 cursor-pointer",onClick:()=>c(h),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:h.name||h.id}),r.jsxs("p",{className:"text-sm text-gray-500",children:["Type: ",h.type," | External ID: ",h.externalId]})]}),r.jsxs("div",{className:"text-sm text-gray-500",children:[s.filter(m=>m.fromId===h.id||m.toId===h.id).length," relationships"]})]}),(l==null?void 0:l.id)===h.id&&r.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-200",children:[r.jsx("h5",{className:"text-sm font-medium text-gray-900 mb-2",children:"Relationships:"}),r.jsx("div",{className:"space-y-1",children:s.filter(m=>m.fromId===h.id||m.toId===h.id).map((m,x)=>{var y,w;return r.jsxs("p",{className:"text-sm text-gray-600",children:[m.fromId===h.id?"Has":"Is"," ",m.type," ",m.fromId===h.id?((y=t.find(S=>S.id===m.toId))==null?void 0:y.name)||m.toId:((w=t.find(S=>S.id===m.fromId))==null?void 0:w.name)||m.fromId]},x)})})]})]},h.id))}),r.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200",children:r.jsxs("p",{className:"text-sm text-gray-500",children:["Total: ",t.length," entities, ",s.length," relationships"]})})]})]})},QO=({connection:e,integration:t,onSave:n,onCancel:s})=>{const[i,o]=g.useState({name:"",description:"",syncInterval:"hourly",autoSync:!0,webhookEnabled:!1,webhookUrl:"",rateLimitOverride:"",customHeaders:{},entityMappings:[],advanced:{}}),[a,l]=g.useState(!1),[c,u]=g.useState(null);g.useEffect(()=>{e&&o({name:e.name||"",description:e.description||"",syncInterval:e.syncInterval||"hourly",autoSync:e.autoSync!==!1,webhookEnabled:e.webhookEnabled||!1,webhookUrl:e.webhookUrl||"",rateLimitOverride:e.rateLimitOverride||"",customHeaders:e.customHeaders||{},entityMappings:e.entityMappings||[],advanced:e.advanced||{}})},[e]);const d=async h=>{var m,x;h.preventDefault(),l(!0),u(null);try{const y=e?`/api/connections/${e.id}/config`:"/api/connections/config",S=await W[e?"put":"post"](y,{...i,integrationId:t.id});n(S.data)}catch(y){u(((x=(m=y.response)==null?void 0:m.data)==null?void 0:x.error)||"Failed to save configuration")}finally{l(!1)}},f=()=>{const h=prompt("Header name:");if(h){const m=prompt("Header value:");m&&o(x=>({...x,customHeaders:{...x.customHeaders,[h]:m}}))}},p=h=>{o(m=>{const{[h]:x,...y}=m.customHeaders;return{...m,customHeaders:y}})},b=()=>{o(h=>({...h,entityMappings:[...h.entityMappings,{id:Date.now(),sourceType:"",targetType:"",fieldMappings:{}}]}))},j=(h,m)=>{o(x=>({...x,entityMappings:x.entityMappings.map(y=>y.id===h?{...y,...m}:y)}))},v=h=>{o(m=>({...m,entityMappings:m.entityMappings.filter(x=>x.id!==h)}))};return r.jsxs("form",{onSubmit:d,className:"space-y-6",children:[c&&r.jsx("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:r.jsx("p",{className:"text-sm text-destructive",children:c})}),r.jsxs("div",{className:"bg-card rounded-lg shadow p-6 border border-border",children:[r.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Basic Configuration"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Connection Name"}),r.jsx("input",{type:"text",id:"name",value:i.name,onChange:h=>o(m=>({...m,name:h.target.value})),className:"mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm",placeholder:`My ${t.displayName} Connection`})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground",children:"Description"}),r.jsx("textarea",{id:"description",value:i.description,onChange:h=>o(m=>({...m,description:h.target.value})),rows:3,className:"mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm",placeholder:"Optional description for this connection"})]})]})]}),r.jsxs("div",{className:"bg-card rounded-lg shadow p-6 border border-border",children:[r.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Sync Configuration"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{children:r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:i.autoSync,onChange:h=>o(m=>({...m,autoSync:h.target.checked})),className:"rounded border-input text-primary shadow-sm focus:border-ring focus:ring-ring"}),r.jsx("span",{className:"ml-2 text-sm text-foreground",children:"Enable automatic synchronization"})]})}),i.autoSync&&r.jsxs("div",{children:[r.jsx("label",{htmlFor:"syncInterval",className:"block text-sm font-medium text-foreground",children:"Sync Interval"}),r.jsxs("select",{id:"syncInterval",value:i.syncInterval,onChange:h=>o(m=>({...m,syncInterval:h.target.value})),className:"mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm",children:[r.jsx("option",{value:"realtime",children:"Real-time"}),r.jsx("option",{value:"5min",children:"Every 5 minutes"}),r.jsx("option",{value:"15min",children:"Every 15 minutes"}),r.jsx("option",{value:"hourly",children:"Hourly"}),r.jsx("option",{value:"daily",children:"Daily"}),r.jsx("option",{value:"weekly",children:"Weekly"})]})]})]})]}),r.jsxs("div",{className:"bg-card rounded-lg shadow p-6 border border-border",children:[r.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Webhook Configuration"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{children:r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:i.webhookEnabled,onChange:h=>o(m=>({...m,webhookEnabled:h.target.checked})),className:"rounded border-input text-primary shadow-sm focus:border-ring focus:ring-ring"}),r.jsx("span",{className:"ml-2 text-sm text-foreground",children:"Enable webhooks for real-time updates"})]})}),i.webhookEnabled&&r.jsxs("div",{children:[r.jsx("label",{htmlFor:"webhookUrl",className:"block text-sm font-medium text-foreground",children:"Webhook URL"}),r.jsxs("div",{className:"mt-1 flex rounded-md shadow-sm",children:[r.jsxs("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 border-input bg-muted text-muted-foreground text-sm",children:[window.location.origin,"/api/webhooks/"]}),r.jsx("input",{type:"text",id:"webhookUrl",value:i.webhookUrl,onChange:h=>o(m=>({...m,webhookUrl:h.target.value})),className:"flex-1 block w-full rounded-none rounded-r-md border-input bg-background text-foreground focus:border-ring focus:ring-ring sm:text-sm",placeholder:"connection-id",disabled:!0})]}),r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"This URL will be automatically generated when the connection is created."})]})]})]}),r.jsxs("div",{className:"bg-card rounded-lg shadow p-6 border border-border",children:[r.jsx("h3",{className:"text-lg font-semibold text-card-foreground mb-4",children:"Advanced Configuration"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"rateLimitOverride",className:"block text-sm font-medium text-foreground",children:"Rate Limit Override (requests per minute)"}),r.jsx("input",{type:"number",id:"rateLimitOverride",value:i.rateLimitOverride,onChange:h=>o(m=>({...m,rateLimitOverride:h.target.value})),className:"mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm",placeholder:"Leave empty to use default"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Custom Headers"}),r.jsx(V,{type:"button",onClick:f,size:"sm",variant:"secondary",children:"Add Header"})]}),Object.keys(i.customHeaders).length>0?r.jsx("div",{className:"space-y-2",children:Object.entries(i.customHeaders).map(([h,m])=>r.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-muted/50 rounded",children:[r.jsxs("code",{className:"text-sm font-mono flex-1",children:[h,": ",m]}),r.jsx("button",{type:"button",onClick:()=>p(h),className:"text-destructive hover:text-destructive/80",children:"Remove"})]},h))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No custom headers configured"})]})]})]}),r.jsxs("div",{className:"bg-card rounded-lg shadow p-6 border border-border",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Entity Mappings"}),r.jsx(V,{type:"button",onClick:b,size:"sm",variant:"secondary",children:"Add Mapping"})]}),i.entityMappings.length>0?r.jsx("div",{className:"space-y-4",children:i.entityMappings.map(h=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Source Type"}),r.jsx("input",{type:"text",value:h.sourceType,onChange:m=>j(h.id,{sourceType:m.target.value}),className:"mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm",placeholder:"e.g., Contact"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Target Type"}),r.jsx("input",{type:"text",value:h.targetType,onChange:m=>j(h.id,{targetType:m.target.value}),className:"mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm",placeholder:"e.g., User"})]})]}),r.jsx("button",{type:"button",onClick:()=>v(h.id),className:"mt-2 text-sm text-red-600 hover:text-red-800",children:"Remove Mapping"})]},h.id))}):r.jsx("p",{className:"text-sm text-gray-500",children:"No entity mappings configured"})]}),r.jsxs("div",{className:"flex justify-end space-x-3",children:[r.jsx(V,{type:"button",onClick:s,variant:"secondary",children:"Cancel"}),r.jsx(V,{type:"submit",variant:"primary",disabled:a,children:a?"Saving...":"Save Configuration"})]})]})},JO=()=>{const{connections:e,users:t,integrations:n,refreshConnections:s}=Mt(),{socket:i,emit:o,on:a}=an(),[l,c]=g.useState(null),[u,d]=g.useState("overview"),[f,p]=g.useState(!1),[b,j]=g.useState(!1),[v,h]=g.useState(null),[m,x]=g.useState(null);g.useEffect(()=>{y();const A=a("connection-update",w),P=a("connection-test",S);return o("subscribe",{topics:["connections"]}),()=>{A&&A(),P&&P(),o("unsubscribe",{topics:["connections"]})}},[i]);const y=async()=>{try{const A=await W.get("/api/connections/stats/summary");x(A.data)}catch(A){console.error("Failed to fetch connection stats:",A)}},w=A=>{s(),y()},S=A=>{(l==null?void 0:l.id)===A.connectionId&&c(P=>({...P,lastTestResult:A.summary}))},C=async A=>{p(!1),h(null),await s(),c(A),d("config"),j(!0)},k=async A=>{j(!1),await s()},T=async A=>{if(confirm("Are you sure you want to delete this connection?"))try{await W.delete(`/api/connections/${A}`),await s(),(l==null?void 0:l.id)===A&&c(null)}catch(P){console.error("Failed to delete connection:",P),alert("Failed to delete connection")}},N=A=>n.find(P=>P.id===A)||{name:A},E=A=>{const P=t.find(M=>M.id===A);return P?`${P.firstName} ${P.lastName}`:A};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Connection Management"}),r.jsx("p",{className:"mt-2 text-gray-600",children:"Manage integration connections, test connectivity, and monitor health"})]}),r.jsx(V,{onClick:()=>p(!0),variant:"primary",children:"New Connection"})]}),m&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(B,{children:r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Total Connections"}),r.jsx("p",{className:"text-2xl font-bold text-gray-900",children:m.totalConnections})]})}),r.jsx(B,{children:r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Active"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:m.activeConnections})]})}),r.jsx(B,{children:r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Total Entities"}),r.jsx("p",{className:"text-2xl font-bold text-gray-900",children:m.totalEntities})]})}),r.jsx(B,{children:r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Recently Used"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:m.recentlyUsed})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsx("div",{className:"lg:col-span-1",children:r.jsx(B,{children:r.jsxs("div",{className:"p-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Connections"}),r.jsx("div",{className:"space-y-2",children:e.map(A=>{const P=N(A.integration);return r.jsx("button",{onClick:()=>{c(A),d("overview")},className:`w-full text-left p-3 rounded-lg transition-colors ${(l==null?void 0:l.id)===A.id?"bg-blue-50 border-blue-500 border":"hover:bg-gray-50 border border-gray-200"}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium text-gray-900",children:A.name||P.displayName||P.name}),r.jsx("p",{className:"text-sm text-gray-500",children:E(A.userId)})]}),r.jsx(Wx,{connectionId:A.id,compact:!0})]})},A.id)})}),e.length===0&&r.jsx("p",{className:"text-center text-gray-500 py-8",children:"No connections yet. Create your first connection above."})]})})}),r.jsx("div",{className:"lg:col-span-2",children:l?r.jsxs("div",{className:"space-y-6",children:[r.jsx(B,{children:r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:l.name||N(l.integration).displayName}),r.jsxs("p",{className:"text-sm text-gray-500",children:["Connected by ",E(l.userId)]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(wn,{status:l.status==="active"?"success":"error",text:l.status}),r.jsx(V,{onClick:()=>T(l.id),variant:"secondary",size:"sm",children:"Delete"})]})]}),r.jsx("div",{className:"flex space-x-1 border-b border-gray-200",children:[{id:"overview",label:"Overview"},{id:"test",label:"Test"},{id:"health",label:"Health"},{id:"entities",label:"Entities"},{id:"config",label:"Configuration"}].map(A=>r.jsx("button",{onClick:()=>d(A.id),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${u===A.id?"text-blue-600 border-blue-600":"text-gray-500 border-transparent hover:text-gray-700"}`,children:A.label},A.id))})]})}),u==="overview"&&r.jsx(B,{children:r.jsxs("div",{className:"p-6",children:[r.jsx("h4",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Connection Details"}),r.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Connection ID"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 font-mono",children:l.id})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Created"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900",children:new Date(l.createdAt).toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Last Updated"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900",children:new Date(l.updatedAt).toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Last Used"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900",children:l.lastUsed?new Date(l.lastUsed).toLocaleString():"Never"})]})]}),l.description&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h5",{className:"text-sm font-medium text-gray-500",children:"Description"}),r.jsx("p",{className:"mt-1 text-sm text-gray-900",children:l.description})]})]})}),u==="test"&&r.jsx(YO,{connection:l,onTestComplete:A=>{console.log("Test completed:",A)}}),u==="health"&&r.jsx(Wx,{connectionId:l.id,compact:!1}),u==="entities"&&r.jsx(XO,{connectionId:l.id}),u==="config"&&r.jsx(B,{children:r.jsx("div",{className:"p-6",children:b?r.jsx(QO,{connection:l,integration:N(l.integration),onSave:k,onCancel:()=>j(!1)}):r.jsxs("div",{children:[r.jsx("h4",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Configuration"}),r.jsx(V,{onClick:()=>j(!0),variant:"primary",children:"Edit Configuration"})]})})})]}):r.jsx(B,{children:r.jsx("div",{className:"p-8 text-center",children:r.jsx("p",{className:"text-gray-500",children:"Select a connection to view details and manage settings"})})})})]}),f&&r.jsx("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white rounded-lg p-6 max-w-lg w-full",children:v?r.jsx(GO,{integration:v,onSuccess:C,onCancel:()=>{p(!1),h(null)}}):r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Select Integration"}),r.jsx("div",{className:"space-y-2",children:n.map(A=>r.jsxs("button",{onClick:()=>h(A),className:"w-full text-left p-3 rounded-lg border border-gray-200 hover:bg-gray-50",children:[r.jsx("p",{className:"font-medium text-gray-900",children:A.displayName||A.name}),r.jsx("p",{className:"text-sm text-gray-500",children:A.description})]},A.id))}),r.jsx(V,{onClick:()=>p(!1),variant:"secondary",className:"mt-4 w-full",children:"Cancel"})]})})})]})},ZO=({user:e,integration:t})=>{const{currentUser:n}=Mt(),{on:s}=an(),[i,o]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState([]),[d,f]=g.useState("list"),[p,b]=g.useState(""),j=e||n;g.useEffect(()=>{const S=s("simulation:auth",T=>{v("Authentication",T.session)}),C=s("simulation:action",T=>{v("Action Performed",T.actionResult)}),k=s("simulation:webhook",T=>{v("Webhook Event",T.webhookEvent)});return()=>{S&&S(),C&&C(),k&&k()}},[s]);const v=(S,C)=>{u(k=>[{id:Date.now(),type:S,data:C,timestamp:new Date().toISOString()},...k].slice(0,50))},h=async()=>{if(!j||!t){alert("Please select a user and integration");return}try{o(!0);const S=await W.post("/api/users/simulation/authenticate",{userId:j.id,integrationId:t.id});l(S.data.session),v("Session Started",S.data.session)}catch(S){console.error("Failed to start simulation:",S),alert("Failed to start simulation"),o(!1)}},m=async()=>{if(a)try{await W.delete(`/api/users/simulation/sessions/${a.sessionId}`),l(null),o(!1),v("Session Ended",{sessionId:a.sessionId})}catch(S){console.error("Failed to stop simulation:",S)}},x=async()=>{if(a)try{let S={};if(p)try{S=JSON.parse(p)}catch{S={data:p}}const C=await W.post("/api/users/simulation/action",{sessionId:a.sessionId,action:d,payload:S});v("Action Result",C.data.actionResult)}catch(S){console.error("Failed to perform action:",S),alert("Failed to perform action")}},y=async()=>{if(!(!j||!t))try{const S=await W.post("/api/users/simulation/webhook",{userId:j.id,integrationId:t.id,event:"data.updated",data:{id:"webhook_item_"+Date.now(),changes:["field1","field2"],timestamp:new Date().toISOString()}});v("Webhook Simulated",S.data.webhookEvent)}catch(S){console.error("Failed to simulate webhook:",S),alert("Failed to simulate webhook")}},w=[{value:"list",label:"List Items"},{value:"create",label:"Create Item"},{value:"update",label:"Update Item"},{value:"delete",label:"Delete Item"},{value:"sync",label:"Sync Data"}];return r.jsxs("div",{className:"bg-white rounded-lg shadow p-6",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"User Simulation"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Simulate user interactions with integrations for testing"})]}),r.jsxs("div",{className:"space-y-4 mb-6",children:[r.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-gray-900",children:j?`${j.firstName} ${j.lastName}`:"No user selected"}),r.jsx("p",{className:"text-xs text-gray-500",children:t?t.name:"No integration selected"})]}),r.jsx("div",{className:"flex items-center space-x-2",children:i?r.jsxs("button",{onClick:m,className:"flex items-center space-x-2 px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:[r.jsx(qT,{size:16}),r.jsx("span",{children:"Stop Simulation"})]}):r.jsxs("button",{onClick:h,disabled:!j||!t,className:Y("flex items-center space-x-2 px-4 py-2 rounded-md transition-colors",j&&t?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[r.jsx(ub,{size:16}),r.jsx("span",{children:"Start Simulation"})]})})]}),a&&r.jsx("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg",children:r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(rl,{className:"text-blue-600 mt-0.5",size:20}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium text-blue-900",children:"Session Active"}),r.jsxs("p",{className:"text-xs text-blue-700 mt-1",children:["Session ID: ",a.sessionId]}),r.jsxs("p",{className:"text-xs text-blue-700",children:["Expires: ",new Date(a.expiresAt).toLocaleTimeString()]})]})]})})]}),i&&a&&r.jsx("div",{className:"space-y-4 mb-6",children:r.jsxs("div",{className:"p-4 border border-gray-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Simulate Action"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Action Type"}),r.jsx("select",{value:d,onChange:S=>f(S.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500",children:w.map(S=>r.jsx("option",{value:S.value,children:S.label},S.value))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Payload (JSON)"}),r.jsx("textarea",{value:p,onChange:S=>b(S.target.value),placeholder:'{"name": "Test Item"}',className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 font-mono text-xs",rows:3})]}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsxs("button",{onClick:x,className:"flex items-center space-x-2 px-3 py-1.5 bg-blue-600 text-white text-sm rounded-md hover:bg-blue-700",children:[r.jsx(db,{size:14}),r.jsx("span",{children:"Execute Action"})]}),r.jsxs("button",{onClick:y,className:"flex items-center space-x-2 px-3 py-1.5 bg-purple-600 text-white text-sm rounded-md hover:bg-purple-700",children:[r.jsx(Zt,{size:14}),r.jsx("span",{children:"Trigger Webhook"})]})]})]})]})}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Activity Log"}),r.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:c.length===0?r.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"No activity yet. Start a simulation to see logs."}):c.map(S=>r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Wi,{size:14,className:"text-gray-500"}),r.jsx("span",{className:"text-xs font-medium text-gray-900",children:S.type})]}),r.jsx("span",{className:"text-xs text-gray-500",children:new Date(S.timestamp).toLocaleTimeString()})]}),r.jsx("div",{className:"mt-1",children:r.jsx("pre",{className:"text-xs text-gray-600 font-mono overflow-x-auto",children:JSON.stringify(S.data,null,2)})})]},S.id))})]})]})},eL=()=>{const{users:e,integrations:t,currentUser:n}=Mt(),[s,i]=g.useState(null),[o,a]=g.useState(null),l=s||n;return r.jsxs("div",{children:[r.jsxs("div",{className:"mb-8",children:[r.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Integration Testing Simulator"}),r.jsx("p",{className:"mt-2 text-gray-600",children:"Simulate user interactions with integrations for development testing"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8",children:[r.jsxs("div",{className:"bg-white shadow rounded-lg p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Select Test User"}),n&&r.jsx("div",{className:"mb-4 p-3 bg-blue-50 border border-blue-200 rounded-md",children:r.jsxs("p",{className:"text-sm text-blue-800",children:["Using context user: ",r.jsxs("strong",{children:[n.firstName," ",n.lastName]})]})}),r.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:e.length===0?r.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"No test users available. Create some users first."}):e.map(c=>r.jsxs("label",{className:`flex items-center p-3 border rounded-md cursor-pointer transition-colors ${(l==null?void 0:l.id)===c.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:[r.jsx("input",{type:"radio",name:"user",value:c.id,checked:(l==null?void 0:l.id)===c.id,onChange:()=>i(c),className:"mr-3"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[c.firstName," ",c.lastName]}),r.jsx("p",{className:"text-xs text-gray-500",children:c.email}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:"text-xs bg-gray-100 text-gray-600 px-2 py-0.5 rounded",children:c.role}),c.appOrgId&&r.jsxs("span",{className:"text-xs text-gray-500",children:["Org: ",c.appOrgId]})]})]})]},c.id))})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Select Integration"}),r.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:t.length===0?r.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"No integrations available. Install some integrations first."}):t.map(c=>r.jsxs("label",{className:`flex items-center p-3 border rounded-md cursor-pointer transition-colors ${(o==null?void 0:o.id)===c.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:[r.jsx("input",{type:"radio",name:"integration",value:c.id,checked:(o==null?void 0:o.id)===c.id,onChange:()=>a(c),className:"mr-3"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium text-gray-900",children:c.name}),r.jsx("p",{className:"text-xs text-gray-500",children:c.description||"No description"}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${c.status==="active"?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"}`,children:c.status||"inactive"}),r.jsxs("span",{className:"text-xs text-gray-500",children:["v",c.version||"1.0.0"]})]})]})]},c.id))})]})]}),r.jsx(ZO,{user:l,integration:o}),r.jsxs("div",{className:"mt-8 bg-yellow-50 border border-yellow-200 rounded-lg p-6",children:[r.jsx("h4",{className:"text-sm font-semibold text-yellow-900 mb-2",children:"How to Use the Simulator"}),r.jsxs("ol",{className:"text-sm text-yellow-800 space-y-2 list-decimal list-inside",children:[r.jsx("li",{children:"Select a test user or use the current context user from the header"}),r.jsx("li",{children:"Choose an integration to test"}),r.jsx("li",{children:"Start a simulation session"}),r.jsx("li",{children:"Execute actions and observe the responses"}),r.jsx("li",{children:"Simulate webhook events to test integration reactions"}),r.jsx("li",{children:"Monitor the activity log for debugging"})]}),r.jsx("p",{className:"text-xs text-yellow-700 mt-3",children:"Note: All simulations are for local development only and do not affect real data."})]})]})};function tL({metrics:e}){if(!e||e.error)return r.jsx(B,{children:r.jsx("div",{className:"text-center py-8 text-gray-500",children:(e==null?void 0:e.error)||"No Lambda metrics available"})});const{functions:t=[]}=e,n=i=>{var o,a,l;return((o=i.metrics)==null?void 0:o.errors)>0?"error":((a=i.metrics)==null?void 0:a.throttles)>0?"warning":((l=i.metrics)==null?void 0:l.invocations)>0?"success":"inactive"},s=i=>i?i<1e3?`${Math.round(i)}ms`:`${(i/1e3).toFixed(2)}s`:"0ms";return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(B,{children:[r.jsxs("h3",{className:"text-lg font-semibold mb-4",children:["Lambda Functions (",t.length,")"]}),t.length===0?r.jsx("p",{className:"text-gray-500",children:"No Lambda functions found for this service"}):r.jsx("div",{className:"space-y-4",children:t.map((i,o)=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:i.functionName}),r.jsxs("div",{className:"text-sm text-gray-600 space-x-4",children:[r.jsxs("span",{children:["Runtime: ",i.runtime]}),r.jsxs("span",{children:["Memory: ",i.memorySize,"MB"]}),r.jsxs("span",{children:["Timeout: ",i.timeout,"s"]})]})]}),r.jsx(wn,{status:n(i),text:n(i)})]}),i.metrics&&r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4 mt-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Invocations"}),r.jsx("div",{className:"text-xl font-mono",children:i.metrics.invocations||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Errors"}),r.jsx("div",{className:"text-xl font-mono text-red-600",children:i.metrics.errors||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Duration"}),r.jsx("div",{className:"text-xl font-mono",children:s(i.metrics.duration)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Throttles"}),r.jsx("div",{className:"text-xl font-mono text-yellow-600",children:i.metrics.throttles||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Concurrent"}),r.jsx("div",{className:"text-xl font-mono",children:Math.round(i.metrics.concurrentexecutions||0)})]})]}),i.metrics&&(i.metrics.errors>0||i.metrics.throttles>0)&&r.jsxs("div",{className:"mt-3 p-3 bg-red-50 rounded text-sm",children:[i.metrics.errors>0&&r.jsx("div",{className:"text-red-700",children:"⚠️ This function has errors. Check CloudWatch logs for details."}),i.metrics.throttles>0&&r.jsx("div",{className:"text-yellow-700",children:"⚠️ This function is being throttled. Consider increasing reserved concurrency."})]}),r.jsxs("div",{className:"text-xs text-gray-500 mt-2",children:["Last modified: ",new Date(i.lastModified).toLocaleString()]})]},o))})]}),t.length>0&&r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Summary Statistics"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total Invocations"}),r.jsx("div",{className:"text-2xl font-mono",children:t.reduce((i,o)=>{var a;return i+(((a=o.metrics)==null?void 0:a.invocations)||0)},0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total Errors"}),r.jsx("div",{className:"text-2xl font-mono text-red-600",children:t.reduce((i,o)=>{var a;return i+(((a=o.metrics)==null?void 0:a.errors)||0)},0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Error Rate"}),r.jsx("div",{className:"text-2xl font-mono",children:(()=>{const i=t.reduce((a,l)=>{var c;return a+(((c=l.metrics)==null?void 0:c.invocations)||0)},0),o=t.reduce((a,l)=>{var c;return a+(((c=l.metrics)==null?void 0:c.errors)||0)},0);return i>0?`${(o/i*100).toFixed(2)}%`:"0%"})()})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Duration"}),r.jsx("div",{className:"text-2xl font-mono",children:(()=>{const i=t.filter(a=>{var l;return((l=a.metrics)==null?void 0:l.duration)>0});if(i.length===0)return"0ms";const o=i.reduce((a,l)=>a+l.metrics.duration,0)/i.length;return s(o)})()})]})]})]})]})}function nL({metrics:e}){if(!e||e.error)return r.jsx(B,{children:r.jsx("div",{className:"text-center py-8 text-gray-500",children:(e==null?void 0:e.error)||"No API Gateway metrics available"})});const{apis:t=[]}=e,n=i=>{var o,a,l;return((o=i.metrics)==null?void 0:o["5xxerror"])>0?"error":((a=i.metrics)==null?void 0:a["4xxerror"])>0?"warning":((l=i.metrics)==null?void 0:l.count)>0?"success":"inactive"},s=i=>i?`${Math.round(i)}ms`:"0ms";return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(B,{children:[r.jsxs("h3",{className:"text-lg font-semibold mb-4",children:["API Gateways (",t.length,")"]}),t.length===0?r.jsx("p",{className:"text-gray-500",children:"No API Gateways found for this service"}):r.jsx("div",{className:"space-y-4",children:t.map((i,o)=>{var a;return r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:i.apiName}),r.jsxs("div",{className:"text-sm text-gray-600",children:[r.jsxs("span",{children:["ID: ",i.apiId]}),i.description&&r.jsx("span",{className:"ml-4",children:i.description})]})]}),r.jsx(wn,{status:n(i),text:n(i)})]}),i.metrics&&r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-4 mt-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total Requests"}),r.jsx("div",{className:"text-xl font-mono",children:i.metrics.count||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"4XX Errors"}),r.jsx("div",{className:"text-xl font-mono text-yellow-600",children:i.metrics["4xxerror"]||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"5XX Errors"}),r.jsx("div",{className:"text-xl font-mono text-red-600",children:i.metrics["5xxerror"]||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Error Rate"}),r.jsxs("div",{className:"text-xl font-mono",children:[((a=i.metrics.errorRate)==null?void 0:a.toFixed(2))||0,"%"]})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Latency"}),r.jsx("div",{className:"text-xl font-mono",children:s(i.metrics.latency)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Integration"}),r.jsx("div",{className:"text-xl font-mono",children:s(i.metrics.integrationlatency)})]})]}),i.metrics&&(i.metrics["5xxerror"]>0||i.metrics.errorRate>5)&&r.jsxs("div",{className:"mt-3 p-3 bg-red-50 rounded text-sm",children:[i.metrics["5xxerror"]>0&&r.jsx("div",{className:"text-red-700",children:"⚠️ Server errors detected. Check Lambda function logs and API Gateway execution logs."}),i.metrics.errorRate>5&&r.jsxs("div",{className:"text-yellow-700",children:["⚠️ High error rate detected (",i.metrics.errorRate.toFixed(2),"%). Review recent deployments."]})]}),r.jsxs("div",{className:"text-xs text-gray-500 mt-2",children:["Created: ",new Date(i.createdDate).toLocaleString()]})]},o)})})]}),t.length>0&&t.some(i=>{var o;return((o=i.metrics)==null?void 0:o.count)>0})&&r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Performance Analysis"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Latency Breakdown"}),r.jsx("div",{className:"space-y-2",children:t.filter(i=>{var o;return((o=i.metrics)==null?void 0:o.latency)>0}).map((i,o)=>{const a=i.metrics.latency||0,l=i.metrics.integrationlatency||0,c=a-l;return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-32 text-sm truncate",children:i.apiName}),r.jsxs("div",{className:"flex-1 flex h-6 rounded overflow-hidden",children:[r.jsx("div",{className:"bg-blue-500 flex items-center justify-center text-xs text-white",style:{width:`${c/a*100}%`},children:s(c)}),r.jsx("div",{className:"bg-green-500 flex items-center justify-center text-xs text-white",style:{width:`${l/a*100}%`},children:s(l)})]}),r.jsx("div",{className:"text-sm font-mono w-20 text-right",children:s(a)})]},o)})}),r.jsxs("div",{className:"flex gap-4 mt-2 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),r.jsx("span",{children:"Gateway Overhead"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),r.jsx("span",{children:"Integration (Lambda)"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total Requests"}),r.jsx("div",{className:"text-2xl font-mono",children:t.reduce((i,o)=>{var a;return i+(((a=o.metrics)==null?void 0:a.count)||0)},0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total Errors"}),r.jsx("div",{className:"text-2xl font-mono text-red-600",children:t.reduce((i,o)=>{var a,l;return i+(((a=o.metrics)==null?void 0:a["4xxerror"])||0)+(((l=o.metrics)==null?void 0:l["5xxerror"])||0)},0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Error Rate"}),r.jsx("div",{className:"text-2xl font-mono",children:(()=>{const i=t.filter(a=>{var l;return((l=a.metrics)==null?void 0:l.count)>0});return i.length===0?"0%":`${(i.reduce((a,l)=>a+(l.metrics.errorRate||0),0)/i.length).toFixed(2)}%`})()})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Latency"}),r.jsx("div",{className:"text-2xl font-mono",children:(()=>{const i=t.filter(a=>{var l;return((l=a.metrics)==null?void 0:l.latency)>0});if(i.length===0)return"0ms";const o=i.reduce((a,l)=>a+l.metrics.latency,0)/i.length;return s(o)})()})]})]})]})]})]})}function sL({metrics:e}){if(!e||e.error)return r.jsx(B,{children:r.jsx("div",{className:"text-center py-8 text-gray-500",children:(e==null?void 0:e.error)||"No SQS metrics available"})});const{queues:t=[]}=e,n=o=>o.error?"error":o.messagesAvailable>100?"warning":o.messagesInFlight>0?"success":"inactive",s=o=>{if(!o)return"Unknown";const a=Date.now()-parseInt(o)*1e3,l=Math.floor(a/(1e3*60*60*24)),c=Math.floor(a%(1e3*60*60*24)/(1e3*60*60));return l>0?`${l}d ${c}h`:c>0?`${c}h`:"Just created"},i=o=>{const a=Math.floor(o/86400),l=Math.floor(o%(60*60*24)/(60*60));return`${a}d ${l}h`};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(B,{children:[r.jsxs("h3",{className:"text-lg font-semibold mb-4",children:["SQS Queues (",t.length,")"]}),t.length===0?r.jsx("p",{className:"text-gray-500",children:"No SQS queues found for this service"}):r.jsx("div",{className:"space-y-4",children:t.map((o,a)=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:o.queueName}),r.jsx("div",{className:"text-sm text-gray-600",children:r.jsx("span",{className:"break-all",children:o.queueUrl})})]}),r.jsx(wn,{status:n(o),text:n(o)})]}),o.error?r.jsxs("div",{className:"mt-3 p-3 bg-red-50 rounded text-sm text-red-700",children:["Error fetching queue metrics: ",o.error]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Available"}),r.jsx("div",{className:"text-xl font-mono",children:o.messagesAvailable||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"In Flight"}),r.jsx("div",{className:"text-xl font-mono text-blue-600",children:o.messagesInFlight||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Delayed"}),r.jsx("div",{className:"text-xl font-mono text-yellow-600",children:o.messagesDelayed||0})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total"}),r.jsx("div",{className:"text-xl font-mono",children:(o.messagesAvailable||0)+(o.messagesInFlight||0)+(o.messagesDelayed||0)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mt-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Visibility Timeout"}),r.jsxs("div",{className:"font-mono",children:[o.visibilityTimeout,"s"]})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Retention Period"}),r.jsx("div",{className:"font-mono",children:i(o.messageRetentionPeriod)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Age"}),r.jsx("div",{className:"font-mono",children:s(o.createdTimestamp)})]})]}),o.messagesAvailable>100&&r.jsx("div",{className:"mt-3 p-3 bg-yellow-50 rounded text-sm text-yellow-700",children:"⚠️ High message count detected. Queue may be backing up."}),o.messagesInFlight>10&&r.jsx("div",{className:"mt-3 p-3 bg-blue-50 rounded text-sm text-blue-700",children:"ℹ️ Multiple messages being processed. Monitor for processing delays."})]})]},a))})]}),t.length>0&&r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Queue Health Summary"}),r.jsx("div",{className:"space-y-3 mb-4",children:t.filter(o=>!o.error).map((o,a)=>{const l=(o.messagesAvailable||0)+(o.messagesInFlight||0)+(o.messagesDelayed||0),c=l>0?o.messagesAvailable/l*100:0,u=l>0?o.messagesInFlight/l*100:0,d=l>0?o.messagesDelayed/l*100:0;return r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[r.jsx("span",{className:"font-medium",children:o.queueName}),r.jsxs("span",{className:"font-mono",children:[l," messages"]})]}),r.jsxs("div",{className:"flex h-6 rounded overflow-hidden bg-gray-200",children:[c>0&&r.jsx("div",{className:"bg-green-500",style:{width:`${c}%`},title:`${o.messagesAvailable} available`}),u>0&&r.jsx("div",{className:"bg-blue-500",style:{width:`${u}%`},title:`${o.messagesInFlight} in flight`}),d>0&&r.jsx("div",{className:"bg-yellow-500",style:{width:`${d}%`},title:`${o.messagesDelayed} delayed`})]})]},a)})}),r.jsxs("div",{className:"flex gap-4 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),r.jsx("span",{children:"Available"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),r.jsx("span",{children:"In Flight"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded"}),r.jsx("span",{children:"Delayed"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-6 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Total Messages"}),r.jsx("div",{className:"text-2xl font-mono",children:t.reduce((o,a)=>o+(a.messagesAvailable||0)+(a.messagesInFlight||0)+(a.messagesDelayed||0),0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Available"}),r.jsx("div",{className:"text-2xl font-mono text-green-600",children:t.reduce((o,a)=>o+(a.messagesAvailable||0),0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Processing"}),r.jsx("div",{className:"text-2xl font-mono text-blue-600",children:t.reduce((o,a)=>o+(a.messagesInFlight||0),0)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600",children:"Delayed"}),r.jsx("div",{className:"text-2xl font-mono text-yellow-600",children:t.reduce((o,a)=>o+(a.messagesDelayed||0),0)})]})]})]})]})}function rL({metrics:e}){var a,l,c,u,d,f,p,b,j,v;if(!e)return r.jsx(B,{children:r.jsx("div",{className:"text-center py-8 text-gray-500",children:"No metrics data available for charting"})});const t=(h,m,x="blue")=>{if(!h||h.length===0)return null;const y=Math.max(...h.map(w=>w.value));return r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"font-medium mb-3",children:m}),r.jsx("div",{className:"space-y-2",children:h.map((w,S)=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-32 text-sm truncate",children:w.label}),r.jsxs("div",{className:"flex-1 flex items-center",children:[r.jsx("div",{className:"flex-1 bg-gray-200 rounded h-6 relative",children:r.jsx("div",{className:`bg-${x}-500 h-full rounded transition-all duration-300`,style:{width:`${w.value/y*100}%`}})}),r.jsx("span",{className:"ml-2 text-sm font-mono w-16 text-right",children:w.value})]})]},S))})]})},n=((l=(a=e.lambda)==null?void 0:a.functions)==null?void 0:l.map(h=>{var m;return{label:h.functionName.split("-").pop()||h.functionName,value:((m=h.metrics)==null?void 0:m.invocations)||0}}))||[],s=((u=(c=e.lambda)==null?void 0:c.functions)==null?void 0:u.map(h=>{var m;return{label:h.functionName.split("-").pop()||h.functionName,value:((m=h.metrics)==null?void 0:m.errors)||0}}))||[],i=((f=(d=e.apiGateway)==null?void 0:d.apis)==null?void 0:f.map(h=>{var m;return{label:h.apiName.split("-").pop()||h.apiName,value:((m=h.metrics)==null?void 0:m.count)||0}}))||[],o=((b=(p=e.sqs)==null?void 0:p.queues)==null?void 0:b.map(h=>({label:h.queueName.split("-").pop()||h.queueName,value:(h.messagesAvailable||0)+(h.messagesInFlight||0)})))||[];return r.jsx("div",{className:"space-y-6",children:r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Metrics Visualization"}),r.jsx("p",{className:"text-gray-600 mb-6",children:"Visual representation of your Frigg application metrics. Charts are updated in real-time as new metrics are collected."}),n.length>0&&t(n.filter(h=>h.value>0),"Lambda Function Invocations (Last Hour)","blue"),s.some(h=>h.value>0)&&t(s.filter(h=>h.value>0),"Lambda Function Errors (Last Hour)","red"),i.length>0&&t(i.filter(h=>h.value>0),"API Gateway Requests (Last Hour)","green"),o.length>0&&t(o.filter(h=>h.value>0),"SQS Queue Messages","yellow"),((v=(j=e.lambda)==null?void 0:j.functions)==null?void 0:v.length)>0&&r.jsxs("div",{className:"mt-8",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Average Duration Comparison"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.lambda.functions.filter(h=>{var m;return((m=h.metrics)==null?void 0:m.duration)>0}).sort((h,m)=>{var x,y;return(((x=m.metrics)==null?void 0:x.duration)||0)-(((y=h.metrics)==null?void 0:y.duration)||0)}).map((h,m)=>r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-sm font-medium truncate",children:h.functionName.split("-").pop()||h.functionName}),r.jsx("div",{className:"text-2xl font-mono",children:h.metrics.duration<1e3?`${Math.round(h.metrics.duration)}ms`:`${(h.metrics.duration/1e3).toFixed(2)}s`}),r.jsxs("div",{className:"text-xs text-gray-500",children:[h.metrics.invocations," invocations"]})]},m))})]}),r.jsxs("div",{className:"mt-8 p-4 bg-gray-50 rounded",children:[r.jsx("h4",{className:"font-medium mb-2",children:"System Health Score"}),r.jsx("div",{className:"flex items-center gap-4",children:r.jsx("div",{className:"flex-1",children:(()=>{var S,C,k,T;const h=((C=(S=e.lambda)==null?void 0:S.functions)==null?void 0:C.reduce((N,E)=>{var A;return N+(((A=E.metrics)==null?void 0:A.invocations)||0)},0))||0,m=((T=(k=e.lambda)==null?void 0:k.functions)==null?void 0:T.reduce((N,E)=>{var A;return N+(((A=E.metrics)==null?void 0:A.errors)||0)},0))||0,x=h>0?m/h*100:0,y=Math.max(0,100-x*10);let w="green";return y<80&&(w="yellow"),y<60&&(w="red"),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[r.jsx("span",{children:"Overall Health"}),r.jsxs("span",{children:[Math.round(y),"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-4",children:r.jsx("div",{className:`bg-${w}-500 h-4 rounded-full transition-all duration-300`,style:{width:`${y}%`}})}),r.jsx("div",{className:"text-xs text-gray-600 mt-1",children:"Based on error rates and response times"})]})})()})})]}),r.jsxs("div",{className:"mt-8 p-4 bg-blue-50 rounded text-sm text-blue-700",children:[r.jsx("strong",{children:"Coming Soon:"})," Interactive time-series charts with Chart.js or D3.js for historical trend analysis and real-time metric streaming."]})]})})}function iL(){const[e,t]=g.useState({initialized:!1,isMonitoring:!1,config:null}),[n,s]=g.useState(null),[i,o]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState("overview"),{socket:d,connected:f}=an();g.useEffect(()=>{p()},[]),g.useEffect(()=>{if(!d||!f)return;const m=y=>{s(y),l(null)},x=y=>{l(y.message||"Monitoring error occurred")};return d.emit("subscribe",{topics:["monitoring:metrics","monitoring:error"]}),d.on("broadcast",y=>{y.topic==="monitoring:metrics"?m(y.data):y.topic==="monitoring:error"&&x(y.data)}),()=>{d.emit("unsubscribe",{topics:["monitoring:metrics","monitoring:error"]}),d.off("broadcast")}},[d,f]);const p=async()=>{try{const x=await(await fetch("/api/monitoring/status")).json();t(x)}catch(m){console.error("Failed to check monitoring status:",m)}},b=async()=>{o(!0),l(null);try{if(!(await fetch("/api/monitoring/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collectionInterval:6e4})})).ok)throw new Error("Failed to initialize monitoring");if(!(await fetch("/api/monitoring/start",{method:"POST"})).ok)throw new Error("Failed to start monitoring");await p(),await v()}catch(m){l(m.message)}finally{o(!1)}},j=async()=>{o(!0);try{if(!(await fetch("/api/monitoring/stop",{method:"POST"})).ok)throw new Error("Failed to stop monitoring");await p(),s(null)}catch(m){l(m.message)}finally{o(!1)}},v=async()=>{o(!0);try{const m=await fetch("/api/monitoring/metrics/collect",{method:"POST"});if(!m.ok)throw new Error("Failed to collect metrics");const x=await m.json();x.success&&s(x.data)}catch(m){l(m.message)}finally{o(!1)}},h=()=>{var w,S,C;if(!n)return r.jsx("div",{className:"text-center py-8 text-gray-500",children:"No metrics available. Start monitoring to see data."});const{lambda:m,apiGateway:x,sqs:y}=n;return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Lambda Functions"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total Functions:"}),r.jsx("span",{className:"font-mono",children:m.totalFunctions||0})]}),m.functions&&m.functions.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total Invocations:"}),r.jsx("span",{className:"font-mono",children:m.functions.reduce((k,T)=>{var N;return k+(((N=T.metrics)==null?void 0:N.invocations)||0)},0)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total Errors:"}),r.jsx("span",{className:"font-mono text-red-600",children:m.functions.reduce((k,T)=>{var N;return k+(((N=T.metrics)==null?void 0:N.errors)||0)},0)})]})]})]})]}),r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"API Gateway"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total APIs:"}),r.jsx("span",{className:"font-mono",children:x.totalApis||0})]}),x.apis&&x.apis.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total Requests:"}),r.jsx("span",{className:"font-mono",children:x.apis.reduce((k,T)=>{var N;return k+(((N=T.metrics)==null?void 0:N.count)||0)},0)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Error Rate:"}),r.jsxs("span",{className:"font-mono",children:[((C=(S=(w=x.apis[0])==null?void 0:w.metrics)==null?void 0:S.errorRate)==null?void 0:C.toFixed(2))||0,"%"]})]})]})]})]}),r.jsxs(B,{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"SQS Queues"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Total Queues:"}),r.jsx("span",{className:"font-mono",children:y.totalQueues||0})]}),y.queues&&y.queues.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Messages Available:"}),r.jsx("span",{className:"font-mono",children:y.queues.reduce((k,T)=>k+(T.messagesAvailable||0),0)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Messages In Flight:"}),r.jsx("span",{className:"font-mono",children:y.queues.reduce((k,T)=>k+(T.messagesInFlight||0),0)})]})]})]})]})]})};return r.jsxs("div",{className:"monitoring-dashboard",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Production Monitoring"}),r.jsx("p",{className:"text-gray-600",children:"Monitor your production Frigg instances in real-time with AWS CloudWatch integration"})]}),r.jsx(B,{className:"mb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(wn,{status:e.isMonitoring?"success":"inactive",text:e.isMonitoring?"Monitoring Active":"Monitoring Inactive"}),e.config&&r.jsxs("div",{className:"text-sm text-gray-600",children:["Region: ",r.jsx("span",{className:"font-mono",children:e.config.region})," | Stage: ",r.jsx("span",{className:"font-mono",children:e.config.stage})," | Service: ",r.jsx("span",{className:"font-mono",children:e.config.serviceName})]})]}),r.jsx("div",{className:"flex gap-2",children:e.isMonitoring?r.jsxs(r.Fragment,{children:[r.jsx(V,{variant:"secondary",onClick:v,disabled:i,children:"Refresh Now"}),r.jsx(V,{variant:"secondary",onClick:j,disabled:i,children:"Stop Monitoring"})]}):r.jsx(V,{onClick:b,disabled:i,children:i?r.jsx(Ke,{size:"sm"}):"Start Monitoring"})})]})}),a&&r.jsx(B,{className:"mb-6 border-red-500 bg-red-50",children:r.jsxs("div",{className:"text-red-700",children:[r.jsx("strong",{children:"Error:"})," ",a]})}),r.jsxs("div",{className:"flex gap-2 mb-6",children:[r.jsx(V,{variant:c==="overview"?"primary":"secondary",onClick:()=>u("overview"),children:"Overview"}),r.jsx(V,{variant:c==="lambda"?"primary":"secondary",onClick:()=>u("lambda"),children:"Lambda Functions"}),r.jsx(V,{variant:c==="apigateway"?"primary":"secondary",onClick:()=>u("apigateway"),children:"API Gateway"}),r.jsx(V,{variant:c==="sqs"?"primary":"secondary",onClick:()=>u("sqs"),children:"SQS Queues"}),r.jsx(V,{variant:c==="charts"?"primary":"secondary",onClick:()=>u("charts"),children:"Charts"})]}),i&&!n?r.jsx(B,{children:r.jsxs("div",{className:"flex items-center justify-center py-8",children:[r.jsx(Ke,{}),r.jsx("span",{className:"ml-2",children:"Loading metrics..."})]})}):r.jsxs(r.Fragment,{children:[c==="overview"&&h(),c==="lambda"&&r.jsx(tL,{metrics:n==null?void 0:n.lambda}),c==="apigateway"&&r.jsx(nL,{metrics:n==null?void 0:n.apiGateway}),c==="sqs"&&r.jsx(sL,{metrics:n==null?void 0:n.sqs}),c==="charts"&&r.jsx(rL,{metrics:n})]}),n&&r.jsxs("div",{className:"mt-4 text-sm text-gray-500 text-right",children:["Last updated: ",new Date(n.timestamp).toLocaleString(),n.collectionDuration&&r.jsxs("span",{children:[" (collected in ",n.collectionDuration,"ms)"]})]})]})}function oL(){return r.jsx(aj,{children:r.jsx(iL,{})})}const aL={INTEGRATION:"Integration Templates",API:"API Templates",UTILITY:"Utility Templates",CUSTOM:"Custom Templates"},Ws={"api-wrapper":{name:"API Wrapper",description:"Generic API wrapper with authentication and error handling",category:"INTEGRATION",variables:["serviceName","baseURL","authType"],template:`const axios = require('axios');
431
-
432
- class {{serviceName}}API {
433
- constructor(config) {
434
- this.baseURL = '{{baseURL}}';
435
- this.client = axios.create({
436
- baseURL: this.baseURL,
437
- timeout: 30000
438
- });
439
-
440
- {{#if authType}}
441
- this.setupAuthentication('{{authType}}');
442
- {{/if}}
443
- }
444
-
445
- setupAuthentication(type) {
446
- switch(type) {
447
- case 'bearer':
448
- this.client.defaults.headers.common['Authorization'] = \`Bearer \${this.token}\`;
449
- break;
450
- case 'api-key':
451
- this.client.defaults.headers.common['X-API-Key'] = this.apiKey;
452
- break;
453
- }
454
- }
455
-
456
- async request(method, path, data = null) {
457
- try {
458
- const response = await this.client.request({
459
- method,
460
- url: path,
461
- data
462
- });
463
- return response.data;
464
- } catch (error) {
465
- throw this.handleError(error);
466
- }
467
- }
468
-
469
- handleError(error) {
470
- if (error.response) {
471
- return new Error(\`API Error: \${error.response.status} - \${error.response.data.message || error.response.statusText}\`);
472
- } else if (error.request) {
473
- return new Error('Network Error: No response received');
474
- } else {
475
- return new Error(\`Request Error: \${error.message}\`);
476
- }
477
- }
478
- }
479
-
480
- module.exports = {{serviceName}}API;`},"webhook-handler":{name:"Webhook Handler",description:"Express middleware for handling webhooks with signature verification",category:"API",variables:["serviceName","secretHeader","signatureAlgorithm"],template:`const crypto = require('crypto');
481
- const express = require('express');
482
-
483
- class {{serviceName}}WebhookHandler {
484
- constructor(options = {}) {
485
- this.secret = options.secret || process.env.{{serviceName.toUpperCase()}}_WEBHOOK_SECRET;
486
- this.secretHeader = '{{secretHeader}}' || 'x-hub-signature-256';
487
- this.algorithm = '{{signatureAlgorithm}}' || 'sha256';
488
- this.router = express.Router();
489
- this.setupRoutes();
490
- }
491
-
492
- setupRoutes() {
493
- this.router.use(express.raw({ type: 'application/json' }));
494
- this.router.post('/webhook', this.verifySignature.bind(this), this.handleWebhook.bind(this));
495
- }
496
-
497
- verifySignature(req, res, next) {
498
- const signature = req.headers[this.secretHeader];
499
- if (!signature) {
500
- return res.status(401).json({ error: 'Missing signature header' });
501
- }
502
-
503
- const expectedSignature = crypto
504
- .createHmac(this.algorithm, this.secret)
505
- .update(req.body)
506
- .digest('hex');
507
-
508
- const providedSignature = signature.replace(\`\${this.algorithm}=\`, '');
509
-
510
- if (!crypto.timingSafeEqual(Buffer.from(expectedSignature), Buffer.from(providedSignature))) {
511
- return res.status(401).json({ error: 'Invalid signature' });
512
- }
513
-
514
- next();
515
- }
516
-
517
- async handleWebhook(req, res) {
518
- try {
519
- const payload = JSON.parse(req.body);
520
- await this.processWebhook(payload);
521
- res.status(200).json({ success: true });
522
- } catch (error) {
523
- console.error('Webhook processing error:', error);
524
- res.status(500).json({ error: 'Webhook processing failed' });
525
- }
526
- }
527
-
528
- async processWebhook(payload) {
529
- // Override this method in your implementation
530
- console.log('Received webhook:', payload);
531
- }
532
-
533
- getRouter() {
534
- return this.router;
535
- }
536
- }
537
-
538
- module.exports = {{serviceName}}WebhookHandler;`},"data-transformer":{name:"Data Transformer",description:"Utility for transforming data between different schemas",category:"UTILITY",variables:["transformerName","sourceSchema","targetSchema"],template:`class {{transformerName}} {
539
- constructor(mappingConfig = {}) {
540
- this.mapping = mappingConfig;
541
- this.validators = {};
542
- this.transformers = {};
543
- this.setupDefaultTransformers();
544
- }
545
-
546
- setupDefaultTransformers() {
547
- this.transformers = {
548
- string: (value) => String(value),
549
- number: (value) => Number(value),
550
- boolean: (value) => Boolean(value),
551
- date: (value) => new Date(value),
552
- array: (value) => Array.isArray(value) ? value : [value]
553
- };
554
- }
555
-
556
- transform(sourceData, mappingKey = 'default') {
557
- const mapping = this.mapping[mappingKey];
558
- if (!mapping) {
559
- throw new Error(\`Mapping '\${mappingKey}' not found\`);
560
- }
561
-
562
- const result = {};
563
-
564
- for (const [targetField, config] of Object.entries(mapping)) {
565
- try {
566
- const value = this.extractValue(sourceData, config.source);
567
- const transformedValue = this.applyTransforms(value, config.transforms || []);
568
- this.setValue(result, targetField, transformedValue);
569
- } catch (error) {
570
- if (config.required) {
571
- throw new Error(\`Failed to transform required field '\${targetField}': \${error.message}\`);
572
- }
573
- if (config.default !== undefined) {
574
- this.setValue(result, targetField, config.default);
575
- }
576
- }
577
- }
578
-
579
- return result;
580
- }
581
-
582
- extractValue(data, path) {
583
- return path.split('.').reduce((obj, key) => {
584
- if (obj === null || obj === undefined) return undefined;
585
- return obj[key];
586
- }, data);
587
- }
588
-
589
- setValue(obj, path, value) {
590
- const keys = path.split('.');
591
- const lastKey = keys.pop();
592
- const target = keys.reduce((o, key) => {
593
- if (!(key in o)) o[key] = {};
594
- return o[key];
595
- }, obj);
596
- target[lastKey] = value;
597
- }
598
-
599
- applyTransforms(value, transforms) {
600
- return transforms.reduce((val, transform) => {
601
- if (typeof transform === 'string') {
602
- return this.transformers[transform](val);
603
- } else if (typeof transform === 'function') {
604
- return transform(val);
605
- } else if (transform.type && this.transformers[transform.type]) {
606
- return this.transformers[transform.type](val, transform.options);
607
- }
608
- return val;
609
- }, value);
610
- }
611
-
612
- addTransformer(name, transformer) {
613
- this.transformers[name] = transformer;
614
- }
615
-
616
- addMapping(key, mapping) {
617
- this.mapping[key] = mapping;
618
- }
619
- }
620
-
621
- module.exports = {{transformerName}};`}},lL=({onGenerate:e})=>{const[t,n]=g.useState(null),[s,i]=g.useState({}),[o,a]=g.useState(""),[l,c]=g.useState([]),[u,d]=g.useState(!1),f=g.useCallback(C=>{n(C);const k=Ws[C];if(k){const T={};k.variables.forEach(N=>{T[N]=""}),i(T)}},[]),p=g.useCallback((C,k)=>{i(T=>({...T,[C]:k}))},[]),b=g.useCallback(()=>{c(C=>[...C,{name:"",description:"",defaultValue:""}])},[]),j=g.useCallback((C,k,T)=>{c(N=>N.map((E,A)=>A===C?{...E,[k]:T}:E))},[]),v=g.useCallback(C=>{c(k=>k.filter((T,N)=>N!==C))},[]),h=g.useCallback((C,k)=>{let T=C;return Object.entries(k).forEach(([N,E])=>{const A=new RegExp(`{{${N}}}`,"g");T=T.replace(A,E);const P=new RegExp(`{{${N}\\.toUpperCase\\(\\)}}`,"g");T=T.replace(P,E.toUpperCase());const M=new RegExp(`{{#if ${N}}}([\\s\\S]*?){{/if}}`,"g");T=T.replace(M,E?"$1":"")}),T=T.replace(/{{[^}]+}}/g,""),T},[]),m=g.useCallback(()=>{let C,k,T;if(u)C=o,k=l.reduce((N,E)=>(N[E.name]=E.defaultValue,N),{}),T={name:"custom-template",type:"custom",files:[{name:"index.js",content:h(C,k)},{name:"README.md",content:w()}]};else{const N=Ws[t];if(!N)return;const E=h(N.template,s);T={name:t,type:"template",files:[{name:"index.js",content:E},{name:"package.json",content:x(N)},{name:"README.md",content:y(N)}]}}e(u?{customTemplate:o,customVariables:l}:s,u?C:h(Ws[t].template,s),T)},[u,o,l,t,s,h,e]),x=C=>JSON.stringify({name:`frigg-${t}`,version:"1.0.0",description:C.description,main:"index.js",scripts:{test:'echo "No tests yet" && exit 0'},dependencies:{"@friggframework/core":"^1.0.0"}},null,2),y=C=>`# ${C.name}
622
-
623
- ${C.description}
624
-
625
- ## Variables Used
626
-
627
- ${C.variables.map(k=>`- **${k}**: ${s[k]||"Not set"}`).join(`
628
- `)}
629
-
630
- ## Usage
631
-
632
- \`\`\`javascript
633
- const ${s.serviceName||"Service"} = require('./index');
634
-
635
- // Your implementation here
636
- \`\`\`
637
-
638
- ## Customization
639
-
640
- This code was generated from a template. Modify it according to your specific needs.
641
- `,w=()=>`# Custom Template
642
-
643
- Generated from a custom template.
644
-
645
- ## Variables
646
-
647
- ${l.map(C=>`- **${C.name}**: ${C.description||"No description"}`).join(`
648
- `)}
649
-
650
- ## Usage
651
-
652
- This is a custom template. Refer to the generated code for usage instructions.
653
- `,S=()=>{if(u)return o.trim().length>0;if(!t)return!1;const C=Ws[t];return C&&C.variables.every(k=>{var T;return(T=s[k])==null?void 0:T.trim()})};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Template Selector"}),r.jsx(B,{className:"p-4",children:r.jsxs("div",{className:"flex space-x-4",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"radio",checked:!u,onChange:()=>d(!1),className:"mr-2"}),"Built-in Templates"]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"radio",checked:u,onChange:()=>d(!0),className:"mr-2"}),"Custom Template"]})]})}),u?r.jsx(r.Fragment,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs(B,{className:"p-6",children:[r.jsx("h3",{className:"text-lg font-medium mb-4",children:"Custom Template"}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Template Code"}),r.jsx("textarea",{value:o,onChange:C=>a(C.target.value),placeholder:"Enter your template code here. Use {{variableName}} for variables.",rows:12,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm"}),r.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Use ","{{variableName}}"," syntax for variables. Supports ","{{#if variable}}...{{/if}}"," for conditionals."]})]})})]}),r.jsxs(B,{className:"p-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Template Variables"}),r.jsx(V,{onClick:b,size:"sm",children:"Add Variable"})]}),l.length===0&&r.jsx("div",{className:"text-center py-4 text-gray-500",children:"No variables defined. Add variables to make your template dynamic."}),r.jsx("div",{className:"space-y-3",children:l.map((C,k)=>r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3 p-3 border rounded",children:[r.jsx("input",{type:"text",value:C.name,onChange:T=>j(k,"name",T.target.value),placeholder:"Variable name",className:"px-2 py-1 border border-gray-300 rounded text-sm"}),r.jsx("input",{type:"text",value:C.description,onChange:T=>j(k,"description",T.target.value),placeholder:"Description",className:"px-2 py-1 border border-gray-300 rounded text-sm"}),r.jsx("input",{type:"text",value:C.defaultValue,onChange:T=>j(k,"defaultValue",T.target.value),placeholder:"Default value",className:"px-2 py-1 border border-gray-300 rounded text-sm"}),r.jsx(V,{size:"sm",variant:"outline",onClick:()=>v(k),className:"text-red-600 hover:text-red-700",children:"Remove"})]},k))})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Choose a Template"}),Object.entries(aL).map(([C,k])=>{const T=Object.entries(Ws).filter(([,N])=>N.category===C);return T.length===0?null:r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:k}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:T.map(([N,E])=>r.jsxs(B,{className:`cursor-pointer transition-all p-4 ${t===N?"border-blue-500 bg-blue-50":"hover:border-gray-300"}`,onClick:()=>f(N),children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsx("h5",{className:"font-medium",children:E.name}),r.jsx("input",{type:"radio",checked:t===N,onChange:()=>f(N),className:"mt-1"})]}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:E.description}),r.jsxs("div",{className:"text-xs text-gray-500",children:["Variables: ",E.variables.join(", ")]})]},N))})]},C)})]}),t&&r.jsxs(B,{className:"p-6",children:[r.jsx("h3",{className:"text-lg font-medium mb-4",children:"Configure Template Variables"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Ws[t].variables.map(C=>r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:C.charAt(0).toUpperCase()+C.slice(1)}),r.jsx("input",{type:"text",value:s[C]||"",onChange:k=>p(C,k.target.value),placeholder:`Enter ${C}`,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]},C))})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(V,{onClick:m,disabled:!S(),className:"bg-purple-600 hover:bg-purple-700",children:"Generate from Template"})})]})},cL=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"},{value:"date",label:"Date"},{value:"array",label:"Array"},{value:"object",label:"Object"},{value:"json",label:"JSON"}],F1=({schema:e=[],onChange:t})=>{const[n,s]=g.useState(null),i=g.useCallback(()=>{const u={id:Date.now(),name:"",label:"",type:"string",required:!1,encrypted:!1,default:"",validation:{}};t([...e,u]),s(u.id)},[e,t]),o=g.useCallback((u,d)=>{const f=e.map(p=>p.id===u?{...p,...d}:p);t(f)},[e,t]),a=g.useCallback(u=>{const d=e.filter(f=>f.id!==u);t(d),n===u&&s(null)},[e,t,n]),l=g.useCallback(()=>{s(null)},[]),c=u=>{var d,f,p,b,j;return n!==u.id?r.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-md",children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:u.label||u.name||"Unnamed Field"}),r.jsxs("div",{className:"text-sm text-gray-500",children:[u.type," ",u.required&&"• Required"," ",u.encrypted&&"• Encrypted"]})]}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx(V,{size:"sm",variant:"outline",onClick:()=>s(u.id),children:"Edit"}),r.jsx(V,{size:"sm",variant:"outline",onClick:()=>a(u.id),className:"text-red-600 hover:text-red-700",children:"Remove"})]})]}):r.jsx(B,{className:"p-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Field Name *"}),r.jsx("input",{type:"text",value:u.name,onChange:v=>o(u.id,{name:v.target.value}),placeholder:"field_name",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Used in code (snake_case recommended)"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Display Label"}),r.jsx("input",{type:"text",value:u.label,onChange:v=>o(u.id,{label:v.target.value}),placeholder:"Field Label",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Human-readable label"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Type"}),r.jsx("select",{value:u.type,onChange:v=>o(u.id,{type:v.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:cL.map(v=>r.jsx("option",{value:v.value,children:v.label},v.value))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Default Value"}),r.jsx("input",{type:"text",value:u.default,onChange:v=>o(u.id,{default:v.target.value}),placeholder:"Optional default",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"flex flex-col justify-center space-y-2",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:u.required,onChange:v=>o(u.id,{required:v.target.checked}),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"Required"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:u.encrypted,onChange:v=>o(u.id,{encrypted:v.target.checked}),className:"mr-2"}),r.jsx("span",{className:"text-sm",children:"Encrypted"})]})]})]}),(u.type==="string"||u.type==="number")&&r.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"Validation Rules"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.type==="string"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Min Length"}),r.jsx("input",{type:"number",value:((d=u.validation)==null?void 0:d.minLength)||"",onChange:v=>o(u.id,{validation:{...u.validation,minLength:parseInt(v.target.value)||void 0}}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Max Length"}),r.jsx("input",{type:"number",value:((f=u.validation)==null?void 0:f.maxLength)||"",onChange:v=>o(u.id,{validation:{...u.validation,maxLength:parseInt(v.target.value)||void 0}}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Pattern (Regex)"}),r.jsx("input",{type:"text",value:((p=u.validation)==null?void 0:p.pattern)||"",onChange:v=>o(u.id,{validation:{...u.validation,pattern:v.target.value||void 0}}),placeholder:"^[a-zA-Z0-9]+$",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),u.type==="number"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Minimum Value"}),r.jsx("input",{type:"number",value:((b=u.validation)==null?void 0:b.min)||"",onChange:v=>o(u.id,{validation:{...u.validation,min:parseFloat(v.target.value)||void 0}}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Maximum Value"}),r.jsx("input",{type:"number",value:((j=u.validation)==null?void 0:j.max)||"",onChange:v=>o(u.id,{validation:{...u.validation,max:parseFloat(v.target.value)||void 0}}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]})]})]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[r.jsx(V,{variant:"outline",onClick:()=>s(null),children:"Cancel"}),r.jsx(V,{onClick:l,disabled:!u.name,children:"Save Field"})]})]})})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"Schema Fields"}),r.jsx(V,{onClick:i,children:"Add Field"})]}),e.length===0&&r.jsx("div",{className:"text-center py-8 text-gray-500 border-2 border-dashed border-gray-300 rounded-md",children:'No custom fields defined. Click "Add Field" to create your first field.'}),r.jsx("div",{className:"space-y-3",children:e.map(u=>r.jsx("div",{children:c(u)},u.id))}),e.length>0&&r.jsxs("div",{className:"bg-blue-50 p-4 rounded-md",children:[r.jsx("h5",{className:"font-medium text-blue-900 mb-2",children:"Generated Schema Preview"}),r.jsx("pre",{className:"text-sm text-blue-800 bg-blue-100 p-3 rounded overflow-x-auto",children:e.map(u=>{const d=u.validation&&Object.keys(u.validation).length>0?`, validation: ${JSON.stringify(u.validation)}`:"";return` ${u.name}: { type: '${u.type}', required: ${u.required}${u.encrypted?", encrypted: true":""}${u.default?`, default: '${u.default}'`:""}${d} }`}).join(`,
654
- `)})]})]})};class uL{constructor(){this.npmRegistry="https://registry.npmjs.org",this.scope="@friggframework",this.modulePrefix="api-module-",this.moduleCache=new Map,this.cacheExpiry=60*60*1e3}async getAllModules(){const t="all-modules",n=this.getFromCache(t);if(n)return n;try{const s=`${this.npmRegistry}/-/v1/search?text=${encodeURIComponent(this.scope+"/"+this.modulePrefix)}&size=250`,i=await fetch(s);if(!i.ok)throw new Error(`Failed to fetch modules: ${i.status}`);const a=(await i.json()).objects.filter(l=>l.package.name.startsWith(`${this.scope}/${this.modulePrefix}`)).map(l=>({name:l.package.name,displayName:this.formatDisplayName(l.package.name),version:l.package.version,description:l.package.description,keywords:l.package.keywords||[],links:l.package.links||{},date:l.package.date,publisher:l.package.publisher,maintainers:l.package.maintainers||[]})).sort((l,c)=>l.displayName.localeCompare(c.displayName));return this.setCache(t,a),a}catch(s){return console.error("Error fetching API modules:",s),[]}}async getModuleDetails(t){const n=`module-${t}`,s=this.getFromCache(n);if(s)return s;try{const i=`${this.npmRegistry}/${t}`,o=await fetch(i);if(!o.ok)throw new Error(`Failed to fetch module details: ${o.status}`);const a=await o.json(),l=a["dist-tags"].latest,c=a.versions[l],u={name:a.name,displayName:this.formatDisplayName(a.name),version:l,description:a.description,readme:a.readme,homepage:a.homepage,repository:a.repository,keywords:c.keywords||[],dependencies:c.dependencies||{},peerDependencies:c.peerDependencies||{},maintainers:a.maintainers||[],time:a.time,friggConfig:c.frigg||{},authType:this.detectAuthType(c),requiredFields:this.extractRequiredFields(c)};return this.setCache(n,u),u}catch(i){return console.error(`Error fetching details for ${t}:`,i),null}}formatDisplayName(t){return t.replace(`${this.scope}/`,"").replace(this.modulePrefix,"").split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}detectAuthType(t){const n={...t.dependencies,...t.peerDependencies},s=t.keywords||[],i=(t.description||"").toLowerCase();return n["@friggframework/oauth2"]||s.includes("oauth2")?"oauth2":n["@friggframework/oauth1"]||s.includes("oauth1")?"oauth1":s.includes("api-key")||i.includes("api key")?"api-key":s.includes("basic-auth")||i.includes("basic auth")?"basic-auth":"custom"}extractRequiredFields(t){const n=t.frigg||{},s=[];if(n.requiredFields)return n.requiredFields;switch(this.detectAuthType(t)){case"oauth2":s.push({name:"client_id",label:"Client ID",type:"string",required:!0},{name:"client_secret",label:"Client Secret",type:"password",required:!0},{name:"redirect_uri",label:"Redirect URI",type:"string",required:!0});break;case"api-key":s.push({name:"api_key",label:"API Key",type:"password",required:!0});break;case"basic-auth":s.push({name:"username",label:"Username",type:"string",required:!0},{name:"password",label:"Password",type:"password",required:!0});break}return s}getFromCache(t){const n=this.moduleCache.get(t);return n?Date.now()-n.timestamp>this.cacheExpiry?(this.moduleCache.delete(t),null):n.data:null}setCache(t,n){this.moduleCache.set(t,{data:n,timestamp:Date.now()})}clearCache(){this.moduleCache.clear()}}const Zd=new uL,dL=({onSelect:e,selectedModule:t})=>{const[n,s]=g.useState([]),[i,o]=g.useState(!0),[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(null),[p,b]=g.useState(!1);g.useEffect(()=>{j()},[]),g.useEffect(()=>{t&&v(t)},[t]);const j=async()=>{try{o(!0),l(null);const x=await Zd.getAllModules();s(x)}catch(x){l("Failed to load API modules. Please try again."),console.error("Error loading modules:",x)}finally{o(!1)}},v=async x=>{try{b(!0);const y=await Zd.getModuleDetails(x);f(y)}catch(y){console.error("Error loading module details:",y)}finally{b(!1)}},h=g.useCallback(x=>{e(x)},[e]),m=n.filter(x=>{var y;return x.displayName.toLowerCase().includes(c.toLowerCase())||((y=x.description)==null?void 0:y.toLowerCase().includes(c.toLowerCase()))});return i?r.jsx("div",{className:"flex items-center justify-center p-8",children:r.jsx(Ke,{size:"lg"})}):a?r.jsx(B,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-red-600 mb-4",children:a}),r.jsx(V,{onClick:j,children:"Retry"})]})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium mb-4",children:"Select an API Module"}),r.jsx("div",{className:"mb-4",children:r.jsx("input",{type:"text",value:c,onChange:x=>u(x.target.value),placeholder:"Search API modules...",className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:m.map(x=>r.jsx(B,{className:`p-4 cursor-pointer transition-all ${t===x.name?"ring-2 ring-blue-500 shadow-lg":"hover:shadow-md"}`,onClick:()=>h(x.name),children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:x.displayName}),r.jsx("p",{className:"text-sm text-gray-600 mt-1 line-clamp-2",children:x.description||"No description available"}),r.jsxs("div",{className:"mt-2 flex items-center text-xs text-gray-500",children:[r.jsxs("span",{children:["v",x.version]}),x.date&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"mx-2",children:"•"}),r.jsx("span",{children:new Date(x.date).toLocaleDateString()})]})]})]}),t===x.name&&r.jsx("div",{className:"ml-2",children:r.jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})]})},x.name))}),m.length===0&&r.jsxs("div",{className:"text-center py-8 text-gray-500",children:['No modules found matching "',c,'"']})]}),t&&d&&r.jsxs(B,{className:"p-6",children:[r.jsx("h4",{className:"text-lg font-semibold mb-4",children:"Module Details"}),p?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Ke,{})}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h5",{className:"font-medium text-gray-900",children:d.displayName}),r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:d.description})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Package:"}),r.jsx("p",{className:"text-sm text-gray-900",children:d.name})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Version:"}),r.jsx("p",{className:"text-sm text-gray-900",children:d.version})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Auth Type:"}),r.jsx("p",{className:"text-sm text-gray-900 capitalize",children:d.authType})]}),d.homepage&&r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Documentation:"}),r.jsx("a",{href:d.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline",children:"View Docs"})]})]}),d.requiredFields&&d.requiredFields.length>0&&r.jsxs("div",{children:[r.jsx("h5",{className:"font-medium text-gray-900 mb-2",children:"Required Configuration"}),r.jsx("div",{className:"bg-gray-50 rounded-md p-3",children:r.jsx("ul",{className:"space-y-1",children:d.requiredFields.map((x,y)=>r.jsxs("li",{className:"text-sm flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:x.label}),r.jsx("span",{className:"text-gray-600",children:x.type})]},y))})})]}),d.keywords&&d.keywords.length>0&&r.jsxs("div",{children:[r.jsx("h5",{className:"font-medium text-gray-900 mb-2",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:d.keywords.map((x,y)=>r.jsx("span",{className:"px-2 py-1 text-xs bg-gray-100 text-gray-700 rounded-md",children:x},y))})]})]})]})]})},ci={API:"api",OAUTH1:"oauth1",OAUTH2:"oauth2",BASIC_AUTH:"basic-auth"},cu={[ci.API]:[{name:"apiKey",label:"API Key",type:"string",required:!0,encrypted:!1}],[ci.OAUTH2]:[{name:"access_token",label:"Access Token",type:"string",required:!0,encrypted:!1},{name:"refresh_token",label:"Refresh Token",type:"string",required:!1,encrypted:!1},{name:"expires_at",label:"Expires At",type:"date",required:!1,encrypted:!1},{name:"scope",label:"Scope",type:"string",required:!1,encrypted:!1}],[ci.BASIC_AUTH]:[{name:"username",label:"Username",type:"string",required:!0,encrypted:!1},{name:"password",label:"Password",type:"string",required:!0,encrypted:!0}],[ci.OAUTH1]:[{name:"oauth_token",label:"OAuth Token",type:"string",required:!0,encrypted:!1},{name:"oauth_token_secret",label:"OAuth Token Secret",type:"string",required:!0,encrypted:!0}]},fL=({onGenerate:e})=>{var x,y;const[t,n]=g.useState({name:"",displayName:"",description:"",category:"API Module",type:ci.API,baseURL:"",authorizationURL:"",tokenURL:"",scope:"",apiEndpoints:[],entitySchema:[],useExistingModule:!1,selectedModule:null,moduleDetails:null}),[s,i]=g.useState("basic"),[o,a]=g.useState(!1),l=g.useCallback((w,S)=>{n(C=>({...C,[w]:S}))},[]),c=g.useCallback(async w=>{if(n(S=>({...S,selectedModule:w})),w){a(!0);try{const S=await Zd.getModuleDetails(w);n(C=>({...C,moduleDetails:S,name:S.name.replace("@friggframework/api-module-",""),displayName:S.displayName,description:S.description||C.description,type:S.authType==="oauth2"?INTEGRATION_TYPES.OAUTH2:S.authType==="api-key"?INTEGRATION_TYPES.API:S.authType==="basic-auth"?INTEGRATION_TYPES.BASIC_AUTH:INTEGRATION_TYPES.CUSTOM}))}catch(S){console.error("Error loading module details:",S)}finally{a(!1)}}},[]),u=g.useCallback(()=>{n(w=>({...w,apiEndpoints:[...w.apiEndpoints,{id:Date.now(),name:"",method:"GET",path:"",description:"",parameters:[],responseSchema:{}}]}))},[]),d=g.useCallback((w,S)=>{n(C=>({...C,apiEndpoints:C.apiEndpoints.map(k=>k.id===w?{...k,...S}:k)}))},[]),f=g.useCallback(w=>{n(S=>({...S,apiEndpoints:S.apiEndpoints.filter(C=>C.id!==w)}))},[]),p=g.useCallback(()=>{const w=t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(M,_)=>_.toUpperCase());if(t.useExistingModule&&t.selectedModule)return b();const S=cu[t.type]||[],C=[...S,...t.entitySchema,{name:"user_id",label:"User ID",type:"string",required:!0}],k=`class ${w}Entity extends Entity {
655
- static tableName = '${t.name}';
656
-
657
- static getSchema() {
658
- return {
659
- ${C.map(M=>` ${M.name}: { type: '${M.type}', required: ${M.required}${M.encrypted?", encrypted: true":""}${M.default?`, default: '${M.default}'`:""} }`).join(`,
660
- `)}
661
- };
662
- }
663
- }`,T=t.apiEndpoints.map(M=>{const _=M.name||`${M.method.toLowerCase()}${M.path.replace(/[^a-zA-Z0-9]/g,"")}`,O=M.parameters&&M.parameters.length>0;return` async ${_}(${O?"params = {}":""}) {
664
- const response = await this.${M.method.toLowerCase()}('${M.path}'${O?", params":""});
665
- return response.data;
666
- }`}).join(`
667
-
668
- `),N=`class ${w}Api extends Api {
669
- constructor(config) {
670
- super(config);
671
- this.baseURL = '${t.baseURL||"https://api.example.com"}';
672
- this.headers = {
673
- 'Content-Type': 'application/json'
674
- };
675
- }
676
-
677
- ${t.type===INTEGRATION_TYPES.API?" setApiKey(apiKey) {\n this.headers['Authorization'] = `Bearer ${apiKey}`;\n }":""}
678
-
679
- ${t.type===INTEGRATION_TYPES.BASIC_AUTH?" setCredentials(username, password) {\n const credentials = Buffer.from(`${username}:${password}`).toString('base64');\n this.headers['Authorization'] = `Basic ${credentials}`;\n }":""}
680
-
681
- ${t.type===INTEGRATION_TYPES.OAUTH2?" setAccessToken(token) {\n this.headers['Authorization'] = `Bearer ${token}`;\n }":""}
682
-
683
- async testConnection() {
684
- const response = await this.get('/ping');
685
- return response.data;
686
- }
687
-
688
- ${T||" // Add your API methods here"}
689
- }`,E=`class ${w}Integration extends IntegrationBase {
690
- static Entity = ${w}Entity;
691
- static Api = ${w}Api;
692
- static type = '${t.name}';
693
-
694
- static Config = {
695
- name: '${t.name}',
696
- displayName: '${t.displayName}',
697
- description: '${t.description}',
698
- category: '${t.category}',
699
- version: '1.0.0',
700
- supportedVersions: ['1.0.0']
701
- };
702
-
703
- async connect(params) {
704
- const api = new ${w}Api();
705
-
706
- // Set authentication
707
- ${t.type===INTEGRATION_TYPES.API?" api.setApiKey(params.apiKey);":""}
708
- ${t.type===INTEGRATION_TYPES.BASIC_AUTH?" api.setCredentials(params.username, params.password);":""}
709
- ${t.type===INTEGRATION_TYPES.OAUTH2?" api.setAccessToken(params.access_token);":""}
710
-
711
- try {
712
- await api.testConnection();
713
- } catch (error) {
714
- throw new Error('Connection failed: ' + error.message);
715
- }
716
-
717
- const entity = await ${w}Entity.create({
718
- ${S.map(M=>` ${M.name}: params.${M.name}`).join(`,
719
- `)},
720
- user_id: params.userId
721
- });
722
-
723
- return entity;
724
- }
725
-
726
- static async checkConnection(entity) {
727
- const api = new ${w}Api();
728
-
729
- ${t.type===INTEGRATION_TYPES.API?" api.setApiKey(entity.apiKey);":""}
730
- ${t.type===INTEGRATION_TYPES.BASIC_AUTH?" api.setCredentials(entity.username, entity.password);":""}
731
- ${t.type===INTEGRATION_TYPES.OAUTH2?" api.setAccessToken(entity.access_token);":""}
732
-
733
- try {
734
- await api.testConnection();
735
- return true;
736
- } catch (error) {
737
- return false;
738
- }
739
- }
740
- }`,A=`const { Api, Entity, IntegrationBase } = require('@friggframework/core');
741
- ${t.type===INTEGRATION_TYPES.OAUTH2?"const { OAuth2AuthorizationCode } = require('@friggframework/oauth2');":""}
742
-
743
- ${k}
744
-
745
- ${N}
746
-
747
- ${E}
748
-
749
- module.exports = ${w}Integration;`,P={name:t.name,className:w,type:t.type,files:[{name:"index.js",content:A},{name:"package.json",content:j()},{name:"README.md",content:v()},{name:"__tests__/index.test.js",content:h()}]};e(t,A,P)},[t,e]),b=()=>{var A,P;const w=t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(M,_)=>_.toUpperCase()),S=t.selectedModule,C=t.moduleDetails||{},k=`const ${w}Module = require('${S}');
750
- const { IntegrationBase } = require('@friggframework/core');
751
-
752
- // Wrapper class that extends the npm module with custom functionality
753
- class ${w}Integration extends IntegrationBase {
754
- static Api = ${w}Module.Api;
755
- static Entity = ${w}Module.Entity;
756
- static Config = {
757
- ...${w}Module.Config,
758
- // Override or extend configuration
759
- displayName: '${t.displayName||C.displayName}',
760
- description: '${t.description||C.description}'
761
- };
762
-
763
- constructor(config) {
764
- super(config);
765
- // Initialize the base module
766
- this.module = new ${w}Module(config);
767
- }
768
-
769
- async connect(params) {
770
- // Delegate to the module's connect method
771
- return this.module.connect(params);
772
- }
773
-
774
- static async checkConnection(entity) {
775
- // Delegate to the module's checkConnection method
776
- return ${w}Module.checkConnection(entity);
777
- }
778
-
779
- // Add custom methods here
780
- ${t.apiEndpoints.map(M=>` async ${M.name||`${M.method.toLowerCase()}${M.path.replace(/[^a-zA-Z0-9]/g,"")}`}(params = {}) {
781
- const api = new ${w}Module.Api(this.entity);
782
- return api.${M.method.toLowerCase()}('${M.path}', params);
783
- }`).join(`
784
-
785
- `)}
786
- }
787
-
788
- module.exports = ${w}Integration;`,T={name:`@your-org/${t.name}-integration`,version:"0.1.0",description:t.description||`Integration wrapper for ${S}`,main:"index.js",scripts:{test:"jest","test:watch":"jest --watch"},keywords:["frigg","integration",t.name],dependencies:{"@friggframework/core":"^1.0.0",[S]:`^${C.version||"latest"}`},devDependencies:{"@jest/globals":"^29.0.0",jest:"^29.0.0"}},N=`# ${t.displayName||C.displayName} Integration
789
-
790
- ${t.description||C.description}
791
-
792
- This integration extends the [${S}](https://www.npmjs.com/package/${S}) module.
793
-
794
- ## Installation
795
-
796
- \`\`\`bash
797
- npm install ${S}
798
- \`\`\`
799
-
800
- ## Configuration
801
-
802
- ${((A=C.requiredFields)==null?void 0:A.map(M=>`- **${M.label}**: ${M.type}${M.required?" (required)":""}`).join(`
803
- `))||"See module documentation for required configuration."}
804
-
805
- ## Usage
806
-
807
- \`\`\`javascript
808
- const ${w}Integration = require('./index');
809
-
810
- const integration = new ${w}Integration(config);
811
-
812
- // Connect
813
- const entity = await integration.connect({
814
- ${((P=C.requiredFields)==null?void 0:P.map(M=>` ${M.name}: 'your-${M.name}'`).join(`,
815
- `))||" // Add required parameters"}
816
- });
817
- \`\`\`
818
-
819
- ## API Methods
820
-
821
- ${t.apiEndpoints.map(M=>`- \`${M.name||"endpoint"}\`: ${M.description||"No description"}`).join(`
822
- `)||"See module documentation for available methods."}
823
- `,E={name:t.name,className:w,type:"module-wrapper",baseModule:S,files:[{name:"index.js",content:k},{name:"package.json",content:JSON.stringify(T,null,2)},{name:"README.md",content:N}]};e(t,k,E)},j=()=>(t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(w,S)=>S.toUpperCase()),JSON.stringify({name:`@friggframework/${t.name}`,version:"0.1.0",description:t.description,main:"index.js",scripts:{test:"jest","test:watch":"jest --watch"},keywords:["frigg","integration",t.name],dependencies:{"@friggframework/core":"^1.0.0",...t.type===INTEGRATION_TYPES.OAUTH2?{"@friggframework/oauth2":"^1.0.0"}:{}},devDependencies:{"@jest/globals":"^29.0.0",jest:"^29.0.0"}},null,2)),v=()=>{var S;const w=t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(C,k)=>k.toUpperCase());return`# ${t.displayName} Integration
824
-
825
- ${t.description}
826
-
827
- ## Installation
828
-
829
- \`\`\`bash
830
- npm install @friggframework/${t.name}
831
- \`\`\`
832
-
833
- ## Usage
834
-
835
- \`\`\`javascript
836
- const ${w}Integration = require('@friggframework/${t.name}');
837
-
838
- const integration = new ${w}Integration();
839
-
840
- // Connect
841
- const entity = await integration.connect({
842
- ${((S=cu[t.type])==null?void 0:S.map(C=>` ${C.name}: 'your-${C.name.replace(/_/g,"-")}'`).join(`,
843
- `))||" // Add your authentication parameters"}
844
- userId: 'user-123'
845
- });
846
-
847
- // Check connection
848
- const isConnected = await ${w}Integration.checkConnection(entity);
849
- \`\`\`
850
-
851
- ## API Methods
852
-
853
- ${t.apiEndpoints.map(C=>`- \`${C.name||"endpoint"}\`: ${C.description||"No description"}`).join(`
854
- `)||"- Add your API methods here"}
855
-
856
- ## License
857
-
858
- MIT`},h=()=>{const w=t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(S,C)=>C.toUpperCase());return`const { describe, it, expect } = require('@jest/globals');
859
- const ${w}Integration = require('../index');
860
-
861
- describe('${w}Integration', () => {
862
- it('should have correct configuration', () => {
863
- expect(${w}Integration.Config.name).toBe('${t.name}');
864
- expect(${w}Integration.type).toBe('${t.name}');
865
- });
866
-
867
- it('should have Entity and Api classes', () => {
868
- expect(${w}Integration.Entity).toBeDefined();
869
- expect(${w}Integration.Api).toBeDefined();
870
- });
871
-
872
- describe('Entity', () => {
873
- it('should have correct table name', () => {
874
- expect(${w}Integration.Entity.tableName).toBe('${t.name}');
875
- });
876
-
877
- it('should have valid schema', () => {
878
- const schema = ${w}Integration.Entity.getSchema();
879
- expect(schema).toBeDefined();
880
- expect(schema.user_id).toBeDefined();
881
- });
882
- });
883
-
884
- describe('Api', () => {
885
- it('should initialize with correct baseURL', () => {
886
- const api = new ${w}Integration.Api();
887
- expect(api.baseURL).toBe('${t.baseURL||"https://api.example.com"}');
888
- });
889
- });
890
- });`},m=[{id:"module",label:"Module Selection",icon:"📦"},{id:"basic",label:"Basic Info",icon:"📝"},{id:"auth",label:"Authentication",icon:"🔐"},{id:"endpoints",label:"API Endpoints",icon:"🔗"},{id:"schema",label:"Entity Schema",icon:"📊"}];return r.jsxs("div",{className:"space-y-6",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Integration Generator"}),r.jsx("div",{className:"border-b border-gray-200",children:r.jsx("nav",{className:"-mb-px flex space-x-8",children:m.map(w=>r.jsxs("button",{onClick:()=>i(w.id),className:`py-2 px-1 border-b-2 font-medium text-sm ${s===w.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[r.jsx("span",{className:"mr-2",children:w.icon}),w.label]},w.id))})}),r.jsxs(B,{className:"p-6",children:[s==="module"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"mb-6",children:[r.jsxs("label",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"checkbox",checked:t.useExistingModule,onChange:w=>l("useExistingModule",w.target.checked),className:"h-4 w-4 text-blue-600 rounded focus:ring-blue-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Use existing Frigg API module from npm"})]}),r.jsx("p",{className:"text-sm text-gray-500 mt-1 ml-7",children:"Select from pre-built API modules or create a custom integration from scratch"})]}),t.useExistingModule&&r.jsx(dL,{selectedModule:t.selectedModule,onSelect:c}),!t.useExistingModule&&r.jsxs("div",{className:"bg-gray-50 rounded-lg p-6 text-center",children:[r.jsx("svg",{className:"w-12 h-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Custom Integration"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Build a custom integration from scratch with full control over the implementation"})]})]}),s==="basic"&&r.jsxs("div",{className:"space-y-4",children:[t.useExistingModule&&t.selectedModule&&r.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("svg",{className:"w-5 h-5 text-blue-600 mt-0.5 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),r.jsx("div",{children:r.jsxs("p",{className:"text-sm text-blue-800",children:["Using ",r.jsx("strong",{children:((x=t.moduleDetails)==null?void 0:x.displayName)||t.selectedModule})," as base module. Some fields have been auto-filled from the module configuration."]})})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Integration Name *"}),r.jsx("input",{type:"text",value:t.name,onChange:w=>l("name",w.target.value),placeholder:"e.g., salesforce, hubspot",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:t.useExistingModule&&o})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Display Name"}),r.jsx("input",{type:"text",value:t.displayName,onChange:w=>l("displayName",w.target.value),placeholder:"e.g., Salesforce, HubSpot",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("textarea",{value:t.description,onChange:w=>l("description",w.target.value),placeholder:"Brief description of the integration",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Category"}),r.jsxs("select",{value:t.category,onChange:w=>l("category",w.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"API Integration",children:"API Integration"}),r.jsx("option",{value:"CRM",children:"CRM"}),r.jsx("option",{value:"Marketing",children:"Marketing"}),r.jsx("option",{value:"Sales",children:"Sales"}),r.jsx("option",{value:"Support",children:"Support"}),r.jsx("option",{value:"Analytics",children:"Analytics"}),r.jsx("option",{value:"Communication",children:"Communication"}),r.jsx("option",{value:"Other",children:"Other"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Base URL *"}),r.jsx("input",{type:"url",value:t.baseURL,onChange:w=>l("baseURL",w.target.value),placeholder:"https://api.example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]})]}),s==="auth"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Authentication Type"}),r.jsxs("select",{value:t.type,onChange:w=>l("type",w.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:INTEGRATION_TYPES.API,children:"API Key"}),r.jsx("option",{value:INTEGRATION_TYPES.OAUTH2,children:"OAuth 2.0"}),r.jsx("option",{value:INTEGRATION_TYPES.BASIC_AUTH,children:"Basic Auth"}),r.jsx("option",{value:INTEGRATION_TYPES.OAUTH1,children:"OAuth 1.0"}),r.jsx("option",{value:INTEGRATION_TYPES.CUSTOM,children:"Custom"})]})]}),t.type===INTEGRATION_TYPES.OAUTH2&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Authorization URL"}),r.jsx("input",{type:"url",value:t.authorizationURL,onChange:w=>l("authorizationURL",w.target.value),placeholder:"https://example.com/oauth/authorize",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Token URL"}),r.jsx("input",{type:"url",value:t.tokenURL,onChange:w=>l("tokenURL",w.target.value),placeholder:"https://example.com/oauth/token",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"OAuth Scope"}),r.jsx("input",{type:"text",value:t.scope,onChange:w=>l("scope",w.target.value),placeholder:"read write",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),r.jsxs("div",{className:"bg-gray-50 p-4 rounded-md",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Authentication Fields"}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"The following fields will be included in the Entity schema based on your authentication type:"}),r.jsx("div",{className:"space-y-2",children:((y=cu[t.type])==null?void 0:y.map((w,S)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium",children:w.label}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-gray-500",children:w.type}),w.required&&r.jsx("span",{className:"text-red-500",children:"Required"}),w.encrypted&&r.jsx("span",{className:"text-blue-500",children:"Encrypted"})]})]},S)))||r.jsx("span",{className:"text-gray-500",children:"No standard fields for custom authentication"})})]})]}),s==="endpoints"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h3",{className:"text-lg font-medium",children:"API Endpoints"}),r.jsx(V,{onClick:u,children:"Add Endpoint"})]}),t.apiEndpoints.length===0&&r.jsx("div",{className:"text-center py-8 text-gray-500",children:'No endpoints defined. Click "Add Endpoint" to get started.'}),t.apiEndpoints.map(w=>r.jsxs(B,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-4",children:[r.jsxs("h4",{className:"font-medium",children:["Endpoint ",w.id]}),r.jsx(V,{variant:"outline",size:"sm",onClick:()=>f(w.id),className:"text-red-600 hover:text-red-700",children:"Remove"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Method"}),r.jsxs("select",{value:w.method,onChange:S=>d(w.id,{method:S.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"GET",children:"GET"}),r.jsx("option",{value:"POST",children:"POST"}),r.jsx("option",{value:"PUT",children:"PUT"}),r.jsx("option",{value:"DELETE",children:"DELETE"}),r.jsx("option",{value:"PATCH",children:"PATCH"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Path"}),r.jsx("input",{type:"text",value:w.path,onChange:S=>d(w.id,{path:S.target.value}),placeholder:"/users",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Method Name"}),r.jsx("input",{type:"text",value:w.name,onChange:S=>d(w.id,{name:S.target.value}),placeholder:"getUsers",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("input",{type:"text",value:w.description,onChange:S=>d(w.id,{description:S.target.value}),placeholder:"Retrieves a list of users",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]},w.id))]}),s==="schema"&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Custom Entity Fields"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Add custom fields to store additional data in your integration entity. Authentication fields are automatically included."}),r.jsx(F1,{schema:t.entitySchema,onChange:w=>l("entitySchema",w)})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(V,{onClick:p,disabled:!t.name||!t.baseURL&&!t.useExistingModule||t.useExistingModule&&!t.selectedModule,className:"bg-blue-600 hover:bg-blue-700",children:"Generate Integration Code"})})]})},mL=["GET","POST","PUT","DELETE","PATCH"],hL=({onGenerate:e})=>{var S,C,k,T;const[t,n]=g.useState([]),[s,i]=g.useState(null),[o,a]=g.useState({name:"",description:"",baseURL:"",version:"1.0.0",authentication:"bearer"}),l=g.useCallback(()=>{const N={id:Date.now(),path:"",method:"GET",summary:"",description:"",tags:[],parameters:[],requestBody:null,responses:{200:{description:"Success",schema:[]}},security:!0};n(E=>[...E,N]),i(N.id)},[]),c=g.useCallback((N,E)=>{n(A=>A.map(P=>P.id===N?{...P,...E}:P))},[]),u=g.useCallback(N=>{n(E=>E.filter(A=>A.id!==N)),s===N&&i(null)},[s]),d=g.useCallback(N=>{var A;const E={id:Date.now(),name:"",in:"query",type:"string",required:!1,description:""};c(N,{parameters:[...((A=t.find(P=>P.id===N))==null?void 0:A.parameters)||[],E]})},[t,c]),f=g.useCallback((N,E,A)=>{const P=t.find(_=>_.id===N);if(!P)return;const M=P.parameters.map(_=>_.id===E?{..._,...A}:_);c(N,{parameters:M})},[t,c]),p=g.useCallback((N,E)=>{const A=t.find(M=>M.id===N);if(!A)return;const P=A.parameters.filter(M=>M.id!==E);c(N,{parameters:P})},[t,c]),b=g.useCallback(()=>{o.name.replace(/[^a-zA-Z0-9]/g,"").toLowerCase();const N=`const express = require('express');
891
- const router = express.Router();
892
- const { validateRequest, handleError } = require('../middleware');
893
- const { ${o.name}Service } = require('../services');`,E=t.map(P=>{P.path.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()+P.method.toLowerCase();const M=P.path.replace(/{([^}]+)}/g,":$1"),_=P.parameters.length>0?`validateRequest(${JSON.stringify(P.parameters)}), `:"",O=P.security?"requireAuth, ":"";return`// ${P.summary||P.description||"No description"}
894
- router.${P.method.toLowerCase()}('${M}', ${O}${_}async (req, res) => {
895
- try {
896
- ${j(P)}
897
- res.json(result);
898
- } catch (error) {
899
- handleError(error, res);
900
- }
901
- });`}).join(`
902
-
903
- `);return`${N}
904
-
905
- ${E}
906
-
907
- module.exports = router;`},[o,t]),j=N=>{const E=N.parameters.filter(O=>O.in==="path").map(O=>`req.params.${O.name}`),A=N.parameters.filter(O=>O.in==="query").length>0?"req.query":null,P=N.requestBody?"req.body":null,M=[E,A,P].filter(Boolean).flat(),_=N.path.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()+N.method.toLowerCase();return` const result = await ${o.name}Service.${_}(${M.join(", ")});`},v=g.useCallback(()=>{const N={openapi:"3.0.0",info:{title:o.name,description:o.description,version:o.version},servers:[{url:o.baseURL,description:"API Server"}],paths:{},components:{securitySchemes:{bearerAuth:{type:"http",scheme:"bearer",bearerFormat:"JWT"}}}};return t.forEach(E=>{N.paths[E.path]||(N.paths[E.path]={}),N.paths[E.path][E.method.toLowerCase()]={summary:E.summary,description:E.description,tags:E.tags,parameters:E.parameters.map(A=>({name:A.name,in:A.in,required:A.required,description:A.description,schema:{type:A.type}})),responses:Object.entries(E.responses).reduce((A,[P,M])=>(A[P]={description:M.description,content:{"application/json":{schema:h(M.schema)}}},A),{}),...E.security?{security:[{bearerAuth:[]}]}:{}},E.requestBody&&(N.paths[E.path][E.method.toLowerCase()].requestBody={required:!0,content:{"application/json":{schema:h(E.requestBody.schema)}}})}),JSON.stringify(N,null,2)},[o,t]),h=N=>{if(!N||N.length===0)return{type:"object"};const E={},A=[];return N.forEach(P=>{E[P.name]={type:P.type,description:P.label||P.name},P.required&&A.push(P.name),P.validation&&Object.assign(E[P.name],P.validation)}),{type:"object",properties:E,required:A}},m=g.useCallback(()=>{const N=o.name+"Service",E=t.map(A=>{const P=A.path.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()+A.method.toLowerCase(),M=A.parameters.filter($=>$.in==="path").map($=>$.name),_=A.parameters.filter($=>$.in==="query").length>0,O=A.requestBody,F=[];return M.length>0&&F.push(M.join(", ")),_&&F.push("query"),O&&F.push("data"),` static async ${P}(${F.join(", ")}) {
908
- // TODO: Implement ${A.summary||A.description||"endpoint logic"}
909
- throw new Error('Not implemented');
910
- }`}).join(`
911
-
912
- `);return`class ${N} {
913
- ${E}
914
- }
915
-
916
- module.exports = ${N};`},[o,t]),x=g.useCallback(()=>{const N=b(),E=m(),A=v(),P={name:o.name,type:"api-endpoints",files:[{name:"router.js",content:N},{name:"service.js",content:E},{name:"openapi.json",content:A},{name:"README.md",content:y()}]};e(o,{router:N,service:E,openapi:A},P)},[o,b,m,v,e]),y=()=>`# ${o.name} API
917
-
918
- ${o.description}
919
-
920
- ## Endpoints
921
-
922
- ${t.map(N=>`### ${N.method} ${N.path}
923
-
924
- ${N.description||N.summary||"No description available"}
925
-
926
- ${N.parameters.length>0?`**Parameters:**
927
- ${N.parameters.map(E=>`- \`${E.name}\` (${E.type}${E.required?", required":""}): ${E.description||"No description"}`).join(`
928
- `)}`:""}
929
- `).join(`
930
- `)}
931
-
932
- ## Authentication
933
-
934
- ${o.authentication==="bearer"?"This API uses Bearer token authentication.":"Authentication method not specified."}
935
-
936
- ## Usage
937
-
938
- 1. Import the router in your Express app
939
- 2. Mount the router at your desired path
940
- 3. Implement the service methods
941
- 4. Test the endpoints
942
-
943
- \`\`\`javascript
944
- const app = require('express')();
945
- const ${o.name.toLowerCase()}Router = require('./router');
946
-
947
- app.use('/api/${o.name.toLowerCase()}', ${o.name.toLowerCase()}Router);
948
- \`\`\`
949
- `,w=t.find(N=>N.id===s);return r.jsxs("div",{className:"space-y-6",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"API Endpoint Generator"}),r.jsxs(B,{className:"p-6",children:[r.jsx("h3",{className:"text-lg font-medium mb-4",children:"API Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"API Name *"}),r.jsx("input",{type:"text",value:o.name,onChange:N=>a(E=>({...E,name:N.target.value})),placeholder:"UserAPI",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Version"}),r.jsx("input",{type:"text",value:o.version,onChange:N=>a(E=>({...E,version:N.target.value})),placeholder:"1.0.0",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("textarea",{value:o.description,onChange:N=>a(E=>({...E,description:N.target.value})),placeholder:"API description",rows:2,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Base URL"}),r.jsx("input",{type:"url",value:o.baseURL,onChange:N=>a(E=>({...E,baseURL:N.target.value})),placeholder:"https://api.example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Authentication"}),r.jsxs("select",{value:o.authentication,onChange:N=>a(E=>({...E,authentication:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"bearer",children:"Bearer Token"}),r.jsx("option",{value:"api-key",children:"API Key"}),r.jsx("option",{value:"basic",children:"Basic Auth"}),r.jsx("option",{value:"none",children:"None"})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsx("div",{className:"lg:col-span-1",children:r.jsxs(B,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Endpoints"}),r.jsx(V,{onClick:l,size:"sm",children:"Add"})]}),t.length===0&&r.jsx("div",{className:"text-center py-4 text-gray-500",children:'No endpoints yet. Click "Add" to create one.'}),r.jsx("div",{className:"space-y-2",children:t.map(N=>r.jsx("div",{onClick:()=>i(N.id),className:`p-3 rounded border cursor-pointer transition-colors ${s===N.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("span",{className:`inline-block px-2 py-1 text-xs rounded font-medium ${N.method==="GET"?"bg-green-100 text-green-800":N.method==="POST"?"bg-blue-100 text-blue-800":N.method==="PUT"?"bg-yellow-100 text-yellow-800":N.method==="DELETE"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:N.method}),r.jsx("div",{className:"text-sm font-medium mt-1",children:N.path||"/path"}),N.summary&&r.jsx("div",{className:"text-xs text-gray-500 mt-1",children:N.summary})]}),r.jsx(V,{size:"sm",variant:"outline",onClick:E=>{E.stopPropagation(),u(N.id)},className:"text-red-600 hover:text-red-700",children:"×"})]})},N.id))})]})}),r.jsx("div",{className:"lg:col-span-2",children:w?r.jsxs(B,{className:"p-6",children:[r.jsx("h3",{className:"text-lg font-medium mb-4",children:"Edit Endpoint"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Method"}),r.jsx("select",{value:w.method,onChange:N=>c(w.id,{method:N.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:mL.map(N=>r.jsx("option",{value:N,children:N},N))})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Path"}),r.jsx("input",{type:"text",value:w.path,onChange:N=>c(w.id,{path:N.target.value}),placeholder:"/users/{id}",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Summary"}),r.jsx("input",{type:"text",value:w.summary,onChange:N=>c(w.id,{summary:N.target.value}),placeholder:"Brief summary",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("textarea",{value:w.description,onChange:N=>c(w.id,{description:N.target.value}),placeholder:"Detailed description",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",id:`security-${w.id}`,checked:w.security,onChange:N=>c(w.id,{security:N.target.checked}),className:"mr-2"}),r.jsx("label",{htmlFor:`security-${w.id}`,className:"text-sm",children:"Requires Authentication"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between items-center mb-3",children:[r.jsx("h4",{className:"font-medium",children:"Parameters"}),r.jsx(V,{size:"sm",onClick:()=>d(w.id),children:"Add Parameter"})]}),((S=w.parameters)==null?void 0:S.length)===0&&r.jsx("div",{className:"text-sm text-gray-500 py-2",children:"No parameters defined"}),(C=w.parameters)==null?void 0:C.map(N=>r.jsxs("div",{className:"border rounded p-3 mb-2",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-2 mb-2",children:[r.jsx("input",{type:"text",value:N.name,onChange:E=>f(w.id,N.id,{name:E.target.value}),placeholder:"Parameter name",className:"px-2 py-1 border border-gray-300 rounded text-sm"}),r.jsxs("select",{value:N.in,onChange:E=>f(w.id,N.id,{in:E.target.value}),className:"px-2 py-1 border border-gray-300 rounded text-sm",children:[r.jsx("option",{value:"query",children:"Query"}),r.jsx("option",{value:"path",children:"Path"}),r.jsx("option",{value:"header",children:"Header"})]}),r.jsxs("select",{value:N.type,onChange:E=>f(w.id,N.id,{type:E.target.value}),className:"px-2 py-1 border border-gray-300 rounded text-sm",children:[r.jsx("option",{value:"string",children:"String"}),r.jsx("option",{value:"number",children:"Number"}),r.jsx("option",{value:"boolean",children:"Boolean"}),r.jsx("option",{value:"array",children:"Array"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("label",{className:"flex items-center text-sm",children:[r.jsx("input",{type:"checkbox",checked:N.required,onChange:E=>f(w.id,N.id,{required:E.target.checked}),className:"mr-1"}),"Required"]}),r.jsx(V,{size:"sm",variant:"outline",onClick:()=>p(w.id,N.id),className:"text-red-600",children:"×"})]})]}),r.jsx("input",{type:"text",value:N.description,onChange:E=>f(w.id,N.id,{description:E.target.value}),placeholder:"Parameter description",className:"w-full px-2 py-1 border border-gray-300 rounded text-sm"})]},N.id))]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:"Response Schema (200 OK)"}),r.jsx(F1,{schema:((T=(k=w.responses)==null?void 0:k[200])==null?void 0:T.schema)||[],onChange:N=>c(w.id,{responses:{...w.responses,200:{description:"Success",schema:N}}})})]})]})]}):r.jsx(B,{className:"p-8",children:r.jsxs("div",{className:"text-center text-gray-500",children:[r.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.367 2.684 3 3 0 00-5.367-2.684z"})}),r.jsx("p",{children:"Select an endpoint to edit its configuration"}),r.jsx("p",{className:"text-sm mt-1",children:"Or create a new endpoint to get started"})]})})})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(V,{onClick:x,disabled:!o.name||t.length===0,className:"bg-green-600 hover:bg-green-700",children:"Generate API Code"})})]})},na={"basic-backend":{name:"Basic Backend",description:"Simple Frigg backend with core functionality",features:["Express server","MongoDB integration","Basic authentication","Environment configuration"]},microservices:{name:"Microservices",description:"Multi-service architecture with API Gateway",features:["API Gateway","Service discovery","Load balancing","Circuit breakers"]},serverless:{name:"Serverless",description:"AWS Lambda-based serverless backend",features:["Lambda functions","API Gateway","DynamoDB","CloudWatch logging"]},"full-stack":{name:"Full Stack",description:"Complete application with frontend and backend",features:["React frontend","Express backend","Database integration","Authentication"]}},Hx=[{id:"hubspot",name:"HubSpot",category:"CRM"},{id:"salesforce",name:"Salesforce",category:"CRM"},{id:"slack",name:"Slack",category:"Communication"},{id:"mailchimp",name:"Mailchimp",category:"Marketing"},{id:"stripe",name:"Stripe",category:"Payments"},{id:"twilio",name:"Twilio",category:"Communication"},{id:"google-analytics",name:"Google Analytics",category:"Analytics"},{id:"microsoft-teams",name:"Microsoft Teams",category:"Communication"}],uu=[{value:"mongodb",label:"MongoDB",description:"Document database"},{value:"postgresql",label:"PostgreSQL",description:"Relational database"},{value:"mysql",label:"MySQL",description:"Relational database"},{value:"dynamodb",label:"DynamoDB",description:"AWS NoSQL database"},{value:"redis",label:"Redis",description:"In-memory cache"}],pL=({onGenerate:e})=>{const[t,n]=g.useState({name:"",description:"",template:"basic-backend",database:"mongodb",integrations:[],features:{authentication:!0,logging:!0,monitoring:!0,testing:!0,docker:!0,ci:!1},deployment:{platform:"aws",environment:"development"}}),[s,i]=g.useState(0),o=[{title:"Project Info",description:"Basic project configuration"},{title:"Template",description:"Choose project template"},{title:"Database",description:"Select database options"},{title:"Integrations",description:"Choose integrations"},{title:"Features",description:"Enable additional features"},{title:"Deployment",description:"Deployment configuration"}],a=g.useCallback((S,C)=>{n(k=>({...k,[S]:C}))},[]),l=g.useCallback(S=>{n(C=>({...C,features:{...C.features,[S]:!C.features[S]}}))},[]),c=g.useCallback(S=>{n(C=>({...C,integrations:C.integrations.includes(S)?C.integrations.filter(k=>k!==S):[...C.integrations,S]}))},[]),u=g.useCallback(()=>{na[t.template];const S={name:t.name,version:"1.0.0",description:t.description,main:"app.js",scripts:{start:"node app.js",dev:"nodemon app.js",test:t.features.testing?"jest":void 0,build:t.template==="serverless"?"serverless package":void 0,deploy:t.template==="serverless"?"serverless deploy":void 0},dependencies:{"@friggframework/core":"^1.0.0",express:"^4.18.0",...t.database==="mongodb"?{mongoose:"^7.0.0"}:{},...t.database==="postgresql"?{pg:"^8.8.0","pg-hstore":"^2.3.4"}:{},...t.database==="mysql"?{mysql2:"^3.0.0"}:{},...t.features.authentication?{passport:"^0.6.0","passport-jwt":"^4.0.0"}:{},...t.features.logging?{winston:"^3.8.0"}:{},...t.integrations.map(_=>({[`@friggframework/api-module-${_}`]:"^1.0.0"})).reduce((_,O)=>({..._,...O}),{})},devDependencies:{nodemon:"^2.0.0",...t.features.testing?{jest:"^29.0.0",supertest:"^6.3.0"}:{}}},C=d(),k=t.template==="serverless"?f():null,T=t.features.docker?p():null,N=t.features.docker?b():null,E=j(),A=v(),P=[{name:"package.json",content:JSON.stringify(S,null,2)},{name:"app.js",content:C},{name:"README.md",content:E},{name:".env.example",content:A},...k?[{name:"serverless.yml",content:k}]:[],...T?[{name:"Dockerfile",content:T}]:[],...N?[{name:"docker-compose.yml",content:N}]:[],...t.features.ci?[{name:".github/workflows/ci.yml",content:h()}]:[]],M={name:t.name,template:t.template,type:"project-scaffold",files:P};e(t,{files:P},M)},[t,e]),d=()=>`const express = require('express');
950
- const { FriggManager } = require('@friggframework/core');
951
- ${t.features.logging?"const winston = require('winston');":""}
952
- ${t.database==="mongodb"?"const mongoose = require('mongoose');":""}
953
-
954
- const app = express();
955
- const port = process.env.PORT || 3000;
956
-
957
- // Middleware
958
- app.use(express.json());
959
- app.use(express.urlencoded({ extended: true }));
960
-
961
- ${t.features.logging?`
962
- // Logging configuration
963
- const logger = winston.createLogger({
964
- level: 'info',
965
- format: winston.format.combine(
966
- winston.format.timestamp(),
967
- winston.format.json()
968
- ),
969
- transports: [
970
- new winston.transports.Console(),
971
- new winston.transports.File({ filename: 'app.log' })
972
- ]
973
- });
974
- `:""}
975
-
976
- ${t.database==="mongodb"?`
977
- // Database connection
978
- mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/${t.name}', {
979
- useNewUrlParser: true,
980
- useUnifiedTopology: true
981
- });
982
- `:""}
983
-
984
- // Frigg Manager initialization
985
- const friggManager = new FriggManager({
986
- database: '${t.database}',
987
- integrations: [
988
- ${t.integrations.map(S=>` require('@friggframework/api-module-${S}')`).join(`,
989
- `)}
990
- ]
991
- });
992
-
993
- // Routes
994
- app.get('/', (req, res) => {
995
- res.json({
996
- message: 'Welcome to ${t.name}',
997
- status: 'running',
998
- integrations: [${t.integrations.map(S=>`'${S}'`).join(", ")}]
999
- });
1000
- });
1001
-
1002
- app.get('/health', (req, res) => {
1003
- res.json({ status: 'healthy', timestamp: new Date().toISOString() });
1004
- });
1005
-
1006
- // Start server
1007
- app.listen(port, () => {
1008
- ${t.features.logging?"logger.info":"console.log"}(\`Server running on port \${port}\`);
1009
- });
1010
-
1011
- module.exports = app;`,f=()=>`service: ${t.name}
1012
-
1013
- frameworkVersion: '3'
1014
-
1015
- provider:
1016
- name: aws
1017
- runtime: nodejs18.x
1018
- stage: \${opt:stage, 'dev'}
1019
- region: \${opt:region, 'us-east-1'}
1020
- environment:
1021
- NODE_ENV: \${self:provider.stage}
1022
- ${t.integrations.map(S=>`${S.toUpperCase()}_API_KEY: \${env:${S.toUpperCase()}_API_KEY}`).join(`
1023
- `)}
1024
-
1025
- functions:
1026
- app:
1027
- handler: app.handler
1028
- events:
1029
- - http:
1030
- path: /{proxy+}
1031
- method: ANY
1032
- cors: true
1033
- - http:
1034
- path: /
1035
- method: ANY
1036
- cors: true
1037
-
1038
- ${t.database==="dynamodb"?`
1039
- resources:
1040
- Resources:
1041
- ${t.name}Table:
1042
- Type: AWS::DynamoDB::Table
1043
- Properties:
1044
- TableName: \${self:provider.stage}-${t.name}
1045
- AttributeDefinitions:
1046
- - AttributeName: id
1047
- AttributeType: S
1048
- KeySchema:
1049
- - AttributeName: id
1050
- KeyType: HASH
1051
- BillingMode: PAY_PER_REQUEST
1052
- `:""}
1053
-
1054
- plugins:
1055
- - serverless-offline`,p=()=>`FROM node:18-alpine
1056
-
1057
- WORKDIR /app
1058
-
1059
- COPY package*.json ./
1060
- RUN npm ci --only=production
1061
-
1062
- COPY . .
1063
-
1064
- EXPOSE 3000
1065
-
1066
- CMD ["npm", "start"]`,b=()=>`version: '3.8'
1067
-
1068
- services:
1069
- app:
1070
- build: .
1071
- ports:
1072
- - "3000:3000"
1073
- environment:
1074
- - NODE_ENV=development
1075
- ${t.database==="mongodb"?"- MONGODB_URI=mongodb://mongo:27017/"+t.name:""}
1076
- depends_on:
1077
- ${t.database==="mongodb"?"- mongo":""}
1078
- volumes:
1079
- - .:/app
1080
- - /app/node_modules
1081
-
1082
- ${t.database==="mongodb"?` mongo:
1083
- image: mongo:5
1084
- ports:
1085
- - "27017:27017"
1086
- volumes:
1087
- - mongo_data:/data/db
1088
-
1089
- volumes:
1090
- mongo_data:`:""}`,j=()=>{var C;const S=na[t.template];return`# ${t.name}
1091
-
1092
- ${t.description}
1093
-
1094
- ## Project Template: ${S.name}
1095
-
1096
- ${S.description}
1097
-
1098
- ### Features
1099
-
1100
- ${S.features.map(k=>`- ${k}`).join(`
1101
- `)}
1102
-
1103
- ### Integrations
1104
-
1105
- ${t.integrations.length>0?t.integrations.map(k=>{const T=Hx.find(N=>N.id===k);return`- ${T==null?void 0:T.name} (${T==null?void 0:T.category})`}).join(`
1106
- `):"No integrations configured"}
1107
-
1108
- ### Database
1109
-
1110
- - ${(C=uu.find(k=>k.value===t.database))==null?void 0:C.label}
1111
-
1112
- ### Additional Features
1113
-
1114
- ${Object.entries(t.features).filter(([,k])=>k).map(([k])=>`- ${k.charAt(0).toUpperCase()+k.slice(1)}`).join(`
1115
- `)}
1116
-
1117
- ## Getting Started
1118
-
1119
- 1. Install dependencies:
1120
- \`\`\`bash
1121
- npm install
1122
- \`\`\`
1123
-
1124
- 2. Copy environment variables:
1125
- \`\`\`bash
1126
- cp .env.example .env
1127
- \`\`\`
1128
-
1129
- 3. Update environment variables in \`.env\`
1130
-
1131
- ${t.features.docker?"4. Start with Docker:\n ```bash\n docker-compose up\n ```\n\n Or start locally:":"4. Start the application:"}
1132
- \`\`\`bash
1133
- npm run dev
1134
- \`\`\`
1135
-
1136
- ## API Endpoints
1137
-
1138
- - \`GET /\` - Welcome message and status
1139
- - \`GET /health\` - Health check
1140
-
1141
- ## Deployment
1142
-
1143
- ${t.template==="serverless"?"This project uses Serverless Framework for deployment:\n\n```bash\nnpm run deploy\n```":`Configure your deployment platform (${t.deployment.platform}) according to your needs.`}
1144
-
1145
- ## License
1146
-
1147
- MIT`},v=()=>`# Environment Configuration
1148
- NODE_ENV=development
1149
- PORT=3000
1150
-
1151
- # Database
1152
- ${t.database==="mongodb"?`MONGODB_URI=mongodb://localhost:27017/${t.name}`:""}
1153
- ${t.database==="postgresql"?`DATABASE_URL=postgresql://user:password@localhost:5432/${t.name}`:""}
1154
- ${t.database==="mysql"?`DATABASE_URL=mysql://user:password@localhost:3306/${t.name}`:""}
1155
-
1156
- # Integration API Keys
1157
- ${t.integrations.map(S=>`${S.toUpperCase()}_API_KEY=your_${S}_api_key_here`).join(`
1158
- `)}
1159
-
1160
- # Authentication (if enabled)
1161
- ${t.features.authentication?`JWT_SECRET=your_jwt_secret_here
1162
- JWT_EXPIRES_IN=24h`:""}
1163
-
1164
- # AWS Configuration (if using AWS services)
1165
- ${t.deployment.platform==="aws"?`AWS_ACCESS_KEY_ID=your_access_key
1166
- AWS_SECRET_ACCESS_KEY=your_secret_key
1167
- AWS_REGION=us-east-1`:""}`,h=()=>`name: CI/CD Pipeline
1168
-
1169
- on:
1170
- push:
1171
- branches: [ main, develop ]
1172
- pull_request:
1173
- branches: [ main ]
1174
-
1175
- jobs:
1176
- test:
1177
- runs-on: ubuntu-latest
1178
-
1179
- strategy:
1180
- matrix:
1181
- node-version: [16.x, 18.x]
1182
-
1183
- steps:
1184
- - uses: actions/checkout@v3
1185
-
1186
- - name: Use Node.js \${{ matrix.node-version }}
1187
- uses: actions/setup-node@v3
1188
- with:
1189
- node-version: \${{ matrix.node-version }}
1190
- cache: 'npm'
1191
-
1192
- - run: npm ci
1193
-
1194
- ${t.features.testing?"- run: npm test":""}
1195
-
1196
- - run: npm run lint
1197
-
1198
- deploy:
1199
- needs: test
1200
- runs-on: ubuntu-latest
1201
- if: github.ref == 'refs/heads/main'
1202
-
1203
- steps:
1204
- - uses: actions/checkout@v3
1205
-
1206
- - name: Use Node.js 18.x
1207
- uses: actions/setup-node@v3
1208
- with:
1209
- node-version: 18.x
1210
- cache: 'npm'
1211
-
1212
- - run: npm ci
1213
-
1214
- ${t.template==="serverless"?"- run: npm run deploy":"# Add your deployment steps here"}`,m=()=>{s<o.length-1&&i(s+1)},x=()=>{s>0&&i(s-1)},y=()=>{switch(s){case 0:return t.name&&t.description;case 1:return t.template;case 2:return t.database;default:return!0}},w=()=>{var S;switch(s){case 0:return r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Project Information"}),r.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Project Name *"}),r.jsx("input",{type:"text",value:t.name,onChange:C=>a("name",C.target.value),placeholder:"my-frigg-project",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description *"}),r.jsx("textarea",{value:t.description,onChange:C=>a("description",C.target.value),placeholder:"Brief description of your project",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]})]});case 1:return r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Choose Project Template"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(na).map(([C,k])=>r.jsxs(B,{className:`cursor-pointer transition-all p-4 ${t.template===C?"border-blue-500 bg-blue-50":"hover:border-gray-300"}`,onClick:()=>a("template",C),children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsx("h4",{className:"font-medium",children:k.name}),r.jsx("input",{type:"radio",checked:t.template===C,onChange:()=>a("template",C),className:"mt-1"})]}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:k.description}),r.jsx("div",{className:"space-y-1",children:k.features.map((T,N)=>r.jsxs("div",{className:"text-xs text-gray-500 flex items-center",children:[r.jsx("span",{className:"w-1 h-1 bg-gray-400 rounded-full mr-2"}),T]},N))})]},C))})]});case 2:return r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Database Configuration"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:uu.map(C=>r.jsxs(B,{className:`cursor-pointer transition-all p-4 ${t.database===C.value?"border-blue-500 bg-blue-50":"hover:border-gray-300"}`,onClick:()=>a("database",C.value),children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsx("h4",{className:"font-medium",children:C.label}),r.jsx("input",{type:"radio",checked:t.database===C.value,onChange:()=>a("database",C.value),className:"mt-1"})]}),r.jsx("p",{className:"text-sm text-gray-600",children:C.description})]},C.value))})]});case 3:return r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Select Integrations"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Choose the integrations you want to include in your project."}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:Hx.map(C=>r.jsx("div",{className:`border rounded p-3 cursor-pointer transition-all ${t.integrations.includes(C.id)?"border-blue-500 bg-blue-50":"hover:border-gray-300"}`,onClick:()=>c(C.id),children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm",children:C.name}),r.jsx("p",{className:"text-xs text-gray-500",children:C.category})]}),r.jsx("input",{type:"checkbox",checked:t.integrations.includes(C.id),onChange:()=>c(C.id)})]})},C.id))})]});case 4:return r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Additional Features"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Enable additional features for your project."}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(t.features).map(([C,k])=>r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium capitalize",children:C.replace(/([A-Z])/g," $1")}),r.jsxs("p",{className:"text-sm text-gray-500",children:[C==="authentication"&&"JWT-based authentication system",C==="logging"&&"Winston logging configuration",C==="monitoring"&&"Health checks and metrics",C==="testing"&&"Jest testing framework",C==="docker"&&"Docker and docker-compose files",C==="ci"&&"GitHub Actions CI/CD pipeline"]})]}),r.jsx("input",{type:"checkbox",checked:k,onChange:()=>l(C)})]},C))})]});case 5:return r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Deployment Configuration"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Platform"}),r.jsxs("select",{value:t.deployment.platform,onChange:C=>a("deployment",{...t.deployment,platform:C.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"aws",children:"AWS"}),r.jsx("option",{value:"gcp",children:"Google Cloud"}),r.jsx("option",{value:"azure",children:"Microsoft Azure"}),r.jsx("option",{value:"heroku",children:"Heroku"}),r.jsx("option",{value:"vercel",children:"Vercel"}),r.jsx("option",{value:"netlify",children:"Netlify"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Environment"}),r.jsxs("select",{value:t.deployment.environment,onChange:C=>a("deployment",{...t.deployment,environment:C.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"development",children:"Development"}),r.jsx("option",{value:"staging",children:"Staging"}),r.jsx("option",{value:"production",children:"Production"})]})]})]}),r.jsxs("div",{className:"bg-blue-50 p-4 rounded-md",children:[r.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Project Summary"}),r.jsxs("div",{className:"text-sm text-blue-800 space-y-1",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Name:"})," ",t.name]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Template:"})," ",na[t.template].name]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Database:"})," ",(S=uu.find(C=>C.value===t.database))==null?void 0:S.label]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Integrations:"})," ",t.integrations.length>0?t.integrations.join(", "):"None"]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Features:"})," ",Object.entries(t.features).filter(([,C])=>C).map(([C])=>C).join(", ")]})]})]})]});default:return null}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Project Scaffold Wizard"}),r.jsx("div",{className:"flex items-center justify-between mb-8",children:o.map((S,C)=>r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium ${C<=s?"bg-blue-600 text-white":"bg-gray-200 text-gray-500"}`,children:C+1}),r.jsxs("div",{className:"ml-2 text-sm",children:[r.jsx("div",{className:`font-medium ${C<=s?"text-blue-600":"text-gray-500"}`,children:S.title}),r.jsx("div",{className:"text-gray-400 text-xs",children:S.description})]}),C<o.length-1&&r.jsx("div",{className:`w-16 h-px mx-4 ${C<s?"bg-blue-600":"bg-gray-200"}`})]},C))}),r.jsx(B,{className:"p-6",children:w()}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx(V,{variant:"outline",onClick:x,disabled:s===0,children:"Previous"}),s===o.length-1?r.jsx(V,{onClick:u,className:"bg-green-600 hover:bg-green-700",children:"Generate Project"}):r.jsx(V,{onClick:m,disabled:!y(),children:"Next"})]})]})},gL=({code:e,metadata:t,onChange:n})=>{const[s,i]=g.useState(null),[o,a]=g.useState({}),[l,c]=g.useState(!0),u=g.useMemo(()=>t!=null&&t.files?t.files:typeof e=="string"?[{name:"index.js",content:e}]:typeof e=="object"&&e!==null?Object.entries(e).map(([m,x])=>({name:m.endsWith(".js")?m:`${m}.js`,content:typeof x=="string"?x:JSON.stringify(x,null,2)})):[],[e,t]);We.useEffect(()=>{u.length>0&&!s&&i(u[0].name)},[u,s]);const d=g.useCallback((m,x)=>{if(a(y=>({...y,[m]:x})),n){const y=u.map(w=>w.name===m?{...w,content:x}:w);n(y)}},[u,n]),f=g.useCallback(m=>{var x;return o[m]??((x=u.find(y=>y.name===m))==null?void 0:x.content)??""},[o,u]),p=m=>{var y;switch((y=m.split(".").pop())==null?void 0:y.toLowerCase()){case"js":return"📄";case"json":return"📋";case"md":return"📝";case"yml":case"yaml":return"⚙️";case"env":return"🔐";default:return"📄"}},b=m=>{var y;switch((y=m.split(".").pop())==null?void 0:y.toLowerCase()){case"js":return"javascript";case"json":return"json";case"md":return"markdown";case"yml":case"yaml":return"yaml";case"env":return"bash";default:return"text"}},j=(m,x)=>x==="javascript"?m.replace(/(\/\/.*$)/gm,'<span style="color: #008000;">$1</span>').replace(/(\/\*[\s\S]*?\*\/)/g,'<span style="color: #008000;">$1</span>').replace(/\b(const|let|var|function|class|if|else|for|while|return|import|export|require|module)\b/g,'<span style="color: #0000FF;">$1</span>').replace(/(['"`])((?:(?!\1)[^\\]|\\.)*)(\1)/g,'<span style="color: #A31515;">$1$2$3</span>'):m,v=m=>{const x=f(m),y=new Blob([x],{type:"text/plain"}),w=URL.createObjectURL(y),S=document.createElement("a");S.href=w,S.download=m,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(w)},h=()=>{const x=u.map(C=>({name:C.name,content:f(C.name)})).map(C=>`// File: ${C.name}
1215
- ${C.content}`).join(`
1216
-
1217
- `+"=".repeat(50)+`
1218
-
1219
- `),y=new Blob([x],{type:"text/plain"}),w=URL.createObjectURL(y),S=document.createElement("a");S.href=w,S.download=`${(t==null?void 0:t.name)||"generated-code"}.txt`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(w)};return u.length===0?r.jsx(B,{className:"p-8",children:r.jsxs("div",{className:"text-center text-gray-500",children:[r.jsx("svg",{className:"w-12 h-12 mx-auto mb-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),r.jsx("p",{children:"No code generated yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Configure your settings and generate code to see a preview"})]})}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Code Preview & Editor"}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsxs("div",{className:"flex border rounded-md",children:[r.jsx("button",{onClick:()=>c(!0),className:`px-3 py-1 text-sm ${l?"bg-blue-600 text-white":"text-gray-600"}`,children:"Preview"}),r.jsx("button",{onClick:()=>c(!1),className:`px-3 py-1 text-sm ${l?"text-gray-600":"bg-blue-600 text-white"}`,children:"Edit"})]}),r.jsx(V,{onClick:h,size:"sm",children:"Download All"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4",children:[r.jsx("div",{className:"lg:col-span-1",children:r.jsxs(B,{className:"p-4",children:[r.jsxs("h4",{className:"font-medium mb-3",children:["Files (",u.length,")"]}),r.jsx("div",{className:"space-y-1",children:u.map(m=>r.jsxs("div",{onClick:()=>i(m.name),className:`flex items-center justify-between p-2 rounded cursor-pointer transition-colors ${s===m.name?"bg-blue-100 text-blue-800":"hover:bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("span",{className:"mr-2",children:p(m.name)}),r.jsx("span",{className:"text-sm truncate",children:m.name})]}),r.jsx("button",{onClick:x=>{x.stopPropagation(),v(m.name)},className:"text-gray-400 hover:text-gray-600",title:"Download file",children:r.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3M3 17V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2z"})})})]},m.name))})]})}),r.jsx("div",{className:"lg:col-span-3",children:s&&r.jsxs(B,{className:"p-0 overflow-hidden",children:[r.jsxs("div",{className:"bg-gray-50 px-4 py-2 border-b flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("span",{className:"mr-2",children:p(s)}),r.jsx("span",{className:"font-medium",children:s}),r.jsxs("span",{className:"ml-2 text-sm text-gray-500",children:["(",b(s),")"]})]}),r.jsxs("div",{className:"text-sm text-gray-500",children:[f(s).split(`
1220
- `).length," lines"]})]}),r.jsx("div",{className:"p-0",children:l?r.jsx("pre",{className:"p-4 bg-gray-900 text-gray-100 overflow-x-auto text-sm",children:r.jsx("code",{dangerouslySetInnerHTML:{__html:j(f(s),b(s))}})}):r.jsx("textarea",{value:f(s),onChange:m=>d(s,m.target.value),className:"w-full h-96 p-4 font-mono text-sm border-0 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500",style:{tabSize:2}})})]})})]}),r.jsxs(B,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Generation Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-2xl font-bold text-blue-600",children:u.length}),r.jsx("div",{className:"text-sm text-gray-500",children:"Files"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-2xl font-bold text-green-600",children:u.reduce((m,x)=>m+f(x.name).split(`
1221
- `).length,0)}),r.jsx("div",{className:"text-sm text-gray-500",children:"Lines"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-2xl font-bold text-purple-600",children:[Math.round(u.reduce((m,x)=>m+f(x.name).length,0)/1024),"K"]}),r.jsx("div",{className:"text-sm text-gray-500",children:"Characters"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:(t==null?void 0:t.type)||"Generated"}),r.jsx("div",{className:"text-sm text-gray-500",children:"Type"})]})]})]}),(t==null?void 0:t.validationErrors)&&t.validationErrors.length>0&&r.jsxs(B,{className:"p-4 border-red-200 bg-red-50",children:[r.jsx("h4",{className:"font-medium text-red-800 mb-2",children:"Validation Errors"}),r.jsx("ul",{className:"list-disc list-inside text-sm text-red-700 space-y-1",children:t.validationErrors.map((m,x)=>r.jsx("li",{children:m},x))})]}),r.jsxs(B,{className:"p-4 bg-blue-50 border-blue-200",children:[r.jsx("h4",{className:"font-medium text-blue-800 mb-2",children:"💡 Tips"}),r.jsxs("ul",{className:"text-sm text-blue-700 space-y-1",children:[r.jsx("li",{children:"• Switch between Preview and Edit modes to review or modify generated code"}),r.jsx("li",{children:"• Download individual files or all files as a bundle"}),r.jsx("li",{children:"• Changes made in edit mode will be included in the final generation"}),r.jsx("li",{children:"• Use the file explorer to navigate between generated files"})]})]})]})},Mn={API_MODULE:"api-module",API_ENDPOINT:"api-endpoint",PROJECT_SCAFFOLD:"project-scaffold",CUSTOM:"custom"},xL=()=>{const[e,t]=g.useState("select-type"),[n,s]=g.useState(null),[i,o]=g.useState(null),[a,l]=g.useState({}),c=[{id:"select-type",title:"Select Generation Type"},{id:"configure",title:"Configure Options"},{id:"preview",title:"Preview & Edit"},{id:"generate",title:"Generate Files"}],u=g.useCallback(v=>{s(v),t("configure")},[]),d=g.useCallback((v,h,m)=>{o(h),l(m),t("preview")},[]),f=g.useCallback(v=>{o(v)},[]),p=g.useCallback(async()=>{try{const v=await fetch("/api/codegen/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:n,code:i,metadata:a})});if(v.ok){const h=await v.json();alert(`Code generated successfully! Files created: ${h.files.join(", ")}`),t("select-type"),s(null),o(null),l({})}else throw new Error("Failed to generate code")}catch(v){console.error("Generation error:",v),alert("Failed to generate code. Please try again.")}},[n,i,a]),b=()=>r.jsx("div",{className:"flex items-center justify-center mb-8",children:c.map((v,h)=>r.jsxs(We.Fragment,{children:[r.jsxs("div",{className:`flex items-center ${v.id===e?"text-blue-600":c.findIndex(m=>m.id===e)>h?"text-green-600":"text-gray-400"}`,children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center border-2 ${v.id===e?"border-blue-600 bg-blue-50":c.findIndex(m=>m.id===e)>h?"border-green-600 bg-green-50":"border-gray-300 bg-gray-50"}`,children:c.findIndex(m=>m.id===e)>h?r.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):r.jsx("span",{className:"text-sm font-medium",children:h+1})}),r.jsx("span",{className:"ml-2 text-sm font-medium",children:v.title})]}),h<c.length-1&&r.jsx("div",{className:"w-16 h-px bg-gray-300 mx-4"})]},v.id))}),j=()=>{switch(e){case"select-type":return r.jsxs("div",{className:"space-y-6",children:[r.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:"What would you like to generate?"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(B,{className:"cursor-pointer hover:shadow-lg transition-shadow p-6",onClick:()=>u(Mn.API_MODULE),children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mx-auto mb-4",children:r.jsx("svg",{className:"w-6 h-6 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"API Module"}),r.jsx("p",{className:"text-gray-600",children:"Generate an API wrapper class for external service communication with authentication and credential storage"})]})}),r.jsx(B,{className:"cursor-pointer hover:shadow-lg transition-shadow p-6",onClick:()=>u(Mn.API_ENDPOINT),children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mx-auto mb-4",children:r.jsx("svg",{className:"w-6 h-6 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.367 2.684 3 3 0 00-5.367-2.684z"})})}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"API Endpoints"}),r.jsx("p",{className:"text-gray-600",children:"Create REST API endpoints with schemas, validation, and documentation"})]})}),r.jsx(B,{className:"cursor-pointer hover:shadow-lg transition-shadow p-6",onClick:()=>u(Mn.PROJECT_SCAFFOLD),children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mx-auto mb-4",children:r.jsx("svg",{className:"w-6 h-6 text-purple-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"})})}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Project Scaffold"}),r.jsx("p",{className:"text-gray-600",children:"Create a complete Frigg backend project with integrations and configuration"})]})}),r.jsx(B,{className:"cursor-pointer hover:shadow-lg transition-shadow p-6",onClick:()=>u(Mn.CUSTOM),children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center mx-auto mb-4",children:r.jsxs("svg",{className:"w-6 h-6 text-orange-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Custom Template"}),r.jsx("p",{className:"text-gray-600",children:"Use custom templates or modify existing ones to fit your specific needs"})]})})]})]});case"configure":return r.jsxs("div",{children:[n===Mn.API_MODULE&&r.jsx(fL,{onGenerate:d}),n===Mn.API_ENDPOINT&&r.jsx(hL,{onGenerate:d}),n===Mn.PROJECT_SCAFFOLD&&r.jsx(pL,{onGenerate:d}),n===Mn.CUSTOM&&r.jsx(lL,{onGenerate:d})]});case"preview":return r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Preview & Edit Generated Code"}),r.jsx(gL,{code:i,metadata:a,onChange:f}),r.jsxs("div",{className:"flex justify-between mt-6",children:[r.jsx(V,{variant:"outline",onClick:()=>t("configure"),children:"Back to Configuration"}),r.jsx(V,{onClick:p,className:"bg-green-600 hover:bg-green-700",children:"Generate Files"})]})]});default:return null}};return r.jsxs("div",{className:"max-w-6xl mx-auto p-6",children:[r.jsxs("div",{className:"mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold text-center mb-2",children:"Code Generation Wizard"}),r.jsx("p",{className:"text-gray-600 text-center",children:"Generate integrations, APIs, and scaffolds with visual tools"})]}),b(),r.jsx(B,{className:"p-8",children:j()})]})},yL=()=>r.jsx("div",{className:"min-h-screen bg-gray-50",children:r.jsx("div",{className:"py-8",children:r.jsx(xL,{})})});function vL(){const{currentRepository:e,isLoading:t}=Mt(),n=Ds();return t?r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Initializing Frigg Management UI..."})]})}):e?e&&(n.pathname==="/welcome"||n.pathname==="/")?r.jsx(Tp,{to:"/dashboard",replace:!0}):r.jsx(aj,{children:r.jsxs(nC,{children:[r.jsx(et,{path:"/welcome",element:r.jsx(Bx,{})}),r.jsx(et,{path:"/",element:r.jsx(Tp,{to:"/dashboard"})}),r.jsx(et,{path:"/dashboard",element:r.jsx(OO,{})}),r.jsx(et,{path:"/integrations",element:r.jsx(LO,{})}),r.jsx(et,{path:"/integrations/discover",element:r.jsx(DO,{})}),r.jsx(et,{path:"/integrations/:integrationName/configure",element:r.jsx(FO,{})}),r.jsx(et,{path:"/integrations/:integrationName/test",element:r.jsx($O,{})}),r.jsx(et,{path:"/environment",element:r.jsx(HO,{})}),r.jsx(et,{path:"/users",element:r.jsx(KO,{})}),r.jsx(et,{path:"/connections",element:r.jsx(JO,{})}),r.jsx(et,{path:"/simulation",element:r.jsx(eL,{})}),r.jsx(et,{path:"/monitoring",element:r.jsx(oL,{})}),r.jsx(et,{path:"/code-generation",element:r.jsx(yL,{})})]})}):r.jsx(Bx,{})}class bL extends We.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("ErrorBoundary caught an error:",t,n),this.setState({error:t,errorInfo:n})}render(){return this.state.hasError?this.props.fallback?this.props.fallback:r.jsx("div",{className:"min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8",children:r.jsx("div",{className:"sm:mx-auto sm:w-full sm:max-w-md",children:r.jsx("div",{className:"bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100",children:r.jsx("svg",{className:"h-6 w-6 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),r.jsx("h3",{className:"mt-4 text-lg font-medium text-gray-900",children:"Something went wrong"}),r.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"An unexpected error occurred. Please refresh the page and try again."}),!1,r.jsx("div",{className:"mt-6",children:r.jsx("button",{onClick:()=>window.location.reload(),className:"w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Reload page"})})]})})})}):this.props.children}}function wL(){return r.jsx(bL,{children:r.jsx(H3,{defaultTheme:"system",children:r.jsx(ok,{children:r.jsx(DE,{children:r.jsx(cC,{children:r.jsx(vL,{})})})})})})}du.createRoot(document.getElementById("root")).render(r.jsx(We.StrictMode,{children:r.jsx(wL,{})}));